@sema-agent/core 7.51.2 → 7.53.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 (446) hide show
  1. package/CHANGELOG.md +698 -2
  2. package/README.md +3 -1
  3. package/dist/agents/agent-transcript-tool.d.ts +1 -1
  4. package/dist/agents/cascade.js +4 -0
  5. package/dist/agents/cross-session-envelope.d.ts +8 -0
  6. package/dist/agents/cross-session-envelope.js +6 -0
  7. package/dist/agents/cross-session-judge.d.ts +21 -1
  8. package/dist/agents/cross-session-judge.js +8 -0
  9. package/dist/agents/cross-session-ref.d.ts +5 -0
  10. package/dist/agents/cross-session-ref.js +1 -0
  11. package/dist/agents/cumulative-stats.d.ts +3 -0
  12. package/dist/agents/cumulative-stats.js +3 -0
  13. package/dist/agents/list-agents-tool.d.ts +1 -1
  14. package/dist/agents/org-delivery-gate.d.ts +122 -0
  15. package/dist/agents/org-delivery-gate.js +69 -0
  16. package/dist/agents/peer-held-queue.d.ts +9 -4
  17. package/dist/agents/peer-held-queue.js +6 -5
  18. package/dist/agents/peer-session-drain.d.ts +35 -5
  19. package/dist/agents/peer-session-drain.js +271 -180
  20. package/dist/agents/read-inbox-tool.d.ts +8 -1
  21. package/dist/agents/read-inbox-tool.js +5 -1
  22. package/dist/agents/repair-loop.js +4 -0
  23. package/dist/agents/send-message-tool.d.ts +11 -16
  24. package/dist/agents/send-message-tool.js +11 -13
  25. package/dist/agents/subagent.d.ts +3 -0
  26. package/dist/agents/subagent.js +105 -76
  27. package/dist/agents/tool-filter.d.ts +58 -13
  28. package/dist/agents/tool-filter.js +34 -14
  29. package/dist/bench/metrics.d.ts +1 -0
  30. package/dist/brain/anthropic.d.ts +6 -1
  31. package/dist/brain/anthropic.js +17 -13
  32. package/dist/brain/model-presets.d.ts +4 -5
  33. package/dist/brain/model-presets.js +6 -5
  34. package/dist/brain/open-responses.js +16 -12
  35. package/dist/brain/openai.js +16 -12
  36. package/dist/brain/request-params.d.ts +12 -33
  37. package/dist/brain/request-params.js +5 -2
  38. package/dist/brain/request-route.d.ts +9 -8
  39. package/dist/brain/request-route.js +1 -0
  40. package/dist/brain/route-adjudicator.d.ts +123 -47
  41. package/dist/brain/route-adjudicator.js +171 -42
  42. package/dist/brain/route-conformance.js +2 -2
  43. package/dist/brain/routing.d.ts +24 -1
  44. package/dist/brain/routing.js +54 -19
  45. package/dist/brain/status-sink.d.ts +18 -0
  46. package/dist/brain/status-sink.js +7 -0
  47. package/dist/brain/timeout.js +5 -4
  48. package/dist/core/a2a.d.ts +5 -2
  49. package/dist/core/a2a.js +30 -13
  50. package/dist/core/allow-entry.d.ts +42 -9
  51. package/dist/core/allow-entry.js +25 -18
  52. package/dist/core/auto-compaction.d.ts +80 -20
  53. package/dist/core/auto-compaction.js +65 -18
  54. package/dist/core/auto-promote.d.ts +2 -1
  55. package/dist/core/auto-promote.js +2 -2
  56. package/dist/core/caller-tool-name.d.ts +9 -0
  57. package/dist/core/caller-tool-name.js +13 -0
  58. package/dist/core/checkpoint-requirements.d.ts +7 -1
  59. package/dist/core/checkpoint-requirements.js +2 -0
  60. package/dist/core/checkpoint-store.d.ts +57 -24
  61. package/dist/core/checkpoint-store.js +3 -3
  62. package/dist/core/child-clamp-seats.d.ts +6 -0
  63. package/dist/core/child-clamp-seats.js +2 -1
  64. package/dist/core/compliance.js +3 -1
  65. package/dist/core/credential-vocabulary.d.ts +33 -8
  66. package/dist/core/credential-vocabulary.js +32 -7
  67. package/dist/core/decision-receipt.d.ts +2 -2
  68. package/dist/core/delegation-frames.d.ts +9 -2
  69. package/dist/core/delegation-name.d.ts +18 -0
  70. package/dist/core/delegation-name.js +47 -0
  71. package/dist/core/effective-path-target.d.ts +25 -6
  72. package/dist/core/effective-path-target.js +24 -2
  73. package/dist/core/engine-capabilities.d.ts +8 -1
  74. package/dist/core/engine-capabilities.js +1 -1
  75. package/dist/core/engine-notice.d.ts +49 -21
  76. package/dist/core/frontmatter-fence.d.ts +10 -0
  77. package/dist/core/frontmatter-fence.js +6 -0
  78. package/dist/core/gate-fold.js +8 -25
  79. package/dist/core/gate-lanes.js +358 -274
  80. package/dist/core/gate-outcome.d.ts +11 -6
  81. package/dist/core/governance-codes.d.ts +11 -4
  82. package/dist/core/governance-codes.js +12 -3
  83. package/dist/core/hands-band-screen.d.ts +7 -0
  84. package/dist/core/hands-band-screen.js +32 -0
  85. package/dist/core/hooks.d.ts +283 -739
  86. package/dist/core/hooks.js +100 -193
  87. package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
  88. package/dist/{tools/fs → core}/image-admission.js +24 -6
  89. package/dist/core/locked-config.d.ts +84 -32
  90. package/dist/core/locked-config.js +128 -42
  91. package/dist/core/mcp-connection-pool.d.ts +4 -1
  92. package/dist/core/mcp-connection-pool.js +7 -2
  93. package/dist/core/mcp-probe.d.ts +12 -9
  94. package/dist/core/mcp-probe.js +3 -3
  95. package/dist/core/mcp-server-spec.d.ts +104 -10
  96. package/dist/core/mcp-server-spec.js +183 -33
  97. package/dist/core/mcp.d.ts +31 -20
  98. package/dist/core/mcp.js +66 -56
  99. package/dist/core/memory-engine/data-plane.js +5 -1
  100. package/dist/core/memory-engine/distiller.js +16 -2
  101. package/dist/core/memory-engine/engine.d.ts +22 -30
  102. package/dist/core/memory-engine/engine.js +16 -10
  103. package/dist/core/memory-engine/frontmatter.d.ts +6 -0
  104. package/dist/core/memory-engine/frontmatter.js +19 -16
  105. package/dist/core/memory.d.ts +2 -2
  106. package/dist/core/mode-policy.d.ts +5 -16
  107. package/dist/core/mode-policy.js +7 -19
  108. package/dist/core/model-seat.d.ts +4 -1
  109. package/dist/core/mods/dollar.d.ts +109 -0
  110. package/dist/core/mods/dollar.js +154 -0
  111. package/dist/core/mods/host.d.ts +23 -0
  112. package/dist/core/mods/host.js +21 -0
  113. package/dist/core/mods/kernel/budget.d.ts +43 -0
  114. package/dist/core/mods/kernel/budget.js +83 -0
  115. package/dist/core/mods/kernel/dispatch.d.ts +100 -0
  116. package/dist/core/mods/kernel/dispatch.js +699 -0
  117. package/dist/core/mods/kernel/events.d.ts +245 -0
  118. package/dist/core/mods/kernel/events.js +210 -0
  119. package/dist/core/mods/kernel/index.d.ts +6 -0
  120. package/dist/core/mods/kernel/index.js +5 -0
  121. package/dist/core/mods/kernel/receive.d.ts +94 -0
  122. package/dist/core/mods/kernel/receive.js +188 -0
  123. package/dist/core/mods/kernel/registration.d.ts +131 -0
  124. package/dist/core/mods/kernel/registration.js +102 -0
  125. package/dist/core/mods/kernel/site-rules.d.ts +149 -0
  126. package/dist/core/mods/kernel/site-rules.js +296 -0
  127. package/dist/core/mods/stations.d.ts +344 -0
  128. package/dist/core/mods/stations.js +437 -0
  129. package/dist/core/mounted-mcp.d.ts +57 -0
  130. package/dist/core/mounted-mcp.js +71 -2
  131. package/dist/core/own-property-receipt.d.ts +13 -0
  132. package/dist/core/own-property-receipt.js +13 -23
  133. package/dist/core/parent-spec-seat.d.ts +18 -7
  134. package/dist/core/parent-spec-seat.js +6 -2
  135. package/dist/core/path-identity.js +2 -1
  136. package/dist/core/permission-rule-model.d.ts +58 -9
  137. package/dist/core/permission-rule-model.js +81 -7
  138. package/dist/core/permission-rule-org.d.ts +163 -33
  139. package/dist/core/permission-rule-org.js +205 -71
  140. package/dist/core/permission-rule-syntax.d.ts +15 -0
  141. package/dist/core/permission-rule-syntax.js +24 -16
  142. package/dist/core/permission-rules.d.ts +14 -2
  143. package/dist/core/permission-rules.js +63 -23
  144. package/dist/core/prompt-section-seat.d.ts +15 -27
  145. package/dist/core/prompt-section-seat.js +73 -40
  146. package/dist/core/protocol-http-auth.d.ts +3 -1
  147. package/dist/core/protocol-http-auth.js +2 -0
  148. package/dist/core/reminder-mint.d.ts +2 -2
  149. package/dist/core/remote-env.d.ts +24 -12
  150. package/dist/core/remote-env.js +1 -0
  151. package/dist/core/resume-startup-cause.d.ts +16 -1
  152. package/dist/core/resume-startup-cause.js +4 -1
  153. package/dist/core/retention.js +7 -2
  154. package/dist/core/retired-keys.d.ts +12 -2
  155. package/dist/core/retired-keys.js +15 -1
  156. package/dist/core/roles.js +60 -10
  157. package/dist/core/rule-lane-reads.js +1 -1
  158. package/dist/core/runner/announce-once-ledger.d.ts +31 -1
  159. package/dist/core/runner/announce-once-ledger.js +22 -0
  160. package/dist/core/runner/assemble-result.d.ts +9 -0
  161. package/dist/core/runner/assemble-result.js +3 -1
  162. package/dist/core/runner/call-hook-stations.d.ts +23 -27
  163. package/dist/core/runner/call-hook-stations.js +58 -42
  164. package/dist/core/runner/caller-stop-gate.d.ts +25 -0
  165. package/dist/core/runner/caller-stop-gate.js +7 -0
  166. package/dist/core/runner/compaction-seams.d.ts +8 -22
  167. package/dist/core/runner/compaction-seams.js +28 -53
  168. package/dist/core/runner/construction-doors.js +11 -1
  169. package/dist/core/runner/contracts.d.ts +86 -83
  170. package/dist/core/runner/credential-origin-seat.d.ts +2 -0
  171. package/dist/core/runner/credential-origin-seat.js +19 -0
  172. package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
  173. package/dist/core/runner/gate-exit.d.ts +47 -36
  174. package/dist/core/runner/gate-exit.js +12 -5
  175. package/dist/core/runner/image.js +1 -2
  176. package/dist/core/runner/inline-image.js +1 -1
  177. package/dist/core/runner/mcp-redial.d.ts +52 -10
  178. package/dist/core/runner/mcp-redial.js +38 -9
  179. package/dist/core/runner/notice-seat-input.d.ts +11 -0
  180. package/dist/core/runner/notice-seat-input.js +1 -0
  181. package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
  182. package/dist/core/runner/permission-rule-lanes.js +22 -10
  183. package/dist/core/runner/person-path-rows.d.ts +3 -1
  184. package/dist/core/runner/person-path-rows.js +3 -2
  185. package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
  186. package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
  187. package/dist/core/runner/prepare-ask-lane.js +6 -15
  188. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
  189. package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
  190. package/dist/core/runner/prepare-config-doors.d.ts +52 -1
  191. package/dist/core/runner/prepare-config-doors.js +168 -143
  192. package/dist/core/runner/prepare-defer-classify.js +7 -11
  193. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  194. package/dist/core/runner/prepare-delegation-surface.js +7 -5
  195. package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
  196. package/dist/core/runner/prepare-gate-stations.js +11 -10
  197. package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
  198. package/dist/core/runner/prepare-hands-readface.js +2 -1
  199. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
  200. package/dist/core/runner/prepare-inherited-gate.js +10 -23
  201. package/dist/core/runner/prepare-listings.d.ts +1 -1
  202. package/dist/core/runner/prepare-listings.js +4 -2
  203. package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
  204. package/dist/core/runner/prepare-memory-engine-session.js +20 -7
  205. package/dist/core/runner/prepare-memory.d.ts +3 -2
  206. package/dist/core/runner/prepare-memory.js +6 -2
  207. package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
  208. package/dist/core/runner/prepare-offload-wrappers.js +2 -1
  209. package/dist/core/runner/prepare-park-ask.js +10 -14
  210. package/dist/core/runner/prepare-policy-chain.d.ts +17 -15
  211. package/dist/core/runner/prepare-policy-chain.js +104 -109
  212. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  213. package/dist/core/runner/prepare-project-context.js +11 -12
  214. package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
  215. package/dist/core/runner/prepare-prompt-assembly.js +138 -101
  216. package/dist/core/runner/prepare-prompt-inputs.d.ts +28 -23
  217. package/dist/core/runner/prepare-prompt-inputs.js +11 -10
  218. package/dist/core/runner/prepare-protocol-tools.d.ts +11 -7
  219. package/dist/core/runner/prepare-protocol-tools.js +20 -13
  220. package/dist/core/runner/prepare-question-face.d.ts +4 -2
  221. package/dist/core/runner/prepare-question-face.js +4 -3
  222. package/dist/core/runner/prepare-safety-scan.js +6 -10
  223. package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
  224. package/dist/core/runner/prepare-suspend-saga.js +7 -5
  225. package/dist/core/runner/prepare-task.js +41 -23
  226. package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
  227. package/dist/core/runner/prepare-turn-wiring.js +29 -27
  228. package/dist/core/runner/prepare-wiring-manifest.d.ts +13 -9
  229. package/dist/core/runner/prepare-wiring-manifest.js +14 -11
  230. package/dist/core/runner/resume-admission.d.ts +4 -1
  231. package/dist/core/runner/resume-admission.js +7 -5
  232. package/dist/core/runner/resume-apply.d.ts +5 -2
  233. package/dist/core/runner/resume-apply.js +24 -42
  234. package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
  235. package/dist/core/runner/resume-checkpoint-screen.js +9 -1
  236. package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
  237. package/dist/core/runner/resume-internals-and-config.js +3 -8
  238. package/dist/core/runner/resume-preflight.js +38 -16
  239. package/dist/core/runner/retired-runner-deps.d.ts +5 -6
  240. package/dist/core/runner/retired-runner-deps.js +4 -5
  241. package/dist/core/runner/run-brain-sinks.d.ts +3 -2
  242. package/dist/core/runner/run-brain-sinks.js +5 -1
  243. package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
  244. package/dist/core/runner/run-compaction-machinery.js +7 -33
  245. package/dist/core/runner/run-harness-handlers.js +4 -2
  246. package/dist/core/runner/run-identity-wiring.d.ts +3 -1
  247. package/dist/core/runner/run-identity-wiring.js +3 -2
  248. package/dist/core/runner/run-leg.js +103 -95
  249. package/dist/core/runner/run-notification-lane.js +1 -0
  250. package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
  251. package/dist/core/runner/run-recovery-lanes.js +14 -11
  252. package/dist/core/runner/run-settle-and-teardown.js +9 -28
  253. package/dist/core/runner/run-stop-and-final-verify.js +18 -25
  254. package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
  255. package/dist/core/runner/run-terminal-adoption.js +34 -22
  256. package/dist/core/runner/run-tool-mount-facts.js +5 -3
  257. package/dist/core/runner/run-turn-boundary.js +32 -37
  258. package/dist/core/runner/runtask.d.ts +6 -7
  259. package/dist/core/runner/runtask.js +15 -73
  260. package/dist/core/runner/session-rule-policy.d.ts +5 -5
  261. package/dist/core/runner/session-rule-policy.js +13 -8
  262. package/dist/core/runner/side-call-account.d.ts +68 -0
  263. package/dist/core/runner/side-call-account.js +61 -0
  264. package/dist/core/runner/skills-seat.d.ts +15 -0
  265. package/dist/core/runner/skills-seat.js +57 -0
  266. package/dist/core/runner/stream-halt-verbs.js +12 -17
  267. package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
  268. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  269. package/dist/core/runner/stream-steer-verb.js +20 -38
  270. package/dist/core/runner/sub-agent-deny-lists.d.ts +124 -23
  271. package/dist/core/runner/sub-agent-deny-lists.js +230 -71
  272. package/dist/core/runner/synthetic-tools.d.ts +5 -2
  273. package/dist/core/runner/synthetic-tools.js +2 -12
  274. package/dist/core/runner/tool-end-body.d.ts +5 -6
  275. package/dist/core/runner/tool-end-body.js +6 -4
  276. package/dist/core/runner/tool-not-executed.d.ts +15 -0
  277. package/dist/core/runner/tool-not-executed.js +30 -0
  278. package/dist/core/runner/tool-occurrence.d.ts +8 -7
  279. package/dist/core/runner/tool-occurrence.js +5 -5
  280. package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
  281. package/dist/core/runner-deps.d.ts +43 -36
  282. package/dist/core/safety-merge-corpus.js +18 -2
  283. package/dist/core/secret-env.d.ts +88 -20
  284. package/dist/core/secret-env.js +192 -38
  285. package/dist/core/session-policy-store.d.ts +71 -16
  286. package/dist/core/session-policy-store.js +138 -28
  287. package/dist/core/session-reconcile.d.ts +4 -0
  288. package/dist/core/session-reconcile.js +2 -1
  289. package/dist/core/shell-read-silence.js +3 -32
  290. package/dist/core/side-query.d.ts +5 -3
  291. package/dist/core/skill-grant.d.ts +3 -2
  292. package/dist/core/skill-grant.js +17 -9
  293. package/dist/core/skills-directory.d.ts +31 -11
  294. package/dist/core/skills-directory.js +655 -104
  295. package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
  296. package/dist/core/task-event.d.ts +49 -3
  297. package/dist/core/task-notification.js +2 -2
  298. package/dist/core/task-result.d.ts +8 -0
  299. package/dist/core/task-spec.d.ts +20 -19
  300. package/dist/core/task-stream.d.ts +14 -4
  301. package/dist/core/tighten-task-spec.d.ts +4 -3
  302. package/dist/core/tighten-task-spec.js +2 -4
  303. package/dist/core/tool-check-reading.d.ts +74 -0
  304. package/dist/core/tool-check-reading.js +80 -0
  305. package/dist/core/tool-policy.d.ts +62 -18
  306. package/dist/core/tool-policy.js +86 -15
  307. package/dist/core/tool-registry.d.ts +20 -0
  308. package/dist/core/tool-registry.js +4 -0
  309. package/dist/core/tool-spec.d.ts +10 -6
  310. package/dist/core/tools.js +2 -0
  311. package/dist/core/trace.d.ts +51 -32
  312. package/dist/core/types.d.ts +2 -2
  313. package/dist/core/types.js +1 -1
  314. package/dist/core/unc-spelling.d.ts +10 -0
  315. package/dist/core/unc-spelling.js +3 -0
  316. package/dist/core/untrusted-egress.d.ts +8 -0
  317. package/dist/core/untrusted-egress.js +4 -1
  318. package/dist/core/untrusted-text.d.ts +16 -0
  319. package/dist/core/untrusted-text.js +7 -2
  320. package/dist/core/user-attachment.d.ts +25 -4
  321. package/dist/core/user-attachment.js +63 -42
  322. package/dist/core/wiring-manifest.d.ts +18 -15
  323. package/dist/core/wiring-manifest.js +2 -2
  324. package/dist/engine/compaction/utils.js +1 -2
  325. package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
  326. package/dist/engine/execution-env/symlink-chain.js +1 -1
  327. package/dist/engine/harness/agent-harness.d.ts +1 -1
  328. package/dist/engine/harness/agent-harness.js +5 -4
  329. package/dist/engine/harness/types.d.ts +20 -16
  330. package/dist/engine/harness/types.js +7 -1
  331. package/dist/engine/llm/types.d.ts +12 -7
  332. package/dist/engine/loop/agent-loop.d.ts +12 -1
  333. package/dist/engine/loop/agent-loop.js +18 -6
  334. package/dist/engine/loop/types.d.ts +8 -2
  335. package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
  336. package/dist/engine/session/import-validate.js +3 -10
  337. package/dist/engine/session/session.d.ts +4 -4
  338. package/dist/engine/session/session.js +4 -4
  339. package/dist/index.d.ts +33 -23
  340. package/dist/index.js +23 -15
  341. package/dist/internal/harness.d.ts +2 -1
  342. package/dist/internal/harness.js +2 -1
  343. package/dist/orchestration/goal.d.ts +24 -1
  344. package/dist/orchestration/goal.js +3 -2
  345. package/dist/orchestration/run-spec.d.ts +4 -6
  346. package/dist/orchestration/run-spec.js +39 -63
  347. package/dist/orchestration/run-workflow-tool.js +1 -2
  348. package/dist/orchestration/workflow.d.ts +11 -3
  349. package/dist/orchestration/workflow.js +11 -2
  350. package/dist/prompt-assembly/artifact-store.d.ts +72 -56
  351. package/dist/prompt-assembly/artifact-store.js +60 -52
  352. package/dist/prompt-assembly/artifact.d.ts +90 -76
  353. package/dist/prompt-assembly/artifact.js +197 -145
  354. package/dist/prompt-assembly/assemble.d.ts +36 -29
  355. package/dist/prompt-assembly/assemble.js +34 -220
  356. package/dist/prompt-assembly/bands.d.ts +20 -0
  357. package/dist/prompt-assembly/bands.js +18 -0
  358. package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
  359. package/dist/prompt-assembly/catalog/constitution.js +69 -0
  360. package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
  361. package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
  362. package/dist/prompt-assembly/catalog/index.d.ts +11 -0
  363. package/dist/prompt-assembly/catalog/index.js +60 -0
  364. package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
  365. package/dist/prompt-assembly/catalog/memory.js +6 -0
  366. package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
  367. package/dist/prompt-assembly/catalog/modes.js +137 -0
  368. package/dist/prompt-assembly/catalog/role.d.ts +10 -0
  369. package/dist/prompt-assembly/catalog/role.js +157 -0
  370. package/dist/prompt-assembly/catalog/schema.d.ts +138 -0
  371. package/dist/prompt-assembly/catalog/schema.js +25 -0
  372. package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
  373. package/dist/prompt-assembly/catalog/sections.js +98 -0
  374. package/dist/prompt-assembly/catalog/team.d.ts +4 -0
  375. package/dist/prompt-assembly/catalog/team.js +258 -0
  376. package/dist/prompt-assembly/composer.d.ts +26 -28
  377. package/dist/prompt-assembly/composer.js +124 -46
  378. package/dist/prompt-assembly/epoch.d.ts +89 -79
  379. package/dist/prompt-assembly/epoch.js +115 -142
  380. package/dist/prompt-assembly/explain.d.ts +58 -34
  381. package/dist/prompt-assembly/explain.js +21 -24
  382. package/dist/prompt-assembly/overlay.d.ts +137 -0
  383. package/dist/prompt-assembly/overlay.js +339 -0
  384. package/dist/prompt-assembly/renderers.d.ts +21 -0
  385. package/dist/prompt-assembly/renderers.js +39 -0
  386. package/dist/prompt-assembly/section-usage.d.ts +3 -3
  387. package/dist/prompt-assembly/section-usage.js +1 -1
  388. package/dist/prompt-assembly/select.d.ts +71 -0
  389. package/dist/prompt-assembly/select.js +106 -0
  390. package/dist/prompt-assembly/sugar.d.ts +31 -0
  391. package/dist/prompt-assembly/sugar.js +20 -0
  392. package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
  393. package/dist/prompt-assembly/types.d.ts +45 -148
  394. package/dist/prompts/coordinator.d.ts +2 -21
  395. package/dist/prompts/coordinator.js +3 -255
  396. package/dist/prompts/cowork.d.ts +27 -16
  397. package/dist/prompts/cowork.js +2 -23
  398. package/dist/prompts/default.d.ts +38 -511
  399. package/dist/prompts/default.js +20 -288
  400. package/dist/prompts/supervisor.d.ts +6 -71
  401. package/dist/prompts/supervisor.js +6 -117
  402. package/dist/stores/file/permission-rule-store.d.ts +1 -1
  403. package/dist/stores/file/permission-rule-store.js +2 -1
  404. package/dist/tools/artifact/artifact-tool.js +4 -3
  405. package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
  406. package/dist/tools/fs/dir-entries.d.ts +4 -2
  407. package/dist/tools/fs/dir-entries.js +16 -4
  408. package/dist/tools/fs/fs-bash.d.ts +1 -1
  409. package/dist/tools/fs/fs-bash.js +22 -11
  410. package/dist/tools/fs/fs-pdf.js +17 -13
  411. package/dist/tools/fs/fs-read.js +4 -3
  412. package/dist/tools/fs/fs-shared.d.ts +1 -10
  413. package/dist/tools/fs/fs-shared.js +3 -4
  414. package/dist/tools/fs/fs-write.js +2 -1
  415. package/dist/tools/fs/notebook.js +1 -1
  416. package/dist/tools/fs/pdf.d.ts +20 -10
  417. package/dist/tools/fs/pdf.js +19 -10
  418. package/dist/tools/fs/program-read-model.d.ts +68 -8
  419. package/dist/tools/fs/program-read-model.js +112 -33
  420. package/dist/tools/fs/program-read-model.rows.js +30 -10
  421. package/dist/tools/fs/read-deny-home.d.ts +25 -9
  422. package/dist/tools/fs/read-deny-home.js +28 -27
  423. package/dist/tools/fs/read-deny.d.ts +41 -11
  424. package/dist/tools/fs/read-deny.js +51 -5
  425. package/dist/tools/fs/safety.d.ts +4 -26
  426. package/dist/tools/fs/safety.js +10 -32
  427. package/dist/tools/fs/search.js +15 -10
  428. package/dist/tools/fs/shell-read-argv.d.ts +3 -2
  429. package/dist/tools/fs/shell-read-argv.js +118 -38
  430. package/dist/tools/fs/shell-read-establish.d.ts +5 -5
  431. package/dist/tools/fs/shell-read-establish.js +11 -61
  432. package/dist/tools/fs/shell-read-identity.js +6 -3
  433. package/dist/tools/fs/shell-read-judge.d.ts +13 -15
  434. package/dist/tools/fs/shell-read-judge.js +18 -4
  435. package/dist/tools/fs/shell-read-plan.d.ts +2 -2
  436. package/dist/tools/web.js +1 -1
  437. package/package.json +13 -1
  438. package/test/export-surface.snapshot.json +306 -103
  439. package/wire-changes/core@7.52.0.json +5859 -0
  440. package/wire-changes/core@7.53.0.json +1946 -0
  441. package/dist/core/hook-seats.d.ts +0 -66
  442. package/dist/core/hook-seats.js +0 -37
  443. package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
  444. package/dist/prompt-assembly/packs/sema-default.js +0 -147
  445. package/dist/prompts/simple-sections.d.ts +0 -58
  446. package/dist/prompts/simple-sections.js +0 -43
@@ -17,7 +17,7 @@ import type { GateOutcome } from "../gate-outcome.js";
17
17
  import type { TaskEvent, TaskEventIdentity } from "../types.js";
18
18
  import type { OccurrenceStart, ToolOccurrenceTable } from "./tool-occurrence.js";
19
19
  import { type McpDelivered } from "../mcp-failure.js";
20
- import type { RecoveredOrphan } from "../session-reconcile.js";
20
+ import { type RecoveredOrphan } from "../session-reconcile.js";
21
21
  import { type StructuredProjector } from "./tool-output-projection.js";
22
22
  import type { WriteFamily } from "./turn-attachments.js";
23
23
  /** Derive the thin `response` digest from a harness tool result: model-facing text
@@ -77,16 +77,15 @@ export interface OccurrenceEnd {
77
77
  /** The harness result (or the exact text the closing station records). */
78
78
  result: unknown;
79
79
  isError: boolean;
80
- /** POSITIVE evidence the call never executed — the loop's own mark on a call it closed without running it, or the
81
- * reconcile's never-started class. Absent = no such evidence, never "it ran" (see `tool_end.notExecuted`). */
80
+ /** The CLOSING STATION's own POSITIVE evidence the call never executed — the loop's mark (a halted sibling may well have been let go by the gate) or the reconcile's never-started class; the engine's refusal is read off the occurrence. Absent = no such evidence, never "it ran". */
82
81
  notExecuted?: true;
83
82
  /** The call is closed by an interruption rather than a result of its own. */
84
83
  interrupted?: true;
85
84
  /** See {@link toolEndBodyFrom}'s parameter of the same name. */
86
85
  gatedCallIdOfRun?: string;
87
86
  }
88
- /** What the end projection decided, for the readers that ride beside the frame (the trace row, the row's record). */
89
- export interface SettledOccurrence {
87
+ /** What the end projection decided, for the readers that ride beside the frame (the trace row, the row's record, the rows' `notExecuted`). */
88
+ export interface SettledOccurrence extends Pick<OccurrenceEnd, "notExecuted"> {
90
89
  /** The latest gate record — the call's disposition (absent when no gate exit saw it). */
91
90
  gate?: GateOutcome;
92
91
  /** The tool's own error bit, or a refusal recorded after the gate: the engine's record wins over the tool's word. */
@@ -96,7 +95,7 @@ export interface SettledOccurrence {
96
95
  * The END projection — the ONE mint of `tool_end`, for every station that closes a call: the live loop's
97
96
  * `tool_execution_end`, the resumed leg's resolution, an interrupted run's reconcile and the reconcile replayed at
98
97
  * the next process start. It reads the occurrence and nothing else: `gate` is its latest gate record, `isError` is
99
- * the tool's bit or the refusal that record names, and `notExecuted` rides only on the station's positive evidence.
98
+ * the tool's bit or the refusal that record names, and `notExecuted` rides on positive evidence only: the station's own or `refusedBeforeRelease` (returned for the rows).
100
99
  *
101
100
  * A call whose start never went out on this stream (a call the loop never reached, a call announced by a dead
102
101
  * process) gets its start minted here first, marked `recovered` and carrying the input the closing station holds —
@@ -1,6 +1,8 @@
1
1
  import {} from "../../internal/harness.js";
2
2
  import { readMember } from "../thrown-value.js";
3
+ import { refusedBeforeRelease } from "./tool-not-executed.js";
3
4
  import { MCP_DELIVERY_VERDICTS } from "../mcp-failure.js";
5
+ import { closeNeverExecuted } from "../session-reconcile.js";
4
6
  import { TOOL_SEARCH_NAME } from "./tool-disclosure.js";
5
7
  import { toolOutputFrom } from "./tool-output-projection.js";
6
8
  import { TASK_CREATE_TOOL_NAME, TASK_UPDATE_TOOL_NAME, TODO_WRITE_TOOL_NAME } from "../tool-catalog-entries.js";
@@ -63,7 +65,7 @@ export function emitSettled(table, start, end, frames) {
63
65
  if (!occ.startEmitted)
64
66
  frames.push(startFrameOf(occ, true));
65
67
  const gate = occ.gateRounds.at(-1);
66
- const isError = end.isError || gate?.disposition.kind === "denied";
68
+ const isError = end.isError || gate?.disposition.kind === "denied", notExecuted = end.notExecuted === true || refusedBeforeRelease(occ);
67
69
  table.close(occ.toolCallId, end.interrupted === true ? "interrupted" : "settled");
68
70
  frames.push({
69
71
  type: "tool_end",
@@ -73,12 +75,12 @@ export function emitSettled(table, start, end, frames) {
73
75
  isError,
74
76
  ...toolEndBodyFrom(end.result, isError, frames, gate, end.gatedCallIdOfRun),
75
77
  ...(gate?.disposition.kind === "denied" && occ.wireName !== undefined ? { wireName: occ.wireName } : {}),
76
- ...(end.notExecuted === true ? { notExecuted: true } : {}),
78
+ ...(notExecuted ? { notExecuted: true } : {}),
77
79
  });
78
- return { ...(gate !== undefined ? { gate } : {}), isError };
80
+ return { ...(gate !== undefined ? { gate } : {}), isError, ...(notExecuted ? { notExecuted: true } : {}) };
79
81
  }
80
82
  export function reconciledEnd(orphan) {
81
- return { result: { content: orphan.text, details: { code: orphan.errorKind } }, isError: true, interrupted: true, ...(orphan.errorKind === "interrupted_never_started" ? { notExecuted: true } : {}) };
83
+ return { result: { content: orphan.text, details: { code: orphan.errorKind } }, isError: true, interrupted: true, ...(closeNeverExecuted(orphan.errorKind) ? { notExecuted: true } : {}) };
82
84
  }
83
85
  export function writeFamilyOfCanonical(name) {
84
86
  if (name === TASK_CREATE_TOOL_NAME || name === TASK_UPDATE_TOOL_NAME)
@@ -0,0 +1,15 @@
1
+ import type { ToolOccurrence } from "./tool-occurrence.js";
2
+ /** The engine's own judgment refused this call and it was never let go to an executor: the latest gate record is a
3
+ * refusal and the life never left `announced` — positive evidence the call did not run (a refusal recorded AFTER the
4
+ * release, by a station inside the execution, is not). A call whose start this stream never carried (a recovered
5
+ * one, closed by a station that knows only its own class) is not read here. */
6
+ export declare function refusedBeforeRelease(occ: Pick<ToolOccurrence, "life" | "gateRounds" | "startEmitted">): boolean;
7
+ /** `details` as a persisted `toolResult` row carries it: `notExecuted` is the ENGINE's key — the settlement's fact when it holds,
8
+ * absent otherwise, whatever a tool wrote under that name. Returns `details` itself unless the key has to move; never mutates it. */
9
+ export declare function rowDetailsOf(details: unknown, notExecuted: boolean): unknown;
10
+ /** A row the resumed leg mints (`toolResultMsg`) with the settlement's fact on it. */
11
+ export declare function withRowNotExecuted<T extends object>(row: T, notExecuted: boolean): T;
12
+ /** Write the end projection's one `notExecuted` onto the result the live loop persists as the call's row: the loop builds that message
13
+ * from this very result right after the end event. The frame's card was projected from the previous `details` first and keeps its
14
+ * members (a row mark is never part of a card). `Reflect.set`: a result that refuses the write keeps its row as it was. */
15
+ export declare function stampRowNotExecuted(result: unknown, notExecuted: boolean): void;
@@ -0,0 +1,30 @@
1
+ import { readOwnMembers } from "../thrown-value.js";
2
+ export function refusedBeforeRelease(occ) {
3
+ return occ.life === "announced" && occ.startEmitted && occ.gateRounds.at(-1)?.disposition.kind === "denied";
4
+ }
5
+ export function rowDetailsOf(details, notExecuted) {
6
+ const carries = (() => { try {
7
+ return details !== null && typeof details === "object" && !Array.isArray(details) && Object.keys(details).includes("notExecuted");
8
+ }
9
+ catch {
10
+ return false;
11
+ } })();
12
+ if (!notExecuted && !carries)
13
+ return details;
14
+ const bag = { ...readOwnMembers(details) };
15
+ if (notExecuted)
16
+ bag["notExecuted"] = true;
17
+ else
18
+ delete bag["notExecuted"];
19
+ return bag;
20
+ }
21
+ export function withRowNotExecuted(row, notExecuted) {
22
+ return notExecuted ? { ...row, details: rowDetailsOf(undefined, true) } : row;
23
+ }
24
+ export function stampRowNotExecuted(result, notExecuted) {
25
+ if (result === null || typeof result !== "object")
26
+ return;
27
+ const next = rowDetailsOf(result.details, notExecuted);
28
+ if (next !== result.details)
29
+ Reflect.set(result, "details", next);
30
+ }
@@ -6,10 +6,11 @@
6
6
  * `tool_progress` heartbeat (`tool-progress-lane.ts`), the trace row's `ok`, and the resumed leg's
7
7
  * `executionOutcome` filing. The record has three parts:
8
8
  *
9
- * - the EXECUTION LIFE, monotonic: `announced` (the start frame is out) → `executing` (the engine started the
10
- * tool body itself — the resumed leg; on a live leg the loop starts the body and the runner does not observe
11
- * that moment, so a live call stays `announced`) → `settled` or `interrupted`. Leaving a terminal state is an
12
- * engine defect and throws;
9
+ * - the EXECUTION LIFE, monotonic: `announced` (the start frame is out) → `released` (the engine let the call go
10
+ * to its executor: the resumed leg right before it runs the tool body itself, a live leg at the gate's allow
11
+ * exit — the loop starts the body after it and the runner does not observe that moment) → `settled` or
12
+ * `interrupted`. A call that closes still `announced` was never let go: whatever the tool's body did, this call
13
+ * did not do it (`refusedBeforeRelease`, `tool-not-executed.ts`). Leaving a terminal state is an engine defect and throws;
13
14
  * - the WAIT ON A PERSON, re-entrant: every ask put to the person's seat for this call counts one entry and one
14
15
  * exit (several rounds of one gate pass, a confirmation asked during the execution) — a count, never a bit,
15
16
  * because the waits nest and overlap;
@@ -28,7 +29,7 @@ import type { DeniedBy, GateOutcome } from "../gate-outcome.js";
28
29
  * host without `performance` falls back to the wall clock and inherits its rollback behaviour. */
29
30
  export declare const occurrenceClock: () => number;
30
31
  /** Where a call's execution life stands — see the module header for the order. */
31
- export type OccurrenceLife = "announced" | "executing" | "settled" | "interrupted";
32
+ export type OccurrenceLife = "announced" | "released" | "settled" | "interrupted";
32
33
  /** What opens an occurrence: the facts its start frame carries. */
33
34
  export interface OccurrenceStart {
34
35
  readonly toolCallId: string;
@@ -78,8 +79,8 @@ export interface ToolOccurrenceTable {
78
79
  ensure(start: OccurrenceStart): ToolOccurrence;
79
80
  /** The call's start frame is out. */
80
81
  noteStartEmitted(toolCallId: string): void;
81
- /** The engine starts the tool body. */
82
- execute(toolCallId: string): void;
82
+ /** The engine lets the call go to its executor — the one transition into `released`, whichever leg makes it. */
83
+ release(toolCallId: string): void;
83
84
  /** A gate exit for this call: its record and the input it decided on (frozen by the gate's exit). */
84
85
  gateRound(toolCallId: string, outcome: GateOutcome, finalInput?: unknown): void;
85
86
  /** A station after the gate refused the call: one more gate record, minted as a veto of whatever the latest one
@@ -1,6 +1,6 @@
1
1
  import { mintGateOutcome } from "./gate-exit.js";
2
2
  export const occurrenceClock = () => (typeof performance !== "undefined" ? performance.now() : Date.now());
3
- const TERMINAL = { announced: false, executing: false, settled: true, interrupted: true };
3
+ const TERMINAL = { announced: false, released: false, settled: true, interrupted: true };
4
4
  export function createToolOccurrenceTable() {
5
5
  const byId = new Map();
6
6
  const attempts = new Map();
@@ -77,11 +77,11 @@ export function createToolOccurrenceTable() {
77
77
  noteStartEmitted(toolCallId) {
78
78
  held(toolCallId, "a start frame").startEmitted = true;
79
79
  },
80
- execute(toolCallId) {
81
- const occ = held(toolCallId, "execute");
80
+ release(toolCallId) {
81
+ const occ = held(toolCallId, "release");
82
82
  if (occ.life !== "announced")
83
- throw new Error(`tool occurrence: call "${toolCallId}" (attempt ${occ.attempt}) cannot start executing from "${occ.life}"`);
84
- occ.life = "executing";
83
+ throw new Error(`tool occurrence: call "${toolCallId}" (attempt ${occ.attempt}) cannot be released from "${occ.life}"`);
84
+ occ.life = "released";
85
85
  },
86
86
  gateRound(toolCallId, outcome, finalInput) {
87
87
  const occ = held(toolCallId, "a gate round");
@@ -6,7 +6,7 @@
6
6
  * closed-set words, counts, the call's identity and a media type only when it can be one — never the bytes.
7
7
  */
8
8
  import { type EngineNotice } from "../engine-notice.js";
9
- import type { ToolResultMediaRefusal } from "../../tools/fs/image-admission.js";
9
+ import type { ToolResultMediaRefusal } from "../image-admission.js";
10
10
  /** The run's attribution pair, as every per-run notice carries it. */
11
11
  export interface ToolResultMediaSeatIds {
12
12
  sessionId: string;
@@ -159,12 +159,14 @@ export interface RunnerDeps {
159
159
  */
160
160
  rosterStore?: import("../agents/roster-store.js").RosterStore;
161
161
  /**
162
- * design/148 S1 — the center prompt-artifact source (protocol §9.2). `current()` supplies the
163
- * validated candidate NEW sessions adopt at session_start; `get(digest)` resolves a PINNED
164
- * center artifact on resume (a miss is fail-loud `prompt.snapshot_unavailable` — core never
165
- * recomposes a hybrid from same-named newer content). Core bundles `CenterPromptSource`
166
- * (+ memory/file artifact & source-state stores); a server deployment feeds it verified
167
- * effective-snapshot envelopes via `applySnapshot`. Omitted = bundled-only (today's shape).
162
+ * The center prompt-artifact source (artifact v3 only — a v2 body is refused `schema`, INTEGRATION-CORE §12.11).
163
+ * `current()` supplies the verified
164
+ * candidate a top-level session adopts at session start and at a compaction; `get(digest)` resolves a PINNED center
165
+ * layer on resume (a miss is fail-loud `prompt.snapshot_unavailable` — core never recomposes a hybrid from newer
166
+ * content; a copy the engine refuses is told apart from a missing one, in the failure's sentence and on `onError`);
167
+ * `sourceState()` is the tri-state every adoption decision keys on. What a source hands a run is re-checked
168
+ * before it is adopted. Core bundles `CenterPromptSource` (+ memory/file artifact & source-state stores); a server
169
+ * feeds it published artifacts via `applySnapshot`. Omitted = no center layer.
168
170
  */
169
171
  promptSource?: import("../prompt-assembly/artifact-store.js").PromptArtifactSource;
170
172
  /**
@@ -518,7 +520,7 @@ export interface RunnerDeps {
518
520
  resumePreflight?: (info: ResumePreflightInfo, signal: AbortSignal) => Promise<ResumePreflightVerdict>;
519
521
  /**
520
522
  * design/380 O2 — the {@link resumePreflight} deadline in ms. Default 10s (its own bound,
521
- * deliberately NOT the hooks-record default: a resume preflight sits on every redeem attempt of a
523
+ * deliberately its own: a resume preflight sits on every redeem attempt of a
522
524
  * parked row and must answer promptly or get out of the way). Bad values (non-finite, ≤ 0,
523
525
  * non-number) are DISCLOSED loudly through `onError` and fall back to the default (the bad-value
524
526
  * loudness default: announce, never silently absorb).
@@ -961,6 +963,19 @@ export interface RunnerDeps {
961
963
  * everywhere (mode parity, the CC default). Inert without {@link peerDirectory}.
962
964
  */
963
965
  crossSessionInbound?: import("../agents/cross-session-judge.js").CrossSessionInboundSettingLayers | (() => import("../agents/cross-session-judge.js").CrossSessionInboundSettingLayers);
966
+ /**
967
+ * WHO consumes this deployment's principal inbox (`principal.inbox`, where the
968
+ * organization's delivery gate appends cross-principal letters; the mailbox contract's fourth chain).
969
+ * Absent = no consumer, no lane (byte for byte as before); a deployment that mounts a gate DECLARES
970
+ * `{ assistant: "<agent handle>" }` (the scope's assistant is the only consumer; no terminal leg touches the
971
+ * box). `"terminals"` (each terminal drains the box as a second lane) is refused until held decisions are
972
+ * shared across terminals (`detail.reason: "terminals_unsupported"`). Letters are judged on the principal's
973
+ * `crossSessionInbound` layers (managed, user), held when unset. ANY other value fails the prepare of a leg
974
+ * that drains a session box with `config.principal_inbox_consumer_invalid` (`detail.reason: "malformed"`).
975
+ */
976
+ principalInboxConsumer?: "terminals" | {
977
+ assistant: string;
978
+ };
964
979
  /**
965
980
  * design/385 §4.4 (slice 4) — this deployment's `dialogExpiry` (CC settings key, verbatim vocabulary
966
981
  * `"60s" | "5m" | "10m" | "never"`, default `"5m"`): how long a HELD cross-session message whose cause
@@ -1117,7 +1132,7 @@ export interface RunnerDeps {
1117
1132
  * CLAUDE.md/git injection — the cure for "say hi → only greets"). The deployment/profile owns the CONTENT
1118
1133
  * (read CLAUDE.md / `.claude/` + fold in `git log -5`/status + a byte budget); core owns the seam + fence +
1119
1134
  * cache placement and NEVER hardcodes a filename (same trust posture as {@link executionEnvFactory}/
1120
- * {@link promptProvider}/{@link modelKnowledgeCutoffs}). A RunnerDeps FUNCTION, not a `TaskSpec` field: it is
1135
+ * {@link mods}/{@link modelKnowledgeCutoffs}). A RunnerDeps FUNCTION, not a `TaskSpec` field: it is
1121
1136
  * unserializable (durable resume) and reading files for an UNTRUSTED caller would be a confused-deputy hole
1122
1137
  * (design/44 §7 Q4). DECOUPLED from `memoryStore` — injects even with NO long-term memory configured (H5).
1123
1138
  *
@@ -1189,8 +1204,6 @@ export interface RunnerDeps {
1189
1204
  path: string;
1190
1205
  contentHash: string | null;
1191
1206
  }> | null>;
1192
- /** Override system-prompt assembly. Defaults to `defaultPromptProvider`. */
1193
- promptProvider?: import("../prompts/default.js").PromptProvider;
1194
1207
  /**
1195
1208
  * design/99 §E23 — the LIVE-ONLY inbound-elicitation seam (an MCP server asking the END USER for input
1196
1209
  * mid-tool-call). Wired ONLY for servers that opted in via {@link McpServerSpec.elicitation}; absent ⇒ core
@@ -1269,20 +1282,13 @@ export interface RunnerDeps {
1269
1282
  */
1270
1283
  artifactHost?: import("./artifact-host.js").ArtifactHost;
1271
1284
  /**
1272
- * Default in-process hooks for all tasks (design/37) — the FULL lifecycle seam of the `Hooks`
1273
- * interface, not just the tool-call trio: `preToolUse` (rewrite/restrict args + inject context),
1274
- * `postToolUse` (rewrite output + inject context), `userPromptSubmit` (design/373 §4.3: screens
1275
- * EVERY user-lane entrance — the objective, a live `TaskStream.steer`, a wake resume's message,
1276
- * and a parked steer's redelivery, discriminated by `ctx.source`; a hook that blocks
1277
- * unconditionally refuses steers/wakes too — see the ⚠️ WIDENED INVOCATION SET banner on
1278
- * {@link import("./hooks.js").Hooks.userPromptSubmit}), plus `stop` (push back when the run would otherwise end and continue
1279
- * it), `postToolUseFailure` / `postToolBatch` / `permissionDenied` (failure, batch-boundary and
1280
- * deny observers), `preCompact` / `postCompact` (compaction gate + observer), `stopFailure`
1281
- * (API-error terminal observer) and the `preToolUseObservational` declaration flag — each member's
1282
- * contract is documented on the `Hooks` interface itself. A task's own `hooks` overrides this. A
1283
- * PreToolUse hook's `allow` never bypasses `toolPolicy` — the policy is always the final say.
1284
- */
1285
- hooks?: import("./hooks.js").Hooks;
1285
+ * The deployment seat of the mods bus: extension registrations every task of this Runner carries (every leg — root,
1286
+ * delegated child, resume — admits them at its own prepare). Each declares its tier (`prepend`, `user` or `append`;
1287
+ * absent or another word refuses the prepare, `config.mods_invalid`). A task's own `TaskSpec.mods` run beside these,
1288
+ * never instead of them. A `classic.PreToolUse` handler's `allow` never bypasses `toolPolicy` — the policy is always
1289
+ * the final say.
1290
+ */
1291
+ mods?: readonly import("./mods/kernel/index.js").ModRegistration<import("./mods/dollar.js").EngineDollar>[];
1286
1292
  /**
1287
1293
  * Policy for remote image URLs (`TaskSpec.images[].url`). Return false to reject. When set it
1288
1294
  * **replaces** the built-in SSRF guard (https-only + private/reserved-host block) — e.g. supply a
@@ -1295,17 +1301,18 @@ export interface RunnerDeps {
1295
1301
  * summaries) is invisible without this and lets a session grow until it tops the window.
1296
1302
  * - `"prompt-cache"` — a prefix-cache hazard on the wire: a detected cache break (design/31), or a
1297
1303
  * mis-declared/mismatched `promptCacheFamily`. The prefix cache will miss. Log/alert on both.
1298
- * - `"prompt-constitution"` — a `stableSystem` provider returned an ALREADY-assembled prompt
1299
- * (constitution anchor found); core passed it through un-doubled. Upgrade the provider to return
1300
- * only the role base (or set `replaceAll: true` to own the whole base).
1301
- * - `"degraded"` — the task kept running with a capability quietly reduced: a question auto-answered
1302
- * with no human present, a skipped env git snapshot, a lost checkpoint-put confirmation, an
1303
- * unroutable descendant notification, and similar best-effort arms. The run proceeds; the reduced
1304
- * arm is what is being disclosed (`classification` names it).
1305
- * - `"config"` — a deployment-wiring problem detected while preparing or tearing down a task: tool
1306
- * mount conflicts, refused/ignored knob values, gate-off notices, store/env teardown legs. The
1307
- * broadest class by call-site count — most misconfigurations announce here rather than failing
1308
- * the task.
1304
+ * - `"prompt-constitution"` — a prompt overlay did not take effect as written: a later source (or a later declaration in the same source) superseded
1305
+ * it on the same target, its target was not in this run's prompt, or a mods handler's `prompt.compose` answer was skipped (it rewrote another's
1306
+ * overlay, or wrote what the band table does not grant its seat); each overlay is named once per run. The center prompt too: a pinned session's
1307
+ * stored artifact refused or unreadable (it fails `prompt.snapshot_unavailable`), a fresh session's candidate that does not verify, and a
1308
+ * `CenterPromptSource` boot restore with no usable copy (`sessionId: ""`, `classification: "center-source-restore"`) — that last line only when the
1309
+ * host passes this same sink to `CenterPromptSource` as its own `onError` (the source restores at boot, apart from any Runner; given none, it is silent).
1310
+ * - `"degraded"` — the task kept running with a capability quietly reduced: a question auto-answered with no human
1311
+ * present, a skipped env git snapshot, a lost checkpoint-put confirmation, an unroutable descendant notification, and
1312
+ * similar best-effort arms. The run proceeds; the reduced arm is what is being disclosed (`classification` names it).
1313
+ * - `"config"` — a deployment-wiring problem detected while preparing or tearing down a task: tool mount conflicts,
1314
+ * refused/ignored knob values, gate-off notices, store/env teardown legs. The broadest class by call-site count — most
1315
+ * misconfigurations announce here rather than failing the task.
1309
1316
  * - `"memory"` — a post-task memory-consolidation pass failed or skipped a malformed reconcile
1310
1317
  * decision (design/41). Best-effort: the notes the model saved are kept; the task still succeeds.
1311
1318
  * - `"mcp"` — an MCP server failed to connect / list its tools and was skipped (fail-open, design/29);
@@ -1496,7 +1503,7 @@ export interface RunnerDeps {
1496
1503
  * trusted control-plane injection), so it lives on `RunnerDeps` — NOT `TaskSpec`: `TaskSpec` is the
1497
1504
  * serializable, untrusted-caller, durable-resume-round-trippable per-task config (a function can be
1498
1505
  * neither serialized nor durably checkpointed, and the sandbox/env-class injections deliberately sit on
1499
- * `RunnerDeps` for the same trust reason). Same placement as `promptProvider` / `executionEnvFactory`.
1506
+ * `RunnerDeps` for the same trust reason). Same placement as `mods` / `executionEnvFactory`.
1500
1507
  *
1501
1508
  * When `summaryProvider` is set, BOTH compaction call sites (the within-task turn boundary AND `finish()`
1502
1509
  * at task end) consult it: a NON-EMPTY string is reused verbatim (the real `generateSummary` LLM call is
@@ -177,12 +177,28 @@ export const SAFETY_MERGE_CONFORMANCE_CORPUS = [
177
177
  },
178
178
  {
179
179
  name: "inert-deny-entry-removed-safe",
180
- intent: "removing a deny entry that reads as nothing (an empty entry, a wildcard peer, a `__` name with no protocol prefix) relaxes nothing — the comparison reads the EFFECTIVE entries on both sides",
181
- prior: { toolDeny: ["Bash", "", "mcp__*", "github__x"] },
180
+ intent: "removing a deny entry the grammar reads that names nothing (a wildcard peer, a `__` name with no protocol prefix) relaxes nothing — the comparison reads the EFFECTIVE entries on both sides",
181
+ prior: { toolDeny: ["Bash", "mcp__*", "github__x"] },
182
182
  next: { toolDeny: ["Bash"] },
183
183
  loosens: false,
184
184
  reasons: [],
185
185
  },
186
+ {
187
+ name: "unreadable-deny-prior-loosened",
188
+ intent: "rules whose toolDeny holds an entry no rule grammar reads (an empty entry) cannot be read and refuse every call — an override that can be read loosens them",
189
+ prior: { toolDeny: ["Bash", ""] },
190
+ next: { toolDeny: ["Bash"] },
191
+ loosens: true,
192
+ reasons: ['the prior rules refuse every call — their toolDeny holds "" (grammar), which no grammar reads'],
193
+ },
194
+ {
195
+ name: "unreadable-deny-next-safe",
196
+ intent: "an override whose toolDeny holds an entry no rule grammar reads refuses every call — it loosens nothing, whatever else it drops",
197
+ prior: { toolDeny: ["Bash"], allowDirs: ["/repo"] },
198
+ next: { toolDeny: [""] },
199
+ loosens: false,
200
+ reasons: [],
201
+ },
186
202
  {
187
203
  name: "inert-allow-entry-added-safe",
188
204
  intent: "adding an allowlist entry that reads as nothing admits nothing, so it widens nothing",
@@ -4,8 +4,9 @@
4
4
  * A child the engine spawns may run what the MODEL chose (a tool shell, a gate over model-written code, a language
5
5
  * server). Under the `"scrub"` policy (the default) it inherits every variable but those the judgment below names —
6
6
  * deleted whole, never rewritten; `"all"` and a `string[]` allow list are the caller's explicit alternatives
7
- * ({@link inheritedHostEnv}). Whatever the policy, a name the deployment declares as its own credential
8
- * ({@link declareWithheldEnv}) is never inherited. One judgment per variable ({@link classifySecretEnvEntry}), the first rule that answers:
7
+ * ({@link inheritedHostEnv}). Whatever the policy, an entry that is this deployment's own credential is never inherited:
8
+ * its name is one the deployment declared, or its value equals a credential value the deployment declared or the
9
+ * engine holds ({@link declareWithheldEnv}, {@link holdOwnCredentialValues}). One judgment per variable ({@link classifySecretEnvEntry}), the first rule that answers:
9
10
  * 1. exempt — git's environment config and the proxy variables, handed on as written ({@link isExemptEnvName});
10
11
  * 2. `exact-name` — a known credential name (the vocabulary's exact env names);
11
12
  * 3. `prefix-rule` — the OpenTelemetry settings ({@link OTEL_ENV_RE});
@@ -26,8 +27,9 @@ import { type EngineNotice } from "./engine-notice.js";
26
27
  * Reads the first {@link VALUE_SCAN_LIMIT} code units. The value half of the judgment, exported apart from the env
27
28
  * entry's exemptions ({@link isExemptEnvName}): a caller holding a value that is no environment variable asks this. */
28
29
  export declare function looksLikeCredentialValue(value: string): boolean;
29
- /** Which rule withheld an entry: one of the scrub's rules, or `own-credential` — the deployment declared the name as its
30
- * own credential ({@link declareWithheldEnv}), which every policy withholds. */
30
+ /** Which rule withheld an entry: one of the scrub's rules, or `own-credential` — the entry is this deployment's own
31
+ * credential (its name is declared, or its value equals a declared or engine-held credential value:
32
+ * {@link declareWithheldEnv}), which every policy withholds. */
31
33
  export type SecretEnvFindingKind = "exact-name" | "name-rule" | "namespace-rule" | "prefix-rule" | "value-rule" | "own-credential";
32
34
  /** One env entry withheld (deleted) from a child's environment: its name — never its value, so the record is
33
35
  * loggable —, the rule that withheld it, how strong that claim is, and the minting module. */
@@ -50,34 +52,100 @@ export declare function isSecretEnvKey(key: string, value?: string): boolean;
50
52
  export declare function scrubSecretEnv(env: NodeJS.ProcessEnv, findings?: SecretEnvFinding[]): NodeJS.ProcessEnv;
51
53
  /** How much of this process's environment a child spawned on this host inherits — the `inheritEnv` value. */
52
54
  export type InheritEnvPolicy = "all" | "scrub" | string[];
55
+ /** What {@link declareWithheldEnv} takes: this deployment's own credentials in this process's environment. */
56
+ export interface WithheldEnvDeclaration {
57
+ /** Names of variables that are this deployment's own credentials: never inherited, and an allow list naming one is refused. */
58
+ readonly names: readonly string[];
59
+ /** Credential values this deployment holds: an inherited entry whose value equals one — the same string, compared
60
+ * whole, never as a part — is never inherited, whatever its name. A value must be a credential: not white space only,
61
+ * a flag or placeholder word, one character repeated, or fewer than eight characters. */
62
+ readonly values: readonly string[];
63
+ }
53
64
  /**
54
- * Declare the names of this deployment's OWN credentials in this process's environment — the engine's or its host's:
55
- * an approval bearer, a service token. From then on no child spawned on this host inherits one, whatever the policy:
56
- * every spawn site reads its environment through {@link inheritedHostEnv}, which subtracts them from `"all"` and from
57
- * the scrub's result (each one present is a finding of kind `own-credential`), and {@link inheritEnvPolicyProblem}
58
- * refuses an allow list naming one. Compared as the platform compares variable names: exactly, but case-blind on
59
- * Windows. A variable a host hands a child itself (a shell's `shellEnv`, a per-exec `env`, a language server's `env`, an MCP server entry's `env`)
60
- * is its explicit grant and is not read against the list.
65
+ * Declare this deployment's OWN credentials in this process's environment — the engine's or its host's: an approval
66
+ * bearer, a service token — by name and by value. From then on no child spawned on this host inherits one, whatever the
67
+ * policy: every spawn site reads its environment through {@link inheritedHostEnv}, which subtracts from `"all"`, from the
68
+ * scrub's result and from an allow list's every entry that is this deployment's own credential (each one present is a
69
+ * finding of kind `own-credential`), and {@link inheritEnvPolicyProblem} refuses an allow list naming a declared name.
70
+ * A NAME is compared as the platform compares variable names: exactly, but case-blind on Windows. A VALUE is compared
71
+ * whole, as the same string: an entry holding it as a part (`Bearer <value>`, a URL, an encoding of it) is not its value.
72
+ * Besides the declared values, every value the engine took in itself ({@link holdOwnCredentialValues}) is withheld the
73
+ * same way. A variable a host hands a child itself (a shell's `shellEnv`, a per-exec `env`, a language server's `env`,
74
+ * an MCP server entry's `env`) is its explicit grant and is not read against the table.
61
75
  *
62
- * Declared once, at start-up, before anything spawns; a later call REPLACES the list (a configuration reload), read
63
- * from the next spawn on — a spawn whose environment is already read (one announcing its findings) keeps it. The
64
- * list is copied. A malformed list — not an array, an entry that is no variable name, or a name the host hands every
65
- * child anyway ({@link runtimeSuppliedEnv}) — throws and leaves the declaration as it was.
76
+ * Declared once, at start-up, before anything spawns; a later call REPLACES the declaration whole (a configuration
77
+ * reload), read from the next spawn on — a spawn whose environment is already read (one announcing its findings) keeps
78
+ * it; the values the engine took in stay. The lists are copied, and a value is kept only as a digest (no credential is
79
+ * held by the table). A malformed table — not a plain object `{ names, values }` (the names-only list of earlier releases
80
+ * included), a member besides those two, a list that is a Proxy or whose element throws while it is read, a name that
81
+ * is no variable name or that the host hands every child anyway ({@link runtimeSuppliedEnv}), a value that is not a
82
+ * string a variable can hold or is no credential ({@link notACredentialReason}: white space only, a flag or placeholder
83
+ * word, one character repeated, fewer than {@link CREDENTIAL_MIN_CHARS} characters — withholding it would take a setting
84
+ * such as `CI=true` from every child) or that is, in this process's environment now, the value of such a variable —
85
+ * throws and leaves the declaration as it was. A value listed twice is the one value (the declaration is a set). No
86
+ * refusal sentence repeats a value.
66
87
  *
67
88
  * Two Windows readings, measured on a real machine: a withheld name that the child's own shell or runtime re-creates
68
89
  * with a DEFAULT of its own (`ComSpec`, `PATHEXT`, `HOME`, `CommonProgramFiles`, …) shows up in the child's table with
69
90
  * that default, never with this process's value — withheld, not leaked; and the disclosure (`detail.ownCredentials`)
70
91
  * spells each withheld name as this process's environment spells it, not as the declaration spelled it.
71
92
  */
72
- export declare function declareWithheldEnv(names: readonly string[]): void;
73
- /** Test seam: never called by production code (a host re-declares `[]`). */
93
+ export declare function declareWithheldEnv(table: WithheldEnvDeclaration): void;
94
+ /**
95
+ * The engine takes credential values in — each where the engine receives it: a first-party brain's construction
96
+ * credential (`brainConfigSnapshot`), a model entry's own credential headers (`resolveRouteCredential`), a protocol
97
+ * peer's credential headers (`resolveProtocolHttpHeaders`), the memory distiller's chat seat key (`openAiCompatChatSeat`,
98
+ * and `RunnerDeps.memoryConsolidationDriver.chat` at `new Runner`, before that seat is built). From then on, for the
99
+ * life of the process, no child spawned on this host inherits an entry whose value equals one: the same table, the same
100
+ * subtraction, finding and disclosure as a declared value ({@link declareWithheldEnv}). A credential the engine is handed
101
+ * per request (a per-model auth hook's answer) is not taken in: the host that resolves it owns it and declares it.
102
+ * An absent or empty value adds nothing. A value that is no credential ({@link notACredentialReason}: white space, a
103
+ * flag or placeholder word, one character repeated, fewer than {@link CREDENTIAL_MIN_CHARS} characters — the key a local
104
+ * gateway is told to be handed) is not taken in: its holder uses it as given (it is no bad value), and the variables
105
+ * that hold the same string stay with every child. Said once per process per value, never the value, as the notice
106
+ * `config.credential_not_withheld` through the engine's one notice throat ({@link deliverEngineNotice}): to `onNotice`
107
+ * when the intake has the structured seat in hand (the `RunnerDeps` receipt at `new Runner`), else as that notice's
108
+ * line on `console.warn` (the throat's own arm for an absent seat — a brain's construction, a request's route reading,
109
+ * a peer's dial, a directly built distiller seat). A value that is, in this process's
110
+ * environment now, the value of a variable every child is handed whatever the spawn passes cannot be withheld: the intake
111
+ * throws (`config.invalid_argument`, the variable named, never the value) and takes nothing in — the brain is not built,
112
+ * the peer is not dialed.
113
+ */
114
+ export declare function holdOwnCredentialValues(values: Iterable<string | undefined>, onNotice?: (notice: EngineNotice) => void): void;
115
+ /** THE one reading of which HTTP header carries a credential by its NAME — the credential vocabulary's header-name
116
+ * reading ({@link isSensitiveHeaderName}: `Authorization`, `Proxy-Authorization`, `X-Api-Key`, Azure's `api-key`,
117
+ * `x-goog-api-key`, `Cookie`, any name holding a credential word; not a gateway's own spelling of a name the
118
+ * vocabulary declares non-secret, `cf-aig-cache-key` / `X-Idempotency-Key`). The reading of a record MEMBER's name
119
+ * (`isSensitiveRecordKey`), which decides what a record shows, takes those declared names whole only. Every face that
120
+ * asks "which header is a credential, by its name" reads this one: the withheld-value intake below
121
+ * ({@link credentialHeaderValues}) and the route law — which bag carries a credential, which header values a per-model
122
+ * credential's identity is read from, which headers the per-model winner strips, which the user-header merge leaves to
123
+ * that strip, which the run-static stream options refuse. The NAME is the shared half: the intake adds a half of its
124
+ * own, a value that looks like a credential under any name ({@link looksLikeCredentialValue}) — a guess it may make,
125
+ * because withholding a value from a child costs little; the route law does not, because a header it reads as a
126
+ * credential replaces the deployment's key and is bound to an origin, and a guess that is wrong drops a key that should
127
+ * have gone out. */
128
+ export declare function isCredentialHeaderName(name: string): boolean;
129
+ /** Whether a credential header's value is `<auth-scheme> <credentials>` by definition (RFC 9110 §11.6.2 / §11.7.2:
130
+ * `Authorization`, `Proxy-Authorization`) — the scheme word is public and the credentials part is the secret. Any other
131
+ * credential header's value is opaque, read whole. */
132
+ export declare function isSchemedCredentialHeader(name: string): boolean;
133
+ /** The credential values a header bag carries: each header whose name is a credential header ({@link isCredentialHeaderName})
134
+ * or whose value carries one ({@link looksLikeCredentialValue}), as written and, when it reads `<scheme> <credentials>`,
135
+ * its credentials part too — the spelling a variable copied from it would carry. A schemed header's
136
+ * ({@link isSchemedCredentialHeader}) value over a credentials part that is no credential (`Bearer 1`) gives that part
137
+ * alone — the engine's intake then does not take it in — and not the whole value, which carries nothing else. Any other
138
+ * header (`User-Agent`, `Accept`, a region) is no credential. */
139
+ export declare function credentialHeaderValues(headers: Readonly<Record<string, string>> | undefined): string[];
140
+ /** Test seam: never called by production code (a host re-declares `{ names: [], values: [] }`; what the engine took in stays). */
74
141
  export declare function __resetWithheldEnv(): void;
75
142
  /**
76
- * THE environment a child spawned ON THIS HOST inherits: the policy's arm, less the declared own credentials
77
- * ({@link declareWithheldEnv}). The arms: `"scrub"` (and absent) is this process's environment through
143
+ * THE environment a child spawned ON THIS HOST inherits: the policy's arm, less this deployment's own credentials — a
144
+ * declared name, or a value equal to a declared or engine-held credential value ({@link declareWithheldEnv},
145
+ * {@link holdOwnCredentialValues}). The arms: `"scrub"` (and absent) is this process's environment through
78
146
  * {@link scrubSecretEnv}; `"all"` is this process's environment as written; a `string[]` is exactly the named
79
147
  * variables that are set, as written — a strict allow list, so a name it leaves out (`PATH` included) is not
80
- * inherited. `findings` collects every entry withheld: the scrub's, and each declared own credential the arm held.
148
+ * inherited. `findings` collects every entry withheld: the scrub's, and each own credential the arm held.
81
149
  *
82
150
  * A policy {@link inheritEnvPolicyProblem} refuses throws that reason HERE, at every spawn, read against the
83
151
  * declaration as it stands: a value that is no policy at all (never read as the scrub), and an allow list naming a