Skip to content

Commit 1e5096c

Browse files
authored
refactor(ui): one job per sidebar zone — shell chrome controls, header presence, slim footer (#112936)
* refactor(ui): one job per sidebar zone — move search/collapse to shell chrome, presence to chat header, slim footer * test(ui): point drawer-collapse e2e step at shell chrome nav toggle * refactor(ui): unexport lobsterLookStyleVars after logo stand-in removal * docs(web): describe shell chrome controls, slim footer, and header presence facepile * fix(ui): keep cluster search on native-nav hosts; draft-aware collapsed new-thread
1 parent b5232bc commit 1e5096c

26 files changed

Lines changed: 270 additions & 701 deletions

‎docs/web/control-ui.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ The **+** in the sidebar session-list header opens a full-page draft at `/new`:
227227

228228
Inside **Settings**, the dedicated sidebar includes **Ask OpenClaw** and starts with a **Search settings** field for quickly finding settings sections.
229229

230-
A **Search** field at the top of the sidebar opens the command palette (⌘K). Clicking the agent identity row at the top of the sidebar opens the agent menu; **Home** opens the main session. When something needs action — failed or overdue cron jobs, expiring or expired model auth — compact attention chips appear above the sidebar footer and click through to the owning page. The identity row shows the agent's avatar (identity image or emoji), name, connection dot, and a live subtitle. Clicking it opens the agent menu: an agent switcher (multi-agent setups), "What can this agent do?", **Agent settings**, **Settings**, mobile pairing, **Docs**, the build chip, and the color-mode toggle. Rosters above ten agents get a filter field and list pinned agents first; pin or unpin agents from the Agents settings page, with the pinned set stored in the browser profile. Choosing an agent scopes Chat plus Usage, Automations, Tasks, Workboard, and Sessions to that agent. Each scoped page exposes an **Agent** control with **All agents** as an escape; this widens the shared page scope without changing the concrete chat agent, while direct session links still open their target. The Agents settings page keeps its own `?agent=` selection and does not follow the shared page scope. The footer bar holds the product logo, the build chip, a gateway connection dot, and a Settings shortcut. When the gateway runs from a source checkout on a branch other than `main`, the footer also shows that branch name in red so a non-release gateway is obvious at a glance (release installs never show it). Shift-Command-Comma opens **Settings** without overriding the browser's Command-Comma shortcut. The sidebar header also holds the collapse toggle (⌘B); collapsing hides the sidebar entirely for a full-width workspace, and a floating expand control (or ⌘B) brings it back; the macOS app hosts that toggle natively in the titlebar instead. The sidebar is the only navigation chrome on desktop, with no top bar. Narrow viewports swap the sidebar for a slide-over drawer behind a compact header row holding the drawer toggle, brand, and command-palette search; on phones, Chat absorbs that navigation row into its title bar, with the menu and search controls beside the session title. In the macOS app the separate header row folds the titlebar clearance into a single compact strip beside the window controls. Navigation uses regular browser history, so the browser's back/forward buttons traverse it; the macOS app adds a native sidebar toggle next to the window controls plus trackpad swipe gestures, with back/forward buttons at the sidebar's right edge while it is expanded and native search (command palette) and new-session buttons while it is collapsed.
230+
On desktop web, a fixed control cluster at the top-left of the content area — the web counterpart of the macOS titlebar strip — holds the sidebar collapse toggle (⌘B) and the command-palette search button (⌘K). Clicking the agent identity row at the top of the sidebar opens the agent menu; **Home** opens the main session. When something needs action — failed or overdue cron jobs, expiring or expired model auth — compact attention chips appear above the sidebar footer and click through to the owning page. The identity row shows the agent's avatar (identity image or emoji), name, connection dot, and a live subtitle. Clicking it opens the agent menu: an agent switcher (multi-agent setups), "What can this agent do?", **Agent settings**, **Settings**, mobile pairing, **Docs**, the build chip, and the color-mode toggle. Rosters above ten agents get a filter field and list pinned agents first; pin or unpin agents from the Agents settings page, with the pinned set stored in the browser profile. Choosing an agent scopes Chat plus Usage, Automations, Tasks, Workboard, and Sessions to that agent. Each scoped page exposes an **Agent** control with **All agents** as an escape; this widens the shared page scope without changing the concrete chat agent, while direct session links still open their target. The Agents settings page keeps its own `?agent=` selection and does not follow the shared page scope. The footer bar holds your identity (avatar and name, opening your profile settings) and a Settings shortcut; a connection status pill appears only while the gateway is offline. Build and version details live in the agent menu's build chip and the About page. When the gateway runs from a source checkout on a branch other than `main`, the footer also shows that branch name in red so a non-release gateway is obvious at a glance (release installs never show it). Shift-Command-Comma opens **Settings** without overriding the browser's Command-Comma shortcut. Collapsing the sidebar (⌘B or the cluster's toggle) hides it entirely for a full-width workspace; while collapsed, the top-left cluster keeps the expand toggle and search and gains a new-thread button — mirroring what the macOS app hosts natively in its titlebar. The sidebar is the only navigation chrome on desktop, with no top bar. Narrow viewports swap the sidebar for a slide-over drawer behind a compact header row holding the drawer toggle, brand, and command-palette search; on phones, Chat absorbs that navigation row into its title bar, with the menu and search controls beside the session title. In the macOS app the separate header row folds the titlebar clearance into a single compact strip beside the window controls. Navigation uses regular browser history, so the browser's back/forward buttons traverse it; the macOS app adds a native sidebar toggle next to the window controls plus trackpad swipe gestures, with back/forward buttons at the sidebar's right edge while it is expanded and native search (command palette) and new-session buttons while it is collapsed.
231231

232232
Pending approvals also contribute an attention chip above the sidebar footer;
233233
select it to open the owning Approvals page.
@@ -419,10 +419,11 @@ The macOS app keeps its native link-browser sidebar for links clicked in the das
419419
- Live `chat` events are delivery state, while `chat.history` is rebuilt from the durable session transcript. After tool-final events the Control UI reloads history and merges only a small optimistic tail; the transcript boundary is documented in [WebChat](/web/webchat).
420420
- `chat.inject` appends an assistant note to the session transcript and broadcasts a `chat` event for UI-only updates (no agent run, no channel delivery).
421421
- The sidebar lists every loaded active session by agent section and pinned/channel/work/custom/Chats buckets with a single New Session action that opens the draft dialog. Opening a visible row moves only the highlight. Sessions can be dropped onto Pinned to pin them, or onto a custom group or Chats to move them; custom groups are collapsible and drag-reorderable, group names and order sync through the gateway, and collapsed state stays in the browser. A new dashboard session asynchronously gets a concise generated title from its first non-command message; explicit names and authenticated sender identity remain separate, so account names are never used as generated titles. Set `agents.defaults.utilityModel` (or `agents.entries.*.utilityModel`) to route this separate model call to a lower-cost model; if that distinct model fails, title generation retries once with the primary model. Expanding another agent section browses that agent's sessions without leaving the open chat.
422-
- Thread search lives in the command palette (⌘K, or the Search field at the top of the sidebar): typing a query follows a bounded number of matching pages across agents, filters internal child/cron rows, and lists visible matches next to navigation commands. The Threads page keeps the exhaustive searchable list with filters.
422+
- Thread search lives in the command palette (⌘K, or the search button in the top-left control cluster): typing a query follows a bounded number of matching pages across agents, filters internal child/cron rows, and lists visible matches next to navigation commands. The Threads page keeps the exhaustive searchable list with filters.
423423
- Each sidebar row keeps direct pin access plus a full context menu for unread state, rename, fork, grouping, archive, and delete. Multi-selected rows (Cmd/Ctrl-click, Shift-click for ranges) get a batch menu covering unread state, grouping, archive, and delete; batch archive/delete stays disabled unless every selected session is archivable. An active run and an agent's main session cannot be archived. Archiving or deleting the currently selected session switches Chat back to that agent's main session.
424424
- In the macOS app, the OpenClaw mark uses the otherwise-empty native titlebar strip next to the window controls instead of consuming a sidebar row.
425425
- On desktop widths, chat controls stay on one compact row and collapse while scrolling down the transcript; scrolling up, returning to the top, or reaching the bottom restores the controls.
426+
- The session header shows a small facepile beside the workspace chip when other people are viewing the same session; it lists up to four viewer avatars with an overflow count and disappears when you are alone.
426427
- Consecutive duplicate text-only messages render as one bubble with a count badge. Messages that carry images, attachments, tool output, or canvas previews are left uncollapsed.
427428
- User-message bubbles carry transcript actions: a hover rewind button (confirm popover with a "Don't ask again" option) plus right-click **Rewind to here** and **Fork from here**. Rewind repoints the session to the state just before that message and returns its text to the composer for edit and resend (`sessions.rewind`, `operator.admin`); fork creates a new session from the active-path prefix before the message, opens it, and seeds its composer with the same text (`sessions.fork`, `operator.write`). Both actions disable with an explanatory tooltip while the agent is working, apply only to persisted user messages, and are rejected for sessions whose conversation is owned by an external agent harness. Rewind moves chat context only — files and other tool side effects are not reverted — and the pre-rewind transcript remains preserved in the append-only session store. When that store contains multiple transcript branches, the chat title bar shows a branch menu with each branch's latest message, message count, and recency; selecting an inactive branch switches the current session back to that preserved path (`sessions.branches.list`, `operator.read`; `sessions.branches.switch`, `operator.admin`). Branch switching is also unavailable while the agent is working, and selecting the already-active branch is a typed no-op error at the RPC boundary. The separate hide action on user bubbles hides a message in the current browser only; the message stays in the transcript and the agent still sees it.
428429
- 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. Detection runs server-side through `controlUi.sessionPullRequests`, which reuses the Gateway's `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. 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.

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

Lines changed: 62 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import { isGatewayMethodAdvertised } from "../lib/gateway-methods.ts";
5454
import { createIdleImport } from "../lib/idle-import.ts";
5555
import { isWorkboardEnabledInConfigSnapshot } from "../lib/plugin-activation.ts";
5656
import { searchForSession } from "../lib/sessions/index.ts";
57+
import { normalizeAgentId } from "../lib/sessions/session-key.ts";
5758
import "../lib/toast.ts";
5859
import { isTerminalAvailable } from "../lib/terminal-availability.ts";
5960
import { OpenClawLightDomElement } from "../lit/openclaw-element.ts";
@@ -125,6 +126,9 @@ type AppSidebarElement = HTMLElement & {
125126
const ROUTE_IDS_WITHOUT_WORKBOARD = APP_ROUTE_IDS.filter((routeId) => routeId !== "workboard");
126127
const AGENT_ROSTER_REFRESH_DEBOUNCE_MS = 100;
127128
const EMPTY_OUTBOX_COUNT_FOR_SESSION = () => 0;
129+
const PALETTE_SHORTCUT = /Mac|iP(hone|ad|od)/i.test(globalThis.navigator?.platform ?? "")
130+
? "⌘K"
131+
: "Ctrl K";
128132

129133
type StoredOutboxScopeHost = {
130134
settings: { gatewayUrl?: string | null };
@@ -938,7 +942,7 @@ class OpenClawShell extends OpenClawLightDomElement {
938942
});
939943
if (nextNavCollapsed) {
940944
void this.updateComplete.then(() => {
941-
this.restoreFocusTo(this.querySelector<HTMLElement>(".shell-nav-expand"));
945+
this.restoreFocusTo(this.querySelector<HTMLElement>(".shell-chrome-controls__nav-toggle"));
942946
});
943947
}
944948
}
@@ -987,6 +991,10 @@ class OpenClawShell extends OpenClawLightDomElement {
987991
context.navigation.update({ navWidth });
988992
}
989993

994+
private openNewSession(agentId: string, target?: NewSessionTarget) {
995+
this.navigate("new-session", { search: newSessionSearch(agentId, target) });
996+
}
997+
990998
// Shipped Mac app builds without web chrome still drive these handlers.
991999
private readonly handleNativeToggleSidebar = () => {
9921000
this.toggleNavigationSurface();
@@ -1018,9 +1026,7 @@ class OpenClawShell extends OpenClawLightDomElement {
10181026
return;
10191027
}
10201028
const agentId = context.agentSelection.state.selectedId ?? "";
1021-
this.navigate("new-session", {
1022-
search: agentId ? `?agent=${encodeURIComponent(agentId)}` : "",
1023-
});
1029+
this.openNewSession(agentId);
10241030
};
10251031

10261032
private readonly handleNativeHistoryState = (event: Event) => {
@@ -1585,6 +1591,12 @@ class OpenClawShell extends OpenClawLightDomElement {
15851591
mobileNavLayout,
15861592
});
15871593
const shellWidth = Math.max(globalThis.innerWidth || 0, NAV_WIDTH_MAX);
1594+
// Mirror the sidebar brand action: an open new-session draft wins over the
1595+
// persisted selection so the collapsed cluster "+" targets the same agent.
1596+
const selectedAgentId = normalizeAgentId(
1597+
this.draftSessionAgentId() ||
1598+
(context.agentSelection.state.selectedId ?? gatewaySnapshot.assistantAgentId),
1599+
);
15881600
// One storage read per render; theme.refresh() re-renders on pref changes.
15891601
const uiSettings = loadSettings();
15901602
// The new-session draft shares the chat layout: full-height pane that owns
@@ -1648,19 +1660,52 @@ class OpenClawShell extends OpenClawLightDomElement {
16481660
.onOpenPalette=${this.openPalette}
16491661
.onToggleDrawer=${(trigger: HTMLElement) => this.toggleNavigationSurface(trigger)}
16501662
></openclaw-app-topbar>
1651-
${navCollapsed && !onboarding
1663+
${!onboarding && !settingsTakeover && !mobileNavLayout
16521664
? html`
1653-
<openclaw-tooltip .content=${`${t("nav.expand")} (⌘B)`}>
1654-
<button
1655-
type="button"
1656-
class="shell-nav-expand"
1657-
aria-label=${t("nav.expand")}
1658-
aria-expanded="false"
1659-
@click=${() => this.toggleNavigationSurface()}
1665+
<div class="shell-chrome-controls">
1666+
<openclaw-tooltip
1667+
.content=${`${t(navCollapsed ? "nav.expand" : "nav.collapse")} (⌘B)`}
16601668
>
1661-
${icons.panelLeftOpen}
1662-
</button>
1663-
</openclaw-tooltip>
1669+
<button
1670+
type="button"
1671+
class="shell-chrome-controls__button shell-chrome-controls__nav-toggle"
1672+
aria-label=${t(navCollapsed ? "nav.expand" : "nav.collapse")}
1673+
aria-expanded=${navCollapsed ? "false" : "true"}
1674+
@click=${() => this.toggleNavigationSurface()}
1675+
>
1676+
${navCollapsed ? icons.panelLeftOpen : icons.panelLeftClose}
1677+
</button>
1678+
</openclaw-tooltip>
1679+
${navCollapsed
1680+
? html`<openclaw-tooltip
1681+
.content=${gatewaySnapshot.connected
1682+
? t("chat.runControls.newSession")
1683+
: t("chat.runControls.newSessionDisconnected")}
1684+
>
1685+
<button
1686+
type="button"
1687+
class="shell-chrome-controls__button shell-chrome-controls__new-thread"
1688+
aria-label=${t("chat.runControls.newSession")}
1689+
?disabled=${!gatewaySnapshot.connected}
1690+
@click=${() => this.openNewSession(selectedAgentId)}
1691+
>
1692+
${icons.plus}
1693+
</button>
1694+
</openclaw-tooltip>`
1695+
: nothing}
1696+
<openclaw-tooltip
1697+
.content=${`${t("chat.openCommandPalette")} (${PALETTE_SHORTCUT})`}
1698+
>
1699+
<button
1700+
type="button"
1701+
class="shell-chrome-controls__button shell-chrome-controls__search"
1702+
aria-label=${t("chat.openCommandPalette")}
1703+
@click=${this.openPalette}
1704+
>
1705+
${icons.search}
1706+
</button>
1707+
</openclaw-tooltip>
1708+
</div>
16641709
`
16651710
: nothing}
16661711
<div class="shell-nav">
@@ -1726,14 +1771,10 @@ class OpenClawShell extends OpenClawLightDomElement {
17261771
.updateAvailable=${navigationSurfaceHidden ? null : overlaySnapshot.updateAvailable}
17271772
.updateRunning=${overlaySnapshot.updateRunning}
17281773
.onUpdate=${() => void context.overlays.runUpdate()}
1729-
.onOpenPalette=${this.openPalette}
17301774
.onOpenApprovals=${this.openApprovals}
1731-
.onToggleSidebar=${() => this.toggleNavigationSurface()}
17321775
.onRetryConnect=${() => context.gateway.connect()}
1733-
.onOpenNewSession=${(agentId: string, target?: NewSessionTarget) => {
1734-
const search = newSessionSearch(agentId, target);
1735-
this.navigate("new-session", { search });
1736-
}}
1776+
.onOpenNewSession=${(agentId: string, target?: NewSessionTarget) =>
1777+
this.openNewSession(agentId, target)}
17371778
.draftSessionAgentId=${this.draftSessionAgentId()}
17381779
.onUpdateSidebarEntries=${(entries: string[]) =>
17391780
context.navigation.update({ sidebarEntries: entries })}

‎ui/src/components/app-sidebar-agent-menu.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { openExternalUrlSafe } from "../lib/open-external-url.ts";
1212
import { normalizeAgentId } from "../lib/sessions/session-key.ts";
1313
import { renderAgentSelectAvatar, renderAgentSelectCopy } from "./agent-select.ts";
1414
import { icons, type IconName } from "./icons.ts";
15+
import "./sidebar-build-chip.ts";
1516
import {
1617
consumeDropdownKeyboardDismissal,
1718
syncDropdownItemRadio,

0 commit comments

Comments
 (0)