dsh-taskbridge 1.7.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -21
  3. package/README.md +149 -290
  4. package/THIRD_PARTY_NOTICES.txt +23 -23
  5. package/antigravity/agents/dsh-taskbridge.md +31 -0
  6. package/antigravity/skills/dsh-taskbridge/SKILL.md +51 -0
  7. package/codex/dsh-taskbridge.toml +170 -631
  8. package/cordis.patch.yml +6 -6
  9. package/docs/INTRODUCTION.md +119 -295
  10. package/docs/INTRODUCTION.zh.md +134 -279
  11. package/docs/antigravity-integration.md +42 -0
  12. package/docs/auth-contract.md +138 -138
  13. package/docs/claude-code.md +6 -11
  14. package/docs/codex-integration.md +2 -2
  15. package/docs/contracts-stage-b.md +443 -443
  16. package/docs/plugin-market.md +30 -30
  17. package/docs/redaction-contract.md +170 -170
  18. package/docs/releases/1.7.0.zh.md +11 -11
  19. package/docs/releases/1.8.0.zh.md +16 -0
  20. package/docs/runtime-compatibility.md +1 -1
  21. package/docs/taskbridge-upgrade.md +28 -28
  22. package/docs/taskdispatch-upgrade.md +25 -25
  23. package/docs/workspace-contract.md +538 -538
  24. package/docs/workspace-grouping.md +126 -126
  25. package/icon.svg +1 -1
  26. package/lib/client.d.ts +733 -699
  27. package/lib/client.js +7 -7
  28. package/locale/en.json +1 -1
  29. package/locale/zh.json +1 -1
  30. package/package.json +149 -144
  31. package/src/antigravity/installer.js +1046 -0
  32. package/src/antigravity/seam.js +142 -0
  33. package/src/auth/fence.js +361 -361
  34. package/src/auth/grants.js +789 -789
  35. package/src/client/api.js +143 -0
  36. package/src/client/index.jsx +113 -3
  37. package/src/client/sidebar.jsx +862 -862
  38. package/src/client/styles.js +624 -624
  39. package/src/client/task-cleanup.js +304 -304
  40. package/src/client/task-records-table.jsx +217 -217
  41. package/src/client/task-view.js +307 -307
  42. package/src/client/workspace-groups.js +482 -482
  43. package/src/client/workspaces-browser.jsx +770 -770
  44. package/src/codex/agent-ownership.js +270 -270
  45. package/src/codex/installer.js +3 -0
  46. package/src/codex/toml.js +784 -784
  47. package/src/config/redact.js +245 -245
  48. package/src/config/store.js +186 -186
  49. package/src/credentials/seam.js +202 -202
  50. package/src/http/respond.js +6 -5
  51. package/src/http/user-plane.js +72 -0
  52. package/src/index.js +25 -0
  53. package/src/jobs/diagnostics.js +15 -15
  54. package/src/jobs/plan-store.js +1020 -1020
  55. package/src/jobs/review-note.js +63 -63
  56. package/src/jobs/task-descriptions.js +82 -82
  57. package/src/jobs/task-display.js +73 -73
  58. package/src/jobs/task-tree.js +786 -786
  59. package/src/jobs/title.js +134 -134
  60. package/src/mcp/continuation.js +317 -317
  61. package/src/mcp/server.js +4 -1
  62. package/src/model/connectivity.js +371 -371
  63. package/src/model/discovery.js +582 -582
  64. package/src/model/native-catalog.js +68 -68
  65. package/src/model/openai-adapter.js +671 -671
  66. package/src/model/probe.js +264 -264
  67. package/src/model/providers.js +756 -756
  68. package/src/model/routing.js +321 -321
  69. package/src/runtime/permissions.js +1619 -1619
  70. package/src/runtime/question-call.js +162 -162
  71. package/src/runtime/questions.js +909 -909
  72. package/src/runtime/worker-prompt.js +60 -55
  73. package/src/workspace/audit.js +775 -775
  74. package/src/workspace/preflight.js +424 -424
  75. package/src/workspace/worktrees.js +679 -679
package/lib/client.d.ts CHANGED
@@ -1,699 +1,733 @@
1
- // Type declarations for the dsh-delegate browser half (`lib/client.js`).
2
- //
3
- // `lib/client.js` is not an ordinary ES module: it is a *registration* for the DSH
4
- // client's module table, produced by `scripts/build-client.mjs` from
5
- // `src/client/index.jsx`:
6
- //
7
- // window.__ModuleLoader__.load({ id: "dsh-taskbridge", factory: (require) => … })
8
- //
9
- // The factory returns `module.exports`, whose shape is declared here as
10
- // {@link DelegateClientModule}. The bundle declares `dsh.client.platform: "web"`,
11
- // which is the only platform `dsh-client-modules` in 0.2.x selects; Desktop and
12
- // Web both run that client module system, so the same declaration serves both.
13
- // Its module requests are limited to the platform table (`react`,
14
- // `react/jsx-runtime`) — that is why no `dsh.client.external` entry is needed.
15
- // Ordering against the Plugins manager comes from `dsh.client.inject`, whose row
16
- // for this package must name `@deepseek-ai/dsh-client-ui-plugin-manager`.
17
- //
18
- // This file documents the contract for editors and type-aware tests; nothing
19
- // imports it at runtime.
20
-
21
- /**
22
- * The slot this page occupies: the Plugins manager's per-bundle configuration
23
- * slot (`kind: 'keyed'`, `scope: 'root'`), rendered only with `view: 'page'` on
24
- * the bundle's own details page.
25
- */
26
- export declare const PLUGIN_CONFIG_SLOT: 'plugins.bundle.config';
27
-
28
- /**
29
- * Key of the registration: exactly the bundle's npm package name. The manager
30
- * looks the entry up by `pkg.name`; any other key never renders.
31
- */
32
- export declare const PLUGIN_BUNDLE_KEY: 'dsh-taskbridge';
33
-
34
- /** Required client services: slot registration only. */
35
- export declare const inject: readonly ['slots'];
36
-
37
- // ---------------------------------------------------------------------------
38
- // Native left navigation (G08)
39
- // ---------------------------------------------------------------------------
40
-
41
- /** The host shell slot that holds the sidebar's main entries (the icon). */
42
- export declare const MAIN_SLOT: 'main';
43
-
44
- /**
45
- * The host shell slot that lists the sidebar panels (the row). This registration adds only
46
- * the task entry; the shell's workspace region (`sidebar.workspaces`) is taken by a SEPARATE,
47
- * lower-priority registration ({@link registerWorkspacesBrowser}) that can fall back to DSH's
48
- * own browser. See `docs/workspace-grouping.md`.
49
- */
50
- export declare const SIDEBAR_PANEL_SLOT: 'sidebar.panellist';
51
-
52
- /** Shared id of the two registrations, namespaced against other sidebar plugins. */
53
- export declare const TASKS_NAV_KEY: 'dsh-taskbridge:taskbridge-tasks';
54
-
55
- /** Sort key of the row in `sidebar.panellist`. */
56
- export declare const TASKS_NAV_ORDER: number;
57
-
58
- /** Operator-facing label of the entry. */
59
- export declare const TASKS_NAV_LABEL: 'TaskBridge 任务';
60
-
61
- /**
62
- * The host's `uiWorkspace` service, or `null`. A host without it is the documented
63
- * degradation: the panel lists records and offers no navigation.
64
- */
65
- export declare function resolveUiWorkspace(ctx: unknown): { openSession: (sessionId: string) => unknown } | null;
66
-
67
- /**
68
- * The host's `workspaces` service, or `null`. Its `list` is the subscribable source
69
- * (`{ getSnapshot, subscribe }`) used to verify a recorded session id.
70
- */
71
- export declare function resolveWorkspaces(ctx: unknown): unknown;
72
-
73
- /** Resolve a service passed either as a value or as a lazy getter (or `null`). */
74
- export declare function resolveService(value: unknown): object | null;
75
-
76
- /**
77
- * Register the FULL CONTENT PANEL on `main` and the SMALL ICON on
78
- * `sidebar.panellist`, sharing one id.
79
- *
80
- * This is the host's own split (0.2.2-rc.5): `main` carries
81
- * `{ name: 'main', key }` with the page component, and `sidebar.panellist` carries
82
- * `{ name: 'sidebar.panellist', id, order, label }` with the icon component, where
83
- * `label` is a function.
84
- *
85
- * Both slots are optional host capabilities: a missing `slots` service or an
86
- * undeclared slot simply registers nothing, and the settings page is unaffected.
87
- * `store` is the SAME instance the settings page uses; `uiWorkspace`/`workspaces`
88
- * may be values or lazy getters, resolved each time they are used.
89
- */
90
- export declare function registerTasksNavigation(
91
- ctx: unknown,
92
- options?: {
93
- store?: unknown;
94
- uiWorkspace?: unknown;
95
- workspaces?: unknown;
96
- registerPanel?: () => () => void;
97
- registerIcon?: () => () => void;
98
- },
99
- ): () => void;
100
-
101
- /**
102
- * Where a recorded session id sits among the host's Workspaces:
103
- * `pending` (snapshot not ready), `present` (listed and not archived),
104
- * `archived` (in the host's `archivedSessionIds`), `missing` (a ready snapshot does
105
- * not list it), or `unknown` (no service at all).
106
- */
107
- export type DelegateSessionPlacementState = 'unknown' | 'pending' | 'present' | 'archived' | 'missing';
108
-
109
- /** The host's Workspaces snapshot, or `null` when it cannot be read synchronously. */
110
- export declare function workspacesSnapshot(workspaces: unknown): {
111
- phase?: string;
112
- items?: Array<{ workspaceId?: string; sessionIds?: string[] }>;
113
- archivedSessionIds?: string[];
114
- } | null;
115
-
116
- /** Every session id a snapshot knows, mapped to its workspace id. */
117
- export declare function knownSessionIds(snapshot: unknown): Map<string, string>;
118
-
119
- /** Read one recorded session's placement from the host's `workspaces.list` snapshot. */
120
- export declare function sessionPlacement(
121
- sessionId: string | null,
122
- workspaces: unknown,
123
- ): { state: DelegateSessionPlacementState; label: string | null; workspaceId: string | null };
124
-
125
- /** The session id a `/tasks` row actually recorded, or `null`. */
126
- export declare function taskSessionId(task: unknown): string | null;
127
-
128
- /** Short, stable display form of a session id. */
129
- export declare function shortSessionId(sessionId: string | null): string;
130
-
131
- /** One project group the navigation panel draws. */
132
- export interface DelegateNavGroup {
133
- /** Host project key; two same-named projects stay two groups. */
134
- key: string;
135
- sessions: Array<{
136
- taskId: string;
137
- title: string;
138
- sessionId: string | null;
139
- status: { key: string; label: string; tone: string };
140
- archived: boolean;
141
- }>;
142
- }
143
-
144
- /** The navigation panel's model, projected from the page store and the host tree. */
145
- export interface DelegateNavView {
146
- groups: DelegateNavGroup[];
147
- archivedGroups: DelegateNavGroup[];
148
- activeCount: number;
149
- archivedCount: number;
150
- total: number;
151
- available: boolean;
152
- meta: Map<string, { name: string | null; shortPath: string | null; unverified: boolean; nodeCount: number }>;
153
- }
154
-
155
- /** Project the store snapshot and the host's tree onto the panel's model. */
156
- export declare function navViewModel(snapshot: unknown): DelegateNavView;
157
-
158
- /** Fallback label of a project key the host did not name. */
159
- export declare function projectLabel(key: string): string;
160
-
161
- /** A group's title: the host's project name, else the key's fallback label. */
162
- export declare function groupTitle(group: DelegateNavGroup, meta: Map<string, unknown>): string;
163
-
164
- /** Why archived rows are listed separately (or `null` when none are). */
165
- export declare function archivedSourceNote(snapshot: unknown): string | null;
166
-
167
- /**
168
- * Open one recorded session through the host's own `uiWorkspace.openSession`.
169
- *
170
- * Verification comes first and `openSession` is called at most ONCE. Refused (with
171
- * readable copy, and without navigating) when: there is no `uiWorkspace`; the record
172
- * has no id; the snapshot is not ready; the id is in the host's
173
- * `archivedSessionIds`; a ready snapshot does not list it; or there is no
174
- * `workspaces` service to verify it against. Never renames, moves or archives.
175
- */
176
- export declare function locateSession(
177
- uiWorkspace: unknown,
178
- sessionId: string | null,
179
- workspaces?: unknown,
180
- ): Promise<{ ok: boolean; message: string }>;
181
-
182
- /** The small sidebar ICON registered on `sidebar.panellist`. */
183
- export declare function TaskbridgeSidebarIcon(): unknown;
184
-
185
- /**
186
- * The FULL CONTENT PANEL registered on `main`; receives
187
- * `{ store, uiWorkspace, workspaces }`, where the last two may be lazy getters.
188
- */
189
- export declare function TaskbridgeNavPanel(props: Record<string, unknown>): unknown;
190
-
191
- // ---------------------------------------------------------------------------
192
- // Grouped workspaces (the shell's `sidebar.workspaces` cell)
193
- // ---------------------------------------------------------------------------
194
-
195
- /** The host slot the grouped workspaces browser occupies. */
196
- export declare const WORKSPACES_SLOT: 'sidebar.workspaces';
197
-
198
- /**
199
- * The host's published CHILD slot of its workspace browser: a list rendered INSIDE every native
200
- * session row. This is the only thing this plugin registers in the sidebar's workspace area; the
201
- * parent slot stays the host's, so native rows, names, order, search and menus are untouched.
202
- */
203
- export declare const SESSION_ROW_ACTION_SLOT: 'sidebar.workspaces.session.row.action';
204
-
205
- /** The id of this plugin's row-action registration, namespaced against other plugins. */
206
- export declare const SESSION_ROW_ACTION_ID: string;
207
-
208
- /** Its order: after the host's own row actions (the host uses 100 and 200). */
209
- export declare const SESSION_ROW_ACTION_ORDER: number;
210
-
211
- /** @deprecated The plugin no longer registers on `sidebar.workspaces`. */
212
- export declare const WORKSPACES_PRIORITY: number;
213
-
214
- /** How the plugin's own grouping presents itself. */
215
- export declare const WORKSPACE_VIEWS: Readonly<{
216
- grouped: 'grouped';
217
- passthrough: 'passthrough';
218
- }>;
219
-
220
- /** Sections the grouping model can produce. */
221
- export declare const GROUP_KINDS: Readonly<{ container: 'container'; project: 'project' }>;
222
-
223
- /** One identity row as `GET /api/dsh-delegate/session-map` publishes it. */
224
- export interface DelegateSessionIdentity {
225
- taskId: string;
226
- sessionId: string;
227
- workspaceId: string;
228
- sourcePath: string;
229
- executionPath: string;
230
- isolation: string | null;
231
- updatedAt: number;
232
- }
233
-
234
- /** One conversation of a task workspace (level 3 of the tree): a real (workspace, session) pair. */
235
- export interface DelegateGroupedSession {
236
- sessionId: string;
237
- /** The native Workspace it really lives in; every action on this row addresses this pair. */
238
- workspaceId: string;
239
- taskId: string | null;
240
- title: string;
241
- isolation: string | null;
242
- updatedAt: number;
243
- archived: boolean;
244
- }
245
-
246
- /**
247
- * One TASK WORKSPACE (level 2): the native Workspace one dispatched chain lives in.
248
- *
249
- * Two chains of one project can share one native Workspace, so a project can hold two nodes with
250
- * the same `workspaceId`; the row's identity is `chainId`.
251
- */
252
- export interface DelegateGroupedWorkspace {
253
- workspaceId: string;
254
- /** The continuation chain this node stands for (its root task id, or a pair-derived key). */
255
- chainId: string;
256
- title: string;
257
- /** The real execution path; a display node names the native record, it never impersonates it. */
258
- path: string;
259
- /**
260
- * The Workspace also holds conversations this plugin cannot vouch for, so renaming or removing
261
- * it as a whole would act on them: both operations are refused.
262
- */
263
- sharedWithOrdinary: boolean;
264
- conversations: DelegateGroupedSession[];
265
- }
266
-
267
- /** One node of the tree: the TaskBridge container or one real source project. */
268
- export interface DelegateWorkspaceGroup {
269
- kind: 'container' | 'project';
270
- key: string;
271
- name: string;
272
- path: string;
273
- workspaceCount: number;
274
- conversationCount: number;
275
- /** Projects of the container. */
276
- projects?: DelegateWorkspaceGroup[];
277
- /** A project's task workspaces (one per dispatched chain). */
278
- workspaces?: DelegateGroupedWorkspace[];
279
- }
280
-
281
- /** The TaskBridge section view model. */
282
- export interface DelegateWorkspacesView {
283
- ready: boolean;
284
- groups: DelegateWorkspaceGroup[];
285
- /** Native Workspaces the section does NOT claim; the native browser shows them itself. */
286
- standalone: Array<{ workspaceId: string; title: string; path: string }>;
287
- ungrouped: Array<{ sessionId: string; title: string; owned: boolean }>;
288
- archived: Array<{ sessionId: string; title: string; workspaceId: string; taskId: string | null }>;
289
- duplicates: Array<{ sessionId: string; workspaceId: string }>;
290
- /** Task workspaces shown in the section. */
291
- ownCount: number;
292
- conversationCount: number;
293
- workspaceCount: number;
294
- /** Native Workspaces the section leaves to the browser because they also hold other ones. */
295
- mixedCount: number;
296
- standaloneCount: number;
297
- }
298
-
299
- /** Canonical key of one directory, folded exactly as `sessionPathKey` folds it. */
300
- export declare function sourcePathKey(value: unknown): string;
301
-
302
- /** Whether a path is the plugin's registered managed-worktree root. */
303
- export declare function isManagedRootPath(path: unknown): boolean;
304
-
305
- /** Short label of one path node (its last one or two segments). */
306
- export declare function projectNameOf(path: unknown): string;
307
-
308
- /** The host's Workspaces snapshot, or `null` when it cannot be read synchronously. */
309
- export declare function readWorkspacesSnapshot(workspaces: unknown): unknown;
310
-
311
- /** The snapshot normalized to the fields the model consumes. */
312
- export declare function workspaceItems(snapshot: unknown): {
313
- ready: boolean;
314
- items: Array<{ workspaceId: string; title: string; path: string; sessionIds: string[]; pinned: boolean }>;
315
- archivedSessionIds: string[];
316
- ungroupedSessionIds: string[];
317
- };
318
-
319
- /** Identity rows narrowed to rows that name both a Session and a Workspace. */
320
- export declare function identityRows(rows: unknown): DelegateSessionIdentity[];
321
-
322
- /** Session titles derived from `/tasks` rows (id stated by the record, never inferred). */
323
- export declare function sessionTitles(tasks: unknown): Map<string, string>;
324
-
325
- /** Task records indexed by the session/workspace pair they prove, plus their titles. */
326
- export declare function sessionIndex(tasks: unknown): {
327
- titles: Map<string, string>;
328
- pairs: Map<string, DelegateSessionIdentity>;
329
- byTask: Map<string, DelegateSessionIdentity>;
330
- /** Task id → the root task of its continuation chain. */
331
- chainOf: Map<string, string>;
332
- };
333
-
334
- /** Build the TaskBridge section from the host snapshot, the identity map and task records. */
335
- export declare function workspaceGroups(input: {
336
- snapshot?: unknown;
337
- identities?: unknown;
338
- titles?: Map<string, string>;
339
- tasks?: unknown;
340
- }): DelegateWorkspacesView;
341
-
342
- /** Which presentation the plugin's own grouping calls for. */
343
- export declare function workspacesViewMode(input: {
344
- ownCount?: number;
345
- }): 'grouped' | 'passthrough';
346
-
347
- /** Read the identity map from the operator plane; a refusal answers an empty list. */
348
- export declare function loadSessionMap(api: { getSessionMap: () => Promise<unknown> }): Promise<object[]>;
349
-
350
- /** Resolve one optional host service through `ctx.get`, or `null`. */
351
- export declare function hostService(ctx: unknown, name: string): object | null;
352
-
353
- /** Ask the operator for one line of text (the shell's dialog), or `null`. */
354
- export declare function askText(message: string, initial: string, shell?: unknown): string | null;
355
-
356
- /** Ask the operator to confirm a destructive action; an absent dialog answers NO. */
357
- export declare function askConfirm(message: string, shell?: unknown): boolean;
358
-
359
- /** Short display form of a session id. */
360
- export declare function shortId(sessionId: unknown): string;
361
-
362
- /** A host snapshot reused while its data is unchanged (safe for `useSyncExternalStore`). */
363
- export declare function stableSnapshot(snapshot: unknown, cache?: { key: string | null; value: object | null }): object | null;
364
-
365
- /** Session id → what proves it is a TaskBridge dispatch (identity row or record, plus its title). */
366
- export declare function dispatchProof(identities: unknown, tasks: unknown): {
367
- bySession: Map<string, DelegateSessionIdentity & { title?: string }>;
368
- ready: boolean;
369
- };
370
-
371
- /**
372
- * Register the per-session marker into the host's published child slot
373
- * ({@link SESSION_ROW_ACTION_SLOT}). The parent slot is never registered: the native workspace
374
- * rows, names, order, search, menus and actions stay exactly as the host renders them.
375
- */
376
- export declare function registerSessionRowMarker(
377
- ctx: unknown,
378
- options?: { store?: unknown; api?: unknown; sessionMap?: () => Promise<unknown> },
379
- ): () => void;
380
-
381
- /** The marker rendered inside one native session row (`sessionId` comes from the host). */
382
- export declare function DispatchedSessionMarker(props: Record<string, unknown>): unknown;
383
-
384
- /** The plugin's own grouping surface: TaskBridge → task workspace → conversation. */
385
- export declare function TaskbridgeGrouping(props: Record<string, unknown>): unknown;
386
-
387
- /** @deprecated Kept so an older import resolves; the plugin registers no such entry. */
388
- export declare function registerWorkspacesBrowser(...args: unknown[]): () => void;
389
-
390
- /** Options accepted by {@link registerBundleConfiguration}. */
391
- export interface DelegateBundleConfigOptions {
392
- /** Page store; the component subscribes to it itself. */
393
- store: unknown;
394
- }
395
-
396
- /**
397
- * Register the bundle configuration page on a client context.
398
- * @param ctx - client context exposing `slots`.
399
- * @param options - the page store.
400
- * @returns the slot disposer.
401
- */
402
- export declare function registerBundleConfiguration(
403
- ctx: unknown,
404
- options: DelegateBundleConfigOptions,
405
- ): () => void;
406
-
407
- /**
408
- * Client plugin apply hook: injects the scoped stylesheet and registers one
409
- * `plugins.bundle.config` entry, and nothing else. It never registers a
410
- * `settings.section`, and it never dispatches a task.
411
- * @param ctx - client Cordis context.
412
- */
413
- export declare function apply(ctx: unknown): void;
414
-
415
- /**
416
- * React component that renders the whole configuration page. It receives the
417
- * registration's `inject` face (`{ store }`) plus the slot owner props
418
- * (`{ view: 'page', form? }`), and deliberately ignores `form`.
419
- */
420
- export declare function DelegateConfigPage(props: Record<string, unknown>): unknown;
421
-
422
- /** Re-exported client helpers that the page and the tests both use. */
423
- export declare const documentFromDraft: (...args: unknown[]) => unknown;
424
- export declare const describeError: (...args: unknown[]) => string;
425
- export declare const exportDocument: (...args: unknown[]) => unknown;
426
-
427
- /**
428
- * The plan-creation form state, as one editable batch plus the batch's parent.
429
- *
430
- * `parent` on a row is `''` (root), `'row:<n>'` (another row of the same batch, by
431
- * position) or a real plan `nodeId` the host returned. There is no title-based
432
- * parent, by construction.
433
- */
434
- export interface DelegatePlanCreateRow {
435
- title: string;
436
- goalDescription?: string;
437
- parent?: string;
438
- }
439
-
440
- /** Draft the plan-creation form holds. */
441
- export interface DelegatePlanCreateDraft {
442
- title?: string;
443
- goal?: string;
444
- parentNodeId?: string;
445
- workspacePath?: string;
446
- rows?: DelegatePlanCreateRow[];
447
- }
448
-
449
- /**
450
- * The request body `POST /api/dsh-delegate/plans` takes. It names no connection:
451
- * the host always writes for the fixed local caller and refuses a body that tries.
452
- */
453
- export interface DelegatePlanCreateRequest {
454
- nodes: Array<{
455
- key: string;
456
- title: string;
457
- goalDescription?: string;
458
- parentKey?: string;
459
- parentNodeId?: string;
460
- }>;
461
- parentNodeId?: string;
462
- workspacePath?: string;
463
- }
464
-
465
- /**
466
- * Project the form draft onto the create request.
467
- * @returns the request body plus the local precheck problems (empty when valid).
468
- */
469
- export declare function planCreateRequest(
470
- draft: DelegatePlanCreateDraft,
471
- ): { body: DelegatePlanCreateRequest; problems: string[] };
472
-
473
- /**
474
- * Actions the Codex panel may send. `status` is absent on purpose: the page reads
475
- * that state through a `GET`, so only a real change is ever a `POST`.
476
- */
477
- export declare const CODEX_ACTIONS: readonly ['install', 'repair', 'remove'];
478
-
479
- /** The user-plane path the Codex panel uses (`GET` diagnoses, `POST` acts). */
480
- export declare const ROUTES: Readonly<Record<string, string>> & { codex: '/api/dsh-delegate/codex' };
481
-
482
- /**
483
- * One target's presentation state: agent file, MCP entry or DSH switch.
484
- *
485
- * The three are reported separately because they are independent: an installed
486
- * agent does not imply a configured MCP entry, and neither implies that the DSH
487
- * local-call switch is on.
488
- */
489
- export interface DelegateCodexTargetView {
490
- key: 'agent' | 'mcp' | 'switch';
491
- label: string;
492
- state: string;
493
- tone: 'on' | 'off' | 'warn';
494
- detail: string;
495
- path?: string;
496
- paths?: string[];
497
- }
498
-
499
- /** Map a served Codex status document onto one target's presentation state. */
500
- export declare function codexTargetView(
501
- codex: unknown,
502
- switchState: unknown,
503
- target: 'agent' | 'mcp' | 'switch',
504
- ): DelegateCodexTargetView;
505
-
506
- /** Chinese one-line summary of an action outcome (`changed` / `refused`). */
507
- export declare function describeCodexOutcome(outcome: unknown): string;
508
-
509
- /**
510
- * One execution chain as the cleanup surface sees it.
511
- *
512
- * `selectable` is the host's own verdict plus the exact-rounds check made in the page;
513
- * `blockers` carries the host's stable codes and is what a disabled checkbox explains.
514
- */
515
- export interface DelegateCleanupCandidate {
516
- chainId: string;
517
- taskIds: string[];
518
- roundCount: number;
519
- title: string;
520
- planNodeId: string | null;
521
- parentNodeId: string | null;
522
- nodeId: string | null;
523
- nodeKind: string;
524
- selectable: boolean;
525
- blockers: string[];
526
- reason: string | null;
527
- }
528
-
529
- /** One chain of a cleanup request: its identity and its exact rounds. */
530
- export interface DelegateCleanupChain {
531
- chainId: string;
532
- taskIds: string[];
533
- }
534
-
535
- /** What the confirmation shows before anything is sent. */
536
- export interface DelegateCleanupSummary {
537
- chains: number;
538
- rounds: number;
539
- empty: boolean;
540
- executable: boolean;
541
- problems: string[];
542
- }
543
-
544
- /** Once one request may name. Mirrors `MAX_CLEANUP_CHAINS` on the host. */
545
- export declare const MAX_CLEANUP_CHAINS: number;
546
-
547
- /** Chinese label for one cleanup blocker code. */
548
- export declare function cleanupBlockerLabel(code: string): string;
549
-
550
- /** Every execution chain of a rendered tree, in pre-order, with its eligibility. */
551
- export declare function cleanupCandidates(view: unknown): DelegateCleanupCandidate[];
552
-
553
- /** Chain id -> the rounds that were selected; anything stale is disabled. */
554
- export declare function withSelectionState(
555
- candidate: DelegateCleanupCandidate,
556
- selectedTaskIds: string[],
557
- ): DelegateCleanupCandidate;
558
-
559
- /** Drop selections that no longer name a selectable chain of the current tree. */
560
- export declare function pruneCleanupSelection(
561
- selection: Record<string, string[]>,
562
- candidates: DelegateCleanupCandidate[],
563
- ): { selection: Record<string, string[]>; dropped: string[] };
564
-
565
- /** Toggle one chain in a selection (a new object; the input is not mutated). */
566
- export declare function toggleCleanupSelection(
567
- selection: Record<string, string[]>,
568
- candidate: DelegateCleanupCandidate,
569
- ): Record<string, string[]>;
570
-
571
- /** Chain/round counts and any problem that blocks the confirmation. */
572
- export declare function cleanupSelectionSummary(
573
- selection: Record<string, string[]>,
574
- candidates: DelegateCleanupCandidate[],
575
- ): DelegateCleanupSummary;
576
-
577
- /** Project a selection onto the exact request body the host accepts. */
578
- export declare function cleanupRequest(
579
- selection: Record<string, string[]>,
580
- candidates: DelegateCleanupCandidate[],
581
- ): { body: { chains: DelegateCleanupChain[] }; problems: string[] };
582
-
583
- /** Stable fingerprint of a selection, for change detection across refreshes. */
584
- export declare function cleanupSelectionKey(
585
- candidates: DelegateCleanupCandidate[],
586
- selection: Record<string, string[]>,
587
- ): string;
588
-
589
- /** The removed ids and counts of a completed cleanup. */
590
- export declare function cleanupOutcome(outcome: unknown): {
591
- chains: number;
592
- rounds: number;
593
- deletedTaskIds: string[];
594
- };
595
-
596
- /** Plain-Chinese description of one completed cleanup. */
597
- export declare function describeCleanupOutcome(outcome: unknown): string;
598
-
599
- /** The irreversible-action warning shown beside the confirm button. */
600
- export declare function cleanupWarningText(): string;
601
-
602
- /**
603
- * The operator's execution-choice block, normalized for display.
604
- *
605
- * A document (or a host) that predates the block opens at the OFF default, so an
606
- * upgraded installation never presents agent collaboration as already decided on.
607
- */
608
- export declare function executionOf(
609
- source: unknown,
610
- ): { agentTeamsDefault: boolean | unknown };
611
-
612
- /** The documented default a NEW task gets when nothing else decides. */
613
- export declare const AGENT_TEAMS_DEFAULT_FOR_NEW_TASKS: false;
614
-
615
- /** Where a task's frozen Agent Teams decision came from. */
616
- export declare const AGENT_TEAMS_ORIGIN_LABELS: Readonly<{
617
- request: string;
618
- continuation: string;
619
- 'settings-default': string;
620
- }>;
621
-
622
- /** Shape the registration factory returns as `module.exports`. */
623
- export interface DelegateClientModule {
624
- PLUGIN_CONFIG_SLOT: typeof PLUGIN_CONFIG_SLOT;
625
- PLUGIN_BUNDLE_KEY: typeof PLUGIN_BUNDLE_KEY;
626
- inject: typeof inject;
627
- registerBundleConfiguration: typeof registerBundleConfiguration;
628
- apply: typeof apply;
629
- DelegateConfigPage: typeof DelegateConfigPage;
630
- documentFromDraft: typeof documentFromDraft;
631
- describeError: typeof describeError;
632
- exportDocument: typeof exportDocument;
633
- /** G09 batch plan creation: the pure form-draft → request projection. */
634
- planCreateRequest: typeof planCreateRequest;
635
- /** Task-record cleanup: the chain projection, selection and confirmation text. */
636
- MAX_CLEANUP_CHAINS: typeof MAX_CLEANUP_CHAINS;
637
- cleanupBlockerLabel: typeof cleanupBlockerLabel;
638
- cleanupCandidates: typeof cleanupCandidates;
639
- withSelectionState: typeof withSelectionState;
640
- pruneCleanupSelection: typeof pruneCleanupSelection;
641
- toggleCleanupSelection: typeof toggleCleanupSelection;
642
- cleanupSelectionSummary: typeof cleanupSelectionSummary;
643
- cleanupRequest: typeof cleanupRequest;
644
- cleanupSelectionKey: typeof cleanupSelectionKey;
645
- cleanupOutcome: typeof cleanupOutcome;
646
- describeCleanupOutcome: typeof describeCleanupOutcome;
647
- cleanupWarningText: typeof cleanupWarningText;
648
- /** Execution choices: the new-task Agent Teams default and its origin labels. */
649
- executionOf: typeof executionOf;
650
- AGENT_TEAMS_DEFAULT_FOR_NEW_TASKS: typeof AGENT_TEAMS_DEFAULT_FOR_NEW_TASKS;
651
- AGENT_TEAMS_ORIGIN_LABELS: typeof AGENT_TEAMS_ORIGIN_LABELS;
652
- /** G08 native left navigation: slot names, projection and navigation. */
653
- MAIN_SLOT: typeof MAIN_SLOT;
654
- SIDEBAR_PANEL_SLOT: typeof SIDEBAR_PANEL_SLOT;
655
- TASKS_NAV_KEY: typeof TASKS_NAV_KEY;
656
- TASKS_NAV_LABEL: typeof TASKS_NAV_LABEL;
657
- resolveUiWorkspace: typeof resolveUiWorkspace;
658
- resolveWorkspaces: typeof resolveWorkspaces;
659
- resolveService: typeof resolveService;
660
- workspacesSnapshot: typeof workspacesSnapshot;
661
- knownSessionIds: typeof knownSessionIds;
662
- registerTasksNavigation: typeof registerTasksNavigation;
663
- navViewModel: typeof navViewModel;
664
- locateSession: typeof locateSession;
665
- TaskbridgeSidebarIcon: typeof TaskbridgeSidebarIcon;
666
- TaskbridgeNavPanel: typeof TaskbridgeNavPanel;
667
- /**
668
- * The sidebar integration: the host's published per-session child slot, the marker it renders,
669
- * and the plugin's own three-level grouping with its pure model.
670
- */
671
- SESSION_ROW_ACTION_SLOT: typeof SESSION_ROW_ACTION_SLOT;
672
- SESSION_ROW_ACTION_ID: typeof SESSION_ROW_ACTION_ID;
673
- SESSION_ROW_ACTION_ORDER: typeof SESSION_ROW_ACTION_ORDER;
674
- WORKSPACES_SLOT: typeof WORKSPACES_SLOT;
675
- WORKSPACES_PRIORITY: typeof WORKSPACES_PRIORITY;
676
- WORKSPACE_VIEWS: typeof WORKSPACE_VIEWS;
677
- GROUP_KINDS: typeof GROUP_KINDS;
678
- registerSessionRowMarker: typeof registerSessionRowMarker;
679
- DispatchedSessionMarker: typeof DispatchedSessionMarker;
680
- TaskbridgeGrouping: typeof TaskbridgeGrouping;
681
- dispatchProof: typeof dispatchProof;
682
- registerWorkspacesBrowser: typeof registerWorkspacesBrowser;
683
- workspacesViewMode: typeof workspacesViewMode;
684
- workspaceGroups: typeof workspaceGroups;
685
- workspaceItems: typeof workspaceItems;
686
- identityRows: typeof identityRows;
687
- sessionTitles: typeof sessionTitles;
688
- sessionIndex: typeof sessionIndex;
689
- sourcePathKey: typeof sourcePathKey;
690
- isManagedRootPath: typeof isManagedRootPath;
691
- projectNameOf: typeof projectNameOf;
692
- readWorkspacesSnapshot: typeof readWorkspacesSnapshot;
693
- loadSessionMap: typeof loadSessionMap;
694
- hostService: typeof hostService;
695
- askText: typeof askText;
696
- askConfirm: typeof askConfirm;
697
- shortId: typeof shortId;
698
- stableSnapshot: typeof stableSnapshot;
699
- }
1
+ // Type declarations for the dsh-delegate browser half (`lib/client.js`).
2
+ //
3
+ // `lib/client.js` is not an ordinary ES module: it is a *registration* for the DSH
4
+ // client's module table, produced by `scripts/build-client.mjs` from
5
+ // `src/client/index.jsx`:
6
+ //
7
+ // window.__ModuleLoader__.load({ id: "dsh-taskbridge", factory: (require) => … })
8
+ //
9
+ // The factory returns `module.exports`, whose shape is declared here as
10
+ // {@link DelegateClientModule}. The bundle declares `dsh.client.platform: "web"`,
11
+ // which is the only platform `dsh-client-modules` in 0.2.x selects; Desktop and
12
+ // Web both run that client module system, so the same declaration serves both.
13
+ // Its module requests are limited to the platform table (`react`,
14
+ // `react/jsx-runtime`) — that is why no `dsh.client.external` entry is needed.
15
+ // Ordering against the Plugins manager comes from `dsh.client.inject`, whose row
16
+ // for this package must name `@deepseek-ai/dsh-client-ui-plugin-manager`.
17
+ //
18
+ // This file documents the contract for editors and type-aware tests; nothing
19
+ // imports it at runtime.
20
+
21
+ /**
22
+ * The slot this page occupies: the Plugins manager's per-bundle configuration
23
+ * slot (`kind: 'keyed'`, `scope: 'root'`), rendered only with `view: 'page'` on
24
+ * the bundle's own details page.
25
+ */
26
+ export declare const PLUGIN_CONFIG_SLOT: 'plugins.bundle.config';
27
+
28
+ /**
29
+ * Key of the registration: exactly the bundle's npm package name. The manager
30
+ * looks the entry up by `pkg.name`; any other key never renders.
31
+ */
32
+ export declare const PLUGIN_BUNDLE_KEY: 'dsh-taskbridge';
33
+
34
+ /** Required client services: slot registration only. */
35
+ export declare const inject: readonly ['slots'];
36
+
37
+ // ---------------------------------------------------------------------------
38
+ // Native left navigation (G08)
39
+ // ---------------------------------------------------------------------------
40
+
41
+ /** The host shell slot that holds the sidebar's main entries (the icon). */
42
+ export declare const MAIN_SLOT: 'main';
43
+
44
+ /**
45
+ * The host shell slot that lists the sidebar panels (the row). This registration adds only
46
+ * the task entry; the shell's workspace region (`sidebar.workspaces`) is taken by a SEPARATE,
47
+ * lower-priority registration ({@link registerWorkspacesBrowser}) that can fall back to DSH's
48
+ * own browser. See `docs/workspace-grouping.md`.
49
+ */
50
+ export declare const SIDEBAR_PANEL_SLOT: 'sidebar.panellist';
51
+
52
+ /** Shared id of the two registrations, namespaced against other sidebar plugins. */
53
+ export declare const TASKS_NAV_KEY: 'dsh-taskbridge:taskbridge-tasks';
54
+
55
+ /** Sort key of the row in `sidebar.panellist`. */
56
+ export declare const TASKS_NAV_ORDER: number;
57
+
58
+ /** Operator-facing label of the entry. */
59
+ export declare const TASKS_NAV_LABEL: 'TaskBridge 任务';
60
+
61
+ /**
62
+ * The host's `uiWorkspace` service, or `null`. A host without it is the documented
63
+ * degradation: the panel lists records and offers no navigation.
64
+ */
65
+ export declare function resolveUiWorkspace(ctx: unknown): { openSession: (sessionId: string) => unknown } | null;
66
+
67
+ /**
68
+ * The host's `workspaces` service, or `null`. Its `list` is the subscribable source
69
+ * (`{ getSnapshot, subscribe }`) used to verify a recorded session id.
70
+ */
71
+ export declare function resolveWorkspaces(ctx: unknown): unknown;
72
+
73
+ /** Resolve a service passed either as a value or as a lazy getter (or `null`). */
74
+ export declare function resolveService(value: unknown): object | null;
75
+
76
+ /**
77
+ * Register the FULL CONTENT PANEL on `main` and the SMALL ICON on
78
+ * `sidebar.panellist`, sharing one id.
79
+ *
80
+ * This is the host's own split (0.2.2-rc.5): `main` carries
81
+ * `{ name: 'main', key }` with the page component, and `sidebar.panellist` carries
82
+ * `{ name: 'sidebar.panellist', id, order, label }` with the icon component, where
83
+ * `label` is a function.
84
+ *
85
+ * Both slots are optional host capabilities: a missing `slots` service or an
86
+ * undeclared slot simply registers nothing, and the settings page is unaffected.
87
+ * `store` is the SAME instance the settings page uses; `uiWorkspace`/`workspaces`
88
+ * may be values or lazy getters, resolved each time they are used.
89
+ */
90
+ export declare function registerTasksNavigation(
91
+ ctx: unknown,
92
+ options?: {
93
+ store?: unknown;
94
+ uiWorkspace?: unknown;
95
+ workspaces?: unknown;
96
+ registerPanel?: () => () => void;
97
+ registerIcon?: () => () => void;
98
+ },
99
+ ): () => void;
100
+
101
+ /**
102
+ * Where a recorded session id sits among the host's Workspaces:
103
+ * `pending` (snapshot not ready), `present` (listed and not archived),
104
+ * `archived` (in the host's `archivedSessionIds`), `missing` (a ready snapshot does
105
+ * not list it), or `unknown` (no service at all).
106
+ */
107
+ export type DelegateSessionPlacementState = 'unknown' | 'pending' | 'present' | 'archived' | 'missing';
108
+
109
+ /** The host's Workspaces snapshot, or `null` when it cannot be read synchronously. */
110
+ export declare function workspacesSnapshot(workspaces: unknown): {
111
+ phase?: string;
112
+ items?: Array<{ workspaceId?: string; sessionIds?: string[] }>;
113
+ archivedSessionIds?: string[];
114
+ } | null;
115
+
116
+ /** Every session id a snapshot knows, mapped to its workspace id. */
117
+ export declare function knownSessionIds(snapshot: unknown): Map<string, string>;
118
+
119
+ /** Read one recorded session's placement from the host's `workspaces.list` snapshot. */
120
+ export declare function sessionPlacement(
121
+ sessionId: string | null,
122
+ workspaces: unknown,
123
+ ): { state: DelegateSessionPlacementState; label: string | null; workspaceId: string | null };
124
+
125
+ /** The session id a `/tasks` row actually recorded, or `null`. */
126
+ export declare function taskSessionId(task: unknown): string | null;
127
+
128
+ /** Short, stable display form of a session id. */
129
+ export declare function shortSessionId(sessionId: string | null): string;
130
+
131
+ /** One project group the navigation panel draws. */
132
+ export interface DelegateNavGroup {
133
+ /** Host project key; two same-named projects stay two groups. */
134
+ key: string;
135
+ sessions: Array<{
136
+ taskId: string;
137
+ title: string;
138
+ sessionId: string | null;
139
+ status: { key: string; label: string; tone: string };
140
+ archived: boolean;
141
+ }>;
142
+ }
143
+
144
+ /** The navigation panel's model, projected from the page store and the host tree. */
145
+ export interface DelegateNavView {
146
+ groups: DelegateNavGroup[];
147
+ archivedGroups: DelegateNavGroup[];
148
+ activeCount: number;
149
+ archivedCount: number;
150
+ total: number;
151
+ available: boolean;
152
+ meta: Map<string, { name: string | null; shortPath: string | null; unverified: boolean; nodeCount: number }>;
153
+ }
154
+
155
+ /** Project the store snapshot and the host's tree onto the panel's model. */
156
+ export declare function navViewModel(snapshot: unknown): DelegateNavView;
157
+
158
+ /** Fallback label of a project key the host did not name. */
159
+ export declare function projectLabel(key: string): string;
160
+
161
+ /** A group's title: the host's project name, else the key's fallback label. */
162
+ export declare function groupTitle(group: DelegateNavGroup, meta: Map<string, unknown>): string;
163
+
164
+ /** Why archived rows are listed separately (or `null` when none are). */
165
+ export declare function archivedSourceNote(snapshot: unknown): string | null;
166
+
167
+ /**
168
+ * Open one recorded session through the host's own `uiWorkspace.openSession`.
169
+ *
170
+ * Verification comes first and `openSession` is called at most ONCE. Refused (with
171
+ * readable copy, and without navigating) when: there is no `uiWorkspace`; the record
172
+ * has no id; the snapshot is not ready; the id is in the host's
173
+ * `archivedSessionIds`; a ready snapshot does not list it; or there is no
174
+ * `workspaces` service to verify it against. Never renames, moves or archives.
175
+ */
176
+ export declare function locateSession(
177
+ uiWorkspace: unknown,
178
+ sessionId: string | null,
179
+ workspaces?: unknown,
180
+ ): Promise<{ ok: boolean; message: string }>;
181
+
182
+ /** The small sidebar ICON registered on `sidebar.panellist`. */
183
+ export declare function TaskbridgeSidebarIcon(): unknown;
184
+
185
+ /**
186
+ * The FULL CONTENT PANEL registered on `main`; receives
187
+ * `{ store, uiWorkspace, workspaces }`, where the last two may be lazy getters.
188
+ */
189
+ export declare function TaskbridgeNavPanel(props: Record<string, unknown>): unknown;
190
+
191
+ // ---------------------------------------------------------------------------
192
+ // Grouped workspaces (the shell's `sidebar.workspaces` cell)
193
+ // ---------------------------------------------------------------------------
194
+
195
+ /** The host slot the grouped workspaces browser occupies. */
196
+ export declare const WORKSPACES_SLOT: 'sidebar.workspaces';
197
+
198
+ /**
199
+ * The host's published CHILD slot of its workspace browser: a list rendered INSIDE every native
200
+ * session row. This is the only thing this plugin registers in the sidebar's workspace area; the
201
+ * parent slot stays the host's, so native rows, names, order, search and menus are untouched.
202
+ */
203
+ export declare const SESSION_ROW_ACTION_SLOT: 'sidebar.workspaces.session.row.action';
204
+
205
+ /** The id of this plugin's row-action registration, namespaced against other plugins. */
206
+ export declare const SESSION_ROW_ACTION_ID: string;
207
+
208
+ /** Its order: after the host's own row actions (the host uses 100 and 200). */
209
+ export declare const SESSION_ROW_ACTION_ORDER: number;
210
+
211
+ /** @deprecated The plugin no longer registers on `sidebar.workspaces`. */
212
+ export declare const WORKSPACES_PRIORITY: number;
213
+
214
+ /** How the plugin's own grouping presents itself. */
215
+ export declare const WORKSPACE_VIEWS: Readonly<{
216
+ grouped: 'grouped';
217
+ passthrough: 'passthrough';
218
+ }>;
219
+
220
+ /** Sections the grouping model can produce. */
221
+ export declare const GROUP_KINDS: Readonly<{ container: 'container'; project: 'project' }>;
222
+
223
+ /** One identity row as `GET /api/dsh-delegate/session-map` publishes it. */
224
+ export interface DelegateSessionIdentity {
225
+ taskId: string;
226
+ sessionId: string;
227
+ workspaceId: string;
228
+ sourcePath: string;
229
+ executionPath: string;
230
+ isolation: string | null;
231
+ updatedAt: number;
232
+ }
233
+
234
+ /** One conversation of a task workspace (level 3 of the tree): a real (workspace, session) pair. */
235
+ export interface DelegateGroupedSession {
236
+ sessionId: string;
237
+ /** The native Workspace it really lives in; every action on this row addresses this pair. */
238
+ workspaceId: string;
239
+ taskId: string | null;
240
+ title: string;
241
+ isolation: string | null;
242
+ updatedAt: number;
243
+ archived: boolean;
244
+ }
245
+
246
+ /**
247
+ * One TASK WORKSPACE (level 2): the native Workspace one dispatched chain lives in.
248
+ *
249
+ * Two chains of one project can share one native Workspace, so a project can hold two nodes with
250
+ * the same `workspaceId`; the row's identity is `chainId`.
251
+ */
252
+ export interface DelegateGroupedWorkspace {
253
+ workspaceId: string;
254
+ /** The continuation chain this node stands for (its root task id, or a pair-derived key). */
255
+ chainId: string;
256
+ title: string;
257
+ /** The real execution path; a display node names the native record, it never impersonates it. */
258
+ path: string;
259
+ /**
260
+ * The Workspace also holds conversations this plugin cannot vouch for, so renaming or removing
261
+ * it as a whole would act on them: both operations are refused.
262
+ */
263
+ sharedWithOrdinary: boolean;
264
+ conversations: DelegateGroupedSession[];
265
+ }
266
+
267
+ /** One node of the tree: the TaskBridge container or one real source project. */
268
+ export interface DelegateWorkspaceGroup {
269
+ kind: 'container' | 'project';
270
+ key: string;
271
+ name: string;
272
+ path: string;
273
+ workspaceCount: number;
274
+ conversationCount: number;
275
+ /** Projects of the container. */
276
+ projects?: DelegateWorkspaceGroup[];
277
+ /** A project's task workspaces (one per dispatched chain). */
278
+ workspaces?: DelegateGroupedWorkspace[];
279
+ }
280
+
281
+ /** The TaskBridge section view model. */
282
+ export interface DelegateWorkspacesView {
283
+ ready: boolean;
284
+ groups: DelegateWorkspaceGroup[];
285
+ /** Native Workspaces the section does NOT claim; the native browser shows them itself. */
286
+ standalone: Array<{ workspaceId: string; title: string; path: string }>;
287
+ ungrouped: Array<{ sessionId: string; title: string; owned: boolean }>;
288
+ archived: Array<{ sessionId: string; title: string; workspaceId: string; taskId: string | null }>;
289
+ duplicates: Array<{ sessionId: string; workspaceId: string }>;
290
+ /** Task workspaces shown in the section. */
291
+ ownCount: number;
292
+ conversationCount: number;
293
+ workspaceCount: number;
294
+ /** Native Workspaces the section leaves to the browser because they also hold other ones. */
295
+ mixedCount: number;
296
+ standaloneCount: number;
297
+ }
298
+
299
+ /** Canonical key of one directory, folded exactly as `sessionPathKey` folds it. */
300
+ export declare function sourcePathKey(value: unknown): string;
301
+
302
+ /** Whether a path is the plugin's registered managed-worktree root. */
303
+ export declare function isManagedRootPath(path: unknown): boolean;
304
+
305
+ /** Short label of one path node (its last one or two segments). */
306
+ export declare function projectNameOf(path: unknown): string;
307
+
308
+ /** The host's Workspaces snapshot, or `null` when it cannot be read synchronously. */
309
+ export declare function readWorkspacesSnapshot(workspaces: unknown): unknown;
310
+
311
+ /** The snapshot normalized to the fields the model consumes. */
312
+ export declare function workspaceItems(snapshot: unknown): {
313
+ ready: boolean;
314
+ items: Array<{ workspaceId: string; title: string; path: string; sessionIds: string[]; pinned: boolean }>;
315
+ archivedSessionIds: string[];
316
+ ungroupedSessionIds: string[];
317
+ };
318
+
319
+ /** Identity rows narrowed to rows that name both a Session and a Workspace. */
320
+ export declare function identityRows(rows: unknown): DelegateSessionIdentity[];
321
+
322
+ /** Session titles derived from `/tasks` rows (id stated by the record, never inferred). */
323
+ export declare function sessionTitles(tasks: unknown): Map<string, string>;
324
+
325
+ /** Task records indexed by the session/workspace pair they prove, plus their titles. */
326
+ export declare function sessionIndex(tasks: unknown): {
327
+ titles: Map<string, string>;
328
+ pairs: Map<string, DelegateSessionIdentity>;
329
+ byTask: Map<string, DelegateSessionIdentity>;
330
+ /** Task id → the root task of its continuation chain. */
331
+ chainOf: Map<string, string>;
332
+ };
333
+
334
+ /** Build the TaskBridge section from the host snapshot, the identity map and task records. */
335
+ export declare function workspaceGroups(input: {
336
+ snapshot?: unknown;
337
+ identities?: unknown;
338
+ titles?: Map<string, string>;
339
+ tasks?: unknown;
340
+ }): DelegateWorkspacesView;
341
+
342
+ /** Which presentation the plugin's own grouping calls for. */
343
+ export declare function workspacesViewMode(input: {
344
+ ownCount?: number;
345
+ }): 'grouped' | 'passthrough';
346
+
347
+ /** Read the identity map from the operator plane; a refusal answers an empty list. */
348
+ export declare function loadSessionMap(api: { getSessionMap: () => Promise<unknown> }): Promise<object[]>;
349
+
350
+ /** Resolve one optional host service through `ctx.get`, or `null`. */
351
+ export declare function hostService(ctx: unknown, name: string): object | null;
352
+
353
+ /** Ask the operator for one line of text (the shell's dialog), or `null`. */
354
+ export declare function askText(message: string, initial: string, shell?: unknown): string | null;
355
+
356
+ /** Ask the operator to confirm a destructive action; an absent dialog answers NO. */
357
+ export declare function askConfirm(message: string, shell?: unknown): boolean;
358
+
359
+ /** Short display form of a session id. */
360
+ export declare function shortId(sessionId: unknown): string;
361
+
362
+ /** A host snapshot reused while its data is unchanged (safe for `useSyncExternalStore`). */
363
+ export declare function stableSnapshot(snapshot: unknown, cache?: { key: string | null; value: object | null }): object | null;
364
+
365
+ /** Session id → what proves it is a TaskBridge dispatch (identity row or record, plus its title). */
366
+ export declare function dispatchProof(identities: unknown, tasks: unknown): {
367
+ bySession: Map<string, DelegateSessionIdentity & { title?: string }>;
368
+ ready: boolean;
369
+ };
370
+
371
+ /**
372
+ * Register the per-session marker into the host's published child slot
373
+ * ({@link SESSION_ROW_ACTION_SLOT}). The parent slot is never registered: the native workspace
374
+ * rows, names, order, search, menus and actions stay exactly as the host renders them.
375
+ */
376
+ export declare function registerSessionRowMarker(
377
+ ctx: unknown,
378
+ options?: { store?: unknown; api?: unknown; sessionMap?: () => Promise<unknown> },
379
+ ): () => void;
380
+
381
+ /** The marker rendered inside one native session row (`sessionId` comes from the host). */
382
+ export declare function DispatchedSessionMarker(props: Record<string, unknown>): unknown;
383
+
384
+ /** The plugin's own grouping surface: TaskBridge → task workspace → conversation. */
385
+ export declare function TaskbridgeGrouping(props: Record<string, unknown>): unknown;
386
+
387
+ /** @deprecated Kept so an older import resolves; the plugin registers no such entry. */
388
+ export declare function registerWorkspacesBrowser(...args: unknown[]): () => void;
389
+
390
+ /** Options accepted by {@link registerBundleConfiguration}. */
391
+ export interface DelegateBundleConfigOptions {
392
+ /** Page store; the component subscribes to it itself. */
393
+ store: unknown;
394
+ }
395
+
396
+ /**
397
+ * Register the bundle configuration page on a client context.
398
+ * @param ctx - client context exposing `slots`.
399
+ * @param options - the page store.
400
+ * @returns the slot disposer.
401
+ */
402
+ export declare function registerBundleConfiguration(
403
+ ctx: unknown,
404
+ options: DelegateBundleConfigOptions,
405
+ ): () => void;
406
+
407
+ /**
408
+ * Client plugin apply hook: injects the scoped stylesheet and registers one
409
+ * `plugins.bundle.config` entry, and nothing else. It never registers a
410
+ * `settings.section`, and it never dispatches a task.
411
+ * @param ctx - client Cordis context.
412
+ */
413
+ export declare function apply(ctx: unknown): void;
414
+
415
+ /**
416
+ * React component that renders the whole configuration page. It receives the
417
+ * registration's `inject` face (`{ store }`) plus the slot owner props
418
+ * (`{ view: 'page', form? }`), and deliberately ignores `form`.
419
+ */
420
+ export declare function DelegateConfigPage(props: Record<string, unknown>): unknown;
421
+
422
+ /** Re-exported client helpers that the page and the tests both use. */
423
+ export declare const documentFromDraft: (...args: unknown[]) => unknown;
424
+ export declare const describeError: (...args: unknown[]) => string;
425
+ export declare const exportDocument: (...args: unknown[]) => unknown;
426
+
427
+ /**
428
+ * The plan-creation form state, as one editable batch plus the batch's parent.
429
+ *
430
+ * `parent` on a row is `''` (root), `'row:<n>'` (another row of the same batch, by
431
+ * position) or a real plan `nodeId` the host returned. There is no title-based
432
+ * parent, by construction.
433
+ */
434
+ export interface DelegatePlanCreateRow {
435
+ title: string;
436
+ goalDescription?: string;
437
+ parent?: string;
438
+ }
439
+
440
+ /** Draft the plan-creation form holds. */
441
+ export interface DelegatePlanCreateDraft {
442
+ title?: string;
443
+ goal?: string;
444
+ parentNodeId?: string;
445
+ workspacePath?: string;
446
+ rows?: DelegatePlanCreateRow[];
447
+ }
448
+
449
+ /**
450
+ * The request body `POST /api/dsh-delegate/plans` takes. It names no connection:
451
+ * the host always writes for the fixed local caller and refuses a body that tries.
452
+ */
453
+ export interface DelegatePlanCreateRequest {
454
+ nodes: Array<{
455
+ key: string;
456
+ title: string;
457
+ goalDescription?: string;
458
+ parentKey?: string;
459
+ parentNodeId?: string;
460
+ }>;
461
+ parentNodeId?: string;
462
+ workspacePath?: string;
463
+ }
464
+
465
+ /**
466
+ * Project the form draft onto the create request.
467
+ * @returns the request body plus the local precheck problems (empty when valid).
468
+ */
469
+ export declare function planCreateRequest(
470
+ draft: DelegatePlanCreateDraft,
471
+ ): { body: DelegatePlanCreateRequest; problems: string[] };
472
+
473
+ /**
474
+ * Actions the Codex panel may send. `status` is absent on purpose: the page reads
475
+ * that state through a `GET`, so only a real change is ever a `POST`.
476
+ */
477
+ export declare const CODEX_ACTIONS: readonly ['install', 'repair', 'remove'];
478
+
479
+ /** The user-plane paths the integration panels use (`GET` diagnoses, `POST` acts). */
480
+ export declare const ROUTES: Readonly<Record<string, string>> & {
481
+ codex: '/api/dsh-delegate/codex';
482
+ antigravity: '/api/dsh-delegate/antigravity';
483
+ };
484
+
485
+ /**
486
+ * One target's presentation state: agent file, MCP entry or DSH switch.
487
+ *
488
+ * The three are reported separately because they are independent: an installed
489
+ * agent does not imply a configured MCP entry, and neither implies that the DSH
490
+ * local-call switch is on.
491
+ */
492
+ export interface DelegateCodexTargetView {
493
+ key: 'agent' | 'mcp' | 'switch';
494
+ label: string;
495
+ state: string;
496
+ tone: 'on' | 'off' | 'warn';
497
+ detail: string;
498
+ path?: string;
499
+ paths?: string[];
500
+ }
501
+
502
+ /** Map a served Codex status document onto one target's presentation state. */
503
+ export declare function codexTargetView(
504
+ codex: unknown,
505
+ switchState: unknown,
506
+ target: 'agent' | 'mcp' | 'switch',
507
+ ): DelegateCodexTargetView;
508
+
509
+ /** Chinese one-line summary of an action outcome (`changed` / `refused`). */
510
+ export declare function describeCodexOutcome(outcome: unknown): string;
511
+
512
+ /** Actions the Antigravity panel may send (`status` is always `GET`). */
513
+ export declare const ANTIGRAVITY_ACTIONS: readonly ['install', 'repair', 'remove'];
514
+
515
+ /** One Antigravity target's presentation state: plugin bundle, MCP config or DSH switch. */
516
+ export interface DelegateAntigravityTargetView {
517
+ key: 'plugin' | 'mcp' | 'switch';
518
+ label: string;
519
+ state: string;
520
+ tone: 'on' | 'off' | 'warn';
521
+ detail: string;
522
+ path?: string;
523
+ paths?: string[];
524
+ }
525
+
526
+ /** Map a served Antigravity status document onto one target's presentation state. */
527
+ export declare function antigravityTargetView(
528
+ antigravity: unknown,
529
+ switchState: unknown,
530
+ target: 'plugin' | 'mcp' | 'switch',
531
+ ): DelegateAntigravityTargetView;
532
+
533
+ /** Chinese one-line summary of an Antigravity action outcome (`changed` / `refused`). */
534
+ export declare function describeAntigravityOutcome(outcome: unknown): string;
535
+
536
+ /**
537
+ * One execution chain as the cleanup surface sees it.
538
+ *
539
+ * `selectable` is the host's own verdict plus the exact-rounds check made in the page;
540
+ * `blockers` carries the host's stable codes and is what a disabled checkbox explains.
541
+ */
542
+ export interface DelegateCleanupCandidate {
543
+ chainId: string;
544
+ taskIds: string[];
545
+ roundCount: number;
546
+ title: string;
547
+ planNodeId: string | null;
548
+ parentNodeId: string | null;
549
+ nodeId: string | null;
550
+ nodeKind: string;
551
+ selectable: boolean;
552
+ blockers: string[];
553
+ reason: string | null;
554
+ }
555
+
556
+ /** One chain of a cleanup request: its identity and its exact rounds. */
557
+ export interface DelegateCleanupChain {
558
+ chainId: string;
559
+ taskIds: string[];
560
+ }
561
+
562
+ /** What the confirmation shows before anything is sent. */
563
+ export interface DelegateCleanupSummary {
564
+ chains: number;
565
+ rounds: number;
566
+ empty: boolean;
567
+ executable: boolean;
568
+ problems: string[];
569
+ }
570
+
571
+ /** Once one request may name. Mirrors `MAX_CLEANUP_CHAINS` on the host. */
572
+ export declare const MAX_CLEANUP_CHAINS: number;
573
+
574
+ /** Chinese label for one cleanup blocker code. */
575
+ export declare function cleanupBlockerLabel(code: string): string;
576
+
577
+ /** Every execution chain of a rendered tree, in pre-order, with its eligibility. */
578
+ export declare function cleanupCandidates(view: unknown): DelegateCleanupCandidate[];
579
+
580
+ /** Chain id -> the rounds that were selected; anything stale is disabled. */
581
+ export declare function withSelectionState(
582
+ candidate: DelegateCleanupCandidate,
583
+ selectedTaskIds: string[],
584
+ ): DelegateCleanupCandidate;
585
+
586
+ /** Drop selections that no longer name a selectable chain of the current tree. */
587
+ export declare function pruneCleanupSelection(
588
+ selection: Record<string, string[]>,
589
+ candidates: DelegateCleanupCandidate[],
590
+ ): { selection: Record<string, string[]>; dropped: string[] };
591
+
592
+ /** Toggle one chain in a selection (a new object; the input is not mutated). */
593
+ export declare function toggleCleanupSelection(
594
+ selection: Record<string, string[]>,
595
+ candidate: DelegateCleanupCandidate,
596
+ ): Record<string, string[]>;
597
+
598
+ /** Chain/round counts and any problem that blocks the confirmation. */
599
+ export declare function cleanupSelectionSummary(
600
+ selection: Record<string, string[]>,
601
+ candidates: DelegateCleanupCandidate[],
602
+ ): DelegateCleanupSummary;
603
+
604
+ /** Project a selection onto the exact request body the host accepts. */
605
+ export declare function cleanupRequest(
606
+ selection: Record<string, string[]>,
607
+ candidates: DelegateCleanupCandidate[],
608
+ ): { body: { chains: DelegateCleanupChain[] }; problems: string[] };
609
+
610
+ /** Stable fingerprint of a selection, for change detection across refreshes. */
611
+ export declare function cleanupSelectionKey(
612
+ candidates: DelegateCleanupCandidate[],
613
+ selection: Record<string, string[]>,
614
+ ): string;
615
+
616
+ /** The removed ids and counts of a completed cleanup. */
617
+ export declare function cleanupOutcome(outcome: unknown): {
618
+ chains: number;
619
+ rounds: number;
620
+ deletedTaskIds: string[];
621
+ };
622
+
623
+ /** Plain-Chinese description of one completed cleanup. */
624
+ export declare function describeCleanupOutcome(outcome: unknown): string;
625
+
626
+ /** The irreversible-action warning shown beside the confirm button. */
627
+ export declare function cleanupWarningText(): string;
628
+
629
+ /**
630
+ * The operator's execution-choice block, normalized for display.
631
+ *
632
+ * A document (or a host) that predates the block opens at the OFF default, so an
633
+ * upgraded installation never presents agent collaboration as already decided on.
634
+ */
635
+ export declare function executionOf(
636
+ source: unknown,
637
+ ): { agentTeamsDefault: boolean | unknown };
638
+
639
+ /** The documented default a NEW task gets when nothing else decides. */
640
+ export declare const AGENT_TEAMS_DEFAULT_FOR_NEW_TASKS: false;
641
+
642
+ /** Where a task's frozen Agent Teams decision came from. */
643
+ export declare const AGENT_TEAMS_ORIGIN_LABELS: Readonly<{
644
+ request: string;
645
+ continuation: string;
646
+ 'settings-default': string;
647
+ }>;
648
+
649
+ /** Shape the registration factory returns as `module.exports`. */
650
+ export interface DelegateClientModule {
651
+ PLUGIN_CONFIG_SLOT: typeof PLUGIN_CONFIG_SLOT;
652
+ PLUGIN_BUNDLE_KEY: typeof PLUGIN_BUNDLE_KEY;
653
+ inject: typeof inject;
654
+ registerBundleConfiguration: typeof registerBundleConfiguration;
655
+ apply: typeof apply;
656
+ DelegateConfigPage: typeof DelegateConfigPage;
657
+ documentFromDraft: typeof documentFromDraft;
658
+ describeError: typeof describeError;
659
+ exportDocument: typeof exportDocument;
660
+ ROUTES: typeof ROUTES;
661
+ CODEX_ACTIONS: typeof CODEX_ACTIONS;
662
+ codexTargetView: typeof codexTargetView;
663
+ describeCodexOutcome: typeof describeCodexOutcome;
664
+ ANTIGRAVITY_ACTIONS: typeof ANTIGRAVITY_ACTIONS;
665
+ antigravityTargetView: typeof antigravityTargetView;
666
+ describeAntigravityOutcome: typeof describeAntigravityOutcome;
667
+ /** G09 batch plan creation: the pure form-draft → request projection. */
668
+ planCreateRequest: typeof planCreateRequest;
669
+ /** Task-record cleanup: the chain projection, selection and confirmation text. */
670
+ MAX_CLEANUP_CHAINS: typeof MAX_CLEANUP_CHAINS;
671
+ cleanupBlockerLabel: typeof cleanupBlockerLabel;
672
+ cleanupCandidates: typeof cleanupCandidates;
673
+ withSelectionState: typeof withSelectionState;
674
+ pruneCleanupSelection: typeof pruneCleanupSelection;
675
+ toggleCleanupSelection: typeof toggleCleanupSelection;
676
+ cleanupSelectionSummary: typeof cleanupSelectionSummary;
677
+ cleanupRequest: typeof cleanupRequest;
678
+ cleanupSelectionKey: typeof cleanupSelectionKey;
679
+ cleanupOutcome: typeof cleanupOutcome;
680
+ describeCleanupOutcome: typeof describeCleanupOutcome;
681
+ cleanupWarningText: typeof cleanupWarningText;
682
+ /** Execution choices: the new-task Agent Teams default and its origin labels. */
683
+ executionOf: typeof executionOf;
684
+ AGENT_TEAMS_DEFAULT_FOR_NEW_TASKS: typeof AGENT_TEAMS_DEFAULT_FOR_NEW_TASKS;
685
+ AGENT_TEAMS_ORIGIN_LABELS: typeof AGENT_TEAMS_ORIGIN_LABELS;
686
+ /** G08 native left navigation: slot names, projection and navigation. */
687
+ MAIN_SLOT: typeof MAIN_SLOT;
688
+ SIDEBAR_PANEL_SLOT: typeof SIDEBAR_PANEL_SLOT;
689
+ TASKS_NAV_KEY: typeof TASKS_NAV_KEY;
690
+ TASKS_NAV_LABEL: typeof TASKS_NAV_LABEL;
691
+ resolveUiWorkspace: typeof resolveUiWorkspace;
692
+ resolveWorkspaces: typeof resolveWorkspaces;
693
+ resolveService: typeof resolveService;
694
+ workspacesSnapshot: typeof workspacesSnapshot;
695
+ knownSessionIds: typeof knownSessionIds;
696
+ registerTasksNavigation: typeof registerTasksNavigation;
697
+ navViewModel: typeof navViewModel;
698
+ locateSession: typeof locateSession;
699
+ TaskbridgeSidebarIcon: typeof TaskbridgeSidebarIcon;
700
+ TaskbridgeNavPanel: typeof TaskbridgeNavPanel;
701
+ /**
702
+ * The sidebar integration: the host's published per-session child slot, the marker it renders,
703
+ * and the plugin's own three-level grouping with its pure model.
704
+ */
705
+ SESSION_ROW_ACTION_SLOT: typeof SESSION_ROW_ACTION_SLOT;
706
+ SESSION_ROW_ACTION_ID: typeof SESSION_ROW_ACTION_ID;
707
+ SESSION_ROW_ACTION_ORDER: typeof SESSION_ROW_ACTION_ORDER;
708
+ WORKSPACES_SLOT: typeof WORKSPACES_SLOT;
709
+ WORKSPACES_PRIORITY: typeof WORKSPACES_PRIORITY;
710
+ WORKSPACE_VIEWS: typeof WORKSPACE_VIEWS;
711
+ GROUP_KINDS: typeof GROUP_KINDS;
712
+ registerSessionRowMarker: typeof registerSessionRowMarker;
713
+ DispatchedSessionMarker: typeof DispatchedSessionMarker;
714
+ TaskbridgeGrouping: typeof TaskbridgeGrouping;
715
+ dispatchProof: typeof dispatchProof;
716
+ registerWorkspacesBrowser: typeof registerWorkspacesBrowser;
717
+ workspacesViewMode: typeof workspacesViewMode;
718
+ workspaceGroups: typeof workspaceGroups;
719
+ workspaceItems: typeof workspaceItems;
720
+ identityRows: typeof identityRows;
721
+ sessionTitles: typeof sessionTitles;
722
+ sessionIndex: typeof sessionIndex;
723
+ sourcePathKey: typeof sourcePathKey;
724
+ isManagedRootPath: typeof isManagedRootPath;
725
+ projectNameOf: typeof projectNameOf;
726
+ readWorkspacesSnapshot: typeof readWorkspacesSnapshot;
727
+ loadSessionMap: typeof loadSessionMap;
728
+ hostService: typeof hostService;
729
+ askText: typeof askText;
730
+ askConfirm: typeof askConfirm;
731
+ shortId: typeof shortId;
732
+ stableSnapshot: typeof stableSnapshot;
733
+ }