@sema-agent/core 7.15.0 → 7.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/CHANGELOG.md +202 -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 +4 -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/delegation-settlement.d.ts +37 -12
  49. package/dist/core/memory-engine/delegation-settlement.js +128 -39
  50. package/dist/core/memory-engine/engine.d.ts +9 -8
  51. package/dist/core/memory-engine/engine.js +115 -120
  52. package/dist/core/memory-engine/file-backend.d.ts +17 -5
  53. package/dist/core/memory-engine/file-backend.js +78 -34
  54. package/dist/core/memory-engine/index.d.ts +2 -2
  55. package/dist/core/memory-engine/index.js +2 -2
  56. package/dist/core/memory-engine/layout.d.ts +152 -54
  57. package/dist/core/memory-engine/layout.js +441 -104
  58. package/dist/core/memory-engine/types.d.ts +8 -3
  59. package/dist/core/memory-engine/types.js +5 -0
  60. package/dist/core/memory-recall.d.ts +0 -8
  61. package/dist/core/memory.d.ts +1 -1
  62. package/dist/core/oracle-isolation.js +2 -2
  63. package/dist/core/parent-spec-seat.d.ts +66 -0
  64. package/dist/core/parent-spec-seat.js +47 -0
  65. package/dist/core/permission-rule-model.d.ts +11 -6
  66. package/dist/core/permission-rule-model.js +53 -37
  67. package/dist/core/permission-rules.js +8 -3
  68. package/dist/core/protocol-naming.d.ts +2 -2
  69. package/dist/core/remote-env.d.ts +1 -1
  70. package/dist/core/retired-keys.d.ts +19 -0
  71. package/dist/core/retired-keys.js +15 -0
  72. package/dist/core/runner/abort-race.d.ts +3 -3
  73. package/dist/core/runner/active-skill-scope.d.ts +2 -2
  74. package/dist/core/runner/active-skill-scope.js +3 -3
  75. package/dist/core/runner/assemble-result.d.ts +42 -40
  76. package/dist/core/runner/assemble-result.js +5 -4
  77. package/dist/core/runner/checkpoint-scope.d.ts +4 -4
  78. package/dist/core/runner/clock-and-limits.d.ts +3 -3
  79. package/dist/core/runner/compaction-call-options.d.ts +35 -99
  80. package/dist/core/runner/compaction-knobs.d.ts +4 -4
  81. package/dist/core/runner/compaction-seams.d.ts +5 -5
  82. package/dist/core/runner/contracts.d.ts +232 -233
  83. package/dist/core/runner/decide-continuation.d.ts +6 -6
  84. package/dist/core/runner/denial-limit-arms.d.ts +8 -8
  85. package/dist/core/runner/derived-route-fallback.d.ts +2 -2
  86. package/dist/core/runner/gate-exit.d.ts +6 -6
  87. package/dist/core/runner/gate-exit.js +15 -1
  88. package/dist/core/runner/git-status-frame.d.ts +7 -7
  89. package/dist/core/runner/halt-attribution.d.ts +35 -0
  90. package/dist/core/runner/halt-attribution.js +16 -0
  91. package/dist/core/runner/inherited-ask-grants.d.ts +6 -6
  92. package/dist/core/runner/memory-capture-optout.d.ts +1 -1
  93. package/dist/core/runner/memory-consolidation-driver.d.ts +4 -4
  94. package/dist/core/runner/memory-consolidation.d.ts +6 -8
  95. package/dist/core/runner/memory-consolidation.js +0 -1
  96. package/dist/core/runner/park-commit.d.ts +6 -6
  97. package/dist/core/runner/permission-rule-lanes.d.ts +19 -19
  98. package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -4
  99. package/dist/core/runner/prepare-artifact.d.ts +53 -0
  100. package/dist/core/runner/prepare-artifact.js +77 -0
  101. package/dist/core/runner/prepare-ask-lane.d.ts +3 -3
  102. package/dist/core/runner/prepare-boundary-parks.d.ts +3 -3
  103. package/dist/core/runner/prepare-caps-and-workflow.d.ts +9 -7
  104. package/dist/core/runner/prepare-caps-and-workflow.js +2 -3
  105. package/dist/core/runner/prepare-config-doors.d.ts +24 -24
  106. package/dist/core/runner/prepare-config-doors.js +5 -2
  107. package/dist/core/runner/prepare-context-lane.d.ts +8 -8
  108. package/dist/core/runner/prepare-context-lane.js +2 -13
  109. package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
  110. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  111. package/dist/core/runner/prepare-file-history.d.ts +3 -3
  112. package/dist/core/runner/prepare-file-history.js +3 -52
  113. package/dist/core/runner/prepare-gate-stations.d.ts +5 -5
  114. package/dist/core/runner/prepare-hands-readface.d.ts +35 -38
  115. package/dist/core/runner/prepare-hands-readface.js +3 -2
  116. package/dist/core/runner/prepare-inherited-gate.d.ts +9 -6
  117. package/dist/core/runner/prepare-inherited-gate.js +7 -8
  118. package/dist/core/runner/prepare-listings.d.ts +3 -3
  119. package/dist/core/runner/prepare-lsp.d.ts +3 -3
  120. package/dist/core/runner/prepare-memory-engine-session.d.ts +5 -5
  121. package/dist/core/runner/prepare-memory.d.ts +4 -6
  122. package/dist/core/runner/prepare-memory.js +10 -9
  123. package/dist/core/runner/prepare-offload-wrappers.d.ts +2 -2
  124. package/dist/core/runner/prepare-park-ask.d.ts +6 -6
  125. package/dist/core/runner/prepare-policy-chain.d.ts +7 -7
  126. package/dist/core/runner/prepare-policy-chain.js +15 -30
  127. package/dist/core/runner/prepare-prompt-assembly.js +1 -1
  128. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -5
  129. package/dist/core/runner/prepare-protocol-tools.d.ts +1 -1
  130. package/dist/core/runner/prepare-question-face.d.ts +4 -4
  131. package/dist/core/runner/prepare-run-refs.d.ts +11 -11
  132. package/dist/core/runner/prepare-safety-scan.d.ts +2 -2
  133. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -4
  134. package/dist/core/runner/prepare-suspend-saga.js +0 -2
  135. package/dist/core/runner/prepare-task.d.ts +12 -12
  136. package/dist/core/runner/prepare-task.js +10 -9
  137. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +2 -3
  138. package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -4
  139. package/dist/core/runner/prepare-wiring-manifest.js +9 -7
  140. package/dist/core/runner/prepare-workspace-restore.d.ts +1 -1
  141. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  142. package/dist/core/runner/resume-admission.d.ts +1 -1
  143. package/dist/core/runner/resume-admission.js +2 -1
  144. package/dist/core/runner/resume-claim.d.ts +1 -1
  145. package/dist/core/runner/resume-internals-and-config.d.ts +1 -1
  146. package/dist/core/runner/resume-internals-and-config.js +4 -0
  147. package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
  148. package/dist/core/runner/resume-preflight.d.ts +1 -1
  149. package/dist/core/runner/resume-review-outcome.d.ts +1 -1
  150. package/dist/core/runner/retired-runner-deps.d.ts +3 -0
  151. package/dist/core/runner/retired-runner-deps.js +7 -0
  152. package/dist/core/runner/run-brain-sinks.d.ts +1 -1
  153. package/dist/core/runner/run-clock-and-content.d.ts +4 -4
  154. package/dist/core/runner/run-compaction-machinery.d.ts +3 -3
  155. package/dist/core/runner/run-git-lane.d.ts +1 -1
  156. package/dist/core/runner/run-harness-handlers.d.ts +2 -2
  157. package/dist/core/runner/run-harness-handlers.js +2 -3
  158. package/dist/core/runner/run-identity-wiring.d.ts +4 -4
  159. package/dist/core/runner/run-leg.d.ts +3 -3
  160. package/dist/core/runner/run-notification-lane.d.ts +2 -2
  161. package/dist/core/runner/run-reasoning-seat.d.ts +2 -2
  162. package/dist/core/runner/run-settle-and-teardown.d.ts +5 -5
  163. package/dist/core/runner/run-settle-and-teardown.js +3 -1
  164. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
  165. package/dist/core/runner/run-terminal-adoption.d.ts +5 -5
  166. package/dist/core/runner/runtask.d.ts +14 -14
  167. package/dist/core/runner/session-file-state-replay.d.ts +3 -3
  168. package/dist/core/runner/session-file-state-replay.js +3 -3
  169. package/dist/core/runner/session-rule-policy.d.ts +2 -2
  170. package/dist/core/runner/session-rule-policy.js +3 -4
  171. package/dist/core/runner/steer-admission.d.ts +2 -2
  172. package/dist/core/runner/stream-halt-verbs.d.ts +1 -1
  173. package/dist/core/runner/stream-halt-verbs.js +1 -1
  174. package/dist/core/runner/stream-reap.d.ts +1 -1
  175. package/dist/core/runner/stream-steer-verb.js +1 -4
  176. package/dist/core/runner/synthetic-tools.d.ts +8 -8
  177. package/dist/core/runner/teardown-bounded.d.ts +2 -2
  178. package/dist/core/runner/tool-defer-gate.d.ts +1 -1
  179. package/dist/core/runner/tool-disclosure.d.ts +33 -33
  180. package/dist/core/runner/tool-end-body.d.ts +3 -3
  181. package/dist/core/runner/tool-face-overlay.d.ts +2 -2
  182. package/dist/core/runner/tool-output-projection.d.ts +2 -2
  183. package/dist/core/runner/turn-attachments.d.ts +53 -53
  184. package/dist/core/runner/usage-accounting.d.ts +4 -4
  185. package/dist/core/runner/workspace-path.d.ts +1 -1
  186. package/dist/core/runner/workspace-path.js +3 -0
  187. package/dist/core/runner-deps.d.ts +30 -49
  188. package/dist/core/safe-notify.d.ts +1 -1
  189. package/dist/core/sensitive-path-policy.d.ts +1 -1
  190. package/dist/core/sensitive-path-policy.js +4 -4
  191. package/dist/core/session.d.ts +2 -2
  192. package/dist/core/skill-tool-specifier.d.ts +1 -1
  193. package/dist/core/skills-directory.d.ts +1 -1
  194. package/dist/core/store-contracts/checkpoint-store-contract.js +1 -1
  195. package/dist/core/strategy-store.d.ts +8 -11
  196. package/dist/core/task-event.d.ts +20 -17
  197. package/dist/core/task-limits.d.ts +1 -1
  198. package/dist/core/task-notification.d.ts +5 -5
  199. package/dist/core/task-registry-agent.d.ts +5 -5
  200. package/dist/core/task-registry-monitor.d.ts +2 -2
  201. package/dist/core/task-registry-shared.d.ts +27 -27
  202. package/dist/core/task-registry-shared.js +3 -13
  203. package/dist/core/task-registry.d.ts +8 -8
  204. package/dist/core/task-result.d.ts +37 -37
  205. package/dist/core/task-spec.d.ts +5 -5
  206. package/dist/core/task-stream.d.ts +16 -11
  207. package/dist/core/tool-catalog-entries.d.ts +1 -0
  208. package/dist/core/tool-catalog-entries.js +5 -0
  209. package/dist/core/tool-conformance.d.ts +0 -2
  210. package/dist/core/tool-conformance.js +1 -3
  211. package/dist/core/tool-errors.d.ts +5 -0
  212. package/dist/core/tool-errors.js +1 -0
  213. package/dist/core/tool-policy.d.ts +51 -22
  214. package/dist/core/tool-policy.js +28 -5
  215. package/dist/core/tool-result-budget.d.ts +1 -1
  216. package/dist/core/tool-result-store.d.ts +11 -11
  217. package/dist/core/tool-spec.d.ts +34 -38
  218. package/dist/core/tools.d.ts +2 -2
  219. package/dist/core/trace.d.ts +12 -15
  220. package/dist/core/untrusted-text.d.ts +1 -1
  221. package/dist/core/wiring-manifest.d.ts +4 -3
  222. package/dist/core/workflow-journal-store.d.ts +11 -11
  223. package/dist/engine/execution-env/node-execution-env.d.ts +3 -2
  224. package/dist/engine/execution-env/node-execution-env.js +4 -2
  225. package/dist/engine/harness/agent-harness.d.ts +47 -4
  226. package/dist/engine/harness/agent-harness.js +52 -9
  227. package/dist/engine/llm/types.d.ts +1 -1
  228. package/dist/engine/loop/agent-loop.js +15 -8
  229. package/dist/engine/loop/types.d.ts +5 -0
  230. package/dist/index.d.ts +21 -16
  231. package/dist/index.js +17 -12
  232. package/dist/internal/harness.d.ts +1 -0
  233. package/dist/orchestration/run-spec.d.ts +3 -0
  234. package/dist/orchestration/run-spec.js +3 -3
  235. package/dist/orchestration/run-workflow-tool.d.ts +12 -6
  236. package/dist/orchestration/run-workflow-tool.js +23 -5
  237. package/dist/orchestration/workflow-primitives.d.ts +4 -2
  238. package/dist/orchestration/workflow-primitives.js +1 -4
  239. package/dist/orchestration/workflow-types.d.ts +34 -4
  240. package/dist/orchestration/workflow-types.js +2 -0
  241. package/dist/orchestration/workflow.d.ts +39 -7
  242. package/dist/orchestration/workflow.js +234 -113
  243. package/dist/prompt-assembly/assemble.d.ts +2 -2
  244. package/dist/prompt-assembly/assemble.js +9 -9
  245. package/dist/prompt-assembly/composer.d.ts +6 -7
  246. package/dist/prompt-assembly/composer.js +10 -10
  247. package/dist/prompt-assembly/epoch.js +1 -1
  248. package/dist/prompt-assembly/event-registry.d.ts +0 -21
  249. package/dist/prompt-assembly/packs/sema-default.js +30 -30
  250. package/dist/prompt-assembly/types.d.ts +14 -14
  251. package/dist/prompts/coordinator.d.ts +0 -13
  252. package/dist/prompts/coordinator.js +0 -3
  253. package/dist/stores/file/checkpoint-store.js +1 -5
  254. package/dist/stores/file/file-history-store.js +2 -2
  255. package/dist/stores/file/permission-rule-store.d.ts +4 -35
  256. package/dist/stores/file/permission-rule-store.js +4 -148
  257. package/dist/tools/artifact/artifact-text.d.ts +62 -0
  258. package/dist/tools/artifact/artifact-text.js +68 -0
  259. package/dist/tools/artifact/artifact-tool.d.ts +52 -0
  260. package/dist/tools/artifact/artifact-tool.js +351 -0
  261. package/dist/tools/artifact/local-stub.d.ts +26 -0
  262. package/dist/tools/artifact/local-stub.js +296 -0
  263. package/dist/tools/fs/bash-readonly-classifier.d.ts +114 -48
  264. package/dist/tools/fs/bash-readonly-classifier.js +171 -60
  265. package/dist/tools/fs/encoding.d.ts +31 -40
  266. package/dist/tools/fs/fs-bash.d.ts +49 -45
  267. package/dist/tools/fs/fs-bash.js +19 -27
  268. package/dist/tools/fs/fs-pdf.d.ts +8 -8
  269. package/dist/tools/fs/fs-search-tools.d.ts +4 -4
  270. package/dist/tools/fs/fs-search-tools.js +5 -2
  271. package/dist/tools/fs/fs-shared.d.ts +146 -158
  272. package/dist/tools/fs/fs-shared.js +3 -11
  273. package/dist/tools/fs/fs-write.d.ts +8 -8
  274. package/dist/tools/fs/gh-rate-limit.d.ts +13 -14
  275. package/dist/tools/fs/index.d.ts +78 -78
  276. package/dist/tools/fs/index.js +4 -1
  277. package/dist/tools/fs/notebook.d.ts +24 -25
  278. package/dist/tools/fs/pdf.d.ts +3 -3
  279. package/dist/tools/fs/read-deny.d.ts +22 -22
  280. package/dist/tools/fs/read-face.d.ts +21 -24
  281. package/dist/tools/fs/repo-map.d.ts +8 -8
  282. package/dist/tools/fs/safety.d.ts +233 -130
  283. package/dist/tools/fs/safety.js +131 -31
  284. package/dist/tools/fs/search.d.ts +63 -71
  285. package/dist/tools/fs/search.js +8 -6
  286. package/package.json +6 -2
  287. package/test/export-surface.snapshot.json +119 -39
@@ -106,7 +106,6 @@ export function prepareSuspendSaga(input) {
106
106
  activeTools: [...activeTools],
107
107
  outputRef: { value: outputRef.value, set: outputRef.set },
108
108
  nestedStats: { ...nestedStats },
109
- consolidationNotes: undefined,
110
109
  readFileState: readFileStateForCheckpoint ? [...readFileStateForCheckpoint.entries()] : undefined,
111
110
  readFace: faceCheckpointSection(),
112
111
  reminderMark,
@@ -121,7 +120,6 @@ export function prepareSuspendSaga(input) {
121
120
  .map((t) => ({ id: t.task_id, ...(t.description !== undefined ? { description: t.description } : {}) }));
122
121
  return live.length > 0 ? live : undefined;
123
122
  })(),
124
- pendingSteer: undefined,
125
123
  pendingSteerQueue: undefined,
126
124
  inheritedGate: (() => {
127
125
  const requiresParentConstraint = (inheritedParentConstraints?.length ?? 0) > 0 || seedInheritedGate?.requiresParentConstraint === true;
@@ -26,7 +26,7 @@ export declare function __resetToolModelGateAnnouncements(): void;
26
26
  export declare const TOOL_MODEL_GATE_RESTORE_SENTENCE = "restore via TaskSpec.restoreGatedTools, SEMA_TOOL_MODEL_GATE=off, or RunnerDeps.toolModelGate: false";
27
27
  export { __resetReadFaceClampAnnouncement } from "./prepare-hands-readface.js";
28
28
  /**
29
- * design/164 件四 — how long before an execution environment's declared `lifetimeMs` expires the engine
29
+ * How long before an execution environment's declared `lifetimeMs` expires the engine
30
30
  * stops the run and checkpoints it. The margin has to cover ONE suspend: pausing/snapshotting the
31
31
  * workspace, minting the checkpoint, committing it durably, and letting the loop stop cleanly — with
32
32
  * room for a slow durable store. 60s is generous for that work and small next to any real sandbox
@@ -39,7 +39,7 @@ export { __resetReadFaceClampAnnouncement } from "./prepare-hands-readface.js";
39
39
  */
40
40
  export declare const ENV_LIFETIME_SUSPEND_MARGIN_MS = 60000;
41
41
  /**
42
- * design/164 件四 — resolve the moment an env's lifetime EXPIRES (epoch ms), or `undefined` when the env
42
+ * Resolve the moment an env's lifetime EXPIRES (epoch ms), or `undefined` when the env
43
43
  * declares none / cannot be aged. Split out as a pure function so the anchor rules are testable and
44
44
  * stated once.
45
45
  *
@@ -66,7 +66,7 @@ export { isFableFamilyModelId, resolveAttachmentsConfig, resolveModelPromptTrait
66
66
  export { rebaseWorkspacePath, rebaseWorkspacePathAcross } from "./workspace-path.js";
67
67
  /** Everything the run loop needs, built once by {@link prepareTask} (task setup, isolated from the loop). */
68
68
  /**
69
- * RB-330 + 5.38 r2 件2 — the SINGLE effective-delegation derivation for a leg, minted once per prepare
69
+ * The SINGLE effective-delegation derivation for a leg, minted once per prepare
70
70
  * and read by EVERY consumer face; two facets, one source:
71
71
  *
72
72
  * - `isDelegatedChild` — the raw delegation fact, forks included. Trusted internals first; on a
@@ -79,10 +79,10 @@ export { rebaseWorkspacePath, rebaseWorkspacePathAcross } from "./workspace-path
79
79
  * the `hookIdentity` mint.
80
80
  * - `isNonForkChild` — the fact minus forks, for the authority/context faces: the `loadProjectMemory`
81
81
  * ctx flag ({@link RunnerDeps.loadProjectMemory} `isSubagent`) and the prompt runtime fact
82
- * `isSubagent` (RB-204's `SUBAGENT_CONSENT_NOTICE` gate). A FORK is excluded on both, deliberately:
83
- * a fork IS the parent continuing (design/110), so it inherits the parent's authority — and, on the
82
+ * `isSubagent` (the `SUBAGENT_CONSENT_NOTICE` gate). A FORK is excluded on both, deliberately:
83
+ * a fork IS the parent continuing, so it inherits the parent's authority — and, on the
84
84
  * memory face, the parent's own project context; trimming a fork's CLAUDE.md would hand the
85
- * continuation LESS context than the run it continues. (RB-330 history: the memory face once used
85
+ * continuation LESS context than the run it continues. (The memory face must not use
86
86
  * `parentTaskId !== undefined` alone, which {@link RunInternals.isDelegatedChild}'s own docstring
87
87
  * forbids — a directly-started workflow's children have no nameable parent.)
88
88
  *
@@ -95,7 +95,7 @@ export declare function effectiveDelegationFacts(internals: Pick<RunInternals, "
95
95
  isNonForkChild: boolean;
96
96
  };
97
97
  /**
98
- * Build everything a task run needs (council design/34 ②: a free function with EXPLICIT deps, not a
98
+ * Build everything a task run needs (a free function with EXPLICIT deps, not a
99
99
  * Runner method — testable and decoupled). Resolves the model/role/thinking, acquires + reconciles the
100
100
  * session (with the conflict-detecting Proxy + bounded re-wake on a lost CAS), assembles the tool set
101
101
  * (caller tools + offload wrap + report_blocked + submit_output + MCP + memory + read_tool_result),
@@ -104,19 +104,19 @@ export declare function effectiveDelegationFacts(internals: Pick<RunInternals, "
104
104
  * flow** lives here — that stays in the Runner loop.
105
105
  */
106
106
  export declare function prepareTask(spec: TaskSpec, deps: RunnerDeps, sessions: SessionStore, resume?: PrepareResume, internals?: RunInternals,
107
- /** design/98 §3.1 (S8c): a TRUSTED self-reference to the Runner, passed by the Runner itself (never a
107
+ /** A TRUSTED self-reference to the Runner, passed by the Runner itself (never a
108
108
  * TaskSpec field) so the `run_workflow` tool can execute child tasks via `runner.runTask`. Undefined when
109
109
  * prepareTask is exercised standalone (then run_workflow is simply not mounted). */
110
110
  runnerSelf?: RunnerSelfSeat,
111
- /** #499 — carrier for the id minted below, so a prepare that THROWS still lets its caller name the
111
+ /** Carrier for the id minted below, so a prepare that THROWS still lets its caller name the
112
112
  * run (prepare emits run-scoped notices of its own; each needs a terminal that names it). Same seat
113
113
  * shape the Runner uses for the generated taskId/sessionId. */
114
114
  runIdSink?: {
115
115
  runId?: string;
116
116
  }): Promise<Prepared>;
117
- /** design/393 S7 (#675) — the entry IS the contract the notification lane's seat names ({@link PrepareTaskFn}, contracts.ts):
118
- * a signature change reds HERE, at the declaration, as `false` failing the `true` bound. IDENTITY, not assignability (review
119
- * round 1): the parameter tuple (arity, optionality, each type) and the return type must be the SAME type in both directions —
117
+ /** The entry IS the contract the notification lane's seat names ({@link PrepareTaskFn}, contracts.ts):
118
+ * a signature change reds HERE, at the declaration, as `false` failing the `true` bound. IDENTITY, not assignability:
119
+ * the parameter tuple (arity, optionality, each type) and the return type must be the SAME type in both directions —
120
120
  * one-way `extends` let a dropped trailing parameter, an added optional one or a narrowed return slip through. Type-level only —
121
121
  * nothing is emitted. */
122
122
  type Holds<T extends true> = T;
@@ -58,6 +58,7 @@ import { derivedRouteFallsBack } from "./derived-route-fallback.js";
58
58
  import { prepareProtocolTools } from "./prepare-protocol-tools.js";
59
59
  import { prepareQuestionFace } from "./prepare-question-face.js";
60
60
  import { prepareLsp } from "./prepare-lsp.js";
61
+ import { prepareArtifact } from "./prepare-artifact.js";
61
62
  import { createRollbackStack } from "./rollback-stack.js";
62
63
  export { __resetMaterializeEnvAnnouncements } from "./prepare-tool-disclosure-mount.js";
63
64
  export { fileHistoryFilesystemIdentity, resolveFileHistoryScope } from "./prepare-file-history.js";
@@ -70,6 +71,7 @@ import { createSchedulerTools } from "../../tools/scheduler-tools.js";
70
71
  import { selfOrchestrationFailClosedReason } from "../../orchestration/workflow-script-runner.js";
71
72
  import { remainingBudgetMicroUsd, resolveCheckpointStore } from "../checkpoint-store.js";
72
73
  import { checkpointSeatOf } from "../checkpoint-seat.js";
74
+ import { handsWriteHalfMounts } from "../../tools/fs/index.js";
73
75
  import { durableParkGapFor } from "../park-selfcheck.js";
74
76
  import { deliverEngineNotice } from "../types.js";
75
77
  import { ToolRosterDeltaSeat } from "../tool-roster.js";
@@ -264,7 +266,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
264
266
  const { toolFaceSnapshot, promptProfile, lockedPreflight, resolvedInteractionPosture, microCompactKnob, resolvedRole, model, thinking, compModel, fableMitigations, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailRef, brainCallGuardrailMs } = doors;
265
267
  announceToolModelGate(deps.onNotice, model.id, doors.modelGate);
266
268
  const modelGateManifest = toolModelGateManifest(doors.modelGate);
267
- const { toolEffects, egressTools, irreversibleTools, irreversibilityTier, axisExplicitNegatives, reversibilityProbes, ownToolNames } = prepareSafetyScan({ spec, deps });
269
+ const { toolEffects, egressTools, irreversibleTools, irreversibilityTier, axisExplicitNegatives, reversibilityProbes } = prepareSafetyScan({ spec, deps });
268
270
  let shellGatedTools = new Set();
269
271
  refuseRequireExistingWithoutSession(spec);
270
272
  const { acquired, session, conflictRef, wakeRecovered, resumeAtBeforeParentId } = await prepareAcquireReconcile({ sessions, spec, resume, toolEffects, ...(internals?.sessionPlacement !== undefined ? { placement: internals.sessionPlacement } : {}), ...(() => { const g = durableParkGapFor(deps, spec); return g !== undefined ? { durableParkGap: g } : {}; })() });
@@ -368,8 +370,8 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
368
370
  let resolvedReadFace;
369
371
  let readDenyAdditionsNormalized = [];
370
372
  let handsLessResolvedFace;
371
- const { liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, autoModeIntent, inheritedAdmittedOrgScopes, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, orgAdmissionCheckpointState, faceCheckpointSection, faceCheckpointState, f012CheckpointState, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, frozenOnQuestion, provenanceForChildrenRef, delegationSettlementRef, inheritedGateForChildren, carrierReadFace, fullShellReachable, gateStopRef, stopForDenialLimit, enrichSpecToolCtx } = prepareInheritedGate({ spec, deps, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, checkpointSeat, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, autoModeSeat, handsEnabled, reportUsage, harnessRef, skillScope, forwardEvent, subagentRetain, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun: () => { abortController.abort(); void harness.abort(); }, runtimeCaps: () => runtimeCaps, hooks: () => hooks, preToolUseObservational: () => preToolUseObservational, hookTimeoutMs: () => hookTimeoutMs, hookEnvFace: () => hookEnvFace, autoModeDecider: () => autoModeDecider, autoModeDenialTracking: () => autoModeDenialTracking, autoModeArming: () => autoModeArming, agentForkDenial: () => agentForkDenial, observersActive: () => observersActive, resolvedReadFace: () => resolvedReadFace, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized, handsLessResolvedFace: () => handsLessResolvedFace, centerAdoption: () => centerAdoptionRef.current, memoryEngineSession: () => memoryEngineSession });
372
- const { roster, blockedRef, runtimeCaps, runtimeCapsFaulted, complianceDenies, complianceDegraded, agentForkDenial, observersActive, autoModeArmReason, autoModeDecider, autoModeDenialTracking, autoModeArming, selfOrchestrationActive, workflowToolsActive, workflowSizeGuideline } = await prepareCapsAndWorkflow({ spec, deps, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, checkpointSeat, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, frozenOnAsk, carrierReadFace, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, autoModeIntent, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, memoryEngineSession: () => memoryEngineSession, centerAdoption: () => centerAdoptionRef.current, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized });
373
+ const { liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, autoModeIntent, inheritedAdmittedOrgScopes, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, orgAdmissionCheckpointState, faceCheckpointSection, faceCheckpointState, f012CheckpointState, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, frozenOnQuestion, parentSpecSeat, provenanceForChildrenRef, delegationSettlementRef, inheritedGateForChildren, carrierReadFace, fullShellReachable, gateStopRef, stopForDenialLimit, enrichSpecToolCtx } = prepareInheritedGate({ spec, deps, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, checkpointSeat, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, autoModeSeat, handsEnabled, reportUsage, harnessRef, skillScope, forwardEvent, subagentRetain, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun: () => { abortController.abort(); void harness.abort(); }, runtimeCaps: () => runtimeCaps, hooks: () => hooks, preToolUseObservational: () => preToolUseObservational, hookTimeoutMs: () => hookTimeoutMs, hookEnvFace: () => hookEnvFace, autoModeDecider: () => autoModeDecider, autoModeDenialTracking: () => autoModeDenialTracking, autoModeArming: () => autoModeArming, agentForkDenial: () => agentForkDenial, observersActive: () => observersActive, resolvedReadFace: () => resolvedReadFace, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized, handsLessResolvedFace: () => handsLessResolvedFace, centerAdoption: () => centerAdoptionRef.current, memoryEngineSession: () => memoryEngineSession });
374
+ const { roster, blockedRef, runtimeCaps, runtimeCapsFaulted, complianceDenies, complianceDegraded, agentForkDenial, observersActive, autoModeArmReason, autoModeDecider, autoModeDenialTracking, autoModeArming, selfOrchestrationActive, workflowToolsActive, workflowSizeGuideline } = await prepareCapsAndWorkflow({ spec, deps, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, checkpointSeat, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, frozenOnAsk, parentSpecSeat, carrierReadFace, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, autoModeIntent, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, memoryEngineSession: () => memoryEngineSession, centerAdoption: () => centerAdoptionRef.current, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized });
373
375
  const tools = roster.tools;
374
376
  const pausedRef = {};
375
377
  const remoteEnvFailures = [];
@@ -432,11 +434,10 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
432
434
  const { mcp, a2a, rebuildHarnessToolsRef, contentOriginWrapRef, toolCallGateArmedRef } = await prepareProtocolTools({ lockedPreflight, spec, deps, reminderMark, reminderDisclosureCounts, runId, sessionId, onceLedger, roster, rosterSeat, remoteToolOffload, toolFaceSnapshot, toolEffects, axisExplicitNegatives, irreversibilityTier, irreversibleTools, egressTools, abortController, rollback });
433
435
  const callIssuedAtRef = {};
434
436
  const workCutRef = { continuation: false, abortedBeforeTurnEnd: false };
435
- const memoryWriteGateRef = {};
436
437
  const advertisedWritableDirs = handsEnabled
437
438
  ? new AdvertisedWritableDirs(executionEnv, (dir, reason) => deps.onError?.(new Error(`${dir.advertiser} advertised writable directory skipped (cannot canonicalize): ${dir.path} — ${reason}`), { phase: "config", sessionId }))
438
439
  : undefined;
439
- const handsWriteHalfPlanned = handsEnabled && spec.handsReadOnly !== true;
440
+ const handsWriteHalfPlanned = handsEnabled && handsWriteHalfMounts({ readOnly: spec.handsReadOnly === true });
440
441
  const memoryPairNameDomain = new Set();
441
442
  for (const t of tools) {
442
443
  memoryPairNameDomain.add(t.name);
@@ -455,12 +456,11 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
455
456
  return { fault: true };
456
457
  }
457
458
  })();
458
- const { memoryEngineSession, memoryTools, composeInjection: composeMemoryInjection, admittedOrgScopes: memoryAdmittedOrgScopes, ownOrgVerdict: memoryOwnOrgVerdict, effectiveMemoryScopes: memoryEffectiveScopes, } = await prepareMemory({
459
+ const { memoryEngineSession, memoryTools, memoryWriteGate, composeInjection: composeMemoryInjection, admittedOrgScopes: memoryAdmittedOrgScopes, ownOrgVerdict: memoryOwnOrgVerdict, effectiveMemoryScopes: memoryEffectiveScopes, } = await prepareMemory({
459
460
  spec,
460
461
  deps,
461
462
  sessionId,
462
463
  taskRootPath: taskRootFinal,
463
- memoryWriteGateRef,
464
464
  reminderMark,
465
465
  writeToolsMounted: (handsWriteHalfPlanned || tools.some((t) => t.name === "Write")) &&
466
466
  !(toolFaceSnapshot.exclude?.includes("Write") ?? false) &&
@@ -505,7 +505,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
505
505
  if (internals?.ownOrgAdmissionRef !== undefined && ownOrgVerdictRef.current !== undefined) {
506
506
  internals.ownOrgAdmissionRef.current = ownOrgVerdictRef.current;
507
507
  }
508
- const handsReadFaceInput = { handsEnabled, executionEnv, taskRootFinal, rebaseRestoredPath, resume, session, sessionId, hostTaskId, taskScope, fullShellReachable, effectiveShellGate, toolFaceSnapshot, model, spec, deps, internals, memoryWriteGateRef, ...(advertisedWritableDirs !== undefined ? { advertisedWritableDirs } : {}), firstPartyOffload, roster, egressTools, irreversibilityTier, irreversibleTools, reversibilityProbes, reminderMark, reminderDisclosureCounts, ...(trackFileEdit !== undefined ? { trackFileEdit } : {}), onFileEdited: noteFileEdited, ...(restoredFilePaths.length > 0 ? { restoredFilePaths } : {}) };
508
+ const handsReadFaceInput = { handsEnabled, executionEnv, taskRootFinal, rebaseRestoredPath, resume, session, sessionId, hostTaskId, taskScope, fullShellReachable, effectiveShellGate, toolFaceSnapshot, model, spec, deps, internals, memoryWriteGate, ...(advertisedWritableDirs !== undefined ? { advertisedWritableDirs } : {}), firstPartyOffload, roster, egressTools, irreversibilityTier, irreversibleTools, reversibilityProbes, reminderMark, reminderDisclosureCounts, ...(trackFileEdit !== undefined ? { trackFileEdit } : {}), onFileEdited: noteFileEdited, ...(restoredFilePaths.length > 0 ? { restoredFilePaths } : {}) };
509
509
  const handsReadFace = handsEnabled ? await prepareHandsMount(handsReadFaceInput) : resolveHandsLessReadFace(handsReadFaceInput);
510
510
  const { readFileStateForCheckpoint, seedContextFiles, handsCwdRef, workspaceStateSettle, wsSnapshot, rebaseWsPath, backgroundTaskToolsActive, additionalRootsCanonical, additionalReadRootsCanonical, attachmentRootCanonical, readDenyMatcher, envHandToolNames, sealReadStateSeat } = handsReadFace;
511
511
  resolvedReadFace = handsReadFace.resolvedReadFace;
@@ -532,6 +532,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
532
532
  `(per-principal entitlement governance, not a misconfiguration — Agent(subagent_type:"fork") will refuse honestly)`), { phase: "config", sessionId });
533
533
  }
534
534
  const { lspDiagnostics, nudgeLspOnEdit, lspRunIdent } = prepareLsp({ spec, deps, executionEnv, taskRootFinal, handsEnabled, sessionId, handsCwdRef, roster, envHandToolNames });
535
+ prepareArtifact({ deps, runId, taskId: hostTaskId, sessionId, agentName: internals?.explicitAgentName, executionEnv, rootCanonical: attachmentRootCanonical, additionalRootsCanonical: [...additionalRootsCanonical, ...additionalReadRootsCanonical], readDenyMatcher, resolvedReadFace, handsCwdRef, roster, firstPartyOffload, envHandToolNames });
535
536
  if (internals?.delegationProvenance !== undefined && resume !== undefined) {
536
537
  const live = internals.delegationProvenance.ref.current;
537
538
  const seed = resume.seed.delegationProvenance;
@@ -681,7 +682,7 @@ export async function prepareTask(spec, deps, sessions, resume, internals, runne
681
682
  releaseSignal = () => sig.removeEventListener("abort", onExternalAbort);
682
683
  }
683
684
  }
684
- const { hooks, hookTimeoutMs, preToolUseObservational, ownGatePreToolUse, basePolicyForResumeEdit, denyNarrowingPolicy, policyLayers, effectivePolicy, inheritedUnavailableAsks, inheritedAskGrants, askSourceIdentity, riskAxesOf, ruleOffersOf, permissionRuleLane, permissionRuleOrgLane, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions } = await preparePolicyChain({ spec, deps, internals, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, lockedPreflight, tools, harnessTools, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, ownToolNames, shellGatedTools, handsCwdRef, readDenyMatcher, questionToolMounted, runtimeCaps, inheritedAncestorRules, inheritedParentConstraints, seedInheritedGate, hasSkillManifest, skillScope, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, autoModeDecider, stopForDenialLimit, delegation, abortController, now, ownSessionRulesRef });
685
+ const { hooks, hookTimeoutMs, preToolUseObservational, ownGatePreToolUse, basePolicyForResumeEdit, denyNarrowingPolicy, policyLayers, effectivePolicy, inheritedUnavailableAsks, inheritedAskGrants, askSourceIdentity, riskAxesOf, ruleOffersOf, permissionRuleLane, permissionRuleOrgLane, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions } = await preparePolicyChain({ spec, deps, internals, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, lockedPreflight, tools, harnessTools, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, envHandToolNames, handsCwdRef, readDenyMatcher, questionToolMounted, runtimeCaps, inheritedAncestorRules, inheritedParentConstraints, seedInheritedGate, hasSkillManifest, skillScope, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, autoModeDecider, stopForDenialLimit, delegation, abortController, now, ownSessionRulesRef });
685
686
  const { onAsk, preToolContexts, blockedToolCalls, gateOutcomes, batchHaltRef, blockedTracked, incompleteSuspendAdapter, durableSuspendInfraReady, resourceSuspendEligible, usageGovernance, durableApproval, wiringManifest, parkLaneArmed, gateMachineryActive, hookIdentity, hookEnvFace } = prepareWiringManifest({ spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, hooks, preToolUseObservational, policyLayers, effectivePolicy, handsEnabled, mcp, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, lockedPreflight, peerLaneRefs, peerLaneActive, harness, pausedRef, frozenOnAsk, liveInheritedGate, delegation, toolRoster });
686
687
  if (fileHistoryBoundary !== undefined) {
687
688
  harness.on("tool_call", async () => {
@@ -1,12 +1,11 @@
1
1
  /**
2
- * design/390 §1.2 M14 — prepareTask's TOOL-DISCLOSURE-MOUNT phase, verbatim from the driver: the deferred registry
2
+ * PrepareTask's TOOL-DISCLOSURE-MOUNT phase, verbatim from the driver: the deferred registry
3
3
  * and its placeholders, the ToolSearch mount with its serialized activation section, the materialize strategy's
4
4
  * two-layer resolution (spec over the env channel, the safety interlock, the loud arms for a discarded env value), the
5
5
  * per-tool static exemption with its monotone ledger, the activation seed from the transcript / compaction snapshots /
6
6
  * checkpoint, the callable-names accessor the offload preview and ToolSearch share, the delta ref with its failed-server
7
7
  * arm, and the RefreshMcpTools rebuild seam's two arms. The env-channel announce ledger (per sink, per line) moved with
8
- * the segment — only this phase announces through it. The interface is the dependency list the segment had implicitly
9
- * (design/238 R-1).
8
+ * the segment — only this phase announces through it. The interface is the dependency list the segment had implicitly.
10
9
  *
11
10
  * ASYNC PHASE: with deferred names present the segment awaits the session's context and branch (the activation seed),
12
11
  * exactly where the driver awaited them; with nothing deferred the body has no await of its own. The phase adds no yield
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/390 §1.2 M18 — prepareTask's WIRING-MANIFEST phase, verbatim from the driver: the run's own frozen approver
2
+ * PrepareTask's WIRING-MANIFEST phase, verbatim from the driver: the run's own frozen approver
3
3
  * seat, the loud ungated-write warning (hand band / destructive MCP / first-party write tools with no effect-aware gate,
4
4
  * deduped per deployment and tool-set shape), the PreToolUse context stash and the blocked-call set, the settlement and
5
5
  * bare-rejection sidebands, the turn halt fact, the suspend infrastructure predicates (restore surface gap, durable
@@ -7,10 +7,10 @@
7
7
  * durableApproval, the effective wiring manifest, the peer lane's ask fold and drain binding, the park predicate as ONE
8
8
  * named const, the durable-gate-unavailable notice, the hook identity mint and the hook env face. The four helpers only
9
9
  * this segment called moved with it (usage governance, the per-deployment warn ledger, the MCP manifest projection, the
10
- * durable-gate notice). The interface is the dependency list the segment had implicitly (design/238 R-1).
10
+ * durable-gate notice). The interface is the dependency list the segment had implicitly.
11
11
  *
12
12
  * SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await, so the phase adds no yield between the policy-chain
13
- * station before it and the gate registration after it (design/390 §1.5: a stretch with no await is extracted as a sync
13
+ * station before it and the gate registration after it (a stretch with no await is extracted as a sync
14
14
  * function). Read-stability of the host handles for the call: {@link RunInternals} (`@contract prepare.deps-read-stable`).
15
15
  *
16
16
  * One read changed spelling and nothing else: the manifest's MCP face read `mcp?.statuses ?? []` while `mcp` had long
@@ -103,7 +103,7 @@ export interface PrepareWiringManifestInput {
103
103
  sessions: SessionStore;
104
104
  /** borrowed-readonly — the model gate's per-leg read face, or undefined. */
105
105
  modelGateManifest: WiringManifest["modelGate"];
106
- /** borrowed-readonly — the leg's minted tool roster (design/388): rides the manifest's `tools` section and is the
106
+ /** borrowed-readonly — the leg's minted tool roster: rides the manifest's `tools` section and is the
107
107
  * source of the hand band's write-capable names for the ungated-write warning (what actually MOUNTED). */
108
108
  toolRoster: ToolRoster;
109
109
  /** borrowed-readonly — the arming outcome the caps phase minted (the manifest's auto-mode face). */
@@ -3,7 +3,7 @@ import { resolveCheckpointStore } from "../checkpoint-store.js";
3
3
  import { createHookEnvCapabilities, mintHookInvocationIdentity } from "../hooks.js";
4
4
  import { isRemoteExecutionEnv, missingRestoreSurface } from "../remote-env.js";
5
5
  import { isVolatileOffloadStore } from "../tool-result-store.js";
6
- import { isLiveApproverSeat } from "../tool-policy.js";
6
+ import { durableMandateSourceOf, isLiveApproverSeat } from "../tool-policy.js";
7
7
  import { deliverEngineNotice } from "../types.js";
8
8
  import { inlineUntrusted } from "../untrusted-text.js";
9
9
  import { GLOBAL_USAGE_KEY, usageRetryAfterMs, windowsGovernCost } from "../usage-window-store.js";
@@ -84,24 +84,26 @@ function buildUsageGovernance(windows, deps, principal, sessionId) {
84
84
  }
85
85
  const ungatedWarnedShapes = new WeakMap();
86
86
  function announceDurableGateUnavailable(args) {
87
- if (!args.forceDurableGate || args.storeWired)
87
+ if (args.mandate === undefined || args.storeWired)
88
88
  return;
89
+ const source = args.mandate;
89
90
  const cause = args.taskStoreDisabled ? "task_store_disabled" : "no_deployment_store";
90
91
  const inheritedContentMandate = (args.parentConstraints ?? []).some((pc) => pc.contentMandate === true);
91
92
  const liveQuestionFace = args.liveQuestionFace && !inheritedContentMandate;
92
93
  deliverEngineNotice(args.onNotice, {
93
94
  code: "config.durable_gate_unavailable",
94
- message: `Durable approval gate mandated but unavailable: the runtime entitlement forceDurableGate is in force for this ` +
95
- `principal, but ${cause === "task_store_disabled" ? 'this task disabled the checkpoint store (checkpointStore: "disabled")' : "this deployment wired no checkpoint store"}, ` +
95
+ message: `Durable approval gate mandated but unavailable: ${source === "force_durable_gate" ? "the runtime entitlement forceDurableGate is in force for this principal" : "this task opted into durable approval (durableApproval) with no live approver seat"}, ` +
96
+ `but ${cause === "task_store_disabled" ? 'this task disabled the checkpoint store (checkpointStore: "disabled")' : "this deployment wired no checkpoint store"}, ` +
96
97
  `so no interactive ask of this task can be parked for a durable answer. Asks resolve on the live chain instead ` +
97
- `(${args.liveApprover ? "a live approver answers permission asks in-stream" : "permission asks are denied fail-closed — no live approver is wired"}; ` +
98
+ `(${args.liveApprover ? "a live approver answers permission asks in-stream" : args.blanketAllow ? 'a blanket "allow" posture answers ordinary permission asks without judgment (a mandated ask is refused)' : "permission asks are denied fail-closed — no live approver is wired"}; ` +
98
99
  `${liveQuestionFace ? "a live question face answers AskUserQuestion in-stream" : args.liveQuestionFace ? "AskUserQuestion is withheld from the live face by an inherited durable mandate and refused" : "AskUserQuestion has no live face and is refused"}) ` +
99
- `and NO durable approval record is written. ${cause === "task_store_disabled" ? "Run this task with its store, or withdraw the entitlement for principals whose runs are machine-started." : "Wire a checkpoint store on this deployment, or withdraw the entitlement for principals served here."}`,
100
+ `and NO durable approval record is written. ${cause === "task_store_disabled" ? "Run this task with its store" : "Wire a checkpoint store on this deployment"}, or ${source === "force_durable_gate" ? "withdraw the entitlement for principals served here" : "give the task a live approver seat (or drop durableApproval)"}.`,
100
101
  detail: {
101
102
  sessionId: args.sessionId,
102
103
  runId: args.runId,
103
104
  ...(args.principal ? { principal: args.principal } : {}),
104
105
  cause,
106
+ source,
105
107
  liveApprover: args.liveApprover,
106
108
  liveQuestionFace,
107
109
  },
@@ -225,7 +227,7 @@ export function prepareWiringManifest(input) {
225
227
  resourceSuspendEligible ||
226
228
  platformSuspendArmed ||
227
229
  spec.enablePlanMode === true;
228
- announceDurableGateUnavailable({ onNotice: deps.onNotice, forceDurableGate: runtimeCaps?.forceDurableGate === true, storeWired: checkpointStore !== undefined, taskStoreDisabled: spec.checkpointStore === "disabled", liveApprover: isLiveApproverSeat(frozenOnAsk), liveQuestionFace: liveQuestionFace !== undefined, parentConstraints: liveInheritedGate?.parentConstraints, sessionId, runId, principal: spec.principal });
230
+ announceDurableGateUnavailable({ onNotice: deps.onNotice, mandate: durableMandateSourceOf({ forceDurableGate: runtimeCaps?.forceDurableGate === true, durableApprovalDeclared: spec.durableApproval !== undefined, onAsk: frozenOnAsk }), storeWired: checkpointStore !== undefined, taskStoreDisabled: spec.checkpointStore === "disabled", liveApprover: isLiveApproverSeat(frozenOnAsk), blanketAllow: frozenOnAsk === "allow", liveQuestionFace: liveQuestionFace !== undefined, parentConstraints: liveInheritedGate?.parentConstraints, sessionId, runId, principal: spec.principal });
229
231
  const hookIdentity = mintHookInvocationIdentity({
230
232
  sessionId,
231
233
  taskId: hostTaskId,
@@ -45,7 +45,7 @@ export interface PrepareWorkspaceRestoreResult {
45
45
  * phases, so a consumer moved ahead of this call is a lexical error. */
46
46
  taskRootFinal: string;
47
47
  /** owned (pure function; closes over the phase-armed rebase state) — migrates one checkpointed
48
- * absolute path from the OLD workspace root onto the restored one (RB-439-c: any accepted
48
+ * absolute path from the OLD workspace root onto the restored one (any accepted
49
49
  * spelling of the old root); the identity function when no divergence was armed. Consumers (T7):
50
50
  * the readFileState checkpoint seed, the handsCwd seed, the activeWorktree restore. */
51
51
  rebaseRestoredPath: (p: string) => string;
@@ -1,13 +1,13 @@
1
1
  import type { RemoteExecutionEnv, RemoteExecutionError, SnapshotId, VmLifecycleOptions } from "../remote-env.js";
2
2
  import type { RemoteEnvFailureNote } from "../types.js";
3
3
  /**
4
- * RB-439-a — project one failed remote lifecycle call onto the caller-facing note. ONE builder for all
4
+ * Project one failed remote lifecycle call onto the caller-facing note. ONE builder for all
5
5
  * three ops so the `retryable` classification can never drift between the lane that reports a `suspendVM`
6
6
  * refusal and the lane that reports a failed restore.
7
7
  */
8
8
  export declare function remoteEnvFailureNote(op: RemoteEnvFailureNote["op"], error: RemoteExecutionError, attempts: number): RemoteEnvFailureNote;
9
9
  /**
10
- * RB-439-a — `resumeVM` with a bounded retry on the TRANSIENT codes, plus the attempt count for the
10
+ * `resumeVM` with a bounded retry on the TRANSIENT codes, plus the attempt count for the
11
11
  * caller-facing note.
12
12
  *
13
13
  * Why this op and no other: `resumeVM` is the one lifecycle call the seam documents as "idempotent +
@@ -19,7 +19,7 @@ export declare function remoteEnvFailureNote(op: RemoteEnvFailureNote["op"], err
19
19
  * attempt — `withRetry` will not spend a second call on a permanent refusal.
20
20
  */
21
21
  export declare function restoreWorkspaceWithRetry(env: RemoteExecutionEnv, snapshotId: SnapshotId, options: VmLifecycleOptions,
22
- /** design/384 slice 2 (additive): observe each attempt AS IT STARTS. The returned `attempts` is
22
+ /** Observe each attempt AS IT STARTS. The returned `attempts` is
23
23
  * only readable after settlement, and a caller whose wait on this promise is BOUNDED (the park
24
24
  * compensation) must report the live attempt count when its bound fires mid-call — without this
25
25
  * seat a deaf second attempt was reported as `attempts: 1`. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S3 — the resume ladder's ADMISSION rung (E1) and the wake's shaping (E2), verbatim from
2
+ * The resume ladder's ADMISSION rung (E1) and the wake's shaping (E2), verbatim from
3
3
  * `Runner.resumeStream`: the outcome container's domain, the one-read snapshots of the caller's config and
4
4
  * the trusted internals bag, the store resolution, the row read and its terminal-status confirm, the
5
5
  * same-process parent-constraint re-supply, then the wake pre-ladder (gate purity, pendingAction purity,
@@ -36,6 +36,7 @@ export async function resumeAdmission(input) {
36
36
  const outcomeGate = outcome.gate;
37
37
  const resumeSignal = config.signal;
38
38
  let suppliedMessage;
39
+ const parkedSteers = readPendingSteerQueue(cp.state);
39
40
  if (outcomeGate === "wake") {
40
41
  suppliedMessage = outcome.message;
41
42
  const gk = cp.gate.kind;
@@ -74,7 +75,7 @@ export async function resumeAdmission(input) {
74
75
  if (suppliedMessage !== undefined) {
75
76
  wakeMessage = validatePendingSteer(suppliedMessage);
76
77
  }
77
- else if (readPendingSteerQueue(cp.state).length === 0) {
78
+ else if (parkedSteers.length === 0) {
78
79
  throw new CheckpointError("wake.nothing_to_deliver", "cannot wake: no message was supplied and the checkpoint holds no parked pendingSteer — an empty " +
79
80
  "wake would burn the checkpoint on a blank continuation; supply `message` or park a steer first");
80
81
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S3 — the resume ladder's CLAIM rung (E10), verbatim from `Runner.resumeStream`: the atomic
2
+ * The resume ladder's CLAIM rung (E10), verbatim from `Runner.resumeStream`: the atomic
3
3
  * CAS (`claimTerminal` when the store provides it — one round trip carrying the loser's truth — else the
4
4
  * two-step `resolve` + diagnostic read), the same-Runner claim mark around it, and the loss classification
5
5
  * (`reopened_concurrently` for a live row whose rev moved, `already_resolved` for a consumed one, with the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S3 — the resume ladder's INTERNALS-AND-CONFIG rung (E7), verbatim from `Runner.resumeStream`:
2
+ * The resume ladder's INTERNALS-AND-CONFIG rung (E7), verbatim from `Runner.resumeStream`:
3
3
  * the locked-policy guard on the resume-edit seat, the principal and placement identity-continuity rungs,
4
4
  * and the governance-window ENTRANCE check for a row that still owes a delivery.
5
5
  *
@@ -1,9 +1,13 @@
1
1
  import { CheckpointError, readPendingSteerQueue } from "../checkpoint-store.js";
2
2
  import { GLOBAL_USAGE_KEY, resolveUsageWindows, usageRetryAfterMs } from "../usage-window-store.js";
3
3
  import { placementValueOrAbsent } from "./checkpoint-scope.js";
4
+ import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
5
+ import { resolveMicroCompactKnob } from "./prepare-config-doors.js";
4
6
  export function resumeInternalsAndConfig(input) {
5
7
  const { cp, config, internals, outcomeGate, runner } = input;
6
8
  let windowEntrance;
9
+ assertNoRetiredRunnerDeps(runner.deps);
10
+ resolveMicroCompactKnob(runner.deps.microCompact);
7
11
  if (runner.deps.lockedConfig?.keys?.includes("toolPolicy") === true && config.basePolicyForResumeEdit !== undefined) {
8
12
  throw new CheckpointError("checkpoint.invalid_outcome", "TaskSpec.basePolicyForResumeEdit is administratively locked by this deployment (locked key \"toolPolicy\") — a task-supplied " +
9
13
  "resume-edit policy is refused pre-CAS (the checkpoint stays pending); remove the field or change the deployment's lock configuration");
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S3 — the resume ladder's APPROVAL-LANE capture and binding rung (E4), verbatim from
2
+ * The resume ladder's APPROVAL-LANE capture and binding rung (E4), verbatim from
3
3
  * `Runner.resumeStream`: on a human / irreversible_ask row every deployment-supplied field of the
4
4
  * `policy_ask` decide is read exactly once into a plain twin (answer canonicalized, updatedInput cloned to the
5
5
  * JSON domain, the decision word, the refused keys, the host's decision facts and attribution, the deny note),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S3 — the resume ladder's deployment PREFLIGHT rung (E9), verbatim from `Runner.resumeStream`:
2
+ * The resume ladder's deployment PREFLIGHT rung (E9), verbatim from `Runner.resumeStream`:
3
3
  * the LAST rung before the CAS. The deployment's `resumePreflight` screens the resume off the persisted row's
4
4
  * facts under its own validated deadline; every non-answer arm refuses retry-later (the row stays pending);
5
5
  * only an explicit, fully readable `terminal` verdict settles the row through the single-shot expire CAS
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S3 — the resume ladder's gate-match rung and the review / park TWINS (E3), verbatim from
2
+ * The resume ladder's gate-match rung and the review / park TWINS (E3), verbatim from
3
3
  * `Runner.resumeStream`: the outcome arm must match the persisted gate kind; a review-gate outcome
4
4
  * (plan_review / dry_run_review) is captured into a plain twin with its domain and text-payload checks, the
5
5
  * break-out-tag hygiene and the env_failed replay guard; the two tool-less park lanes (wake / resource_limit)
@@ -0,0 +1,3 @@
1
+ import type { RunnerDeps } from "../types.js";
2
+ /** Runs in the pre-first-await config-doors phase, before any resource-bearing preparation, and pre-CAS on a resume. */
3
+ export declare function assertNoRetiredRunnerDeps(deps: RunnerDeps): void;
@@ -0,0 +1,7 @@
1
+ import { assertNoRetiredKeys } from "../retired-keys.js";
2
+ const RETIRED_RUNNER_DEPS_KEYS = {
3
+ legacyRewindBoundaryProbe: "the rewind refusal always names both possibilities (never existed / retired whole-tree era); a deployment that holds that era's table answers the question on its own surface",
4
+ };
5
+ export function assertNoRetiredRunnerDeps(deps) {
6
+ assertNoRetiredKeys(deps, RETIRED_RUNNER_DEPS_KEYS, "RunnerDeps");
7
+ }
@@ -21,7 +21,7 @@ export interface RunBrainSinksInput {
21
21
  observeReasoningWireFacts: (facts: ReasoningWireFacts) => void;
22
22
  }
23
23
  export interface RunBrainSinksResult {
24
- /** design/99 BC-2: the subagent's human display name for its `task_progress` ticks, or undefined. */
24
+ /** The subagent's human display name for its `task_progress` ticks, or undefined. */
25
25
  subagentName: string | undefined;
26
26
  /** Compose the three brain ALS sinks around a brain-driving call. */
27
27
  withBrainSinks: <T>(fn: () => Promise<T>) => Promise<T>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S5 — the run body's CLOCK and CONTENT seats (R6), verbatim from `Runner.runLocked`: the per-slice
2
+ * The run body's CLOCK and CONTENT seats (R6), verbatim from `Runner.runLocked`: the per-slice
3
3
  * walltime window and its MONOTONIC deadline anchored at task start, the hard-abort timer armed against that same
4
4
  * deadline (a suspendable task gets the backstop grace), the content-event push that also forwards a sub-agent's
5
5
  * events to the parent's display sink, the run's own committed-tail ref and the `message_committed` mint that
@@ -34,15 +34,15 @@ export interface RunClockAndContentInput {
34
34
  startedToolCallIds: Set<string>;
35
35
  }
36
36
  export interface RunClockAndContentResult {
37
- /** design/164: the PER-SLICE active clock, or undefined (0 is a valid, exhausted window). */
37
+ /** The PER-SLICE active clock, or undefined (0 is a valid, exhausted window). */
38
38
  effectiveTimeoutMs: number | undefined;
39
- /** RB-20: the monotonic deadline every walltime enforcement decision reads, or undefined. */
39
+ /** The monotonic deadline every walltime enforcement decision reads, or undefined. */
40
40
  walltimeMonotonicDeadline: number | undefined;
41
41
  /** The hard walltime backstop: its fired flag / lateness, and the clear the teardown calls. */
42
42
  timeout: ReturnType<typeof startTimeout>;
43
43
  /** Push a content event to the run's queue and, for a sub-agent, to the parent's display sink. */
44
44
  pushContent: (e: TaskEvent) => void;
45
- /** #483: the id of the LAST entry this run committed — the settle-time seal's provenance anchor. */
45
+ /** The id of the LAST entry this run committed — the settle-time seal's provenance anchor. */
46
46
  ownCommittedTailRef: {
47
47
  current: string | undefined;
48
48
  };
@@ -15,7 +15,7 @@ export interface RunCompactionMachineryInput {
15
15
  /** borrowed-mutable — the run's usage counters: every accounted summary call adds to them (compaction spend
16
16
  * tracked separately too). */
17
17
  stats: Stats;
18
- /** borrowed-readonly — the telemetry lane's price-table door (#462), consulted for every summarizer table adopted. */
18
+ /** borrowed-readonly — the telemetry lane's price-table door, consulted for every summarizer table adopted. */
19
19
  noteUnevaluablePriceTable: (p: ModelPricing) => void;
20
20
  /** borrowed-readonly — the Runner's deployment deps, read LIVE (`brain`, `pricing`, `onError`). */
21
21
  runner: RunnerDepsSeat;
@@ -23,13 +23,13 @@ export interface RunCompactionMachineryInput {
23
23
  export interface RunCompactionMachineryResult {
24
24
  /** The accounted compaction brain — `complete` always provided, usage recorded inline. */
25
25
  compactionBrain: Brain;
26
- /** design/64 §25 (A): whether ROUTINE turn-boundary compaction runs for this task. */
26
+ /** Whether ROUTINE turn-boundary compaction runs for this task. */
27
27
  withinTaskCompaction: boolean;
28
28
  /** §17.4: the consecutive-failure circuit breaker shared by every compaction lane of the run. */
29
29
  compactionBreaker: {
30
30
  failures: number;
31
31
  };
32
- /** design/145 门A/§3: the window-safety wiring (per call — a mid-task degrade moves the fallback target). */
32
+ /** The window-safety wiring (per call — a mid-task degrade moves the fallback target). */
33
33
  windowSafetyOptions: (mainModel: Model) => Pick<MaybeCompactOptions, "fallbackBudget" | "onWindowSafety">;
34
34
  }
35
35
  export declare function runCompactionMachinery(input: RunCompactionMachineryInput): RunCompactionMachineryResult;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S5 — the run body's GIT LANE (R12), verbatim from `Runner.runLocked`: the git-status re-assert closure
2
+ * The run body's GIT LANE (R12), verbatim from `Runner.runLocked`: the git-status re-assert closure
3
3
  * installed on `prepared.gitStatusRef` (compaction landing hook + owed-frame retry — an engine-minted standalone
4
4
  * append with the receipt in hand, the announced mirror written only then), the parked mirror flush (F4), the
5
5
  * owed-frame retry subscription registered BEFORE the boundary handler, the boundary subscription itself and the
@@ -34,11 +34,11 @@ export interface RunHarnessHandlersResult {
34
34
  type: "tool_execution_end";
35
35
  }>) => void;
36
36
  onTurnEnd: () => void;
37
- /** RB-475 — the single workspace_changed mint (cwd diff vs the closure's dedupe state); the run body
37
+ /** The single workspace_changed mint (cwd diff vs the closure's dedupe state); the run body
38
38
  * calls it after a resume's approved-call resolution, which bypasses onToolEnd. */
39
39
  announceWorkspaceMove: () => void;
40
40
  }
41
- /** design/157 B15 尾件 — R5 抽取:runLocked 的五个 harness 事件处理器(onMessageUpdate/onMessageEnd/
41
+ /** R5 抽取:runLocked 的五个 harness 事件处理器(onMessageUpdate/onMessageEnd/
42
42
  * onToolStart/onToolEnd/onTurnEnd,~530 行)整块搬迁。正文逐字;唯一字面变化 = this.deps.onError →
43
43
  * deps.runnerHooks.onError(1 处)。`lastWorkspaceCwd` 是纯 R5 局部(读写全在 onToolEnd 内,零段外
44
44
  * 读者),声明随迁进工厂体——调用点放在原声明位之后,初值 `prepared.cwdRef?.current` 的求值时机不变
@@ -286,9 +286,8 @@ export function createHarnessHandlers(input) {
286
286
  if (prepared.abortController.signal.aborted)
287
287
  prepared.workCutRef.abortedBeforeTurnEnd = true;
288
288
  const stopExtra = rs.turn.turnStopReason !== undefined ? { stopReason: rs.turn.turnStopReason } : {};
289
- queue.push(rs.turn.turnUsage
290
- ? { type: "turn_end", usage: rs.turn.turnUsage, ...(rs.turn.turnUsageMissing ? { usageMissing: true } : {}), ...stopExtra, ...ident() }
291
- : { type: "turn_end", usageMissing: true, ...stopExtra, ...ident() });
289
+ const usage = rs.turn.turnUsage ?? { inputTokens: 0, totalInputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, costMicroUsd: 0 };
290
+ queue.push({ type: "turn_end", usage, ...(rs.turn.turnUsage === undefined || rs.turn.turnUsageMissing ? { usageMissing: true } : {}), ...stopExtra, ...ident() });
292
291
  rs.turn.turnUsageMissing = false;
293
292
  rs.turn.turnStopReason = undefined;
294
293
  if (parentToolCallId !== undefined) {
@@ -33,7 +33,7 @@ export interface RunIdentityWiringInput {
33
33
  }) => Promise<"queued" | "parked" | "dropped_duplicate">;
34
34
  /** borrowed-mutable — the turn-open dedup set (the cross-layer double-park dedup): a redelivered frame's key is registered here. */
35
35
  deliveredAtTurnOpen: Set<string>;
36
- /** borrowed-mutable — design/176: the peer inbound chain, overwritten by each consumed peer-class payload. */
36
+ /** borrowed-mutable — the peer inbound chain, overwritten by each consumed peer-class payload. */
37
37
  peerInboundChainRef: PeerInboundChainRef;
38
38
  /** borrowed-mutable — the notification lane's bindings seat (its own `let`s behind getters / setters, never a copy):
39
39
  * this lane binds the harness, the session anchor and the identity mint the lane's closures read, and reads the
@@ -55,7 +55,7 @@ export interface RunIdentityWiringResult {
55
55
  parentToolCallId?: string;
56
56
  sourceTaskId?: string;
57
57
  };
58
- /** #281 件B: the delegation-lifecycle emission closure both stations share (spawn here, terminal in the driver). */
58
+ /** The delegation-lifecycle emission closure both stations share (spawn here, terminal in the driver). */
59
59
  emitDelegationLifecycle: (event: import("../types.js").DelegationLifecycleEvent) => void;
60
60
  /** The loop-liveness latch and the two attribution seats (ended / userInterrupted / userHalted). */
61
61
  loopLatch: {
@@ -65,7 +65,7 @@ export interface RunIdentityWiringResult {
65
65
  };
66
66
  /** This leg's usage counters, zeroed here; the harness-handlers lane is their writer from the first turn on. */
67
67
  stats: Stats;
68
- /** backlog #389 — the held agent_end account, a READ FACE over this lane's own `let` (the undrained-inputs sink writes it
68
+ /** The held agent_end account, a READ FACE over this lane's own `let` (the undrained-inputs sink writes it
69
69
  * when the run committed a durable park); the terminal-adoption lane settles it minus what the park carried. */
70
70
  undrainedUserAtEnd: {
71
71
  readonly current: {
@@ -73,7 +73,7 @@ export interface RunIdentityWiringResult {
73
73
  followUp: number;
74
74
  } | undefined;
75
75
  };
76
- /** #677 — did the run END with a person's steer / follow-up still pending (queued, or drained at the final boundary and
76
+ /** Did the run END with a person's steer / follow-up still pending (queued, or drained at the final boundary and
77
77
  * never served)? A READ FACE over this lane's own `let`, written by the same undrained-inputs sink on BOTH its arms
78
78
  * (park or not): the terminal-adoption lane folds it into the answer-settled verdict — a "stop" answer the person had
79
79
  * already asked to continue past is not a settled answer, so a stop that cut that continuation is a stop on work. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/393 S6 — the run body's LEG (R13), verbatim from `Runner.runLocked`: the one `harness.prompt` of the leg and
2
+ * The run body's LEG (R13), verbatim from `Runner.runLocked`: the one `harness.prompt` of the leg and
3
3
  * everything that decides whether it is issued. Two legs behind one try / catch / finally: the RESUME leg (the walltime
4
4
  * and governance-window entrance claims, the gated decision's application, the exhaustion arms, the continuation prompt's
5
5
  * assembly — orphaned background tasks, the git frame, the parked steer queue and the wake message each under its own trust
@@ -7,7 +7,7 @@
7
7
  * frame's primary delivery, the first-frame listings, the pre-call budget / token / entry-governance gates, the image
8
8
  * conversion, the objective's human-input frame and the prompt itself). The resumed decision's application
9
9
  * (`applyResumeDecision`) and the gated call's resolver (`resolvePendingCall` — the post-CAS belts, the execution record)
10
- * are the lane's own module-private functions since design/393 S7, verbatim from the Runner's private methods: the resume
10
+ * are the lane's own module-private functions since S7, verbatim from the Runner's private methods: the resume
11
11
  * leg is their one caller, and a sibling file would be a lane-to-lane reach (the S6 legs' reading). The tail captures the abort facts; the catch
12
12
  * re-throws the resume-equivalent env failures after a bounded teardown and adopts everything else as the leg's throw;
13
13
  * the finally releases the timer, the diagnostics, the signal, the content-ask bindings, flips the notification lane
@@ -99,7 +99,7 @@ export interface RunLegResult {
99
99
  abortedLive: boolean;
100
100
  /** The snapshot of `loopLatch.userInterrupted`, taken with `abortedLive`. */
101
101
  userInterruptedLive: boolean;
102
- /** design/174: the answered-but-never-collected deliveries the finally settled. */
102
+ /** The answered-but-never-collected deliveries the finally settled. */
103
103
  strandedHumanAnswers: ReadonlyArray<{
104
104
  deliveryId: string;
105
105
  toolCallId: string;