Skip to content

Commit b5b17c6

Browse files
authored
fix: keep Workboard visible in the sidebar (#125473)
* fix(ui): keep workboard in sidebar navigation * test(ui): align workboard navigation ownership * fix(ui): preserve saved workboard sidebar slots * test(ui): shrink assertion safety baseline * fix(plugins): bind native routes to bundled owners * refactor(plugins): isolate native route policy
1 parent af599f2 commit b5b17c6

34 files changed

Lines changed: 322 additions & 134 deletions

‎config/assertion-safety-baseline.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3989,7 +3989,7 @@ src/worker/worker-process.ts 2
39893989
src/worker/worker-session-tools.ts 4
39903990
src/worker/workspace-rsync-receiver.ts 1
39913991
ui/src/api/gateway.ts 1
3992-
ui/src/app-navigation.ts 3
3992+
ui/src/app-navigation.ts 2
39933993
ui/src/app-route-paths.ts 1
39943994
ui/src/app-routes.ts 1
39953995
ui/src/app/app-host-route-state.ts 1
@@ -4015,7 +4015,7 @@ ui/src/app/overlays.ts 1
40154015
ui/src/app/question-prompt.ts 2
40164016
ui/src/app/server-prefs-state.ts 14
40174017
ui/src/app/server-prefs.ts 17
4018-
ui/src/app/settings.ts 10
4018+
ui/src/app/settings.ts 9
40194019
ui/src/app/stale-chunk-reload.ts 1
40204020
ui/src/app/startup-settings.ts 1
40214021
ui/src/app/theme.ts 4
@@ -4088,7 +4088,7 @@ ui/src/components/session-data-controller.ts 2
40884088
ui/src/components/session-data-scroll-controller.ts 1
40894089
ui/src/components/session-group-defaults-dialog.ts 1
40904090
ui/src/components/session-menu.ts 1
4091-
ui/src/components/session-organizer-controller.ts 9
4091+
ui/src/components/session-organizer-controller.ts 5
40924092
ui/src/components/settings-sidebar.ts 3
40934093
ui/src/components/settings-ui.ts 7
40944094
ui/src/components/sidebar-agent-card.ts 1

‎docs/plugins/sdk-overview.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,12 @@ plugins can set `path` to a plugin HTTP route (see
399399
(`control` or `agent`), `order` sorts among plugin tabs, and `requiredScopes`
400400
hides the tab from connections lacking those operator scopes:
401401

402+
Bundled plugins whose page already has a matching native Control UI route can set
403+
`placement: "route:<pluginId>"`. The host rejects native-route claims from external
404+
plugins or from bundled plugins whose ID does not own that route. The sidebar opens
405+
the native route while the descriptor is present instead of mounting the generic
406+
plugin-tab page.
407+
402408
For a gateway-protected external tab, register the descriptor `path` under a
403409
same-plugin `auth: "gateway"` HTTP route. After authenticated bootstrap, the browser gets a
404410
short-lived, HttpOnly grant scoped to that plugin and route root so the

‎extensions/workboard/index.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { capturePluginRegistration } from "openclaw/plugin-sdk/plugin-test-runtime";
2+
import { describe, expect, it, vi } from "vitest";
3+
4+
vi.mock("./src/store.js", () => ({
5+
WorkboardStore: { openSqlite: () => ({}) },
6+
}));
7+
8+
import plugin from "./index.js";
9+
10+
describe("Workboard plugin registration", () => {
11+
it("advertises its native route only while the plugin runtime is active", () => {
12+
const captured = capturePluginRegistration({
13+
id: "workboard",
14+
name: "Workboard",
15+
register: plugin.register,
16+
});
17+
18+
expect(captured.controlUiDescriptors).toContainEqual({
19+
surface: "tab",
20+
id: "workboard",
21+
label: "Workboard",
22+
placement: "route:workboard",
23+
icon: "kanban",
24+
group: "control",
25+
requiredScopes: ["operator.read"],
26+
});
27+
});
28+
});

‎extensions/workboard/index.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ export default definePluginEntry({
3333
readSessions: async (options) =>
3434
await readWorkboardLifecycleSessions(api.runtime.gateway, options),
3535
});
36+
api.session.controls.registerControlUiDescriptor({
37+
surface: "tab",
38+
id: "workboard",
39+
label: "Workboard",
40+
placement: "route:workboard",
41+
icon: "kanban",
42+
group: "control",
43+
requiredScopes: ["operator.read"],
44+
});
3645
api.session.controls.registerControlUiDescriptor({
3746
surface: "widget",
3847
id: "board",

‎packages/gateway-protocol/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ version and the additive schema surface. Dates are authoring dates (2026).
1414
- Slim worker and session-catalog payloads to the active wire contract.
1515
- Remove dead protocol surfaces and add since-vintage metadata to retained schemas and methods.
1616
- Add optional `step` on `SystemAgentChatResult` carrying the full awaited wizard step.
17+
- Project plugin tab `placement` in `hello-ok` so active plugins can target native Control UI routes.
1718

1819
## Protocol v4 (current)
1920

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export const HelloOkSchema = closedObject({
111111
description: Type.Optional(Type.String()),
112112
icon: Type.Optional(Type.String()),
113113
path: Type.Optional(Type.String()),
114+
placement: Type.Optional(Type.String()),
114115
requiresGatewayAuth: Type.Optional(Type.Boolean()),
115116
group: Type.Optional(Type.Union([Type.Literal("control"), Type.Literal("agent")])),
116117
order: Type.Optional(Type.Number()),

‎scripts/control-ui-mock-dev.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,19 @@ async function createChatPickerScenario(
16591659
]
16601660
: []),
16611661
],
1662+
controlUiTabs:
1663+
fixture === "workboard"
1664+
? [
1665+
{
1666+
group: "control",
1667+
icon: "kanban",
1668+
id: "workboard",
1669+
label: "Workboard",
1670+
placement: "route:workboard",
1671+
pluginId: "workboard",
1672+
},
1673+
]
1674+
: [],
16621675
controlUiWidgetKinds: [
16631676
{ pluginId: "session", kind: "session:progress", label: "Session progress" },
16641677
...(fixture === "workboard"

‎src/gateway/control-ui-plugin-tabs.test.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,19 @@ describe("listControlUiPluginTabs", () => {
5252

5353
it("projects only tab descriptors", () => {
5454
activateDescriptors([
55-
{ pluginId: "logbook", descriptor: tabDescriptor() },
55+
{
56+
pluginId: "workboard",
57+
descriptor: tabDescriptor({ placement: "route:workboard" }),
58+
},
5659
{ pluginId: "other", descriptor: tabDescriptor({ id: "run-panel", surface: "run" }) },
5760
]);
5861

5962
const tabs = listControlUiPluginTabs(["operator.admin"]);
6063
expect(tabs.map((tab) => tab.id)).toEqual(["logbook"]);
61-
expect(expectDefined(tabs[0], "tabs[0] test invariant").pluginId).toBe("logbook");
64+
expect(expectDefined(tabs[0], "tabs[0] test invariant")).toMatchObject({
65+
placement: "route:workboard",
66+
pluginId: "workboard",
67+
});
6268
});
6369

6470
it("hides tabs whose required scopes are not granted", () => {

‎src/gateway/control-ui-plugin-tabs.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type ControlUiPluginTab = {
2020
description?: string;
2121
icon?: string;
2222
path?: string;
23+
placement?: string;
2324
group?: "control" | "agent";
2425
order?: number;
2526
requiresGatewayAuth?: boolean;
@@ -94,6 +95,7 @@ function projectControlUiPluginTabs(
9495
description: descriptor.description,
9596
icon: descriptor.icon,
9697
path: descriptor.path,
98+
placement: descriptor.placement,
9799
group: descriptor.group,
98100
order: descriptor.order,
99101
});

‎src/plugins/host-hooks.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export type PluginControlUiDescriptor = {
9999
surface: "session" | "tool" | "run" | "settings" | "tab" | "widget";
100100
label: string;
101101
description?: string;
102+
/** Bundled plugins may claim their matching native route as `route:<pluginId>`. */
102103
placement?: string;
103104
schema?: PluginJsonValue;
104105
requiredScopes?: OperatorScope[];

0 commit comments

Comments
 (0)