dsh-taskbridge 1.5.4 → 1.7.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 (74) hide show
  1. package/CHANGELOG.md +80 -59
  2. package/README.md +51 -50
  3. package/THIRD_PARTY_NOTICES.txt +23 -0
  4. package/bin/dsh-delegate-mcp.d.ts +1 -0
  5. package/bin/dsh-delegate-mcp.js +1 -0
  6. package/codex/dsh-taskbridge.toml +148 -71
  7. package/docs/INTRODUCTION.md +44 -22
  8. package/docs/INTRODUCTION.zh.md +32 -26
  9. package/docs/codex-integration.md +99 -19
  10. package/docs/contracts-stage-b.md +4 -4
  11. package/docs/conversation-placement.md +25 -7
  12. package/docs/plugin-market.md +1 -1
  13. package/docs/releases/1.6.0.zh.md +11 -0
  14. package/docs/releases/1.7.0.zh.md +11 -0
  15. package/docs/runtime-compatibility.md +10 -11
  16. package/docs/silent-wait.md +69 -31
  17. package/docs/taskbridge-upgrade.md +1 -1
  18. package/docs/worker-permissions.md +11 -21
  19. package/docs/workspace-grouping.md +126 -0
  20. package/lib/client.d.ts +581 -0
  21. package/lib/client.js +332 -3461
  22. package/locale/en.json +1 -1
  23. package/locale/zh.json +1 -1
  24. package/package.json +7 -19
  25. package/src/client/api.js +895 -90
  26. package/src/client/index.jsx +1363 -296
  27. package/src/client/sidebar.jsx +862 -0
  28. package/src/client/styles.js +340 -0
  29. package/src/client/task-cleanup.js +304 -0
  30. package/src/client/task-records-table.jsx +217 -0
  31. package/src/client/task-view.js +307 -0
  32. package/src/client/workspace-groups.js +482 -0
  33. package/src/client/workspaces-browser.jsx +770 -0
  34. package/src/codex/agent-ownership.js +270 -0
  35. package/src/codex/installer.js +528 -35
  36. package/src/codex/seam.js +5 -0
  37. package/src/config/defaults.js +63 -17
  38. package/src/config/settings.js +60 -62
  39. package/src/config/validate.js +126 -71
  40. package/src/http/execution-plane.js +200 -1
  41. package/src/http/respond.js +26 -2
  42. package/src/http/user-plane.js +566 -2
  43. package/src/index.d.ts +55 -0
  44. package/src/index.js +58 -42
  45. package/src/jobs/activity.js +968 -78
  46. package/src/jobs/engine.js +1010 -230
  47. package/src/jobs/history.js +224 -12
  48. package/src/jobs/plan-store.js +1020 -0
  49. package/src/jobs/record-cleanup.js +196 -0
  50. package/src/jobs/task-display.js +73 -0
  51. package/src/jobs/task-tree.js +786 -0
  52. package/src/jobs/title.js +129 -12
  53. package/src/mcp/server.js +206 -10
  54. package/src/mcp/wait.js +64 -5
  55. package/src/runtime/agent-runner.js +101 -15
  56. package/src/runtime/worker-prompt.js +53 -0
  57. package/src/workspace/locks.js +288 -167
  58. package/docs/assets/taskbridge-workflow.en.png +0 -0
  59. package/docs/assets/taskbridge-workflow.zh.png +0 -0
  60. package/docs/releases/1.4.0-token-benchmark.zh.md +0 -40
  61. package/docs/releases/1.4.0.zh.md +0 -54
  62. package/docs/releases/1.4.1.zh.md +0 -59
  63. package/docs/releases/1.4.2.zh.md +0 -23
  64. package/docs/releases/1.5.0-token-benchmark.zh.md +0 -73
  65. package/docs/releases/1.5.0.zh.md +0 -51
  66. package/docs/releases/1.5.1.zh.md +0 -70
  67. package/docs/releases/1.5.2.zh.md +0 -30
  68. package/docs/releases/1.5.3-test.1.zh.md +0 -28
  69. package/docs/releases/1.5.3-test.2.zh.md +0 -24
  70. package/docs/releases/1.5.3.zh.md +0 -33
  71. package/docs/releases/1.5.4.zh.md +0 -25
  72. package/src/review/preset.js +0 -868
  73. package/src/review/prompts.js +0 -145
  74. package/src/review/reviewer.js +0 -933
package/lib/client.d.ts CHANGED
@@ -34,6 +34,359 @@ export declare const PLUGIN_BUNDLE_KEY: 'dsh-taskbridge';
34
34
  /** Required client services: slot registration only. */
35
35
  export declare const inject: readonly ['slots'];
36
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
+
37
390
  /** Options accepted by {@link registerBundleConfiguration}. */
38
391
  export interface DelegateBundleConfigOptions {
39
392
  /** Page store; the component subscribes to it itself. */
@@ -71,6 +424,52 @@ export declare const documentFromDraft: (...args: unknown[]) => unknown;
71
424
  export declare const describeError: (...args: unknown[]) => string;
72
425
  export declare const exportDocument: (...args: unknown[]) => unknown;
73
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
+
74
473
  /**
75
474
  * Actions the Codex panel may send. `status` is absent on purpose: the page reads
76
475
  * that state through a `GET`, so only a real change is ever a `POST`.
@@ -107,6 +506,119 @@ export declare function codexTargetView(
107
506
  /** Chinese one-line summary of an action outcome (`changed` / `refused`). */
108
507
  export declare function describeCodexOutcome(outcome: unknown): string;
109
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
+
110
622
  /** Shape the registration factory returns as `module.exports`. */
111
623
  export interface DelegateClientModule {
112
624
  PLUGIN_CONFIG_SLOT: typeof PLUGIN_CONFIG_SLOT;
@@ -115,4 +627,73 @@ export interface DelegateClientModule {
115
627
  registerBundleConfiguration: typeof registerBundleConfiguration;
116
628
  apply: typeof apply;
117
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;
118
699
  }