@linxin666/dsh-client-ui-task-board 0.4.16 → 0.4.17

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 (59) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +16 -36
  3. package/README.zh.md +16 -36
  4. package/lib/client.js +101 -1348
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +129 -2528
  7. package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -20
  8. package/lib/types/client/board/status-key.d.ts +0 -15
  9. package/lib/types/client/locales.d.ts +1 -110
  10. package/lib/types/core/controller.d.ts +1 -1
  11. package/lib/types/core/extension.d.ts +4 -5
  12. package/lib/types/core/model-catalog.d.ts +58 -0
  13. package/lib/types/core/reasoning-effort.d.ts +1 -1
  14. package/lib/types/core/tasks.d.ts +0 -45
  15. package/lib/types/core/use-cases/task-update.d.ts +1 -1
  16. package/lib/types/host/llm-dispatch.d.ts +8 -10
  17. package/lib/types/host-ledger.d.ts +0 -28
  18. package/lib/types/host-runner.d.ts +6 -71
  19. package/lib/types/host-service.d.ts +17 -89
  20. package/lib/types/index.d.ts +0 -78
  21. package/lib/types/protocol.d.ts +6 -23
  22. package/package.json +26 -26
  23. package/src/client/TaskBoardSettingsCard.tsx +13 -200
  24. package/src/client/board/ExecutionLog.tsx +2 -5
  25. package/src/client/board/NewTaskModal.tsx +1 -42
  26. package/src/client/board/TaskCard.tsx +2 -7
  27. package/src/client/board/TaskDetail.tsx +2 -37
  28. package/src/client/board/status-key.ts +0 -30
  29. package/src/client/board-settings.module.css +3 -22
  30. package/src/client/board.module.css +1 -104
  31. package/src/client/index.ts +1 -1
  32. package/src/client/locales.ts +6 -224
  33. package/src/core/controller.ts +1 -3
  34. package/src/core/extension.ts +4 -5
  35. package/src/core/model-catalog.ts +114 -0
  36. package/src/core/reasoning-effort.ts +1 -1
  37. package/src/core/store.ts +22 -17
  38. package/src/core/tasks.ts +0 -53
  39. package/src/core/use-cases/task-update.ts +1 -8
  40. package/src/host/agent-tools.ts +1 -15
  41. package/src/host/llm-dispatch.ts +8 -10
  42. package/src/host-ledger.ts +1 -86
  43. package/src/host-routes.ts +4 -4
  44. package/src/host-runner.ts +12 -138
  45. package/src/host-service.ts +51 -266
  46. package/src/index.ts +9 -163
  47. package/src/protocol.ts +8 -43
  48. package/lib/types/client/board/VerificationReport.d.ts +0 -10
  49. package/lib/types/core/verification-budget.d.ts +0 -52
  50. package/lib/types/core/verification.d.ts +0 -753
  51. package/lib/types/host/verification-gate.d.ts +0 -95
  52. package/lib/types/host/verification-runner.d.ts +0 -139
  53. package/lib/types/host/workspace-evidence.d.ts +0 -53
  54. package/src/client/board/VerificationReport.tsx +0 -361
  55. package/src/core/verification-budget.ts +0 -115
  56. package/src/core/verification.ts +0 -1594
  57. package/src/host/verification-gate.ts +0 -487
  58. package/src/host/verification-runner.ts +0 -702
  59. package/src/host/workspace-evidence.ts +0 -176
@@ -15,7 +15,7 @@
15
15
  * the only place that can complete the documented `provider/model` or model-id
16
16
  * pin.
17
17
  */
18
- import type { CatalogModel, ModelCatalogView } from './verification.ts'
18
+ import type { CatalogModel, ModelCatalogView } from './model-catalog.ts'
19
19
 
20
20
  /** One execution route an effort resolves against: `provider/model`, or a bare model id. */
21
21
  export interface ReasoningRoute {
package/src/core/store.ts CHANGED
@@ -18,7 +18,6 @@ import { sanitizeFreezeSnapshot } from './freeze-snapshot.ts'
18
18
  import { sanitizeHandover } from './handover.ts'
19
19
  import { normalizeTaskIntegrations } from './extension.ts'
20
20
  import { normalizeAttachments } from './attachment.ts'
21
- import { normalizeVerification } from './verification.ts'
22
21
 
23
22
  /** Persistence seam for the task ledger. */
24
23
  export interface TaskStore {
@@ -76,8 +75,6 @@ function isTaskRecordShape(value: unknown): value is Omit<TaskRecord, 'status'>
76
75
  if (record.hidden !== undefined && typeof record.hidden !== 'boolean') return false
77
76
  if (record.attachments !== undefined && !Array.isArray(record.attachments)) return false
78
77
  if (record.reuseSession !== undefined && typeof record.reuseSession !== 'boolean') return false
79
- if (record.goalRun !== undefined && typeof record.goalRun !== 'boolean') return false
80
- if (record.skipVerification !== undefined && typeof record.skipVerification !== 'boolean') return false
81
78
  if (!Array.isArray(record.executions)) return false
82
79
  for (const execution of record.executions) {
83
80
  if (typeof execution !== 'object' || execution === null) return false
@@ -95,13 +92,30 @@ function isTaskRecordShape(value: unknown): value is Omit<TaskRecord, 'status'>
95
92
  // written before the field existed carries none, and a non-boolean value
96
93
  // is dropped by the repair below rather than trusted as provenance.
97
94
  if (entry.external !== undefined && typeof entry.external !== 'boolean') return false
98
- // The acceptance block is repaired like every other optional field: an
99
- // unusable one is dropped, which can only make the board MORE strict.
100
- if (entry.verification !== undefined && normalizeVerification(entry.verification) === undefined) return false
101
95
  }
102
96
  return true
103
97
  }
104
98
 
99
+ /**
100
+ * Drop the fields of retired features from one loaded row.
101
+ *
102
+ * A ledger written by an older build may still carry them: `goalRun` and
103
+ * `skipVerification` on a card, and the acceptance block on an execution. They
104
+ * are removed field by field rather than rejected — an old row always loads,
105
+ * every other field is untouched, and the next commit persists the row without
106
+ * them, so a removed option never survives a load and no new value is ever
107
+ * written for it.
108
+ * @param value - the parsed row (a card or one execution record).
109
+ * @returns a copy without the retired fields.
110
+ */
111
+ function withoutRetiredFields<T extends object>(value: T): T {
112
+ const kept = { ...value } as Record<string, unknown>
113
+ delete kept.goalRun
114
+ delete kept.skipVerification
115
+ delete kept.verification
116
+ return kept as T
117
+ }
118
+
105
119
  /** A task record is structurally valid if it round-trips through the UI. */
106
120
  export function isTaskRecord(value: unknown): value is TaskRecord {
107
121
  return isTaskRecordShape(value) && isTaskStatus(value.status)
@@ -245,7 +259,7 @@ export function parseLedger(raw: string | null): TaskRecord[] {
245
259
  }
246
260
  // Always (re)assign the schedule: a repair that returns undefined must
247
261
  // clear a malformed persisted rule rather than leave it in the row.
248
- const task: TaskRecord = { ...row, status: normalizeStatus(row.status) }
262
+ const task: TaskRecord = withoutRetiredFields({ ...row, status: normalizeStatus(row.status) })
249
263
  task.schedule = normalizeSchedule(row.schedule)
250
264
  // The lineage link is repaired like every other optional field: a blank or
251
265
  // non-string parent id clears the link instead of dropping the row. Whether
@@ -255,16 +269,13 @@ export function parseLedger(raw: string | null): TaskRecord[] {
255
269
  // Cascade bookkeeping on execution records is repaired field by field too,
256
270
  // so a hand-edited ledger degrades a run group instead of the whole task.
257
271
  task.executions = task.executions.map(execution => ({
258
- ...execution,
272
+ ...withoutRetiredFields(execution),
259
273
  runGroupId: normalizeTargetId(execution.runGroupId),
260
274
  ownResult: isExecutionOutcome(execution.ownResult) ? execution.ownResult : undefined,
261
275
  ownError: typeof execution.ownError === 'string' ? execution.ownError : undefined,
262
276
  // A summary a reader does not recognize (an older document has none) is
263
277
  // simply absent; a malformed one is dropped without costing the run.
264
278
  summary: normalizeExecutionSummary(execution.summary),
265
- // A malformed acceptance block is dropped rather than dropping the
266
- // execution record: the board then treats that run as unverified.
267
- verification: normalizeVerification(execution.verification),
268
279
  // A malformed rework block is dropped on the same terms: the run itself
269
280
  // is what the history is for, and only its instructions are unrecoverable.
270
281
  rework: normalizeExecutionRework(execution.rework),
@@ -282,12 +293,6 @@ export function parseLedger(raw: string | null): TaskRecord[] {
282
293
  task.archivedAt = typeof row.archivedAt === 'number' && Number.isFinite(row.archivedAt) ? row.archivedAt : undefined
283
294
  task.permission = isTaskPermission(row.permission) ? row.permission as TaskPermission : undefined
284
295
  task.reuseSession = row.reuseSession === true ? true : undefined
285
- // The goal opt-in is stored only when it is ON: absent means the default
286
- // (one plain turn per run), so a hand-edited false normalizes back to it.
287
- task.goalRun = row.goalRun === true ? true : undefined
288
- // The acceptance opt-out is stored only when it is ON: absent inherits the
289
- // board-wide switch, so a hand-edited false normalizes back to inherit.
290
- task.skipVerification = row.skipVerification === true ? true : undefined
291
296
  task.freeze = normalizeFreeze(row.freeze)
292
297
  task.handover = normalizeHandover(row.handover)
293
298
  // Tags are repaired field by field like the schedule: a malformed entry is
package/src/core/tasks.ts CHANGED
@@ -5,7 +5,6 @@
5
5
  * unit-testable in isolation.
6
6
  */
7
7
  import type { FreezeSnapshot } from './freeze-snapshot.ts'
8
- import type { ExecutionVerification } from './verification.ts'
9
8
  import type { TaskHandover, TaskHandoverInput } from './handover.ts'
10
9
  import { normalizeTaskIntegrations, type TaskBoardExtensionPayload } from './extension.ts'
11
10
  import { normalizeAttachments, type TaskAttachment } from './attachment.ts'
@@ -134,14 +133,6 @@ export interface ExecutionRecord {
134
133
  * informational, and every field above is what the board decides with.
135
134
  */
136
135
  summary?: ExecutionSummary
137
- /**
138
- * Goal acceptance state of this execution (task-board goal verification).
139
- * Fixed when the execution starts and never rewritten from later settings:
140
- * the contract is frozen here, the attempts accrue here, and the settlement
141
- * rule reads the pass record here. Absent on an execution that started
142
- * before the feature existed, which keeps it on the historical verdict.
143
- */
144
- verification?: ExecutionVerification
145
136
  }
146
137
 
147
138
  /**
@@ -493,32 +484,6 @@ export interface TaskRecord {
493
484
  * run group it opened before this behavior changed.
494
485
  */
495
486
  teamRun?: boolean
496
- /**
497
- * Start every execution of this task with dsh's built-in `/goal` command,
498
- * armed with the composed execution prompt as its objective. The session then
499
- * keeps working automatic continuation rounds until the agent marks the goal
500
- * complete, and this board settles the execution on the goal's own end
501
- * instead of at the first turn end. Absent means OFF — the option is
502
- * unchecked by default, so only an explicit `true` joins the goal run and
503
- * every card that never touched it (including every card written before the
504
- * field existed) runs one plain turn. A session whose `/goal` command is
505
- * refused still runs the prompt.
506
- */
507
- goalRun?: boolean
508
- /**
509
- * Run this task's goal executions WITHOUT the board's acceptance gate.
510
- *
511
- * Absent means INHERIT: the execution's applicability is decided by the
512
- * board-wide `goalVerification` switch frozen at start, exactly as a card
513
- * that never touched this option behaves. Only an explicit `true` opts the
514
- * card out, and the execution records `applicability: 'disabled'` so the
515
- * report says plainly that nothing certified this run.
516
- *
517
- * The opt-out is per execution, not per run: flipping it never rewrites the
518
- * verdict rule of an execution already open, and a rerun or a scheduled
519
- * occurrence reads the card's current value when it freezes its contract.
520
- */
521
- skipVerification?: boolean
522
487
  /**
523
488
  * Frozen context snapshot for a continuation card; absent on plain tasks.
524
489
  * Sanitized before it enters the ledger (redaction, slash-command taint,
@@ -625,16 +590,6 @@ export interface NewTaskInput {
625
590
  applyCardDefaults?: boolean
626
591
  /** Reuse the previous execution's session for later runs (issue #1419). */
627
592
  reuseSession?: boolean
628
- /**
629
- * Start the execution with dsh's built-in `/goal`. Absent means the default
630
- * (one plain turn); only an explicit true joins the goal run.
631
- */
632
- goalRun?: boolean
633
- /**
634
- * Run this task's goal executions without the acceptance gate; absent
635
- * inherits the board-wide `goalVerification` switch.
636
- */
637
- skipVerification?: boolean
638
593
  /**
639
594
  * Optional scheduling rule requested at creation time (the new-task
640
595
  * dialog): an enable flag, the kind of plan (a recurring 5-field cron
@@ -794,14 +749,6 @@ export function createTask(input: NewTaskInput, now: number, id: string): TaskRe
794
749
  model: normalizeTargetId(input.model),
795
750
  reasoningEffort: normalizeTargetId(input.reasoningEffort),
796
751
  reuseSession: input.reuseSession === true ? true : undefined,
797
- // Default OFF: only an explicit true is stored, so a card that never
798
- // touched the option (and every card written before the field existed)
799
- // keeps running one plain turn.
800
- goalRun: input.goalRun === true ? true : undefined,
801
- // Default OFF: only an explicit true is stored, so a card that never
802
- // touched the option inherits the board-wide acceptance switch exactly as
803
- // every card written before the field existed does.
804
- skipVerification: input.skipVerification === true ? true : undefined,
805
752
  ...(input.freeze === undefined ? {} : { freeze: freezeOf(input.freeze, now) }),
806
753
  ...(input.handover === undefined ? {} : { handover: { ...input.handover, bundledAt: now } }),
807
754
  ...(tags === undefined ? {} : { tags }),
@@ -17,7 +17,7 @@ import type { TaskHandoverInput } from '../handover.ts'
17
17
  * Editable fields on a task (the update patch surface). `freeze` replaces the
18
18
  * continuation-card snapshot (restamping frozenAt); an explicit null clears it.
19
19
  */
20
- export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt' | 'workspaceId' | 'mode' | 'permission' | 'model' | 'reasoningEffort' | 'reuseSession' | 'goalRun' | 'skipVerification'>> & {
20
+ export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt' | 'workspaceId' | 'mode' | 'permission' | 'model' | 'reasoningEffort' | 'reuseSession'>> & {
21
21
  freeze?: FreezeSnapshot & { redacted?: boolean } | null
22
22
  /** Replaces the handover bundle (restamping bundledAt); an explicit null clears it. */
23
23
  handover?: TaskHandoverInput | null
@@ -134,13 +134,6 @@ export function applyUpdateTask(
134
134
  // Session reuse is a boolean opt-in; false (or an explicit null from a
135
135
  // caller that needs to clear it) returns the task to one session per run.
136
136
  if ('reuseSession' in patch) next.reuseSession = patch.reuseSession === true ? true : undefined
137
- // The /goal opt-in is default-OFF: true joins the goal run, while false
138
- // (or an explicit null) returns the card to the default and stores nothing.
139
- if ('goalRun' in patch) next.goalRun = patch.goalRun === true ? true : undefined
140
- // The acceptance opt-out is the mirror image: default OFF, so only true
141
- // pins a card out of the gate; false (or an explicit null) returns it to
142
- // inheriting the board-wide switch and stores nothing.
143
- if ('skipVerification' in patch) next.skipVerification = patch.skipVerification === true ? true : undefined
144
137
  if (workspaceId !== undefined || 'workspaceId' in patch) next.workspaceId = workspaceId
145
138
  if (mode !== undefined || 'mode' in patch) next.mode = mode
146
139
  if (permission !== undefined || 'permission' in patch) next.permission = permission
@@ -172,10 +172,6 @@ function taskSummary(
172
172
  ...(task.reasoningEffort === undefined ? {} : { reasoningEffort: task.reasoningEffort }),
173
173
  ...(task.reuseSession === true ? { reuseSession: true } : {}),
174
174
  ...(task.teamRun === true ? { teamRun: true } : {}),
175
- // Default-OFF opt-in: only a card that asked for the goal run reports it.
176
- ...(task.goalRun === true ? { goalRun: true } : {}),
177
- // Default-OFF opt-out: the deviation is what a reader must be told.
178
- ...(task.skipVerification === true ? { skipVerification: true } : {}),
179
175
  ...(task.schedule === undefined ? {} : { schedule: scheduleView(task.schedule) }),
180
176
  ...(task.freeze === undefined ? {} : { continuationCard: true }),
181
177
  ...(task.permissionConfirmedAt === undefined ? {} : { permissionConfirmedAt: task.permissionConfirmedAt }),
@@ -362,7 +358,6 @@ function buildManageTool(host: TaskBoardToolHost): ToolDefinition {
362
358
  'A manual move writes the card column only and never fabricates an execution record, so the card reports a declaration rather than evidence of a run: done/failed declare work finished (or failed) outside a Host-run execution — human work, an external system, a decision made elsewhere — and running says the work is under way without a tracked session. Use task_board_run when the work should actually run in a session here.',
363
359
  'record-external-outcome is the record-backed version of move-done and move-failed: use it when YOU, or another agent outside this Host, actually finished or failed the card with your own model, so the terminal column and the run history both derive from one execution record. It takes result (succeeded or failed) and initiatedBy (who completed it, for example your own agent name) plus an optional summary, and it is refused while the card still has an open execution: the Host stays the only authority over a run it is executing. It cannot record running or cancelled — those remain Host-only. A parent card that dispatched its subtasks uses it once, at the end, to backfill every subtask card with the conclusion it reached; the Host records an inherited verdict on a subtask the parent never wrote back, so the write-back is what keeps each subtask conclusion its own.',
364
360
  'settle force-closes the open execution of a card the board can no longer observe (a stuck running card) and records it cancelled with the caller as the reason, so the card returns to the todo column and can be run again.',
365
- 'reset-verification clears the acceptance anomalies (timeouts, authentication failures, an unresolvable judge route, or an attempt the time budget ended) recorded on a card open execution, so the next update_goal(action: complete) runs a fresh acceptance. It is refused unless that execution really carries such anomalies, it never clears a quality verdict, and a spent anomaly budget otherwise HOLDS the card open instead of failing it: tell the user the acceptance environment is unusable and that this action is how they clear it once they have fixed it.',
366
361
  'archive takes the whole subtask tree off the board and is refused while any member has an unsettled execution; restore brings the task, its ancestors and its subtree back; delete removes one card and is refused while it still has subtasks (detach or delete them first) or while it runs.',
367
362
  'It cannot confirm a permission binding: the confirmation gate is a human act performed in the board UI.',
368
363
  ].join(' '),
@@ -371,7 +366,7 @@ function buildManageTool(host: TaskBoardToolHost): ToolDefinition {
371
366
  action: {
372
367
  type: 'string',
373
368
  required: true,
374
- enum: ['move-todo', 'move-backlog', 'move-running', 'move-done', 'move-failed', 'archive', 'restore', 'delete', 'settle', 'reset-verification', 'record-external-outcome'],
369
+ enum: ['move-todo', 'move-backlog', 'move-running', 'move-done', 'move-failed', 'archive', 'restore', 'delete', 'settle', 'record-external-outcome'],
375
370
  description: 'The lifecycle operation to perform.',
376
371
  },
377
372
  // Only record-external-outcome reads these two; every other action
@@ -432,7 +427,6 @@ function buildManageTool(host: TaskBoardToolHost): ToolDefinition {
432
427
  'move-failed': { kind: 'move', taskId: args.taskId, status: 'failed' },
433
428
  archive: { kind: 'archive', taskId: args.taskId },
434
429
  settle: { kind: 'settle', taskId: args.taskId },
435
- 'reset-verification': { kind: 'reset-verification', taskId: args.taskId },
436
430
  restore: { kind: 'restore', taskId: args.taskId },
437
431
  delete: { kind: 'delete', taskId: args.taskId },
438
432
  }
@@ -605,8 +599,6 @@ function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
605
599
  model: { type: 'string', description: 'Pinned model as provider/model (or a model id); omit to adopt the board new-card default, and the host default when none is configured.' },
606
600
  reasoningEffort: { type: 'string', description: 'Reasoning effort id for that model (an adapter-owned level such as "high"); omit to adopt the board new-card default for that model, and the model own default when none applies. Only an effort the target model declares is sent; an empty string clears it back to the default.' },
607
601
  reuseSession: { type: 'boolean', description: 'Continue later runs in the previous execution session instead of a fresh conversation.' },
608
- goalRun: { type: 'boolean', description: 'Start each run with dsh built-in /goal so the session keeps working continuation rounds until the goal completes. Off by default: omit (or pass false) for a single plain turn, and pass true to opt this card in. It only takes effect while the deployment global native /goal switch is on.' },
609
- skipVerification: { type: 'boolean', description: 'Run this task without the board acceptance gate: update_goal may mark the goal complete without a passing acceptance, and the execution record is marked skipped. Default false (omit to inherit the board-wide acceptance switch). Only affects executions started afterwards.' },
610
602
  tags: {
611
603
  type: 'array',
612
604
  description: 'Labels: the name renders as a badge and drives the board filter; promptPrefix is injected ahead of the execution prompt on every run.',
@@ -656,8 +648,6 @@ function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
656
648
  // targets the caller omitted are filled.
657
649
  applyCardDefaults: true,
658
650
  ...(args.reuseSession === true ? { reuseSession: true } : {}),
659
- ...(args.goalRun === true ? { goalRun: true } : {}),
660
- ...(args.skipVerification === true ? { skipVerification: true } : {}),
661
651
  ...(tags.length === 0 ? {} : { tags }),
662
652
  ...(args.schedule === undefined ? {} : {
663
653
  schedule: {
@@ -715,8 +705,6 @@ function buildUpdateTool(host: TaskBoardToolHost): ToolDefinition {
715
705
  model: { type: 'string', description: 'New pinned model; an empty string clears it.' },
716
706
  reasoningEffort: { type: 'string', description: 'New reasoning effort id for the pinned model; an empty string clears it back to the model own default. Only an effort the target model declares is sent at run time.' },
717
707
  reuseSession: { type: 'boolean', description: 'Continue later runs in the previous execution session.' },
718
- goalRun: { type: 'boolean', description: 'Whether each run starts with dsh built-in /goal (default false, one plain turn). Pass true to opt this card in, or false to return it to the default.' },
719
- skipVerification: { type: 'boolean', description: 'Whether this task runs without the board acceptance gate (default false, inherit the board-wide switch). Pass true to opt out; pass false to opt back in. Only affects executions started afterwards.' },
720
708
  tags: {
721
709
  type: 'array',
722
710
  description: 'Replacement label set; an empty array clears all labels.',
@@ -748,8 +736,6 @@ function buildUpdateTool(host: TaskBoardToolHost): ToolDefinition {
748
736
  patch.permission = args.permission === '' ? undefined : args.permission
749
737
  }
750
738
  if (has(args, 'reuseSession')) patch.reuseSession = args.reuseSession === true
751
- if (has(args, 'goalRun')) patch.goalRun = args.goalRun === true ? true : false
752
- if (has(args, 'skipVerification')) patch.skipVerification = args.skipVerification === true ? true : false
753
739
  if (has(args, 'tags')) {
754
740
  const tags = args.tags ?? []
755
741
  patch.tags = tags.length === 0
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * One-shot model dispatch for the board's Host half.
3
3
  *
4
- * The board makes two one-shot model calls: the goal-acceptance judge
5
- * (`verification-runner.ts`) and the "parse pasted text" action
6
- * (`host-ai.ts`). Both call the official `llm` service, and both must call it
4
+ * The board makes one one-shot model call: the "parse pasted text" action
5
+ * (`host-ai.ts`). It calls the official `llm` service, and it must call it
7
6
  * the way the official agent loop does.
8
7
  *
9
8
  * The runtime exposes two entry points with the same name shape. The public
@@ -20,9 +19,9 @@
20
19
  * so the guard's `for await (const chunk of next())` raised
21
20
  * `TypeError: next(...) is not a function or its return value is not async
22
21
  * iterable`. The agent loop was unaffected because it already dispatches
23
- * through `prepareCall(...).stream(...)`; the board's two one-shot calls were
24
- * not, and each completed acceptance was recorded as an anomaly
25
- * ("验收异常(裁判请求失败)") after two judge attempts.
22
+ * through `prepareCall(...).stream(...)`; the board's one-shot call was not,
23
+ * and the parse action failed with that TypeError until it dispatched the same
24
+ * way.
26
25
  *
27
26
  * Dispatching through the prepared call fixes that at the owner: the board no
28
27
  * longer depends on a mutable instance property that a plugin may legitimately
@@ -38,10 +37,9 @@ export type OneShotRequest = Pick<GenerateOptions, 'messages' | 'signal'> & Pick
38
37
  /**
39
38
  * The call config as this board's own domain types carry it.
40
39
  *
41
- * `VerificationRoute.reasoningEffort` and the parse route are plain strings (the
42
- * catalog publishes effort ids as strings), while the SDK brands them
43
- * nominally; the single crossing is branded here so no caller repeats the
44
- * assertion.
40
+ * The parse route's `reasoningEffort` and the catalog's effort ids are plain
41
+ * strings, while the SDK brands them nominally; the single crossing is branded
42
+ * here so no caller repeats the assertion.
45
43
  */
46
44
  export interface OneShotCallConfig {
47
45
  provider: string
@@ -31,7 +31,6 @@ import { applySetParent } from './core/use-cases/task-parent.ts'
31
31
  import { applyDeleteTag, applyRenameTag } from './core/use-cases/task-tag.ts'
32
32
  import { applyUpdateTask, canEditTaskContent, hasContentPatch } from './core/use-cases/task-update.ts'
33
33
  import { TASK_BOARD_MIGRATABLE_SCHEMA_VERSIONS, TASK_BOARD_SCHEMA_VERSION, TASK_BOARD_ZONE_STAMP_SCHEMA_VERSION, type TaskBoardAction, type TaskBoardSchedulerSnapshot } from './protocol.ts'
34
- import { withoutAcceptanceAnomalies, type ExecutionVerification } from './core/verification.ts'
35
34
  import { DEFAULT_SESSION_PERMISSION, requiresPermissionConfirmation, type TaskPermission } from './core/handover.ts'
36
35
 
37
36
  interface PersistedScheduler extends TaskBoardSchedulerSnapshot {
@@ -382,17 +381,7 @@ function mergeTask(a: TaskRecord, b: TaskRecord): TaskRecord {
382
381
  const previous = byId.get(entry.id)
383
382
  byId.set(entry.id, previous === undefined ? entry : betterExecution(previous, entry))
384
383
  }
385
- // Acceptance evidence is the one field "betterExecution" cannot choose: a
386
- // browser half that also wrote this execution carries no attempts, and taking
387
- // its copy would erase the Host's verdict. The copy with the most recorded
388
- // attempts wins, and one execution's verdict is never copied onto another.
389
- const executions = [...byId.values()].sort((x, y) => x.startedAt - y.startedAt).map(entry => {
390
- if (entry.verification !== undefined) return entry
391
- const richer = [...a.executions, ...b.executions]
392
- .filter(other => other.id === entry.id && other.verification !== undefined)
393
- .sort((x, y) => (y.verification?.attempts.length ?? 0) - (x.verification?.attempts.length ?? 0))[0]
394
- return richer?.verification === undefined ? entry : { ...entry, verification: richer.verification }
395
- })
384
+ const executions = [...byId.values()].sort((x, y) => x.startedAt - y.startedAt)
396
385
  return { ...newer, executions: retainRecentExecutions(executions) }
397
386
  }
398
387
 
@@ -1227,32 +1216,6 @@ export class HostTaskLedger {
1227
1216
  this.finalizeReadyRuns(false)
1228
1217
  break
1229
1218
  }
1230
- case 'reset-verification': {
1231
- // The explicit user reset of the acceptance anomaly counter (issue
1232
- // #1828). It clears the attempts the ENVIRONMENT produced — timeouts,
1233
- // authentication failures, unresolvable routes, and attempts the time
1234
- // budget ended — and nothing else: a quality verdict is the board's own
1235
- // judgement of the work and survives every reset. Only the open
1236
- // execution is addressable, because the reset exists to unblock a
1237
- // completion claim on a run that is still going.
1238
- const task = this.document.tasks.find(item => item.id === action.taskId)
1239
- if (task === undefined) throw new Error('task not found')
1240
- if (task.archivedAt !== undefined) throw new Error('archived task is read-only')
1241
- const execution = [...task.executions].reverse().find(entry => entry.endedAt === undefined)
1242
- if (execution === undefined) throw new Error('task has no open execution')
1243
- const verification = execution.verification
1244
- if (verification === undefined || verification.applicability !== 'enforced') {
1245
- throw new Error('this execution is not gated by task acceptance')
1246
- }
1247
- const cleared = withoutAcceptanceAnomalies(verification)
1248
- if (cleared === undefined) throw new Error('this execution has no acceptance anomaly to reset')
1249
- this.document.tasks = this.document.tasks.map(item => item.id !== action.taskId ? item : {
1250
- ...item,
1251
- updatedAt: now,
1252
- executions: item.executions.map(entry => entry.id === execution.id ? { ...entry, verification: cleared } : entry),
1253
- })
1254
- break
1255
- }
1256
1219
  case 'restore': {
1257
1220
  if (this.subtreeHasOpenExecution(action.taskId)) throw new Error('running task cannot be restored')
1258
1221
  const result = applyRestoreTask(this.document.tasks, action.taskId, now, this.maxSubtaskDepth)
@@ -1668,54 +1631,6 @@ export class HostTaskLedger {
1668
1631
  return this.normalizeDocument({ ...parsed, tasks: rows as TaskRecord[] })
1669
1632
  }
1670
1633
 
1671
- /**
1672
- * Find the still-open execution that ran in one session, with its task.
1673
- *
1674
- * The completion gate keys on the session id its tool call arrives from: the
1675
- * execution record is the only object binding a session to a card, and an
1676
- * already-settled execution is deliberately not returned (a session the board
1677
- * no longer owns must not be gated).
1678
- * @param sessionId - the DSH session the tool call runs in.
1679
- * @returns the open execution and its task, or undefined.
1680
- */
1681
- findOpenExecutionBySession(sessionId: string): { task: TaskRecord; execution: ExecutionRecord } | undefined {
1682
- if (sessionId === '') return undefined
1683
- for (const task of this.document.tasks) {
1684
- for (const execution of task.executions) {
1685
- if (execution.endedAt !== undefined) continue
1686
- if (execution.sessionId === sessionId) return { task, execution }
1687
- }
1688
- }
1689
- return undefined
1690
- }
1691
-
1692
- /**
1693
- * Replace one execution's acceptance block (creating it when absent).
1694
- *
1695
- * A no-op when the serialized value is unchanged, so a coarse caller that
1696
- * re-writes the same state never bumps the ledger revision. A settled
1697
- * execution keeps its record: the report of a finished cycle must survive,
1698
- * and only the board's own settlement moves the card.
1699
- * @param taskId - the task owning the execution.
1700
- * @param executionId - the execution to update.
1701
- * @param verification - the new block.
1702
- * @returns true when the ledger changed.
1703
- */
1704
- setVerification(taskId: string, executionId: string, verification: ExecutionVerification): boolean {
1705
- const now = this.now()
1706
- const task = this.document.tasks.find(item => item.id === taskId)
1707
- const execution = task?.executions.find(entry => entry.id === executionId)
1708
- if (task === undefined || execution === undefined) return false
1709
- if (JSON.stringify(execution.verification ?? null) === JSON.stringify(verification)) return false
1710
- this.document.tasks = this.document.tasks.map(item => item.id !== taskId ? item : {
1711
- ...item,
1712
- updatedAt: now,
1713
- executions: item.executions.map(entry => entry.id === executionId ? { ...entry, verification } : entry),
1714
- })
1715
- this.commit()
1716
- return true
1717
- }
1718
-
1719
1634
  private load(dir: string): LedgerDocument {
1720
1635
  const existed = existsSync(this.file)
1721
1636
  // schemaVersion stays unknown-typed here: on-disk documents may be v2 or
@@ -428,14 +428,14 @@ export function makeTaskBoardRoutes(
428
428
  }
429
429
  },
430
430
  }
431
- const verification: WebRoute = {
431
+ const modelCatalog: WebRoute = {
432
432
  kind: 'exact',
433
- path: `${TASK_BOARD_API_PREFIX}/verification`,
433
+ path: `${TASK_BOARD_API_PREFIX}/model-catalog`,
434
434
  handler: async (req, res): Promise<void> => {
435
435
  if (req.method !== 'GET') return writeJson(res, 405, { ok: false, error: 'method-not-allowed' }, { 'cache-control': 'no-store' })
436
436
  if (!guard(req, res)) return
437
437
  try {
438
- writeJson(res, 200, await service.verificationOptions(), { 'cache-control': 'no-store' })
438
+ writeJson(res, 200, await service.modelCatalogOptions(), { 'cache-control': 'no-store' })
439
439
  } catch (error) {
440
440
  writeJson(res, 500, { ok: false, error: error instanceof Error ? error.message : String(error) }, { 'cache-control': 'no-store' })
441
441
  }
@@ -520,5 +520,5 @@ export function makeTaskBoardRoutes(
520
520
  }
521
521
  },
522
522
  }
523
- return [state, action, events, parse, verification, attachmentUpload, attachmentImage]
523
+ return [state, action, events, parse, modelCatalog, attachmentUpload, attachmentImage]
524
524
  }