@sema-agent/core 7.67.3 → 7.68.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 (501) hide show
  1. package/CHANGELOG.md +1537 -0
  2. package/README.md +18 -9
  3. package/README.zh-CN.md +16 -8
  4. package/dist/agents/agent-definition.d.ts +1 -1
  5. package/dist/agents/agent-definition.js +4 -1
  6. package/dist/agents/cascade.d.ts +2 -2
  7. package/dist/agents/cascade.js +3 -1
  8. package/dist/agents/cumulative-stats.d.ts +2 -1
  9. package/dist/agents/cumulative-stats.js +4 -1
  10. package/dist/agents/list-agents-tool.d.ts +30 -0
  11. package/dist/agents/list-agents-tool.js +45 -3
  12. package/dist/agents/peer-admission.d.ts +2 -2
  13. package/dist/agents/peer-session-drain.d.ts +2 -0
  14. package/dist/agents/peer-session-drain.js +1 -0
  15. package/dist/agents/repair-loop.js +3 -1
  16. package/dist/agents/retain-ledger.d.ts +61 -8
  17. package/dist/agents/retain-ledger.js +25 -3
  18. package/dist/agents/roster-store.d.ts +4 -2
  19. package/dist/agents/send-message-tool.d.ts +1 -1
  20. package/dist/agents/send-message-tool.js +20 -15
  21. package/dist/agents/subagent-steps.js +2 -10
  22. package/dist/agents/subagent.d.ts +3 -0
  23. package/dist/agents/subagent.js +106 -76
  24. package/dist/agents/tool-filter.d.ts +20 -11
  25. package/dist/agents/tool-filter.js +8 -4
  26. package/dist/agents/verify.d.ts +3 -1
  27. package/dist/agents/verify.js +2 -0
  28. package/dist/brain/anthropic.js +4 -4
  29. package/dist/brain/open-responses.js +3 -1
  30. package/dist/brain/openai.js +3 -1
  31. package/dist/brain/reasoning-request.d.ts +73 -19
  32. package/dist/brain/reasoning-request.js +164 -72
  33. package/dist/brain/reasoning-stamp.d.ts +26 -0
  34. package/dist/brain/reasoning-stamp.js +10 -0
  35. package/dist/brain/reasoning.d.ts +95 -162
  36. package/dist/brain/reasoning.js +31 -86
  37. package/dist/brain/route-adjudicator.d.ts +9 -7
  38. package/dist/brain/route-adjudicator.js +12 -10
  39. package/dist/brain/status-sink.d.ts +19 -64
  40. package/dist/brain/status-sink.js +5 -21
  41. package/dist/brain/stream-engine.d.ts +11 -2
  42. package/dist/brain/stream-engine.js +10 -0
  43. package/dist/core/a2a.d.ts +17 -5
  44. package/dist/core/a2a.js +11 -3
  45. package/dist/core/allow-entry.d.ts +35 -15
  46. package/dist/core/allow-entry.js +47 -60
  47. package/dist/core/ask-headline.d.ts +68 -0
  48. package/dist/core/ask-headline.js +23 -0
  49. package/dist/core/ask-origin.d.ts +36 -8
  50. package/dist/core/ask-origin.js +17 -10
  51. package/dist/core/ask-question.d.ts +34 -7
  52. package/dist/core/ask-question.js +10 -1
  53. package/dist/core/ask-unresolvable-notice.d.ts +7 -0
  54. package/dist/core/ask-unresolvable-notice.js +9 -3
  55. package/dist/core/auto-strip.d.ts +53 -0
  56. package/dist/core/auto-strip.js +76 -0
  57. package/dist/core/background-agent-store.d.ts +45 -5
  58. package/dist/core/background-agent-store.js +69 -15
  59. package/dist/core/background-shell.d.ts +2 -2
  60. package/dist/core/caller-text.js +2 -2
  61. package/dist/core/canonical-json.d.ts +13 -0
  62. package/dist/core/canonical-json.js +7 -0
  63. package/dist/core/checkpoint-features.d.ts +66 -20
  64. package/dist/core/checkpoint-features.js +12 -1
  65. package/dist/core/checkpoint-generation.d.ts +1 -1
  66. package/dist/core/checkpoint-queries.d.ts +1 -1
  67. package/dist/core/checkpoint-queries.js +4 -1
  68. package/dist/core/checkpoint-requirements.d.ts +45 -2
  69. package/dist/core/checkpoint-requirements.js +16 -6
  70. package/dist/core/checkpoint-row-verdict.d.ts +1 -0
  71. package/dist/core/checkpoint-row-verdict.js +4 -0
  72. package/dist/core/checkpoint-store.d.ts +66 -38
  73. package/dist/core/checkpoint-store.js +15 -6
  74. package/dist/core/child-clamp-seats.d.ts +6 -0
  75. package/dist/core/child-clamp-seats.js +1 -0
  76. package/dist/core/config-refusal-codes.d.ts +1 -1
  77. package/dist/core/config-refusal-codes.js +1 -0
  78. package/dist/core/delegation-frames.d.ts +9 -12
  79. package/dist/core/delegation-frames.js +9 -8
  80. package/dist/core/engine-capabilities.d.ts +21 -8
  81. package/dist/core/engine-capabilities.js +1 -1
  82. package/dist/core/engine-notice.d.ts +147 -34
  83. package/dist/core/engine-notice.js +27 -16
  84. package/dist/core/engine-storage-backend.d.ts +2 -1
  85. package/dist/core/env-budget.js +3 -3
  86. package/dist/core/env-knob-announce.d.ts +10 -10
  87. package/dist/core/env-knob-announce.js +3 -6
  88. package/dist/core/file-history-store.d.ts +29 -4
  89. package/dist/core/file-history-store.js +13 -0
  90. package/dist/core/frame-settlement.d.ts +2 -1
  91. package/dist/core/gate-fold.js +1 -1
  92. package/dist/core/gate-lanes.js +56 -49
  93. package/dist/core/governance-codes.d.ts +39 -3
  94. package/dist/core/governance-codes.js +61 -3
  95. package/dist/core/hooks.d.ts +29 -11
  96. package/dist/core/hooks.js +5 -2
  97. package/dist/core/human-input-projection.js +3 -3
  98. package/dist/core/input-author.d.ts +17 -3
  99. package/dist/core/input-author.js +15 -3
  100. package/dist/core/leg-identity.d.ts +10 -28
  101. package/dist/core/leg-identity.js +1 -21
  102. package/dist/core/lsp.d.ts +18 -13
  103. package/dist/core/lsp.js +30 -22
  104. package/dist/core/mailbox-store.d.ts +1 -1
  105. package/dist/core/mailbox-store.js +4 -4
  106. package/dist/core/mcp-connection-pool.d.ts +93 -4
  107. package/dist/core/mcp-connection-pool.js +104 -1
  108. package/dist/core/mcp-failure.d.ts +38 -12
  109. package/dist/core/mcp-failure.js +9 -13
  110. package/dist/core/mcp-probe.d.ts +4 -3
  111. package/dist/core/mcp-server-link.d.ts +4 -2
  112. package/dist/core/mcp-server-link.js +4 -5
  113. package/dist/core/mcp-server-spec.d.ts +3 -3
  114. package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
  115. package/dist/core/mcp-server-unavailable-notice.js +18 -4
  116. package/dist/core/mcp.d.ts +40 -6
  117. package/dist/core/mcp.js +39 -13
  118. package/dist/core/memory-engine/content-origin.js +2 -2
  119. package/dist/core/memory-engine/control-objects.d.ts +2 -4
  120. package/dist/core/memory-engine/control-objects.js +2 -10
  121. package/dist/core/memory-engine/delegation-settlement.js +6 -1
  122. package/dist/core/memory-engine/dual-root.js +3 -0
  123. package/dist/core/memory-engine/engine.d.ts +6 -4
  124. package/dist/core/memory-engine/engine.js +32 -29
  125. package/dist/core/memory-engine/file-backend.d.ts +20 -5
  126. package/dist/core/memory-engine/file-backend.js +21 -31
  127. package/dist/core/memory-engine/frontmatter.d.ts +2 -0
  128. package/dist/core/memory-engine/frontmatter.js +4 -0
  129. package/dist/core/memory-engine/layout.d.ts +114 -20
  130. package/dist/core/memory-engine/layout.js +340 -22
  131. package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
  132. package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
  133. package/dist/core/memory-engine/mount-failed-notice.js +43 -10
  134. package/dist/core/memory-engine/sync-client.js +4 -5
  135. package/dist/core/model-fallbacks.d.ts +5 -1
  136. package/dist/core/model-fallbacks.js +3 -3
  137. package/dist/core/model-receipt.d.ts +2 -1
  138. package/dist/core/model-receipt.js +12 -1
  139. package/dist/core/mods/kernel/dispatch.d.ts +2 -2
  140. package/dist/core/mods/kernel/dispatch.js +14 -6
  141. package/dist/core/mods/kernel/events.d.ts +8 -5
  142. package/dist/core/mods/kernel/events.js +2 -2
  143. package/dist/core/mods/kernel/index.d.ts +1 -1
  144. package/dist/core/mods/kernel/registration.d.ts +9 -0
  145. package/dist/core/mods/package.js +1 -1
  146. package/dist/core/mods/session-append.d.ts +4 -2
  147. package/dist/core/mods/session-append.js +3 -0
  148. package/dist/core/mods/stations.d.ts +7 -11
  149. package/dist/core/mods/stations.js +4 -7
  150. package/dist/core/mods/tool-call.d.ts +10 -8
  151. package/dist/core/mods/tool-call.js +15 -18
  152. package/dist/core/mounted-mcp.d.ts +0 -4
  153. package/dist/core/mounted-mcp.js +1 -1
  154. package/dist/core/park-noun.d.ts +24 -0
  155. package/dist/core/park-noun.js +21 -0
  156. package/dist/core/park-resumability.d.ts +60 -0
  157. package/dist/core/park-resumability.js +30 -0
  158. package/dist/core/permission-rule-provider.d.ts +24 -2
  159. package/dist/core/permission-rule-provider.js +11 -8
  160. package/dist/core/permission-rule-store.d.ts +8 -1
  161. package/dist/core/permission-rule-store.js +2 -3
  162. package/dist/core/permission-rules.d.ts +2 -1
  163. package/dist/core/permission-rules.js +8 -4
  164. package/dist/core/persisted-rule-arms.d.ts +3 -0
  165. package/dist/core/persisted-rule-arms.js +2 -1
  166. package/dist/core/present-plan-tool.d.ts +47 -3
  167. package/dist/core/present-plan-tool.js +62 -4
  168. package/dist/core/principal-name.d.ts +1 -1
  169. package/dist/core/principal-name.js +5 -5
  170. package/dist/core/process-identity.js +10 -5
  171. package/dist/core/protocol-http-auth.d.ts +20 -14
  172. package/dist/core/protocol-http-auth.js +70 -50
  173. package/dist/core/read-only-shell.js +9 -5
  174. package/dist/core/redaction-marks.d.ts +4 -26
  175. package/dist/core/redaction-marks.js +9 -21
  176. package/dist/core/remote-env.d.ts +43 -16
  177. package/dist/core/remote-env.js +1 -1
  178. package/dist/core/request-copy-projection.d.ts +1 -1
  179. package/dist/core/request-copy-projection.js +40 -50
  180. package/dist/core/resume-config-judge.js +1 -1
  181. package/dist/core/resume-startup-cause.d.ts +35 -18
  182. package/dist/core/resume-startup-cause.js +13 -10
  183. package/dist/core/retention.d.ts +167 -25
  184. package/dist/core/retention.js +100 -20
  185. package/dist/core/roles.d.ts +6 -0
  186. package/dist/core/roles.js +11 -5
  187. package/dist/core/rule-lane-reads.d.ts +3 -0
  188. package/dist/core/rule-lane-reads.js +5 -1
  189. package/dist/core/rule-store-fault.d.ts +70 -0
  190. package/dist/core/rule-store-fault.js +102 -0
  191. package/dist/core/runner/advertised-writable-dirs.js +16 -31
  192. package/dist/core/runner/announce-once-ledger.d.ts +19 -2
  193. package/dist/core/runner/announce-once-ledger.js +24 -2
  194. package/dist/core/runner/assemble-result.d.ts +6 -0
  195. package/dist/core/runner/assemble-result.js +1 -1
  196. package/dist/core/runner/auto-strip-notice.d.ts +36 -0
  197. package/dist/core/runner/auto-strip-notice.js +59 -0
  198. package/dist/core/runner/branch-window.d.ts +3 -0
  199. package/dist/core/runner/branch-window.js +37 -0
  200. package/dist/core/runner/caller-roster.d.ts +8 -3
  201. package/dist/core/runner/capability-withheld-seat.js +3 -9
  202. package/dist/core/runner/clock-and-limits.d.ts +22 -1
  203. package/dist/core/runner/clock-and-limits.js +30 -0
  204. package/dist/core/runner/contracts.d.ts +58 -35
  205. package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
  206. package/dist/core/runner/credential-refusal-seat.js +47 -0
  207. package/dist/core/runner/cross-boundary-lane.js +6 -4
  208. package/dist/core/runner/decide-continuation.js +1 -1
  209. package/dist/core/runner/file-history-restore.d.ts +53 -2
  210. package/dist/core/runner/file-history-restore.js +29 -10
  211. package/dist/core/runner/forward-sink.d.ts +14 -1
  212. package/dist/core/runner/forward-sink.js +14 -12
  213. package/dist/core/runner/gate-exit.d.ts +8 -7
  214. package/dist/core/runner/gate-exit.js +13 -13
  215. package/dist/core/runner/git-status-frame.js +2 -4
  216. package/dist/core/runner/initial-run-state.js +1 -1
  217. package/dist/core/runner/main-call-account.d.ts +3 -1
  218. package/dist/core/runner/main-call-account.js +5 -3
  219. package/dist/core/runner/mcp-redial.d.ts +2 -5
  220. package/dist/core/runner/mcp-redial.js +2 -2
  221. package/dist/core/runner/nested-memory-content.d.ts +7 -1
  222. package/dist/core/runner/nested-memory-content.js +73 -13
  223. package/dist/core/runner/nested-memory-lane.d.ts +44 -19
  224. package/dist/core/runner/nested-memory-lane.js +152 -76
  225. package/dist/core/runner/park-commit.js +3 -1
  226. package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
  227. package/dist/core/runner/permission-rule-lanes.js +29 -3
  228. package/dist/core/runner/person-path-rows.d.ts +3 -11
  229. package/dist/core/runner/person-path-rows.js +21 -24
  230. package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
  231. package/dist/core/runner/prepare-artifact.d.ts +1 -1
  232. package/dist/core/runner/prepare-artifact.js +20 -14
  233. package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
  234. package/dist/core/runner/prepare-ask-lane.js +6 -5
  235. package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
  236. package/dist/core/runner/prepare-boundary-parks.js +27 -24
  237. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
  238. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  239. package/dist/core/runner/prepare-config-doors.d.ts +9 -24
  240. package/dist/core/runner/prepare-config-doors.js +58 -41
  241. package/dist/core/runner/prepare-context-lane.d.ts +2 -2
  242. package/dist/core/runner/prepare-context-lane.js +3 -5
  243. package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
  244. package/dist/core/runner/prepare-defer-classify.js +1 -1
  245. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  246. package/dist/core/runner/prepare-delegation-surface.js +3 -2
  247. package/dist/core/runner/prepare-file-history.d.ts +62 -26
  248. package/dist/core/runner/prepare-file-history.js +117 -46
  249. package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
  250. package/dist/core/runner/prepare-gate-stations.js +6 -5
  251. package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
  252. package/dist/core/runner/prepare-hands-readface.js +8 -4
  253. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  254. package/dist/core/runner/prepare-inherited-gate.js +6 -6
  255. package/dist/core/runner/prepare-listings.d.ts +1 -1
  256. package/dist/core/runner/prepare-listings.js +1 -1
  257. package/dist/core/runner/prepare-memory.js +2 -2
  258. package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
  259. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  260. package/dist/core/runner/prepare-park-ask.d.ts +10 -3
  261. package/dist/core/runner/prepare-park-ask.js +7 -9
  262. package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
  263. package/dist/core/runner/prepare-policy-chain.js +18 -13
  264. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  265. package/dist/core/runner/prepare-project-context.js +5 -3
  266. package/dist/core/runner/prepare-prompt-assembly.js +2 -1
  267. package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
  268. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  269. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
  270. package/dist/core/runner/prepare-protocol-tools.js +7 -7
  271. package/dist/core/runner/prepare-question-face.d.ts +4 -2
  272. package/dist/core/runner/prepare-run-refs.d.ts +7 -2
  273. package/dist/core/runner/prepare-run-refs.js +8 -7
  274. package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
  275. package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
  276. package/dist/core/runner/prepare-suspend-saga.js +4 -3
  277. package/dist/core/runner/prepare-task.js +66 -53
  278. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
  279. package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
  280. package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
  281. package/dist/core/runner/prepare-turn-wiring.js +1 -1
  282. package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
  283. package/dist/core/runner/prepare-wiring-manifest.js +14 -6
  284. package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
  285. package/dist/core/runner/prepare-workspace-restore.js +15 -6
  286. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  287. package/dist/core/runner/restore-seat.d.ts +41 -0
  288. package/dist/core/runner/restore-seat.js +38 -0
  289. package/dist/core/runner/resume-admission.js +1 -1
  290. package/dist/core/runner/resume-apply.js +4 -3
  291. package/dist/core/runner/resume-checkpoint-screen.js +2 -1
  292. package/dist/core/runner/resume-internals-and-config.js +2 -1
  293. package/dist/core/runner/resume-preflight.js +2 -1
  294. package/dist/core/runner/rewind-files.js +22 -6
  295. package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
  296. package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
  297. package/dist/core/runner/run-brain-sinks.d.ts +3 -6
  298. package/dist/core/runner/run-brain-sinks.js +6 -6
  299. package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
  300. package/dist/core/runner/run-git-lane.d.ts +2 -0
  301. package/dist/core/runner/run-git-lane.js +2 -1
  302. package/dist/core/runner/run-harness-handlers.js +5 -4
  303. package/dist/core/runner/run-identity-wiring.js +20 -12
  304. package/dist/core/runner/run-leg.js +31 -72
  305. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  306. package/dist/core/runner/run-notification-lane.js +2 -4
  307. package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
  308. package/dist/core/runner/run-reasoning-seat.js +13 -18
  309. package/dist/core/runner/run-settle-and-teardown.js +13 -9
  310. package/dist/core/runner/run-terminal-adoption.js +4 -8
  311. package/dist/core/runner/run-turn-boundary.js +6 -3
  312. package/dist/core/runner/runtask.d.ts +9 -4
  313. package/dist/core/runner/runtask.js +29 -22
  314. package/dist/core/runner/session-rule-policy.d.ts +11 -1
  315. package/dist/core/runner/shell-env-withheld.js +2 -7
  316. package/dist/core/runner/side-call-account.d.ts +5 -6
  317. package/dist/core/runner/side-call-account.js +2 -2
  318. package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
  319. package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
  320. package/dist/core/runner/stream-settle-backstop.js +4 -6
  321. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  322. package/dist/core/runner/stream-steer-verb.js +4 -4
  323. package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
  324. package/dist/core/runner/sub-agent-deny-lists.js +7 -4
  325. package/dist/core/runner/teardown-bounded.d.ts +7 -0
  326. package/dist/core/runner/teardown-bounded.js +7 -0
  327. package/dist/core/runner/terminal-account.js +41 -13
  328. package/dist/core/runner/terminal-projection.d.ts +1 -5
  329. package/dist/core/runner/tool-end-body.d.ts +9 -3
  330. package/dist/core/runner/tool-end-body.js +6 -3
  331. package/dist/core/runner/tool-output-projection.d.ts +13 -4
  332. package/dist/core/runner/tool-output-projection.js +10 -14
  333. package/dist/core/runner/turn-attachments.d.ts +3 -2
  334. package/dist/core/runner/turn-attachments.js +12 -5
  335. package/dist/core/runner-deps.d.ts +6 -6
  336. package/dist/core/runtime-caps.d.ts +2 -1
  337. package/dist/core/secret-env.d.ts +20 -3
  338. package/dist/core/secret-env.js +13 -15
  339. package/dist/core/session-checkout.d.ts +115 -15
  340. package/dist/core/session-checkout.js +435 -136
  341. package/dist/core/session-policy-store.js +21 -3
  342. package/dist/core/session-reconcile.js +1 -0
  343. package/dist/core/session-store.js +2 -0
  344. package/dist/core/session.d.ts +11 -1
  345. package/dist/core/shell-run-candidates.d.ts +1 -0
  346. package/dist/core/shell-run-candidates.js +1 -1
  347. package/dist/core/shutdown-debug.d.ts +6 -5
  348. package/dist/core/shutdown-debug.js +5 -1
  349. package/dist/core/skill-grant.js +4 -1
  350. package/dist/core/skills-directory.js +5 -3
  351. package/dist/core/spec-contract.d.ts +1 -1
  352. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
  353. package/dist/core/store-contracts/file-history-store-contract.js +26 -2
  354. package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
  355. package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
  356. package/dist/core/store-contracts/task-list-store-contract.js +28 -1
  357. package/dist/core/task-event.d.ts +48 -27
  358. package/dist/core/task-notification.d.ts +15 -9
  359. package/dist/core/task-notification.js +12 -0
  360. package/dist/core/task-registry-agent.d.ts +24 -22
  361. package/dist/core/task-registry-agent.js +65 -46
  362. package/dist/core/task-registry-shared.d.ts +17 -5
  363. package/dist/core/task-registry.d.ts +17 -6
  364. package/dist/core/task-registry.js +6 -1
  365. package/dist/core/task-result.d.ts +71 -25
  366. package/dist/core/task-spec-members.d.ts +0 -1
  367. package/dist/core/task-spec-members.js +1 -1
  368. package/dist/core/task-spec.d.ts +60 -52
  369. package/dist/core/task-stream.d.ts +45 -12
  370. package/dist/core/terminal-cause.d.ts +45 -8
  371. package/dist/core/terminal-cause.js +5 -0
  372. package/dist/core/tool-card-bound.d.ts +32 -0
  373. package/dist/core/tool-card-bound.js +33 -0
  374. package/dist/core/tool-catalog-entries.d.ts +9 -0
  375. package/dist/core/tool-catalog-entries.js +48 -0
  376. package/dist/core/tool-errors.d.ts +4 -3
  377. package/dist/core/tool-face.d.ts +3 -3
  378. package/dist/core/tool-mount-facts.d.ts +3 -2
  379. package/dist/core/tool-mount-facts.js +1 -1
  380. package/dist/core/tool-mount-static.js +7 -5
  381. package/dist/core/tool-policy.d.ts +21 -19
  382. package/dist/core/tool-policy.js +5 -6
  383. package/dist/core/tool-registry.d.ts +3 -1
  384. package/dist/core/tool-registry.js +15 -1
  385. package/dist/core/tool-result-store.d.ts +9 -3
  386. package/dist/core/tool-result-store.js +14 -1
  387. package/dist/core/tool-roster.d.ts +18 -0
  388. package/dist/core/tool-roster.js +30 -1
  389. package/dist/core/tool-spec.d.ts +17 -8
  390. package/dist/core/trace.d.ts +35 -31
  391. package/dist/core/types.d.ts +2 -2
  392. package/dist/core/untrusted-egress.d.ts +10 -9
  393. package/dist/core/untrusted-egress.js +9 -9
  394. package/dist/core/untrusted-text.d.ts +0 -18
  395. package/dist/core/untrusted-text.js +7 -3
  396. package/dist/core/user-attachment.d.ts +9 -6
  397. package/dist/core/user-attachment.js +12 -10
  398. package/dist/core/user-row-origin.d.ts +44 -25
  399. package/dist/core/user-row-origin.js +30 -20
  400. package/dist/core/wiring-manifest.d.ts +26 -7
  401. package/dist/core/wiring-manifest.js +14 -11
  402. package/dist/core/workspace-snapshot.d.ts +3 -1
  403. package/dist/core/workspace-snapshot.js +1 -0
  404. package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
  405. package/dist/engine/execution-env/node-execution-env.js +127 -67
  406. package/dist/engine/harness/agent-harness.d.ts +4 -5
  407. package/dist/engine/harness/agent-harness.js +2 -7
  408. package/dist/engine/harness/types.d.ts +51 -19
  409. package/dist/engine/harness/types.js +28 -1
  410. package/dist/engine/llm/types.d.ts +26 -14
  411. package/dist/engine/llm/types.js +2 -2
  412. package/dist/engine/loop/agent-loop.d.ts +2 -2
  413. package/dist/engine/loop/agent-loop.js +51 -275
  414. package/dist/engine/loop/types.d.ts +0 -18
  415. package/dist/engine/session/import-validate.d.ts +3 -0
  416. package/dist/engine/session/import-validate.js +34 -2
  417. package/dist/engine/session/repo-utils.d.ts +42 -4
  418. package/dist/engine/session/repo-utils.js +33 -5
  419. package/dist/engine/session/session.d.ts +41 -14
  420. package/dist/engine/session/session.js +96 -25
  421. package/dist/index.d.ts +21 -16
  422. package/dist/index.js +16 -10
  423. package/dist/orchestration/run-spec.d.ts +1 -1
  424. package/dist/orchestration/run-workflow-tool.d.ts +12 -9
  425. package/dist/orchestration/run-workflow-tool.js +15 -19
  426. package/dist/orchestration/workflow-governance.js +13 -21
  427. package/dist/orchestration/workflow-observe.d.ts +4 -3
  428. package/dist/orchestration/workflow-primitives.d.ts +1 -1
  429. package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
  430. package/dist/orchestration/workflow-record-artifact.js +32 -0
  431. package/dist/orchestration/workflow-script-store.d.ts +9 -0
  432. package/dist/orchestration/workflow-script-store.js +20 -1
  433. package/dist/orchestration/workflow-types.d.ts +33 -3
  434. package/dist/orchestration/workflow.d.ts +24 -14
  435. package/dist/orchestration/workflow.js +52 -23
  436. package/dist/prompt-assembly/artifact.js +4 -8
  437. package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
  438. package/dist/prompt-assembly/catalog/engine.js +30 -0
  439. package/dist/prompt-assembly/catalog/index.d.ts +1 -1
  440. package/dist/prompt-assembly/catalog/index.js +2 -2
  441. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
  442. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
  443. package/dist/prompt-assembly/epoch.js +6 -8
  444. package/dist/prompt-assembly/turn-snapshot.js +8 -9
  445. package/dist/stores/file/background-agent-store.js +5 -6
  446. package/dist/stores/file/checkpoint-store.d.ts +0 -4
  447. package/dist/stores/file/checkpoint-store.js +7 -3
  448. package/dist/stores/file/file-history-store.d.ts +8 -0
  449. package/dist/stores/file/file-history-store.js +72 -0
  450. package/dist/stores/file/fs-atomic.js +17 -12
  451. package/dist/stores/file/index.js +11 -5
  452. package/dist/stores/file/mailbox-store.js +13 -4
  453. package/dist/stores/file/permission-rule-store.js +14 -13
  454. package/dist/stores/file/shared-ledger.d.ts +4 -0
  455. package/dist/stores/file/shared-ledger.js +4 -0
  456. package/dist/stores/file/task-list-store.js +12 -3
  457. package/dist/stores/file/workflow-run-store.js +1 -0
  458. package/dist/tools/fs/bash-program-position.d.ts +4 -2
  459. package/dist/tools/fs/bash-program-position.js +1 -1
  460. package/dist/tools/fs/bash-readonly-classifier.js +1 -1
  461. package/dist/tools/fs/bound-open.d.ts +97 -0
  462. package/dist/tools/fs/bound-open.js +103 -0
  463. package/dist/tools/fs/containment-face.d.ts +2 -2
  464. package/dist/tools/fs/fs-pdf.d.ts +7 -1
  465. package/dist/tools/fs/fs-pdf.js +31 -23
  466. package/dist/tools/fs/fs-read.d.ts +24 -17
  467. package/dist/tools/fs/fs-read.js +84 -53
  468. package/dist/tools/fs/fs-shared.d.ts +14 -12
  469. package/dist/tools/fs/fs-shared.js +5 -4
  470. package/dist/tools/fs/fs-write.d.ts +2 -2
  471. package/dist/tools/fs/fs-write.js +20 -12
  472. package/dist/tools/fs/index.d.ts +4 -4
  473. package/dist/tools/fs/index.js +2 -2
  474. package/dist/tools/fs/notebook.d.ts +1 -1
  475. package/dist/tools/fs/pdf.d.ts +12 -3
  476. package/dist/tools/fs/pdf.js +22 -9
  477. package/dist/tools/fs/read-deny-home.d.ts +3 -2
  478. package/dist/tools/fs/read-deny-home.js +8 -11
  479. package/dist/tools/fs/safety.d.ts +3 -2
  480. package/dist/tools/fs/shell-read-check.js +10 -9
  481. package/dist/tools/monitor.d.ts +6 -5
  482. package/dist/tools/task-list.d.ts +16 -6
  483. package/dist/tools/task-list.js +4 -0
  484. package/dist/tools/web.d.ts +9 -1
  485. package/dist/tools/web.js +8 -3
  486. package/dist/tools/worktree.d.ts +7 -5
  487. package/dist/tools/worktree.js +4 -3
  488. package/package.json +4 -3
  489. package/test/export-surface.snapshot.json +93 -7
  490. package/wire-changes/core-stores-sql@7.68.0.json +39 -0
  491. package/wire-changes/core-stores-sql@7.68.1.json +39 -0
  492. package/wire-changes/core@7.68.0.json +4257 -0
  493. package/wire-changes/core@7.68.1.json +95 -0
  494. package/wire-changes/mods-kernel@7.68.0.json +129 -0
  495. package/wire-changes/mods-kernel@7.68.1.json +39 -0
  496. package/wire-changes/primitives@7.68.0.json +253 -0
  497. package/wire-changes/primitives@7.68.1.json +39 -0
  498. package/wire-changes/wiki-gate@7.68.0.json +39 -0
  499. package/wire-changes/wiki-gate@7.68.1.json +39 -0
  500. package/dist/core/runner/credential-origin-seat.d.ts +0 -2
  501. package/dist/core/runner/credential-origin-seat.js +0 -20
@@ -69,6 +69,11 @@ export interface EngineNotice {
69
69
  * per Runner for the deployment's (at construction, no session). `detail: { sessionId?, entries: [{ source, entry,
70
70
  * reason, skill?, list? }] }` (`source` ∈ `skill` / `request` / `deployment`; `skill` and `list` only on a skill's;
71
71
  * `reason` ∈ {@link import("./allow-entry.js").ALLOW_ENTRY_INERT_REASONS}; `entry` is the entry as written — the message spells it — when it is at most `NOTICE_RULE_TEXT_MAX` (1 024) code points; a longer one is cut to 1 024 plus the truncation mark, 1 025 in all).
72
+ * - `"permission.allow_rule_not_used_in_auto"` — auto mode does not use an allow rule the person holds (`auto-strip.ts`): the calls
73
+ * it names go to the classifier. Said at the first call in `auto` the rule would have been read for, then not again in the
74
+ * conversation for that rule (`src/core/runner/auto-strip-notice.ts`). Audience `user`. `detail: { entry, source, reason, toolName,
75
+ * toolCallId, skill?, sessionId, sourceSessionId?, agentId?, runId }` — `source` ∈ `user` / `project` / `session` (a stored row's
76
+ * source) / `request` / `deployment` / `skill`, `reason` from {@link import("./auto-strip.js").AUTO_STRIP_REASONS}.
72
77
  * - `"mods.registration_refused"` — an extension registration was not mounted: a registration admitted before it
73
78
  * answered `{ refuse }` on `plugin.register`, or failed while judging it (fail-closed). The run goes on without it.
74
79
  * Audience `user` (the seat is in `detail`). Once per refused registration per run. `detail: { name, seat, tier,
@@ -184,16 +189,70 @@ export interface EngineNotice {
184
189
  * key: (code, occurrenceId). NOT the whole family: a SPEC field written on the options object
185
190
  * (`model`, `modelName`, `thinking`, …) is REFUSED at the membrane instead — a silently ignored
186
191
  * `model` runs a different agent than the author asked for.
187
- * - `"config.forward_sink_failed"` — the deployment's opt-in subagent display sink
188
- * (`RunInternals.onForwardEvent`) failed and the frame it was handed was dropped: it threw, or —
189
- * since an `async` function satisfies that `=> void` seat — it returned a promise that rejected.
190
- * The run is untouched (forwarding is a render channel, and delivery is never awaited, so a sink
191
- * that never settles is not a failure and announces nothing). `detail: { site, cause }` — `site` is
192
- * the engine-owned site name the failures are counted under, `cause` the thrown value's message.
193
- * Audience `operator`: the sink is deployment wiring and nobody else can repair it. Dedup unit:
194
- * once per RUN (the counters ride `RunInternals.forwardScope`, which every copy of a run's
195
- * internals carries), later failures of the same run counted only — a sink that fails on every
196
- * frame therefore costs ONE line, not one per frame.
192
+ * - `"config.host_sink_failed"` — a host seat the run calls failed and was contained: it threw, or —
193
+ * since an `async` function satisfies a `=> void` seat — it returned a promise that rejected. The run
194
+ * is untouched (the seat's frame or event is dropped; delivery is never awaited, so a seat that never
195
+ * settles is not a failure and announces nothing). `detail: { site, cause }` — `site` names the seat:
196
+ * `"run_internals"` (a `RunInternals` sink — `onLegFrame`, `onActivity`, …), `"delegation_lifecycle"`
197
+ * (`RunnerDeps.onDelegationLifecycle`) or `"forward"` (the subagent display sink,
198
+ * `RunInternals.onForwardEvent`); `cause` is the thrown value's message. Audience `operator`: the seat
199
+ * is deployment wiring and nobody else can repair it. Dedup unit: once per engine-owned site name per
200
+ * run (the forward sink's counters ride `RunInternals.forwardScope`, which every copy of a run's
201
+ * internals carries), later failures counted only — a seat that fails on every frame costs ONE line.
202
+ * Replaces `config.forward_sink_failed` (that code's `detail.site` read `"runtask.onForwardEvent"`).
203
+ * - `"config.seat_malformed"` — a host seat is present but is not a function: the delegation-lifecycle
204
+ * observer (`RunnerDeps.onDelegationLifecycle` — its frames are not delivered) or a Node environment's
205
+ * `onSecretEnvScrub` (its findings fall back to the summary line). `detail: { seat }`. Audience
206
+ * `operator`. Once per process per seat.
207
+ * - `"config.env_knob_adjusted"` — a process-level numeric env knob was not used as written: ignored (not
208
+ * a positive whole number — the default stands), capped to its ceiling or raised to its floor; the
209
+ * sentence names the value asked for and the value in force. `detail: { name, applied? }` — `applied`
210
+ * is the number in force, absent when a downstream built-in default stands. Said on the default seat;
211
+ * audience `operator`; once per process per distinct sentence.
212
+ * - `"config.read_deny_home"` — placing read-deny rows under a home could not settle one of its facts:
213
+ * `detail.kind` is `"bad_value"` (an account value that is no home), `"unanswered"` (the account
214
+ * lookup failed), `"auxiliary"` / `"config_root"` (a home or config root that did not answer its
215
+ * probes) — each once per process — or `"placement_lost"` (an engine defect: a tool band handed a home
216
+ * list that is not its placement's, said every time). Said on the default seat; audience `operator`.
217
+ * - `"config.permission_rules_skipped"` — `createPermissionRulePolicy` under `onInvalidRule: "skip"`
218
+ * dropped rules it could not compile and was given no `onIssue`. `detail: { count, codes }` — the
219
+ * number of rules and their distinct issue codes; the sentence names each rule. Said on the default
220
+ * seat; audience `operator`; once per construction.
221
+ * - `"config.process_start_time_unavailable"` — this host cannot report process start times, so every
222
+ * record naming a process (a file store's directory lock, a run claim, a memory writer's session
223
+ * account) is judged by pid alone. `detail: { reason }`. Said on the default seat; audience
224
+ * `operator`; once per process.
225
+ * - `"store.tail_segment_unjudged"` — a file store's JSONL tail segment larger than the judgeable bound
226
+ * was ended as a line, not judged; its bytes are untouched. `detail: { path }`. Said on the default
227
+ * seat; audience `operator`; once per repair.
228
+ * - `"store.lock_retained"` — a lock this live process took could not be handed back, so it may still
229
+ * name this pid: `detail: { lock, path, pid }`, `lock` one of `"directory_fence"`, `"boot"` (a file
230
+ * store's data root) or `"mailbox"` (a box lock, unreadable at release or not removable). Said on the
231
+ * default seat; audience `operator`; once per failed release.
232
+ * - `"memory.notice_unscoped"` — a memory notice (the engine's, or a file store's) named no single
233
+ * scope, so it was kept off every session's memory notices; said here only when the memory engine has
234
+ * no incident sink (with one, the sink is told `memory.announcement_withheld`). `detail: { stage }`.
235
+ * Said on the default seat; audience `operator`.
236
+ * - `"delegation.settlement_external"` — a background delegation settled EXTERNAL after launch: its
237
+ * session is marked and its unmarked committed contributions are challenged. `detail: { sessionId }`.
238
+ * Said on the default seat; audience `operator`; once per applied settlement.
239
+ * - `"delegation.settlement_write_failed"` — a background delegation's settlement verdict could not be
240
+ * written after its retries; the pending row expires as unproven at the settlement window.
241
+ * `detail: { verdict, sessionId, fork }`. Said on the notice seat of the runner that mounted the
242
+ * delegation tool; audience `operator`.
243
+ * - `"delegation.durable_row_unpersisted"` — a durable background-agent row's bookkeeping stopped:
244
+ * `detail.kind` is `"terminal_unrecoverable"` (a terminal flush the heartbeat could not land in 60
245
+ * re-drives), `"poisoned"` (the lane met a foreign writer or a write it could not recover — no more
246
+ * writes for that row) or `"admission"` (an org-admission verdict was not persisted); `detail.handle`
247
+ * names the row. Said on the default seat; audience `operator`. Formerly a process `warning` event.
248
+ * - `"delegation.parked_card_unreadable"` — the store sweep could not read a parked background agent's approval card
249
+ * (its body does not decode, or it carries no state word, and the store's listing states none): the row is left parked.
250
+ * `detail: { handle, scope, cause }`, `cause` `"decode"` | `"no_state"`; once per (scope, handle) per process; said on the
251
+ * default seat; audience `operator`. Formerly a process `warning` event.
252
+ * - `"engine.debug_trace"` — an operator's opt-in trace: `SEMA_DEBUG_SHUTDOWN=1` (`detail.topic:
253
+ * "shutdown"` plus the step's own facts) or `SEMA_DEBUG_WORKFLOW_JOURNAL=1` (`detail: { topic:
254
+ * "workflow_journal", runId, callKey }`). One per traced step; said on the default seat; audience
255
+ * `operator`; never minted unless the flag is set.
197
256
  * - `"memory.restore_withheld"` — a memory containment DID NOT write a committed baseline back: another
198
257
  * writer held the path when the restore reached it, and those newer bytes were left standing.
199
258
  * Containment is unaffected and the committed copy is still in the store, so reconciling the two is
@@ -238,7 +297,7 @@ export interface EngineNotice {
238
297
  * (`McpAuthorization`). `detail: { server, reason, authorizeUrl?, principal?, sessionId, runId }` —
239
298
  * `reason` is `rejected` (401) / `scope` (403 insufficient_scope) / `none` (the seat holds no
240
299
  * authorization for this user), `authorizeUrl` the seat's own (never the endpoint's
241
- * `resource_metadata`, which rides the record only). `"user"` audience: nobody but the user can
300
+ * `resource_metadata`, which rides the record only). The `message` names no address (it points at the host's prompt). `"user"` audience: nobody but the user can
242
301
  * authorize; `sessionId` REQUIRED at the mint. Dedup unit: once per (leg, server) — a resume is a new
243
302
  * leg and may announce again. A deployment that waits for the authorization keys on this notice; the
244
303
  * leg itself does not park on it.
@@ -247,9 +306,12 @@ export interface EngineNotice {
247
306
  * warning the operator reads on `onError` (`{ phase: "mcp" }`, code `mcp.server_unavailable`): derived at the Runner's drain of the
248
307
  * materialization's warning lane from the warning object itself, so the two are one fact; the wiring manifest's `mcp` row and the
249
308
  * materialization's `statuses` already read `failed` and are not touched. `detail: { server, sessionId, runId }` — `server` is the
250
- * declared entry's name, never the failure's text, a URL, a command or a path. A server whose dial failed `unauthorized` is NOT told
251
- * here — `mcp.authorization_required` is its notice. `"user"` audience; `sessionId` REQUIRED at the mint. Dedup unit: once per
252
- * (leg, server) — a later leg whose dial fails again is a new fact; a consumer folding per session would hide a second server's.
309
+ * declared entry's name, never the failure's text, a URL, a command or a path; `sessionId` the session whose MCP pool holds the
310
+ * attempt (a child's or a workflow agent's: the session that handed it the pool), `runId` the leg's. A server whose dial failed
311
+ * `unauthorized` is NOT told here — `mcp.authorization_required` is its notice. `"user"` audience; `sessionId` REQUIRED at the mint.
312
+ * Dedup unit: once per failed connection attempt — a failure that waited out the startup bound is remembered by the session and
313
+ * told once (later legs dial nothing), any other is told on each leg it ends; a consumer folding per session would hide a second
314
+ * server's.
253
315
  * - `"mcp.credential_echoed"` — a protocol peer (an MCP server, an A2A peer) echoed a credential its
254
316
  * connection's requests carried into what it said about itself: an MCP server's `serverInfo`, its
255
317
  * instructions or its tool listing, an A2A peer's agent card. The engine reads that account through
@@ -385,7 +447,7 @@ export interface EngineNotice {
385
447
  * `user`: on a lane with no approval face this line is the only place the user hears why the call did not
386
448
  * run. It is not a block — the denial limit does not count it.
387
449
  * - `"route.credential_origin_mismatch"` (key↔URL pairing, `src/brain/route-adjudicator.ts`; announced by
388
- * `src/core/runner/credential-origin-seat.ts`) — a request was REFUSED, nothing sent, because the per-model
450
+ * `src/core/runner/credential-refusal-seat.ts`) — a request was REFUSED, nothing sent, because the per-model
389
451
  * credential it would carry is bound to another origin: the law binds a per-model credential to the origin
390
452
  * (scheme + host + port) of the first request sent carrying it (or the one the host rebinds it to,
391
453
  * `route.credential_rebound`), so an entry whose `baseUrl` moved to another
@@ -396,6 +458,14 @@ export interface EngineNotice {
396
458
  * failed hears why; the operator hears it through the sink. `detail: { modelId, boundOrigin, requestOrigin,
397
459
  * sessionId, runId }` — the two origins in display spelling, never a credential or a digest of one. Once per
398
460
  * run per (modelId, boundOrigin, requestOrigin).
461
+ * - `"route.credential_mismatch"` (the deployment credential's pairing, `src/brain/route-adjudicator.ts`; announced by the same
462
+ * seat, `src/core/runner/credential-refusal-seat.ts`, as the entry above) — a request was REFUSED, nothing sent, because the
463
+ * deployment credential is paired with the brain's root and this model's request was going to another: a credential does not
464
+ * follow a model to another host. The request's own failure carries the same code (`[invalid_request] route.credential_mismatch:
465
+ * …`). Minted only for a request the gate refused (`routeRefusalError`), as the entry above says. Audience `user`, for the same
466
+ * reader. `detail: { modelId, requestBaseUrl, configBaseUrl, sessionId, runId }` — the request's root and the declared root
467
+ * (`""` when the brain declares none) in display spelling, never a credential or a digest of one. Once per run per
468
+ * (modelId, requestBaseUrl, configBaseUrl).
399
469
  * - `"route.credential_rebound"` (`rebindCredentialOrigin`, `src/brain/route-adjudicator.ts`) — the HOST moved a
400
470
  * per-model credential's binding, explicitly: every secret the credential carries is now bound to the origin the
401
471
  * named entry sends to, and a request carrying it anywhere else (another entry still on the old host included) is
@@ -517,6 +587,21 @@ export interface EngineNotice {
517
587
  * (path, reason), across runs; a delegated leg records it and says nothing. A file that exists but cannot be read
518
588
  * (an I/O error, not text, past the read bound) is the operator's line instead (`onError` phase `degraded`,
519
589
  * classification `attachment-read`), once per session per path.
590
+ * - `"instructions.family_undeclared"` (#4179) — a run was prepared with no instruction family declared (`TaskSpec.instructionFamily`
591
+ * absent, `projectMemory` not `"disabled"`): no run of this deployment reads an instruction file (CLAUDE.md or another) into the
592
+ * model's context, and the wiring manifest says only `projectMemory: "absent"`. Declare the family (which file names, which rules
593
+ * directory) to read them. Audience `operator`; `detail: { sessionId }` — the session of the run that first met the absence. ONCE PER NOTICE RECEIVER
594
+ * (the `onNotice` function: every run, session, delegated leg and further Runner built over the same function says nothing more; with no
595
+ * receiver wired, once per process at the default seat). A run whose request set `projectMemory: "disabled"` announces nothing: the request already said it.
596
+ * - `"task.completed_past_limit"` (#4184) — a run COMPLETED strictly past a ceiling the caller declared (`TaskSpec.limits`: a token or cost
597
+ * ceiling, the walltime window): its last turn answered and owed no further request, so nothing was cut and the verdict stays `completed`
598
+ * (a run that owed another request fails or parks on its axis, as before, and says so there; a ceiling only met, and a turn cap reached on
599
+ * the answer, are a run that used its allowance and say nothing). Audience `operator`; ONCE PER RUN, from the one evaluation
600
+ * `TaskResult.limitCrossed` reads — the notice and the member cannot disagree. `detail: { axis, limit, observed, sessionId, runId, taskId }`;
601
+ * `axis` ∈ `budget_tokens` | `budget_cost` | `walltime` (a parked run's `resource_limit` words), `limit` / `observed` in the axis's unit
602
+ * (tokens, micro-USD, ms; see `TaskResult.limitCrossed`). Branch on `detail.axis`, never on the sentence. On a plain run (no
603
+ * `resourceSuspend`) it rides beside `task.interrupt_unconsumed` (audience `user`: a stop landed after the answer, `origin` ∈ `budget` |
604
+ * `turns` | `walltime`); a resource-slice run that completed past a ceiling says only this one.
520
605
  * - `"task.tool_turn_incomplete"` (#1230) — the person's line for a tool turn the model was handed incomplete, beside
521
606
  * the note the model itself reads. `detail.cause` (closed `TOOL_TURN_INCOMPLETE_CAUSES`): `truncated` — calls whose
522
607
  * arguments were cut before they parsed, dropped (they did not run); `unnamed` — calls that arrived with no tool
@@ -615,9 +700,9 @@ export interface EngineNotice {
615
700
  * call to the engine's own shell tool starts, on every leg (the answer can grow during a run: a credential the engine
616
701
  * takes in when it first routes a model is withheld from the next child); once per SESSION per name set (the
617
702
  * session's announced record). A delegated leg's goes to the delegation tree's root session and names the leg
618
- * (`sourceSessionId`, `agentId?`, #3650). `detail: { state, names?, ownCredentials?, sessionId, sourceSessionId?, agentId?, runId? }` — `state` `"withheld"`
703
+ * (`sourceSessionId`, `agentId?`, #3650). `detail: { state, names?, ownCredentials?, remedies?, sessionId, sourceSessionId?, agentId?, runId? }` — `state` `"withheld"`
619
704
  * carries the operator row's split (names only, never a value); `"unknown"` (the environment answered `"unknown"`)
620
- * carries no names and says the engine could not determine them.
705
+ * carries no names and says the engine could not determine them. `remedies` (#4198, additive) lists the ways out as `{ kind }` ({@link import("./secret-env.js").WITHHELD_ENV_REMEDY_KINDS}; the family `delegation.ask_unresolvable` uses); absent = none: every name is the engine's own credential.
621
706
  * - `"config.credential_not_withheld"` (#1816) — a credential value the engine was handed (a brain's key or credential
622
707
  * header, a model entry's or a peer's credential header, a consolidation seat's key) is no credential (a placeholder
623
708
  * such as `EMPTY`, fewer than eight characters, one character repeated): it is used as given, but a variable holding
@@ -671,9 +756,18 @@ export interface EngineNotice {
671
756
  * which `bypassPermissions` keeps and a headless run refuses); at `"prepare"` the run's path tables lack the rows
672
757
  * for the whole run. `detail.at` names the read that found it first: `"prepare"` (the path rows the run's file and
673
758
  * shell checks take at run start — the next run reads them again) or `"call"` (one call's own rule check — every
674
- * later call reads again, so the rows apply as soon as a read succeeds). Once per run, whichever read fails
675
- * first; the trace keeps every read's line (`permission.rule_store_unreadable`).
676
- * `detail: { at, sessionId, runId }`. Audience `user`.
759
+ * later call reads again, so the rows apply as soon as a read succeeds). Told once per SESSION per fault set,
760
+ * through the session's announced record (`AnnounceOnceLedger.oncePerSession`): the first read that finds it tells it, a later run of
761
+ * the same session over the same fault set says nothing, a different fault set is told again, a run with no session record to read tells
762
+ * it once per run, and a delegated agent's child (a session of its own) tells it once itself; the trace keeps every read's line (`permission.rule_store_unreadable`).
763
+ * `detail: { at, sessionId, runId, faults }` — `faults` one `{ sources, reason }` per partition the read could not read (a read
764
+ * that failed whole: one over every partition it took out): `sources` the sources of the person's rules it took out (`user` and
765
+ * `project` are the durable partition's, `session` the session's), `reason` one of `not_readable` (the account is not allowed to
766
+ * read the folder or file), `read_failed` (any other failed read), `unsafe_permissions` (the folder is writable by group or
767
+ * others), `owner_mismatch` (the folder is another account's), `damaged` (the stored rules, or what holds them, are damaged or not in
768
+ * a form this engine reads: for a file store a link, not an ordinary file, bytes that are no rule file, or a marker that is none), `later_grammar` (a newer engine wrote them), `no_answer` (the read did not answer in time) or `unclassified` (a
769
+ * store that states none of these). The sentence names the partition, the cause and the repair; no path rides the notice (the
770
+ * store's own disclosure line carries where). Audience `user`.
677
771
  * - `"permission.rule_row_dropped"` — the person's store served project-scoped rows whose scope root is not a
678
772
  * complete absolute path (only a foreign writer or a hand edit makes one; every engine write face refuses it): they
679
773
  * take no part in this run's checks — a deny or ask row among them protects nothing — until they are rewritten or
@@ -729,10 +823,11 @@ export interface EngineNotice {
729
823
  * is its own leg and says so again; `detail: { sessionId, runId, principal?, cause, source,
730
824
  * liveApprover, liveQuestionFace }` — `source` is `"force_durable_gate"` or `"durable_approval"`
731
825
  * (which mandate is unhonored; the recovery differs); `cause` is `"no_deployment_store"` (the deployment wired none),
732
- * `"task_store_disabled"` (`TaskSpec.checkpointStore: "disabled"`, the per-run off switch, on a leg
733
- * whose deployment may well have a store: the fix is the task's), or `"leg_not_resumable"` (a store, but the entitlement binds a
734
- * DELEGATED leg its parent forwarded no durable approval to — a synchronous or fork child, a background child whose lane cannot
735
- * park. Such a leg parks no ask and nothing answers in its place: every permission ask is refused without consulting the
826
+ * `"task_store_disabled"` (`TaskSpec.checkpointStore: "disabled"`, the per-run off switch, on a leg whose deployment may well have a
827
+ * store — set by the host on its task, or by the engine on every fork child and the legs under it: the fix is the task's, or a non-fork delegation;
828
+ * a leg nobody resumes reads the next word first), or `"leg_not_resumable"` (the entitlement binds a leg whose
829
+ * parks nobody resumes — a synchronous or fork child, a background child whose lane cannot park; read before the store, so
830
+ * such a leg reads it with or without one. Such a leg parks no ask and nothing answers in its place: every permission ask is refused without consulting the
736
831
  * approver, a question is refused, not shown — unlike the two store causes, whose asks resolve on the live chain); `liveApprover` /
737
832
  * `liveQuestionFace`: whether a live seat will EFFECTIVELY answer the leg's permission asks /
738
833
  * questions in-stream (a delegated child under an inherited content mandate reads `false`
@@ -779,6 +874,17 @@ export interface EngineNotice {
779
874
  * — what is announced is the remainder that could NOT be carried, so a fully-migrated park says
780
875
  * nothing at all and a queue-full / no-longer-pending row still says exactly what was lost.
781
876
  *
877
+ * - `"task.undelivered_input_dropped"` — a leg ended holding inputs another author wrote (an observer's report relayed to the child it
878
+ * watches) that it accepted and never read: they are dropped, never carried across a pause and never on the person's account above,
879
+ * so the person is told what their session lost. Audience `user`. One loss, two faces: the host's `onError` line (`phase: "degraded"`,
880
+ * classification `undelivered-input-dropped`, once per leg end) is the operator's, this notice is the person's. Told once per SESSION —
881
+ * the unit is the leg's own session (its announced record, the digest keyed on its session id): a later leg end on the same session
882
+ * says nothing more. The cap is best-effort, in the one direction the announced record always errs: a write the leg's exit could not
883
+ * persist, an older park mirror a resume reads, a second Runner on the session, or a record past its bound can tell a LATER loss again,
884
+ * never drop a first one. Addressed as every user-face notice of a leg is (`noticeAddressOf`): its own session on a top-level leg; the
885
+ * delegation tree's root on a delegated one, `sourceSessionId` / `agentId` naming the leg. `detail: { authors, sessionId, sourceSessionId?, agentId?, taskId, runId }` — `authors`
886
+ * counts the dropped inputs per author (the `INPUT_AUTHORS` words other than `operator`; only the authors that wrote one are keys).
887
+ *
782
888
  * - `"task.turn_interrupted"` (design/373) — a running turn was ACTUALLY CUT at a manufactured
783
889
  * boundary: the in-flight provider stream / tool batch was aborted (finished tool calls keep
784
890
  * their real results, never-started ones settle as paired results; the interruption marker
@@ -1087,10 +1193,10 @@ export interface EngineNotice {
1087
1193
  * - `"memory.mount_failed"` — a memory store that was asked for did not mount for this run (the memory phase's fail-open
1088
1194
  * arm: the task runs without its memory). Minted under the guard that mints the run's `memoryless` / `mount-failed`
1089
1195
  * observation, so the two are one fact; the operator's half is `onError` (`{ phase: "memory" }`), this is the person's.
1090
- * `detail: { sessionId, scopes, cause }` — `scopes` is what the task asked to mount (the whole span failed), `cause` the
1091
- * refusal's own code when it is a member of `STORE_FORM_REFUSAL_CODES`, else `"unclassified"`; never the thrown text, never a
1092
- * path. Audience `"user"`. Dedup unit: once per SESSION — key `(code, detail.sessionId)`; the phase mints once per leg whose
1093
- * mount failed. The model's half is the memory band's writes-unavailable notice, said only where the roster cannot persist.
1196
+ * `detail: { sessionId, scopes, cause, outsideReason? }` — `scopes` what the task asked to mount (the whole span failed), `cause`
1197
+ * the refusal's code when a member of `STORE_FORM_REFUSAL_CODES`, else `"unclassified"`; `outsideReason` exactly when `cause` is
1198
+ * `memory.target_outside_store` (its case); never the thrown text or a path. Audience `"user"`. Dedup: once per SESSION — key
1199
+ * `(code, detail.sessionId)`; the phase mints once per leg whose mount failed. The model's half: the memory band's writes-unavailable notice.
1094
1200
  * - `"memory.consolidation_incomplete"` (design/376, LLM consolidation driver) — a driver run
1095
1201
  * settled without reaching the fixpoint: `detail` names the stop reason (the closed
1096
1202
  * `ConsolidationRunStopReason` set), cycles done, and the residue (write-failure or
@@ -1296,8 +1402,9 @@ export interface EngineNotice {
1296
1402
  * Optional and absent for process/config-scoped codes. */
1297
1403
  sessionId?: string;
1298
1404
  }
1299
- /** Install the process's default notice seat, for what the engine says where no seat is in hand (a brain's construction, a route reading, a peer's dial): a second call replaces it,
1300
- * `undefined` removes it (such notices then print on `console.warn`), a seat a station holds always wins, anything but a function or `undefined` is refused (`config.invalid_argument`). */
1405
+ /** Install the process's default notice seat, for what the engine says where no seat is in hand (a brain's construction, a route reading, a peer's dial,
1406
+ * a store, a tool band, a process-level knob, a memory engine a host built itself): a second call replaces it, `undefined` removes it (such notices then
1407
+ * print as one process line), a seat a station holds always wins, anything but a function or `undefined` is refused (`config.invalid_argument`). */
1301
1408
  export declare function setDefaultEngineNoticeSeat(seat: ((notice: EngineNotice) => void) | undefined): void;
1302
1409
  /** Test seam (mirrors `__resetBashTimeoutAnnouncements`): never called by production code. */
1303
1410
  export declare function __resetMalformedNoticeSeatAnnouncement(): void;
@@ -1316,13 +1423,19 @@ export declare function __resetMalformedNoticeSeatAnnouncement(): void;
1316
1423
  * principle lose a ledgered line for the process lifetime — un-ledgering after the fact would race
1317
1424
  * an async sink's late rejection and re-announce (double-send) on transient failures.
1318
1425
  * · a PRESENT NON-function seat is a bad deployment value, and #123 (loud-bad-value law) forbids
1319
- * folding it to silence: the notice itself falls back to `console.warn` (no line is lost), and the
1426
+ * folding it to silence: the notice itself is printed as a process line (no line is lost), and the
1320
1427
  * seat defect — the one fact every fallback would otherwise repeat — is announced once per process.
1321
1428
  * · an ABSENT seat goes to the default seat a host installed ({@link setDefaultEngineNoticeSeat}; a function seat as above, and
1322
- * a present seat — non-function included — never falls through to it), else prints the historic `console.warn` line verbatim.
1429
+ * a present seat — non-function included — never falls through to it), else prints the notice's `message` as one process line.
1430
+ * · a seat is never handed a notice its own delivery raised: while a seat is being called (and in every promise and timer it
1431
+ * starts from there), a notice bound for that same seat is printed as a process line instead. Two seats that raise notices
1432
+ * for each other stop the same way, at the first seat met again.
1323
1433
  * · `admission`, when given, is asked once with the notice as it will leave (after the text pass and the routing lift): `false`
1324
1434
  * hands it to no seat. A predicate that answers `false` has already said so on its own account (the occupant judge mints its
1325
1435
  * `delegation.delivery_discarded`); it only judges and never rewrites the notice — the mint stays at the call site.
1436
+ *
1437
+ * Every process line goes through one writer ({@link writeProcessLine}), which is guarded: what the engine says can never fail
1438
+ * the call that said it, whichever arm it leaves by.
1326
1439
  */
1327
1440
  export declare function deliverEngineNotice(onNotice: ((notice: EngineNotice) => void) | undefined, notice: EngineNotice, admission?: (notice: EngineNotice) => boolean): void;
1328
1441
  /**
@@ -1453,8 +1566,8 @@ export declare function owedUserInputIds(held: HeldUserInputs | undefined, migra
1453
1566
  * (an account nobody closes is the silence this seat exists to end; a second row would be the same loss
1454
1567
  * counted twice). Keyed on the account OBJECT — one per run, minted by the lane that assembles it. NEVER
1455
1568
  * THROWS: a station calls it from a teardown path where the run is already failing, and a disclosure that
1456
- * takes the cleanup down with it is worse than the silence it was fixing (the absent-sink arm of
1457
- * {@link deliverEngineNotice} ends at a bare `console.warn`, which a host-replaced console can throw from). */
1569
+ * takes the cleanup down with it is worse than the silence it was fixing (the delivery itself contains a
1570
+ * throwing seat and a throwing console; the counting before it is what this guard is for). */
1458
1571
  export declare function settleOwedUserInput(account: OwedUserInputAccount, rowReturned: boolean, ids: {
1459
1572
  taskId?: string;
1460
1573
  sessionId?: string;
@@ -1,3 +1,4 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
1
2
  import { egressAccount, egressText } from "./untrusted-egress.js";
2
3
  let defaultNoticeSeat;
3
4
  export function setDefaultEngineNoticeSeat(seat) {
@@ -6,6 +7,14 @@ export function setDefaultEngineNoticeSeat(seat) {
6
7
  defaultNoticeSeat = seat;
7
8
  }
8
9
  let malformedNoticeSeatAnnounced = false;
10
+ const seatsDelivering = new AsyncLocalStorage();
11
+ function writeProcessLine(text) {
12
+ try {
13
+ console.warn(text);
14
+ }
15
+ catch {
16
+ }
17
+ }
9
18
  export function __resetMalformedNoticeSeatAnnouncement() {
10
19
  malformedNoticeSeatAnnounced = false;
11
20
  }
@@ -22,29 +31,31 @@ export function deliverEngineNotice(onNotice, notice, admission) {
22
31
  return;
23
32
  const seat = onNotice === undefined ? defaultNoticeSeat : onNotice;
24
33
  if (typeof seat === "function") {
34
+ const delivering = seatsDelivering.getStore() ?? [];
35
+ if (delivering.includes(seat)) {
36
+ writeProcessLine(notice.message);
37
+ return;
38
+ }
39
+ const bound = seat;
25
40
  try {
26
- const r = seat(notice);
27
- if (typeof r?.then === "function") {
28
- r.then(undefined, () => {
29
- });
30
- }
41
+ seatsDelivering.run([...delivering, bound], () => {
42
+ const r = bound(notice);
43
+ if (typeof r?.then === "function") {
44
+ r.then(undefined, () => {
45
+ });
46
+ }
47
+ });
31
48
  }
32
49
  catch {
33
50
  }
34
51
  return;
35
52
  }
36
- if (onNotice !== undefined) {
37
- if (!malformedNoticeSeatAnnounced) {
38
- malformedNoticeSeatAnnounced = true;
39
- try {
40
- console.warn(`The structured notice sink (RunnerDeps.onNotice) holds ${onNotice === null ? "null" : typeof onNotice} — not a ` +
41
- `function. Notices fall back to console.warn until the wiring is fixed (omit the key, or wire a function).`);
42
- }
43
- catch {
44
- }
45
- }
53
+ if (onNotice !== undefined && !malformedNoticeSeatAnnounced) {
54
+ malformedNoticeSeatAnnounced = true;
55
+ writeProcessLine(`The structured notice sink (RunnerDeps.onNotice) holds ${onNotice === null ? "null" : typeof onNotice} — not a ` +
56
+ `function. Notices fall back to console.warn until the wiring is fixed (omit the key, or wire a function).`);
46
57
  }
47
- console.warn(notice.message);
58
+ writeProcessLine(notice.message);
48
59
  }
49
60
  export function parkedInputIdsOf(records) {
50
61
  const ids = (lane) => lane.flatMap((r) => (typeof r === "object" && r !== null && typeof r.inputId === "string" ? [r.inputId] : []));
@@ -56,7 +56,8 @@ export interface EngineStorageBackend {
56
56
  * The backend-level managed-retention executor, when this backend has one.
57
57
  *
58
58
  * Retention execution belongs to the backend, not to each store: the capability's session deletion
59
- * re-checks live references inside the deletion transaction, and those references are held by several
59
+ * re-checks live references under the session's exclusion
60
+ * ({@link import("./retention.js").ManagedRetentionCapability.deleteExpiredSessions}), and those references are held by several
60
61
  * stores at once (pending checkpoints, background-agent rows, workflow runs), so only a party that
61
62
  * spans them can honor it. Absent ⇒ this backend executes no managed retention — the bundled file
62
63
  * backend is one such backend.
@@ -24,15 +24,15 @@ export function resolveEnvBudget(rawEnv, spec) {
24
24
  const raw = rawEnv.trim();
25
25
  const n = parseWholeNumber(raw);
26
26
  if (n === undefined || n <= 0) {
27
- announceEnvKnob(`${spec.name}=${rawEnv} was ignored — it is not a positive whole number of ${spec.unit}. Using ${spec.default === undefined ? "the built-in default" : spec.default} instead.`);
27
+ announceEnvKnob(`${spec.name}=${rawEnv} was ignored — it is not a positive whole number of ${spec.unit}. Using ${spec.default === undefined ? "the built-in default" : spec.default} instead.`, { name: spec.name, applied: spec.default });
28
28
  return spec.default;
29
29
  }
30
30
  if (spec.max !== undefined && n > spec.max) {
31
- announceEnvKnob(`${spec.name}=${rawEnv} Capped from ${n} to ${spec.max}.`);
31
+ announceEnvKnob(`${spec.name}=${rawEnv} Capped from ${n} to ${spec.max}.`, { name: spec.name, applied: spec.max });
32
32
  return spec.max;
33
33
  }
34
34
  if (spec.min !== undefined && n < spec.min) {
35
- announceEnvKnob(`${spec.name}=${rawEnv} Raised from ${n} to ${spec.min}.`);
35
+ announceEnvKnob(`${spec.name}=${rawEnv} Raised from ${n} to ${spec.min}.`, { name: spec.name, applied: spec.min });
36
36
  return spec.min;
37
37
  }
38
38
  return n;
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Say a knob-resolution fact once per process.
2
+ * Say a knob-resolution fact once per process, as `config.env_knob_adjusted` (`detail.name` the knob, `detail.applied` the
3
+ * value in force when it is a number — absent when a downstream built-in default stands).
3
4
  *
4
- * Swallow-guarded, the same posture as every other advisory sink here (`deliverEngineNotice`,
5
- * `emitBrainStatus`, `emitBrainTelemetry`): an announcement must never become a failure. The write is
6
- * not to a channel this process owns — a host is free to replace `console.warn` with its own logger,
7
- * and a `Console` built with `ignoreErrors:false` throws on a full or closed stream. These resolvers
8
- * sit on hot paths that have already done irreversible work (the shell's output clip runs AFTER the
9
- * command ran), so an unguarded write could destroy a completed command's output and invite the caller
10
- * to run it again. The line is ledgered BEFORE delivery so a throwing sink cannot turn one fact into a
11
- * warning per call either.
5
+ * The delivery never throws (the notice throat contains a throwing seat and a throwing console alike): these resolvers sit on
6
+ * hot paths that have already done irreversible work (the shell's output clip runs AFTER the command ran), so a failing
7
+ * announcement must never destroy a completed command's output and invite the caller to run it again. The line is ledgered
8
+ * BEFORE delivery so a throwing seat cannot turn one fact into one notice per call either.
12
9
  */
13
- export declare function announceEnvKnob(line: string): void;
10
+ export declare function announceEnvKnob(line: string, knob: {
11
+ readonly name: string;
12
+ readonly applied: number | undefined;
13
+ }): void;
14
14
  /** Test seam: the announcement de-dupes per process, so a test asserting the line must be able to clear
15
15
  * the ledger. Never called by production code. */
16
16
  export declare function __resetEnvKnobAnnouncements(): void;
@@ -1,13 +1,10 @@
1
+ import { deliverEngineNotice } from "./engine-notice.js";
1
2
  const announcedEnvKnobLines = new Set();
2
- export function announceEnvKnob(line) {
3
+ export function announceEnvKnob(line, knob) {
3
4
  if (announcedEnvKnobLines.has(line))
4
5
  return;
5
6
  announcedEnvKnobLines.add(line);
6
- try {
7
- console.warn(line);
8
- }
9
- catch {
10
- }
7
+ deliverEngineNotice(undefined, { code: "config.env_knob_adjusted", message: line, detail: { name: knob.name, ...(knob.applied !== undefined ? { applied: knob.applied } : {}) } });
11
8
  }
12
9
  export function __resetEnvKnobAnnouncements() {
13
10
  announcedEnvKnobLines.clear();
@@ -221,11 +221,15 @@ export interface FileHistoryDiffStats {
221
221
  }
222
222
  /** `Runner.rewindFiles`' request — the out-of-run code-only rewind (the reference's `rewind_files` control request). */
223
223
  export interface RewindFilesRequest {
224
- /** The session whose history is converged. It must exist. */
224
+ /** The session whose history is converged. It must exist. Its files are converged where its runs recorded them: a session
225
+ * that works in its own tree (`TaskSpec.workspace`) in that tree, never the base checkout; a checkout that cannot be resolved
226
+ * (record unreadable, released, tree gone) refuses with the session checkout's code and nothing moved. */
225
227
  sessionId: string;
226
228
  /** The boundary key: the entry id of the person's input that opened a turn (its run's first row of a person's
227
229
  * input; an engine entry ahead of it, such as a task notification, is not one) — the id space `TaskSpec.rewindFilesTo`
228
- * addresses ("the files as they were when that turn began"). An entry with no boundary of its own refuses. */
230
+ * addresses ("the files as they were when that turn began"). An entry with no boundary of its own refuses, and so does an
231
+ * entry the session's own log does not hold (an id that was erased and created again does not rewind to the earlier
232
+ * occupant's turns) — both `rewind_snapshot.unresolvable`, with nothing moved. */
229
233
  to: string;
230
234
  /** Preview only: the working tree is not written (a fork whose history was never carried may have its carry
231
235
  * completed — the same carry the session's next run performs). */
@@ -532,7 +536,8 @@ export interface FileHistoryStore {
532
536
  /**
533
537
  * Erase the WHOLE scope — every boundary, every version record INCLUDING the v1 pristine baselines `reap` keeps while a scope
534
538
  * lives, its consumed-id ledger — and the blobs no other scope references: the session-tree cascade's leg for a deleted session
535
- * (the scope is the session id; {@link import("./retention.js").RETENTION_CASCADE}). Answers how many boundaries and version
539
+ * (the scope is the session row's history scope, `fileHistoryScopeOf(sessionId, incarnation)`;
540
+ * {@link import("./retention.js").RETENTION_CASCADE}). Answers how many boundaries and version
536
541
  * records it removed (a damaged record is erased all the same and counts once; a scope with no history answers 0, so a repeat
537
542
  * is harmless). The scope then reads as one that never had
538
543
  * history: an id registered again later starts a new one. Refused (thrown, `conflict`) while THIS store runs a write of the scope
@@ -544,6 +549,19 @@ export interface FileHistoryStore {
544
549
  * deletion (only `reap` remains, which keeps the baselines), and the deployment owns that gap.
545
550
  */
546
551
  deleteBySession?(scope: string): Promise<number>;
552
+ /**
553
+ * The operator's erase of a session whose head cannot be read (the session store refuses its head read): its occupant cannot be read,
554
+ * so its scope cannot be named — this erases EVERY scope the store holds that belongs to the session id, as {@link deleteBySession}
555
+ * erases one: the bare id and each occupant's address, each scope read back by `readFileHistoryScope` (a scope whose `sessionId` is
556
+ * the id), never a prefix match — an id the session id is a prefix of (`s1x` for `s1`) or one that carries a `~` of its own is
557
+ * another id. Answers the total of what {@link deleteBySession} answers per scope (0 when the id holds no history, so a repeat is
558
+ * harmless); refused and thrown as it is (a write in flight on one of the scopes, a store fault). A scope whose name the store
559
+ * cannot read back cannot be judged and fails the call (thrown) before anything is erased. Never an owner's request and never called
560
+ * by an automatic path: the session-tree cascade calls it in place of {@link deleteBySession} for such a session (the leg's
561
+ * `unreadable` verb, {@link import("./retention.js").RETENTION_CASCADE}), after the forks have been carried from the source
562
+ * addresses their own rows record. OPTIONAL: absent ⇒ that cascade refuses the session before its first destructive call.
563
+ */
564
+ deleteUnreadableSessionHistory?(sessionId: string): Promise<number>;
547
565
  /**
548
566
  * Cross-session carry (CC copyFileHistoryForResume): make `toScope` see `fromScope`'s boundaries
549
567
  * + versions (content-addressed backends copy references, zero bytes). Same-scope call is a
@@ -564,7 +582,13 @@ export interface FileHistoryStore {
564
582
  * (`SessionMetadata.forkedFrom`) rather than on the code path that forked — so the Agent tool's
565
583
  * fork route, `warmResume`, and a deployment that forks a session and then runs a task on it all
566
584
  * reach the same seat. It runs BEFORE the restore seat, so the very first task on a fork may
567
- * itself ask to restore files to a pre-fork boundary.
585
+ * itself ask to restore files to a pre-fork boundary. The lineage fact is the fork row's whole
586
+ * cell: the source id AND the occupant of it the fork was cut from (`SessionMetadata.forkedFromIncarnation`),
587
+ * which together are the source's history scope: `fromScope` = `fileHistoryScopeOf(forkedFrom, forkedFromIncarnation)`,
588
+ * `toScope` = the fork's own `fileHistoryScopeOf(forkId, incarnation)`. The carry is lazy — it can run long after
589
+ * the fork — and reads no row of the source: an id created again since holds another occupant, whose history is at
590
+ * another address. A fork row that records no source occupant has no source address, which means NO call, one
591
+ * `onError` disclosure (`adopt_failed`, phase `"rewind"`), and a fork that starts with its own history.
568
592
  *
569
593
  * The empty-target law is what makes that safe to attempt rather than schedule: a scope that
570
594
  * already holds history answers the typed `conflict`, which at that seat MEANS "already carried,
@@ -944,6 +968,7 @@ export declare class InMemoryFileHistoryStore implements FileHistoryStore {
944
968
  diffStats(scope: string, entryId: string, env: ExecutionEnv, root: string): Promise<FileHistoryDiffStats | null>;
945
969
  reap(scope: string, keepEntryIds: string[]): Promise<number>;
946
970
  deleteBySession(scope: string): Promise<number>;
971
+ deleteUnreadableSessionHistory(sessionId: string): Promise<number>;
947
972
  /** Blob GC: live = referenced by ANY scope's retained version records, or in-flight. Synchronous (no await), so it runs
948
973
  * atomically vs an in-flight capture parked at an await. */
949
974
  private collectBlobs;
@@ -4,6 +4,8 @@ import { readMemberGroup } from "./member-group.js";
4
4
  import { isAbsoluteForFamily, isWinFormPath, pathFamilyOf, relativeInEveryFamily } from "../tools/fs/safety.js";
5
5
  import { fileHistoryBoundariesToKeep, resolveFileHistoryRetention } from "./file-history-retention.js";
6
6
  import { optionKeys, receiveOptions } from "./own-property-receipt.js";
7
+ import { readUnreadableDeleteId } from "./session.js";
8
+ import { readFileHistoryScope } from "../engine/session/repo-utils.js";
7
9
  const normSlash = (p) => p.replace(/\\/g, "/");
8
10
  const stripTrailSep = (p) => (isWinFormPath(p) ? p.replace(/[\\/]+$/, "") : p.replace(/\/+$/, ""));
9
11
  const foldDrive = (p) => (/^[A-Za-z]:(\/|$)/.test(p) ? p[0].toLowerCase() + p.slice(1) : p);
@@ -860,6 +862,17 @@ export class InMemoryFileHistoryStore {
860
862
  this.collectBlobs();
861
863
  return removed;
862
864
  }
865
+ async deleteUnreadableSessionHistory(sessionId) {
866
+ const id = readUnreadableDeleteId("FileHistoryStore.deleteUnreadableSessionHistory", sessionId);
867
+ const owned = [...new Set([...this.scopes.keys(), ...this.writers.keys()])].filter((scope) => readFileHistoryScope(scope)?.sessionId === id);
868
+ const busy = owned.find((scope) => this.writers.has(scope));
869
+ if (busy !== undefined)
870
+ return this.deleteBySession(busy);
871
+ let removed = 0;
872
+ for (const scope of owned)
873
+ removed += await this.deleteBySession(scope);
874
+ return removed;
875
+ }
863
876
  collectBlobs() {
864
877
  const live = new Set(this.inFlightBlobs.keys());
865
878
  for (const s of this.scopes.values()) {
@@ -91,7 +91,8 @@ export declare function frameSurvivesInToolResult(committedContent: unknown, fra
91
91
  /** The station that applies a HOST hook's `updatedOutput` marks the carrier — only when an ask rides it, so an
92
92
  * ordinary rewritten result leaves nothing behind. */
93
93
  export declare function noteHostRewrite(seam: FrameSettlement, toolCallId: string): void;
94
- /** A station WITHHELD a call's result in place of what it produced (a checking extension could not hand back its answer):
94
+ /** A station WITHHELD a call's result in place of what it produced (an extension's deny once the call ran, or a result the
95
+ * bus could not hand to the extensions that check it):
95
96
  * the host side decided what the model reads, so the carrier is marked as rewritten and its asks are answered now,
96
97
  * against the content that replaces the result, through the one writer below — a call whose result no transcript commit
97
98
  * follows (an extension's own call) is settled all the same, and the commit of one that does follow finds nothing left. */
@@ -191,7 +191,7 @@ export async function runGateFold(pass) {
191
191
  if (pass.decision.action === "ask")
192
192
  pass.decision = { ...pass.decision, ...marks };
193
193
  else
194
- [pass.decision, pass.tightenedBy] = [{ action: "ask", message: `tool "${toolName}" crosses the device boundary of a run that executes on a target device — a person must confirm it`, decisionReason: "safety", ...marks }, "safety"];
194
+ [pass.decision, pass.tightenedBy] = [{ action: "ask", message: `tool "${toolName}" crosses the device boundary of a run that executes on a target device — it needs approval before it runs`, decisionReason: "safety", ...marks }, "safety"];
195
195
  }
196
196
  const unstatedRuns = pass.policyRewrite !== undefined ? pass.policyRewrite : pass.currentInput;
197
197
  if (asksUnstated(pass.decision, pass.req, unstatedRuns, permissionSeatAt(input, unstatedRuns)?.seat, input.permissionMode?.())) {