Commit graph

210 commits

Author SHA1 Message Date
Marco Beretta
b24226672d
🌊 perf: Trim Per-Token and Per-Render Work in Streaming and Lists (#16718)
* perf: Trim Per-Token and Per-Render Work in Streaming and Lists

* test: Assert Rendered Diff Rows Alongside Render Counts

* refactor: Read the Active Sidebar Row Through the Existing Index Selector

Drops the new Recoil selector: conversationIdByIndex(0) already yields a primitive id, so rows still skip re-renders on every conversation write. The DiffView row test keeps the real cn behind a spy and derives the per-row cost from the first render.

* test: Cover the Sidebar Active Row Across Chat Switches and New Chat
2026-10-03 10:40:55 -04:00
Marco Beretta
2ea44e0d67
fix: Layer Settings Dialog Popovers Above Its Panel (#16720)
The Settings dialog is a Headless UI panel at z-50, not an OGDialog, so it set no dialog depth and its Select lists kept their z-40 layer, opening invisibly behind the panel. A new DialogLayer counts it as one dialog level, so popovers inside it take the depth-aware z-index they get inside an OGDialog.
2026-10-03 15:47:53 +02:00
Marco Beretta
f156160c99
📏 feat: Size Roles for the Select List (#16714)
* feat: Size Roles for the Select List

The Select list drew a fixed max-h-96 and min-w-[8rem], the last hard-coded sizes among the ten shared primitives. They are now the listMaxHeight and listMinWidth appearance roles, defaulting to 24rem and 8rem. The ClickHouse theme sizes the list by its trigger and keeps the 24rem cap, since Click UI caps it only at the viewport's available height.

* test: Resize the Select List From a Reference Theme
2026-10-03 15:25:23 +02:00
Marco Beretta
47b525ebc2
📌 test: Re-Pin Click UI Drift Guard to v0.13.0 and Probe the Checkbox- #16706 (#16706)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
2026-10-03 13:07:42 +02:00
Marco Beretta
4e325f184c
🎚️ refactor: Drop Inline Pointer Styles From Select and Menu Primitives (#16704)
* refactor: Move Select and Menu Pointer Events to Classes

DropdownPopup and SelectContent re-enabled pointer events inside modal dialogs through inline style, which kept a no-inline-styles suppression on both primitives. Both now apply pointer-events-auto as a class and keep only the runtime z-index inline. The Select item indicator box takes the icon size role instead of a fixed h-3.5 w-3.5.

* test: Cover Popover Picks Inside Modal Dialogs

* test: Open Settings From the Drawer and Tag Indicator Scenarios

* test: Let Each Verify Project Set the Color Mode

* test: Measure the Select Indicator After the List Settles

* test: Drop the Settings Select Pick That Never Reached a Dialog
2026-10-03 12:57:18 +02:00
Marco Beretta
a2b184b231
🖍️ fix: Read Theme Roles for the Last Artifact and Agent Chip Colours (#16705)
* fix: Read Theme Roles for the Last Artifact and Agent Chip Colours

The artifact mobile backdrop now reads surface-overlay like the dialog scrims, the refresh overlay over the rendered preview reads surface-media-overlay, and the agent builder's provider chip reads surface-primary and text-primary like the conversation icon chip. Monaco's built-in vs-dark canvas joins the third-party surfaces allowlist entry, and the allowlist no longer points at a closed sweep issue.

* test: Cover Theme Roles on the Provider Chip and Artifact Overlays
2026-10-03 12:56:45 +02:00
Danny Avila
c945cafa34
🏃 fix: List Every Running Chat in the Sidebar's Running Group (#16668)
* 🏃 fix: List Every Running Chat in the Sidebar's Running Group

The Running group partitioned the Chats list's own rows, so a running chat
filed in a project, a pinned chat, or one past the loaded pages never
appeared in it. Running chats the loaded rows do not hold are now fetched
by id and merged in newest first, with a project badge on filed chats.
Narrowed lists (search, filters, facets, archive) keep only their own rows.

* fix: Keep Fetched Running Rows Current, Accessible, and Scoped

- Fetch only under the newest-first sort that shows the Running group.
- Re-ask within two seconds for a record not written yet, so a short
  run is not missed; keep the 15-second refresh once it exists.
- Leave archived chats out of Running.
- Patch and clear the fetched rows through updateConvoInAllQueries and
  removeConvoFromAllQueries, so renames, pins and removals show at once.
- Carry the shared-link state the list endpoints derive.
- Seed an empty conversation cache with the fetched record for navigation.
- Describe the focusable row with its project name.

* fix: Preserve Running Chat Cache Updates and Picker Keyboard Activation

* fix: Open the Assistant Picker Through Its Supported Keyboard Handler

* test: Keep SSE Cleanup Query Client Cancellation Compatible

* fix: Keep Temporary Chats Out of the Running Sidebar

* fix: Preserve Running Rows Across Initial Fetch Cancellation

* fix: Preserve Running Removal and Server Read Authority

* fix: Record Running Removal Before Query Creation

* test: Type Running Query Regression Props Explicitly

* fix: Keep Chat Settings Out of Running Sidebar Rows

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-02 20:28:02 -04:00
Marco Beretta
2d35614a0c
🧭 feat: Give the Mobile Drawer Edge a Role and Move the Last Page Colours Onto Roles (#16631)
* feat: Give the Mobile Drawer Edge a Role and Move the Last Page Colours Onto Roles

The mobile drawer drew its edge with dark-only border utilities, the web source caption with gray-900 and white, the prompt panel's mobile backdrop with black at 20%, and the Insights agent picker popover with a dark-only override, so no theme could reach them.

drawer-edge paints the drawer's trailing edge: the drawer's own fill in light, where the scrim already separates it, and border-xheavy in dark, so dark mode keeps today's edge; a theme that sets only those two roles keeps the edge its mode drew. The source caption reads the media overlay roles, the prompt panel backdrop takes the page scrim the mobile drawer uses, and MultiSelect gains a widget surface that the Insights picker uses in place of its dark override.

* test: Pin the Drawer Edge Role in Both Modes and Under a Theme

* test: Write the Drawer Edge Scenario Tags Out Whole

* fix: Type the Drawer Edge Fallback So the Theme Resolver Stays Checkable

resolveTheme spreads every role fallback into one object literal, and each untyped conditional spread doubles the union the checker builds. One more pushed tsc for packages/client past CI's 6 GB heap. Typing the fallback as Partial<IThemeRGB> keeps it from adding to that union; a full check now peaks at about 4 GB.
2026-10-03 00:28:08 +02:00
Marco Beretta
fc05ea3946
🙋 feat: Refine the Ask Question Card and Smooth Batched Question Steps (#16641)
* feat: Refine the Ask Question Surfaces and Drop the Stop Shortcut Hint

* feat: Smooth Step Changes in Batched Questions With Numbered Option Rows

* fix: Swap Batched Question Answers Instantly While the Height Eases

* fix: Keep the Batch Card's Place in the Thread and the Answer Placeholder While Locked

* feat: Instant Option Row Hover and Typed Answers Replace Choices

* style: Fade Option Rows Slowly When They Lock

* feat: Swap Batched Questions Instantly While Only the Height Eases

* fix: Ease the Batch Status Lines and Keep Question Controls Unselectable

* fix: Stop the Batch Answer Area From Showing a Scrollbar

* fix: Keep the Locked Composer Placeholder Out of Text Selection

* feat: Check Mark on a Chosen Single-Select Answer

* feat: Turn the Question Move Chevron During the Composer and Chat Morph

* fix: Ease Only the Batch Card's Outer Height When Switching Questions

* fix: Pin the Batch Header and Buttons to the Card Edges While Its Height Eases

* fix: Confirm Batch Answers on Enter, Bound Long Prompts, and Keep the Form on Jotai

* test: Scenarios for Batched Ask Question Answers

* test: Pause the Fake Model on a Real Question Batch for the Ask Scenarios

* test: Run the Ask Scenarios in a Desktop Context

* fix: Cap the Batch Question Popover to the Viewport

* fix: Scroll the Capped Batch Card, Guard IME Enter, and Keep Focus on the Next Question
2026-10-02 23:14:08 +02:00
Marco Beretta
448ab4a411
🧰 style: Hover-Revealed Tool Output Copy, Full Output, and a Virtualized My Files Table (#16640)
* perf: Virtualize the My Files Table

* fix: Even Bottom Spacing Under the Compact Context Button

* feat: Overlay Tool Output Copy Actions and Show Full Output

* fix: Scroll the Virtualized My Files Table Itself and Expose Row Positions

* test: Scenarios for Tool Output Copy Reveal and Full Output

* test: Tab Through the Output Box to Reach the Copy Action

* fix: Open Terminal Output on Its Last Lines

* fix: Follow Streamed Terminal Output Only While the Reader Is at the Bottom
2026-10-02 18:24:18 +02:00
Marco Beretta
7baa814868
📐 feat: Size Roles for the Shared Primitives (#16617)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
* feat: Size roles for the shared primitives

Button's xs, lg and icon squares, the large title input, the checkbox, menu, select and dialog icons and the switch's hit area read new size roles whose defaults are the fixed sizes they drew, and the menu row corner reads radiusLg. The ClickHouse theme takes Click UI's single button size, its small icon button and its checkbox and icon sizes. A spec pins the strict count of theme-driven primitives at eight of ten and what the other two still hard-code.

* fix: Hold the switch hit area to the target minimum in width and scan stylesheet colors

* test: Read every raw palette hue in the primitive guard

* test: Exempt only theme role fallbacks in the primitive guard

* feat: Tab minimum width role and a wider fixed-size guard

The primitive guard now also reads absolute arbitrary sizes, ring-offset palettes and 4 and 8 digit hex colors. The Tabs trigger's 100px minimum becomes the tabMinWidth role, which the ClickHouse theme sets to 0 so tabs size by their label as in Click UI.

* fix: Keep app icon buttons and their companions on the button size role

The passkey rename input keeps the field height, and the agent builder panel headers size their back button and balancing spacer from size-theme-button, so a theme that changes the button height keeps those rows aligned.

* fix: Size menu glyphs from the icon role and floor touch targets at the minimum target size

* fix: Let menu glyphs fill their slot and keep the dialog close target at the minimum size

* test: Probe the menu glyph inside a flex row, as DropdownPopup renders it

* fix: Hold icon button squares to the minimum target size

* fix: Bound the icon and checkbox size roles to the room their layouts leave

iconSize takes 0.75 to 1.25rem, iconSizeLg 1 to 2rem and checkboxSize 1 to 1.5rem, so a theme can retune them without shrinking a checkbox below the box it was or pushing an icon past the inset it sits in.

* fix: Hold the icon-only Dropdown and header spacers to the minimum target size

* fix: Floor the button size roles at the target minimum and let callers replace the control height

* test: Move the unknown appearance markers off the new title field height

* fix: Size the compact step, the exported Dialog and the combobox icons from roles

The Button and Dropdown compact recipes read a buttonHeightCompact role, the exported Dialog's action buttons and close glyph read buttonHeight and a bounded iconSizeMd, Combobox icons follow iconSize, and the checkbox callers drop their fixed sizes so checkboxSize reaches them. minTargetSize may no longer exceed buttonHeight or fieldHeight, so the target floor never pulls icon buttons out of line with the fields beside them.

* fix: Size the collapsed Combobox square from the control height role

* fix: Hold every Button size and the collapsed Combobox to the target minimum

* fix: Let section header buttons keep their own text height

* test: Treat a zero size as a reset in the primitive guard

* fix: Enforce the target size at the roles instead of on every Button

A minimum height on every Button size grew callers that draw a smaller control on purpose, such as the sortable table header (h-auto) and the 20px artifact and attachment row actions. The floors come off the Button sizes and icon squares; a theme that sets minTargetSize may instead not size any button or field below it, and the new Button size roles keep their 24px floor.

* fix: Check the control and large field heights against the target floor

* fix: Hold the target floor at a fixed 24px and floor the large field height

* fix: Keep the passkey rename field on the button height and drop the fixed MCP checkbox size

* fix: Size the Combobox check glyph from the icon role and scope the README floor claim
2026-10-02 11:03:19 +02:00
Marco Beretta
557038bd6b
📏 feat: Click UI Spacing and Mono Stack for the ClickHouse Theme (#16616)
* feat: Click UI spacing and mono stack for the ClickHouse theme

The ClickHouse theme sets spaceCompact and spaceNormal from Click UI's spaces.2 and spaces.3 and takes Click UI's mono stack verbatim. The drift guard cites all nine Click UI spaces, each drawn by a spacing role or an equal Tailwind step, and the mono family now compares in full.

* test: Pin the Click UI spaces against the compiled steps and the ClickHouse compact spacing
2026-10-01 23:14:57 +02:00
Marco Beretta
687f69e187
🫗 feat: Field Fill and Ink Theme Roles (#16607)
* feat: Field fill and ink theme roles

Fields ink their value in a new field-text role, which follows text-primary, and a theme whose fieldFillStyle appearance role is fill paints them in a new field-fill role, which follows surface-primary. The default transparent style keeps every field clear, read from the nearest themed root through a style-query variant. The ClickHouse theme fills and inks fields with Click UI's field tokens, which empties the not-expressible list.

* fix: Ink the TimePicker value in the field role and type the field colors

* fix: Keep field ink and state fills over the field fill

Field-variant Dropdown triggers no longer swap to the primary ink on hover, and the field fill variant carries a single class's weight so hover, open and disabled fills paint over it.

* test: Count the field roles beside the media overlay roles

* fix: Type the color fallbacks as one object and keep a disabled field's fill under the pointer

resolveTheme spread about twenty fallbacks typed as role-or-empty unions; each union spread doubled the type checker's work, and the field roles pushed the client typecheck past the CI heap. Typing them as IThemeRGB drops its memory from 3.3GB to 0.65GB. A fill theme with the default dim disabled style also keeps a disabled field's fill under the pointer.
2026-10-01 23:14:37 +02:00
lia-by-librechat[bot]
d2f970910c
🦎 fix: Restore Theme Contrast in Composer and Messages (#16624)
* 🦎 fix: Restore Theme Contrast in Composer and Messages

* Match Sticky Activity Headers to Their Hosting Surface

---------

Co-authored-by: Lia <lia@librechat.ai>
2026-10-01 13:45:24 -04:00
Marco Beretta
345a20fe3a
🪟 feat: Undock the Artifacts Pane into Its Own Window (#15911)
* 🪟 feat: Undock the Artifacts Pane into Its Own Window

The artifacts pane could only live in the chat's side panel, so viewing an
artifact meant giving up half the conversation and there was no way to put it on
a second screen. A header action now moves the pane into a separate browser
window and back.

The pane stays in the chat tab's React tree and is portaled into the popup's
document, so artifacts keep streaming into it and docking back is a re-render
rather than a reload. Everything a portal does not carry is mirrored: the host
stylesheets (re-synced for lazy chunks, HMR and CSSOM-only rules), the resolved
theme, a base URL for relative assets, and Sandpack's frame messages, which
would otherwise never reach the listener the opener installed.

* 🪟 fix: Keep the Artifacts Pane Whole When It Changes Windows

Review of the undock change surfaced one cause behind most of its findings: the
pane is a new component instance in every host, so anything a mount decides was
lost or wrongly reset when it moved.

- The code editor buffer now carries the artifact it belongs to, so a remount
  restores unsaved text instead of falling back to the persisted content, and
  the edit the debounce never got to send is handed to the mutation on mount.
  The share hosts take one provider around every branch for the same reason.
- The artifact registry is cleared by the host that owns it: the pane keeps it
  while it only changes windows, and leaving the route wipes it, so no artifact
  follows the user to a shared conversation.
- Fullscreen exits through the document that owns the container, Mermaid pan
  listens where its canvas lives, and Copy reports success only once the write
  resolves, with a toast when it does not.
- Style mirroring compares what a sheet actually contains: rules a page inserts
  through the CSSOM are serialized, and a rewrite the observer saw refreshes its
  clone even when nothing measurable changed.
- A child-activity panel opened while the pane is undocked stays open; the two
  panels are exclusive only while they compete for the side panel.

Adds the scenario suite for the window behaviors (`@scenario:` tagged) plus unit
coverage for the registry lifetime, the panel slot and buffer ownership.

* 🧭 fix: Carry the Artifacts Tab Across a Window Change

The pane's active tab lived in the component instance, so undocking from the
code tab landed the user back on the preview — with their unsaved text out of
sight, which reads as losing it. The tab is pane state now, next to the editor
buffer it belongs with, and the scenario asserts both survive the move.

* 🧹 chore: Drop Unused Imports From the Presentation Spec

* 🎯 fix: Bound the Artifacts Pane's Shared State to Its Session

The second review round found the cost of state that outlives an instance, all
in the seams the first round opened.

- Download now reads the editor buffer only when it belongs to the artifact on
  screen, so selecting another artifact cannot export the previous one's edits.
- The active tab is reset when the pane session ends — close or conversation
  change — instead of following a later artifact onto the code tab.
- A mutation started by a previous pane instance can no longer report back, so
  the mount releases the stale "mutating" flag before handing over the restored
  text; otherwise the edit queued behind a completion that never arrives.
- The undocked window's size and position are read while it still has them, in
  its `pagehide`, so closing through the browser remembers the bounds too.
- Docking from the window moves focus to the control that replaces the one the
  user pressed, which a keyboard user otherwise loses to the document.
- The share host keeps one `EditorProvider` mounted across the closed and open
  branches, so opening the overlay no longer remounts the transcript.

* 🎨 fix: Paint the Undocked Window Before Its Sheet Arrives

A mirrored stylesheet is a fetch, so the popup showed its default white canvas
for that moment — plain against a dark app, and visible to the scenario as a
transparent pane. The host's resolved surface colour is now the `var()`
fallback in the popup's own layout sheet, so the window opens on the app's
canvas and the real token takes over when it lands.

The two scenarios that read settled state — the painted canvas, and a keyboard
Enter that closes the window it was pressed in — now wait for it instead of
sampling the first frame.

* 🔭 fix: Focus the Dock Target Once the Pane Has Mounted\n\nThe focus handoff ran before the pane rendered its toolbar, so the control it\nwas meant to focus did not exist yet and the request was never spent. It now\nwaits for the mount that creates that control.

* 🧩 fix: Give the Edit Pipeline and the Transcript One Owner Each

Round three found the same shape three more times: work that belongs to a
session was still decided by an instance or by a branch.

- The editor no longer infers whether a previous instance's save is running.
  React Query keeps a mutation's callbacks on the mutation, so that request
  settles the shared flag itself; the new instance waits for idle and submits
  the restored buffer once, instead of clearing a flag it does not own and
  resubmitting against an `original` the earlier request may have replaced.
- The shared conversation keeps its transcript in one place — always the first
  panel of the resizable group — so opening the pane, undocking it or docking
  it again changes only the pane's host, not the transcript's ancestry.
- The clipboard fallback runs in the pane's own document, so an undocked pane
  on a deployment without the Clipboard API can still copy instead of only
  reporting failure.

* 🧷 fix: Tie the Editor Buffer and Focus to the Pane Session

Round four found the last places where the retained buffer and the focus
handoff were decided by a code path rather than by the session boundary.

- Closing the pane discards the buffer, the tab and any pending focus request,
  so reopening an artifact starts from what is saved instead of restoring — and
  silently resubmitting — text the user abandoned.
- Only the buffer an instance inherits at mount is drained. Navigating back to
  an artifact restores its own unsaved text in the editor instead of writing
  the persisted content over it, which used to queue that content behind the
  edit and undo it.
- Closing the window through the browser hands focus back exactly as the Dock
  control does, rather than leaving a keyboard user on the document body.
- The clipboard fallback restores focus by capability rather than `instanceof`,
  which never matches across the popup's realm.

* 🔐 fix: Make Undocking Configurable and Its Saves Session-Bound

- `interface.artifactUndocking` is a `configSchema` field, default enabled, so a
  deployment that cannot use popups keeps the docked pane. The hosts resolve it
  — the chat host from the startup config, the shared host from the shared-link
  config, which now carries the flag — and hand it to the pane through the
  context it already takes, rather than the pane reading config itself.
- A save carries the editing session it was started in. React Query keeps its
  callbacks after the editor is gone, and those callbacks used to write the
  buffer a closed session had just cleared and submit its queued edit; they now
  stop at a session boundary, so a closed pane mutates nothing and leaves no
  text behind for the next one.

* ✂️ fix: Stop the Editor from Overwriting Another Artifact's Unsaved Text

- A write this component makes into the Monaco model comes back through
  `onChange` exactly like a keystroke. Restoring an artifact's text therefore
  looked like typing and keyed the shared buffer to the artifact now on
  screen — so selecting another artifact before the debounce fired replaced
  the text the first one was still holding, and returning to it showed the
  persisted content. The value written here is now recognised and consumed,
  and the retained buffer is sent deliberately when its artifact comes back,
  which is where its cancelled debounce finally becomes a save.
- The save lock is the session's, not a request's. A save that outlives its
  session no longer clears the lock or the failure notice a later session
  took, and ending a session releases it — while an edit typed behind a lock
  whose owner is gone is sent by the editor holding it as soon as the lock is
  free, instead of waiting for the user to type again.

* 🔔 fix: Report Failures in the Window the User Is Looking At

The app's toast surface is mounted once in the chat tab, so a notice raised
from the undocked pane — a copy that no clipboard path accepted, for
instance — appeared in a document nobody was looking at. The window now
carries a Radix toast provider and viewport of its own around the portaled
pane; the toast state is shared, so the same notice is shown wherever the
user is rather than routed by hand at each call site.

* 🚧 fix: Offer Undocking Only Once the Deployment Has Answered

An absent config read as enabled, which is the default, but a config request
in flight reads the same way: a user could undock during that window and the
arriving answer would then take the Dock control away with it. Both hosts now
treat an unanswered config as no capability, and the pane keeps the control
that docks it whenever it is undocked, so a capability that disappears cannot
strand the pane in a window with no way back.

* 🎯 fix: Land Queued Edits, the Config Toggle and Focus on the Window

- A queued edit is sent against the content the artifact actually holds. The
  save that held the lock has already replaced what that edit was typed
  against, so submitting the captured `original` had the endpoint reject the
  newest text and leave it in the buffer alone.
- `interface.artifactUndocking` now survives interface loading:
  `loadDefaultInterface` rebuilds the object property by property, so the flag
  never reached `/api/config` or the shared-link payload and a deployment that
  set `false` still saw the control.
- Undocking hands focus to the pane the way docking already did. The control
  the user pressed goes away with the docked toolbar, so a keyboard user was
  left on the empty document of the window that had just opened; the focus
  request is now a move in either direction, which is what it is named after.

* 🔓 fix: Let the Request Own the Save, Not the Session

The save lock was a flag the editor set and cleared, which gave two ways to
be wrong: a callback whose session had ended cleared a lock the next session
was waiting on, and ending a session released a lock whose request was still
running — so a pane reopened mid-save could start a second read-replace-save
against content the first request was about to change.

The state is now the request's. The artifact save carries a mutation key and
`isMutating` is read from React Query's mutation cache, so it is true exactly
while a save is in flight, whoever started it: nothing to release, nothing to
leave behind, and an editor that appears mid-save queues its edit and sends it
— rebased on the content that landed — once the request settles.

* ⏱️ test: Give the Undocked Preview Time to Compile

* 📌 fix: Rebase a Queued Edit on What the Save Actually Wrote

The artifact registry catches up when the edited message propagates, not when
the save returns, so an edit sent in between was rebased on content the server
had already replaced and the endpoint rejected it. The text the last save wrote
is on the request itself: the drain reads it from the keyed mutation in React
Query's cache and falls back to the registry only when there is no save to
speak of. The same applies to a buffer inherited at mount, which is submitted
against that record too.

* 🧷 fix: Keep the Pane's Tab and Its Storage Off the Instance

Both findings of the review at a03ee0f7 are the same shape as the ones before
them: something the pane needs was reached for where it does not survive.

- The tab is pane state, but the reset that keeps it honest was an instance
  ref. A host change mounts a new pane, so that ref started empty, read the
  artifact already on screen as freshly opened and wrote `preview` back —
  undocking and docking both returned the user to the preview, which reads as
  the code they were editing having been thrown away. The marker moves to the
  atom beside the tab it guards, and ends with the pane session like the rest
  of it. Opening a *different* artifact still returns to the preview.

- `localStorage` was reached for at the call site. A policy that denies Web
  Storage throws from the getter itself, before the guard around `getItem`
  could run, so undocking threw instead of falling back to default bounds and
  the redock and teardown paths threw on their way home — stranding the pane in
  a window whose control the user had just pressed. Both helpers take the window
  and touch storage inside their own guard.

The scenario that should have caught the tab defect asserted `aria-checked`
once, which matches the frame before the reset lands, so it is polled now.

* 🧪 test: Drop the Denied-Storage Scenario the Shell Cannot Support

Verification at c94e5ef showed the scenario asserting a capability LibreChat
does not have: denying Web Storage in the browser replaces the page with the
error boundary ("denied") before the pane's controls are reachable, so the
popup never opened and the test timed out in all three projects.

The finding behind it was about one call site — the pane reaching for
`source.localStorage` outside the guard around its `getItem` — and that stays
fixed and covered by the unit tests in `undockedWindow.spec.ts`, which
reproduce the throwing getter and fail without the fix.

Surviving denied storage app-wide is the shell's problem, not the pane's, and
is tracked at berry-13/LibreChat#41. The spec says why the scenario is absent
so it is not added back.

* 🔗 fix: Match the Artifact Trigger's Name as Dev Now Builds It

The scenarios opened the artifact by its full accessible name, spelled out as
"<title> Click to open". Dev's "Unify Artifact Triggers as Tool Rows" (#15915)
folded the format badge and whether the row renders a preview into that name,
so it now reads "E2E HTML Artifact HTML Opens as a rendered preview Click to
open" and an exact match finds nothing. Every scenario in the file failed at
its first click, three retries deep, which is what pushed the e2e shard past
its 30 minute ceiling.

This did not show up locally because the mock harness serves `client/dist`,
and mine was built before the rebase. The old bundle still rendered the old
name, so the stale locator passed here and failed in CI — and dev's own
`plain-text-artifact-row` spec failed locally for the mirror-image reason.
Both pass against a freshly built client.

The trigger is matched on its title now, the way dev's spec does it, so the
badge and the preview hint can change again without breaking the file.

* 🍞 fix: Share One Toast Viewport Between the App and the Window

The undocked artifacts window needs a toast viewport of its own, and it carried its own copy of the app shell's class list — so any change to toast placement, stacking or width would have had to be made twice, or the popup's notices would drift from the app's.\n\nThe viewport is now one composition in \, rendered by both hosts. It keeps the class list it always had and still takes a \, so the popup can adjust its own placement without forking the primitive.

* 🚫 fix: Keep a Rejected Edit Rejected Across a Host Change

A save the endpoint answers with 400 is deterministic, and the editor already refuses to send that exact text again. The refusal lived in the editor instance while the text itself lives in the shared buffer, so moving the pane to another host — which remounts the editor — dropped the marker and the inherited-buffer drain immediately sent the rejected text back, against the same original that produced the 400. Every dock or undock cost another rejected request, with no new edit from the user.\n\nThe marker now sits beside the buffer it describes, in the editor session, and names the artifact it was recorded for. A remount inherits it; a successful save clears it; ending the session clears it with the buffer. Returning to an artifact no longer resends its rejected text either, for the same reason. A genuine new edit still saves.

* 🧭 fix: Key the Artifact Registry to the Host's Conversation

The guard that bounds the artifact registry to one conversation decided that the conversation had changed by reading the chat tab's Recoil slot, which the shared route never sets. A shared conversation's host stays mounted while the reader moves between shared links, so on that route the change was invisible and only the unmount cleanup ever fired: artifacts from the previous link stayed in the registry, and opening an artifact in the next one could list and navigate back to the previous share's content.\n\nThe identity is now the host's to supply — the chat tab passes its Recoil slot, a shared conversation passes its own id — which is also what keeps the hook from reaching into app-global state for something only its caller knows. The first observed identity still does not wipe, so the loading transition into a shared conversation keeps the artifacts that belong to it.

* 🧪 test: Cover the Shared Host, a Blocked Popup and a Rejected Save

Three paths the pane reaches that no scenario exercised: a shared conversation, whose host resolves the undock capability from the shared-link config; a browser that refuses the popup, where the pane has to stay put and say so; and an edit the endpoint rejected, which must not go back on the wire because the pane changed hosts.

* 📝 docs: Document the Artifact Undocking Toggle in the Example Config

\ reached the schema and the shared-link config without ever appearing in the example file a deployment copies, so the lever existed but was undiscoverable. Documented with the default that reproduces today's behavior.

* 🔐 fix: Make the Undock Capability the Host's Answer, Not a Default

\ filled \ with \ when a host left it out, so a host that forgot would offer a window the deployment may have turned off — the one field in that context with no sensible fallback. It is now required, which makes forgetting it a compile error instead of a capability grant.

* 🕰️ fix: Read an Absent Conversation as Loading, Not as a Switch

The registry guard normalized a missing identity to a sentinel and stored it, so a host that reported nothing for a render — a shared link whose data refetches, a chat tab reading its slot before it is filled — looked like a move to another conversation. The reader lost the artifact they had open, and the same conversation coming back read as a first sighting.\n\nAn absent id is now no news at all: the last real identity stays the one the next id is compared against, so returning to it changes nothing and a real switch still wipes. Reported by Devin review of 097f9bfadd (BUG-0002), which also caught that ShareArtifactsContainer's comment already promised this behavior.

* 🏷️ fix: File a Refused Save Under the Artifact That Was Refused

The rejection marker was written with whichever artifact the pane happened to be showing when the 400 landed. A save answers after the user may have moved on, so a refusal for artifact A filed under artifact B left A free to send the same refused text again as soon as the user came back to it — and cleared B's own marker on A's next success.\n\nThe artifact a save was started for is captured when the request goes out, and both callbacks use it: the refusal names that artifact, and a success clears only that artifact's marker. Reported by Codex on 097f9bfadd.

* 🖥️ fix: Do Not Reopen the Pane on a Monitor That Is Gone

Remembered bounds are coordinates, and they outlive the monitor arrangement that produced them. Undocking takes the pane out of the page along with the only control that docks it, so a window reopened onto a display that no longer exists takes the artifact somewhere the user cannot reach.\n\nThe remembered rectangle is now used only when it can still be reached: it either overlaps this display's work area, or the browser says another display is attached, which is the case the feature exists for. A desktop reporting exactly one display is the only one where the rectangle is provably gone, and there the pane opens at the default bounds. A browser that does not report other displays keeps the user's placement. Reported by Devin review of a85d5c348e (BUG-0001).

* 🪞 fix: Follow a Stylesheet the Host Switches, Not Only Rewrites

The style mirror watched for nodes and text, so a sheet whose attributes changed — a \ switch, a \ flag, a \ that stops it being a stylesheet — left the popup showing styling the host had moved on from, with nothing to bring it back into line.\n\nThose attributes are part of the signature now, the observer watches them, and an update applies them to the clone alongside its content. Reported by Devin review of a853d48c90 (BUG-0002).

* ♻️ fix: Rebase Every Resubmitted Edit on What the Last Save Wrote

An edit replaces whatever the last save wrote, and the artifact registry only catches up when the edited message propagates. Three separate paths resubmit retained text — a queued edit, a buffer inherited at mount, and the edit restored when the user comes back to an artifact — and each had to learn that separately; the restore path had not, so it sent \ as the original, the endpoint refused it with a 400, and the text the user typed never landed.\n\nThe rebase now happens once, where the request is built: \ resolves the original from the save's own record unless a caller overrides it, so no path can forget — including the ordinary keystroke debounce, which had the same gap right after a save. Reported by Codex on a7c047cc2a, and the third finding in this family.

* 🧪 test: Let the Shared-Link Dock Click Race Its Own Window

Docking closes the window the click was made in, so the click can resolve against a page that has already gone — the same race the focus scenario already tolerates. The assertion that matters, the pane arriving back in the shared page, is unchanged. Seen once on desktop-dark while verifying a7c047cc2a.

* 🪞 fix: Clone a Stylesheet in the State the Host Has It

The attribute mirror kept a sheet current once the window was open, but the clone was built without those attributes — so a sheet the host had already switched off, or aimed at another medium, arrived in the popup switched on. Its signature matched from that moment, so the sync had nothing to correct.\n\nThe clone now carries the same attributes the sync keeps current. Reported by Devin review of c5d51b85fb (BUG-0002), and the same cause as its predecessor in that round.

* 🧪 test: Match the Blocked-Popup Notice Where It Is Shown

The notice is rendered in the toast and repeated in the live region, so the text matched two nodes and the assertion tripped strict mode on the slower mobile project. Either node proves the user was told; the assertion now takes the first.

* 🗑️ fix: Never Let a Cleared Editor Save Itself as a Deletion

Typing has always refused to save an empty editor: a user who selects all and deletes is mid-edit, not asking for the artifact's content to be removed. The paths that resubmit retained text did not know that, so a buffer holding an empty string was sent the moment the pane changed hosts or the user came back to the artifact — persisting a deletion nobody confirmed.\n\nThe rule now sits with the other decisions about whether a request goes out, in \, so the debounce, the queued edit, the inherited buffer and the restore all share it. Reported by Codex on a9a51439a5 (P1).

* 🧹 fix: Retire the Inherited Buffer Once a Newer Edit Is in Play

A host change hands the replacement editor the text its predecessor never sent, and the drain submits that once the save pipeline is idle. If the user kept typing in the replacement, the newer text queued behind the running save — and when it landed, the drain still had the older buffer in play and sent it, putting the artifact back the way it was.\n\nAnything an instance submits or queues now retires the buffer it inherited at mount, so the newest text is the last word. The drain passes the inherited text itself, which is how it stays exempt. Reported by Codex on 04a9f685b6 (P1).

* 🎨 style: Satisfy the Tailwind v4 Class Order From Canary

* 🧺 fix: Retain a Displaced Buffer Under the Artifact That Owns It

Editing one artifact evicted another's unsaved text from the shared code
buffer: the selection change had cancelled that edit's debounce, so the
overwritten copy was the only place it lived and coming back to the
artifact fell through to its persisted content. A buffer another artifact
displaces is now retained under its owner, and the editor restores and
sends it from there on the way back. Reported by Codex on 591ab13c96 (P1).

* 🧪 test: Key the Tabs Spec's Mocked Buffer to Its Artifact

The pane-wholeness change gated the preview on the buffer naming the
artifact on screen, but the spec's useCodeState mock never set
codeArtifactId, so the edited preview never applied. The mock now carries
the owner the component reads, and the editor spec's mock grows the
retained-buffer field the component destructures.

* 🧪 test: Prove a Displaced Edit Returns With Its Artifact

The displaced-buffer scenario gets its contract-level coverage: an edit
the user leaves on one artifact, an edit that displaces it on another,
and a return that has to land on the first artifact's own unsaved text.
The fake model grows a reply carrying two artifacts so both trigger rows
exist in one conversation, and its one nested ternary is unrolled so the
file lints under the repo rules CI applies to staged files.

* fix: Resolve Every Artifact Surface and Refusal Per Artifact

Preview, download and the Mermaid host now read an artifact's retained buffer the same way the editor does, rejection markers are kept per artifact so one refusal no longer overwrites another, and the saved-content history is only preferred while the registry still sits on this session's chain of saves.

* fix: Hold an Inherited Edit Until the Editor Can Save It

A buffer inherited across a host change while a response was generating was marked drained before the read-only guard dropped the save, and the read-only transition then replaced it with persisted content. The drain now waits for editing to return and writes the inherited text back after that transition.

* chore: Sort the Presentation Spec's Imports After the Canary Rebase

* test: Prove Each Artifact Surface and Save Path End to End

Covers the download of a displaced edit, a refusal per artifact, an edit after another session changed the artifact, and an edit carried through a response by a host change.

* test: Give the Undocked Presentation Case the Canary Query Client

* test: Start Artifact Scenarios From a Settled Reply on the Desktop Layout

* test: Stub the Command Executor Stamp in the Callbacks Spec Mock

Canary's #16556 calls stampCommandExecutor from callbacks.js, but this spec's @librechat/api mock predates it, so three cases failed on canary itself. The mock now carries the real helper, as it already does for isCodeArtifactToolOutput.

* fix: Track What the Server Holds Per Artifact Instead of Inferring It

The editor reconstructed the server's content from the mutation cache and treated every buffer as unsaved. A save now records what it wrote in a per-artifact ledger that the registry retires once it catches up, so a change made elsewhere (including a revert to an earlier value) wins over this tab's history, and text this tab already saved is never sent again by a host change or a return to the artifact.

* fix: Hide the Undocked Pane While Its Conversation Route Is Pending

The route keeps the previous conversation mounted but hidden while another one loads or fails to, and the undocked portal escaped that ancestry. The host now passes its pending state down and the window hides the pane with it.

* fix: Mark the Saved Buffer Copy and Retire Lag the Registry Has Passed

A buffer is saved only while it is the copy a save wrote, so editing away and back to the same text is still sent. Lag values the registry has already moved past are dropped in order, so a later change back to one of them is read as a change made elsewhere.

* test: Drop the Callbacks Mock Stub Canary Now Carries

* perf: Prune Settled Save Records When the Editing Session Ends
2026-10-01 18:41:18 +02:00
Marco Beretta
d9fdfddce9
🗂️ feat: Give File-Type Tiles Their Own Theme Roles (#16603)
* feat: Give File-Type Tiles Their Own Theme Roles

The file chips in the composer, the file table and message attachments drew their tile in one of seven hard-coded hex fills from utils/files.ts and their glyph in raw white, so a theme could recolour neither. Each kind of file now has a file-* fill role and the glyph reads file-ink; every LibreChat theme keeps today's colours, and ClickHouse draws the tiles from Click UI palette steps that keep the white glyph legible. The tile fill travels as a fill utility, the way the trace kinds already pass theirs.

* test: Pin the File Tile Roles in the Composer Tray

* test: Attach File Tile Captures to the Report

* fix: Keep FileIcon's Colour Fill and Take the Role Through fillClassName

* fix: Hold High Contrast File Tiles to AA Against Their Glyph

* fix: Ink the File Upload Spinner With the Tile Glyph Role
2026-10-01 17:44:29 +02:00
Marco Beretta
d3d9bc9703 🖍️ feat: Give the Remaining Component Colour Literals Theme Roles (#16597)
* feat: Give the Last Component Colour Literals Theme Roles

The default avatar's hairline, the file drop zone's artwork and a dragged badge's lift were literals in Avatar, Icon, MessageIcon, DragDropOverlay and Badge, so no theme could reach them. avatar-edge, the illustration roles and the elevationDrag appearance role now carry them, each defaulting to the literal it replaces in every bundled theme. ClickHouse paints the artwork from Click UI's info ramp.

Canvas, favicon and screenshot code read roles through readThemeColor instead of wrapping channel triplets by hand. The Reasoning fade mask, two comments and dead commented-out SVG fills no longer carry colour literals, and the allowlist is regrouped into nine justified entries.

* test: Pin the Avatar Hairline, Drop Zone Artwork and Drag Lift Roles

* refactor: Export readThemeColor Beside the Theme Atoms

* test: Compare the Avatar Hairline by the Pixel It Paints

* test: Compare the Drag Lift as the Browser Computes It

* test: Attach Drop Zone Artwork Captures to the Report

* test: Pick the Drag Lift Theme From One Init Script

(cherry picked from commit 59a8a31ab2)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16597
2026-10-01 11:50:53 +00:00
Marco Beretta
8b9c9a7728 🖼️ feat: Give Media Overlays Their Own Theme Roles (#16596)
(cherry picked from commit d2e11ffd0a)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16596
2026-10-01 11:50:53 +00:00
Marco Beretta
82127a2269 🌅 fix: Paint the Cached Deployment Theme on the First Frame (#16590)
(cherry picked from commit 2d09fed8d6)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16590
2026-10-01 11:50:53 +00:00
Marco Beretta
3d40b03f0f 🌗 feat: Per-Mode Appearance Defaults for Menu and Tooltip Shadows (#16602)
(cherry picked from commit cfeaee13ab)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16602
2026-10-01 11:50:52 +00:00
Marco Beretta
f83c502c16 📐 feat: Menu, tooltip and tab corner theme roles (#16599)
The menu panel, tooltip and tab trigger read menuRadius, tooltipRadius and tabRadius instead of literal corners. The defaults are the old literals, and the ClickHouse theme sets Click UI's genericMenu, tooltip and tabs radii. The not-expressible list drops the three corners and keeps the field fill and ink, the dark menu shadow and the tooltip shadow.

(cherry picked from commit 98efd35024)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16599
2026-10-01 11:50:52 +00:00
Marco Beretta
5b98963ca2 🪆 fix: Resolve theme markers to the nearest themed root (#16589)
The disabled-fill and field-focus variants, and the Field.css edge rules, read the inherited --theme-disabled-style and --theme-field-focus-style properties through style queries instead of matching any ancestor that carries the data-theme-* marker. A root themed with the default style inside one themed with the other now gets its own behavior back, at any depth. The default treatment never depends on style query support.

(cherry picked from commit ca2876f559)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16589
2026-10-01 11:50:52 +00:00
Marco Beretta
5433d5f387 🧾 test: Complete the Click UI Not-Expressible List (#16588)
* feat: Focus ring width and offset theme roles

The global keyboard focus outline and the keyboard-modality text input outline read focusRingWidth and focusRingOffset instead of 2px literals. Both default to 2px, the ClickHouse theme sets Click UI's 2px and 2px, and the drift guard pins those values against Click UI's focus rules.

* test: Complete the Click UI not-expressible list

The parity spec now probes the Dropdown menu shadow, the Tooltip corner and shadow and the Tabs corner. The menu shadow reads the shadowLg role, whose default is the old literal, so ClickHouse matches Click UI in light; the dark app rule, the Tooltip literals and the Tabs corner have no role and are listed with their issues.

* test: Pin the menu panel shadow in the default and ClickHouse themes

(cherry picked from commit d8c4c12dfd)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16588
2026-10-01 11:50:52 +00:00
Marco Beretta
f79ddcf2d6 feat: Focus ring width and offset theme roles (#16587)
The global keyboard focus outline and the keyboard-modality text input outline read focusRingWidth and focusRingOffset instead of 2px literals. Both default to 2px, the ClickHouse theme sets Click UI's 2px and 2px, and the drift guard pins those values against Click UI's focus rules.

(cherry picked from commit 458af5afca)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16587
2026-10-01 11:49:36 +00:00
Lia
443d27ba32 🎋 fix: Reconcile Canary Promotion Static Checks
Move the existing marketplace spacing, pressed state and reduced-motion handling into shared primitive recipes. Supply loading-dot animation delays through a CSS custom property in the published preset. Remove only the five resolved suppression entries and apply the five CI-reported formatting corrections. Add focused regression coverage for GitHub CI; no local tests, builds, lint checks or typechecks were run, as requested.
2026-10-01 04:13:53 +00:00
Lia
e6d6092448 ⛴️ fix: Reset Agent Search and Wait for Completed Diagram Exports
(cherry picked from commit 67e4609f6a)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16457
2026-10-01 03:46:19 +00:00
Marco Beretta
cd27c01b48 🏷️ feat: Give the Badge Label Its Own Ink and Let the Legacy Dialog Spinner Inherit (#16554)
* feat: Give the Badge Label Its Own Ink and Let the Legacy Dialog Spinner Inherit

The shared Badge inherited the primary ink, so a theme could not label it
in Click UI's muted badge ink without dimming body copy. It now reads a
badge-label color role that defaults to the primary ink and follows it for
a theme that names only that; a hovered or selected badge keeps the primary
ink, which holds AA on those fills. The ClickHouse theme takes Click UI's
badge.opaque.color.text.default, and the Badge label leaves the drift
guard's not-expressible list.

The template's legacy selection spinner painted in text-primary on the
primary fill, dark on dark. It now takes the action's own foreground.

* refactor: Fold the Avatar Glyph Into the Shared Primary Ink Fallback

The default avatar's glyph, the dialog title and the badge label all split
out of the primary ink and follow it for a theme that names only that, so
the avatar keeps one fallback with the others instead of its own copy in
resolveTheme and applyTheme.

* fix: Keep a Disabled Badge in Its Resting Ink on Hover

* fix: Keep a Disabled Selected Badge in the Primary Ink on Hover

(cherry picked from commit ef1aa66812)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16554
2026-10-01 03:46:19 +00:00
Marco Beretta
6df4b8cb9b 🔎 feat: Let Themes Focus Fields by Their Edge and Size Fields and Labels (#16550)
* feat: Let Themes Focus Fields by Their Edge and Size Fields and Labels

Shared fields drew a fixed 40px control that could only focus with the
keyboard ring, and Label a fixed text-sm at leading 1, so a theme could not
draw Click UI's 32px field that swaps its stroke on focus, or its 500
0.75rem/1.5 field label.

Fields now read fieldHeight and fieldFocusStyle: ring keeps today's
keyboard-only ring, border swaps the edge to border-field-focus on any focus
with no ring, mirrored on the root as data-theme-field-focus so the pointer
modality reset leaves it alone. Label reads labelSize, labelLeading and
labelFontWeight. Every default reproduces today's field and label; the edge
color follows focus-control and the label size textSm for a theme that
names only those. The ClickHouse theme takes Click UI's field height,
active stroke and label typography, and the drift guard pins them. The
shared Badge, which no app surface renders, keeps a recorded deviation.

* fix: Keep the Pointer Focus Reset for Edge-Focused Fields

Under fieldFocusStyle border the pointer-modality rule was skipped whole,
so a pointer-focused field lost its outline and ring reset along with the
edge reset. Only the edge reset now depends on the focus style.

* fix: Keep the Forced-Colors Outline and Give SecretInput the Field Roles

Under forced colors the edge color and ring drop out, so suppressing the
outline of an edge-focused field left keyboard focus invisible there. The
suppression now applies outside forced colors only.

SecretInput hard-coded h-10 and was not a shared field, so beside an Input
it kept 40px and missed the theme's focus treatment. It now composes
fieldControl, keeping its trailing padding for the controls; its keyboard
focus becomes the same focus-control ring the other fields draw.

* fix: Give Fields a Vertical Padding Role So a Short Field Keeps Its Line

The field kept a fixed py-2 inside the themed height, so ClickHouse's 32px
field left 14px for a 21px line. Fields now read fieldPaddingY, py-2 by
default; the ClickHouse theme takes Click UI's field.space.y, which fills
its 32px exactly, and the drift guard pins it.

* fix: Keep a 2px Keyboard Focus Perimeter and Respect Scoped Edge-Focus Roots

An edge-focused field showed keyboard focus only as its recolored 1px
edge, under the 2px perimeter the app holds as its focus floor. Keyboard
focus now adds a 1px ring in the same color; pointer focus stays edge-only.

The pointer reset checked only the document root for edge focus, so a
border-focus theme applied to a nested root had its edge reset to the
stock border. It now skips any field under an edge-focus root.

(cherry picked from commit ed6107aa89)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16550
2026-10-01 03:46:19 +00:00
Marco Beretta
0b7d49f829 🪟 feat: Give OGDialog Theme Roles for Its Edge, Padding and Title (#16546)
* fix: Alias the Button Fills to the Inverted Surface and Size the Legacy Dialog Action

A stylesheet that repainted --surface-inverted or its hover no longer
reached primary buttons, because the stock CSS declared their fills from
palette steps. They now read the inverted surface they split from.

A templated dialog's legacy selection action kept a fixed h-10 and the
inverted fill beside the shared cancel Button, so a theme's button height
split the two. It now reads the Button's height and primary fill roles.

* feat: Give OGDialog Theme Roles for Its Edge, Padding and Title

A templated dialog cleared its edge with border-none and set its title at a
fixed text-lg, semibold, display-family heading in the body ink, so a theme
could not draw Click UI's framed dialog or its 700 1.25rem/1.5 title.

OGDialog now reads a stroke width (in border-light), its inline padding and
header gap, and its title's size, leading, weight, family and ink from theme
roles. Every default reproduces today's dialog; the title size, family and
ink follow textLg, displayFontFamily and text-primary for a theme that names
only those. The ClickHouse theme takes Click UI's dialog stroke, space.x,
title gap, title typography and title color, the drift guard pins them, and
the parity probes now read the dialog stroke and scrim.

* fix: Keep the Dialog Title Ink Out of the Verified Mark's Surroundings

The dialog title color was added to the surfaces the verified mark is
measured against, so a theme that named only the title ink took the
verified fallback. It is a text color, not a surface the mark sits on.

* fix: Let Dialog Titles Take the Dialog Title Ink

Seven dialogs set text-text-primary on their OGDialogTitle, which Tailwind
Merge kept over the new dialog-title role, so a theme that gives dialog
titles their own ink reached only some of them. The redundant classes are
gone; the role defaults to the primary ink, so nothing changes by default,
and the design-rule counts for those files drop by the override each
removed.

(cherry picked from commit bddb8f8ab3)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16546
2026-10-01 03:46:19 +00:00
Marco Beretta
eb5d74dbd5 🧑‍🎨 feat: Give the Default Avatar and Avatar Placeholder Theme Roles (#16545)
* feat: Give the Default Avatar and Avatar Placeholder Theme Roles

The default user avatar filled with a literal rgb(121, 137, 255) in Avatar, MessageIcon and the endpoint Icon, and agent and assistant avatars sat on surface-secondary in light and a dark: surface-tertiary override, so no theme could repaint either.

avatar-fill and avatar-text paint the default avatar and its glyph, and avatar-placeholder paints the backdrop behind an agent or assistant image. Every bundled theme reproduces today's pixels. A theme that sets only its surfaces keeps the placeholder on the surface its mode used before the role existed, both when resolved and through the legacy applyTheme path. ClickHouse takes Click UI's avatar fill and text and its muted background.

* test: Pin the Default Avatar Fill With and Without the ClickHouse Theme

The sidebar account avatar falls back to the default avatar when its image fails; with no theme it keeps rgb(121, 137, 255) in both modes and the placeholder keeps the surface its mode used, and under ClickHouse both take the Click UI values.

* fix: Ink Every Default Avatar Glyph With the Avatar Text Role

The sidebar Avatar, the only default avatar the chat renders, still inked its glyph in text-primary, so a theme's avatar-text never reached it and ClickHouse drew a dark glyph where Click UI draws white. Avatar now reads avatar-text, which defaults to each bundled theme's primary text and follows rgb-text-primary in a theme that does not set it, through resolveTheme and the legacy applyTheme path, so every rendered default avatar keeps its pixels.

* fix: Read the Active Mode Off the Root When applyTheme Is Not Told It

applyTheme is exported, and a caller that applies a legacy palette in dark mode without the new mode argument derived the avatar placeholder from the light surface. It now falls back to the root's dark class.

* fix: Keep CSS-Themed Avatars on Their Legacy Source Variables

The avatar text and placeholder defaults were literal triplets, so a consumer theming through --text-primary and the surface variables left avatars on the stock colors. They now alias text-primary, the secondary surface and, in dark, the tertiary surface, resolving to the same pixels by default. applyTheme's mode fallback also reads a dark ancestor, not only the root itself.

* fix: Let the Stylesheet Alias Carry the Document Root Avatar Backdrop

applyTheme wrote the legacy placeholder inline for the mode active when it ran, which then overrode the per-mode stylesheet alias after a dark toggle without a reapply. On the document root the alias already follows the theme's surfaces and the mode, so the placeholder is now derived only for a scoped root, which that alias cannot see.

* fix: Keep a Scoped Legacy Avatar Backdrop Following the Mode

applyTheme wrote a scoped root's avatar placeholder inline for the mode active when it ran, so after a later dark toggle the backdrop stayed on the light surface, where canary's dark:bg-surface-tertiary switched. applyTheme now marks a scoped root with data-theme-scope and the stylesheet points its backdrop at that root's own secondary surface, or its tertiary one under a .dark ancestor, as the document root's alias does. The mode argument is no longer needed and is removed.

(cherry picked from commit 3ac6a0af37)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16545
2026-10-01 03:46:19 +00:00
Marco Beretta
37f02c2897 test: Enumerate the Click UI Decisions the Theme Cannot Express (#16544)
Pin every Click UI parity decision to its verdict per mode (match, near, deviation, not expressible) instead of aggregate floors, so a swap fails by name. List the decisions no theme can reach today, each with its reason and tracking issue, and print a match/near/mismatch status for every color and appearance role against the Click UI token that names its job.

Every status is measured from a rendered primitive or a cited snapshot token: a missing token, a stylesheet rule the rendered popover no longer takes its corner from, a size or radius class no role resolves, an empty gap entry or a moved appearance decision all fail by name. The Button primary fill and height now match through the Button roles, so the Button leaves the list.

(cherry picked from commit a1b98bc724)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16544
2026-10-01 03:46:19 +00:00
Marco Beretta
d06e7635df 🧩 feat: Ignore Unknown Theme Color Tokens Instead of Dropping the Theme (#16529)
(cherry picked from commit 491ea868da)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16529
2026-10-01 03:46:19 +00:00
Marco Beretta
0eccfbfa58 🎛️ feat: Give the Button Theme Roles for Its Label, Height, Fill and States (#16530)
* feat: Give the Button Theme Roles for Its Label, Height, Fill and States

The Button drew a fixed 500-weight label at 40px and 36px, painted its
primary fill in the inverted surface its checkbox and switch share, focused
in the primary ink, and only dimmed when disabled, so a theme could not
draw Click UI's 400-weight 32px buttons or its #302e32 primary.

Add controlFontWeight, buttonHeight and buttonHeightSm appearance roles and
button-primary and button-primary-hover color roles, which follow the
inverted surface for a theme that names only that. The Button reads them,
focuses in focus-control, presses in the pressed roles and composes the
shared disabled recipe; the defaults reproduce today's button exactly.
Tailwind Merge now knows the new utilities, so a caller's own height or
weight still wins.

SelectTrigger hid its outline on every focus and drew nothing instead; it
now draws keyboard focus in focus-control, like the shared field.

The ClickHouse theme takes Click UI's label weight, button height and
primary fills, and the drift guard pins them and measures the Button.

* fix: Focus the Shared Inputs in the Focus-Control Role and Repair the Button Specs

SecretInput, MultiSearch, InputWithDropDown and InputCombobox drew keyboard
focus in the decorative ring-primary, about 2.3:1 on the dark default canvas.
They now use focus-control, and a guard holds that role at 3:1 on every
control canvas in each theme. The Scrim spec follows the Button's focus role,
and the button-roles scenario opens the Data & Privacy tab by its current name.

* test: Reach the Shared Input Focus Rings by Keyboard

The focus-role guard read component source, which a dead string or a ring on a
non-focusable wrapper would satisfy. Each control is now reached by Tab and
the focused element, or the combobox's ring host while it holds keyboard
focus, is asserted to paint the focus-control ring.

(cherry picked from commit dd5fdf1ff4)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16530
2026-10-01 03:46:19 +00:00
Marco Beretta
5c6578fa25 📏 feat: Give Theme-Sized Controls Their Own Padding and Gap Roles (#16528)
* feat: Give Theme-Sized Controls Their Own Padding and Gap Roles

The theme variants of Button and Chip, CheckboxButton and every composer
control read spaceNormal and spaceCompact, which also pad message rows,
steer bubbles and the composer send button, so a theme could not give its
controls Click UI's button spacing without reshaping the chat.

Add controlPaddingX and controlGap appearance roles, which those controls
read instead. Their defaults are the shared spacing values, a theme that
names only spaceNormal or spaceCompact keeps its controls on them, and the
preset falls back to the shared roles for a stylesheet that predates these.

The ClickHouse theme takes Click UI's button.basic.space.x and space.gap,
and the drift guard pins both values and measures the themed Button's
padding and gap.

* test: Reach the Temporary Chat Chip Through a Sent Message

The header status chip only appears once a temporary chat has its first message, so the scenarios send one, and measure the real message bubble instead of a probe for the shared spacing.

* fix: Let the Control Spacing Roles Replace the Base Gap

Tailwind Merge could not classify px-theme-control-x or
gap-theme-control-gap, so a theme-sized Button kept the base gap-2 beside
the role and a caller's own padding beside both, leaving the winner to
stylesheet order. Register both utilities with their groups.

* fix: Alias the Stock Control Spacing to the Shared Spacing Roles

A stylesheet that set only --theme-space-normal or --theme-space-compact
stopped reaching Button, Chip and the composer controls once the stock CSS
declared the control roles as literals, so the preset's fallback never ran.
The stock declarations now read the shared roles, with the same defaults.

* test: Assert the Control Spacing Utilities Declare Their Own Properties

(cherry picked from commit bdfd3012ea)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16528
2026-10-01 03:46:19 +00:00
Marco Beretta
e1e1d1b19d 🎒 feat: Carry Project Context Across Conversations (#15684)
* 🎒 feat: Carry Project Context Across Conversations

* fix: fail a project attach whose upload hold cannot be released and keep file deletes independent of project cleanup

- Attaching a project file now fails, with nothing attached, when the file's
  temporary upload hold cannot be released, instead of attaching a file that
  can still expire.
- A failed project cleanup after a file delete is logged rather than failing a
  delete that already happened, and a user-wide delete clears that user's
  project references without reading every file first.
- Both resize handles share the orientation-aware grip, so a primary handle in
  a vertical group renders a rotated grip like the alternate one.

* fix: treat an empty tenant id as no tenant in the project file picker

* fix: attach nothing when a project file is deleted while the attach is in flight

* fix: localize project file association failures instead of showing server text

* test: expect a localized reason for a rejected project file association

* fix: scope project file listing to the caller's tenant and name the file limit when attaching an existing file

- Listing a project's attached files now returns not found when the project
  belongs to another tenant, matching the available-file listing and the
  chat context resolver.
- Choosing an existing file for a full project now names the project file
  limit instead of the generic attach error, like the upload path.

* fix: treat an empty tenant id as no tenant in every project tenant check

A caller whose tenant id is an empty string was refused its own tenantless
project when listing attached or available files, because the handlers
compared '' with null. The project handlers and the chat context resolver now
share one comparison that treats an empty tenant id as no tenant, the rule the
project file queries already follow.

* test: wait for the workspace layout swap and the mobile drawer before acting in the long-metadata spec

The desktop title was measured while the phone layout could still be the one
rendered, and the sidebar row menu was opened before the mobile drawer
committed its open state, which closes a menu opened ahead of it. The spec
now waits for the workspace's phone-only sidebar toggle to leave and for the
drawer to drop inert, the same drawer signal the agents helpers use.

* fix: keep the agent context fingerprint of a turn outside any project unchanged

Every turn now passes a project context key into the agent context
fingerprint, and a turn outside any project passed the no-project sentinel,
which changed the digest of every existing no-project checkpoint. An agent
event conversation written before this change then cold-started and reloaded
its history on its next event. The fingerprint now hashes the no-project key
as absent, so those checkpoints keep matching.

* test: load the long-metadata spec at phone width before driving the mobile drawer

The spec crossed back from desktop to phone width without a reload, which
leaves the drawer on the desktop toggle path whose delayed focus handoff to
the close button dismissed the row menu roughly 200ms after it opened. The
spec now reloads at phone width, as a phone arrives, and waits for the
drawer's own focus handoff before opening the menu.

(cherry picked from commit 4062bc3c00)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/15684
2026-10-01 03:46:19 +00:00
Marco Beretta
fdef598853 🧽 fix: Paint Freed Feature Surfaces From Theme Roles (#16517)
* fix: Paint Tool Output Panes With the Code Body Role

The output panes of code execution, file authoring and file reads painted
surface-chat in light and surface-primary-alt in dark. surface-code-body is
that same pair in the default, dark and high-contrast themes, and a theme
that styles its code blocks now styles these panes with them.

* fix: Draw the MCP OAuth Logo and QR Tiles From Fixed Roles

The server logo tile and the QR backdrop were bg-white. They take
surface-fixed and surface-qr, both white in every bundled theme, so a theme
can own them without the QR losing its quiet zone.

* fix: Give TextareaAutosize an Invalid State and Use It for Tool Arguments

The tool-approval edit field flagged invalid JSON with border-red-500, a raw
colour the primitive's owner rule rejects in any semantic form. TextareaAutosize
now draws its border in border-destructive when aria-invalid is set, the
attribute the Skills description fields already pass. ToolApproval sets
aria-invalid and points aria-describedby at the Invalid JSON message, so a
screen reader announces the error as well.

* docs: Record the Image Preview, Artifact Scrollbar and Azure Chip Colours

Adds the image preview's media overlays, the sandboxed artifact document's
scrollbar and the Azure file-source gradient to the theme allowlist.

* test: Cover the Tool Output Pane, Invalid Tool Arguments and OAuth QR Tile

Scenarios for the code-body pane behind a file-authoring card, the
announced invalid state of the tool-approval edit field, and the MCP OAuth
QR backdrop staying white in both modes.

* test: Retry the Output Pane Colour and Set Up the Approval and OAuth Scenarios at Desktop Size

The pane is read with a retrying assertion against the resolved role, since
the card re-renders as highlighting lands. The approval agent and the MCP
Settings panel are reached through side panels the mobile layout keeps in its
drawer, so those two scenarios run at desktop size on the mobile project.

(cherry picked from commit 2f16e6b37b)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16517
2026-10-01 03:46:19 +00:00
Marco Beretta
d8797b227c 🗂️ feat: Give the Table Theme Roles for Header Text, Row Rules and Density (#16489)
* feat: Give the Table Theme Roles for Header Text, Row Rules and Density

The shared table could not take Click UI's shape: its header had no fill of
its own, column names were fixed to text-secondary, rows had no rule and
cells were fixed at 1rem. The header now always carries surface-secondary,
which every consumer already painted, and three roles are added: a
table-header-text color that falls back to a theme's secondary text, a
tableCellSpaceY length that sets cell padding and header height, and a
tableRowStroke width that is 0px by default. Tailwind Merge learns the
new padding and height utilities so a caller's own padding still wins.

The ClickHouse theme sets Click UI's header title color, small-size cell
space and 1px row stroke, and the drift guard pins them.

* fix: Carry the Column-Header Role Into Both Data Tables

Both exported data tables set text-secondary on the header cell or its
label, which beat the new role, so a theme never reached their column
names; they now read table-header-text. The legacy table's row titles keep
text-secondary explicitly, since they are row data rendered through
TableHead. The token falls back to --text-secondary for a stylesheet that
predates it.

* refactor: Give TableHeader a filled Variant Instead of a Caller Override

* feat: Route the Data Tables Through Table Density and a Header Fill Role

The density role reached no real table: every data table passed its own
py-1 or py-2. TableCell and TableRowHeader gain compact and dense sizes,
and TableHead sm, compact and row sizes, all derived from the table cell
space (half and a quarter of it), so the three data tables now read the
role while drawing exactly what they drew before. The virtualized table's
rows default to 32px plus half the cell space, 40px as before.

The virtualized table's self-sticking header cells now paint a
table-header-fill role that defaults to each theme's dialog surface, so
Shared Links and Archived Chats look the same by default and take Click
UI's header fill under the ClickHouse theme.

ClickHouse's cell space becomes Click UI's md value, 1rem: its sizes halve
the same way, so the compact tables land on sm, 0.5rem, the size Click UI
tables default to.

* fix: Re-render Mounted Table Rows When the Themed Row Height Changes

The memoized row compared only its data, selection and cells version, so a
theme switch left mounted rows on their old inline height and the
virtualizer measured that stale geometry. It now compares the height too.

* fix: Size Both Virtualizers From the Themed Row Geometry

The legacy table estimated every row at a fixed 48px while its title cells
now follow the cell space, and the dense row budgeted 32px of content that
is really 2rem of controls. A useTableRowHeight hook gives both the dense
and the titled height from the root size, the cell space and the row rule,
48px and 40px as before, and the legacy virtualizer re-measures when it
changes.

* fix: Measure the Legacy Table's Rendered Rows

The legacy table can be given columns without a title, whose rows are
shorter than a titled row, so the estimate alone could not match them.
Each rendered row now reports its size to the virtualizer, and the titled
height is only the first guess for rows not yet rendered.

* test: Compare Archived Header Space Apart From the Theme's Text Line

ClickHouse now draws text-sm on its own 1.5 line height, so its header is
a pixel taller than the default while keeping the same cell space. Compare
the space around the text line instead of the whole header height.

* fix: Keep the Row Rule Inside the Titled Row Estimate

The title cell draws the rule as its own bottom border inside a fixed
border-box height, so adding the stroke again overestimated every
unmounted titled row by the stroke width. Only the content-sized dense
and compact rows grow by it.

* test: Read the Table Defaults From the Published Stock Stylesheet

The table roles' stock values and the no-rule stroke now live in the
package's defaults.css, which replaces controls.css, and the stock
palette counts the two new table color roles.

(cherry picked from commit cf33a478f2)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16489
2026-10-01 03:46:19 +00:00
Marco Beretta
f51b1a823b 🎚️ feat: Give the Switch Theme Roles for Its Size and Knob (#16486)
* feat: Give the Switch Theme Roles for Its Size and Knob

The shared switch read a fixed 44x24 track and painted its knob with
surface-primary, so a theme could not draw Click UI's 32x16 switch or its
dark knob. Add switchWidth and switchHeight appearance roles, from which
the preset derives the knob size and its travel, and a switch-thumb color
role that falls back to a theme's surface-primary when it names only that.
The defaults reproduce today's switch exactly.

The ClickHouse theme sets Click UI's switch size and indicator colors, and
the drift guard pins them and measures the switch geometry.

* test: Measure the Switch by Layout While the Dialog Zooms In

* test: Choose the Switch Theme per Navigation

* fix: Carry the Legacy Surface Onto the Switch Knob in applyTheme

Themes restored through theme-colors reach the DOM through applyTheme,
not resolveTheme, so the knob fallback has to live in its adapter too.

* fix: Fall Back to the Page Surface for the Switch Knob Without the Role

A consumer whose stylesheet predates --switch-thumb would resolve the knob
to an invalid color; the token falls back to --surface-primary, which it
was painted with before the role.

* fix: Keep a Usable Hit Area Under a Compact Switch

A theme can draw the track at 32x16, which is shorter than a usable
target, so an invisible layer keeps the switch at least 24px tall, and
44px on a coarse pointer. The knob subtracts the track's 4px of border in
px, so it holds at any root font size.

* fix: Let Theme Readers Ignore Unknown Color Roles and Validate the Switch Pair

A definition that names a color role this reader does not know was
rejected whole, so every new role made a stored or yaml theme unreadable
to an older client. A well-formed rgb- name with a valid triplet is now
ignored with a warning, the way unknown appearance tokens are; a
malformed name or value is still rejected.

The switch dimensions must be positive, a px height must exceed the 4px
track border, and a width written in the height's unit must be at least
the height. The preset clamps the derived knob and travel at zero and
never draws the track narrower than it is tall, for mixed units.

* fix: Compare the Switch Pair in One Unit Instead of at an Assumed Root

Mixed px and rem, or em, resolve against sizes the validator cannot see,
so a pair that passed at 16px could collapse at another root. Switch
dimensions are now px or rem, a pair must share a unit, a rem height must
be at least 0.5rem, and the checks compare values in that unit.

* fix: Leave Unknown Color Roles to the Client Reader Option

Canary now ignores a well-formed color role only where the reader may
predate the definition (the client), and keeps the server strict so a
typo in librechat.yaml still drops the theme. Drop this branch's
server-side allowance, its fixture and loader expectations, and the
duplicate knownColors helper the rebase left behind.

* fix: Widen a Compact Switch's Touch Target to 44px

On a coarse pointer the hit layer grew to 44px tall but stayed as wide
as the track, so the 32px ClickHouse switch left a 32 by 44 target.
Center the layer on the track and give it the same touch minimum in
width; the scenario now checks both sides.

* fix: Size the Switch Touch Layer From the Touch Role Instead of a Min Width

min-w does not read the spacing scale, so the coarse-pointer layer never
widened. Give it the touch width outright and measure the tap target as
the track's box together with the layer.

* test: Read the Switch Defaults From the Published Stock Stylesheet

Canary now ships the stock values in the package's defaults.css rather
than the app stylesheet, so the switch roles are declared there and the
stock palette counts the new thumb role.

(cherry picked from commit 21cb1712f5)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16486
2026-10-01 03:46:19 +00:00
Marco Beretta
5d39e0b901 📐 fix: Draw Controls at the Theme Control Radius (#16481)
* fix: Draw Controls at the Theme Control Radius

Dropdown gains a shape prop in Button's vocabulary. Omitted, the trigger
takes the theme control radius, which equals rounded-xl in the default
theme, so the settings selects follow a theme's control corner instead of
its dialog step. The marketplace sort and the prompts filter ask for
shape="default" rather than overriding the radius locally.

The settings nav tabs, the agent builder footer buttons and the builder
action controls move from rounded-xl to the control radius.

The Click UI drift guard now measures primitive color and shape parity
against Click UI's component tokens and holds a floor per mode.

* test: Choose the Theme per Navigation Instead of Stacking Init Scripts

(cherry picked from commit ccd9267262)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16481
2026-10-01 03:46:19 +00:00
Marco Beretta
1d01178c63 🧩 fix: Paint Panel Surfaces From Theme Roles (#16484)
* fix: Paint Panel Surfaces From Theme Roles

The tool dialog's logo tile takes the fixed surface that logo tiles use elsewhere,
and the skill image preview icon takes a series slot like the other categorical
marks. The tools category filter drops a raw emerald border and shows its active
state on the filter icon in the accent role instead; the label still names the
active category.

The avatar cropper's media hint and the SharePoint picker background are recorded
in the theme allowlist.

* test: Cover the Skills Category Filter's Active State

* test: Match the Category Filter Trigger Exactly

(cherry picked from commit 8ce9f58fd3)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16484
2026-10-01 03:46:18 +00:00
Marco Beretta
a50ea26fdf 🫧 fix: Paint Chat Surfaces From Theme Roles (#16483)
* fix: Paint Chat Surfaces From Theme Roles

The code window header and skill output panel stop repainting their
surface-secondary container with a per-mode fill that matched it in every bundled
theme, the drag-and-drop backdrop becomes the theme scrim, the OpenAI file-source
chip takes the primary surface, and the banner drops a stopless dark gradient.

ActionIcon, RetrievalIcon, WrenchIcon and the message ProgressCircle had no
importers and carried fixed Lottie colours, so they are removed. The media,
artwork and exported-document colours that stay fixed are recorded in the theme
allowlist.

* fix: Keep the Drag-and-Drop Backdrop Black Until Scrim Opacity Is a Role

The theme scrim is gray in default light, so at the same alpha it dimmed the page
less than the black backdrop it replaced. The backdrop keeps its original colour
and the allowlist records the scrim-opacity role it waits on.

* test: Cover the Code Window Header Showing Its Panel Surface

* test: Exercise the Code Window Header Through a File-Authoring Card

The mock code interpreter exposes bash_tool, whose card has its own header; a skill
file created by the model opens the file-authoring card that renders CodeWindowHeader.

* fix: Keep the OpenAI File-Source Chip's Dark Opacity

The chip composites over the file's own preview, where surface-primary at 75% darkened
it against the shipped black at 65%. It keeps its colours and joins the code-execution
badge in the allowlist as a media overlay.

(cherry picked from commit 0b80ea5ebf)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16483
2026-10-01 03:46:18 +00:00
Marco Beretta
5961f767fd 🔤 fix: Ship the Theme Font Faces With the Package (#16485)
* fix: ship the Inter, Roboto Mono and Inconsolata faces with the package

Move the woff2 files from client/public/fonts into packages/client/src/theme/fonts
and every @font-face rule (the app's Inter and Roboto Mono faces and
client/src/fonts.css) into theme/fonts.css, which tokens.css imports and the build
copies into dist with the files. Each url() names the file by a new
@librechat/client/fonts/* export: a relative path breaks under Vite with
@tailwindcss/postcss, because Vite inlines the import before Tailwind runs and
Tailwind reports every emitted declaration as coming from the root stylesheet.

The app loads the same files through the same import and still emits them to
assets/fonts with their licences, now read from the package; the $fonts alias is
gone. Inter and Roboto Mono gain their OFL texts beside Inconsolata's. The README's
consumer stylesheet moves the package stylesheet import above @config, where
Vite's inliner no longer skips it. The static checks' bundle freshness test reads a
subpath pattern export as the directory it maps into.

* docs: describe how the theme fonts resolve through the package export

* fix: leave subpath pattern exports out of the bundle freshness check

A pattern such as ./dist/fonts/* names no entry the design rules load, and
reading it as its directory made the freshness check depend on a directory the
synthetic build in suppression-baseline.spec.ts never dates. The scenario's
mirror of the manifest reading skips patterns the same way.

(cherry picked from commit 681515c9e5)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16485
2026-10-01 03:46:18 +00:00
Marco Beretta
01f3e52eee 🪞 fix: Publish the Theme Defaults and Scale Mapping to Package Consumers (#16479)
* fix: publish the theme defaults and scale mapping with the package

Move the radius, font and shadow utility mapping from the app stylesheet into
tokens.css, and the stock values of every theme-owned property (the 94 color
roles, the appearance roles and the brand colors, with the primitive scales they
are written against) into a new defaults.css that tokens.css imports and the
build ships beside it. The app reads both through its existing tokens.css
import, so @librechat/client/theme.css now gives a consumer the same utilities
and values the app renders. controls.css folds into the defaults, and the preset
no longer pins rounded-sm, rounded-md and rounded-lg to --radius.

A new mock scenario compiles the app and a consumer from what each loads,
checks the build output and exports, and compares computed styles in light and
dark; defaults.spec.ts holds defaults.css equal to the runtime themes.

* docs: note that hosts load the stock Inter and Roboto Mono faces

(cherry picked from commit a50612f70f)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16479
2026-10-01 03:46:18 +00:00
Marco Beretta
60b8bb9a77 test: Count Derived Scrim Tokens as Theme-Owned (#16512)
The stylesheet-ownership check added in #16480 required every declared
color token to be a theme key of its own, so the scrim tokens from #16492,
which compose the surface-overlay role with a scrim opacity role, failed it
once both landed on canary. A token is now owned when a variable its value
reads is one a theme can set.

(cherry picked from commit 75bb1899fc)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16512
2026-10-01 03:46:18 +00:00
Marco Beretta
dcd06896f2 🖌️ fix: Apply Controlled Themes Before Paint and Theme Prose Links, Inline Code and QR Backdrops (#16480)
* fix: Apply controlled themes before paint and give prose links, inline code and QR backdrops theme roles

ThemeProvider folds a controlled theme prop change into state during the
render that delivers it and applies the theme in a layout effect, so a
deployment theme, a shared link's theme and the viewer's own theme reach
the root before the commit paints. Storage writes stay after the commit.

Adds rgb-link-prose (link in light, primary text in dark, following a
theme's own link) and registers rgb-surface-qr, and paints inline prose
code with the surface-active-alt and surface-hover-alt roles.

* test: Record the frames a controlled theme paints and the prose and QR roles

(cherry picked from commit 364bf27210)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16480
2026-10-01 03:46:18 +00:00
Marco Beretta
a51a0aad67 🎨 fix: Draw Library Colours From Theme Roles and Record the Exceptions (#16482)
* fix: Draw Library Colours From Theme Roles and Record the Exceptions

PixelCard resolves its variant palettes from theme channel variables when it lays
out pixels, so the image generation placeholder follows the active theme in dark
mode instead of drawing a fixed light slate palette. The SAML glyph and Codey mark
take the text colour.

The new theme/allowlist.md records every colour that deliberately sits outside the
theme (brand marks, artwork, theme definitions, library elevation ink) and why.

* fix: Repaint the Pixel Card When the Theme Changes

The palette is read from theme variables when the pixels are laid out, so a mode
switch or an applied theme left the previous theme's pixels on the canvas. The card
now lays its pixels out again when the root's class or inline variables change.

* fix: Keep the Pixel Card's Decorative Presets as Given

The blue, yellow and pink presets have no theme role that reproduces them, so they
keep their original palettes and are recorded in the allowlist; only the default
palette, the one the app renders, reads theme roles.

* test: Cover the SAML Glyph Following the Button Text Colour

* fix: Lay the Pixel Card Out Again Only When Its Palette Changes

The root's inline style also carries unrelated variables such as the scrollbar gutter
and markdown font size, and relaying the pixels on every write blinked and replayed
an in-progress card. The allowlist now states what it covers and where the skipped
files are tracked.

* test: Key the Pixel Card Palette Mock by Variable Name

(cherry picked from commit f546dc2bee)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16482
2026-10-01 03:46:18 +00:00
Marco Beretta
67323e1797 🌫️ feat: Give the Dialog Scrims Theme-Owned Opacity Roles (#16492)
* feat: Give the Dialog Scrims Theme-Owned Opacity Roles

The three dialog families carried their scrim alpha in each utility
(bg-surface-overlay/80, /90, /65), so a theme could recolor a scrim but
not set how much it dims. Add scrimOpacity, alertScrimOpacity and
modalScrimOpacity, exposed as bg-scrim, bg-scrim-alert and
bg-scrim-modal in the published tokens, defaulting to the 80%, 90% and
65% each family drew.

ClickHouse takes Click UI's 0.75 from dialog.color.opaqueBackground,
cited in the drift guard. A bundled scrim never lifts the page and, on
a light canvas, separates the dialog by 3:1, which is why ClickHouse
dark keeps a black overlay rather than Click UI's lighter gray.

* test: Read the Dialog Scrim Through Its Role Class in the Morph and Settings Scenarios

Both scenarios pinned the old bg-surface-overlay/80 literal: the morph
counted elements carrying it and Settings compared its scrim with a
probe of it, whose color-mix value serializes differently from the
role's rgb(). They now use bg-scrim, the class DIALOG_SCRIM_CLASS
exports.

(cherry picked from commit 2d7133fcb1)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16492
2026-10-01 03:46:18 +00:00
Marco Beretta
1b8801dc07 🔤 feat: Give Display Type and the Type Scale Their Own Theme Roles (#16491)
* feat: Give Display Type and the Type Scale Their Own Theme Roles

Add a displayFontFamily appearance role, which the dialog titles compose
through font-display, and textXs..text2xl and leadingXs..leading2xl,
which the app's text-* utilities now read like the radius and shadow
scales. The defaults are Tailwind's own sizes and line heights and the
UI family, so the default theme is unchanged, and a theme that names
only its fontFamily keeps its headings in it.

ClickHouse takes Click UI's display family, font sizes 1 to 6 and its
1.5 product line height, cited in the drift guard. Basier Square is
named but not self-hosted: it is a commercial face, so browsers without
it fall through to the Inter stack.

* fix: Publish the Display Family Utility With the Theme Tokens

* fix: Keep the ClickHouse 2xl Step Below the Unthemed 3xl

Click UI has no size between 1.25rem and 2rem, and 2rem would overtake
Tailwind's unthemed text-3xl (1.875rem), so a responsive text-2xl to
sm:text-3xl heading shrank as the viewport grew. ClickHouse keeps
LibreChat's 1.5rem for 2xl at Click UI's line height, recorded as a
decision in the drift guard, and a registry test holds every bundled
2xl below 3xl.

(cherry picked from commit 400e4549ca)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16491
2026-10-01 03:46:18 +00:00
Marco Beretta
b2da59f08d 🚦 feat: Give Pressed and Disabled States Their Own Theme Roles (#16487)
* feat: Give Pressed and Disabled States Their Own Theme Roles

Add surface-pressed and surface-inverted-pressed, which IconButton takes
while held under a hover. They default to the hover fills a pointer
press has always shown, and a theme that names only its hovers presses
in them, so the default theme is unchanged.

Add surface-disabled, text-disabled and border-disabled, and a
disabledStyle appearance role: dim keeps the half-opacity treatment,
fill paints a disabled Checkbox, Switch, Field or IconButton in the
disabled roles through the theme-disabled variant. The root mirrors
the choice as data-theme-disabled. ClickHouse fills from Click UI's
disabled and active tokens, cited in the drift guard.

* fix: Ink Disabled Placeholders and Press the Submit Button in the State Roles

* fix: Ignore Color Roles a Client Predates and Fill Every Disabled Composer Slot

A cached client reading a newer server's inline theme rejected the
whole definition over one color role it did not know. The client
reader now ignores a well-formed rgb- role holding a triplet with a
warning, as it already did for appearance keys; the server keeps
rejecting unknown roles, where one is a typo in librechat.yaml.

The disabled fill moves into composerSubmitClasses, so the plain send
and stop buttons in Composer and DuringRunSendButton take it too.

* fix: Share One Disabled Fill Recipe Across Every Shared Control

Select, InputNumber, SecretInput, FilterInput and the Slider thumb only
dimmed under a fill theme. The theme-disabled classes now live in one
disabledFillClasses recipe that every shared control composes, and the
variant also matches Radix's data-disabled so a disabled slider thumb
takes the fill.

The deployment-theme scenario for an invalid theme now serves a
malformed color value, since a well-formed role the client predates is
ignored rather than rejected.

* fix: Fill a Disabled InputNumber Through Its Wrapper

rc-input-number puts the component's classes on a wrapper around the
disabled input, so the theme-disabled variant never matched it. Add a
theme-disabled-within variant for a wrapper that contains a disabled
control, and a disabledWithinFillClasses recipe InputNumber composes;
the input inherits the ink and shows the fill through its transparent
background. The default theme's disabled InputNumber is unchanged.

* fix: Carry the Disabled Roles to Every Shared Disabled Surface

Sweep every shared component that dims when disabled. Button-like
controls (AlertDialog and Dialog footer buttons, DialogTemplate's
select, the MultiSelect trigger) compose the fill recipe. Menu items,
tabs and the send-actions rows keep their surface and take the ink
through disabledInkClasses, as Click UI's genericMenu does, and Label
and FilterInput's floating label follow their control through
peerDisabledInkClasses. The variant also matches aria-disabled rows.
OGDialogTemplate and Button stay with the open PR that owns them.

* fix: Gray the Icons of Disabled Menu Rows Under a Fill Theme

A send-action or menu row's icon owns its color (text-status-warning,
text-text-secondary), so the inherited disabled ink left it bright.
The item ink recipe now recolors descendant icons too.

* fix: Fill the Dropdown Trigger and the OTP Group Under a Fill Theme

The default Dropdown trigger only dimmed, and its disabled:hover resets
tied with the fill; the shared recipe now pins the disabled hover fill
and ink too, and the trigger composes it. InputOTP dims its group with
has-[:disabled], so it takes the wrapper recipe.

* fix: Reach Child-Owned Ink and Slot Edges in the Disabled Recipes

A disabled control's own children, the SelectDropDown labels or a
checkbox glyph, kept their explicit ink, and a disabled OTP group's
slots kept their border. The fill and item recipes now carry the
disabled ink to descendants, the wrapper recipe carries the disabled
edge and ink to the group's parts, and SelectDropDown composes the fill
recipe.

* test: Probe Disabled Row Icons With the Recipe's Descendant Selector

* fix: Give Radio Segments, SecretInput Actions and DropdownPopup Items the Disabled Ink

These three dim their disabled state through a JS branch or Ariakit's
aria-disabled rather than a disabled: utility, so the earlier sweep
missed them. Each composes the item ink recipe, whose opacity reset
outranks the branch's opacity-50.

(cherry picked from commit 83d7afb0d1)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16487
2026-10-01 03:46:18 +00:00
Marco Beretta
228191ee7f 🎯 feat: Give Keyboard Focus Its Own Theme Roles (#16478)
* feat: Give Keyboard Focus Its Own Theme Roles

Add rgb-focus-outline for the app-wide keyboard focus outline and
rgb-focus-control for the shared primitives' focus ring. The defaults
reproduce the default theme exactly: a black and white outline, and
primitive rings in the primary text ink. A theme that names only
rgb-ring-primary keeps drawing its outline in that ring, and one that
names only rgb-text-primary keeps ringing its controls in that ink, so
the data-theme-ring marker is no longer needed.

ClickHouse sets both roles to Click UI outline.default, cited in the
drift guard. Every bundled palette holds both roles at 3:1 on its
canvases. Button keeps its ring until the open PR that owns it lands.

* test: Read the Opaque Ring Layer in the Focus Ring Probe

* fix: Draw the Popover Focus Outline in the Control Focus Role

(cherry picked from commit 7a99b5cef7)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16478
2026-10-01 03:46:18 +00:00