Skip to content

Commit aed4510

Browse files
improve(ui): unify chat side rails in a tabbed panel (#123874)
* Control UI: unify chat rails in a tabbed panel * fix(ui): compact chat side panel navigation * Polish rail separators around the active tab * Soften rail tab separators * Inset the rail tab strip from the resize handle * Remove the rail tab strip bottom rule * Add compact close controls to rail tabs * Redistribute rail tabs after closing a surface * Restore bottom docking from the rail terminal * Fade clipped rail tab labels at the edge * Add drag reordering to rail tabs * Polish terminal tab chrome * Polish rail tab close controls * Regularize rail tab separators * Space rail tabs evenly * Add feedback to inactive rail tabs * Smooth rail tab selection * Hide unavailable rail menu items * Preserve browser multi-tab entry * Support bottom-docked rail tabs * Polish rail tab sizing * Refine side panel actions * Neutralize rail empty-state icons * Separate dark rail surfaces * Fade only clipped rail tab labels * Compact rail header controls * Refine the surface picker * Raise and tighten the surface empty state * Keep Browser and Tasks in the chat topbar * Unify surface list cards * Keep embedded rails inside their dock * Reveal rail tab close actions on demand * Show full rail labels only when clipped * Let rail tabs use available space * Align chat topbar surface controls * Unify rail surface empty states * Center rail tab glyphs * Fade clipped rail labels smoothly * Keep rail tab labels visible * Tighten rail tab separator and label fade * Keep the new-tab control beside the rail tabs * Keep rail tab separators from reflowing on activation * Anchor the new-tab control outside the rail tab scroll * Scroll rail tabs at the floor instead of clipping them * Tighten spacing between rail tabs * Report an unusable terminal open response as a readable failure * Keep the terminal session menu inside the panel * Share one dock destination cluster across rails, terminal and browser * Align the terminal mini rail with its management icons * Tidy panel pickers, browser chrome and task detail retry * Type the sidebar callbacks object so tsgo:ui passes * Space out the panel picker rows * Measure tab strip edges by rect and cancel superseded installs * Validate every terminal session field and release unusable sessions * Fold the terminal rail stretch rules into one * test(ui): match rail tab checks to the tabbed panel header Anchoring the new-tab control outside the scroll area wrapped the strip in .side-panel__header-tabs, and every query written as a direct-child chain started matching nothing. The assertions did not fail loudly: they compared an empty label list, so three side-panel journeys and the background-tasks rail went red on a selector detail rather than on behaviour. Give the label query one named owner scoped to the panel's own header, so Terminal and Browser strips in the panel body stay excluded while header layout can keep moving. Freeing that width also means two short tabs now fit where they used to be squeezed, so the closing step asserts the honest invariant - a strip that fits again releases the fade - while the overflow and tooltip regime stays proven earlier in the same journey. Settle the shared side-panel helper on whichever surface renders: an empty panel offers its type list and a populated one offers the header menu, and probing before either existed left it waiting for a control that never comes. Also drop a shadowed seed binding and an unused locator that oxlint flagged in the same file. * fix(ui): adapt session discussion slot to the unified panel layout * test(ui): capture the bottom dock evidence with a resting divider * fix(ui): drop the dead previousDock toggle path * test(ui): align sibling suites with the tabbed panel decisions * fix(ui): keep narrow-pane hides above the icon-button styling cascade * fix(ui): create tooltip descriptions via ownerDocument * fix(lint): merge duplicate terminal header styles and drop dead branches * refactor(ui): extract embedded panel templates from the pane render * refactor(ui): delete rail-era dead exports * test(ui): repair type drift after the rebase * fix(ui): keep the workspace toggle module-local and settle test caps * fix(ui): give side-panel tabs their runtime and their own header actions The tabbed side panel dropped two things the old rails owned. The discussion tab lost its only runtime registration, so `openclaw-session-discussion` was never defined and the tab rendered as a permanently blank box; it now loads through the per-slot lazy runtime map like the other panel types. Panels also have no header of their own anymore, so any action on the active panel's content had to reach the shared header. The header now takes panel contributed actions instead of a discussion-only open-url special case, which brings back the side-chat "Clear thread" overflow menu — its gateway reset had no reachable entry point at all in the embedded rail. * test(ui): anchor the sidebar scroll proof to the panel host The bounding contract moved from `.sidebar-column__panel` to `.side-panel__panel`; mounting the detail panel under the removed class let it grow instead of scroll, so the test failed for its harness rather than for the behavior it guards. * refactor(ui): move side-panel wiring out of the chat render monolith `chat-pane-render.ts` crossed its line budget. The region callbacks are layout policy, so they resolve in the layout module with the pane injecting only what it owns, and the two panel-action producers collapse into the single header contribution the region consumes. * fix(ui): keep one terminal intent queue per document A session route mounts the side-panel terminal beside the shell instance kept for the bottom dock. Each owned a private action array over one sessionStorage key, so their whole-array writes erased each other's intents and a freshly mounted panel drained through a reconnect fence it never saw. The queue, its persisted record, and the fence now belong to the document; panels bind as executors while connected. The chat pane records a toggle intent where it observes it, instead of parking the raw event in memory and handing it to a panel that may not be mounted yet — a service-worker reload in that window dropped the request, thread id and all, with nothing explaining why. That makes the deferred-restore handshake dead weight, so it goes. * fix(ui): let the panel that starts a terminal intent finish it Opening a catalog terminal from a chat route mounts the side-panel terminal right after the request, which swapped the queue's executor mid-flight and stranded the in-flight action; the panel's own mount restore then opened a plain session instead. The executor that began an action stays responsible for it as long as it can still run. * test(ui): cover closed legacy side docks * refactor(ui): split side panel controllers * fix(ui): stabilize embedded panel handoffs * style(ui): format browser panel refresh * test(ui): settle catalog prepend paint incrementally * docs(ui): describe the unified chat side panel * test(ui): settle catalog clock transitions --------- Co-authored-by: Jason (Json) <[email protected]>
1 parent 8d262b9 commit aed4510

108 files changed

Lines changed: 5533 additions & 4593 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/web/control-ui.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,15 @@ The audit ledger is best-effort operational evidence, not a lossless compliance
418418

419419
## Operator terminal
420420

421-
The dockable operator terminal is enabled by default; set `gateway.terminal.enabled: false` and restart the Gateway to opt out. The terminal requires an `operator.admin` connection and opens a host PTY in the active agent workspace. New tabs follow the currently selected chat agent.
421+
The operator terminal is enabled by default; set `gateway.terminal.enabled: false` and restart the Gateway to opt out. The terminal requires an `operator.admin` connection and opens a host PTY in the active agent workspace. New tabs follow the currently selected chat agent.
422422

423423
<Warning>
424424
The terminal is an unconfined host shell and inherits the Gateway process environment. Disable it with `gateway.terminal.enabled: false` on deployments where admin operators should not get a host shell. OpenClaw refuses terminal sessions for agents with `sandbox.mode: "all"`; changing an active agent to that mode closes its existing and in-flight terminal sessions.
425425
</Warning>
426426

427-
Use **Ctrl + backtick** to toggle the terminal. The layout supports bottom and right docking or a main-content mode, resizes with the browser viewport, and keeps multiple shell tabs. Opening a Codex or Claude Code session from the catalog selects main-content mode. See [Gateway configuration](/gateway/configuration-reference#gateway) for `gateway.terminal.enabled` and the optional `gateway.terminal.shell` override.
427+
Use **Ctrl + backtick** to toggle the **Terminal** tab in the selected Chat pane's unified side panel. You can also open **Terminal** from the panel's **+** menu. The shared panel docks right or bottom, resizes with the browser viewport, can expand over the Chat pane, and keeps multiple shell tabs. Opening a Codex or Claude Code session from the catalog selects **Terminal** and expands the panel. See [Gateway configuration](/gateway/configuration-reference#gateway) for `gateway.terminal.enabled` and the optional `gateway.terminal.shell` override.
428+
429+
The unified panel also hosts **Browser**, **Files**, **Tasks**, **Review**, **Side chat**, and capability-dependent **Desktop** and **Discussion** tabs. Its open or minimized state, active tab, tab order, width, dock, and expanded state are stored per session in the current browser profile, so switching sessions restores each session's own working layout. Drag tabs to reorder them, close a tab without closing the other tools, or use the panel close button to minimize the whole panel.
428430

429431
Owner-authorized, unsandboxed agents can use the `terminal` tool for long or interactive work that the operator should watch. Each tool call can open, read, write, resize, close, or list the agent's own gateway PTYs. New sessions open a co-attached Control UI tab by default, so the agent and operator share output and either can type or resize. Agent access is exact-session scoped: an agent cannot read or control operator-created terminals or terminals opened by another agent session.
430432

@@ -447,7 +449,7 @@ The terminal is also available as a [full-screen terminal document](/web/urls#sp
447449

448450
## Browser panel
449451

450-
The Control UI ships a dockable browser panel that renders the Gateway-controlled browser (the same one agents drive through the [browser tool](/tools/browser-control)) in any regular web browser - no native webview required. It appears when the connected Gateway advertises `browser.request` to an `operator.admin` connection; the globe button in the thread workspace rail toggles it. The panel shows a live page snapshot with tabs, an editable URL bar, back/forward/reload, and open-in-your-browser, docks right or bottom, and forwards clicks, wheel scrolling, and basic typing to the remote page. The remote page follows the panel: opening the dock, resizing it, or switching tabs resizes the remote browser viewport to the panel's available space, so the snapshot fills the dock instead of rendering at whatever size an agent last used.
452+
The Control UI ships a **Browser** tab in the unified Chat side panel that renders the Gateway-controlled browser (the same one agents drive through the [browser tool](/tools/browser-control)) in any regular web browser - no native webview required. It appears in the panel's **+** menu when the connected Gateway advertises `browser.request` to an `operator.admin` connection; the globe action in **Files** toggles it. Choosing **Browser** again while its panel tab is already open creates another remote browser tab. The panel shows a live page snapshot with tabs, an editable URL bar, back/forward/reload, and open-in-your-browser, and forwards clicks, wheel scrolling, and basic typing to the remote page. The remote page follows the shared panel: opening it, resizing it, or switching tabs resizes the remote browser viewport to the panel's available space, so the snapshot fills the panel instead of rendering at whatever size an agent last used.
451453

452454
Enable **Open links in Control UI browser** under **Settings → Infrastructure → Browser** to route external HTTP(S) links into new tabs in this panel. The browser-local preference is off by default and appears only while the panel is available; it applies in regular browser-hosted and app-hosted Control UI. Same-origin links, links marked for download, Shift/Alt clicks, file/editor links, email and phone links, right-click actions, and explicit open-in-your-browser actions keep their existing behavior.
453455

@@ -506,11 +508,11 @@ Capability toggles stay disabled until the Gateway, session, and runtime config
506508
- When a session's checkout sits on a non-default branch of a GitHub repository, the chat view pins pull request chips above the composer: PR number, repo, branch, diff counts, a CI pill, and draft/merged/closed state, each linking to the PR. The row shows at most two chips — live (open/draft) PRs first — and a "Show more" button reveals collapsed merged/closed history. The CI pill opens a small CI monitoring popover with passed/failed/running/skipped check counts and a link to the PR's checks page. The Gateway polls only sessions visible in a connected Control UI and pushes changed snapshots through `controlUi.sessionPullRequests.changed`; it reuses `GH_TOKEN`/`GITHUB_TOKEN` when set. When the GitHub API rate limit is hit, chips keep the last known status and show a warning that the status may be out of date; dismissing a chip hides it for that session in the current browser profile. Before any PR exists, the row shows the branch itself — repo, branch name, and the +/− size of the diff against the default-branch merge base (committed and uncommitted work). Once the pushed branch has commits to compare, the row adds a Create PR button that opens GitHub's new-pull-request page; before that, a session with changed files (committed, uncommitted, or untracked) still gets the row without the button. The row hides itself while an open or draft PR exists; once the branch's PR is merged and the pushed tip still matches the merged head, the row disappears too (returning without the Create PR button only when new local work appears, and with it once new commits are pushed past the merged head). The branch row comes from local git only, so it stays available while GitHub is rate limited and carries the same stale-status warning, since "no PR found" cannot be trusted until the limit resets.
507509
- The session diff panel shows what a session's checkout actually changed: the branch button in the workspace rail or chat title bar opens a dense per-file viewer with normalized added/deleted/modified counts, collapsible files, wrapping and unified/split layouts, file copy/open/editor actions, and "N unmodified lines" markers between hunks. The footer switches between all changes, uncommitted work, and individual commits while showing how far the branch is ahead of its merge base; committed branches also provide a copyable local sync command. Diffs are computed server-side through the `sessions.diff` Gateway method (`operator.read` scope); binary and oversized files degrade to stats-only entries, and the button only appears when the connected Gateway advertises `sessions.diff`.
508510
- Every Chat pane has a title bar. Click the session title to rename it; the workspace chip copies the checkout path or branch and can reveal local Gateway workspaces in the host file manager. Remote and exec-node sessions keep copy actions but hide reveal.
509-
- The thread workspace rail in each Chat pane lists thread files, project files, and artifacts. It docks to the pane's right edge by default; drag its header (or use the dock button) to move it to the bottom, and the choice is stored in the current browser profile. A collapsed rail takes no space at all: reopen it with ⇧⌘B or the files toggle in the title bar, which carries a changed-file count badge. The separate file, tool, and Canvas detail panel is unaffected.
511+
- The **Files** tab in each Chat pane's unified side panel lists thread files, project files, and artifacts. Reopen it with ⇧⌘B, the files toggle in the title bar, or the panel's **+** menu; the title-bar toggle carries a changed-file count badge.
510512
- File paths recognized in chat messages read as their basename with a small glyph for the file type in front — a Markdown page, a `package.json` manifest, a TypeScript source, a `.tsx` component, a config or data file, a shell script, and an image each get their own mark, and anything else falls back to a plain document. When two links in the same message share a basename, each keeps just enough of its trailing path to stay distinct. The full path stays on the link: it is what the tooltip shows, what opens in the file panel, and what the message's **Copy** action returns, since copy hands back the original Markdown. Labels you write yourself in a `[label](path)` link are never rewritten. The glyph is drawn from the bundled icon set, never fetched from the network, and is decorative only: it is not read by screen readers and is not part of copied text. Text that is not a recognizable path — anything carrying spaces, parentheses, a `#` fragment, or a `?` query — stays plain prose.
511-
- Clicking a file reference in chat, a file path in an expanded read/edit/write tool card, or a file row in the workspace rail opens the file detail panel. UTF-8 text files use a CodeMirror-based code view with syntax highlighting, line numbers, jump-to-line, in-file search, copy actions, and an open-in-external-editor menu. AVIF, GIF, JPEG, PNG, and WebP images no larger than 256 KiB render inline; other binary files show metadata without lossy text decoding. When the Gateway advertises `sessions.files.set` to an `operator.admin` connection, the text panel adds an Edit mode with dirty tracking and Cmd/Ctrl-S save; unsaved drafts survive file, panel, and session navigation in the current browser tab until explicitly saved or discarded. Saves are compare-and-swap on a content hash returned by `sessions.files.get`: if the file changed on disk since it was loaded (for example because the agent kept working), the panel shows a conflict notice with Reload (take the latest content) and Overwrite (keep the local edit) actions. Writes go through the same fs-safe workspace guards as reads — path containment, symlink/hardlink rejection, and a 256 KiB UTF-8 cap — and only overwrite existing files; the editor never creates or deletes them.
512-
- The background tasks rail in each Chat pane is the list of the current agent's background tasks and subagents (`tasks.list` scoped by agent, kept live by `task` events): running work shows a live elapsed timer, tool-use count, the tool currently in use, and a stop control, while the collapsible finished section adds run durations. Selecting a task from either a rail row or an inline subagent activity row opens its live status and transcript in the detail sidebar without replacing the main conversation; tasks whose session is the current conversation show their prompt and output inspector there instead. Open the rail with the title-bar activity toggle; the task snapshot loads eagerly, so it carries a running-count badge without opening the rail first. The Tasks page remains the full cross-agent ledger.
513-
- The workspace rail, background tasks rail, and detail panel adapt to each pane's own width rather than the window: in a narrow pane or compact window both rails present as bottom strips (side-dock controls hide until the pane widens; the workspace rail keeps first claim on the side slot when only one column fits), and the detail panel stacks below the thread with a horizontal resize handle instead of sharing the row with it. Phone-sized viewports still open the detail panel full-screen.
513+
- Clicking a file reference in chat, a file path in an expanded read/edit/write tool card, or a file row in **Files** opens the **Review** tab. UTF-8 text files use a CodeMirror-based code view with syntax highlighting, line numbers, jump-to-line, in-file search, copy actions, and an open-in-external-editor menu. AVIF, GIF, JPEG, PNG, and WebP images no larger than 256 KiB render inline; other binary files show metadata without lossy text decoding. When the Gateway advertises `sessions.files.set` to an `operator.admin` connection, the text panel adds an Edit mode with dirty tracking and Cmd/Ctrl-S save; unsaved drafts survive file, panel, and session navigation in the current browser tab until explicitly saved or discarded. Saves are compare-and-swap on a content hash returned by `sessions.files.get`: if the file changed on disk since it was loaded (for example because the agent kept working), the panel shows a conflict notice with Reload (take the latest content) and Overwrite (keep the local edit) actions. Writes go through the same fs-safe workspace guards as reads — path containment, symlink/hardlink rejection, and a 256 KiB UTF-8 cap — and only overwrite existing files; the editor never creates or deletes them.
514+
- The **Tasks** tab lists the current agent's background tasks and subagents (`tasks.list` scoped by agent, kept live by `task` events): running work shows a live elapsed timer, tool-use count, the tool currently in use, and a stop control, while the collapsible finished section adds run durations. Selecting a task from either a task row or an inline subagent activity row opens its live status and transcript in **Review** without replacing the main conversation; tasks whose session is the current conversation show their prompt and output inspector there instead. Open **Tasks** with the title-bar activity toggle or the panel's **+** menu; the task snapshot loads eagerly, so the title-bar toggle carries a running-count badge without opening the tab first. The Tasks page remains the full cross-agent ledger.
515+
- The unified side panel adapts to each pane's own width rather than the window: it can dock right or bottom in a wide pane, falls back to a bottom strip in a narrow pane or compact window, and hides its dock controls until the pane widens. Phone-sized viewports still open review content full-screen.
514516
- The chat header model and thinking pickers patch the active session immediately through `sessions.patch`; they are persistent session overrides, not one-turn-only send options.
515517
- **Split view:** open it from the chat title bar (beside the thread diff, background tasks, and thread files toggles), then split the active pane right or down for as many panes as fit. Each pane has its own thread, transcript, composer, and tool stream.
516518
- Agents with the `screen` tool can request the same pane, sidebar, terminal, browser, focus, and navigation changes while a capable Control UI is connected. Protocol v1 applies the command to every connected capable Control UI; see [Screen](/tools/screen).

‎ui/src/app/app-host.dock-suppression.test.ts‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ describe("OpenClaw shell dock suppression", () => {
120120
const container = document.createElement("div");
121121
const desktopAvailable = () =>
122122
(
123-
container.querySelector("openclaw-desktop-panel") as HTMLElement & {
124-
available: boolean;
125-
}
126-
).available;
123+
container.querySelector("openclaw-desktop-panel") as
124+
| (HTMLElement & {
125+
available: boolean;
126+
})
127+
| null
128+
)?.available ?? false;
127129

128130
shell.routeState = { routeId: "appearance" };
129131
renderLit(shell.render(), container);
@@ -164,11 +166,12 @@ describe("OpenClaw shell dock suppression", () => {
164166
expect(
165167
(
166168
container.querySelector("openclaw-terminal-panel") as HTMLElement & {
167-
suppressed: boolean;
169+
sessionBottomOnly: boolean;
168170
}
169-
).suppressed,
170-
).toBe(false);
171-
expect(desktopAvailable()).toBe(true);
171+
).sessionBottomOnly,
172+
).toBe(true);
173+
expect(container.querySelector("openclaw-browser-panel")).toBeNull();
174+
expect(container.querySelector("openclaw-desktop-panel")).toBeNull();
172175

173176
shell.routeState = {
174177
routeId: "new-session",

‎ui/src/app/app-host.test-support.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,23 @@ export function resetAppHostTestGlobals(): void {
1616
);
1717
vi.unstubAllGlobals();
1818
}
19+
20+
export type TestOptionalCustomElement = {
21+
tagName: string;
22+
label: string;
23+
loadModule: () => Promise<unknown>;
24+
};
25+
26+
let lazyElementSequence = 0;
27+
28+
export function createLazyElementSpec(label: string): TestOptionalCustomElement {
29+
lazyElementSequence += 1;
30+
const tagName = `openclaw-app-host-lazy-${lazyElementSequence}`;
31+
return {
32+
tagName,
33+
label,
34+
loadModule: async () => {
35+
customElements.define(tagName, class extends HTMLElement {});
36+
},
37+
};
38+
}

0 commit comments

Comments
 (0)