@sema-agent/core 7.67.2 → 7.68.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 (505) hide show
  1. package/CHANGELOG.md +1533 -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/errors.d.ts +20 -0
  30. package/dist/brain/errors.js +114 -0
  31. package/dist/brain/open-responses.js +3 -1
  32. package/dist/brain/openai.js +3 -1
  33. package/dist/brain/provider-message.d.ts +5 -3
  34. package/dist/brain/provider-message.js +35 -8
  35. package/dist/brain/reasoning-request.d.ts +73 -19
  36. package/dist/brain/reasoning-request.js +164 -72
  37. package/dist/brain/reasoning-stamp.d.ts +26 -0
  38. package/dist/brain/reasoning-stamp.js +10 -0
  39. package/dist/brain/reasoning.d.ts +95 -162
  40. package/dist/brain/reasoning.js +31 -86
  41. package/dist/brain/route-adjudicator.d.ts +9 -7
  42. package/dist/brain/route-adjudicator.js +12 -10
  43. package/dist/brain/status-sink.d.ts +19 -64
  44. package/dist/brain/status-sink.js +5 -21
  45. package/dist/brain/stream-engine.d.ts +11 -2
  46. package/dist/brain/stream-engine.js +10 -0
  47. package/dist/core/a2a.d.ts +17 -5
  48. package/dist/core/a2a.js +11 -3
  49. package/dist/core/allow-entry.d.ts +35 -15
  50. package/dist/core/allow-entry.js +47 -60
  51. package/dist/core/ask-headline.d.ts +68 -0
  52. package/dist/core/ask-headline.js +23 -0
  53. package/dist/core/ask-origin.d.ts +36 -8
  54. package/dist/core/ask-origin.js +17 -10
  55. package/dist/core/ask-question.d.ts +34 -7
  56. package/dist/core/ask-question.js +10 -1
  57. package/dist/core/ask-unresolvable-notice.d.ts +7 -0
  58. package/dist/core/ask-unresolvable-notice.js +9 -3
  59. package/dist/core/auto-strip.d.ts +53 -0
  60. package/dist/core/auto-strip.js +76 -0
  61. package/dist/core/background-agent-store.d.ts +45 -5
  62. package/dist/core/background-agent-store.js +69 -15
  63. package/dist/core/background-shell.d.ts +2 -2
  64. package/dist/core/caller-text.js +2 -2
  65. package/dist/core/canonical-json.d.ts +13 -0
  66. package/dist/core/canonical-json.js +7 -0
  67. package/dist/core/checkpoint-features.d.ts +66 -20
  68. package/dist/core/checkpoint-features.js +12 -1
  69. package/dist/core/checkpoint-generation.d.ts +1 -1
  70. package/dist/core/checkpoint-queries.d.ts +1 -1
  71. package/dist/core/checkpoint-queries.js +4 -1
  72. package/dist/core/checkpoint-requirements.d.ts +25 -1
  73. package/dist/core/checkpoint-requirements.js +5 -1
  74. package/dist/core/checkpoint-row-verdict.d.ts +1 -0
  75. package/dist/core/checkpoint-row-verdict.js +4 -0
  76. package/dist/core/checkpoint-store.d.ts +66 -38
  77. package/dist/core/checkpoint-store.js +15 -6
  78. package/dist/core/child-clamp-seats.d.ts +6 -0
  79. package/dist/core/child-clamp-seats.js +1 -0
  80. package/dist/core/config-refusal-codes.d.ts +1 -1
  81. package/dist/core/config-refusal-codes.js +1 -0
  82. package/dist/core/delegation-frames.d.ts +9 -12
  83. package/dist/core/delegation-frames.js +9 -8
  84. package/dist/core/engine-capabilities.d.ts +21 -8
  85. package/dist/core/engine-capabilities.js +1 -1
  86. package/dist/core/engine-notice.d.ts +147 -34
  87. package/dist/core/engine-notice.js +27 -16
  88. package/dist/core/engine-storage-backend.d.ts +2 -1
  89. package/dist/core/env-budget.js +3 -3
  90. package/dist/core/env-knob-announce.d.ts +10 -10
  91. package/dist/core/env-knob-announce.js +3 -6
  92. package/dist/core/file-history-store.d.ts +29 -4
  93. package/dist/core/file-history-store.js +13 -0
  94. package/dist/core/frame-settlement.d.ts +2 -1
  95. package/dist/core/gate-fold.js +1 -1
  96. package/dist/core/gate-lanes.js +56 -49
  97. package/dist/core/governance-codes.d.ts +39 -3
  98. package/dist/core/governance-codes.js +61 -3
  99. package/dist/core/hooks.d.ts +29 -11
  100. package/dist/core/hooks.js +5 -2
  101. package/dist/core/human-input-projection.js +3 -3
  102. package/dist/core/input-author.d.ts +17 -3
  103. package/dist/core/input-author.js +15 -3
  104. package/dist/core/leg-identity.d.ts +10 -28
  105. package/dist/core/leg-identity.js +1 -21
  106. package/dist/core/lsp.d.ts +18 -13
  107. package/dist/core/lsp.js +30 -22
  108. package/dist/core/mailbox-store.d.ts +1 -1
  109. package/dist/core/mailbox-store.js +4 -4
  110. package/dist/core/mcp-connection-pool.d.ts +93 -4
  111. package/dist/core/mcp-connection-pool.js +104 -1
  112. package/dist/core/mcp-failure.d.ts +38 -12
  113. package/dist/core/mcp-failure.js +9 -13
  114. package/dist/core/mcp-probe.d.ts +4 -3
  115. package/dist/core/mcp-server-link.d.ts +4 -2
  116. package/dist/core/mcp-server-link.js +4 -5
  117. package/dist/core/mcp-server-spec.d.ts +3 -3
  118. package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
  119. package/dist/core/mcp-server-unavailable-notice.js +18 -4
  120. package/dist/core/mcp.d.ts +40 -6
  121. package/dist/core/mcp.js +39 -13
  122. package/dist/core/memory-engine/content-origin.js +2 -2
  123. package/dist/core/memory-engine/control-objects.d.ts +2 -4
  124. package/dist/core/memory-engine/control-objects.js +2 -10
  125. package/dist/core/memory-engine/delegation-settlement.js +6 -1
  126. package/dist/core/memory-engine/dual-root.js +3 -0
  127. package/dist/core/memory-engine/engine.d.ts +6 -4
  128. package/dist/core/memory-engine/engine.js +32 -29
  129. package/dist/core/memory-engine/file-backend.d.ts +20 -5
  130. package/dist/core/memory-engine/file-backend.js +21 -31
  131. package/dist/core/memory-engine/frontmatter.d.ts +2 -0
  132. package/dist/core/memory-engine/frontmatter.js +4 -0
  133. package/dist/core/memory-engine/layout.d.ts +114 -20
  134. package/dist/core/memory-engine/layout.js +340 -22
  135. package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
  136. package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
  137. package/dist/core/memory-engine/mount-failed-notice.js +43 -10
  138. package/dist/core/memory-engine/sync-client.js +4 -5
  139. package/dist/core/model-fallbacks.d.ts +5 -1
  140. package/dist/core/model-fallbacks.js +3 -3
  141. package/dist/core/model-receipt.d.ts +2 -1
  142. package/dist/core/model-receipt.js +12 -1
  143. package/dist/core/mods/kernel/dispatch.d.ts +2 -2
  144. package/dist/core/mods/kernel/dispatch.js +14 -6
  145. package/dist/core/mods/kernel/events.d.ts +8 -5
  146. package/dist/core/mods/kernel/events.js +2 -2
  147. package/dist/core/mods/kernel/index.d.ts +1 -1
  148. package/dist/core/mods/kernel/registration.d.ts +9 -0
  149. package/dist/core/mods/package.js +1 -1
  150. package/dist/core/mods/session-append.d.ts +4 -2
  151. package/dist/core/mods/session-append.js +3 -0
  152. package/dist/core/mods/stations.d.ts +7 -11
  153. package/dist/core/mods/stations.js +4 -7
  154. package/dist/core/mods/tool-call.d.ts +10 -8
  155. package/dist/core/mods/tool-call.js +15 -18
  156. package/dist/core/mounted-mcp.d.ts +0 -4
  157. package/dist/core/mounted-mcp.js +1 -1
  158. package/dist/core/park-noun.d.ts +24 -0
  159. package/dist/core/park-noun.js +21 -0
  160. package/dist/core/park-resumability.d.ts +60 -0
  161. package/dist/core/park-resumability.js +30 -0
  162. package/dist/core/permission-rule-provider.d.ts +24 -2
  163. package/dist/core/permission-rule-provider.js +11 -8
  164. package/dist/core/permission-rule-store.d.ts +8 -1
  165. package/dist/core/permission-rule-store.js +2 -3
  166. package/dist/core/permission-rules.d.ts +2 -1
  167. package/dist/core/permission-rules.js +8 -4
  168. package/dist/core/persisted-rule-arms.d.ts +3 -0
  169. package/dist/core/persisted-rule-arms.js +2 -1
  170. package/dist/core/present-plan-tool.d.ts +47 -3
  171. package/dist/core/present-plan-tool.js +62 -4
  172. package/dist/core/principal-name.d.ts +1 -1
  173. package/dist/core/principal-name.js +5 -5
  174. package/dist/core/process-identity.js +10 -5
  175. package/dist/core/protocol-http-auth.d.ts +30 -9
  176. package/dist/core/protocol-http-auth.js +113 -59
  177. package/dist/core/read-only-shell.js +9 -5
  178. package/dist/core/redaction-marks.d.ts +4 -26
  179. package/dist/core/redaction-marks.js +9 -21
  180. package/dist/core/remote-env.d.ts +43 -16
  181. package/dist/core/remote-env.js +1 -1
  182. package/dist/core/request-copy-projection.d.ts +1 -1
  183. package/dist/core/request-copy-projection.js +40 -50
  184. package/dist/core/resume-config-judge.js +1 -1
  185. package/dist/core/resume-startup-cause.d.ts +35 -18
  186. package/dist/core/resume-startup-cause.js +13 -10
  187. package/dist/core/retention.d.ts +167 -25
  188. package/dist/core/retention.js +100 -20
  189. package/dist/core/roles.d.ts +6 -0
  190. package/dist/core/roles.js +11 -5
  191. package/dist/core/rule-lane-reads.d.ts +3 -0
  192. package/dist/core/rule-lane-reads.js +5 -1
  193. package/dist/core/rule-store-fault.d.ts +70 -0
  194. package/dist/core/rule-store-fault.js +102 -0
  195. package/dist/core/runner/advertised-writable-dirs.js +16 -31
  196. package/dist/core/runner/announce-once-ledger.d.ts +19 -2
  197. package/dist/core/runner/announce-once-ledger.js +24 -2
  198. package/dist/core/runner/assemble-result.d.ts +6 -0
  199. package/dist/core/runner/assemble-result.js +1 -1
  200. package/dist/core/runner/auto-strip-notice.d.ts +36 -0
  201. package/dist/core/runner/auto-strip-notice.js +59 -0
  202. package/dist/core/runner/branch-window.d.ts +3 -0
  203. package/dist/core/runner/branch-window.js +37 -0
  204. package/dist/core/runner/caller-roster.d.ts +8 -3
  205. package/dist/core/runner/capability-withheld-seat.js +3 -9
  206. package/dist/core/runner/clock-and-limits.d.ts +22 -1
  207. package/dist/core/runner/clock-and-limits.js +30 -0
  208. package/dist/core/runner/contracts.d.ts +58 -35
  209. package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
  210. package/dist/core/runner/credential-refusal-seat.js +47 -0
  211. package/dist/core/runner/cross-boundary-lane.js +6 -4
  212. package/dist/core/runner/decide-continuation.js +1 -1
  213. package/dist/core/runner/file-history-restore.d.ts +53 -2
  214. package/dist/core/runner/file-history-restore.js +29 -10
  215. package/dist/core/runner/forward-sink.d.ts +14 -1
  216. package/dist/core/runner/forward-sink.js +14 -12
  217. package/dist/core/runner/gate-exit.d.ts +8 -7
  218. package/dist/core/runner/gate-exit.js +13 -13
  219. package/dist/core/runner/git-status-frame.js +2 -4
  220. package/dist/core/runner/initial-run-state.js +1 -1
  221. package/dist/core/runner/main-call-account.d.ts +3 -1
  222. package/dist/core/runner/main-call-account.js +5 -3
  223. package/dist/core/runner/mcp-redial.d.ts +2 -5
  224. package/dist/core/runner/mcp-redial.js +2 -2
  225. package/dist/core/runner/nested-memory-content.d.ts +7 -1
  226. package/dist/core/runner/nested-memory-content.js +73 -13
  227. package/dist/core/runner/nested-memory-lane.d.ts +44 -19
  228. package/dist/core/runner/nested-memory-lane.js +152 -76
  229. package/dist/core/runner/park-commit.js +3 -1
  230. package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
  231. package/dist/core/runner/permission-rule-lanes.js +29 -3
  232. package/dist/core/runner/person-path-rows.d.ts +3 -11
  233. package/dist/core/runner/person-path-rows.js +21 -24
  234. package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
  235. package/dist/core/runner/prepare-artifact.d.ts +1 -1
  236. package/dist/core/runner/prepare-artifact.js +20 -14
  237. package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
  238. package/dist/core/runner/prepare-ask-lane.js +6 -5
  239. package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
  240. package/dist/core/runner/prepare-boundary-parks.js +27 -24
  241. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
  242. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  243. package/dist/core/runner/prepare-config-doors.d.ts +9 -24
  244. package/dist/core/runner/prepare-config-doors.js +58 -41
  245. package/dist/core/runner/prepare-context-lane.d.ts +2 -2
  246. package/dist/core/runner/prepare-context-lane.js +3 -5
  247. package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
  248. package/dist/core/runner/prepare-defer-classify.js +1 -1
  249. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  250. package/dist/core/runner/prepare-delegation-surface.js +3 -2
  251. package/dist/core/runner/prepare-file-history.d.ts +62 -26
  252. package/dist/core/runner/prepare-file-history.js +117 -46
  253. package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
  254. package/dist/core/runner/prepare-gate-stations.js +6 -5
  255. package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
  256. package/dist/core/runner/prepare-hands-readface.js +8 -4
  257. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  258. package/dist/core/runner/prepare-inherited-gate.js +6 -6
  259. package/dist/core/runner/prepare-listings.d.ts +1 -1
  260. package/dist/core/runner/prepare-listings.js +1 -1
  261. package/dist/core/runner/prepare-memory.js +2 -2
  262. package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
  263. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  264. package/dist/core/runner/prepare-park-ask.d.ts +10 -3
  265. package/dist/core/runner/prepare-park-ask.js +7 -9
  266. package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
  267. package/dist/core/runner/prepare-policy-chain.js +18 -13
  268. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  269. package/dist/core/runner/prepare-project-context.js +5 -3
  270. package/dist/core/runner/prepare-prompt-assembly.js +2 -1
  271. package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
  272. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  273. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
  274. package/dist/core/runner/prepare-protocol-tools.js +7 -7
  275. package/dist/core/runner/prepare-question-face.d.ts +4 -2
  276. package/dist/core/runner/prepare-run-refs.d.ts +7 -2
  277. package/dist/core/runner/prepare-run-refs.js +8 -7
  278. package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
  279. package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
  280. package/dist/core/runner/prepare-suspend-saga.js +4 -3
  281. package/dist/core/runner/prepare-task.js +66 -53
  282. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
  283. package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
  284. package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
  285. package/dist/core/runner/prepare-turn-wiring.js +1 -1
  286. package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
  287. package/dist/core/runner/prepare-wiring-manifest.js +14 -6
  288. package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
  289. package/dist/core/runner/prepare-workspace-restore.js +15 -6
  290. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  291. package/dist/core/runner/restore-seat.d.ts +41 -0
  292. package/dist/core/runner/restore-seat.js +38 -0
  293. package/dist/core/runner/resume-admission.js +1 -1
  294. package/dist/core/runner/resume-apply.js +4 -3
  295. package/dist/core/runner/resume-checkpoint-screen.js +2 -1
  296. package/dist/core/runner/resume-internals-and-config.js +2 -1
  297. package/dist/core/runner/resume-preflight.js +2 -1
  298. package/dist/core/runner/rewind-files.js +22 -6
  299. package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
  300. package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
  301. package/dist/core/runner/run-brain-sinks.d.ts +3 -6
  302. package/dist/core/runner/run-brain-sinks.js +6 -6
  303. package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
  304. package/dist/core/runner/run-git-lane.d.ts +2 -0
  305. package/dist/core/runner/run-git-lane.js +2 -1
  306. package/dist/core/runner/run-harness-handlers.js +5 -4
  307. package/dist/core/runner/run-identity-wiring.js +20 -12
  308. package/dist/core/runner/run-leg.js +31 -72
  309. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  310. package/dist/core/runner/run-notification-lane.js +2 -4
  311. package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
  312. package/dist/core/runner/run-reasoning-seat.js +13 -18
  313. package/dist/core/runner/run-settle-and-teardown.js +13 -9
  314. package/dist/core/runner/run-terminal-adoption.js +4 -8
  315. package/dist/core/runner/run-turn-boundary.js +6 -3
  316. package/dist/core/runner/runtask.d.ts +9 -4
  317. package/dist/core/runner/runtask.js +29 -22
  318. package/dist/core/runner/session-rule-policy.d.ts +11 -1
  319. package/dist/core/runner/shell-env-withheld.js +2 -7
  320. package/dist/core/runner/side-call-account.d.ts +5 -6
  321. package/dist/core/runner/side-call-account.js +2 -2
  322. package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
  323. package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
  324. package/dist/core/runner/stream-settle-backstop.js +4 -6
  325. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  326. package/dist/core/runner/stream-steer-verb.js +4 -4
  327. package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
  328. package/dist/core/runner/sub-agent-deny-lists.js +7 -4
  329. package/dist/core/runner/teardown-bounded.d.ts +7 -0
  330. package/dist/core/runner/teardown-bounded.js +7 -0
  331. package/dist/core/runner/terminal-account.js +41 -13
  332. package/dist/core/runner/terminal-projection.d.ts +1 -5
  333. package/dist/core/runner/tool-end-body.d.ts +9 -3
  334. package/dist/core/runner/tool-end-body.js +6 -3
  335. package/dist/core/runner/tool-output-projection.d.ts +13 -4
  336. package/dist/core/runner/tool-output-projection.js +10 -14
  337. package/dist/core/runner/turn-attachments.d.ts +3 -2
  338. package/dist/core/runner/turn-attachments.js +12 -5
  339. package/dist/core/runner-deps.d.ts +6 -6
  340. package/dist/core/runtime-caps.d.ts +2 -1
  341. package/dist/core/secret-env.d.ts +20 -3
  342. package/dist/core/secret-env.js +13 -15
  343. package/dist/core/session-checkout.d.ts +115 -15
  344. package/dist/core/session-checkout.js +435 -136
  345. package/dist/core/session-policy-store.js +21 -3
  346. package/dist/core/session-reconcile.js +1 -0
  347. package/dist/core/session-store.js +2 -0
  348. package/dist/core/session.d.ts +11 -1
  349. package/dist/core/shell-run-candidates.d.ts +1 -0
  350. package/dist/core/shell-run-candidates.js +1 -1
  351. package/dist/core/shutdown-debug.d.ts +6 -5
  352. package/dist/core/shutdown-debug.js +5 -1
  353. package/dist/core/skill-grant.js +4 -1
  354. package/dist/core/skills-directory.js +5 -3
  355. package/dist/core/spec-contract.d.ts +1 -1
  356. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
  357. package/dist/core/store-contracts/file-history-store-contract.js +26 -2
  358. package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
  359. package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
  360. package/dist/core/store-contracts/task-list-store-contract.js +28 -1
  361. package/dist/core/task-event.d.ts +48 -27
  362. package/dist/core/task-notification.d.ts +15 -9
  363. package/dist/core/task-notification.js +12 -0
  364. package/dist/core/task-registry-agent.d.ts +24 -22
  365. package/dist/core/task-registry-agent.js +65 -46
  366. package/dist/core/task-registry-shared.d.ts +17 -5
  367. package/dist/core/task-registry.d.ts +17 -6
  368. package/dist/core/task-registry.js +6 -1
  369. package/dist/core/task-result.d.ts +71 -25
  370. package/dist/core/task-spec-members.d.ts +0 -1
  371. package/dist/core/task-spec-members.js +1 -1
  372. package/dist/core/task-spec.d.ts +60 -52
  373. package/dist/core/task-stream.d.ts +45 -12
  374. package/dist/core/terminal-cause.d.ts +45 -8
  375. package/dist/core/terminal-cause.js +5 -0
  376. package/dist/core/tool-card-bound.d.ts +32 -0
  377. package/dist/core/tool-card-bound.js +33 -0
  378. package/dist/core/tool-catalog-entries.d.ts +9 -0
  379. package/dist/core/tool-catalog-entries.js +48 -0
  380. package/dist/core/tool-errors.d.ts +4 -3
  381. package/dist/core/tool-face.d.ts +3 -3
  382. package/dist/core/tool-mount-facts.d.ts +3 -2
  383. package/dist/core/tool-mount-facts.js +1 -1
  384. package/dist/core/tool-mount-static.js +7 -5
  385. package/dist/core/tool-policy.d.ts +21 -19
  386. package/dist/core/tool-policy.js +5 -6
  387. package/dist/core/tool-registry.d.ts +3 -1
  388. package/dist/core/tool-registry.js +15 -1
  389. package/dist/core/tool-result-store.d.ts +9 -3
  390. package/dist/core/tool-result-store.js +14 -1
  391. package/dist/core/tool-roster.d.ts +6 -0
  392. package/dist/core/tool-roster.js +18 -0
  393. package/dist/core/tool-spec.d.ts +17 -8
  394. package/dist/core/trace.d.ts +35 -31
  395. package/dist/core/types.d.ts +2 -2
  396. package/dist/core/untrusted-egress.d.ts +19 -7
  397. package/dist/core/untrusted-egress.js +26 -7
  398. package/dist/core/untrusted-text.d.ts +6 -18
  399. package/dist/core/untrusted-text.js +11 -4
  400. package/dist/core/user-attachment.d.ts +9 -6
  401. package/dist/core/user-attachment.js +12 -10
  402. package/dist/core/user-row-origin.d.ts +44 -25
  403. package/dist/core/user-row-origin.js +30 -20
  404. package/dist/core/wiring-manifest.d.ts +26 -7
  405. package/dist/core/wiring-manifest.js +14 -11
  406. package/dist/core/workspace-snapshot.d.ts +3 -1
  407. package/dist/core/workspace-snapshot.js +1 -0
  408. package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
  409. package/dist/engine/execution-env/node-execution-env.js +127 -67
  410. package/dist/engine/harness/agent-harness.d.ts +4 -5
  411. package/dist/engine/harness/agent-harness.js +2 -7
  412. package/dist/engine/harness/types.d.ts +51 -19
  413. package/dist/engine/harness/types.js +28 -1
  414. package/dist/engine/llm/types.d.ts +26 -14
  415. package/dist/engine/llm/types.js +2 -2
  416. package/dist/engine/loop/agent-loop.d.ts +2 -2
  417. package/dist/engine/loop/agent-loop.js +51 -275
  418. package/dist/engine/loop/types.d.ts +0 -18
  419. package/dist/engine/session/import-validate.d.ts +3 -0
  420. package/dist/engine/session/import-validate.js +34 -2
  421. package/dist/engine/session/repo-utils.d.ts +42 -4
  422. package/dist/engine/session/repo-utils.js +33 -5
  423. package/dist/engine/session/session.d.ts +41 -14
  424. package/dist/engine/session/session.js +96 -25
  425. package/dist/index.d.ts +21 -16
  426. package/dist/index.js +16 -10
  427. package/dist/orchestration/run-spec.d.ts +1 -1
  428. package/dist/orchestration/run-workflow-tool.d.ts +12 -9
  429. package/dist/orchestration/run-workflow-tool.js +15 -19
  430. package/dist/orchestration/workflow-governance.js +13 -21
  431. package/dist/orchestration/workflow-observe.d.ts +4 -3
  432. package/dist/orchestration/workflow-primitives.d.ts +1 -1
  433. package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
  434. package/dist/orchestration/workflow-record-artifact.js +32 -0
  435. package/dist/orchestration/workflow-script-store.d.ts +9 -0
  436. package/dist/orchestration/workflow-script-store.js +20 -1
  437. package/dist/orchestration/workflow-types.d.ts +33 -3
  438. package/dist/orchestration/workflow.d.ts +24 -14
  439. package/dist/orchestration/workflow.js +52 -23
  440. package/dist/prompt-assembly/artifact.js +4 -8
  441. package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
  442. package/dist/prompt-assembly/catalog/engine.js +30 -0
  443. package/dist/prompt-assembly/catalog/index.d.ts +1 -1
  444. package/dist/prompt-assembly/catalog/index.js +2 -2
  445. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
  446. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
  447. package/dist/prompt-assembly/epoch.js +6 -8
  448. package/dist/prompt-assembly/turn-snapshot.js +8 -9
  449. package/dist/stores/file/background-agent-store.js +5 -6
  450. package/dist/stores/file/checkpoint-store.d.ts +0 -4
  451. package/dist/stores/file/checkpoint-store.js +7 -3
  452. package/dist/stores/file/file-history-store.d.ts +8 -0
  453. package/dist/stores/file/file-history-store.js +72 -0
  454. package/dist/stores/file/fs-atomic.js +17 -12
  455. package/dist/stores/file/index.js +11 -5
  456. package/dist/stores/file/mailbox-store.js +13 -4
  457. package/dist/stores/file/permission-rule-store.js +14 -13
  458. package/dist/stores/file/shared-ledger.d.ts +4 -0
  459. package/dist/stores/file/shared-ledger.js +4 -0
  460. package/dist/stores/file/task-list-store.js +12 -3
  461. package/dist/stores/file/workflow-run-store.js +1 -0
  462. package/dist/tools/fs/bash-program-position.d.ts +4 -2
  463. package/dist/tools/fs/bash-program-position.js +1 -1
  464. package/dist/tools/fs/bash-readonly-classifier.js +1 -1
  465. package/dist/tools/fs/bound-open.d.ts +97 -0
  466. package/dist/tools/fs/bound-open.js +103 -0
  467. package/dist/tools/fs/containment-face.d.ts +2 -2
  468. package/dist/tools/fs/fs-pdf.d.ts +7 -1
  469. package/dist/tools/fs/fs-pdf.js +31 -23
  470. package/dist/tools/fs/fs-read.d.ts +24 -17
  471. package/dist/tools/fs/fs-read.js +84 -53
  472. package/dist/tools/fs/fs-shared.d.ts +14 -12
  473. package/dist/tools/fs/fs-shared.js +5 -4
  474. package/dist/tools/fs/fs-write.d.ts +2 -2
  475. package/dist/tools/fs/fs-write.js +20 -12
  476. package/dist/tools/fs/index.d.ts +4 -4
  477. package/dist/tools/fs/index.js +2 -2
  478. package/dist/tools/fs/notebook.d.ts +1 -1
  479. package/dist/tools/fs/pdf.d.ts +12 -3
  480. package/dist/tools/fs/pdf.js +22 -9
  481. package/dist/tools/fs/read-deny-home.d.ts +3 -2
  482. package/dist/tools/fs/read-deny-home.js +8 -11
  483. package/dist/tools/fs/safety.d.ts +3 -2
  484. package/dist/tools/fs/shell-read-check.js +10 -9
  485. package/dist/tools/monitor.d.ts +6 -5
  486. package/dist/tools/task-list.d.ts +16 -6
  487. package/dist/tools/task-list.js +4 -0
  488. package/dist/tools/web.d.ts +9 -1
  489. package/dist/tools/web.js +8 -3
  490. package/dist/tools/worktree.d.ts +7 -5
  491. package/dist/tools/worktree.js +4 -3
  492. package/package.json +4 -3
  493. package/test/export-surface.snapshot.json +93 -7
  494. package/wire-changes/core-stores-sql@7.67.3.json +39 -0
  495. package/wire-changes/core-stores-sql@7.68.0.json +39 -0
  496. package/wire-changes/core@7.67.3.json +65 -0
  497. package/wire-changes/core@7.68.0.json +4257 -0
  498. package/wire-changes/mods-kernel@7.67.3.json +39 -0
  499. package/wire-changes/mods-kernel@7.68.0.json +129 -0
  500. package/wire-changes/primitives@7.67.3.json +39 -0
  501. package/wire-changes/primitives@7.68.0.json +253 -0
  502. package/wire-changes/wiki-gate@7.67.3.json +39 -0
  503. package/wire-changes/wiki-gate@7.68.0.json +39 -0
  504. package/dist/core/runner/credential-origin-seat.d.ts +0 -2
  505. package/dist/core/runner/credential-origin-seat.js +0 -20
@@ -23,7 +23,7 @@ export function prepareOffloadWrappers(input) {
23
23
  nestedStats.anyUnpriced = true;
24
24
  };
25
25
  const { explicit: explicitGlobalThreshold, effective: offloadThreshold } = offloadThresholdsOf(spec, deps);
26
- const offloadEnabled = offloadSeatFact(offloadThreshold) && valveLeaves(spec, selector)({ name: OFFLOAD_TOOL_NAME });
26
+ const offloadEnabled = offloadSeatFact(offloadThreshold) && valveLeaves(selector)({ name: OFFLOAD_TOOL_NAME });
27
27
  const rawOffloadStore = offloadEnabled ? (deps.toolResultStore ?? new InMemoryToolResultStore()) : undefined;
28
28
  const offloadStore = rawOffloadStore instanceof RunnerSharedToolResultStore
29
29
  ? new ScopedToolResultStore(rawOffloadStore, offloadScope)
@@ -24,6 +24,7 @@ import { type CallTargetStamp } from "../effective-path-target.js";
24
24
  import { type OnQuestion } from "../ask-question.js";
25
25
  import { type CheckpointStore } from "../checkpoint-store.js";
26
26
  import { type GrantBindingOf } from "../skill-grant-binding.js";
27
+ import { type CallRiskAxes } from "../ask-origin.js";
27
28
  import type { SessionStore } from "../session.js";
28
29
  import { type AskSourceIdentity, type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-policy.js";
29
30
  import { type ToolResultStore } from "../tool-result-store.js";
@@ -34,6 +35,7 @@ import { type ContentAskBinding } from "./content-ask-bindings.js";
34
35
  import type { AskLane, IrreversibilityTier, ParkAsk, Prepared, SuspendSaga } from "./contracts.js";
35
36
  import { type DeferredAsk, type MarkedCalls } from "./deferred-ask.js";
36
37
  import type { createRuleOffersOf } from "./permission-rule-lanes.js";
38
+ import type { EngineText } from "../../prompt-assembly/engine-text.js";
37
39
  import { type ToolRosterDeltaSeat } from "../tool-roster.js";
38
40
  import { type ExistingTargetSeat } from "../existing-target.js";
39
41
  export interface PrepareParkAskInput {
@@ -67,9 +69,8 @@ export interface PrepareParkAskInput {
67
69
  /** borrowed-readonly — the run's card-target source (`current` read per park): the parked write card's
68
70
  * `existingTarget`, read before the pause. Empty (hands-less) ⇒ a card in scope says `withheld` / `unavailable`. */
69
71
  existingTargetSeat: ExistingTargetSeat;
70
- /** borrowed-readonly — the wiring-manifest phase's park predicate (`parkLane.effective`): arms `suspendAsk`. */
72
+ /** borrowed-readonly — the wiring-manifest phase's park predicate (`parkLane.effective`, false on a leg nobody resumes): arms `suspendAsk`. */
71
73
  parkLaneArmed: boolean;
72
- /** borrowed-readonly — the driver's refusal fact: on such a leg the closure parks no ask. */ forcedGateNotResumable: boolean;
73
74
  /** borrowed-readonly — the question-face phase's `durableQuestionFace`: THE one judge of whether a question may park on this leg. */
74
75
  durableQuestionFace: boolean;
75
76
  /** borrowed-readonly — the question-face phase's routability predicate (the mounted question tool is the engine's own,
@@ -146,7 +147,7 @@ export interface PrepareParkAskInput {
146
147
  effectiveShellGate: ShellGateDoctrine | undefined;
147
148
  /** borrowed-readonly — the EFFECTIVE durable-approval opt-in (the caller's, or the synthesized mandate scope): picks the
148
149
  * gate kind, the scope and the ttl. */
149
- durableApproval: TaskSpec["durableApproval"];
150
+ durableApproval: import("../task-spec.js").DurableApprovalOptIn | undefined;
150
151
  /** borrowed-readonly — the cross-slice ledger carried on the resumed checkpoint, or undefined. */
151
152
  priorLedger: Prepared["resourceLedger"];
152
153
  /** borrowed-readonly — the loop's live spend seat; `.get` is read at mint time. */
@@ -158,6 +159,10 @@ export interface PrepareParkAskInput {
158
159
  } | undefined;
159
160
  /** borrowed-readonly — the policy-chain phase's rule-offer factory (the row's suggestion members). */
160
161
  ruleOffersOf: ReturnType<typeof createRuleOffersOf>;
162
+ /** borrowed-readonly — the policy chain's risk-axes projection, the ONE function that mints `riskAxes` (card and row); the row reads it NOW, at the park, so it can differ from the card's reading when the roster's seats moved between the two (#4235). */
163
+ riskAxesOf: (call: Pick<ToolCallRequest, "toolName" | "face">) => {
164
+ riskAxes?: CallRiskAxes;
165
+ };
161
166
  /** borrowed-readonly — the policy-chain phase's Skill-card binding factory: a parked `Skill` call's row carries the named skill and
162
167
  * its lists (`boundGrants`) and their hash (`boundGrantDigest`) from it, as the live ask does. */
163
168
  grantBindingOf: GrantBindingOf;
@@ -175,6 +180,8 @@ export interface PrepareParkAskInput {
175
180
  harness: Pick<AgentHarness, "abort">;
176
181
  /** borrowed-mutable — the run's committed-pause holder (`Prepared.pausedRef`). Writer here: the commit-side publication. */
177
182
  pausedRef: Prepared["pausedRef"];
183
+ /** borrowed-readonly — the run's engine text reading (its locale): a parked card's headline is minted in it. */
184
+ engineText: EngineText;
178
185
  }
179
186
  export interface PrepareParkAskResult {
180
187
  /** owned — the two closures as ONE value, or undefined exactly when the ask lane (and so the saga) is absent. */
@@ -2,7 +2,7 @@ import { callTargetReadingOf } from "../effective-path-target.js";
2
2
  import { approvalTargetsOf } from "../approval-object.js";
3
3
  import { uuidv7 } from "../../engine/session/uuid.js";
4
4
  import { Value } from "typebox/value";
5
- import { classifyQuestionOutcome, isEngineQuestionFace, questionSourceOf, validateAskQuestions, QuestionOutcomeUnreadableError } from "../ask-question.js";
5
+ import { classifyQuestionOutcome, durableApprovalAwaitingSentence, durableQuestionAwaitingSentence, isEngineQuestionFace, questionSourceOf, validateAskQuestions, QuestionOutcomeUnreadableError } from "../ask-question.js";
6
6
  import { hasBackgroundShell, sweepBackgroundShells, sweepRunBoundaryBackgroundShells } from "../background-shell.js";
7
7
  import { boundInputHashOf, exactBoundInputHashOf } from "../canonical-json.js";
8
8
  import { buildRiskDescriptor, debitLedger, encodeAtFidelity, mintCheckpointToken, resolveDeclaredFidelity, } from "../checkpoint-store.js";
@@ -33,11 +33,11 @@ const wordlessDemand = (toolName) => {
33
33
  throw new Error(`a real-approval demand for "${toolName}" reached the park with no origin word — the origin stamp precedes every park`);
34
34
  };
35
35
  export function prepareParkAsk(input) {
36
- const { askLane, saga, spec, deps, sessionId, askSource, checkpointStore, checkpointScope, toolRosterDeltas, existingTargetSeat, parkLaneArmed, forcedGateNotResumable, durableQuestionFace, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, deferredAskIdentities, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, shellReadLandings, advertisedWritableDirs, exemptRoots, offloadStore, suspendTargetGap, session, sessions, suspendChainBase, maxSuspends, remoteEnvFailures, shellGatedTools, irreversibilityTier, toolMarkSources, effectiveShellGate, durableApproval, priorLedger, liveSpendRef, resourceTotal, ruleOffersOf, grantBindingOf, now, humanReviewRef, abortController, harness, pausedRef } = input;
36
+ const { askLane, saga, spec, deps, sessionId, askSource, checkpointStore, checkpointScope, toolRosterDeltas, existingTargetSeat, parkLaneArmed, durableQuestionFace, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, deferredAskIdentities, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, shellReadLandings, advertisedWritableDirs, exemptRoots, offloadStore, suspendTargetGap, session, sessions, suspendChainBase, maxSuspends, remoteEnvFailures, shellGatedTools, irreversibilityTier, toolMarkSources, effectiveShellGate, durableApproval, priorLedger, liveSpendRef, resourceTotal, ruleOffersOf, riskAxesOf, grantBindingOf, now, humanReviewRef, abortController, harness, pausedRef, engineText } = input;
37
37
  if (askLane === undefined || saga === undefined)
38
38
  return { parkAsk: undefined };
39
39
  const { composedCallSignal, approvalPreviewOf } = askLane;
40
- const { inFlightSpendMicroUsd, serializeCheckpointState, compensatePausedVM, commitSuspendSaga, suspendLoopCapHit, suspendableEnv, parkOnlyRemoteEnv, parkOnlyHandle, syncChildBlock } = saga;
40
+ const { inFlightSpendMicroUsd, serializeCheckpointState, compensatePausedVM, commitSuspendSaga, suspendLoopCapHit, suspendableEnv, parkOnlyRemoteEnv, parkOnlyHandle } = saga;
41
41
  const resolveContentAsk = async (req, callSignal) => {
42
42
  const contentAskSignal = composedCallSignal(callSignal);
43
43
  if (!contentAskRoutable(req.toolCallId) || liveQuestionFace === undefined || mountedQuestionTool === undefined) {
@@ -116,8 +116,6 @@ export function prepareParkAsk(input) {
116
116
  };
117
117
  const suspendAsk = parkLaneArmed && checkpointStore !== undefined
118
118
  ? async (req, postHookArgs, safety, liveFaceUnavailable, realApproval, allowRuleShadowed, askDecisionReason, probeReason, probeCause, segmentCoverage, matchedAskRule, probeMandated, carry) => {
119
- if (forcedGateNotResumable)
120
- return undefined;
121
119
  const contentAsk = isEngineQuestionFace(req.face);
122
120
  if (contentAsk && !durableQuestionFace)
123
121
  return undefined;
@@ -245,6 +243,7 @@ export function prepareParkAsk(input) {
245
243
  toolName: req.toolName,
246
244
  args: parkedArgs,
247
245
  safety,
246
+ ...riskAxesOf(req),
248
247
  ...(allowRuleShadowed !== undefined ? { allowRuleShadowed } : {}),
249
248
  ...(probeReason !== undefined ? { probeReason } : {}),
250
249
  ...(probeCause !== undefined ? { probeCause } : {}),
@@ -267,14 +266,14 @@ export function prepareParkAsk(input) {
267
266
  : durableApproval
268
267
  ? {
269
268
  kind: "human",
270
- reason: `human approval required for tool "${req.toolName}"`,
269
+ reason: contentAsk ? durableQuestionAwaitingSentence(req.toolName) : durableApprovalAwaitingSentence(req.toolName),
271
270
  toolName: req.toolName,
272
271
  ...approvalCardMemberOf(req),
273
272
  riskDescriptor,
274
273
  }
275
274
  : {
276
275
  kind: "irreversible_ask",
277
- reason: `human approval required before irreversible tool "${req.toolName}"`,
276
+ reason: durableApprovalAwaitingSentence(req.toolName),
278
277
  toolName: req.toolName,
279
278
  ...approvalCardMemberOf(req),
280
279
  riskDescriptor,
@@ -304,7 +303,6 @@ export function prepareParkAsk(input) {
304
303
  cp = {
305
304
  token,
306
305
  checkpointId: parkedAskIdentity(deferredAskIdentities.get(req.toolCallId), parkedHash),
307
- ...syncChildBlock,
308
306
  scope,
309
307
  sessionId,
310
308
  leafId,
@@ -327,7 +325,7 @@ export function prepareParkAsk(input) {
327
325
  ...parkedTarget,
328
326
  ...(rowRealApproval !== undefined ? { requiresRealApproval: true } : {}),
329
327
  ...askMandateMember(clearanceFacts),
330
- ...askCarryRowMembers(carry),
328
+ ...askCarryRowMembers(carry, engineText),
331
329
  ...ruleOffersOf(req, parkedArgs, clearanceFacts),
332
330
  boundInputHash: parkedHash,
333
331
  ...grantBindingOf(req, parkedArgs),
@@ -27,7 +27,8 @@ import type { ToolOccurrenceTable } from "./tool-occurrence.js";
27
27
  import { type InheritedInstallation, type LegModBus, type ModChainLink } from "../mods/stations.js";
28
28
  import type { LockedPreflight } from "../locked-config.js";
29
29
  import { type SessionPermissionRules } from "../session-policy-store.js";
30
- import { type AskSourceIdentity, type OnAsk, type ToolPolicy } from "../tool-policy.js";
30
+ import { type AskSourceIdentity, type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-policy.js";
31
+ import { type ApprovalParkNotResumable } from "../park-resumability.js";
31
32
  import type { PathRuleBases } from "../permission-rule-model.js";
32
33
  import type { HeadLeads } from "../path-rule-binding.js";
33
34
  import type { RunnerDeps, RuntimeCaps, TaskSpec, ToolEffect } from "../types.js";
@@ -37,11 +38,14 @@ import { type SkillGrantLane, type SkillGrantSource, type SkillGrantTable } from
37
38
  import { type GrantBindingOf } from "../skill-grant-binding.js";
38
39
  import type { ToolSelector } from "../tool-face.js";
39
40
  import { type AllowEntryLane, type AllowEntryTable } from "../allow-entry.js";
41
+ import type { AutoStrippedRule } from "./auto-strip-notice.js";
40
42
  import type { InheritedGate, IrreversibilityTier, PrepareResume, StopForDenialLimit } from "./contracts.js";
41
- import { type Arbitration } from "../ask-origin.js";
43
+ import type { RosterSpec } from "./caller-roster.js";
44
+ import { type Arbitration, type CallRiskAxes } from "../ask-origin.js";
42
45
  import { type ModeGateSeats, type PermissionModeController } from "../mode-policy.js";
43
46
  import { type DeferredAsk, type MarkerChannel } from "./deferred-ask.js";
44
47
  import type { ApprovalWordsSeat } from "../approval-words.js";
48
+ import type { EngineText } from "../../prompt-assembly/engine-text.js";
45
49
  import { type InheritedAskGrant } from "./inherited-ask-grants.js";
46
50
  import { createRuleOffersOf, type PermissionRuleLanes } from "./permission-rule-lanes.js";
47
51
  import type { ToolCallLike } from "../tool-registry.js";
@@ -52,7 +56,7 @@ export interface PreparePolicyChainInput {
52
56
  /** borrowed-readonly — the REBOUND spec. Read: `sessionId` / `principal` (the session-rule read and the lanes' identity),
53
57
  * `durableApproval` / `checkpointStore` (the mandate-park facility test and the sandbox arming's park prerequisites),
54
58
  * `tools` (the names the caller mounted, for the name audit), `classifyAllShell` (every allow member's auto strip). Never mutated. */
55
- spec: Pick<TaskSpec, "sessionId" | "principal" | "durableApproval" | "checkpointStore" | "tools" | "excludeAllTools" | "classifyAllShell">;
59
+ spec: Pick<RosterSpec, "durableApproval"> & Pick<TaskSpec, "sessionId" | "principal" | "checkpointStore" | "tools" | "classifyAllShell">;
56
60
  /** borrowed-readonly — the deployment seats: `sessionPolicyStore` (the rule reads),
57
61
  * `permissionRuleStore` / `localOwnerRules` (the lanes and the offer factory), `onError` / `onNotice` (the advisories,
58
62
  * the refusal disclosures, the late-ask observer), `tracer` (the admission and rule-store frames), `checkpointStore` (the park facility). Receiver preserved;
@@ -67,6 +71,8 @@ export interface PreparePolicyChainInput {
67
71
  /** borrowed-readonly — the leg's carrier for the approving person's written words ({@link ApprovalWordsSeat}): an inherited station puts its
68
72
  * card to the ancestor's approver, and the words a person writes there are about this leg's call, so they reach this leg's model. */
69
73
  approvalWords: ApprovalWordsSeat;
74
+ /** borrowed-readonly — the run's engine text reading (its locale): an inherited station's card headline is minted in it. */
75
+ engineText: EngineText;
70
76
  /** borrowed-readonly — the FINAL task root (path rules resolve against it; the lanes' and the offers' root). */
71
77
  taskRootFinal: string;
72
78
  /** borrowed-readonly — the leg's canonical write roots beyond its write location (`additionalDirectories` + advertised writable
@@ -123,8 +129,9 @@ export interface PreparePolicyChainInput {
123
129
  /** borrowed-readonly — the resolved per-principal entitlements; only `forceDurableGate` (the mandate-park facility and
124
130
  * the sandbox arming's prerequisite). */
125
131
  runtimeCaps: Pick<RuntimeCaps, "forceDurableGate"> | undefined;
126
- /** borrowed-readonly — the driver's leg fact `approvalParkNotResumable` (the opt-in judge's third input). */ approvalParkNotResumable: boolean; /** borrowed-readonly — the driver's refusal fact: an inherited ask on such a leg is refused in the fold, never put to an ancestor's approver. */
127
- forcedGateNotResumable: boolean;
132
+ /** borrowed-readonly — the driver's leg fact `approvalParkNotResumable` (the opt-in judge's third input). */ approvalParkNotResumable: ApprovalParkNotResumable | undefined; /** borrowed-readonly — the word its refusals say (`notResumableSaysOf`). */
133
+ notResumableSays: ApprovalParkNotResumable | undefined; /** borrowed-readonly — the driver's refusal fact: an inherited ask on such a leg is refused in the fold, never put to an ancestor's approver. */
134
+ forcedGateNotResumable: ApprovalParkNotResumable | false | undefined;
128
135
  /** borrowed-readonly — the ancestors' session-rule snapshots (each re-read live-preferring, floor kept).
129
136
  * Never written: an entry is some other leg's or some host's object — see `ancestorSessionRulesRef`. */
130
137
  inheritedAncestorRules: InheritedGate["ancestorRules"];
@@ -176,6 +183,9 @@ export interface PreparePolicyChainInput {
176
183
  /** borrowed-readonly — the leg's live permission-mode seat: the mode gate policy layer and the inherited stations' arbitration
177
184
  * read `current` per call. */
178
185
  permissionMode: PermissionModeController;
186
+ /** borrowed-readonly — the leg's account of an allow rule auto mode does not use ({@link import("./auto-strip-notice.js").createAutoStripNotice}):
187
+ * the gate's allow members hand it each entry the strip took from a call that entry speaks for. */
188
+ autoStripNotice: (rule: AutoStrippedRule, call: ToolCallRequest) => void;
179
189
  /** borrowed-readonly — the leg's live roster seat; the mode write gate reads `current` per call. */ toolRosterDeltas: NonNullable<ModeGateSeats["roster"]>;
180
190
  /** borrowed-readonly — the run's ONE typed stop for a denial-limit bound (the fallback settlements call it). */
181
191
  stopForDenialLimit: StopForDenialLimit;
@@ -234,10 +244,7 @@ export interface PreparePolicyChainResult {
234
244
  inheritedAskGrants: Map<string, InheritedAskGrant>;
235
245
  /** owned — the engine-judged risk axes for an ask, from the same resolved sources the safety tightens use. */
236
246
  riskAxesOf: (call: Pick<ToolCallLike, "toolName" | "face">) => {
237
- riskAxes?: {
238
- irreversible?: boolean;
239
- egress?: boolean;
240
- };
247
+ riskAxes?: CallRiskAxes;
241
248
  };
242
249
  /** owned — the ONE rule-offer factory for all five ask-mint sites. */
243
250
  ruleOffersOf: ReturnType<typeof createRuleOffersOf>;
@@ -246,6 +253,8 @@ export interface PreparePolicyChainResult {
246
253
  grantBindingOf: GrantBindingOf;
247
254
  /** owned — the personal permission-rule lane, or undefined. */
248
255
  permissionRuleLane: PermissionRuleLanes["personal"];
256
+ /** owned — the same lane as the gate reads it: it also tells what the auto strip took from a call (the gate stations' lane). */
257
+ permissionRuleGateLane: PermissionRuleLanes["personal"];
249
258
  /** owned — the leg's facts the two lanes judge against (session, root and anchors, head leads, sinks), for the consolidation
250
259
  * write judge, which builds its own two lanes over the reader the run's cut does not end (it is asked after the run). */
251
260
  ruleLaneFacts: import("./memory-consolidation-write-judge.js").ConsolidationWriteJudgeLeg["lanes"];
@@ -12,6 +12,7 @@ import { isIsolated } from "../remote-env.js";
12
12
  import { deliverEngineNotice } from "../engine-notice.js";
13
13
  import { earlierGrammarNotice } from "../session-policy-store.js";
14
14
  import { attest, attestationOf, checkToolPolicyProjection, combinePolicies, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, durableParkOptInDeclared, isAnsweringSeat, mergeAttestation, refuseOutOfContractDecision, resolveAskFor, toolPolicyNameSets, withAttestation, wrapToolPolicy } from "../tool-policy.js";
15
+ import { notResumableClause, notResumableRefusal } from "../park-resumability.js";
15
16
  import { judgePolicyEntryName, mountedToolNames } from "../tool-name-aliases.js";
16
17
  import { approvalCardMemberOf } from "../tool-roster.js";
17
18
  import { existingTargetOf } from "../existing-target.js";
@@ -24,7 +25,8 @@ import { delegationPoolReading, policyNameRefusal } from "./sub-agent-deny-lists
24
25
  import { POLICY_NAME_REFUSAL_CODE, retiredToolNameNotice } from "../retired-tool-name-account.js";
25
26
  import { UNMATCHED_TOOL_NAMES_CODE } from "../unmatched-tool-names.js";
26
27
  import { valveLeaves } from "../../agents/tool-filter.js";
27
- import { autoStrippedRule, cardDisclosureOf, classifiesAllShell, inheritedAskFallbackMessage, rootFacingToolNames } from "../allow-entry.js";
28
+ import { autoStripReasonOfRow, cardDisclosureOf, classifiesAllShell, inheritedAskFallbackMessage, rootFacingToolNames } from "../allow-entry.js";
29
+ import { ruleSourceOf } from "../permission-rule-provider.js";
28
30
  import { arbitrateByMode, askClassMembersOf, askFaceOf, askMandateMember, INHERITED_STATION_FACTS } from "../ask-origin.js";
29
31
  import { createModeGatePolicy, mountedToolDeclaresReadOnly } from "../mode-policy.js";
30
32
  const ancestorFacts = (ask) => ({ ...(ask ?? {}), ancestorResolved: true });
@@ -40,7 +42,7 @@ import { policyThrowLine, reportPolicyThrow } from "./policy-throw.js";
40
42
  import { heldBy, heldValues, seatOf, wireOf } from "../tool-name-readings.js";
41
43
  import { hostFloorPolicy } from "../host-floor.js";
42
44
  export async function preparePolicyChain(input) {
43
- const { spec, deps, sessionId, runId, hostTaskId, approvalWords, taskRootFinal, additionalRootsCanonical, writeLocation, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, approvalParkNotResumable, forcedGateNotResumable, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, whileClassifying, readFace, permissionMode, toolRosterDeltas, stopForDenialLimit, askSource, abortController, now, ownSessionRulesRef, hostFloor } = input;
45
+ const { spec, deps, sessionId, runId, hostTaskId, approvalWords, engineText, taskRootFinal, additionalRootsCanonical, writeLocation, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, approvalParkNotResumable, notResumableSays, forcedGateNotResumable, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, whileClassifying, readFace, permissionMode, autoStripNotice, toolRosterDeltas, stopForDenialLimit, askSource, abortController, now, ownSessionRulesRef, hostFloor } = input;
44
46
  const ancestorArbitrations = new Map();
45
47
  const judgeHeld = (opts) => judgeInheritedClassifier({ ...opts, autoMode: opts.autoMode === undefined ? undefined : { ...opts.autoMode, decider: heldWhileClassifying(opts.autoMode.decider, whileClassifying) } });
46
48
  const unreadCardTarget = (toolName, args) => existingTargetOf(toolRosterDeltas.current, toolName, args, undefined);
@@ -62,7 +64,7 @@ export async function preparePolicyChain(input) {
62
64
  const known = mountedToolNames(tools);
63
65
  for (const t of harnessTools)
64
66
  known.add(t.name);
65
- const pool = delegationPoolReading(spec.tools ?? [], valveLeaves(spec, selector));
67
+ const pool = delegationPoolReading(spec.tools ?? [], valveLeaves(selector));
66
68
  const callerNames = mountedToolNames(spec.tools ?? []);
67
69
  const rootFacing = rootFacingToolNames([...known, ...callerNames, ...pool.names]);
68
70
  const universe = {
@@ -222,7 +224,7 @@ export async function preparePolicyChain(input) {
222
224
  const mandatedCallFloats = (station, creq, mark) => resolveCheckpointStore(spec, deps) !== undefined && durableParkOptInDeclared({ forceDurableGate: runtimeCaps?.forceDurableGate === true, durableApprovalDeclared: spec.durableApproval !== undefined, approvalParkNotResumable }) && markInheritedUnavailable(station, creq, mark);
223
225
  const mandateUnreconstructibleDeny = (creq) => attest({
224
226
  action: "deny",
225
- message: `inherited parent policy requires durable approval for "${creq.toolName}" — the parent's durable ask cannot be reconstructed in a delegated child; denied fail-closed (tighten-only)`,
227
+ message: notResumableSays !== undefined ? notResumableRefusal(`inherited parent policy requires durable approval for "${creq.toolName}"`, notResumableSays, "call") : `inherited parent policy requires durable approval for "${creq.toolName}" — the parent's durable ask cannot be reconstructed in a delegated child; denied fail-closed (tighten-only)`,
226
228
  }, creq, { unresolvableCause: "mandate_unreconstructible" });
227
229
  const markerChannelFullDeny = (creq) => attest({ action: "deny", message: `no approver is reachable for the inherited approval of "${creq.toolName}" and the marker channel is at capacity — denied fail-closed` }, creq, { unresolvableCause: "approver_unavailable" });
228
230
  const inheritedAskGrants = new Map();
@@ -247,7 +249,7 @@ export async function preparePolicyChain(input) {
247
249
  if (store === undefined)
248
250
  missing.push("a wired CheckpointStore");
249
251
  if (!durableParkOptInDeclared({ forceDurableGate: runtimeCaps?.forceDurableGate === true, durableApprovalDeclared: spec.durableApproval !== undefined, approvalParkNotResumable }))
250
- missing.push(`a durable park (spec.durableApproval, or the forceDurableGate entitlement${approvalParkNotResumable ? " — neither counts on a leg whose approval park cannot be resumed, a delegated leg its parent forwarded no opt-in to" : ""})`);
252
+ missing.push(`a durable park (spec.durableApproval, or the forceDurableGate entitlement${approvalParkNotResumable !== undefined ? ` — neither counts on a leg nobody resumes: ${notResumableClause(approvalParkNotResumable)}` : ""})`);
251
253
  if (missing.length === 0)
252
254
  return true;
253
255
  try {
@@ -338,8 +340,9 @@ export async function preparePolicyChain(input) {
338
340
  };
339
341
  const inheritedAskEvidence = inheritedAskRuleEvidence(deps.permissionRuleStore);
340
342
  const listFacts = { root: taskRootFinal, sessionId, liveCwd: () => handsCwdRef?.current, anchors: pathRuleAnchors.leg, classifyAllShell: classifiesAllShell(spec) };
341
- const skillGrantLane = skillGrants.lane(listFacts);
342
- const allowEntryLanes = { request: allowedToolTables.request.lane(listFacts), deployment: allowedToolTables.deployment.lane(listFacts) };
343
+ const toldFrom = (source) => (s, call) => autoStripNotice({ entry: s.entry, source, reason: s.reason, ...(s.skill !== undefined ? { skill: s.skill } : {}) }, call);
344
+ const skillGrantLane = skillGrants.lane({ ...listFacts, onAutoStripped: toldFrom("skill") });
345
+ const allowEntryLanes = { request: allowedToolTables.request.lane({ ...listFacts, onAutoStripped: toldFrom("request") }), deployment: allowedToolTables.deployment.lane({ ...listFacts, onAutoStripped: toldFrom("deployment") }) };
343
346
  const ruleLaneFacts = {
344
347
  sessionId,
345
348
  root: taskRootFinal,
@@ -352,9 +355,11 @@ export async function preparePolicyChain(input) {
352
355
  questionToolName: ASK_USER_QUESTION_TOOL_NAME,
353
356
  onRevisionDefect: (message) => deps.onError?.(new Error(message), { phase: "config", sessionId }),
354
357
  onDisclosure: (message) => emitTrace(deps.tracer, () => ({ kind: "permission.rule_store_unreadable", version: 1, taskId: hostTaskId, message, ts: Date.now() })),
355
- stripsAllow: (rule, req) => autoStrippedRule(rule, req, permissionMode.current, listFacts.classifyAllShell),
358
+ stripsAllow: (rule, req) => autoStripReasonOfRow(rule, req, permissionMode.current, listFacts.classifyAllShell),
356
359
  };
357
- const { personal: permissionRuleLane, org: permissionRuleOrgLane, wholeToolRefusals: storedRuleWholeToolRefusals } = createPermissionRuleLanes({ provider: deps.permissionRuleStore, localOwnerDeclared: deps.localOwnerRules === true, principal: spec.principal, ...ruleLaneFacts, rows: personRows });
360
+ const laneOver = { provider: deps.permissionRuleStore, localOwnerDeclared: deps.localOwnerRules === true, principal: spec.principal, ...ruleLaneFacts, rows: personRows };
361
+ const { personal: permissionRuleLane, org: permissionRuleOrgLane, wholeToolRefusals: storedRuleWholeToolRefusals } = createPermissionRuleLanes(laneOver);
362
+ const { personal: permissionRuleGateLane } = createPermissionRuleLanes({ ...laneOver, onAutoStripped: (rule, reason, req) => autoStripNotice({ entry: rule.rule, source: ruleSourceOf(rule.scope), reason }, req) });
358
363
  const ruleOffersOf = createRuleOffersOf({
359
364
  laneArmed: permissionRuleLane !== undefined,
360
365
  principal: spec.principal,
@@ -435,7 +440,7 @@ export async function preparePolicyChain(input) {
435
440
  ...askMandateMember(ancestorFacts(j.ask)),
436
441
  ...inheritedAskCarry(j, isAnsweringSeat(onAskOf), ancestorTracker),
437
442
  ruleEvidence: inheritedAskEvidence,
438
- }, onAskOf, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords), ancestorTracker, creq, inheritedStationFacts(creq));
443
+ }, onAskOf, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText), ancestorTracker, creq, inheritedStationFacts(creq));
439
444
  void settleReadRootGrant(rr.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice });
440
445
  settleDenialLimitFallback({ fallback: settled.fallback, mintedHere: settled.mintedHere, tracker: ancestorTracker, resolved: rr, headless: headlessDenyAtRecheck, stop: stopForDenialLimit, toolName: creq.toolName, toolCallId: creq.toolCallId });
441
446
  if (rr.action !== "allow")
@@ -494,7 +499,7 @@ export async function preparePolicyChain(input) {
494
499
  ...askMandateMember(ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
495
500
  ...inheritedAskCarry(j, isAnsweringSeat(pc.onAsk), pc.autoMode?.denialTracking),
496
501
  ruleEvidence: inheritedAskEvidence,
497
- }, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
502
+ }, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
498
503
  void settleReadRootGrant(resolved.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice });
499
504
  const askWaitMs = Math.max(0, now() - askT0);
500
505
  if (resolved.action === "deny" && resolved.approverUnavailable === true) {
@@ -583,7 +588,7 @@ export async function preparePolicyChain(input) {
583
588
  ...askMandateMember(ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
584
589
  ...inheritedAskCarry(j, isAnsweringSeat(pc.onAsk), pc.autoMode?.denialTracking),
585
590
  ruleEvidence: inheritedAskEvidence,
586
- }, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
591
+ }, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
587
592
  void settleReadRootGrant(resolved.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice });
588
593
  const askWaitMs = Math.max(0, now() - askT0);
589
594
  if (resolved.action === "deny" && resolved.approverUnavailable === true) {
@@ -692,7 +697,7 @@ export async function preparePolicyChain(input) {
692
697
  return decision;
693
698
  })
694
699
  : foldedPolicy;
695
- return { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, riskAxesOf, ruleOffersOf, grantBindingOf, permissionRuleLane, ruleLaneFacts, permissionRuleOrgLane, storedRuleWholeToolRefusals, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations: installationsOnLeg };
700
+ return { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, riskAxesOf, ruleOffersOf, grantBindingOf, permissionRuleLane, permissionRuleGateLane, ruleLaneFacts, permissionRuleOrgLane, storedRuleWholeToolRefusals, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations: installationsOnLeg };
696
701
  }
697
702
  const advisedPolicyNames = new WeakMap();
698
703
  const ADVISED_KEYS_CAP = 64;
@@ -14,7 +14,7 @@ export interface PrepareProjectContextInput {
14
14
  * shared-memory tools' trusted identity), `instructionFamily` and `projectMemory` (the manifest's word: a declared
15
15
  * family, and the request's off switch for it — the config door's one reading), `classifyAllShell` (the Skill card's
16
16
  * auto strip). Never mutated. */
17
- spec: Pick<TaskSpec, "sessionId" | "skills" | "userInvokedSkills" | "principal" | "excludeAllTools" | "instructionFamily" | "projectMemory" | "classifyAllShell">;
17
+ spec: Pick<TaskSpec, "sessionId" | "skills" | "userInvokedSkills" | "principal" | "instructionFamily" | "projectMemory" | "classifyAllShell">;
18
18
  /** borrowed-readonly — trusted internals: `inheritedSkillGrants` (the parent's captured skill grant rows, seeded as
19
19
  * `inherited`), `inheritedAllowedTools` (the parent's request entries, seeded as this leg's own). `undefined` on a
20
20
  * standalone prepare. */
@@ -5,8 +5,8 @@ import { defineTool } from "../tools.js";
5
5
  import { readFrozenSkillGrants, seedSkillGrants, skillSeatReader, tellRetiredSkillDeny } from "../skill-grant.js";
6
6
  import { allowedToolsNotGrantedNotice, classifiesAllShell, seedAllowEntryTables } from "../allow-entry.js";
7
7
  import { deliverEngineNotice } from "../engine-notice.js";
8
- import { announceMemoryNotMounted } from "./announce-once-ledger.js";
9
- import { instructionFamilyOf } from "./nested-memory-lane.js";
8
+ import { announceMemoryNotMounted, noticeOncePerSink } from "./announce-once-ledger.js";
9
+ import { INSTRUCTIONS_FAMILY_UNDECLARED, instructionFamilyOf, instructionsFamilyUndeclaredNotice } from "./nested-memory-lane.js";
10
10
  import { SKILL_CONTENT_MAX_CHARS, SKILL_TOOL_NAME, createSkillTool, normalizeSkills } from "./synthetic-tools.js";
11
11
  import { skillLoadReading } from "./skill-base-dir.js";
12
12
  import { RosterBuilder } from "../tool-roster.js";
@@ -15,8 +15,10 @@ import { valveLeaves } from "../../agents/tool-filter.js";
15
15
  export async function prepareProjectContext(input) {
16
16
  const { deps, spec, internals, sessionId, hostTaskId, skillGrants, allowedTools, allowedToolTables, roster, toolFaceSnapshot, onceLedger, memoryTools, memoryEngineSession, memorySearchToolsPlanned, memoryPairExcludedName, memoryPairOccupiedName, resume, skillListingBudget } = input;
17
17
  const tools = roster.tools;
18
- const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
18
+ const leaves = valveLeaves(toolFaceSnapshot.selector);
19
19
  const projectMemoryFact = instructionFamilyOf(spec) === undefined ? "absent" : spec.projectMemory === "disabled" ? "disabled" : "on";
20
+ if (projectMemoryFact === "absent" && spec.projectMemory !== "disabled")
21
+ noticeOncePerSink(deps.onNotice, INSTRUCTIONS_FAMILY_UNDECLARED, () => deliverEngineNotice(deps.onNotice, instructionsFamilyUndeclaredNotice(sessionId)));
20
22
  const declaredSkillRank = new Map();
21
23
  for (const s of spec.skills ?? [])
22
24
  if (!declaredSkillRank.has(s.name))
@@ -1,4 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { textContentHashOf } from "../canonical-json.js";
2
3
  import { SEND_MESSAGE_TOOL_NAME } from "../../agents/send-message-tool.js";
3
4
  import { assemblePrompt } from "../../prompt-assembly/assemble.js";
4
5
  import { adoptCenter, centerOverlaysOf, verifyPromptArtifactBody } from "../../prompt-assembly/artifact.js";
@@ -156,7 +157,7 @@ export async function preparePromptAssembly(input) {
156
157
  const saltedHash = (text) => createHash("sha256").update(PROMPT_HASH_SALT).update(text).digest("hex").slice(0, 12);
157
158
  const contentHashOf = (s) => s.renderer !== undefined || s.chain.some((l) => l.source === "task")
158
159
  ? `salted:${createHash("sha256").update(PROMPT_HASH_SALT).update(s.text).digest("hex")}`
159
- : `sha256:${createHash("sha256").update(s.text).digest("hex")}`;
160
+ : textContentHashOf(s.text);
160
161
  const promptManifest = {
161
162
  identity: { artifact: current.identity, layers: current.layers, epoch: current.epoch, activatedBy: current.activatedBy },
162
163
  selectors: selectorRecord,
@@ -41,8 +41,8 @@ import { type ContextWindowOverlay } from "../context-settings.js";
41
41
  export interface PreparePromptInputsInput {
42
42
  /** borrowed-readonly — the REBOUND spec (`spec′`). Read: `systemPrompt` / `appendSystemPrompt` (handed whole to the
43
43
  * request-body sugar), `clientContext` (zone, email), `envFacts` (the deployment's sandbox + resume facts),
44
- * `compaction` (the within-task flag), `excludeAllTools` (the valve's whole-face switch). Never mutated. */
45
- spec: Pick<TaskSpec, "systemPrompt" | "appendSystemPrompt" | "clientContext" | "envFacts" | "compaction" | "excludeAllTools">;
44
+ * `compaction` (the within-task flag). Never mutated. */
45
+ spec: Pick<TaskSpec, "systemPrompt" | "appendSystemPrompt" | "clientContext" | "envFacts" | "compaction">;
46
46
  /** borrowed-readonly — deployment deps: `onError` (the operator lane: fail-closed advisory, cwd misalignment,
47
47
  * git-lane degrade), `modelKnowledgeCutoffs`. Receiver preserved (`deps.onError?.(…)`). */
48
48
  deps: Pick<RunnerDeps, "onError" | "modelKnowledgeCutoffs">;
@@ -33,7 +33,7 @@ export async function preparePromptInputs(input) {
33
33
  memoryStoreAbsent: input.memoryStoreAbsent,
34
34
  };
35
35
  const sugar = requestBodySugar({ spec, resolvedRole, ...(input.taskRole !== undefined ? { taskRole: input.taskRole } : {}) });
36
- const valveLeft = valveLeaves(spec, toolFaceSnapshot.selector);
36
+ const valveLeft = valveLeaves(toolFaceSnapshot.selector);
37
37
  const taught = mcp.serverInstructions.filter((entry) => instructionsTaught(valveLeft, entry.server, input.roster.tools, mcp.tools));
38
38
  toldAtStart(mcp.instructionsDelta, taught);
39
39
  const say = input.engineText;
@@ -40,17 +40,16 @@ export interface PrepareProtocolToolsInput {
40
40
  hostFloor: import("../host-floor.js").HostFloor | undefined;
41
41
  /** borrowed-readonly — the REBOUND spec. Read: `principal` (the MCP header / the A2A identity), `isolationScope` (with `principal`,
42
42
  * through `isolationScopeOf`: the partition the MCP pool keys this leg's connections under), `tools`
43
- * (the caller names both reserved-name guards check against), `excludeAllTools` (the valve's whole-face switch: the live roster lane's
44
- * reading, and the first-dial gate), `signal` (the host's abort, which stops an MCP dial). */
45
- spec: Pick<TaskSpec, "principal" | "isolationScope" | "tools" | "excludeAllTools" | "signal">;
43
+ * (the caller names both reserved-name guards check against), `signal` (the host's abort, which stops an MCP dial). */
44
+ spec: Pick<TaskSpec, "principal" | "isolationScope" | "tools" | "signal">;
46
45
  /** borrowed-readonly — the deployment seats the materializers and their operator faces read: `onElicit`
47
46
  * and `imageProcessor` ride into the MCP intake; `onError` takes the A2A warnings (no ledger — a peer is
48
47
  * re-read every prepare); `protocolRevocations` + `onNotice` make the leg's one revocation probe; `peerSeat` answers what each MCP / A2A request carries. */
49
48
  deps: Pick<RunnerDeps, "onElicit" | "imageProcessor" | "onError" | "protocolRevocations" | "onNotice" | "peerSeat">;
50
49
  /** borrowed-readonly — the leg's mods bus: its `prompt.section` station disposes of each server's instructions at the dial. */
51
50
  modBus: LegModBus;
52
- /** borrowed-readonly — the run tree's MCP connection pool (the leg leases its connections from it) and whether THIS leg created it
53
- * (then this leg's dispose also closes it). Absent for a leg that declares no server. */
51
+ /** borrowed-readonly — the run tree's MCP connection pool (the leg leases its connections from it and reads its memory of a failed
52
+ * attempt) and whether THIS leg created it (then this leg's dispose also closes it). Absent on a standalone leg that declares no server. */
54
53
  mcpPool?: {
55
54
  pool: import("../mcp-connection-pool.js").McpConnectionPool;
56
55
  owned: boolean;
@@ -5,7 +5,7 @@ import { valveLeaves, valveLeavesPeer } from "../../agents/tool-filter.js";
5
5
  import { resourceFacesLeft } from "../mounted-mcp.js";
6
6
  import { materializeLegA2aTools } from "../a2a.js";
7
7
  import { revocationProbe } from "../protocol-revocation.js";
8
- import { whereToAuthorize } from "../mcp-failure.js";
8
+ import { WHERE_TO_AUTHORIZE } from "../mcp-failure.js";
9
9
  import { mcpServerUnavailableNotice } from "../mcp-server-unavailable-notice.js";
10
10
  import { deliverEngineNotice } from "../types.js";
11
11
  import { isolationScopeOf } from "../isolation-scope.js";
@@ -34,8 +34,8 @@ export async function prepareProtocolTools(input) {
34
34
  if (overPeer !== undefined) {
35
35
  throw Object.assign(new Error(`MCP server name ${JSON.stringify(overPeer.name.slice(0, 40) + "…")} is ${overPeer.name.length} characters; a peer rides every roster row of its tools and the roster's bound on a name is ${TOOL_WIRE_NAME_MAX_CHARS}.`), { code: "config.tool_name_too_long" });
36
36
  }
37
- const serverReached = valveLeavesPeer(spec, toolFaceSnapshot.selector);
38
- const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
37
+ const serverReached = valveLeavesPeer(toolFaceSnapshot.selector);
38
+ const leaves = valveLeaves(toolFaceSnapshot.selector);
39
39
  const resourcesReached = resourceFacesLeft(leaves);
40
40
  const revocations = legRevocationProbe(deps, runId);
41
41
  const mcp = lockedPreflight.mcp?.length
@@ -46,7 +46,7 @@ export async function prepareProtocolTools(input) {
46
46
  rollback.push(function mcpDispose() { return mcp.dispose(); });
47
47
  for (const w of mcp.warnings) {
48
48
  onceLedger.onError(w, { phase: "mcp", sessionId });
49
- const told = mcpServerUnavailableNotice(w, mcp.statuses, { sessionId, runId });
49
+ const told = mcpServerUnavailableNotice(w, mcp.statuses, { sessionId: mcpPool?.pool.sessionId ?? sessionId, runId });
50
50
  if (told !== undefined)
51
51
  deliverEngineNotice(deps.onNotice, told);
52
52
  }
@@ -93,7 +93,7 @@ export async function prepareProtocolTools(input) {
93
93
  const rebuildHarnessToolsRef = {};
94
94
  const contentOriginWrapRef = {};
95
95
  const toolCallGateArmedRef = { armed: false };
96
- const rosterApply = { spec, toolFaceSnapshot, withFaces, remoteToolOffload, foldProtocolAxes: (axes, label) => foldProtocolAxes(axes, label), toolEffects, axisExplicitNegatives, roster, declared: lockedPreflight.mcp ?? [], instructionsDelta: mcp.instructionsDelta };
96
+ const rosterApply = { toolFaceSnapshot, withFaces, remoteToolOffload, foldProtocolAxes: (axes, label) => foldProtocolAxes(axes, label), toolEffects, axisExplicitNegatives, roster, declared: lockedPreflight.mcp ?? [], instructionsDelta: mcp.instructionsDelta };
97
97
  const rosterCommit = { rebuildHarnessToolsRef, rosterSeat, toolCallGateArmedRef, irreversibleTools, egressTools };
98
98
  const redialInput = { ...rosterApply, ...rosterCommit, mcp, deps, sessionId, runId, irreversibilityTier };
99
99
  roster.mounts.know({ "spec.mcp": (lockedPreflight.mcp?.length ?? 0) > 0 });
@@ -193,7 +193,7 @@ export async function prepareProtocolTools(input) {
193
193
  foldProtocolAxes(mcp.toolAxes, "MCP");
194
194
  const a2aDeclared = lockedPreflight.a2a;
195
195
  const a2a = a2aDeclared
196
- ? await materializeLegA2aTools(revocations, a2aDeclared, spec.principal, abortController.signal, hostFloor, deps.peerSeat, credentialEchoNotice(deps.onNotice, sessionId, runId, "a2a"))
196
+ ? await materializeLegA2aTools(revocations, a2aDeclared, spec.principal, abortController.signal, hostFloor, deps.peerSeat, credentialEchoNotice(deps.onNotice, sessionId, runId, "a2a"), (entry) => serverReached(mintNamespacePrefix(A2A_NAMESPACE, entry.name)))
197
197
  : { tools: [], toolAxes: [], warnings: [], statuses: [], refresh: async () => [], dispose: async () => { } };
198
198
  if (a2aDeclared)
199
199
  rollback.push(function a2aDispose() { return a2a.dispose(); });
@@ -223,7 +223,7 @@ function poolPartition(spec) {
223
223
  function mcpAuthorizationNotice(deps, sessionId, runId, principal) {
224
224
  return (server, { reason, authorizeUrl }) => deliverEngineNotice(deps.onNotice, {
225
225
  code: "mcp.authorization_required",
226
- message: `MCP server "${server}" needs the user's authorization before it serves them (${reason}) — authorize it ${whereToAuthorize(authorizeUrl)}; its tools are unavailable until then.`,
226
+ message: `MCP server "${server}" needs the user's authorization before it serves them (${reason}) — authorize it ${WHERE_TO_AUTHORIZE}; its tools are unavailable until then.`,
227
227
  detail: { server, reason, ...(authorizeUrl !== undefined ? { authorizeUrl } : {}), ...(principal !== undefined ? { principal } : {}), sessionId, runId },
228
228
  });
229
229
  }
@@ -20,6 +20,8 @@ import type { AgentTool } from "../../internal/harness.js";
20
20
  import { type OnQuestion } from "../ask-question.js";
21
21
  import type { CheckpointStore } from "../checkpoint-store.js";
22
22
  import { type AskSourceIdentity } from "../tool-policy.js";
23
+ import type { ApprovalParkNotResumable } from "../park-resumability.js";
24
+ import type { RosterSpec } from "./caller-roster.js";
23
25
  import type { RunnerDeps, RuntimeCaps, TaskSpec } from "../types.js";
24
26
  import type { PrepareResume } from "./contracts.js";
25
27
  import { type ContentAskBinding } from "./content-ask-bindings.js";
@@ -31,7 +33,7 @@ export interface PrepareQuestionFaceInput {
31
33
  frozenOnQuestion: OnQuestion | undefined;
32
34
  /** borrowed-readonly — the REBOUND spec. Read: `durableApproval` (the durable face's opt-in), `interactiveTools`
33
35
  * (the override), `interactiveQuestionFallback` (restores the continuation under a resolved posture). Never mutated. */
34
- spec: Pick<TaskSpec, "durableApproval" | "interactiveTools" | "interactiveQuestionFallback" | "excludeAllTools">;
36
+ spec: Pick<RosterSpec, "durableApproval"> & Pick<TaskSpec, "interactiveTools" | "interactiveQuestionFallback">;
35
37
  /** borrowed-readonly — the leg's one ask source (minted once by the driver): the mounted tool's source members. */
36
38
  askSource: AskSourceIdentity;
37
39
  /** borrowed-readonly — the deployment seat `onError` (the stranded-answer and synthetic-continuation operator
@@ -42,7 +44,7 @@ export interface PrepareQuestionFaceInput {
42
44
  /** borrowed-readonly — the principal's resolved runtime caps as of this point (`forceDurableGate` is the
43
45
  * mandate that outranks a live face only where a store exists to park the question). */
44
46
  runtimeCaps: Pick<RuntimeCaps, "forceDurableGate"> | undefined;
45
- /** borrowed-readonly — the driver's one leg fact `approvalParkNotResumable` (the opt-in judge's third input). */ approvalParkNotResumable: boolean;
47
+ /** borrowed-readonly — the driver's one leg fact `approvalParkNotResumable` (the opt-in judge's third input). */ approvalParkNotResumable: ApprovalParkNotResumable | undefined;
46
48
  /** borrowed-readonly — the resolved interaction posture (the door's value), threaded to the tool so both
47
49
  * no-answer arms harden under it. */
48
50
  resolvedInteractionPosture: "interactive" | "headless" | undefined;
@@ -26,6 +26,7 @@ import type { PermissionModeController } from "../mode-policy.js";
26
26
  import { type EditedFilesLedger } from "./edited-files-ledger.js";
27
27
  import { type ToolOccurrenceTable } from "./tool-occurrence.js";
28
28
  import type { ReadFloorSeat } from "../../tools/fs/read-floor.js";
29
+ import { type ApprovalParkNotResumable } from "../park-resumability.js";
29
30
  export interface PrepareRunRefsInput {
30
31
  /** borrowed-readonly — the REBOUND spec. Read: `forwardSubagentEvents` (widens the forwarding filter),
31
32
  * `retainSubagentSessions` (the ledger opt-in and its config), `handsReadOnly` (a read-only run mints no
@@ -43,6 +44,10 @@ export interface PrepareRunRefsInput {
43
44
  taskRootFinal: string;
44
45
  /** borrowed-readonly — the run's byte-floor seat (read-floor.ts), read at each start: the worktree helper's git carries the run's base table. */
45
46
  readFloor: ReadFloorSeat;
47
+ /** borrowed-readonly — the word the driver's leg fact says (`notResumableSaysOf`; present iff the leg's parks cannot be resumed): on such a
48
+ * leg a plan-approval request is refused to the call that made it (`reviewRefusalSentence`) — no plan_review row is minted there, so the
49
+ * call must not read as presented. */
50
+ notResumableSays: ApprovalParkNotResumable | undefined;
46
51
  }
47
52
  export interface PrepareRunRefsResult {
48
53
  /** owned — the ledger's writer (`FileEditedHook`): handed to the hands/read-face phase as its post-write
@@ -78,8 +83,8 @@ export interface PrepareRunRefsResult {
78
83
  * tool ctx then carries no `forwardEvent` key). */
79
84
  forwardEvent: ((e: TaskEvent) => void) | undefined;
80
85
  /** borrowed-mutable — the review-request cell (`Prepared.reviewRequestRef`). Writers: `requestReview` here
81
- * (the first request wins) and the run loop's turn-boundary consumer, which clears `pending` once the
82
- * `plan_review` checkpoint is minted. */
86
+ * (the first request wins, the rest queue in `later`), the end projection (`notePresentedPlan`: what each request's
87
+ * call showed), and the run loop's turn-boundary consumer, which clears both. */
83
88
  reviewRequestRef: Prepared["reviewRequestRef"];
84
89
  /** owned — the ctx primitive that arms `reviewRequestRef`. */
85
90
  requestReview: (opts?: ReviewRequest) => void;
@@ -4,6 +4,7 @@ import { SkillGrantTable } from "../skill-grant.js";
4
4
  import { forwardSafely } from "./forward-sink.js";
5
5
  import { createEditedFilesLedger } from "./edited-files-ledger.js";
6
6
  import { createToolOccurrenceTable } from "./tool-occurrence.js";
7
+ import { reviewRefusalSentence } from "../park-resumability.js";
7
8
  export function forwardsSubagentEvents(spec) {
8
9
  return spec.forwardSubagentEvents === true;
9
10
  }
@@ -11,7 +12,7 @@ export function drainForwardedFramesBeforeDone() {
11
12
  return new Promise((resolve) => setImmediate(resolve));
12
13
  }
13
14
  export function prepareRunRefs(input) {
14
- const { spec, internals, executionEnv, taskRootFinal, readFloor } = input;
15
+ const { spec, internals, executionEnv, taskRootFinal, readFloor, notResumableSays } = input;
15
16
  const { note: noteFileEdited, snapshot: editedFilesSnapshot } = createEditedFilesLedger();
16
17
  const harnessRef = {};
17
18
  const toolProgressRef = {};
@@ -29,12 +30,12 @@ export function prepareRunRefs(input) {
29
30
  : undefined;
30
31
  const reviewRequestRef = {};
31
32
  const requestReview = (opts) => {
32
- if (reviewRequestRef.pending === undefined) {
33
- reviewRequestRef.pending = {
34
- ...(opts?.reason !== undefined ? { reason: opts.reason } : {}),
35
- ...(opts?.requestedByCallId !== undefined ? { requestedByCallId: opts.requestedByCallId } : {}),
36
- };
37
- }
33
+ if (reviewRequestRef.pending === undefined)
34
+ reviewRequestRef.pending = { ...opts };
35
+ else
36
+ (reviewRequestRef.later ??= []).push({ ...opts });
37
+ if (notResumableSays !== undefined)
38
+ throw new Error(reviewRefusalSentence(notResumableSays));
38
39
  };
39
40
  const stopRequestedRef = { current: false };
40
41
  const requestStopAfterTurn = () => {