@sema-agent/core 7.16.0 → 7.17.1

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 (207) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/dist/agents/builtin-agents.d.ts +3 -3
  3. package/dist/agents/cross-session-envelope.d.ts +0 -1
  4. package/dist/agents/cross-session-envelope.js +0 -1
  5. package/dist/agents/peer-notices.d.ts +0 -9
  6. package/dist/agents/peer-notices.js +0 -63
  7. package/dist/agents/subagent.js +7 -15
  8. package/dist/brain/request-params.d.ts +2 -2
  9. package/dist/config/defaults.d.ts +0 -7
  10. package/dist/config/defaults.js +0 -2
  11. package/dist/core/artifact-host.d.ts +218 -0
  12. package/dist/core/artifact-host.js +92 -0
  13. package/dist/core/ask-origin.d.ts +29 -3
  14. package/dist/core/ask-origin.js +17 -9
  15. package/dist/core/ask-question.d.ts +25 -0
  16. package/dist/core/ask-question.js +4 -0
  17. package/dist/core/ask-unresolvable-notice.d.ts +30 -21
  18. package/dist/core/ask-unresolvable-notice.js +16 -8
  19. package/dist/core/auto-compaction.d.ts +10 -10
  20. package/dist/core/auto-mode-arming.d.ts +2 -2
  21. package/dist/core/background-agent-store.d.ts +5 -5
  22. package/dist/core/background-shell.d.ts +1 -1
  23. package/dist/core/checkpoint-execution-record.d.ts +0 -3
  24. package/dist/core/checkpoint-execution-record.js +0 -4
  25. package/dist/core/checkpoint-store.d.ts +71 -99
  26. package/dist/core/checkpoint-store.js +9 -16
  27. package/dist/core/context-edit.d.ts +36 -104
  28. package/dist/core/context-edit.js +37 -60
  29. package/dist/core/effective-path-target.d.ts +68 -8
  30. package/dist/core/effective-path-target.js +42 -30
  31. package/dist/core/engine-notice.d.ts +46 -32
  32. package/dist/core/env-budget.d.ts +31 -0
  33. package/dist/core/env-budget.js +39 -0
  34. package/dist/core/exec-output-tail.d.ts +5 -5
  35. package/dist/core/file-history-store.js +3 -6
  36. package/dist/core/fs-write-gate-policy.d.ts +1 -1
  37. package/dist/core/fs-write-gate-policy.js +3 -3
  38. package/dist/core/gate-lanes.js +9 -15
  39. package/dist/core/governance-codes.d.ts +1 -1
  40. package/dist/core/governance-codes.js +2 -0
  41. package/dist/core/hands-band.d.ts +1 -1
  42. package/dist/core/hooks.d.ts +18 -17
  43. package/dist/core/lsp-session.d.ts +1 -1
  44. package/dist/core/lsp.d.ts +1 -1
  45. package/dist/core/lsp.js +5 -4
  46. package/dist/core/mcp.d.ts +5 -5
  47. package/dist/core/mcp.js +4 -48
  48. package/dist/core/memory-engine/engine.js +2 -1
  49. package/dist/core/memory-engine/layout.d.ts +18 -6
  50. package/dist/core/memory-engine/layout.js +40 -21
  51. package/dist/core/memory-recall.d.ts +0 -8
  52. package/dist/core/memory.d.ts +1 -1
  53. package/dist/core/oracle-isolation.js +2 -2
  54. package/dist/core/parent-spec-seat.d.ts +66 -0
  55. package/dist/core/parent-spec-seat.js +47 -0
  56. package/dist/core/permission-rule-model.d.ts +11 -6
  57. package/dist/core/permission-rule-model.js +53 -37
  58. package/dist/core/permission-rules.js +8 -3
  59. package/dist/core/physical-path.d.ts +37 -0
  60. package/dist/core/physical-path.js +30 -0
  61. package/dist/core/protocol-naming.d.ts +2 -2
  62. package/dist/core/remote-env.d.ts +1 -1
  63. package/dist/core/retired-keys.d.ts +19 -0
  64. package/dist/core/retired-keys.js +15 -0
  65. package/dist/core/runner/active-skill-scope.js +3 -3
  66. package/dist/core/runner/assemble-result.d.ts +15 -13
  67. package/dist/core/runner/assemble-result.js +5 -4
  68. package/dist/core/runner/compaction-call-options.d.ts +25 -89
  69. package/dist/core/runner/contracts.d.ts +11 -10
  70. package/dist/core/runner/gate-exit.js +15 -1
  71. package/dist/core/runner/halt-attribution.d.ts +35 -0
  72. package/dist/core/runner/halt-attribution.js +16 -0
  73. package/dist/core/runner/memory-consolidation.d.ts +0 -2
  74. package/dist/core/runner/memory-consolidation.js +0 -1
  75. package/dist/core/runner/prepare-artifact.d.ts +52 -0
  76. package/dist/core/runner/prepare-artifact.js +63 -0
  77. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
  78. package/dist/core/runner/prepare-caps-and-workflow.js +2 -3
  79. package/dist/core/runner/prepare-config-doors.d.ts +3 -3
  80. package/dist/core/runner/prepare-config-doors.js +5 -2
  81. package/dist/core/runner/prepare-context-lane.d.ts +2 -2
  82. package/dist/core/runner/prepare-context-lane.js +2 -13
  83. package/dist/core/runner/prepare-file-history.d.ts +1 -1
  84. package/dist/core/runner/prepare-file-history.js +3 -52
  85. package/dist/core/runner/prepare-hands-readface.d.ts +4 -7
  86. package/dist/core/runner/prepare-hands-readface.js +3 -2
  87. package/dist/core/runner/prepare-inherited-gate.d.ts +5 -2
  88. package/dist/core/runner/prepare-inherited-gate.js +7 -8
  89. package/dist/core/runner/prepare-memory.d.ts +4 -6
  90. package/dist/core/runner/prepare-memory.js +4 -2
  91. package/dist/core/runner/prepare-policy-chain.d.ts +3 -3
  92. package/dist/core/runner/prepare-policy-chain.js +15 -30
  93. package/dist/core/runner/prepare-prompt-assembly.js +1 -1
  94. package/dist/core/runner/prepare-question-face.js +2 -1
  95. package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
  96. package/dist/core/runner/prepare-suspend-saga.js +0 -2
  97. package/dist/core/runner/prepare-task.js +12 -11
  98. package/dist/core/runner/prepare-wiring-manifest.js +9 -7
  99. package/dist/core/runner/resume-admission.js +2 -1
  100. package/dist/core/runner/resume-internals-and-config.js +4 -0
  101. package/dist/core/runner/retired-runner-deps.d.ts +3 -0
  102. package/dist/core/runner/retired-runner-deps.js +7 -0
  103. package/dist/core/runner/run-harness-handlers.js +5 -3
  104. package/dist/core/runner/run-settle-and-teardown.d.ts +1 -1
  105. package/dist/core/runner/run-settle-and-teardown.js +3 -1
  106. package/dist/core/runner/session-file-state-replay.js +3 -3
  107. package/dist/core/runner/session-rule-policy.js +3 -4
  108. package/dist/core/runner/stream-halt-verbs.js +1 -1
  109. package/dist/core/runner/stream-steer-verb.js +1 -4
  110. package/dist/core/runner/workspace-path.js +3 -0
  111. package/dist/core/runner-deps.d.ts +30 -49
  112. package/dist/core/safe-notify.d.ts +1 -1
  113. package/dist/core/sensitive-path-policy.d.ts +1 -1
  114. package/dist/core/sensitive-path-policy.js +11 -12
  115. package/dist/core/session.d.ts +2 -2
  116. package/dist/core/skill-tool-specifier.d.ts +1 -1
  117. package/dist/core/skills-directory.d.ts +1 -1
  118. package/dist/core/skills-directory.js +4 -3
  119. package/dist/core/spec-contract.js +5 -4
  120. package/dist/core/store-contracts/checkpoint-store-contract.js +1 -1
  121. package/dist/core/strategy-store.d.ts +8 -11
  122. package/dist/core/task-event.d.ts +20 -17
  123. package/dist/core/task-limits.d.ts +1 -1
  124. package/dist/core/task-notification.d.ts +5 -5
  125. package/dist/core/task-registry-agent.d.ts +5 -5
  126. package/dist/core/task-registry-monitor.d.ts +2 -2
  127. package/dist/core/task-registry-shared.d.ts +32 -28
  128. package/dist/core/task-registry-shared.js +4 -13
  129. package/dist/core/task-registry.d.ts +8 -8
  130. package/dist/core/task-result.d.ts +37 -37
  131. package/dist/core/task-spec.d.ts +5 -5
  132. package/dist/core/task-stream.d.ts +16 -11
  133. package/dist/core/tool-catalog-entries.d.ts +1 -0
  134. package/dist/core/tool-catalog-entries.js +6 -1
  135. package/dist/core/tool-conformance.d.ts +0 -2
  136. package/dist/core/tool-conformance.js +1 -3
  137. package/dist/core/tool-errors.d.ts +5 -0
  138. package/dist/core/tool-errors.js +1 -0
  139. package/dist/core/tool-policy.d.ts +66 -22
  140. package/dist/core/tool-policy.js +31 -5
  141. package/dist/core/tool-result-budget.d.ts +1 -1
  142. package/dist/core/tool-result-store.d.ts +11 -11
  143. package/dist/core/tool-spec.d.ts +34 -38
  144. package/dist/core/tools.d.ts +2 -2
  145. package/dist/core/trace.d.ts +12 -15
  146. package/dist/core/untrusted-text.d.ts +1 -1
  147. package/dist/core/wiring-manifest.d.ts +4 -3
  148. package/dist/core/workflow-journal-store.d.ts +11 -11
  149. package/dist/engine/execution-env/node-execution-env.d.ts +3 -2
  150. package/dist/engine/execution-env/node-execution-env.js +8 -5
  151. package/dist/engine/harness/agent-harness.d.ts +47 -4
  152. package/dist/engine/harness/agent-harness.js +52 -9
  153. package/dist/engine/loop/agent-loop.js +15 -8
  154. package/dist/engine/loop/types.d.ts +5 -0
  155. package/dist/index.d.ts +20 -14
  156. package/dist/index.js +16 -10
  157. package/dist/internal/harness.d.ts +1 -0
  158. package/dist/orchestration/run-spec.d.ts +3 -0
  159. package/dist/orchestration/run-spec.js +3 -3
  160. package/dist/orchestration/run-workflow-tool.d.ts +12 -6
  161. package/dist/orchestration/run-workflow-tool.js +23 -5
  162. package/dist/orchestration/workflow-primitives.d.ts +4 -2
  163. package/dist/orchestration/workflow-primitives.js +1 -4
  164. package/dist/orchestration/workflow-script-store.js +9 -25
  165. package/dist/orchestration/workflow-types.d.ts +34 -4
  166. package/dist/orchestration/workflow-types.js +2 -0
  167. package/dist/orchestration/workflow.d.ts +39 -7
  168. package/dist/orchestration/workflow.js +237 -113
  169. package/dist/prompt-assembly/assemble.d.ts +2 -2
  170. package/dist/prompt-assembly/assemble.js +9 -9
  171. package/dist/prompt-assembly/composer.d.ts +6 -7
  172. package/dist/prompt-assembly/composer.js +10 -10
  173. package/dist/prompt-assembly/epoch.js +1 -1
  174. package/dist/prompt-assembly/event-registry.d.ts +0 -21
  175. package/dist/prompt-assembly/packs/sema-default.js +30 -30
  176. package/dist/prompt-assembly/types.d.ts +14 -14
  177. package/dist/prompts/coordinator.d.ts +0 -13
  178. package/dist/prompts/coordinator.js +0 -3
  179. package/dist/stores/cc/task-list-store.js +2 -10
  180. package/dist/stores/file/checkpoint-store.js +1 -5
  181. package/dist/stores/file/file-history-store.js +2 -2
  182. package/dist/stores/file/fs-atomic.d.ts +15 -18
  183. package/dist/stores/file/fs-atomic.js +4 -14
  184. package/dist/stores/file/mailbox-store.d.ts +7 -11
  185. package/dist/stores/file/mailbox-store.js +4 -11
  186. package/dist/stores/file/permission-rule-store.d.ts +4 -35
  187. package/dist/stores/file/permission-rule-store.js +4 -148
  188. package/dist/tools/artifact/artifact-text.d.ts +62 -0
  189. package/dist/tools/artifact/artifact-text.js +68 -0
  190. package/dist/tools/artifact/artifact-tool.d.ts +52 -0
  191. package/dist/tools/artifact/artifact-tool.js +351 -0
  192. package/dist/tools/artifact/local-stub.d.ts +26 -0
  193. package/dist/tools/artifact/local-stub.js +297 -0
  194. package/dist/tools/fs/bash-readonly-classifier.d.ts +90 -8
  195. package/dist/tools/fs/bash-readonly-classifier.js +294 -70
  196. package/dist/tools/fs/fs-bash.d.ts +14 -10
  197. package/dist/tools/fs/fs-bash.js +50 -33
  198. package/dist/tools/fs/fs-search-tools.js +5 -2
  199. package/dist/tools/fs/fs-shared.d.ts +2 -0
  200. package/dist/tools/fs/fs-shared.js +3 -11
  201. package/dist/tools/fs/index.d.ts +4 -0
  202. package/dist/tools/fs/index.js +4 -1
  203. package/dist/tools/fs/safety.d.ts +117 -1
  204. package/dist/tools/fs/safety.js +131 -31
  205. package/dist/tools/fs/search.js +8 -6
  206. package/package.json +2 -1
  207. package/test/export-surface.snapshot.json +119 -39
@@ -1,7 +1,7 @@
1
1
  import type { TaskNotificationPayload } from "./task-notification.js";
2
2
  import { type RegistryCore, type RegisterMonitorInput, type MonitorTaskHandle, type UnifiedTaskResult } from "./task-registry-shared.js";
3
3
  export declare function registerMonitorLane(core: RegistryCore, input: RegisterMonitorInput): string;
4
- /** RB-239: ONE absorption arithmetic for a monitor poll — env-side-loss accounting
4
+ /** ONE absorption arithmetic for a monitor poll — env-side-loss accounting
5
5
  * (RB-238), the spool roll (registry memory bound) and the completed-line split — shared by the
6
6
  * watcher tick and the stop-time final drain. A hand-copied twin in stopMonitor is how half-fixes
7
7
  * happen: any change to the roll/line rules must reach both consumers through this method. Returns
@@ -12,7 +12,7 @@ export declare function absorbMonitorPollLane(handle: MonitorTaskHandle, v: {
12
12
  truncated?: boolean;
13
13
  bytesDroppedBeforeCursor?: number;
14
14
  }): string[];
15
- /** RB-239: the swallow-guarded event sink, shared by the watcher's emits and the stop-time drain. */
15
+ /** The swallow-guarded event sink, shared by the watcher's emits and the stop-time drain. */
16
16
  export declare function emitMonitorEventLane(handle: MonitorTaskHandle, n: TaskNotificationPayload): void;
17
17
  /** The monitor watcher tick loop. Same zombie-proofing discipline as {@link startBashWatcher}
18
18
  * (re-entrancy guard / stop on eviction / stop on vanished shell / stop on a throwing adapter),
@@ -22,7 +22,7 @@ export type SemaTaskStatus = "pending" | "running" | "parked" | "completed" | "f
22
22
  export type TaskRetrievalStatus = "success" | "not_ready" | "timeout";
23
23
  export interface UnifiedTaskOutput {
24
24
  task_id: string;
25
- /** RB-92 (2026-07-25, red probe): `"unknown"` is a DECLARED member here, not a stray literal. A
25
+ /** `"unknown"` is a DECLARED member here, not a stray literal. A
26
26
  * not-found lookup has no task kind to report, and the TaskStop envelope's `task_type` is required by
27
27
  * the client schema — so the wrapper was already emitting `"unknown"` while the type said it could
28
28
  * only be a `SemaTaskType`. Declaring it keeps the two honest with each other, and keeps `SemaTaskType`
@@ -40,7 +40,11 @@ export interface UnifiedTaskOutput {
40
40
  code?: string;
41
41
  /** RB-386② — machine-readable failure code on a FAILED background_agent row's poll
42
42
  * details (the child's TaskResult.errorCode taxonomy — brain codes / `limit.*` / `budget.*` …).
43
- * Additive; absent on non-failed rows, on rows whose failure carried no code, and on other lanes. */
43
+ * Additive; absent on non-failed rows, on rows whose failure carried no code, and on other lanes.
44
+ * The same key also carries a failed WORKFLOW run's `WorkflowRun.errorCode` (
45
+ * `workflow.*` for the orchestration's own refusals / a failed child's terminal code), populated
46
+ * by `formatWorkflowRun`: one field name for "why this poll answer is a failure", whichever lane
47
+ * minted the failure. */
44
48
  errorCode?: string;
45
49
  /** RB-386② — retryability verdict for a FAILED background_agent row, derived at settle time by the
46
50
  * same classifier the sync sub-agent report's `error_kind (retryable: …)` line uses. Additive. */
@@ -146,7 +150,7 @@ export interface BackgroundBashTaskHandle extends SemaTaskHandle {
146
150
  * `mirrorFailed` records that at least one append to the advertised output FILE failed — the terminal
147
151
  * frame then discloses the file as incomplete instead of letting the launch receipt's "full output is
148
152
  * appended there" promise stand over a silently partial file. */
149
- /** RB-238: `droppedBytes`/`dropUnknown` account ENV-SIDE tail-buffer eviction disclosed by
153
+ /** `droppedBytes`/`dropUnknown` account ENV-SIDE tail-buffer eviction disclosed by
150
154
  * the poll (`bytesDroppedBeforeCursor`/`truncated`) — a loss upstream of (and distinct from) the
151
155
  * registry's own `rolledChars` memory bound. Bytes counted here never reached the spool at all. */
152
156
  spool?: {
@@ -182,7 +186,7 @@ export interface WorkflowTaskHandle extends SemaTaskHandle {
182
186
  store?: WorkflowRunStore;
183
187
  /** B-1 (live leg) — see {@link RegisterWorkflowInput.originatingSessionId}. */
184
188
  originatingSessionId?: string;
185
- /** RB-215: design/129 session-lifetime discipline, extended to workflow — the
189
+ /** Design/129 session-lifetime discipline, extended to workflow — the
186
190
  * ONE background kind that never had it (`background_bash`/`monitor`/`background_agent` all do).
187
191
  * Unlike those three (task-scoped BY DEFAULT, `sessionScoped` an explicit opt-in via
188
192
  * `TaskSpec.backgroundScope`), a workflow is unconditionally session-anchored — `originatingSessionId`
@@ -198,7 +202,7 @@ export interface WorkflowTaskHandle extends SemaTaskHandle {
198
202
  sessionScoped?: true;
199
203
  /** See {@link RegisterWorkflowInput.onServedTerminal}. Cleared after the single fire. */
200
204
  onServedTerminal?: () => void;
201
- /** 复审 r2 MAJOR: the bounded return value, captured on the done-hook so the STORE-LESS in-memory lane's
205
+ /** The bounded return value, captured on the done-hook so the STORE-LESS in-memory lane's
202
206
  * terminal poll can hand it over too (the launch note promises it; without a store there was no result). */
203
207
  result?: string;
204
208
  /** T2A-8: the failure reason (bounded + redacted), captured on the done-hook's rejection so a store-less
@@ -232,7 +236,7 @@ export interface BackgroundAgentTaskHandle extends SemaTaskHandle {
232
236
  type: "background_agent";
233
237
  /** design/115 P3: aborting this cancels the child run (TaskStop / parent teardown). */
234
238
  abort: AbortController;
235
- /** RB-236 — lineage axes, declared (registration always spread them into the handle; readers used
239
+ /** Lineage axes, declared (registration always spread them into the handle; readers used
236
240
  * to cast). `rootSessionId` feeds {@link canAccess}'s root-session arm; the other two stay
237
241
  * read-only lineage metadata on the live face (no parentSessionId access arm — see the arm's
238
242
  * comment for why). The register side clamps `parentTaskId`. */
@@ -313,7 +317,7 @@ export interface BackgroundAgentTaskHandle extends SemaTaskHandle {
313
317
  /** Terminal snapshot (bounded, {@link BG_AGENT_RESULT_MAX} in subagent.ts) — served by TaskOutput
314
318
  * once the child finishes. */
315
319
  result?: string;
316
- /** RB-205-B: the FULL result (bounded only by the defensive {@link BG_AGENT_RESULT_FULL_MAX} ceiling
320
+ /** The FULL result (bounded only by the defensive {@link BG_AGENT_RESULT_FULL_MAX} ceiling
317
321
  * in subagent.ts), set ONLY when it differs from `result` — same shape as {@link WorkflowRun.resultFull}
318
322
  * (workflow.ts NH-1). Before this field existed, the settle call sites pre-sliced `child.result` to
319
323
  * ~2-4K chars with no disclosure — clipTaskOutput's own file-pointer/offload-friendly design at the
@@ -350,7 +354,7 @@ export interface BackgroundAgentTaskHandle extends SemaTaskHandle {
350
354
  * overloaded/timeout/network ⇒ true, logic ⇒ false). Stored rather than re-derived so the core
351
355
  * poll lane never has to import the agents-domain classifier (no new domain cycle). */
352
356
  errorRetryable?: boolean;
353
- /** RB-405 — the coarse classification KIND beside `errorRetryable`
357
+ /** The coarse classification KIND beside `errorRetryable`
354
358
  * (classifySubagentError's error_kind ∈ rate_limit/overloaded/timeout/network/logic), threaded
355
359
  * from the same settle mint point and stored for the same no-domain-cycle reason as its sibling.
356
360
  * Rendered on the FAILED row's poll TEXT face as the `(error_kind: …, retryable: …)` clause —
@@ -421,7 +425,7 @@ export interface MonitorTaskHandle extends SemaTaskHandle {
421
425
  lineBuf: string;
422
426
  /** Per-batch monotonic counter → unique notification dedup keys (see task-notification.ts). */
423
427
  seq: number;
424
- /** RB-334 (CC `PCo`/`TIs` 220:403278-403321): the TWO-LEVEL event-storm control's state.
428
+ /** The TWO-LEVEL event-storm control's state.
425
429
  * Level 1 = a token bucket (`stormTokens` out of `stormBurst`, refilled one per
426
430
  * `stormRefillIntervalMs`): a batch that cannot consume a token is SUPPRESSED (its lines stay in the
427
431
  * re-readable spool) and counted in `suppressedBatches`; the next batch that DOES consume one first
@@ -452,7 +456,7 @@ export interface MonitorTaskHandle extends SemaTaskHandle {
452
456
  deadlineAt?: number;
453
457
  timeoutMs?: number;
454
458
  watcher?: unknown;
455
- /** RB-239: a watcher tick is suspended on its pollBackground await RIGHT NOW. The stop-time
459
+ /** A watcher tick is suspended on its pollBackground await RIGHT NOW. The stop-time
456
460
  * final drain must skip its own poll then (that in-flight tick already consumed the env cursor — and a
457
461
  * never-resolving adapter must not pin TaskStop). Set/cleared in lockstep with the tick's re-entrancy
458
462
  * guard. */
@@ -486,7 +490,7 @@ export interface MonitorTaskHandle extends SemaTaskHandle {
486
490
  /** design/158 S2 — cumulative chars (UTF-16 code units, `string.length`) handed to `store.put`
487
491
  * across every segment this handle has spilled so far (both streams combined) — the per-handle
488
492
  * disk-cap accounting ({@link import("./task-registry-monitor.js")} reads `MONITOR_SPILL_CAP_CHARS`
489
- * against this). RB-396-b: the field used to be named `spillBytesUsed` while the ledger counted
493
+ * against this). The field used to be named `spillBytesUsed` while the ledger counted
490
494
  * chars — renamed to the axis it really measures (see the constant's own doc for why chars). */
491
495
  spillCharsUsed?: number;
492
496
  /** design/158 S2 — the per-handle spill cap (`MONITOR_SPILL_CAP_CHARS`) was reached; further
@@ -518,10 +522,10 @@ export interface RegisterMonitorInput extends TaskAccess {
518
522
  timers?: MonitorTimers;
519
523
  /** Batch window (ms, default 200): lines arriving within one tick coalesce into one notification. */
520
524
  batchWindowMs?: number;
521
- /** RB-334: the SUSTAINED batch rate the storm bucket refills at (default 50/min). Exceeding it is
525
+ /** The SUSTAINED batch rate the storm bucket refills at (default 50/min). Exceeding it is
522
526
  * suppression, not death — see `stormBurst` and MONITOR_STORM_KILL_AFTER_MS. */
523
527
  maxBatchesPerMinute?: number;
524
- /** RB-334: burst capacity of the storm bucket (default MONITOR_STORM_BURST = CC's 10). */
528
+ /** Burst capacity of the storm bucket (default MONITOR_STORM_BURST = CC's 10). */
525
529
  stormBurst?: number;
526
530
  now?: number;
527
531
  /** design/158 S2 (RB-364 半) — the offload store a rolled-off spool middle spills to (see
@@ -563,23 +567,23 @@ export declare const MONITOR_BATCH_WINDOW_MS = 200;
563
567
  export declare const MONITOR_DEFAULT_TIMEOUT_MS = 300000;
564
568
  export declare const MONITOR_MAX_TIMEOUT_MS = 3600000;
565
569
  export declare const MONITOR_MAX_BATCHES_PER_MINUTE = 50;
566
- /** RB-334 (CC `bIs` 220:403421): burst capacity of the storm token bucket — how many batches may fire
570
+ /** Burst capacity of the storm token bucket — how many batches may fire
567
571
  * back-to-back before the SUPPRESSION level engages. CC value, adopted verbatim. */
568
572
  export declare const MONITOR_STORM_BURST = 10;
569
- /** RB-334 (CC `FN_` 220:403423): how long a monitor must stay CONTINUOUSLY over budget before the
573
+ /** How long a monitor must stay CONTINUOUSLY over budget before the
570
574
  * second level (kill) fires. CC value, adopted verbatim. */
571
575
  export declare const MONITOR_STORM_KILL_AFTER_MS = 30000;
572
- /** RB-334 (CC `bdd` 220:403427): the partial-line accumulator bound. sema's `lineBuf` had NO bound —
576
+ /** The partial-line accumulator bound. sema's `lineBuf` had NO bound —
573
577
  * a monitored process emitting megabytes without a single newline grew it without limit (the spool's
574
578
  * own roll never covered it). Keep the TAIL (the newest bytes are the ones a watch is about). */
575
579
  export declare const MONITOR_LINE_BUF_CAP = 1048576;
576
- /** RB-239: the monitor event-result clip, shared by the watcher's batch/terminal emits and
580
+ /** The monitor event-result clip, shared by the watcher's batch/terminal emits and
577
581
  * the stop-time drain emit (one clip, one truncation wording). */
578
582
  export declare function clipMonitorEvent(s: string): string;
579
- /** RB-334 (CC `DCo` leg): per-line clip applied to the `lines[]` a batch carries. Spool untouched. */
583
+ /** Per-line clip applied to the `lines[]` a batch carries. Spool untouched. */
580
584
  export declare function clipMonitorLine(s: string): string;
581
585
  /**
582
- * RB-335 (CC `rFs` 220:507725-507743, all six branches verbatim): the ONE terminal-notification summary
586
+ * The ONE terminal-notification summary
583
587
  * HEAD for a background command / monitor watch. Every terminal frame in the bash and monitor lanes
584
588
  * composes its summary as `terminalTaskSummary(...)` plus this lane's own honest detail clause — the
585
589
  * pre-RB-335 code had six hand-written phrasings whose comment claimed "no CC sample for those faces"
@@ -619,14 +623,14 @@ export declare function rollSpoolText(spool: {
619
623
  * matching the pre-S2 loss shape for whatever is dropped PAST the cap. Exported so the boundary is a
620
624
  * testable contract, not a buried literal.
621
625
  *
622
- * RB-396-b (回溯复查批, [c209-C] R2 C4① char/byte 同名异轴族): the constant used to be named
626
+ * The constant used to be named
623
627
  * `..._BYTES` while the ledger added `dropped.length` — chars, up to ~3× fewer than UTF-8 bytes on
624
628
  * multibyte content. CHARS is the axis kept (name changed, arithmetic untouched) because it is the
625
629
  * offload store family's own coordinate (`InMemoryToolResultStore.maxTotalChars` evicts by
626
630
  * `content.length`; `ToolResultSlice.totalChars`) and the spool's `rolledChars` axis — one unit
627
631
  * end-to-end; a `Buffer.byteLength` ledger here would sit crosswise to the store's own cap. */
628
632
  export declare const MONITOR_SPILL_CAP_CHARS: number;
629
- /** RB-238: fold one poll's env-side-loss disclosure into the spool's account. The env's
633
+ /** Fold one poll's env-side-loss disclosure into the spool's account. The env's
630
634
  * tail buffer evicts its HEAD under pressure (node-execution-env 8MB bound) — those bytes are gone
631
635
  * before any watcher ever saw them, which is a different loss than the registry-side `rolledChars`
632
636
  * middle-drop. `bytesDroppedBeforeCursor` only counts bytes dropped before an unconsumed cursor, so
@@ -645,7 +649,7 @@ export declare function accountDroppedBytes(spool: {
645
649
  truncated?: boolean;
646
650
  bytesDroppedBeforeCursor?: number;
647
651
  }): void;
648
- /** RB-238 — the POLL-FACE wording for env-side loss (the terminal/event-frame wording is
652
+ /** The POLL-FACE wording for env-side loss (the terminal/event-frame wording is
649
653
  * {@link droppedGapNote}'s; the two faces differ by design and always have). One function so the two
650
654
  * quantified/unquantified branches cannot drift between the three legs that render it: the monitor
651
655
  * re-readable spool, the bash re-readable spool, and the bash blocked wait. Trailing newline included
@@ -686,7 +690,7 @@ export interface SpoolBodyOptions {
686
690
  /** A full banner line (own trailing newline) rendered after the drop note, or "". */
687
691
  drainNote: string;
688
692
  }
689
- /** RB-238/RB-239/RB-240 — the ONE renderer for a re-readable spool's TaskOutput body,
693
+ /** The ONE renderer for a re-readable spool's TaskOutput body,
690
694
  * shared by the monitor lane (pollMonitorLane) and the bash spool lane (pollBackgroundBash).
691
695
  *
692
696
  * Both faces were hand-copied twins carrying three real disclosure bugs' worth of wording (env-side
@@ -700,19 +704,19 @@ export interface SpoolBodyOptions {
700
704
  * wording ("accumulated char(s) dropped from the middle during the blocked wait"), an intentional
701
705
  * divergence — it shares {@link accountDroppedBytes} + {@link spoolDropNote}, not this. */
702
706
  export declare function renderSpoolBody(spool: RenderableSpool, opts: SpoolBodyOptions): string;
703
- /** RB-238: the honesty suffix for frames over a spool with env-side loss. Empty when nothing dropped. */
707
+ /** The honesty suffix for frames over a spool with env-side loss. Empty when nothing dropped. */
704
708
  export declare function droppedGapNote(spool: {
705
709
  droppedBytes?: number;
706
710
  dropUnknown?: true;
707
711
  }): string;
708
- /** RB-238: the event-stream disclosure rides the FIRST batch after a loss is observed (once-latch —
712
+ /** The event-stream disclosure rides the FIRST batch after a loss is observed (once-latch —
709
713
  * a chatty watch must not repeat the note on every batch; terminal frames disclose unconditionally). */
710
714
  export declare function firstDropNote(spool: {
711
715
  droppedBytes?: number;
712
716
  dropUnknown?: true;
713
717
  dropNotified?: true;
714
718
  }): string;
715
- /** RB-244: ONE wording for "you stopped nothing" across every already-terminal stop face —
719
+ /** ONE wording for "you stopped nothing" across every already-terminal stop face —
716
720
  * the in-process bash/monitor/agent arms and the durable-row fallback previously split: the durable
717
721
  * arm answered honestly while the in-process arms claimed `Terminated <id>.` over work that finished
718
722
  * (or was killed) on its own. CC 220 refuses the call outright (`Task X is not running (status: …)`,
@@ -781,7 +785,7 @@ export declare function editDistance(a: string, b: string): number;
781
785
  /** CC `htr` shape (206:519814-519827): candidates within Levenshtein ≤2 (length-diff ≤2 pre-filter),
782
786
  * best-first; the single best is the "Did you mean" suggestion (`htr(e, keys, 1)[0]`, 206:575196). */
783
787
  export declare function closestName(query: string, candidates: Iterable<string>): string | undefined;
784
- /** Ruled 2026-07-22: DEFAULT-DENY on BOTH axes — the old predicate skipped
788
+ /** DEFAULT-DENY on BOTH axes — the old predicate skipped
785
789
  * a missing axis (owner-less handle = readable by everyone in scope; scope-less handle = readable
786
790
  * across scopes), splitting polarity with `canAccessAgentRecord` and re-opening the session-axis
787
791
  * class cli/server just swept. Registration now REQUIRES both axes ({@link assertOwnership}), so a
@@ -822,7 +826,7 @@ export interface ParkedClaimTicket {
822
826
  reservedRev: number;
823
827
  row: import("./background-agent-store.js").BackgroundAgentRecord;
824
828
  }
825
- /** P1-3 独立复审第三轮(已修) — sibling of {@link mintCompletionId} for a caller that must compute the
829
+ /** Sibling of {@link mintCompletionId} for a caller that must compute the
826
830
  * value BEFORE it is safe to commit (a CAS not yet known to win): fill-once with an EXTERNALLY-chosen
827
831
  * value instead of generating a fresh one. Exists because `rollbackParkedClaim`'s original fix minted
828
832
  * directly onto the live handle before its durable CAS was confirmed — a losing CAS then left a
@@ -2,8 +2,8 @@ import { uuidv7 } from "../internal/harness.js";
2
2
  import { summarizeWorkflowRun } from "./workflow-run-store.js";
3
3
  import { delimitUntrusted } from "./untrusted-text.js";
4
4
  import { boundedRedactedSummary } from "./untrusted-egress.js";
5
- import { clipWithFilePointer } from "./tool-errors.js";
6
- import { announceEnvKnob } from "./env-knob-announce.js";
5
+ import { clipWithFilePointer, OUTPUT_BUDGET_MIN_CHARS } from "./tool-errors.js";
6
+ import { resolveEnvBudget } from "./env-budget.js";
7
7
  export function mintCompletionId(target) {
8
8
  if (target.completionId === undefined)
9
9
  target.completionId = uuidv7();
@@ -60,18 +60,8 @@ export function terminalTaskSummary(kind, label, status, exitCode) {
60
60
  }
61
61
  const TASK_OUTPUT_DEFAULT_CHARS = 32_000;
62
62
  export const TASK_OUTPUT_MAX_CHARS = 160_000;
63
- const TASK_OUTPUT_MIN_CHARS = 512;
64
63
  function taskMaxOutputChars() {
65
- const rawEnv = process.env.TASK_MAX_OUTPUT_LENGTH;
66
- if (rawEnv === undefined || rawEnv.trim() === "")
67
- return TASK_OUTPUT_DEFAULT_CHARS;
68
- const raw = rawEnv.trim();
69
- const n = /^\d+$/.test(raw) ? parseInt(raw, 10) : Number.NaN;
70
- if (!Number.isFinite(n) || n <= 0) {
71
- announceEnvKnob(`TASK_MAX_OUTPUT_LENGTH=${rawEnv} was ignored — it is not a positive whole number of characters. Using ${TASK_OUTPUT_DEFAULT_CHARS} instead.`);
72
- return TASK_OUTPUT_DEFAULT_CHARS;
73
- }
74
- return Math.min(Math.max(n, TASK_OUTPUT_MIN_CHARS), TASK_OUTPUT_MAX_CHARS);
64
+ return resolveEnvBudget(process.env.TASK_MAX_OUTPUT_LENGTH, { name: "TASK_MAX_OUTPUT_LENGTH", unit: "characters", default: TASK_OUTPUT_DEFAULT_CHARS, min: OUTPUT_BUDGET_MIN_CHARS, max: TASK_OUTPUT_MAX_CHARS });
75
65
  }
76
66
  export function clipTaskOutput(s, fullOutputPath) {
77
67
  return clipWithFilePointer(s, taskMaxOutputChars(), fullOutputPath);
@@ -269,6 +259,7 @@ export function formatWorkflowRun(run) {
269
259
  status: run.status,
270
260
  retrieval_status: "success",
271
261
  ...(run.completionId !== undefined ? { completionId: run.completionId } : {}),
262
+ ...(run.errorCode !== undefined ? { errorCode: run.errorCode } : {}),
272
263
  details: summary,
273
264
  },
274
265
  };
@@ -53,7 +53,7 @@ export interface TaskPollOptions {
53
53
  timeoutMs?: number;
54
54
  /** Abort signal — a blocked wait must stop when the tool call is cancelled. */
55
55
  signal?: AbortSignal;
56
- /** RB-220 — mirrors {@link import("./types.js").TaskSpec.oneShot} (see {@link TaskToolOptions.oneShot}
56
+ /** Mirrors {@link import("./types.js").TaskSpec.oneShot} (see {@link TaskToolOptions.oneShot}
57
57
  * for the full contract): forwarded to the background_agent lane's still-running poll body so it
58
58
  * does not teach "you will be notified" when this run has no later turn to receive one. */
59
59
  oneShot?: boolean;
@@ -88,7 +88,7 @@ export interface TaskToolOptions extends TaskAccess {
88
88
  * historical wording); prepare-task passes the real wiring state. */
89
89
  notificationWired?: boolean;
90
90
  /**
91
- * RB-220 — mirrors {@link import("./types.js").TaskSpec.oneShot}: this run has no later turn for an
91
+ * Mirrors {@link import("./types.js").TaskSpec.oneShot}: this run has no later turn for an
92
92
  * async background notification to land in (a headless `-p` process exits once the turn ends).
93
93
  * Threaded into the background_agent lane's non-blocking/blocked-timeout "still running" poll body
94
94
  * (see {@link import("./task-registry-agent.js").pollBackgroundAgentLane}), which otherwise taught
@@ -122,7 +122,7 @@ export interface AccessibleTaskRow {
122
122
  parentTaskId?: string;
123
123
  parentSessionId?: string;
124
124
  rootSessionId?: string;
125
- /** RB-478 — the row's registration instant (the original spawn time for a first-cycle row): the
125
+ /** The row's registration instant (the original spawn time for a first-cycle row): the
126
126
  * revive projection needs it so a revive frame's `startedAt` anchors the ROW, not the wake call. */
127
127
  createdAt?: number;
128
128
  }
@@ -139,11 +139,11 @@ export declare class TaskRegistry {
139
139
  * (cap overflow dropped the watcher; the owner's tasks may still be running — the subscriber must
140
140
  * NOT treat this as quiescence). */
141
141
  private bgQuiescenceWatchers;
142
- /** RB-463 — one host-callback isolation scope for this registry's five notification seams (reap terminal
142
+ /** One host-callback isolation scope for this registry's five notification seams (reap terminal
143
143
  * notifier, session-reap hooks, quiescence fire + cap-overflow eviction, terminal-once send). Same swallow
144
144
  * as the five hand-written try/catches it replaced, now counted per site and readable for diagnostics. */
145
145
  private readonly notifier;
146
- /** RB-473 — the read face for this registry's CONTAINED host-callback failures (site → count).
146
+ /** The read face for this registry's CONTAINED host-callback failures (site → count).
147
147
  * The registry has no deployment error sink of its own to disclose to (it is process-global,
148
148
  * constructed before any RunnerDeps exists), so readability IS its disclosure grade: a deployment
149
149
  * that suspects a broken observer polls this instead of grepping for silence. Empty on the
@@ -241,7 +241,7 @@ export declare class TaskRegistry {
241
241
  agentStore: import("./background-agent-store.js").BackgroundAgentStore;
242
242
  }, ticket: ParkedClaimTicket): Promise<boolean>;
243
243
  finalizeParkedResume(id: string): void;
244
- /** RB-425: `outcome.cycle` names the revive cycle this settle speaks for (absent = 0 = the original
244
+ /** `outcome.cycle` names the revive cycle this settle speaks for (absent = 0 = the original
245
245
  * spawn cycle). A spawn leg never passes it; a caller that settles by LIFECYCLE AUTHORITY (reap /
246
246
  * session release — "whatever is running under this row dies") passes the row's current cycle. See
247
247
  * {@link settleBackgroundAgentLane} for why a stale stamp must be a no-op. */
@@ -283,7 +283,7 @@ export declare class TaskRegistry {
283
283
  suggestion?: string;
284
284
  };
285
285
  markRetainedContinuation(id: string): void;
286
- /** #258 — the row's current stop-cycle counter, read by the spawn lanes right after registering to
286
+ /** The row's current stop-cycle counter, read by the spawn lanes right after registering to
287
287
  * thread into the child's `RunInternals.cycleSeq`; see {@link backgroundAgentCycleSeqLane}. */
288
288
  backgroundAgentCycleSeq(id: string): number | undefined;
289
289
  /** Subagent transcript persistence (delegation entry caps) — one delegation tree's ACTIVE
@@ -399,7 +399,7 @@ export declare class TaskRegistry {
399
399
  * watcher/stop lanes mark and read it too); workflow cancellation is out of scope. */
400
400
  markStopSource(id: string, source: StopSource): void;
401
401
  /**
402
- * RB-164 — attribute an ENV-LEVEL blanket sweep before it runs.
402
+ * Attribute an ENV-LEVEL blanket sweep before it runs.
403
403
  *
404
404
  * The incident: a user's `run_in_background` Bash died mid-run reporting `stopped-by:"system"` with a
405
405
  * zero-byte output file, and diagnosing it took a cross-repo investigation with a timeline argument.
@@ -35,7 +35,7 @@ import type { NestedUsage } from "./tool-spec.js";
35
35
  */
36
36
  export type TaskStatus = "completed" | "blocked" | "failed" | "suspended" | "needs_review";
37
37
  /**
38
- * RB-439-a — one remote-workspace lifecycle failure, reported as data on {@link TaskResult.remoteEnvFailures}.
38
+ * One remote-workspace lifecycle failure, reported as data on {@link TaskResult.remoteEnvFailures}.
39
39
  * See that field for why the eleven-code taxonomy needed a structured channel to reach a caller at all.
40
40
  */
41
41
  export interface RemoteEnvFailureNote {
@@ -127,7 +127,7 @@ export type EffectiveMemoryScopes = {
127
127
  export interface TaskResult {
128
128
  taskId: string;
129
129
  /**
130
- * #499 — the ENGINE-minted identity of THIS run (uuidv7), minted once at the top of prepare and
130
+ * The ENGINE-minted identity of THIS run (uuidv7), minted once at the top of prepare and
131
131
  * never rewritten. The third id of the trio, and the only one the engine owns:
132
132
  * - {@link taskId} — the HOST's task identity, or (when the host named none) the session id: it is
133
133
  * `spec.taskId ?? sessionId` and therefore answers the SAME value for every run of one session;
@@ -168,7 +168,7 @@ export interface TaskResult {
168
168
  * requested ref. A mid-run degradation is observed separately (see the degraded-model fields). */
169
169
  model?: string;
170
170
  /**
171
- * #327 — the leg's effective REASONING resolution: the result-face twin of {@link model} for the thinking
171
+ * The leg's effective REASONING resolution: the result-face twin of {@link model} for the thinking
172
172
  * knob. How the requested tier resolved against the serving model's real capability
173
173
  * (`requested`/`effective`/`graded`/`clamped`/`format`/`endpoint`, plus `dropped:true` when a
174
174
  * non-reasoning model dropped the request entirely — field semantics on
@@ -230,7 +230,7 @@ export interface TaskResult {
230
230
  */
231
231
  salvagedOutput?: string;
232
232
  /**
233
- * RB-439-a — the remote-workspace lifecycle failures this run hit, as DATA. The seam declares eleven
233
+ * The remote-workspace lifecycle failures this run hit, as DATA. The seam declares eleven
234
234
  * distinct `RemoteExecutionErrorCode`s, but every one of them used to reach the caller as the same
235
235
  * thing: a `suspendVM` refusal was swallowed into the `onError` side channel and the result read
236
236
  * `limits.max_turns_exceeded` (identical for a transient auth blip and a permanently-unsupported adapter), while
@@ -430,34 +430,34 @@ export interface TaskResult {
430
430
  */
431
431
  haltedOnUserRejection?: true;
432
432
  /**
433
- * design/373 (#504) — present (`true`) exactly when a {@link TaskStream.halt} was ACCEPTED while
434
- * this run was live: the person issued the bare user interrupt (the CC Esc form — cut the
435
- * in-flight turn, stop at that boundary, wait for their next input). The ruled terminal form is
436
- * completed-with-marker, this seat being the marker: `status` is `"completed"` on the ordinary
437
- * path (a clean, resumable ending nothing failed, nothing is suspended, the session continues
438
- * via the ordinary next-run front door), and this field is what tells a person-stopped ending
439
- * apart from a natural finish same reading discipline as {@link haltedOnUserRejection}, its
440
- * sibling seat ("stopped by the user, awaiting their direction", never "the task finished its
441
- * work"). `result` is whatever the model had produced before the halt (possibly empty a halt
442
- * can land before any output; the run then completes empty rather than failing). Pass-through on
443
- * EVERY terminal the run still reaches (a halt ACCEPTED first that then raced a real
444
- * failure/limit truthfully says a person also stopped it), and the stated honest window — on
445
- * a natural completion the halt arrived too late to prevent (past the loop's final commit
446
- * point): the fact reported is the ACCEPTED HALT, and the transcript says how far the model
447
- * got. First-writer-wins against the run's abort (the `interrupt()` attribution law, the same
448
- * gate): a halt landing AFTER the abort signal already fired neither cut nor stopped anything —
449
- * that ending belongs to the abort, and this seat stays ABSENT rather than signing someone
450
- * else's stop with the halt caller's name. Absent everywhere else; never `false`.
451
- *
452
- * design/384 slice 2 (TRANSITIONAL narrowing): a `"suspended"` / `"needs_review"` terminal does
453
- * NOT carry this seat even when a halt was accepted — those statuses mean a durable park WON its
454
- * race with the halt (the row is committed and redeemable; the run is waiting to continue), and
455
- * "stopped by the person" beside "waiting to resume" was a self-contradictory pair. The halt's
456
- * own receipt (`{turnCut}`) and the `task.turn_interrupted` notice still stand a seat WAS cut.
457
- * Transitional: once halt-boundary source accounting lands (slice 3), the boundary-CONSUMED
458
- * suspension arms flip to signing (a probe pinning today's suppressed shape goes red then, by
459
- * design). The pass-through law is untouched for every OTHER terminal: a halt racing a real
460
- * failure/limit including one that outranks a committed park still signs.
433
+ * Present (`true`) exactly when a {@link TaskStream.halt}
434
+ * (the bare user interrupt, the CC Esc form — cut the in-flight turn, stop at that boundary, wait
435
+ * for the person's next input) was CONSUMED by this run: the engine's own record says the run
436
+ * ended FOR it. The attribution law, one sentence: signed the halt's cut settled a turn (the loop
437
+ * reported the interrupt settlement it took for the seat the halt aborted stream shape, batch
438
+ * shape, or the recovery lane's arms) OR the halt's stop request was among the sources a boundary
439
+ * consult stopped the loop for (the pre-turn guard that refuses the next turn — the birth-window
440
+ * halt included or the post-turn consult). The MINTER states the fact; the result assembly reads
441
+ * it and never infers causation from the final's shape (a brain minting its own `aborted` final
442
+ * beside a late halt reads as the failure it is) nor from the verb's acceptance.
443
+ *
444
+ * The ruled terminal form is completed-with-marker, this seat being the marker: `status` is
445
+ * `"completed"` on the ordinary path (a clean, resumable ending the session continues via the
446
+ * ordinary next-run front door), and this field is what tells a person-stopped ending apart from a
447
+ * natural finish same reading discipline as {@link haltedOnUserRejection}, its sibling seat
448
+ * ("stopped by the user, awaiting their direction", never "the task finished its work"). `result` is
449
+ * whatever the model had produced before the halt (possibly empty). Rides EVERY terminal a
450
+ * consumed halt reaches a halt whose cut settled a turn and then raced a real failure/limit, or
451
+ * whose boundary stop coincided with a review/resource park (`needs_review` / `suspended`),
452
+ * truthfully says a person also stopped it (the slice-2 status-keyed suppression is retired).
453
+ *
454
+ * ABSENT (never `false`) whenever the halt was not consumed, however it was answered: a halt
455
+ * landing after the run's abort already fired (first-writer-wins, the `interrupt()` attribution
456
+ * law that ending belongs to the abort); a halt accepted while the run was already ending for its
457
+ * own reason (a natural completion past the loop's final commit point, a brain's own terminal, a
458
+ * durable approval park whose commit won the race and whose abort then owned the ending); a
459
+ * steer-now cut (its stamp is `steer`). In every such case the halt's trace is its verb receipt plus
460
+ * one `task.halt_unconsumed` notice the seat is never signed on a guess.
461
461
  */
462
462
  haltedByUser?: true;
463
463
  /**
@@ -475,7 +475,7 @@ export interface TaskResult {
475
475
  toolCallId: string;
476
476
  }>;
477
477
  /**
478
- * #481 — HOST-SUPPLIED: the approval plane's report that this leg ended with human approvals still
478
+ * HOST-SUPPLIED: the approval plane's report that this leg ended with human approvals still
479
479
  * OUTSTANDING (the ask identities it is holding, and when the OLDEST of them was created).
480
480
  *
481
481
  * **Who writes it, and why not the engine.** Core mints no ask identity — an ask id belongs to the
@@ -502,7 +502,7 @@ export interface TaskResult {
502
502
  oldestCreatedAtMs: number;
503
503
  };
504
504
  /**
505
- * #485 — HOST-SUPPLIED: how long this leg spent BLOCKED on human approvals, in ms, as the deployment's
505
+ * HOST-SUPPLIED: how long this leg spent BLOCKED on human approvals, in ms, as the deployment's
506
506
  * approval plane measured it. Same writer and same absence contract as {@link pendingApproval}: the
507
507
  * approval clock belongs to whoever holds the ask, so the figure is SINGLE-SOURCED there and core neither
508
508
  * estimates it nor accumulates it (two sides publishing two numbers for one wait is the drift this seat
@@ -521,7 +521,7 @@ export interface TaskResult {
521
521
  */
522
522
  approvalWaitedMs?: number;
523
523
  /**
524
- * #240 (design/199 v1.1) — the READ-face this leg's read surfaces actually judged under, as an
524
+ * The READ-face this leg's read surfaces actually judged under, as an
525
525
  * engine-filled OBSERVATION (never a knob: writing it on a spec does nothing). It is the run's ONE
526
526
  * resolved face — the same value the hands toolkit enforced and the delegation carriers rode — with
527
527
  * the hands-less resume pin folded in (a row resumed on a hands-less worker still reports the
@@ -543,7 +543,7 @@ export interface TaskResult {
543
543
  */
544
544
  effectiveReadFace?: import("../tools/fs/read-face.js").ReadFace;
545
545
  /**
546
- * #240 (design/199 v1.1) — the sensitive-path deny ADDITIONS in force on this leg beyond the
546
+ * The sensitive-path deny ADDITIONS in force on this leg beyond the
547
547
  * built-in table, normalized (deployment ∪ task ∪ checkpoint-frozen seed), as an engine-filled
548
548
  * OBSERVATION. "In force" = judged by this leg's own read surfaces where they mounted, and carried
549
549
  * to its delegation subtree either way (a hands-less resume leg reports the entries its children
@@ -638,7 +638,7 @@ export interface TaskResult {
638
638
  /** The cache-INCLUSIVE prompt total across the task's turns — `promptTokens + cachedTokens +
639
639
  * cacheWriteTokens + cacheWriteTokensLong`, matching OTel `gen_ai.usage.input_tokens`. This is the
640
640
  * quantity cost is computed from, the denominator of `cacheHitRate`, and the figure to use for
641
- * "how much context did this task present" (window/budget views). RB-457-a: `promptTokens` carried
641
+ * "how much context did this task present" (window/budget views). `promptTokens` carried
642
642
  * this value up to 2.13.x; it now carries the cache MISS count and this field is its own
643
643
  * accumulator rather than an alias. Optional BY DESIGN, like every usage field on this stats
644
644
  * face: undefined means the gateway reported no usage (and pre-3.0.0 persisted rows never had
@@ -447,7 +447,7 @@ export interface TaskSpec {
447
447
  */
448
448
  toolMaterializeStrategy?: "swap" | "static";
449
449
  /**
450
- * RB-400-a — the inline-pin counterpart of {@link deferTools} (same wire-name addressing, opposite
450
+ * The inline-pin counterpart of {@link deferTools} (same wire-name addressing, opposite
451
451
  * direction; CC 220 `alwaysLoad` 对位): names listed here are NEVER deferred — not by
452
452
  * `ToolSpec.defer`, not by the MCP constant-defer arm (besides the server's own
453
453
  * `_meta["anthropic/alwaysLoad"]` declaration this list is the only channel that keeps a chosen
@@ -475,7 +475,7 @@ export interface TaskSpec {
475
475
  */
476
476
  restoreGatedTools?: string[] | true;
477
477
  /**
478
- * RB-403 — whether a schema-VALID call on a still-deferred tool runs the real tool directly
478
+ * Whether a schema-VALID call on a still-deferred tool runs the real tool directly
479
479
  * (activating it as a side effect). Default `true`, matching the upstream posture where the
480
480
  * defer gate is shape validation, not activation state (a deferred tool called with correct
481
481
  * arguments succeeds; activation only controls whether the model has SEEN the schema). Set
@@ -1237,7 +1237,7 @@ export interface TaskSpec {
1237
1237
  */
1238
1238
  todoReminderMode?: "baseline" | "off";
1239
1239
  /**
1240
- * RB-313 — `tool_search_usage_reminder` (CC 2.1.220 producer `Nop` @608915, renderer @626269): the
1240
+ * `tool_search_usage_reminder` (CC 2.1.220 producer `Nop` @608915, renderer @626269): the
1241
1241
  * REVERSE nudge for delayed tool disclosure. When tools are deferred (design/36), a model that has
1242
1242
  * gone N turns without calling `ToolSearch` and still has unloaded schemas is told they exist and
1243
1243
  * how to load them, so "this capability does not exist, I will build a workaround" stops being the
@@ -1276,7 +1276,7 @@ export interface TaskSpec {
1276
1276
  */
1277
1277
  budgetUsd?: true;
1278
1278
  /**
1279
- * RB-318 (ruled 2026-08-26) — `total_tokens_reminder` (CC 2.1.245 producer `MPs`, renderer `Oje`):
1279
+ * `total_tokens_reminder` (CC 2.1.245 producer `MPs`, renderer `Oje`):
1280
1280
  * the TOKEN twin of {@link budgetUsd}. One line per collected boundary,
1281
1281
  * `<total_tokens>N tokens left</total_tokens>`, CC-verbatim bytes.
1282
1282
  *
@@ -1312,7 +1312,7 @@ export interface TaskSpec {
1312
1312
  */
1313
1313
  totalTokensReminder?: boolean;
1314
1314
  /**
1315
- * RB-318 — which arm of the readout, CC 2.1.245's closed set (`off` / `infinite` / `fixed` /
1315
+ * Which arm of the readout, CC 2.1.245's closed set (`off` / `infinite` / `fixed` /
1316
1316
  * `countdown` / `padded-countdown`); absent ⇒ CC's own default `"padded-countdown"`.
1317
1317
  *
1318
1318
  * - `countdown` — remaining = ceiling − spend, raw.
@@ -54,7 +54,7 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
54
54
  * (the parked leg's `appendPendingSteer` refuses it identically). Re-issue under a fresh id.
55
55
  * - **Bad value ⇒ typed throw** `steering.invalid_content`, never a silent fallback to "no id": the
56
56
  * value domain is the parked leg's (a non-empty string of at most `MAX_STEER_INPUT_ID_CHARS`
57
- * characters, and never the reserved `LEGACY_PENDING_STEER_INPUT_ID`), so one key is accepted or
57
+ * characters), so one key is accepted or
58
58
  * refused the same way on both legs. Validated before the liveness check, like the parked leg's.
59
59
  * - **Liveness outranks the key**: once the run's loop-liveness latch has flipped (the same signal
60
60
  * the injection path stops polling on) a replay is refused `steering.not_running` like any other
@@ -349,22 +349,27 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
349
349
  * per-run. AUTHORITY (steer-lane law): holding this stream IS the capability — a deployment
350
350
  * relaying this verb owns its own gate (relay IS authorization; it cancels in-flight tool work
351
351
  * and ends the run's forward progress). No text ⇒ the `userPromptSubmit` screen has no domain
352
- * here (nothing enters the model). Honest window, stated: a halt accepted in the run's last
353
- * moments (past the loop's final commit point) finds the run completing naturally — the result
354
- * then reports the natural completion WITH the `haltedByUser` seat (the person did press stop
355
- * while it finished; the transcript says how far the model got). Typed refusals: the
352
+ * here (nothing enters the model). The late window, stated: a halt accepted
353
+ * in the run's last moments (past the loop's final commit point) finds the run completing
354
+ * naturally nothing is cut and no boundary stops for it, so the result reports the natural
355
+ * completion WITHOUT the `haltedByUser` seat and the engine mints `task.halt_unconsumed` (the
356
+ * verb receipt and that notice are the halt's whole trace; the seat is signed from consumption,
357
+ * never from acceptance — see {@link TaskResult.haltedByUser}). Typed refusals: the
356
358
  * steer-family `steering.not_running` once the task has finished (teardown included); a halt
357
359
  * issued BEFORE the run's first prompt polls the same bounded birth window as {@link steer} and
358
360
  * then stops the run before its first model turn (an empty, cleanly-halted completed run).
359
361
  *
360
- * **Receipt tension, stated (design/384 slice 2):** `{turnCut:true}` and the
362
+ * **Receipt tension, stated:** `{turnCut:true}` and the
361
363
  * `task.turn_interrupted` notice assert facts about the CUT — a seat was cut, no new model turn
362
364
  * starts — and both stay true even when the gate's durable leg still collects to `suspended`:
363
- * a park whose store commit was already in flight (or committed) when the cut landed WINS the
364
- * fence race, the row is redeemable, and the result then reads `status:"suspended"` WITHOUT
365
- * {@link TaskResult.haltedByUser} (the transitional narrowing documented on that seat). A cut
366
- * observed BEFORE the commit makes the park concede instead no row, no card, and the ordinary
367
- * halted ending.
365
+ * an approval park whose store commit was already in flight (or committed) when the cut landed
366
+ * WINS the fence race, the row is redeemable, the park's own abort then owns the ending, and the
367
+ * result reads `status:"suspended"` WITHOUT {@link TaskResult.haltedByUser} the halt cut a seat
368
+ * but consumed nothing (no interrupt settlement took its cut, no boundary stopped for it), which
369
+ * `task.halt_unconsumed` discloses. A cut observed BEFORE the commit makes the park concede
370
+ * instead — no row, no card, and the ordinary halted ending. A BOUNDARY park (review / resource
371
+ * slice) beside a consumed halt is the other way round: the terminal is the park's, and the seat
372
+ * IS signed — a person also stopped it.
368
373
  */
369
374
  halt(): Promise<{
370
375
  turnCut: boolean;
@@ -32,6 +32,7 @@ export declare const TASK_UPDATE_TOOL_NAME = "TaskUpdate";
32
32
  export declare const TASK_LIST_TOOL_NAME = "TaskList";
33
33
  export declare const TODO_WRITE_TOOL_NAME = "TodoWrite";
34
34
  export declare const REFRESH_MCP_TOOLS_TOOL_NAME = "RefreshMcpTools";
35
+ export declare const ARTIFACT_TOOL_NAME = "Artifact";
35
36
  /**
36
37
  * Every row. Order is documentation order (hands → delegation → scaffolds → memory → scheduler → host
37
38
  * scenarios); nothing reads the order.