@fish-under-sea/dsh-client-ui-task-board-fish 2.2.3 → 2.3.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 (104) hide show
  1. package/README.en.md +4 -4
  2. package/package.json +1 -1
  3. package/README.i18n.yaml +0 -6
  4. package/README.md +0 -31
  5. package/README.zh.md +0 -31
  6. package/lib/client.js +0 -15861
  7. package/lib/client.js.map +0 -1
  8. package/lib/index.js +0 -12653
  9. package/lib/types/client/CardDefaultPresetField.d.ts +0 -35
  10. package/lib/types/client/PluginSettingsCard.d.ts +0 -255
  11. package/lib/types/client/RangeBubble.d.ts +0 -46
  12. package/lib/types/client/SegmentGroup.d.ts +0 -28
  13. package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -155
  14. package/lib/types/client/apply-guard.d.ts +0 -25
  15. package/lib/types/client/board/AttachmentField.d.ts +0 -70
  16. package/lib/types/client/board/ClampedMarkdown.d.ts +0 -3
  17. package/lib/types/client/board/ConfirmDialog.d.ts +0 -15
  18. package/lib/types/client/board/EditTaskModal.d.ts +0 -17
  19. package/lib/types/client/board/ExecutionLog.d.ts +0 -24
  20. package/lib/types/client/board/LinkSubtaskModal.d.ts +0 -14
  21. package/lib/types/client/board/NewTaskModal.d.ts +0 -26
  22. package/lib/types/client/board/ReasoningEffortField.d.ts +0 -25
  23. package/lib/types/client/board/TagManagerModal.d.ts +0 -26
  24. package/lib/types/client/board/TaskBoard.d.ts +0 -26
  25. package/lib/types/client/board/TaskCard.d.ts +0 -36
  26. package/lib/types/client/board/TaskDetail.d.ts +0 -9
  27. package/lib/types/client/board/TaskForm.d.ts +0 -76
  28. package/lib/types/client/board/VerificationReport.d.ts +0 -10
  29. package/lib/types/client/board/card-view.d.ts +0 -113
  30. package/lib/types/client/board/icons.d.ts +0 -32
  31. package/lib/types/client/board/model-options.d.ts +0 -87
  32. package/lib/types/client/board/overlay.d.ts +0 -69
  33. package/lib/types/client/board/parse-model-pref.d.ts +0 -4
  34. package/lib/types/client/board/preset-label.d.ts +0 -43
  35. package/lib/types/client/board/preset-roster.d.ts +0 -45
  36. package/lib/types/client/board/source-group.d.ts +0 -27
  37. package/lib/types/client/board/status-key.d.ts +0 -19
  38. package/lib/types/client/board/task-markdown.d.ts +0 -19
  39. package/lib/types/client/body-mutations.d.ts +0 -45
  40. package/lib/types/client/host-api.d.ts +0 -88
  41. package/lib/types/client/index.d.ts +0 -128
  42. package/lib/types/client/locales.d.ts +0 -521
  43. package/lib/types/client/main-session.d.ts +0 -32
  44. package/lib/types/client/native-panel.d.ts +0 -48
  45. package/lib/types/client/pending-verify.d.ts +0 -47
  46. package/lib/types/client/plugin-card-seat.d.ts +0 -110
  47. package/lib/types/client/schedule-presets.d.ts +0 -10
  48. package/lib/types/client/schedule-zone.d.ts +0 -97
  49. package/lib/types/client/seats.d.ts +0 -18
  50. package/lib/types/client/service.d.ts +0 -35
  51. package/lib/types/client/settings-entry-form.d.ts +0 -49
  52. package/lib/types/client/settings-form.d.ts +0 -235
  53. package/lib/types/core/attachment.d.ts +0 -132
  54. package/lib/types/core/card-defaults.d.ts +0 -78
  55. package/lib/types/core/controller.d.ts +0 -422
  56. package/lib/types/core/degraded-reason.d.ts +0 -46
  57. package/lib/types/core/execution-summary.d.ts +0 -52
  58. package/lib/types/core/extension.d.ts +0 -399
  59. package/lib/types/core/freeze-snapshot.d.ts +0 -71
  60. package/lib/types/core/handover.d.ts +0 -70
  61. package/lib/types/core/issue-form.d.ts +0 -16
  62. package/lib/types/core/launch-width.d.ts +0 -31
  63. package/lib/types/core/package-name.d.ts +0 -9
  64. package/lib/types/core/poll-cadence.d.ts +0 -31
  65. package/lib/types/core/reasoning-effort.d.ts +0 -57
  66. package/lib/types/core/schedule.d.ts +0 -124
  67. package/lib/types/core/session-reuse.d.ts +0 -30
  68. package/lib/types/core/spend-budget.d.ts +0 -28
  69. package/lib/types/core/store.d.ts +0 -64
  70. package/lib/types/core/subtask.d.ts +0 -204
  71. package/lib/types/core/tasks.d.ts +0 -685
  72. package/lib/types/core/use-cases/task-archive.d.ts +0 -20
  73. package/lib/types/core/use-cases/task-create.d.ts +0 -32
  74. package/lib/types/core/use-cases/task-delete.d.ts +0 -27
  75. package/lib/types/core/use-cases/task-parent.d.ts +0 -21
  76. package/lib/types/core/use-cases/task-schedule.d.ts +0 -96
  77. package/lib/types/core/use-cases/task-tag.d.ts +0 -84
  78. package/lib/types/core/use-cases/task-update.d.ts +0 -77
  79. package/lib/types/core/verification-budget.d.ts +0 -52
  80. package/lib/types/core/verification.d.ts +0 -753
  81. package/lib/types/core/wire-projection.d.ts +0 -35
  82. package/lib/types/core/workspace-target.d.ts +0 -61
  83. package/lib/types/dsh-home.d.ts +0 -16
  84. package/lib/types/host/agent-tools.d.ts +0 -27
  85. package/lib/types/host/attachments.d.ts +0 -250
  86. package/lib/types/host/extension-registry.d.ts +0 -151
  87. package/lib/types/host/launch-admission.d.ts +0 -71
  88. package/lib/types/host/llm-dispatch.d.ts +0 -63
  89. package/lib/types/host/verification-gate.d.ts +0 -95
  90. package/lib/types/host/verification-runner.d.ts +0 -139
  91. package/lib/types/host/workspace-evidence.d.ts +0 -53
  92. package/lib/types/host-ai.d.ts +0 -51
  93. package/lib/types/host-ledger.d.ts +0 -452
  94. package/lib/types/host-routes.d.ts +0 -99
  95. package/lib/types/host-runner.d.ts +0 -401
  96. package/lib/types/host-service.d.ts +0 -517
  97. package/lib/types/host-spend.d.ts +0 -52
  98. package/lib/types/http.d.ts +0 -59
  99. package/lib/types/index.d.ts +0 -441
  100. package/lib/types/loopback.d.ts +0 -64
  101. package/lib/types/mount-once.d.ts +0 -55
  102. package/lib/types/power-inhibitor.d.ts +0 -73
  103. package/lib/types/protocol.d.ts +0 -253
  104. package/lib/types/tool-surface.d.ts +0 -72
@@ -1,685 +0,0 @@
1
- /**
2
- * Task board domain model: task lifecycle statuses, the task record shape,
3
- * and the pure transition functions the controller and tests share.
4
- * Framework-free (no cordis, no runtime imports) so the state machine is
5
- * unit-testable in isolation.
6
- */
7
- import type { FreezeSnapshot } from './freeze-snapshot.ts';
8
- import type { ExecutionVerification } from './verification.ts';
9
- import type { TaskHandover, TaskHandoverInput } from './handover.ts';
10
- import { type TaskBoardExtensionPayload } from './extension.ts';
11
- import { type TaskAttachment } from './attachment.ts';
12
- /** Task lifecycle status, one per kanban column. */
13
- export type TaskStatus = 'backlog' | 'todo' | 'running' | 'done' | 'failed';
14
- /** Settled outcome of one execution attempt. */
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;
50
- /**
51
- * One real execution attempt: the run's own id, the dsh session that ran it
52
- * (filled once the session is created), and the settled outcome once the
53
- * session's turn ended.
54
- */
55
- export interface ExecutionRecord {
56
- /** Execution attempt id (uuid). */
57
- id: string;
58
- /** The dsh session that ran this attempt; absent until creation resolves. */
59
- sessionId: string | undefined;
60
- /** When the run started (ms epoch). */
61
- startedAt: number;
62
- /** When the run settled; absent while still running. */
63
- endedAt: number | undefined;
64
- /** Outcome once settled. */
65
- result: ExecutionOutcome | undefined;
66
- /** Human failure text when the run failed (prompt rejection or agent error). */
67
- error: string | undefined;
68
- /**
69
- * Session id of the DSH session that issued the run/rerun action (issue #6
70
- * audit origin). Client-asserted, not a trust boundary; absent when the run
71
- * was triggered by cron (source unknown).
72
- *
73
- * On an EXTERNAL record (issue #1826) this names the agent that completed the
74
- * work outside the Host instead, which is what makes the history readable.
75
- */
76
- initiatedBy?: string;
77
- /**
78
- * True when this outcome was recorded from outside the Host by
79
- * `record-external-outcome` rather than observed from a DSH session
80
- * (issue #1826).
81
- *
82
- * The board never manufactures one of these itself: every Host-side path
83
- * (`run`, `settle`, cascade folding, restart recovery) writes an execution
84
- * without it, so `external` is the single field separating work this Host ran
85
- * from work an outside agent reported. Such a record never carries a
86
- * `sessionId` and never claims a verdict the Host observed.
87
- */
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;
96
- /** Freeze instant captured from the card snapshot when the run opened. */
97
- frozenAt?: number;
98
- /** Freeze source session captured from the card snapshot when the run opened. */
99
- frozenBy?: string;
100
- /**
101
- * Cascade run group shared by the parent execution and every descendant
102
- * execution one run request opened. Absent on a plain single-task run.
103
- */
104
- runGroupId?: string;
105
- /**
106
- * A cascade parent's own session outcome, recorded as soon as its own turn
107
- * settles and held while its subtask executions finish. The execution stays
108
- * open (no `endedAt`) until the last child settles; the Host monitor skips
109
- * an execution whose own outcome is already recorded.
110
- */
111
- ownResult?: ExecutionOutcome;
112
- /** Human failure text that arrived with {@link ownResult}. */
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;
124
- /**
125
- * Goal acceptance state of this execution (task-board goal verification).
126
- * Fixed when the execution starts and never rewritten from later settings:
127
- * the contract is frozen here, the attempts accrue here, and the settlement
128
- * rule reads the pass record here. Absent on an execution that started
129
- * before the feature existed, which keeps it on the historical verdict.
130
- */
131
- verification?: ExecutionVerification;
132
- }
133
- /**
134
- * Maximum number of execution records retained per task. Older settled runs
135
- * are trimmed when a new execution starts so per-action ledger cost stays
136
- * bounded regardless of how often a task ran before.
137
- */
138
- export declare const EXECUTION_HISTORY_LIMIT = 20;
139
- /**
140
- * Trim an execution list to at most {@link EXECUTION_HISTORY_LIMIT} records,
141
- * most recent last. A running (unsettled) execution is never trimmed: the
142
- * Host monitor and restart recovery depend on the active record, and a task
143
- * cannot start a new run while one is still open.
144
- */
145
- export declare function retainRecentExecutions(executions: readonly ExecutionRecord[]): ExecutionRecord[];
146
- /**
147
- * How a rule produces its triggers: a recurring cron rule, or one single
148
- * planned instant. The distinction is stored rather than inferred so a
149
- * one-shot is never represented as a date-restricted cron expression.
150
- */
151
- export type ScheduleMode = 'cron' | 'once';
152
- /**
153
- * Why a due occurrence produced no run, or why a rule stopped on its own.
154
- *
155
- * These are stable codes, not display text: the board renders them through its
156
- * locale dictionary, so the ledger never carries a translated string.
157
- */
158
- export type ScheduleStopReason =
159
- /** The single planned instant produced its run. */
160
- 'fired'
161
- /** The recurring rule reached its run budget. */
162
- | 'limit'
163
- /** The plan has no reachable instant any more (an impossible cron). */
164
- | 'no-target'
165
- /** The instant passed while the board was not running through it. */
166
- | 'missed'
167
- /** The task already had an open execution, so this occurrence was skipped. */
168
- | 'busy'
169
- /** An above-default permission was still unconfirmed, so this occurrence was skipped. */
170
- | 'permission'
171
- /**
172
- * A scheduled launch failed before any session existed, so the occurrence
173
- * created no execution and its run was refunded rather than spent.
174
- */
175
- | 'launch-failed';
176
- /** Every stop reason this build understands; the repair and wire gates share it. */
177
- export declare const SCHEDULE_STOP_REASONS: readonly ScheduleStopReason[];
178
- /**
179
- * A scheduled-run rule attached to a task. The Host scheduler triggers the
180
- * task when `nextRunAt` is due and persists the rule in the Host ledger.
181
- *
182
- * A rule is either `cron` (the historical shape: a 5-field expression with an
183
- * explicit IANA zone, optionally capped by `maxRuns`) or `once` (one planned
184
- * instant, `at`, with an implicit budget of one run). Both modes count the
185
- * executions the scheduler actually started in `runCount`; a rule that reaches
186
- * its budget stops itself in the ledger (`enabled: false` + `endedReason`)
187
- * instead of relying on the execution agent to disable it.
188
- */
189
- export interface ScheduleRule {
190
- /** Whether the schedule is armed. */
191
- enabled: boolean;
192
- /**
193
- * Which kind of plan this rule carries. A rule loaded from a ledger written
194
- * before the field existed normalizes to `cron` (its `cron` is the plan).
195
- */
196
- mode: ScheduleMode;
197
- /**
198
- * 5-field cron expression: `分 时 日 月 周`. Present on a `cron` rule and
199
- * absent on a `once` rule.
200
- */
201
- cron?: string;
202
- /**
203
- * The instant a `once` rule executes (ms epoch). Kept after the run so the
204
- * detail view can still show the planned time once the rule has ended.
205
- */
206
- at?: number;
207
- /**
208
- * IANA zone the wall clock is read in (issue #1722). Absent means the
209
- * Host process zone, which is what a rule written before zones were
210
- * persisted keeps using; the Host stamps its own zone at ledger migration so
211
- * a later `TZ` change cannot silently move an existing rule.
212
- */
213
- timeZone?: string;
214
- /** Next due instant (ms epoch); maintained by the scheduler/controller. */
215
- nextRunAt: number | undefined;
216
- /** Instant of the latest scheduled trigger (ms epoch). */
217
- lastTriggeredAt: number | undefined;
218
- /**
219
- * Scheduled executions the Host has created under this rule. This is the
220
- * run budget's counter: it counts executions that were successfully opened
221
- * (whatever their later outcome), never completions, and a manual run never
222
- * touches it. A skipped occurrence (busy / permission / missed / no target)
223
- * creates no execution and therefore consumes nothing.
224
- */
225
- runCount: number;
226
- /**
227
- * Maximum scheduled executions for a `cron` rule; absent means unlimited
228
- * (the historical behavior). A `once` rule has an implicit budget of one and
229
- * stores no `maxRuns`.
230
- */
231
- maxRuns?: number;
232
- /** Instant the rule stopped itself (ms epoch); absent while it may still fire. */
233
- endedAt?: number;
234
- /** Why the rule stopped itself; present with `endedAt`. */
235
- endedReason?: ScheduleStopReason;
236
- /** Instant of the latest occurrence that produced no run. */
237
- skippedAt?: number;
238
- /** Why that occurrence produced no run; present with `skippedAt`. */
239
- skippedReason?: ScheduleStopReason;
240
- }
241
- /**
242
- * The rule's total run budget: one for a one-shot, the stored cap for a
243
- * recurring rule, and undefined when the rule is unlimited.
244
- * @param rule - the schedule rule.
245
- * @returns the budget, or undefined for an uncapped rule.
246
- */
247
- export declare function scheduleRunBudget(rule: ScheduleRule): number | undefined;
248
- /**
249
- * Whether a rule has no runs left. The scheduler refuses to open another
250
- * execution for an exhausted rule, which is what makes the budget terminal
251
- * regardless of restarts or repeated timer fires.
252
- * @param rule - the schedule rule.
253
- * @returns true when the run budget is spent.
254
- */
255
- export declare function scheduleExhausted(rule: ScheduleRule): boolean;
256
- /**
257
- * The instant a rule plans to fire next, for display, whatever its mode: the
258
- * planned `at` of a one-shot, or the stored `nextRunAt` of a recurring rule.
259
- * @param rule - the schedule rule.
260
- * @returns the planned instant, or undefined when the rule carries none.
261
- */
262
- export declare function schedulePlannedAt(rule: ScheduleRule): number | undefined;
263
- /**
264
- * Frozen context snapshot carried by a continuation card (issue #4): the
265
- * goal/progress/next text (already sanitized by the freeze gates) plus the
266
- * freeze instant and the redaction warning flag.
267
- */
268
- export interface TaskFreeze extends FreezeSnapshot {
269
- /** When the snapshot was frozen (ms epoch, stamped by the create/update use case). */
270
- frozenAt: number;
271
- /** True when the freeze gates redacted sensitive patterns out of the text. */
272
- redacted?: boolean;
273
- /**
274
- * Session id of the DSH session that authored the frozen snapshot (issue #6
275
- * provenance): stamped by the Host ledger from the create/update action's
276
- * initiator, or kept from the wire payload when no initiator was asserted.
277
- */
278
- frozenBy?: string;
279
- }
280
- /**
281
- * One task label (issue #1521). The name is the badge and the tag-filter key;
282
- * the optional prompt line rides the execution prompt, so a label may be
283
- * display-only (no prefix) or carry an instruction (business-line routing,
284
- * output directory, house style) that every run of the task inherits.
285
- */
286
- export interface TaskTag {
287
- /** Display name; trimmed, non-empty, unique within the task. */
288
- name: string;
289
- /**
290
- * Prompt line injected ahead of the execution prompt. Absent (or blank
291
- * after trimming) keeps the tag display-only: it never touches the prompt,
292
- * so a label with no prefix has zero execution side effects.
293
- */
294
- promptPrefix?: string;
295
- }
296
- /** Maximum number of tags carried by one task. */
297
- export declare const TASK_TAG_LIMIT = 8;
298
- /** Maximum length of a tag name. */
299
- export declare const TAG_NAME_MAX_LENGTH = 32;
300
- /** Maximum length of a tag's injected prompt line. */
301
- export declare const TAG_PROMPT_MAX_LENGTH = 200;
302
- /** Whether an unknown value is a well-formed tag (strict: the wire gate). */
303
- export declare function isTaskTag(value: unknown): value is TaskTag;
304
- /**
305
- * Whether an unknown value is a well-formed tag list (strict: the wire gate).
306
- * An empty list is rejected — clearing tags is expressed by omitting the field
307
- * (create) or by an explicit null (update), never by an empty array.
308
- */
309
- export declare function isTaskTagList(value: unknown): value is TaskTag[];
310
- /**
311
- * Repair a persisted tag list: keep the well-formed entries, trim, drop
312
- * blanks and repeats, cap the count, and collapse a blank prompt line to
313
- * "display-only". Returns undefined when nothing usable remains, so the caller
314
- * clears the field instead of storing an empty array.
315
- */
316
- export declare function normalizeTags(value: unknown): TaskTag[] | undefined;
317
- /**
318
- * Stable palette slot (0..5) for a tag name. The same label always lands on the
319
- * same tone, so a badge needs no stored colour and two tasks sharing a label
320
- * cannot disagree about it.
321
- */
322
- export declare function tagTone(name: string): number;
323
- /**
324
- * Union of the labels already carried by `tasks`, first occurrence wins (the
325
- * oldest task's hint is the one offered). Feeds the editor's name datalist and
326
- * the board's tag filter, so a label defined once can be reused everywhere.
327
- */
328
- export declare function collectKnownTags(tasks: readonly TaskRecord[]): TaskTag[];
329
- /** One task on the board. */
330
- export interface TaskRecord {
331
- /** Stable task id (uuid). */
332
- id: string;
333
- /** Short display title. */
334
- title: string;
335
- /** Longer human description shown in the detail view. */
336
- description: string;
337
- /** The prompt sent to dsh when this task is executed. */
338
- prompt: string;
339
- /**
340
- * Parent task id: present only on a subtask. The Host owns the lineage gate
341
- * (see `core/subtask.ts`), which refuses a cycle, an archived parent, and
342
- * any link that would exceed `maxSubtaskDepth` — so every chain the Host
343
- * wrote under the current setting is at most that many links long. Lowering
344
- * the limit later neither rewrites nor deletes an already stored link.
345
- */
346
- parentId?: string;
347
- /** Current column. */
348
- status: TaskStatus;
349
- /** Creation instant (ms epoch). */
350
- createdAt: number;
351
- /** Last mutation instant (ms epoch). */
352
- updatedAt: number;
353
- /**
354
- * Execution history retained on the task, most recent last: the latest
355
- * {@link EXECUTION_HISTORY_LIMIT} attempts, oldest trimmed on append.
356
- */
357
- executions: ExecutionRecord[];
358
- /** Optional scheduled-run rule (absent on tasks without a schedule). */
359
- schedule?: ScheduleRule;
360
- /**
361
- * Workspace the execution must run in (a workspace-list id); absent means
362
- * the recent-workspace fallback at execution time.
363
- */
364
- workspaceId?: string;
365
- /**
366
- * Agent preset the execution session must be composed from (an
367
- * `agentPreset.list` id); absent means the deployment default.
368
- */
369
- mode?: string;
370
- /**
371
- * Permission preset applied to the execution session through the
372
- * `/permission <id>` slash command; absent leaves the session default.
373
- */
374
- permission?: TaskPermission;
375
- /**
376
- * Pinned model selection for the execution session (format: "provider/model" or model id);
377
- * absent falls back to the host default (agent-default-model).
378
- */
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;
389
- /**
390
- * Whether later executions continue in the previous execution's session
391
- * (issue #1419) instead of minting a fresh conversation per run. Absent or
392
- * false keeps the historical one-session-per-execution behavior; the reuse
393
- * itself only happens when that session is idle and still present (see
394
- * {@link reusableSessionId}).
395
- */
396
- reuseSession?: boolean;
397
- /**
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.
403
- */
404
- teamRun?: boolean;
405
- /**
406
- * Start every execution of this task with dsh's built-in `/goal` command,
407
- * armed with the composed execution prompt as its objective. The session then
408
- * keeps working automatic continuation rounds until the agent marks the goal
409
- * complete, and this board settles the execution on the goal's own end
410
- * instead of at the first turn end. Absent means OFF — the option is
411
- * unchecked by default, so only an explicit `true` joins the goal run and
412
- * every card that never touched it (including every card written before the
413
- * field existed) runs one plain turn. A session whose `/goal` command is
414
- * refused still runs the prompt.
415
- */
416
- goalRun?: boolean;
417
- /**
418
- * Run this task's goal executions WITHOUT the board's acceptance gate.
419
- *
420
- * Absent means INHERIT: the execution's applicability is decided by the
421
- * board-wide `goalVerification` switch frozen at start, exactly as a card
422
- * that never touched this option behaves. Only an explicit `true` opts the
423
- * card out, and the execution records `applicability: 'disabled'` so the
424
- * report says plainly that nothing certified this run.
425
- *
426
- * The opt-out is per execution, not per run: flipping it never rewrites the
427
- * verdict rule of an execution already open, and a rerun or a scheduled
428
- * occurrence reads the card's current value when it freezes its contract.
429
- */
430
- skipVerification?: boolean;
431
- /**
432
- * Frozen context snapshot for a continuation card; absent on plain tasks.
433
- * Sanitized before it enters the ledger (redaction, slash-command taint,
434
- * 8 KiB per-field cap) by the protocol gate and re-normalized on load.
435
- */
436
- freeze?: TaskFreeze;
437
- /**
438
- * Handover bundle carried by a continuation card (issue #5): the pinned
439
- * execution triplet plus doc/script references. Sanitized before it
440
- * enters the ledger by the protocol gate and re-normalized on load; the
441
- * bundle's triplet overrides the legacy pin fields at execution time.
442
- */
443
- handover?: TaskHandover;
444
- /**
445
- * Task labels (issue #1521): optional, additive, and absent on every task
446
- * created before the field existed. A tag whose `promptPrefix` is set is
447
- * prepended to the execution prompt; a bare name is display and filter only.
448
- */
449
- tags?: TaskTag[];
450
- /**
451
- * Human confirmation stamp for an above-default effective permission
452
- * (ms epoch). Absent while the binding awaits confirmation; any permission
453
- * or handover change re-arms the gate by clearing it.
454
- */
455
- permissionConfirmedAt?: number;
456
- /**
457
- * When the task was archived (ms epoch). Archived tasks keep their status
458
- * and execution history, leave the main board, and cannot run until restored;
459
- * absent means on-board.
460
- */
461
- archivedAt?: number;
462
- /**
463
- * Opaque external-provider metadata, keyed by extension id; optional and
464
- * additive so existing tasks require no ledger migration. The board stores
465
- * and forwards it without interpreting the keys — each provider owns the
466
- * shape and validation of its own entry.
467
- */
468
- integrations?: Record<string, TaskBoardExtensionPayload>;
469
- /**
470
- * Whether the card is held off the board: it exists in the ledger (and its
471
- * execution history is intact) but no column ever renders it. Providers
472
- * create hidden cards for work they materialize but do not want displayed;
473
- * absent means on-board.
474
- */
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[];
484
- }
485
- /**
486
- * Statuses a task may be archived from: every status but `running`, whose
487
- * execution the runner still owns until it settles. A settled-only gate made
488
- * the duplicate-and-archive flow a silent no-op for scheduled tasks, which
489
- * return to `todo` after every successful run (issue #1447).
490
- */
491
- export declare const ARCHIVABLE_STATUSES: readonly TaskStatus[];
492
- /** Permission presets a task may pin on its execution session (the `/permission <id>` ids). */
493
- export declare const TASK_PERMISSIONS: readonly ["read-only", "workspace-write", "danger-full-access"];
494
- /** One permission preset id. */
495
- export type TaskPermission = typeof TASK_PERMISSIONS[number];
496
- /** Whether an unknown value is a known permission preset id. */
497
- export declare function isTaskPermission(value: unknown): value is TaskPermission;
498
- /** Input for creating a task. */
499
- export interface NewTaskInput {
500
- title: string;
501
- description: string;
502
- prompt: string;
503
- /**
504
- * Parent task id, turning this creation into a subtask. Absent keeps a root
505
- * task; the create use case validates the link (existence, depth) and
506
- * inherits the parent's unset execution targets.
507
- */
508
- parentId?: string;
509
- /** Workspace the execution must run in; empty/absent = the creating session's workspace for a root task, else the recent workspace at execution time. */
510
- workspaceId?: string;
511
- /** Agent preset the execution session must be composed from; empty/absent = deployment default. */
512
- mode?: string;
513
- /** Permission preset applied to the execution session; absent = session default. */
514
- permission?: TaskPermission;
515
- /** Optional pinned model for the execution session; absent = host default. */
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;
527
- /** Reuse the previous execution's session for later runs (issue #1419). */
528
- reuseSession?: boolean;
529
- /**
530
- * Start the execution with dsh's built-in `/goal`. Absent means the default
531
- * (one plain turn); only an explicit true joins the goal run.
532
- */
533
- goalRun?: boolean;
534
- /**
535
- * Run this task's goal executions without the acceptance gate; absent
536
- * inherits the board-wide `goalVerification` switch.
537
- */
538
- skipVerification?: boolean;
539
- /**
540
- * Optional scheduling rule requested at creation time (the new-task
541
- * dialog): an enable flag, the kind of plan (a recurring 5-field cron
542
- * expression, or one planned instant for a one-shot), an optional run cap,
543
- * and the IANA zone its wall clock is read in (absent means the Host zone).
544
- * The create use case arms it only when enabled and the plan is valid.
545
- */
546
- schedule?: {
547
- enabled: boolean;
548
- mode?: ScheduleMode;
549
- cron?: string;
550
- /** Planned instant of a one-shot rule (ms epoch). */
551
- at?: number;
552
- timeZone?: string;
553
- /** Run cap of a recurring rule; absent means unlimited. */
554
- maxRuns?: number;
555
- };
556
- /**
557
- * Optional frozen context snapshot (goal/progress/next, sanitized by the
558
- * protocol gate) turning the new task into a continuation card.
559
- */
560
- freeze?: FreezeSnapshot & {
561
- redacted?: boolean;
562
- frozenBy?: string;
563
- };
564
- /**
565
- * Optional handover bundle (pinned triplet + doc/script references,
566
- * sanitized by the protocol gate) attached at creation.
567
- */
568
- handover?: TaskHandoverInput;
569
- /**
570
- * Optional task labels. A tag with a non-blank `promptPrefix` is injected
571
- * ahead of the execution prompt; a bare name changes nothing at run time.
572
- */
573
- tags?: TaskTag[];
574
- /** Opaque external-provider metadata keyed by extension id. */
575
- integrations?: Record<string, TaskBoardExtensionPayload>;
576
- /** Column the created card opens in; absent means the board default (todo). */
577
- status?: TaskStatus;
578
- /** Create the card off-board (held in the ledger, never rendered). */
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[];
586
- }
587
- /** The five kanban columns, in display order. */
588
- export declare const COLUMNS: readonly {
589
- status: TaskStatus;
590
- label: string;
591
- }[];
592
- /**
593
- * Statuses a card may be moved to by hand: every column. The board UI and the
594
- * agent tool surface share this one list, so no column can be manual on one
595
- * surface and locked on the other.
596
- *
597
- * The column is a board statement, not a claim about a run. A hand-written
598
- * `done`/`failed` declares that the work finished (or failed) outside a
599
- * Host-run execution — human hands, an external system — and a hand-written
600
- * `running` says the work is under way without a tracked session. None of them
601
- * creates an {@link ExecutionRecord}, which is what keeps a declaration
602
- * distinguishable from a recorded outcome in the card's execution history; the
603
- * next settled run overwrites the column with the real one.
604
- */
605
- export declare const MANUAL_STATUSES: readonly TaskStatus[];
606
- /** Statuses the runner may move a card to from 'running'. */
607
- export declare const RUNNER_SETTLE_STATUSES: readonly TaskStatus[];
608
- /** All valid statuses (closed union guard). */
609
- export declare const ALL_STATUSES: readonly TaskStatus[];
610
- /** Brand an unknown string as a status; undefined when it is not one. */
611
- export declare function isTaskStatus(value: unknown): value is TaskStatus;
612
- /**
613
- * Whether the manual move `from` -> `to` is a legal *column* change: any
614
- * column, and never the one the card already shows.
615
- *
616
- * Whether the card may be moved at all is a separate question. The lock an
617
- * executing card carries belongs to its open execution, never to the column
618
- * text, so it is {@link canMoveTask} — not this predicate — that expresses it.
619
- */
620
- export declare function canMoveManually(from: TaskStatus, to: TaskStatus): boolean;
621
- /**
622
- * Whether the board may move `task` to `to` by hand: the card is on-board,
623
- * holds no open execution, and the target is a legal column change. The ledger,
624
- * the detail view's status buttons and the board's drop handler all decide
625
- * through this one predicate, so no two surfaces can disagree about a card.
626
- */
627
- export declare function canMoveTask(task: TaskRecord, to: TaskStatus): boolean;
628
- /**
629
- * Whether the task still has an execution the runner has not settled. This —
630
- * not the `running` column — is what "the runner owns this card" means: a card
631
- * parked in `running` by hand has no session and stays fully movable.
632
- */
633
- export declare function hasOpenExecution(task: TaskRecord): boolean;
634
- /** Normalize one optional execution-target string: trim; blank collapses to undefined. */
635
- export declare function normalizeTargetId(value: string | undefined): string | undefined;
636
- /**
637
- * Build the persisted freeze snapshot from a sanitized input, stamping the
638
- * freeze instant (shared by the create and update use cases).
639
- */
640
- export declare function freezeOf(input: FreezeSnapshot & {
641
- redacted?: boolean;
642
- frozenBy?: string;
643
- }, now: number): TaskFreeze;
644
- /** Create a task from user input. */
645
- export declare function createTask(input: NewTaskInput, now: number, id: string): TaskRecord;
646
- /** Clone a task with an updated status and a fresh updatedAt. */
647
- export declare function withStatus(task: TaskRecord, status: TaskStatus, now: number): TaskRecord;
648
- /**
649
- * Merge a schedule patch into a task's schedule rule (creating it when
650
- * absent), with a fresh updatedAt. Keys present in the patch overwrite the
651
- * current value — including explicit `undefined`, which clears a field (used
652
- * to disarm `nextRunAt` or to drop an ended/skip record); absent keys keep
653
- * their current value.
654
- */
655
- export declare function withSchedule(task: TaskRecord, patch: Partial<ScheduleRule>, now: number): TaskRecord;
656
- /**
657
- * Open a fresh execution on a task: move it to 'running' and append a
658
- * running execution record. Returns the new task and the new execution.
659
- * @param runGroupId - cascade run group, when this run also opened executions
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.
663
- */
664
- export declare function startExecution(task: TaskRecord, now: number, executionId: string, initiatedBy?: string, runGroupId?: string, rework?: ExecutionRework): {
665
- task: TaskRecord;
666
- execution: ExecutionRecord;
667
- };
668
- /**
669
- * The column a settled outcome puts a card in. The ONE derivation shared by
670
- * every settlement path (issue #1826): a Host-run execution and an outcome an
671
- * outside agent reported both land in the same column from the same rule, so
672
- * the column never becomes a second, independent piece of state.
673
- @param task - the card being settled.
674
- @param outcome - the settled outcome.
675
- @returns the status the card shows afterwards.
676
- */
677
- export declare function settledStatus(task: TaskRecord, outcome: ExecutionOutcome): TaskStatus;
678
- /**
679
- * Settle a running execution: record the outcome and move the task into the
680
- * matching column. No-op (returns the input task) when the execution is not
681
- * the task's latest or is already settled.
682
- */
683
- export declare function settleExecution(task: TaskRecord, executionId: string, outcome: ExecutionOutcome, now: number, error: string | undefined, summary?: ExecutionSummary): TaskRecord;
684
- /** A settled-execution summary string for the detail view. */
685
- export declare function executionLabel(execution: ExecutionRecord): string;