@fish-under-sea/dsh-client-ui-task-board-fish 1.0.2 → 1.1.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 (123) hide show
  1. package/NOTICE +1 -1
  2. package/README.en.md +4 -4
  3. package/README.md +4 -4
  4. package/README.zh.md +4 -4
  5. package/lib/client.js +4428 -1508
  6. package/lib/client.js.map +1 -1
  7. package/lib/index.js +2670 -496
  8. package/lib/types/client/CardDefaultPresetField.d.ts +35 -0
  9. package/lib/types/client/PluginSettingsCard.d.ts +130 -19
  10. package/lib/types/client/RangeBubble.d.ts +46 -0
  11. package/lib/types/client/SegmentGroup.d.ts +28 -0
  12. package/lib/types/client/TaskBoardSettingsCard.d.ts +63 -0
  13. package/lib/types/client/board/AttachmentField.d.ts +70 -0
  14. package/lib/types/client/board/ExecutionLog.d.ts +24 -0
  15. package/lib/types/client/board/ReasoningEffortField.d.ts +25 -0
  16. package/lib/types/client/board/TaskForm.d.ts +4 -0
  17. package/lib/types/client/board/VerificationReport.d.ts +2 -15
  18. package/lib/types/client/board/model-options.d.ts +87 -0
  19. package/lib/types/client/board/preset-label.d.ts +21 -0
  20. package/lib/types/client/board/preset-roster.d.ts +45 -0
  21. package/lib/types/client/board/source-group.d.ts +27 -0
  22. package/lib/types/client/body-mutations.d.ts +45 -0
  23. package/lib/types/client/host-api.d.ts +25 -0
  24. package/lib/types/client/locales.d.ts +87 -9
  25. package/lib/types/client/pending-verify.d.ts +47 -0
  26. package/lib/types/client/plugin-card-seat.d.ts +3 -1
  27. package/lib/types/client/service.d.ts +4 -1
  28. package/lib/types/client/settings-form.d.ts +73 -51
  29. package/lib/types/core/attachment.d.ts +132 -0
  30. package/lib/types/core/card-defaults.d.ts +78 -0
  31. package/lib/types/core/controller.d.ts +57 -8
  32. package/lib/types/core/execution-summary.d.ts +52 -0
  33. package/lib/types/core/extension.d.ts +116 -0
  34. package/lib/types/core/launch-width.d.ts +31 -0
  35. package/lib/types/core/reasoning-effort.d.ts +57 -0
  36. package/lib/types/core/session-reuse.d.ts +7 -1
  37. package/lib/types/core/spend-budget.d.ts +28 -0
  38. package/lib/types/core/subtask.d.ts +100 -37
  39. package/lib/types/core/tasks.d.ts +94 -10
  40. package/lib/types/core/use-cases/task-create.d.ts +10 -5
  41. package/lib/types/core/use-cases/task-tag.d.ts +36 -0
  42. package/lib/types/core/use-cases/task-update.d.ts +22 -1
  43. package/lib/types/core/wire-projection.d.ts +35 -0
  44. package/lib/types/core/workspace-target.d.ts +23 -3
  45. package/lib/types/host/attachments.d.ts +250 -0
  46. package/lib/types/host/extension-registry.d.ts +40 -0
  47. package/lib/types/host/launch-admission.d.ts +71 -0
  48. package/lib/types/host-ledger.d.ts +114 -47
  49. package/lib/types/host-routes.d.ts +63 -0
  50. package/lib/types/host-runner.d.ts +164 -18
  51. package/lib/types/host-service.d.ts +182 -46
  52. package/lib/types/host-spend.d.ts +52 -0
  53. package/lib/types/index.d.ts +173 -54
  54. package/lib/types/loopback.d.ts +41 -1
  55. package/lib/types/protocol.d.ts +52 -11
  56. package/lib/types/tool-surface.d.ts +1 -0
  57. package/locale/en.json +6 -0
  58. package/locale/zh.json +6 -0
  59. package/package.json +35 -28
  60. package/src/client/CardDefaultPresetField.tsx +101 -0
  61. package/src/client/PluginSettingsCard.tsx +385 -111
  62. package/src/client/RangeBubble.tsx +164 -0
  63. package/src/client/SegmentGroup.tsx +93 -0
  64. package/src/client/TaskBoardSettingsCard.tsx +332 -37
  65. package/src/client/board/AttachmentField.tsx +383 -0
  66. package/src/client/board/EditTaskModal.tsx +63 -0
  67. package/src/client/board/ExecutionLog.tsx +154 -0
  68. package/src/client/board/LinkSubtaskModal.tsx +1 -1
  69. package/src/client/board/NewTaskModal.tsx +154 -45
  70. package/src/client/board/ReasoningEffortField.tsx +50 -0
  71. package/src/client/board/TagManagerModal.tsx +151 -2
  72. package/src/client/board/TaskBoard.tsx +47 -10
  73. package/src/client/board/TaskCard.tsx +45 -23
  74. package/src/client/board/TaskDetail.tsx +468 -258
  75. package/src/client/board/TaskForm.tsx +19 -4
  76. package/src/client/board/VerificationReport.tsx +143 -104
  77. package/src/client/board/model-options.ts +208 -0
  78. package/src/client/board/preset-label.ts +32 -0
  79. package/src/client/board/preset-roster.ts +58 -0
  80. package/src/client/board/source-group.ts +94 -0
  81. package/src/client/board/task-markdown.module.css +11 -8
  82. package/src/client/board-settings.module.css +35 -7
  83. package/src/client/board.module.css +1044 -105
  84. package/src/client/body-mutations.ts +133 -0
  85. package/src/client/host-api.ts +70 -0
  86. package/src/client/index.ts +109 -95
  87. package/src/client/locales.ts +205 -48
  88. package/src/client/pending-verify.ts +90 -0
  89. package/src/client/plugin-card-seat.ts +8 -2
  90. package/src/client/service.ts +24 -0
  91. package/src/client/settings-card.module.css +466 -89
  92. package/src/client/settings-entry-form.ts +0 -1
  93. package/src/client/settings-form.ts +102 -60
  94. package/src/core/attachment.ts +287 -0
  95. package/src/core/card-defaults.ts +132 -0
  96. package/src/core/controller.ts +90 -11
  97. package/src/core/execution-summary.ts +96 -0
  98. package/src/core/extension.ts +120 -0
  99. package/src/core/launch-width.ts +38 -0
  100. package/src/core/reasoning-effort.ts +92 -0
  101. package/src/core/session-reuse.ts +7 -1
  102. package/src/core/spend-budget.ts +35 -0
  103. package/src/core/store.ts +19 -1
  104. package/src/core/subtask.ts +144 -68
  105. package/src/core/tasks.ts +117 -10
  106. package/src/core/use-cases/task-create.ts +27 -16
  107. package/src/core/use-cases/task-tag.ts +56 -0
  108. package/src/core/use-cases/task-update.ts +33 -5
  109. package/src/core/wire-projection.ts +81 -0
  110. package/src/core/workspace-target.ts +27 -3
  111. package/src/host/agent-tools.ts +33 -21
  112. package/src/host/attachments.ts +650 -0
  113. package/src/host/extension-registry.ts +150 -5
  114. package/src/host/launch-admission.ts +139 -0
  115. package/src/host-ledger.ts +248 -117
  116. package/src/host-routes.ts +233 -15
  117. package/src/host-runner.ts +395 -61
  118. package/src/host-service.ts +512 -139
  119. package/src/host-spend.ts +105 -0
  120. package/src/index.ts +312 -92
  121. package/src/loopback.ts +57 -1
  122. package/src/protocol.ts +83 -18
  123. package/src/tool-surface.ts +1 -0
@@ -12,6 +12,7 @@
12
12
  * @module dsh-task-board/core/extension
13
13
  */
14
14
  import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
15
+ import type { TaskBoardAction, TaskBoardSnapshot, TaskBoardVerificationOptions } from '../protocol.ts';
15
16
  import type { ExecutionOutcome, TaskRecord, TaskStatus } from './tasks.ts';
16
17
  /** Cordis service name the host and browser halves each publish. */
17
18
  export declare const TASK_BOARD_SERVICE_NAME = "taskBoard";
@@ -36,6 +37,13 @@ export declare const TASK_BOARD_EXTENSION_SEATS: readonly string[];
36
37
  * channel.
37
38
  */
38
39
  export declare const TASK_BOARD_PAYLOAD_LIMIT_BYTES: number;
40
+ /**
41
+ * Largest accepted free text a provider pushes into an execution, in
42
+ * characters: one follow-up message, or one set of rework instructions. Both
43
+ * reach a model as user input, so the bound keeps a single provider call from
44
+ * becoming an unbounded context injection.
45
+ */
46
+ export declare const TASK_BOARD_MESSAGE_MAX_LENGTH = 4000;
39
47
  /** One opaque provider payload the board stores and forwards without interpreting. */
40
48
  export type TaskBoardExtensionPayload = Record<string, unknown>;
41
49
  /**
@@ -90,6 +98,26 @@ export interface TaskBoardTaskDraft {
90
98
  * no reason to know better pins nothing.
91
99
  */
92
100
  workspaceId?: string;
101
+ /**
102
+ * Agent preset the created card pins as its execution composition. Absent
103
+ * pins nothing and leaves the board's own resolution in charge. The value is
104
+ * forwarded to the board's creation path unchanged, so a preset this
105
+ * deployment does not register fails the RUN closed, exactly as it does for a
106
+ * card created anywhere else.
107
+ */
108
+ mode?: string;
109
+ /**
110
+ * Model the created card pins, in `provider/model` form — the same field
111
+ * `task_board_create` takes. Resolved against the host catalog at launch, so
112
+ * an unknown route is a run-time answer, not a creation-time one.
113
+ */
114
+ model?: string;
115
+ /**
116
+ * Reasoning level for the pinned {@link model}. It travels with the model it
117
+ * was chosen for: the board never applies a level to a route that does not
118
+ * declare it.
119
+ */
120
+ reasoningEffort?: string;
93
121
  }
94
122
  /** Options of {@link TaskBoardTasksFace.create}. */
95
123
  export interface TaskBoardCreateOptions {
@@ -131,6 +159,41 @@ export interface TaskBoardTasksFace {
131
159
  setStatus(taskId: string, status: TaskStatus, initiator?: string): void;
132
160
  /** Every task carrying this extension's payload. */
133
161
  linked(): readonly TaskBoardLinkedTask[];
162
+ /**
163
+ * Run a card that already executed again — in its ORIGINAL session — with
164
+ * `instructions` carried as this run's additional input, which is how a
165
+ * reviewer sends work back rather than asking for a fresh attempt. The
166
+ * instructions are recorded on the execution the request opens, so the run
167
+ * history says why that run exists.
168
+ *
169
+ * The request passes through every run gate the board already has — the
170
+ * running lock, the permission confirmation, the acceptance contract and the
171
+ * spend cap — and it never rewrites the card: an executed card's frozen
172
+ * title, description and prompt stay exactly what ran (see
173
+ * {@link TaskBoardTasksFace.patchContent}). A card that never executed, or
174
+ * whose session cannot be continued, is refused instead of quietly starting a
175
+ * conversation the caller never saw.
176
+ *
177
+ * Optional, like {@link TaskBoardExtensionHost.sessions}: the contract
178
+ * version stays 1, so a provider checks the face before using it.
179
+ */
180
+ rework?(taskId: string, instructions: string, initiator?: string): void;
181
+ }
182
+ /**
183
+ * Execution-session face: what a provider delivers INTO a run the board
184
+ * already executed or is executing now.
185
+ */
186
+ export interface TaskBoardSessionsFace {
187
+ /**
188
+ * Queue one follow-up user message into the session of the card's current
189
+ * execution, or of its most recent one when no execution is open.
190
+ *
191
+ * The message is an ordinary user turn queued behind whatever that session is
192
+ * doing; it re-asserts nothing, so the execution's permission, model and
193
+ * preset stay the ones the run froze. A card that never executed, an archived
194
+ * card, and a session the host no longer reaches are refused.
195
+ */
196
+ followUp(taskId: string, text: string): Promise<void>;
134
197
  }
135
198
  /** Storage face for one extension's own payload on a task. */
136
199
  export interface TaskBoardIntegrationFace {
@@ -178,6 +241,12 @@ export interface TaskBoardEventFace {
178
241
  */
179
242
  export interface TaskBoardExtensionHost {
180
243
  tasks: TaskBoardTasksFace;
244
+ /**
245
+ * Delivery into a card's execution session. Optional in the contract on
246
+ * purpose: the API version stays 1, so a provider built against this revision
247
+ * probes the face and keeps working against a board that serves none.
248
+ */
249
+ sessions?: TaskBoardSessionsFace;
181
250
  integration: TaskBoardIntegrationFace;
182
251
  events: TaskBoardEventFace;
183
252
  /**
@@ -214,6 +283,15 @@ export interface TaskBoardClientMirror {
214
283
  }
215
284
  /** Whether a task should be shown on the board; false hides it. */
216
285
  export type TaskBoardVisibilityPredicate = (task: TaskRecord) => boolean;
286
+ /** Generic source bucket a provider assigns to one card. */
287
+ export interface TaskBoardSourceGroup {
288
+ /** Stable, provider-namespaced identity used for ordering and fold persistence. */
289
+ id: string;
290
+ /** Full human-readable source label, such as an owner/repository pair. */
291
+ label: string;
292
+ }
293
+ /** Return a card's source group, or undefined when this provider does not own it. */
294
+ export type TaskBoardGroupingSelector = (task: TaskRecord) => TaskBoardSourceGroup | undefined;
217
295
  /**
218
296
  * Client capability face the board's browser half provides. A provider's
219
297
  * browser half resolves it from the shared cordis service name; it never
@@ -224,6 +302,11 @@ export interface TaskBoardClientFace {
224
302
  dispatch(request: TaskBoardExtensionActionRequest): Promise<boolean>;
225
303
  /** Register one card visibility predicate; the returned disposer removes it. */
226
304
  registerVisibility(predicate: TaskBoardVisibilityPredicate): () => void;
305
+ /**
306
+ * Register one source-group selector; the first selector returning a group
307
+ * wins. Optional so an older board can serve the same API version.
308
+ */
309
+ registerGrouping?(selector: TaskBoardGroupingSelector): () => void;
227
310
  /** Subscribe to the board mirror. */
228
311
  subscribe(callback: (mirror: TaskBoardClientMirror) => void): () => void;
229
312
  /** Read the current board mirror. */
@@ -255,6 +338,39 @@ export interface TaskBoardHostFace {
255
338
  registerExtension(extension: TaskBoardExtension): () => void;
256
339
  /** Whether the board currently runs a given extension (board x extension). */
257
340
  isExtensionEnabled(extensionId: string): boolean;
341
+ /**
342
+ * The whole ledger as the board builds it, tasks included.
343
+ *
344
+ * Part of the read/write face an IN-PROCESS consumer drives the board through
345
+ * (the remote bridge plugin forwarding it to a paired phone); a browser half
346
+ * reads the same document over the board's own HTTP surface. Forwards
347
+ * {@link ../host-service.ts | TaskBoardHostService.snapshot}, so nothing is
348
+ * interpreted between the ledger and the caller.
349
+ */
350
+ snapshot(): TaskBoardSnapshot;
351
+ /**
352
+ * Apply one action through every gate the board already has — the running
353
+ * lock, the permission confirmation, the subtask depth, the schedule budget —
354
+ * and answer the resulting snapshot.
355
+ *
356
+ * The `requestId` is the ledger's own idempotency key, so a caller that
357
+ * retries one envelope does not apply it twice. Refusals are the ledger's:
358
+ * they throw with the Host's own text, which is why this face adds no code
359
+ * table of its own.
360
+ */
361
+ apply(requestId: string, action: TaskBoardAction, initiator?: string): TaskBoardSnapshot | Promise<TaskBoardSnapshot>;
362
+ /**
363
+ * Follow the board's change notifications. The listener receives no payload —
364
+ * a consumer that needs the state reads {@link snapshot} — and the returned
365
+ * disposer unsubscribes.
366
+ */
367
+ subscribe(listener: () => void): () => void;
368
+ /**
369
+ * The acceptance settings, the contract they resolve to right now, and the
370
+ * model catalog the choices come from. The same document the board's own
371
+ * `/verification` route serves.
372
+ */
373
+ verificationOptions(): Promise<TaskBoardVerificationOptions>;
258
374
  }
259
375
  declare module '@deepseek-ai/cordis' {
260
376
  interface Context {
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Run-launch admission width: the one bound on how many sessions this board
3
+ * starts at the same time.
4
+ *
5
+ * One board action opens a whole subtree, and a team run hands every member of
6
+ * it to the Lead at once, so without a bound the Host asks DSH for dozens of
7
+ * sessions in a single tick. The repository's own measured guidance caps heavy
8
+ * implementation subagents at three (docs/multi-agent-resources.md) and no
9
+ * runtime mechanism enforced it; this setting is that mechanism.
10
+ *
11
+ * The bounds and the default live here rather than in either half, exactly like
12
+ * the roster cadence: the settings card validates a draft against the same
13
+ * range the Host clamps a hand-edited configuration to, and a programmatic
14
+ * mount that names no width gets the default.
15
+ *
16
+ * @module dsh-task-board/core/launch-width
17
+ */
18
+ /** Width used when neither the settings document nor the mount names one. */
19
+ export declare const DEFAULT_RUN_LAUNCH_WIDTH = 3;
20
+ /** Narrowest accepted width: one launch at a time. */
21
+ export declare const RUN_LAUNCH_WIDTH_MIN = 1;
22
+ /** Widest accepted width. */
23
+ export declare const RUN_LAUNCH_WIDTH_MAX = 16;
24
+ /**
25
+ * Clamp a configured width into the supported range. A value the schema would
26
+ * refuse (non-finite, below the floor, above the ceiling) still leaves the
27
+ * board launching: an out-of-range setting never stalls a run.
28
+ * @param width - configured width, or undefined for the default.
29
+ * @returns the effective width.
30
+ */
31
+ export declare function normalizeRunLaunchWidth(width: number | undefined): number;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Which reasoning effort one execution may actually send.
3
+ *
4
+ * The rule lives here, in one pure place, so the launch path cannot drift from
5
+ * what the picker promises: an effort is sent ONLY for the exact model route
6
+ * whose adapter declares that id. An unsupported value is dropped rather than
7
+ * passed through — the Host validates the selection against the same
8
+ * capability (`resolveCallConfig` rejects an unsupported effort) and the whole
9
+ * model selection would fail with it. An absent effort stays absent: the SDK
10
+ * then materializes the model's own default, which is exactly what "inherit
11
+ * the model" means.
12
+ *
13
+ * A card that pins a bare model id also gets its provider resolved here: the
14
+ * session wire contract requires `provider` (ModelSelection), so the catalog is
15
+ * the only place that can complete the documented `provider/model` or model-id
16
+ * pin.
17
+ */
18
+ import type { CatalogModel, ModelCatalogView } from './verification.ts';
19
+ /** One execution route an effort resolves against: `provider/model`, or a bare model id. */
20
+ export interface ReasoningRoute {
21
+ provider?: string;
22
+ model: string;
23
+ }
24
+ /** The catalog entry a route names, once the catalog can complete it. */
25
+ export interface DeclaredReasoningRoute {
26
+ provider: string;
27
+ model: string;
28
+ /** The adapter's reasoning metadata; absent when it exposes none. */
29
+ reasoning?: CatalogModel['reasoning'];
30
+ }
31
+ /** What one card's effort resolves to for one route. */
32
+ export interface ReasoningEffortDecision {
33
+ /** The effort to send; absent means "send none". */
34
+ effort?: string;
35
+ /** The card's own value when it will NOT be sent. */
36
+ dropped?: string;
37
+ }
38
+ /** Trim one optional effort: blank text means "not set", like every other pinned target. */
39
+ export declare function normalizeReasoningEffort(value: string | undefined): string | undefined;
40
+ /**
41
+ * Complete one route through the host catalog: a qualified route must match its
42
+ * provider group, and a bare model id matches the first group carrying it —
43
+ * which is the provider the request then names.
44
+ * @param catalog - the host model catalog, when this deployment serves one.
45
+ * @param route - the route as the card pins it.
46
+ * @returns the completed route with its reasoning metadata, or undefined when
47
+ * the catalog declares no such model.
48
+ */
49
+ export declare function declaredRoute(catalog: ModelCatalogView | undefined, route: ReasoningRoute): DeclaredReasoningRoute | undefined;
50
+ /**
51
+ * Resolve the effort one execution sends.
52
+ * @param requested - the card's stored effort (absent or blank = inherit).
53
+ * @param catalog - the host model catalog, when this deployment serves one.
54
+ * @param route - the route the execution will actually run at.
55
+ * @returns the effort to send, or the dropped value that will not be sent.
56
+ */
57
+ export declare function resolveReasoningEffort(requested: string | undefined, catalog: ModelCatalogView | undefined, route: ReasoningRoute | undefined): ReasoningEffortDecision;
@@ -19,6 +19,12 @@ import type { TaskRecord } from './tasks.ts';
19
19
  * @param task - the task about to run.
20
20
  * @param idleSessionIds - ids the last roster saw as present and not running;
21
21
  * undefined when that roster is unknown.
22
+ * @param options.force - continue the settled session regardless of the card's
23
+ * own `reuseSession` opt-in. A rework is exactly that case: the reviewer read
24
+ * the previous run's session and sent it back. Every condition above still
25
+ * applies — the force waives the opt-in, never the evidence.
22
26
  * @returns the session id to continue in, or undefined for a fresh session.
23
27
  */
24
- export declare function reusableSessionId(task: TaskRecord, idleSessionIds: ReadonlySet<string> | undefined): string | undefined;
28
+ export declare function reusableSessionId(task: TaskRecord, idleSessionIds: ReadonlySet<string> | undefined, options?: {
29
+ force?: boolean;
30
+ }): string | undefined;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The daily token ceiling both spend gates share, as pure rules: the cap
3
+ * comparison and the one refusal wording.
4
+ *
5
+ * The unit is tokens, not money. The usage ledger the board reads prices only
6
+ * DeepSeek's own routes, so a cost cap would read 0 on every other route and
7
+ * refuse nothing on exactly the deployments that need it. A cap of 0 is the
8
+ * shipped default and means "no gate": both gates answer before they read a
9
+ * file, subscribe to an event, or compute anything.
10
+ * @module @fish-under-sea/dsh-client-ui-task-board-fish/core/spend-budget
11
+ */
12
+ /** Token cap one board day may spend; 0 disables the gate. */
13
+ export declare const DEFAULT_SPEND_BUDGET_TOKENS = 0;
14
+ /**
15
+ * Whether a day's measured spend already reached the cap.
16
+ * @param usedTokens - tokens the day's spend measurement reported.
17
+ * @param cap - the configured cap, 0 for "no gate".
18
+ * @returns true when a run must be refused.
19
+ */
20
+ export declare function spendCapReached(usedTokens: number, cap: number): boolean;
21
+ /**
22
+ * The refusal text both gates report: the thrown message a client sees as
23
+ * board-refused, and the scheduler error a due occurrence records.
24
+ * @param usedTokens - tokens the day's spend measurement reported.
25
+ * @param cap - the configured cap.
26
+ * @returns the refusal message.
27
+ */
28
+ export declare function spendCapMessage(usedTokens: number, cap: number): string;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Subtask lineage: the depth gate, the ancestry/descendant queries, the
3
- * cascade participant set one run request opens, the deferred settlement of a
4
- * cascade parent, and the execution-target inheritance a subtask resolves at
5
- * run time.
3
+ * outstanding-descendant decision one run request makes, the deferred
4
+ * settlement of a historical run group, and the execution-target inheritance a
5
+ * subtask resolves at run time.
6
6
  *
7
7
  * Framework-free (no cordis, no runtime imports) so every rule is
8
8
  * unit-testable in isolation. The Host ledger is the only authority; the
@@ -75,13 +75,92 @@ export interface ParentLinkCheck {
75
75
  */
76
76
  export declare function checkParentLink(tasks: readonly TaskRecord[], childId: string, parentId: string | null, maxSubtaskDepth: number, lineage?: LineageIndex): ParentLinkCheck;
77
77
  /**
78
- * The tasks one run request opens executions for: the requested task first,
79
- * then its on-board descendants within the configured depth. Archived tasks
80
- * never run; a participant that already has an open execution is skipped by
81
- * the caller, which cannot start it twice.
78
+ * The tasks one run request opens executions for: the requested card ALONE.
79
+ *
80
+ * Running a card never expands into its subtask tree. The card's own session
81
+ * reads its subtasks through the board tools and dispatches subagents itself,
82
+ * so a parent run opens exactly one session. Clicking a subtask runs that
83
+ * subtask as its own root, again without expanding its own descendants. The
84
+ * lineage queries around this one answer questions about the tree the card's
85
+ * agent works with (who is still outstanding, what a historical run group
86
+ * still holds open) — never who gets a session from the Host.
87
+ * @param tasks - the ledger.
88
+ * @param rootId - the task the run request named.
89
+ * @returns the one card this run opens an execution for, or [] when unknown.
90
+ */
91
+ export declare function cascadeTargets(tasks: readonly TaskRecord[], rootId: string): TaskRecord[];
92
+ /**
93
+ * A task together with every descendant within the configured depth: the
94
+ * subtree a lineage gate (archive, restore, force-close) has to walk.
95
+ */
96
+ export declare function subtreeTasks(tasks: readonly TaskRecord[], id: string, maxSubtaskDepth: number): TaskRecord[];
97
+ /**
98
+ * Whether a card still has work outstanding: anything outside the `done`
99
+ * column. It keys on the column alone, so it covers both a subtask that ran
100
+ * and one an operator moved to done by hand.
101
+ */
102
+ export declare function isOutstanding(task: TaskRecord): boolean;
103
+ /**
104
+ * The descendants of a card that still have work outstanding, in breadth-first
105
+ * order: the cards its own session is expected to dispatch. An archived
106
+ * descendant is off the board and cannot be dispatched, so it is not listed.
107
+ */
108
+ export declare function outstandingDescendants(tasks: readonly TaskRecord[], rootId: string, maxSubtaskDepth: number): TaskRecord[];
109
+ /**
110
+ * Whether any descendant of this card still sits outside the `done` column.
111
+ * This is the ONE decision behind both the forced agent preset and the dispatch
112
+ * section of the execution prompt: a card whose tree still holds work runs as
113
+ * the autonomous dispatcher.
114
+ */
115
+ export declare function hasOutstandingDescendants(tasks: readonly TaskRecord[], rootId: string, maxSubtaskDepth: number): boolean;
116
+ /**
117
+ * Agent preset a run with unfinished subtasks is forced under. The id comes
118
+ * from packages/dsh-liangshen (its own `LIANGSHEN_PRESET_ID`); the force is
119
+ * applied at launch and never written into a card's `mode` field.
82
120
  */
83
- export declare function cascadeTargets(tasks: readonly TaskRecord[], rootId: string, maxSubtaskDepth: number): TaskRecord[];
84
- /** One still-open execution belonging to a cascade run group. */
121
+ export declare const LIANGSHEN_PRESET_ID = "liangshen";
122
+ /**
123
+ * The tool a legacy Agent Teams runtime registers, and the one fingerprint
124
+ * this board reads off a deployment: the pre-#7519 generation registers
125
+ * `spawn_teammate` and replaces `send_message` / `list_agents` /
126
+ * `interrupt_agent` with team-scoped variants, so children exist but are
127
+ * unreachable. The current runtime adds a shared task board instead and reuses
128
+ * the coordination tools, so those three names prove nothing and are never
129
+ * gated on (the criterion is the same one
130
+ * `packages/dsh-liangshen/presets/liangshen/dispatcher-rules.mjs` states).
131
+ */
132
+ export declare const LEGACY_AGENT_TEAMS_TOOL = "spawn_teammate";
133
+ /**
134
+ * The failure text the Host records when a run would have been forced under
135
+ * the dispatcher preset on a deployment that cannot orchestrate.
136
+ *
137
+ * A finished sentence rather than a code (the shape `core/workspace-target.ts`
138
+ * gives its missing-workspace refusal): the ledger stores it as the
139
+ * execution's failure text, the agent tools serve it to a model, and any
140
+ * client prints it verbatim. It names the fix, not the mechanism. The launch
141
+ * is refused before any session exists, because the dispatcher preset would
142
+ * otherwise stop and wait for a human reply that an unattended run never
143
+ * brings.
144
+ */
145
+ export declare const LEGACY_AGENT_TEAMS_REASON: string;
146
+ /**
147
+ * Whether a recorded failure text is the legacy-runtime refusal, which the
148
+ * browser half renders in the reader's own language.
149
+ * @param reason - the execution's recorded failure text.
150
+ * @returns true when that run was refused for a deployment that cannot orchestrate.
151
+ */
152
+ export declare function isLegacyAgentTeamsReason(reason: string): boolean;
153
+ /**
154
+ * Whether a card belongs to a run's dispatch set: the card the request named,
155
+ * or a card whose work is still outstanding. Kept for the browser's subtask
156
+ * preview; the Host run itself opens the clicked card alone
157
+ * ({@link cascadeTargets}).
158
+ * @param task - the candidate card.
159
+ * @param rootId - the task the run request named.
160
+ * @returns false when this card is finished and left alone.
161
+ */
162
+ export declare function joinsCascadeRun(task: TaskRecord, rootId: string): boolean;
163
+ /** One still-open execution belonging to a stored run group. */
85
164
  export interface OpenCascadeChild {
86
165
  taskId: string;
87
166
  execution: ExecutionRecord;
@@ -90,14 +169,15 @@ export interface OpenCascadeChild {
90
169
  export declare function openGroupExecution(task: TaskRecord, runGroupId: string): ExecutionRecord | undefined;
91
170
  /**
92
171
  * The direct subtasks of parentTaskId whose execution in this run group is
93
- * still open: the parent remaining waiters. The parent may settle once this
94
- * list is empty and its own outcome is known.
172
+ * still open: the parent's remaining waiters. A stored multi-member group (a
173
+ * run the Host opened before it stopped spreading one run across a subtree)
174
+ * folds once this list is empty and the parent's own outcome is known.
95
175
  */
96
176
  export declare function pendingCascadeChildren(tasks: readonly TaskRecord[], parentTaskId: string, runGroupId: string): OpenCascadeChild[];
97
177
  /**
98
- * Fold a cascade parent own outcome and its children outcomes into one
99
- * verdict: failure dominates, then cancellation, then success. The error text
100
- * is the first failure, falling back to the first cancellation.
178
+ * Fold a stored run-group parent's own outcome and its children's outcomes into
179
+ * one verdict: failure dominates, then cancellation, then success. The error
180
+ * text is the first failure, falling back to the first cancellation.
101
181
  */
102
182
  export declare function combineCascadeOutcome(entries: readonly {
103
183
  result: ExecutionOutcome;
@@ -114,28 +194,11 @@ export declare function effectiveTaskPermission(task: TaskRecord): TaskRecord['p
114
194
  /**
115
195
  * Resolve the execution targets a (sub)task actually runs with: its own value
116
196
  * wins, and an unset target inherits the nearest ancestor up to the root.
117
- * Workspace, agent preset and model inherit the ancestor's PIN only — a
118
- * handover bundle is a per-card continuation artefact and is never inherited.
119
- * The permission inherits the ancestor's EFFECTIVE binding, and its human
120
- * confirmation travels with it, so a subtask of an already-confirmed elevated
121
- * card is runnable while a subtask's own unconfirmed binding stays gated.
197
+ * Workspace, agent preset, model and reasoning effort inherit the ancestor's
198
+ * PIN only — a handover bundle is a per-card continuation artefact and is never
199
+ * inherited. The permission inherits the ancestor's EFFECTIVE binding, and its
200
+ * human confirmation travels with it, so a subtask of an already-confirmed
201
+ * elevated card is runnable while a subtask's own unconfirmed binding stays
202
+ * gated.
122
203
  */
123
- /**
124
- * The immutable teammate name for one team-mode member. Teammate names are
125
- * lower-kebab-case and must stay unique for the lifetime of the Team: the
126
- * run-group token separates two runs of the same tree, and the member
127
- * discriminator separates two members of one run that reduce to the same slug.
128
- *
129
- * The discriminator is not cosmetic. A title with no ASCII word characters (a
130
- * CJK title, for example) carries no slug at all, so every such title of one
131
- * run group collides on the generic prefix; Agent Teams answers every member
132
- * after the first with `teammate name "..." was already used in this Team`,
133
- * and those subtasks never start. Two ASCII titles that share a slug
134
- * (`AI 强度预测` next to `AI 配比优化`) collide the same way.
135
- * @param title - the member task's title.
136
- * @param token - the run group id (the task id when no group is recorded).
137
- * @param memberId - the member task's id, which makes the name unique in the run.
138
- * @returns the teammate name handed to the Agent Teams service.
139
- */
140
- export declare function teammateName(title: string, token: string, memberId?: string): string;
141
204
  export declare function resolveExecutionTargets(task: TaskRecord, tasks: readonly TaskRecord[], maxSubtaskDepth?: number): TaskRecord;
@@ -8,10 +8,45 @@ import type { FreezeSnapshot } from './freeze-snapshot.ts';
8
8
  import type { ExecutionVerification } from './verification.ts';
9
9
  import type { TaskHandover, TaskHandoverInput } from './handover.ts';
10
10
  import { type TaskBoardExtensionPayload } from './extension.ts';
11
+ import { type TaskAttachment } from './attachment.ts';
11
12
  /** Task lifecycle status, one per kanban column. */
12
13
  export type TaskStatus = 'backlog' | 'todo' | 'running' | 'done' | 'failed';
13
14
  /** Settled outcome of one execution attempt. */
14
15
  export type ExecutionOutcome = 'succeeded' | 'failed' | 'cancelled';
16
+ /**
17
+ * What one execution left behind: the text of the run's last assistant message
18
+ * and the session event it was read from.
19
+ *
20
+ * The board records a verdict per execution but no output, so a parent card
21
+ * could see that a subtask succeeded without seeing what it produced. Card
22
+ * content cannot answer that (it is the plan and freezes at the first
23
+ * execution), so the closing text rides the execution record instead.
24
+ */
25
+ export interface ExecutionSummary {
26
+ /** Last assistant message text of the run, bounded by {@link EXECUTION_SUMMARY_LIMIT}. */
27
+ text: string;
28
+ /** Seq of the session event that text came from; absent text has no seq either. */
29
+ seq: number;
30
+ }
31
+ /**
32
+ * Upper bound of one recorded summary, in characters. The ledger stores a
33
+ * conclusion, not a transcript: a reader that needs the whole message follows
34
+ * {@link ExecutionSummary.seq} into the session history.
35
+ */
36
+ export declare const EXECUTION_SUMMARY_LIMIT = 4000;
37
+ /**
38
+ * Rework input recorded on the execution it opened: the reviewer's instructions
39
+ * for redoing work in the card's own session.
40
+ */
41
+ export interface ExecutionRework {
42
+ /** The rework instructions this run was given, as the reviewer wrote them. */
43
+ instructions: string;
44
+ }
45
+ /**
46
+ * Repair a persisted rework block: only a non-blank instruction string
47
+ * survives, so a hand-edited ledger loses the block instead of the execution.
48
+ */
49
+ export declare function normalizeExecutionRework(value: unknown): ExecutionRework | undefined;
15
50
  /**
16
51
  * One real execution attempt: the run's own id, the dsh session that ran it
17
52
  * (filled once the session is created), and the settled outcome once the
@@ -51,6 +86,13 @@ export interface ExecutionRecord {
51
86
  * `sessionId` and never claims a verdict the Host observed.
52
87
  */
53
88
  external?: boolean;
89
+ /**
90
+ * Rework instructions this execution carries as extra input: a reviewer sent
91
+ * the previous run back, so the card re-ran in the same session with these
92
+ * instructions instead of having its frozen content rewritten. Absent on
93
+ * every ordinary run.
94
+ */
95
+ rework?: ExecutionRework;
54
96
  /** Freeze instant captured from the card snapshot when the run opened. */
55
97
  frozenAt?: number;
56
98
  /** Freeze source session captured from the card snapshot when the run opened. */
@@ -69,6 +111,16 @@ export interface ExecutionRecord {
69
111
  ownResult?: ExecutionOutcome;
70
112
  /** Human failure text that arrived with {@link ownResult}. */
71
113
  ownError?: string;
114
+ /**
115
+ * What this run left behind: the text of its last assistant message, taken
116
+ * when the settlement read the session and recorded with the verdict.
117
+ *
118
+ * Absent — never an empty string — when the session could not be read or
119
+ * carried no assistant prose, so "recorded nothing" stays distinguishable
120
+ * from "produced nothing". Settling never fails over it: a summary is
121
+ * informational, and every field above is what the board decides with.
122
+ */
123
+ summary?: ExecutionSummary;
72
124
  /**
73
125
  * Goal acceptance state of this execution (task-board goal verification).
74
126
  * Fixed when the execution starts and never rewritten from later settings:
@@ -325,6 +377,15 @@ export interface TaskRecord {
325
377
  * absent falls back to the host default (agent-default-model).
326
378
  */
327
379
  model?: string;
380
+ /**
381
+ * Reasoning effort pinned for that execution route (an adapter-owned id such
382
+ * as "high"). Absent (or blank) means INHERIT: the session runs at the
383
+ * model's own default level, exactly as a card written before the field
384
+ * existed does. The launch sends the value only when the target model's
385
+ * adapter declares that exact id, so switching a card to a model without
386
+ * that level never pushes an invalid selection (see core/reasoning-effort.ts).
387
+ */
388
+ reasoningEffort?: string;
328
389
  /**
329
390
  * Whether later executions continue in the previous execution's session
330
391
  * (issue #1419) instead of minting a fresh conversation per run. Absent or
@@ -334,12 +395,11 @@ export interface TaskRecord {
334
395
  */
335
396
  reuseSession?: boolean;
336
397
  /**
337
- * Run this task's subtree as an Agent Team instead of one Host-launched
338
- * session per participant: the root becomes the Team Lead session and the
339
- * Host spawns one teammate for each direct subtask inside it. Absent or false
340
- * keeps the plain concurrent cascade. A deployment that does not serve the
341
- * Agent Teams service refuses a team run instead of silently falling back,
342
- * and a subtask's own permission pin cannot be honored in this mode.
398
+ * Historical Agent Team opt-in. New runs never write it and the Host never
399
+ * reads it to decide how to run: a run with unfinished subtasks opens one
400
+ * session whose own agent dispatches subagents. The field is kept so cards
401
+ * already on disk keep their record, and so the ledger can still fold a team
402
+ * run group it opened before this behavior changed.
343
403
  */
344
404
  teamRun?: boolean;
345
405
  /**
@@ -413,6 +473,14 @@ export interface TaskRecord {
413
473
  * absent means on-board.
414
474
  */
415
475
  hidden?: boolean;
476
+ /**
477
+ * Files and images the card carries (issue #1979). Metadata only: the bytes
478
+ * live in the official attachment storage, and this record names the stored
479
+ * object, its size and the digest of the exact bytes the Host verified
480
+ * there. Additive and absent on every card written before the field
481
+ * existed, so an old card keeps running exactly as it did.
482
+ */
483
+ attachments?: TaskAttachment[];
416
484
  }
417
485
  /**
418
486
  * Statuses a task may be archived from: every status but `running`, whose
@@ -446,10 +514,18 @@ export interface NewTaskInput {
446
514
  permission?: TaskPermission;
447
515
  /** Optional pinned model for the execution session; absent = host default. */
448
516
  model?: string;
517
+ /** Optional reasoning effort for that model route; empty/absent = the model's own default. */
518
+ reasoningEffort?: string;
519
+ /**
520
+ * Opt in to the deployment's new-card defaults: a target this input leaves
521
+ * out is filled from the configured default (agent preset, permission, model
522
+ * and the level bound to that model). Absent means the create stores exactly
523
+ * what it was given, which is what the extension provider's own create path
524
+ * and the legacy import rely on.
525
+ */
526
+ applyCardDefaults?: boolean;
449
527
  /** Reuse the previous execution's session for later runs (issue #1419). */
450
528
  reuseSession?: boolean;
451
- /** Run the subtree as an Agent Team (Team Lead session plus one teammate per direct subtask). */
452
- teamRun?: boolean;
453
529
  /**
454
530
  * Start the execution with dsh's built-in `/goal`. Absent means the default
455
531
  * (one plain turn); only an explicit true joins the goal run.
@@ -501,6 +577,12 @@ export interface NewTaskInput {
501
577
  status?: TaskStatus;
502
578
  /** Create the card off-board (held in the ledger, never rendered). */
503
579
  hidden?: boolean;
580
+ /**
581
+ * Files and images the new card carries (issue #1979). The metadata is
582
+ * host-verified against the official attachment storage before it reaches
583
+ * the ledger, so a create never records a claim the storage cannot prove.
584
+ */
585
+ attachments?: TaskAttachment[];
504
586
  }
505
587
  /** The five kanban columns, in display order. */
506
588
  export declare const COLUMNS: readonly {
@@ -576,8 +658,10 @@ export declare function withSchedule(task: TaskRecord, patch: Partial<ScheduleRu
576
658
  * running execution record. Returns the new task and the new execution.
577
659
  * @param runGroupId - cascade run group, when this run also opened executions
578
660
  * for the task's subtasks (see `core/subtask.ts`).
661
+ * @param rework - the reviewer's instructions, when this run is a rework of the
662
+ * card's previous work; recorded on the execution it opens.
579
663
  */
580
- export declare function startExecution(task: TaskRecord, now: number, executionId: string, initiatedBy?: string, runGroupId?: string): {
664
+ export declare function startExecution(task: TaskRecord, now: number, executionId: string, initiatedBy?: string, runGroupId?: string, rework?: ExecutionRework): {
581
665
  task: TaskRecord;
582
666
  execution: ExecutionRecord;
583
667
  };
@@ -596,6 +680,6 @@ export declare function settledStatus(task: TaskRecord, outcome: ExecutionOutcom
596
680
  * matching column. No-op (returns the input task) when the execution is not
597
681
  * the task's latest or is already settled.
598
682
  */
599
- export declare function settleExecution(task: TaskRecord, executionId: string, outcome: ExecutionOutcome, now: number, error: string | undefined): TaskRecord;
683
+ export declare function settleExecution(task: TaskRecord, executionId: string, outcome: ExecutionOutcome, now: number, error: string | undefined, summary?: ExecutionSummary): TaskRecord;
600
684
  /** A settled-execution summary string for the detail view. */
601
685
  export declare function executionLabel(execution: ExecutionRecord): string;