Skip to content

Commit 00a6ecb

Browse files
authored
feat(ui): always-on chat title bar with inline rename and workspace actions (#109422)
* feat(gateway): add sessions.files.reveal to open a session workspace on the gateway host Resolves the session's workspace root server-side (same resolution as sessions.files.list), refuses exec-node and cloud-worker placements, and opens the directory with the platform opener. The opener helpers move out of config.ts into a shared open-path module that config.openFile now uses. * feat(ui): always-on chat title bar with inline rename and workspace menu Every chat pane now renders its header: click the session title to rename it inline (Enter commits via sessions.patch, Escape cancels), a workspace chip names the session's checkout with reveal/copy-path/copy-branch actions, and cloud-worker sessions show a globe. The single-pane floating toggle cluster and the transcript's reserved titlebar drag band fold into the header, which keeps native macOS window dragging. * fix(ui): resolve title-bar session aliases and clear the collapsed-nav overlay Live verification found two gaps: route aliases like ?session=main showed the generic key-derived title instead of the session's label (resolve via hello defaults + key equivalence, matching the pane), and the floating sidebar-expand pill overlapped the header title on plain web while the nav was collapsed (52px inset, mirroring the native-shell clearances). * fix(ui): keep the protocol schema layer out of the Control UI startup bundle The title-bar change made session-row-badges runtime-import the gateway-protocol barrel for one classifier, dragging typebox and every schema into startup JS (395 KiB gzip vs the 370 KiB budget). The placement vocabulary now lives in a dependency-free session-placement-state module: the schema union derives from it, the barrel re-exports it, and the UI deep-imports it (startup back to 361.8 KiB). * fix(gateway-protocol): keep SessionPlacementStateSchema statically typed Type.Union over a mapped array loses tuple inference and collapses Static to never; the literal list stays explicit with a compile-time guard tying it to the shared SESSION_PLACEMENT_STATES vocabulary. * chore(protocol): regenerate Swift/Kotlin bindings for sessions.files.reveal * chore: narrow new exports flagged by the deadcode gate * chore(i18n): leave generated locale artifacts to the locale-refresh workflow The generated-artifact isolation gate (067635c) landed mid-flight; source PRs now carry en.ts only.
1 parent 082ffd4 commit 00a6ecb

33 files changed

Lines changed: 1664 additions & 389 deletions

‎apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayProtocol.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ enum class GatewayMethod(
203203
SessionsFilesList("sessions.files.list"),
204204
SessionsFilesGet("sessions.files.get"),
205205
SessionsFilesSet("sessions.files.set"),
206+
SessionsFilesReveal("sessions.files.reveal"),
206207
ArtifactsList("artifacts.list"),
207208
ArtifactsGet("artifacts.get"),
208209
ArtifactsDownload("artifacts.download"),

‎apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4554,6 +4554,46 @@ public struct SessionsFilesGetResult: Codable, Sendable {
45544554
}
45554555
}
45564556

4557+
public struct SessionsFilesRevealParams: Codable, Sendable {
4558+
public let key: String
4559+
public let agentid: String?
4560+
4561+
public init(
4562+
key: String,
4563+
agentid: String? = nil)
4564+
{
4565+
self.key = key
4566+
self.agentid = agentid
4567+
}
4568+
4569+
private enum CodingKeys: String, CodingKey {
4570+
case key
4571+
case agentid = "agentId"
4572+
}
4573+
}
4574+
4575+
public struct SessionsFilesRevealResult: Codable, Sendable {
4576+
public let ok: Bool
4577+
public let path: String?
4578+
public let error: String?
4579+
4580+
public init(
4581+
ok: Bool,
4582+
path: String? = nil,
4583+
error: String? = nil)
4584+
{
4585+
self.ok = ok
4586+
self.path = path
4587+
self.error = error
4588+
}
4589+
4590+
private enum CodingKeys: String, CodingKey {
4591+
case ok
4592+
case path
4593+
case error
4594+
}
4595+
}
4596+
45574597
public struct SessionsFilesSetParams: Codable, Sendable {
45584598
public let sessionkey: String
45594599
public let path: String

‎docs/web/control-ui.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,16 @@ The macOS app keeps its native link-browser sidebar for links clicked in the das
368368
- 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.
369369
- 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.
370370
- 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.
371-
- The session diff panel shows what a session's checkout actually changed: the branch button (in the workspace rail header, the split-pane header, or the floating button in single-pane chat) opens the detail panel with a per-file diff of branch, uncommitted, and untracked work against the checkout's default-branch merge base — status dot, rename arrow, per-file +/− counts, collapsible files, and "N unmodified lines" markers between hunks. 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`.
372-
- The session workspace rail in each Chat pane lists session 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, the files toggle in the split-pane header, or the floating files button in single-pane chat (both carry a changed-file count badge). The separate file, tool, and Canvas detail panel is unaffected.
371+
- The session diff panel shows what a session's checkout actually changed: the branch button in the workspace rail or chat title bar opens the detail panel with a per-file diff of branch, uncommitted, and untracked work against the checkout's default-branch merge base — status dot, rename arrow, per-file +/− counts, collapsible files, and "N unmodified lines" markers between hunks. 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`.
372+
- 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.
373+
- The session workspace rail in each Chat pane lists session 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.
373374
- 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: 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. When the Gateway advertises `sessions.files.set` to an `operator.admin` connection, the 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 KB UTF-8 cap — and only overwrite existing files; the editor never creates or deletes them.
374-
- The background tasks rail in each Chat pane 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; the collapsible finished section adds run durations; and a View transcript link opens the task's child session in the pane. Open it with the activity toggle in the split-pane header or the floating activity button in single-pane chat — the task snapshot loads eagerly, so both carry a running-count badge without opening the rail first. The Tasks page remains the full cross-agent ledger.
375+
- The background tasks rail in each Chat pane 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; the collapsible finished section adds run durations; and a View transcript link opens the task's child session in the pane. Open it 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.
375376
- 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.
376377
- 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.
377-
- **Split view:** open it from the top-right floating toggle row (beside the session diff, background tasks, and session files toggles), then split the active pane right or down for as many panes as fit. Each pane has its own session, transcript, composer, and tool stream.
378+
- **Split view:** open it from the chat title bar (beside the session diff, background tasks, and session files toggles), then split the active pane right or down for as many panes as fit. Each pane has its own session, transcript, composer, and tool stream.
378379
- Drag a session from the sidebar into chat to open it in a pane. An animated drop preview glides between zones and labels the outcome — "Split" over the exact half a new pane will occupy, "Open here" over a whole pane — and drops also work from single-pane mode.
379-
- The active split pane drives the sidebar selection and URL. Each pane carries its own header row with the session title plus workspace-rail, split, and close controls; dividers resize columns and stacked panes, and the browser stores the layout locally across reloads.
380+
- The active split pane drives the sidebar selection and URL. Its title bar adds split and close controls; dividers resize columns and stacked panes, and the browser stores the layout locally across reloads.
380381
- On narrow screens, split view keeps the layout but renders only the active pane, including its header with the close control.
381382
- If you send a message while a model picker change for the same session is still saving, the composer waits for that session patch before calling `chat.send` so the send uses the selected model.
382383
- Typing `/new` creates and switches to the same fresh dashboard session as New Chat, except when `session.dmScope: "main"` is configured and the current parent is the agent's main session; then it resets the main session in place. Typing `/reset` keeps the Gateway's explicit in-place reset for the current session.

‎packages/gateway-protocol/src/index.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ import {
341341
SessionFileRelevanceSchema,
342342
SessionPlacementSchema,
343343
SessionPlacementStateSchema,
344+
isCloudWorkerPlacementState,
344345
SessionWorktreeInfoSchema,
345346
SessionsCreateParamsSchema,
346347
SessionsCreateResultSchema,
@@ -367,6 +368,8 @@ import {
367368
SessionsFilesSetResultSchema,
368369
SessionsFilesListParamsSchema,
369370
SessionsFilesListResultSchema,
371+
SessionsFilesRevealParamsSchema,
372+
SessionsFilesRevealResultSchema,
370373
SessionsListParamsSchema,
371374
SessionCatalogSchema,
372375
SessionCatalogCapabilitiesSchema,
@@ -645,6 +648,7 @@ export const validateSessionsResolveParams = lazyCompile(SessionsResolveParamsSc
645648
export const validateSessionsFilesListParams = lazyCompile(SessionsFilesListParamsSchema);
646649
export const validateSessionsFilesGetParams = lazyCompile(SessionsFilesGetParamsSchema);
647650
export const validateSessionsFilesSetParams = lazyCompile(SessionsFilesSetParamsSchema);
651+
export const validateSessionsFilesRevealParams = lazyCompile(SessionsFilesRevealParamsSchema);
648652
export const validateSessionsDiffParams = lazyCompile(SessionsDiffParamsSchema);
649653
export const validateSessionsCreateParams = lazyCompile(SessionsCreateParamsSchema);
650654
export const validateSessionsSendParams = lazyCompile(SessionsSendParamsSchema);
@@ -847,6 +851,7 @@ export const validateWebLoginWaitParams = lazyCompile(WebLoginWaitParamsSchema);
847851

848852
// Explicit schema exports keep public protocol changes reviewable.
849853
export {
854+
isCloudWorkerPlacementState,
850855
ConnectParamsSchema,
851856
GatewaySuspendTaskBlockerSchema,
852857
GatewaySuspendBlockerSchema,
@@ -991,6 +996,8 @@ export {
991996
SessionsFilesSetResultSchema,
992997
SessionsFilesListParamsSchema,
993998
SessionsFilesListResultSchema,
999+
SessionsFilesRevealParamsSchema,
1000+
SessionsFilesRevealResultSchema,
9941001
SessionDiffFileSchema,
9951002
SessionDiffFileStatusSchema,
9961003
SessionsDiffParamsSchema,
@@ -1442,6 +1449,8 @@ export type {
14421449
SessionsFilesGetResult,
14431450
SessionsFilesSetParams,
14441451
SessionsFilesSetResult,
1452+
SessionsFilesRevealParams,
1453+
SessionsFilesRevealResult,
14451454
SessionDiffFile,
14461455
SessionDiffFileStatus,
14471456
SessionsDiffParams,

‎packages/gateway-protocol/src/schema/protocol-schemas.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ import {
419419
SessionsFilesGetResultSchema,
420420
SessionsFilesListParamsSchema,
421421
SessionsFilesListResultSchema,
422+
SessionsFilesRevealParamsSchema,
423+
SessionsFilesRevealResultSchema,
422424
SessionsFilesSetParamsSchema,
423425
SessionsFilesSetResultSchema,
424426
SessionsListParamsSchema,
@@ -652,6 +654,8 @@ export const ProtocolSchemas = {
652654
SessionsFilesListResult: SessionsFilesListResultSchema,
653655
SessionsFilesGetParams: SessionsFilesGetParamsSchema,
654656
SessionsFilesGetResult: SessionsFilesGetResultSchema,
657+
SessionsFilesRevealParams: SessionsFilesRevealParamsSchema,
658+
SessionsFilesRevealResult: SessionsFilesRevealResultSchema,
655659
SessionsFilesSetParams: SessionsFilesSetParamsSchema,
656660
SessionsFilesSetResult: SessionsFilesSetResultSchema,
657661
SessionDiffFileStatus: SessionDiffFileStatusSchema,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Placement-state vocabulary shared by the schema layer, the gateway, and
2+
// the Control UI. Keep this module dependency-free: the browser imports it
3+
// at runtime, and a typebox import here would pull the entire schema layer
4+
// into the Control UI startup bundle (which has a hard size budget).
5+
export const SESSION_PLACEMENT_STATES = [
6+
"local",
7+
"requested",
8+
"provisioning",
9+
"syncing",
10+
"starting",
11+
"active",
12+
"draining",
13+
"reconciling",
14+
"reclaimed",
15+
"failed",
16+
] as const;
17+
18+
export type SessionPlacementState = (typeof SESSION_PLACEMENT_STATES)[number];
19+
20+
export function isCloudWorkerPlacementState(
21+
state: SessionPlacementState | undefined,
22+
): state is Exclude<SessionPlacementState, "local" | "reclaimed"> {
23+
return state !== undefined && state !== "local" && state !== "reclaimed";
24+
}

‎packages/gateway-protocol/src/schema/session-placement.ts‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
import type { Static } from "typebox";
22
import { Type } from "typebox";
33
import { NonEmptyString } from "./primitives.js";
4-
5-
/** Durable gateway ownership states for one session execution placement. */
4+
import { SESSION_PLACEMENT_STATES } from "./session-placement-state.js";
5+
6+
export {
7+
isCloudWorkerPlacementState,
8+
SESSION_PLACEMENT_STATES,
9+
type SessionPlacementState,
10+
} from "./session-placement-state.js";
11+
12+
/** Durable gateway ownership states for one session execution placement.
13+
* The literal list stays explicit because Type.Union needs a tuple for
14+
* Static inference (a mapped array collapses Static to never); the guard
15+
* below keeps it in lockstep with SESSION_PLACEMENT_STATES. */
616
export const SessionPlacementStateSchema = Type.Union([
717
Type.Literal("local"),
818
Type.Literal("requested"),
@@ -16,6 +26,13 @@ export const SessionPlacementStateSchema = Type.Union([
1626
Type.Literal("failed"),
1727
]);
1828

29+
type MutuallyAssignable<A, B> = [A] extends [B] ? ([B] extends [A] ? true : never) : never;
30+
const placementStateVocabularyInSync: MutuallyAssignable<
31+
Static<typeof SessionPlacementStateSchema>,
32+
(typeof SESSION_PLACEMENT_STATES)[number]
33+
> = true;
34+
void placementStateVocabularyInSync;
35+
1936
const SessionPlacementTimingProperties = {
2037
generation: Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER }),
2138
createdAtMs: Type.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER }),
@@ -214,7 +231,6 @@ export const SessionPlacementProtocolSchemas = {
214231
SessionsReclaimResult: SessionsReclaimResultSchema,
215232
} as const;
216233

217-
export type SessionPlacementState = Static<typeof SessionPlacementStateSchema>;
218234
export type SessionPlacement = Static<typeof SessionPlacementSchema>;
219235
export type SessionsDispatchParams = Static<typeof SessionsDispatchParamsSchema>;
220236
export type SessionsDispatchResult = Static<typeof SessionsDispatchResultSchema>;

‎packages/gateway-protocol/src/schema/sessions.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ export const SessionsFilesSetResultSchema = closedObject({
154154
file: SessionFileEntrySchema,
155155
});
156156

157+
/** Opens a session workspace on the Gateway host without accepting a client path. */
158+
export const SessionsFilesRevealParamsSchema = closedObject({
159+
key: NonEmptyString,
160+
agentId: Type.Optional(NonEmptyString),
161+
});
162+
163+
/** Result for revealing a session workspace on the Gateway host. */
164+
export const SessionsFilesRevealResultSchema = closedObject({
165+
ok: Type.Boolean(),
166+
path: Type.Optional(NonEmptyString),
167+
error: Type.Optional(NonEmptyString),
168+
});
169+
157170
/** Change status for one file in a session checkout diff. */
158171
export const SessionDiffFileStatusSchema = Type.Union([
159172
Type.Literal("added"),
@@ -645,6 +658,8 @@ export type SessionsFilesGetParams = Static<typeof SessionsFilesGetParamsSchema>
645658
export type SessionsFilesGetResult = Static<typeof SessionsFilesGetResultSchema>;
646659
export type SessionsFilesSetParams = Static<typeof SessionsFilesSetParamsSchema>;
647660
export type SessionsFilesSetResult = Static<typeof SessionsFilesSetResultSchema>;
661+
export type SessionsFilesRevealParams = Static<typeof SessionsFilesRevealParamsSchema>;
662+
export type SessionsFilesRevealResult = Static<typeof SessionsFilesRevealResultSchema>;
648663
export type SessionDiffFileStatus = Static<typeof SessionDiffFileStatusSchema>;
649664
export type SessionDiffFile = Static<typeof SessionDiffFileSchema>;
650665
export type SessionsDiffParams = Static<typeof SessionsDiffParamsSchema>;

‎src/gateway/methods/core-descriptors.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ const CORE_GATEWAY_METHOD_SPECS: readonly CoreGatewayMethodSpec[] = [
141141
{ name: "sessions.files.get", scope: "operator.read" },
142142
// Workspace file writes require the same admin scope as agents.files.set.
143143
{ name: "sessions.files.set", scope: "operator.admin" },
144+
{ name: "sessions.files.reveal", scope: "operator.admin" },
144145
{ name: "artifacts.list", scope: "operator.read" },
145146
{ name: "artifacts.get", scope: "operator.read" },
146147
{ name: "artifacts.download", scope: "operator.read" },

‎src/gateway/server-methods-list.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ describe("listGatewayMethods", () => {
7575
expect(listGatewayMethods()).toContain("controlUi.sessionPullRequests");
7676
});
7777

78+
it("advertises session workspace reveal", () => {
79+
expect(listGatewayMethods()).toContain("sessions.files.reveal");
80+
expect(coreGatewayHandlers["sessions.files.reveal"]).toBeTypeOf("function");
81+
});
82+
7883
it("advertises the versioned activity audit method", () => {
7984
expect(listGatewayMethods()).toContain("audit.activity.list");
8085
expect(coreGatewayHandlers["audit.activity.list"]).toBeTypeOf("function");

0 commit comments

Comments
 (0)