@fish-under-sea/dsh-client-ui-task-board-fish 2.2.2 → 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 +5 -4
  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,452 +0,0 @@
1
- import { type ExecutionOutcome, type ExecutionRecord, type ExecutionSummary, type ScheduleMode, type TaskRecord } from './core/tasks.ts';
2
- import type { CardDefaults } from './core/card-defaults.ts';
3
- import { type TaskBoardAction, type TaskBoardSchedulerSnapshot } from './protocol.ts';
4
- import { type ExecutionVerification } from './core/verification.ts';
5
- import { type TaskPermission } from './core/handover.ts';
6
- export interface LedgerState {
7
- revision: number;
8
- tasks: TaskRecord[];
9
- scheduler: TaskBoardSchedulerSnapshot;
10
- }
11
- export interface OpenedRun {
12
- task: TaskRecord;
13
- execution: ExecutionRecord;
14
- }
15
- /**
16
- * Prefix of the `initiatedBy` an inherited descendant verdict carries. The Host
17
- * recorded it on the run card's behalf (see `inheritVerdictForDescendants`), not
18
- * an outside agent that reported its own work.
19
- */
20
- export declare const PARENT_RUN_INITIATOR_PREFIX = "parent-run:";
21
- /** Minimal value copy used by the Host session monitor. */
22
- export interface OpenExecutionReference {
23
- readonly taskId: string;
24
- readonly executionId: string;
25
- readonly sessionId: string | undefined;
26
- readonly startedAt: number;
27
- /**
28
- * True for a member of a team-mode run other than its Lead. A teammate is a
29
- * durable member of the Team: it stays alive after its turn ends, so the
30
- * roster may keep reporting its session as running, and the turn it completed
31
- * is the only verdict it exposes.
32
- */
33
- readonly teamMember: boolean;
34
- }
35
- /** Minimal value copy used by the Host scheduler. */
36
- export interface DueScheduleReference {
37
- readonly taskId: string;
38
- /** Whether this due rule is a recurring cron rule or a single planned instant. */
39
- readonly mode: ScheduleMode;
40
- /** Cron expression of a recurring rule; absent on a one-shot. */
41
- readonly cron?: string;
42
- /** Zone this rule's wall clock is read in. */
43
- readonly timeZone: string;
44
- readonly nextRunAt: number;
45
- }
46
- /** Derived runtime data for one session-poll pass. */
47
- export interface LedgerRuntimeView {
48
- readonly armedSchedules: number;
49
- readonly openExecutions: readonly OpenExecutionReference[];
50
- /**
51
- * Session ids of every open execution, including the ones
52
- * {@link openExecutions} skips because their own outcome is already
53
- * recorded. A caller that asks whether the board still observes any session
54
- * must use this list: a stored run-group parent is settled by its members,
55
- * but it is still an open execution.
56
- */
57
- readonly openSessionIds: readonly string[];
58
- /**
59
- * Whether this document holds anything the session roster can still decide:
60
- * an open execution that needs inspecting, or a card in the running column
61
- * whose verdict may arrive from a settle this process never saw.
62
- *
63
- * A board with no running card, no open execution and no armed schedule has
64
- * no use for the roster at all, which is what lets the Host poll stand down
65
- * instead of re-reading every persisted session forever.
66
- */
67
- readonly needsSessionState: boolean;
68
- }
69
- /**
70
- * Best-effort single-letter process state ('R','S','D','Z',...) or undefined
71
- * when no probe is available on this platform. Linux reads /proc/<pid>/stat
72
- * directly (no subprocess); other POSIX shells out to `ps -o stat=`; Windows
73
- * has no zombie state, so it returns undefined and the kill(0) probe alone
74
- * is authoritative there.
75
- */
76
- export declare function processState(pid: number): string | undefined;
77
- export declare function processIsAlive(pid: number): boolean;
78
- /** Runs one PowerShell script and returns its trimmed stdout. */
79
- export type PowerShellProbe = (script: string, timeoutMs: number) => string | undefined;
80
- /**
81
- * Windows start time (Unix epoch ms) of a live process.
82
- *
83
- * `Get-Process` is the precise first choice, but an unprivileged caller cannot
84
- * read `.StartTime` for a protected process (System, svchost): the property is
85
- * empty, so the probe returns nothing. Without a fallback, a crash leftover
86
- * lock whose PID was reused by such a process could never be proven stale and
87
- * blocked every startup until the lock was deleted by hand (issue #1629).
88
- * Win32_Process through CIM reports the same CreationDate for those processes
89
- * at the same millisecond precision, so it is the second identity source. The
90
- * probe is injectable so the fallback chain is testable off Windows.
91
- */
92
- export declare function win32StartTimeMs(pid: number, probe?: PowerShellProbe): number | undefined;
93
- /**
94
- * Repair parent links after a load or an import: a link whose parent row is
95
- * missing, cyclic, or names an archived parent while the child is on board is
96
- * dropped (the task becomes a root) instead of dropping the task. A chain
97
- * deeper than the current `maxSubtaskDepth` is deliberately KEPT: the limit
98
- * gates new links, it never deletes a stored one, and every lineage walk is
99
- * bounded by the limit anyway. The Host is the only writer of these links, so
100
- * this is a last-resort guard against a hand-edited or imported document.
101
- */
102
- export declare function repairParentLinks(tasks: readonly TaskRecord[]): TaskRecord[];
103
- export declare class HostTaskLedger {
104
- private readonly now;
105
- private document;
106
- private readonly listeners;
107
- private readonly requestCache;
108
- private readonly lockToken;
109
- private lockFd;
110
- readonly file: string;
111
- readonly lockFile: string;
112
- /** Small sidecar for the 30 s scheduler heartbeat (lastTickAt only). */
113
- readonly schedulerFile: string;
114
- /** Resolves the baseline the confirmation gate compares a binding against. */
115
- private readonly sessionDefault;
116
- /**
117
- * Session-default permission the confirmation gate compares against. Read
118
- * through the resolver on every use, so a baseline that follows the Host's
119
- * own default preset tracks a Settings change made while the board runs.
120
- */
121
- get sessionDefaultPermission(): TaskPermission;
122
- /**
123
- * Deployment subtask depth limit (1..3): the lineage gate every write obeys.
124
- * The settings card edits it live, so {@link setMaxSubtaskDepth} mutates it
125
- * instead of remounting the row.
126
- */
127
- private depthLimit;
128
- /** Live reader of the deployment's new-card defaults (a volatile config read). */
129
- private readonly cardDefaults;
130
- /**
131
- * Live reader of the daily token cap (0 = no gate). The scheduled path asks it
132
- * per due occurrence, so a cap raised after a skipped occurrence admits the
133
- * next one without a restart.
134
- */
135
- private readonly spendBudget;
136
- /** Today's measured spend in tokens, or undefined when nothing can be measured. */
137
- private readonly spendUsed;
138
- constructor(dir?: string, now?: () => number, options?: {
139
- sessionDefaultPermission?: TaskPermission | (() => TaskPermission);
140
- maxSubtaskDepth?: number;
141
- cardDefaults?: () => CardDefaults;
142
- spendBudgetTokens?: () => number;
143
- spendUsedToday?: (now: number) => number | undefined;
144
- });
145
- /** Current subtask depth limit (1..3). */
146
- get maxSubtaskDepth(): number;
147
- /**
148
- * Apply a live settings edit of the subtask depth limit. A no-op when the
149
- * normalized limit is unchanged, so a coarse volatile invalidation that
150
- * changed nothing emits nothing.
151
- */
152
- setMaxSubtaskDepth(depth: number): void;
153
- /** Remove leftover *.tmp-* files from previous crashes or interrupted writes. */
154
- private cleanStaleTemporaryFiles;
155
- /** Revision + scheduler without any task cloning; feeds the SSE event frame. */
156
- summary(): {
157
- revision: number;
158
- scheduler: TaskBoardSchedulerSnapshot;
159
- };
160
- state(): LedgerState;
161
- /**
162
- * Runtime-only projection for the Host poll. It copies just primitive
163
- * identifiers and timestamps, never the complete task/execution history or
164
- * an authoritative mutable object from the ledger.
165
- */
166
- runtimeView(): LedgerRuntimeView;
167
- /** Count armed, non-archived schedules without cloning task histories. */
168
- armedScheduleCount(): number;
169
- /**
170
- * The earliest armed `nextRunAt` strictly after the supplied Host time, or
171
- * undefined when no schedule is armed in the future. This is the instant the
172
- * Host arms its native timer at, so the board wakes exactly when work is due
173
- * instead of polling a fixed heartbeat.
174
- * @param now - current Host time in ms epoch.
175
- * @returns the nearest future trigger, or undefined when none is armed.
176
- */
177
- nextArmedRunAt(now: number): number | undefined;
178
- /** Return value-only references for schedules due at the supplied Host time. */
179
- dueSchedules(now: number): DueScheduleReference[];
180
- subscribe(listener: () => void): () => void;
181
- dispose(): void;
182
- applyRequest(requestId: string, action: TaskBoardAction, initiator?: string): {
183
- state: LedgerState;
184
- runs?: OpenedRun[];
185
- };
186
- /**
187
- * Open the one run a due schedule triggers: an empty array means nothing ran
188
- * (already running, a card whose elevated permission is still unconfirmed, a
189
- * one-shot whose instant was missed, or an exhausted budget), and the rule's
190
- * own state says which.
191
- *
192
- * The run budget is enforced HERE, inside the single ledger writer: a rule
193
- * whose counter already reached its cap is stopped instead of opened, so no
194
- * restart, repeated timer fire or re-arm can overrun it.
195
- * @param taskId - the task whose rule came due.
196
- * @param triggeredAt - the instant the occurrence came due.
197
- * @returns the executions this occurrence opened.
198
- */
199
- openScheduled(taskId: string, triggeredAt: number): OpenedRun[];
200
- /**
201
- * Why a due occurrence may not open a run because the day already spent the
202
- * cap, or undefined when it may. A cap of 0 — the default — answers before the
203
- * measurement is read, so a board with no gate reads no ledger file.
204
- * @param now - clock instant (ms epoch).
205
- * @returns the refusal message, when the cap is reached.
206
- */
207
- private spendRefusal;
208
- /**
209
- * Record a due occurrence that opened no execution: roll a recurring rule to
210
- * its next occurrence (budget untouched), or stop it when there is none. A
211
- * one-shot has no second occurrence, so it always stops here with the reason.
212
- */
213
- private skipOccurrence;
214
- /** Apply a schedule-occurrence transition and persist it atomically. */
215
- private progressSchedule;
216
- /**
217
- * Refund the one scheduled run an occurrence consumed before its launch
218
- * failed without creating a session (see
219
- * {@link applyScheduleRefund}). Called by the service on the failed-launch
220
- * path only; a manual run and a launch that did reach a session are never
221
- * refunded. A no-op for a task with no rule, so a failed run does not touch
222
- * anything.
223
- * @param taskId - the task whose occurrence is being refunded.
224
- * @param now - clock instant (ms epoch).
225
- */
226
- refundScheduledOccurrence(taskId: string, now: number): void;
227
- /**
228
- * Boot / resume recovery: skip every occurrence that came due while the board
229
- * was not running through it. A recurring rule rolls to its next future
230
- * target; a one-shot whose instant has passed is stopped as missed, because
231
- * there is no later occurrence left to run. Rendering the missed occurrence
232
- * is deliberately not attempted: the ACL of a card that fired hours ago is
233
- * stale, and the board's own recovery contract is "missed triggers are
234
- * skipped, never replayed".
235
- */
236
- skipMissed(now: number): void;
237
- setScheduler(patch: Partial<TaskBoardSchedulerSnapshot>): void;
238
- /**
239
- * Settle one execution. A NEW run is a single-member group, so it settles on
240
- * its own turn. A run group the Host opened before it stopped spreading one
241
- * run across a subtree is folded here instead: a stored participant records
242
- * its OWN outcome and only finalizes once every child execution in its group
243
- * has settled, so a parent card leaves 'running' with the whole group's
244
- * verdict rather than its own turn alone.
245
- *
246
- * `summary` is what the run left behind (see `ExecutionSummary`), passed in
247
- * by whichever reader observed the session. It is informational: a caller
248
- * without one settles exactly as before, and a settlement never waits on it.
249
- */
250
- settle(taskId: string, executionId: string, outcome: ExecutionOutcome, error?: string, summary?: ExecutionSummary): void;
251
- /**
252
- * Record the run's verdict on the outstanding descendants its root was asked
253
- * to dispatch.
254
- *
255
- * A card with unfinished subtasks runs as an autonomous dispatcher: its
256
- * session reads the subtasks, dispatches them with subagents, and is asked to
257
- * write their conclusions back with
258
- * `task_board_manage({action:'record-external-outcome'})` before it finishes.
259
- * A run that never wrote one back would leave those cards parked with no
260
- * record of what the parent decided about them, so once the RUN CARD's
261
- * execution reached a decisive terminal record, every outstanding descendant
262
- * this run opened no execution for inherits that verdict as an external
263
- * record.
264
- *
265
- * Idempotent by construction: a card that already carries an execution in
266
- * this run group (the fold owns it), an open execution (it is running on its
267
- * own), or a terminal record stamped after this run started (the dispatching
268
- * agent's own backfill, or an earlier pass of this one) is left alone. Only a
269
- * decisive verdict is inherited: a cancelled run judged nothing about the
270
- * subtasks, and a subtask already in the done column has nothing left to
271
- * inherit.
272
- * @param taskId - the card whose execution just settled.
273
- * @param executionId - that execution.
274
- * @param groupId - its run group.
275
- * @param now - clock instant (ms epoch).
276
- * @returns whether the document changed.
277
- */
278
- private inheritVerdictForDescendants;
279
- attachSession(taskId: string, executionId: string, sessionId: string): void;
280
- allTasks(): readonly TaskRecord[];
281
- getTask(id: string): TaskRecord | undefined;
282
- saveTaskRecord(task: TaskRecord): void;
283
- private apply;
284
- /**
285
- * Whether a creation-time schedule request is usable. A one-shot must carry
286
- * a whole-millisecond instant in the future; a recurring rule must carry a
287
- * valid expression with a reachable occurrence and, when capped, a positive
288
- * whole run budget. An unusable zone is refused rather than reinterpreted as
289
- * the Host zone.
290
- */
291
- private validScheduleRequest;
292
- /**
293
- * The binding that makes a run illegal, if any.
294
- *
295
- * Only the card being run gets a session, so only ITS resolved binding gates
296
- * the run: a subtask's own elevated permission is that subtask's gate when the
297
- * subtask is run, and no longer blocks its parent from running.
298
- * @param root - the task being run.
299
- * @returns the first refusal, or undefined when the run may start.
300
- */
301
- private bindingRefusal;
302
- /**
303
- * The rework block a rework request opens its execution with, or the refusal
304
- * that names why there is nothing to rework.
305
- *
306
- * Read from the ledger alone: a card that never ran, and a card whose runs
307
- * recorded no session, have no conversation to send the reviewer's
308
- * instructions into. Minting one would hand those instructions to an agent
309
- * that never saw the work being sent back, which is the opposite of what a
310
- * rework asks for.
311
- * @param task - the card being reworked.
312
- * @param instructions - the reviewer's instructions, already validated.
313
- * @returns the block recorded on the opened execution.
314
- */
315
- private reworkInput;
316
- /** Whether a task or any of its subtasks still has an open execution. */
317
- private subtreeHasOpenExecution;
318
- /** The descendants of a card that still hold work, as the launch prompt names them. */
319
- outstandingDescendants(taskId: string): TaskRecord[];
320
- /** Whether a card still has a subtask outside the done column. */
321
- hasOutstandingDescendants(taskId: string): boolean;
322
- /**
323
- * Open ONE execution for the requested card, under a fresh run group, and
324
- * commit the ledger once. The group stays single-member on purpose: a run
325
- * never opens a session for a subtask (that card's own agent dispatches
326
- * subagents inside this session), and the group id is what later lets the
327
- * settlement fold a HISTORICAL multi-member group it opened before this
328
- * behavior changed.
329
- * @param root - the task the user ran.
330
- * @param now - clock instant (ms epoch).
331
- * @param initiator - the DSH session that asked for the run (audit only).
332
- * @param rerun - true to reset the root to 'todo' before starting it.
333
- * @param progress - when set, this run was a due occurrence and the root's
334
- * rule is advanced (counter, next target, stop/skip record) in the same
335
- * atomic commit that opened the execution.
336
- * @param rework - the reviewer's instructions, when this run redoes previous
337
- * work; recorded on the execution it opens.
338
- */
339
- private startRun;
340
- /**
341
- * Finalize every stored run-group parent that is ready, walking from `taskId`
342
- * up the lineage: a member settles once its own outcome is recorded and none
343
- * of its group children is still open, and its verdict folds those children in
344
- * (failure dominates, then cancellation). A single-member group — every run
345
- * this Host opens now — settles on its own turn exactly as any plain run does.
346
- */
347
- private settleCascade;
348
- /**
349
- * Close every run that is already decided, and fold every lineage whose
350
- * members are all settled. The Host poll calls this on every tick, so a run
351
- * can no longer be left in the running column by a settle nobody observed:
352
- *
353
- * - A stored team run is governed by its Lead. Once the Lead's own outcome is
354
- * recorded, its still-open members are settled with that verdict. A
355
- * teammate is a durable member of the Team and may never report a turn of
356
- * its own, and without this the whole lineage waits on it forever. New runs
357
- * never start a team, so this only closes a group the ledger already holds.
358
- * - A stored group parent whose members are all settled is finalized here even
359
- * when the settle that completed the tree happened in another process, or
360
- * was interrupted between its child write and its parent write.
361
- *
362
- * Idempotent: a run that is already folded is left untouched, so a caller may
363
- * invoke it on every tick.
364
- * @param persist - false to leave the document for the caller to commit.
365
- * @returns whether the document changed.
366
- */
367
- finalizeReadyRuns(persist?: boolean): boolean;
368
- /**
369
- * The verdict a team run's Lead has already recorded: its own turn outcome
370
- * once that turn ended, or the folded outcome once its card settled.
371
- */
372
- private leadVerdict;
373
- /**
374
- * Settle every still-open member of a team run with the Lead's verdict.
375
- * A teammate that already reported its own outcome keeps it: the ordinary
376
- * fold still lets a failure dominate.
377
- * @param leadId - the Lead card's task id (never settled here).
378
- * @param groupId - the team run's group.
379
- * @param verdict - the Lead's outcome, inherited by members that never reported.
380
- * @param error - the Lead's failure text, inherited with a failed verdict.
381
- * @param now - clock instant (ms epoch).
382
- * @returns whether the document changed.
383
- */
384
- private closeTeamMembers;
385
- /**
386
- * Re-align every armed rule at load/import. A recurring rule is recomputed
387
- * from the current instant; a one-shot is armed at its planned instant when
388
- * that is still in the future, and stopped as missed once it has passed
389
- * (there is no later occurrence to run). A recurring rule recomputed past an
390
- * occurrence records the skip, so the board can show that a fire was passed
391
- * over rather than silently rewinding.
392
- */
393
- private repairSchedules;
394
- private reconcileInterruptedStarts;
395
- /**
396
- * Field-preserving migration of an older document. It first proves every task
397
- * row is structurally valid, so a document that would silently drop or coerce
398
- * rows fails loudly instead (no quarantined-empty restart), and then reuses
399
- * the current normalization.
400
- *
401
- * v4 adds `ScheduleRule.timeZone`. A rule written before v4 was evaluated in
402
- * whatever zone the Host process happened to report, so the migration stamps
403
- * that zone onto every enabled rule: the trigger instant is preserved exactly
404
- * (the stored `nextRunAt` already encodes the old zone), but the rule stops
405
- * following a later `TZ` change, which is what made an existing schedule
406
- * silently move when the Host's zone changed.
407
- *
408
- * v5 adds the per-execution acceptance block. The migration deliberately does
409
- * NOT stamp one: an execution opened before v5 keeps no contract, so it
410
- * settles on its own historical verdict and no in-flight run is retroactively
411
- * judged by a gate that was never armed for it.
412
- */
413
- private migrateLegacyDocument;
414
- /**
415
- * Find the still-open execution that ran in one session, with its task.
416
- *
417
- * The completion gate keys on the session id its tool call arrives from: the
418
- * execution record is the only object binding a session to a card, and an
419
- * already-settled execution is deliberately not returned (a session the board
420
- * no longer owns must not be gated).
421
- * @param sessionId - the DSH session the tool call runs in.
422
- * @returns the open execution and its task, or undefined.
423
- */
424
- findOpenExecutionBySession(sessionId: string): {
425
- task: TaskRecord;
426
- execution: ExecutionRecord;
427
- } | undefined;
428
- /**
429
- * Replace one execution's acceptance block (creating it when absent).
430
- *
431
- * A no-op when the serialized value is unchanged, so a coarse caller that
432
- * re-writes the same state never bumps the ledger revision. A settled
433
- * execution keeps its record: the report of a finished cycle must survive,
434
- * and only the board's own settlement moves the card.
435
- * @param taskId - the task owning the execution.
436
- * @param executionId - the execution to update.
437
- * @param verification - the new block.
438
- * @returns true when the ledger changed.
439
- */
440
- setVerification(taskId: string, executionId: string, verification: ExecutionVerification): boolean;
441
- private load;
442
- private normalizeDocument;
443
- /** Quarantine an unreadable document and start from an empty ledger. */
444
- private recoverCorrupt;
445
- private syncRecentRequests;
446
- private readSchedulerSidecar;
447
- /** Atomic write of the scheduler heartbeat sidecar (0600, tmp + rename + fsync). */
448
- private writeSchedulerSidecar;
449
- private commit;
450
- private notify;
451
- private acquireLock;
452
- }
@@ -1,99 +0,0 @@
1
- import type { IncomingMessage } from 'node:http';
2
- import type { WebRoute } from '@deepseek-ai/dsh-host-webserver';
3
- import type { TaskBoardHostService } from './host-service.ts';
4
- import { type TaskBoardParseDraft, type TaskBoardParseRequest } from './protocol.ts';
5
- import { type TaskBoardAttachmentStore } from './host/attachments.ts';
6
- /**
7
- * Comment-frame cadence on the event stream. It keeps the connection alive
8
- * through intermediaries that would close an idle one; it is not a frame the
9
- * browser reports to the panel (an SSE comment is invisible to EventSource).
10
- */
11
- export declare const HEARTBEAT_MS = 15000;
12
- /** Header replaced by an authenticated same-host reverse proxy. */
13
- export declare const TASK_BOARD_PROXY_TOKEN_HEADER = "x-dsh-task-board-proxy-token";
14
- /**
15
- * The composition's Host connection service, narrowed to the one check the
16
- * board bridges: `requestRejection` runs the Host/Origin fence and verifies
17
- * the authority-bound `dsh-auth-*` browser session minted by the Host. It
18
- * answers `undefined` only for a request it admits and 401/403 otherwise.
19
- * Declared structurally, like the official open-in-app routes do, because the
20
- * service's package is a browser-side dependency this Host half does not
21
- * import.
22
- */
23
- export interface TaskBoardConnectionTrust {
24
- requestRejection(request: {
25
- readonly headers: IncomingMessage['headers'];
26
- }): 401 | 403 | undefined;
27
- }
28
- /** Optional authenticated reverse-proxy access layered over the loopback default. */
29
- export interface TaskBoardRouteAccess {
30
- trustedProxyHosts?: readonly string[];
31
- proxyToken?: string;
32
- /**
33
- /**
34
- * Whether the operator's own reverse proxy or tunnel may speak for the
35
- * browser: a forwarded request that landed on this machine's loopback
36
- * upstream then counts as trustable, still behind the browser same-origin
37
- * marker. Read at each request (hence the function), so the settings switch
38
- * binds the next request without re-registering the routes. Absent or false
39
- * keeps the pre-existing fence exactly as it was (issue #1906).
40
- */
41
- trustForwardedProxy?: () => boolean;
42
- /**
43
- * Resolves the Host's `connection` service when a request arrives, so a
44
- * deployment that mounts it after these routes still gains the bridge and a
45
- * composition that never mounts it keeps the pre-existing fence. Absent means
46
- * no bridge (issue #1930).
47
- */
48
- connection?: () => TaskBoardConnectionTrust | undefined;
49
- }
50
- /**
51
- * Host faces the routes need beyond the ledger service. The parse face is
52
- * resolved lazily by the caller, so a deployment without an llm service still
53
- * registers the route and answers with a typed "no model" failure instead of
54
- * leaving the panel with an unmounted path (issue #1540).
55
- */
56
- export interface TaskBoardRouteOptions {
57
- parseTask?: (request: TaskBoardParseRequest, signal: AbortSignal) => Promise<TaskBoardParseDraft>;
58
- /**
59
- * The official attachment storage, read at request time so a deployment that
60
- * mounts it after these routes still gains the attachment surface. Absent
61
- * means this deployment stores no attachments, and every attachment route
62
- * answers with a typed "storage unavailable" failure.
63
- */
64
- attachments?: () => TaskBoardAttachmentStore | undefined;
65
- }
66
- interface ResolvedRouteAccess {
67
- trustedProxyHosts: ReadonlySet<string>;
68
- proxyToken?: string;
69
- trustForwardedProxy: () => boolean;
70
- connection?: () => TaskBoardConnectionTrust | undefined;
71
- }
72
- /**
73
- * Task-board route fence. Direct desktop access uses the repository-wide
74
- * loopback socket + Host guard and additionally requires a browser same-origin
75
- * marker: a bare local curl without any browser signal cannot exercise the
76
- * agent control plane (a forged Origin does pass the marker — it is a
77
- * tripwire, the socket/Host/origin-equality checks carry the authority).
78
- * Authenticated proxies must be explicitly allowlisted and replace the
79
- * internal token header after their own authentication step.
80
- *
81
- * A third party's proxy cannot inject that token, so a deployment whose own
82
- * tunnel dials the loopback upstream (issue #1918) can instead turn on
83
- * trustForwardedProxy: a forwarded request that landed on this machine
84
- * (loopback socket AND loopback Host) is then admitted on the same browser
85
- * marker alone. The switch defaults off, so an unconfigured board keeps
86
- * refusing every forwarded request (issue #1906).
87
- *
88
- * A deployment behind a reverse proxy or ingress that DSH itself serves
89
- * (`--trusted-host`, TLS terminated at the edge) is admitted by the Host's
90
- * `connection` service instead: a request whose Host/Origin fence and signed
91
- * browser session it accepts needs no board-specific allowlist, which is why
92
- * the check runs first when the service is mounted (issue #1930). The fence
93
- * below stays untouched as the fallback, so a deployment without the service,
94
- * and every direct client the service does not admit, keeps exactly the
95
- * pre-existing decision.
96
- */
97
- export declare function isTrustedTaskBoardRequest(req: IncomingMessage, access: ResolvedRouteAccess): boolean;
98
- export declare function makeTaskBoardRoutes(service: TaskBoardHostService, access?: TaskBoardRouteAccess, options?: TaskBoardRouteOptions): WebRoute[];
99
- export {};