@sema-agent/core 7.58.0 → 7.60.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 (519) hide show
  1. package/CHANGELOG.md +1340 -0
  2. package/README.md +6 -4
  3. package/dist/agents/agent-definition.d.ts +7 -0
  4. package/dist/agents/agent-definition.js +12 -0
  5. package/dist/agents/agent-transcript-tool.d.ts +2 -1
  6. package/dist/agents/agent-transcript-tool.js +3 -1
  7. package/dist/agents/cc-peer-directory.js +8 -8
  8. package/dist/agents/child-model-seat.d.ts +4 -2
  9. package/dist/agents/child-model-seat.js +9 -4
  10. package/dist/agents/cumulative-stats.js +0 -1
  11. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  12. package/dist/agents/inherited-tool-pool.js +22 -0
  13. package/dist/agents/peer-directory.d.ts +9 -0
  14. package/dist/agents/peer-directory.js +6 -2
  15. package/dist/agents/retain-ledger.d.ts +11 -1
  16. package/dist/agents/retain-ledger.js +13 -2
  17. package/dist/agents/roster-store.d.ts +1 -1
  18. package/dist/agents/roster-store.js +3 -1
  19. package/dist/agents/send-message-tool.d.ts +8 -19
  20. package/dist/agents/send-message-tool.js +32 -50
  21. package/dist/agents/subagent.d.ts +51 -17
  22. package/dist/agents/subagent.js +150 -112
  23. package/dist/agents/tool-filter.d.ts +1 -3
  24. package/dist/agents/tool-filter.js +4 -12
  25. package/dist/bench/metrics.d.ts +3 -5
  26. package/dist/bench/metrics.js +0 -1
  27. package/dist/brain/anthropic.js +161 -45
  28. package/dist/brain/degrading.js +3 -1
  29. package/dist/brain/errors.d.ts +9 -3
  30. package/dist/brain/errors.js +7 -1
  31. package/dist/brain/failover.js +2 -1
  32. package/dist/brain/open-responses.js +3 -3
  33. package/dist/brain/openai.js +103 -53
  34. package/dist/brain/provider-dialect.d.ts +11 -0
  35. package/dist/brain/provider-dialect.js +5 -2
  36. package/dist/brain/reasoning-request.js +5 -4
  37. package/dist/brain/reasoning.d.ts +19 -0
  38. package/dist/brain/reasoning.js +17 -2
  39. package/dist/brain/request-route.d.ts +4 -1
  40. package/dist/brain/request-route.js +4 -1
  41. package/dist/brain/route-adjudicator.d.ts +84 -18
  42. package/dist/brain/route-adjudicator.js +90 -22
  43. package/dist/brain/route-conformance.js +1 -1
  44. package/dist/brain/status-sink.d.ts +7 -1
  45. package/dist/brain/status-sink.js +6 -0
  46. package/dist/brain/stream-engine.js +84 -49
  47. package/dist/brain/stream-shared.d.ts +30 -0
  48. package/dist/brain/stream-shared.js +34 -1
  49. package/dist/brain/timeout.d.ts +65 -6
  50. package/dist/brain/timeout.js +111 -11
  51. package/dist/core/a2a.d.ts +15 -5
  52. package/dist/core/a2a.js +34 -19
  53. package/dist/core/account-row.d.ts +61 -0
  54. package/dist/core/account-row.js +51 -0
  55. package/dist/core/advisor-verdict.d.ts +2 -1
  56. package/dist/core/advisor-verdict.js +1 -1
  57. package/dist/core/agent-definition.d.ts +20 -0
  58. package/dist/core/allow-entry.d.ts +20 -6
  59. package/dist/core/allow-entry.js +17 -7
  60. package/dist/core/approval-object.d.ts +29 -15
  61. package/dist/core/approval-object.js +47 -19
  62. package/dist/core/artifact-host.d.ts +0 -2
  63. package/dist/core/artifact-host.js +0 -1
  64. package/dist/core/auto-compaction.js +1 -1
  65. package/dist/core/auto-mode-defaults.d.ts +8 -0
  66. package/dist/core/auto-mode-defaults.js +1 -0
  67. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  68. package/dist/core/auto-mode.d.ts +39 -4
  69. package/dist/core/auto-mode.js +63 -12
  70. package/dist/core/background-agent-store.d.ts +26 -4
  71. package/dist/core/background-agent-store.js +3 -2
  72. package/dist/core/background-shell.d.ts +12 -1
  73. package/dist/core/background-shell.js +12 -0
  74. package/dist/core/checkpoint-requirements.d.ts +13 -1
  75. package/dist/core/checkpoint-requirements.js +3 -1
  76. package/dist/core/checkpoint-store.d.ts +66 -25
  77. package/dist/core/checkpoint-store.js +22 -9
  78. package/dist/core/child-clamp-seats.d.ts +29 -0
  79. package/dist/core/child-clamp-seats.js +56 -1
  80. package/dist/core/compliance.d.ts +3 -3
  81. package/dist/core/compliance.js +1 -1
  82. package/dist/core/credential-echo.d.ts +52 -0
  83. package/dist/core/credential-echo.js +65 -0
  84. package/dist/core/credential-vocabulary.d.ts +13 -3
  85. package/dist/core/credential-vocabulary.js +12 -4
  86. package/dist/core/cross-boundary-taint.d.ts +4 -5
  87. package/dist/core/effective-path-target.d.ts +8 -2
  88. package/dist/core/effective-path-target.js +8 -3
  89. package/dist/core/engine-notice.d.ts +156 -23
  90. package/dist/core/engine-notice.js +19 -5
  91. package/dist/core/frame-settlement.d.ts +5 -0
  92. package/dist/core/frame-settlement.js +4 -0
  93. package/dist/core/gate-fold.js +8 -6
  94. package/dist/core/gate-lanes.js +47 -12
  95. package/dist/core/gate-outcome.d.ts +32 -3
  96. package/dist/core/gate-outcome.js +19 -1
  97. package/dist/core/governance-codes.d.ts +17 -1
  98. package/dist/core/governance-codes.js +25 -0
  99. package/dist/core/hands-band-screen.js +0 -1
  100. package/dist/core/hands-band.d.ts +0 -3
  101. package/dist/core/hooks.d.ts +70 -59
  102. package/dist/core/hooks.js +125 -80
  103. package/dist/core/image-admission.d.ts +106 -52
  104. package/dist/core/image-admission.js +184 -56
  105. package/dist/core/image-downsample.d.ts +36 -69
  106. package/dist/core/image-downsample.js +111 -73
  107. package/dist/core/integer-option.d.ts +21 -0
  108. package/dist/core/integer-option.js +13 -0
  109. package/dist/core/locked-config.d.ts +59 -5
  110. package/dist/core/locked-config.js +82 -50
  111. package/dist/core/mailbox-store.d.ts +45 -1
  112. package/dist/core/mailbox-store.js +53 -9
  113. package/dist/core/mcp-call-meta.d.ts +2 -2
  114. package/dist/core/mcp-call-meta.js +9 -10
  115. package/dist/core/mcp-failure.d.ts +122 -20
  116. package/dist/core/mcp-failure.js +73 -5
  117. package/dist/core/mcp-host-seat.d.ts +92 -0
  118. package/dist/core/mcp-host-seat.js +131 -0
  119. package/dist/core/mcp-probe.d.ts +7 -2
  120. package/dist/core/mcp-probe.js +7 -2
  121. package/dist/core/mcp-server-link.d.ts +22 -1
  122. package/dist/core/mcp-server-link.js +25 -1
  123. package/dist/core/mcp-server-spec.d.ts +38 -9
  124. package/dist/core/mcp-server-spec.js +55 -21
  125. package/dist/core/mcp.d.ts +27 -12
  126. package/dist/core/mcp.js +105 -76
  127. package/dist/core/memory-admission.d.ts +23 -6
  128. package/dist/core/memory-admission.js +19 -9
  129. package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
  130. package/dist/core/memory-engine/consolidation-driver.js +3 -3
  131. package/dist/core/memory-engine/consolidation.d.ts +4 -0
  132. package/dist/core/memory-engine/consolidation.js +1 -0
  133. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  134. package/dist/core/memory-engine/content-origin.js +21 -3
  135. package/dist/core/memory-engine/delegation-settlement.js +5 -12
  136. package/dist/core/memory-engine/distiller.js +2 -2
  137. package/dist/core/memory-engine/dual-root.d.ts +50 -1
  138. package/dist/core/memory-engine/dual-root.js +44 -1
  139. package/dist/core/memory-engine/engine.d.ts +67 -14
  140. package/dist/core/memory-engine/engine.js +384 -212
  141. package/dist/core/memory-engine/export-bundle.d.ts +23 -0
  142. package/dist/core/memory-engine/export-bundle.js +23 -4
  143. package/dist/core/memory-engine/file-backend.d.ts +128 -55
  144. package/dist/core/memory-engine/file-backend.js +290 -117
  145. package/dist/core/memory-engine/index.d.ts +3 -2
  146. package/dist/core/memory-engine/index.js +2 -1
  147. package/dist/core/memory-engine/layout.d.ts +59 -11
  148. package/dist/core/memory-engine/layout.js +190 -40
  149. package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
  150. package/dist/core/memory-engine/memory-backend-contract.js +39 -2
  151. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  152. package/dist/core/memory-engine/scope-contract.js +2 -2
  153. package/dist/core/memory-engine/sync-client.d.ts +51 -9
  154. package/dist/core/memory-engine/sync-client.js +107 -13
  155. package/dist/core/memory-engine/sync-report.d.ts +103 -0
  156. package/dist/core/memory-engine/sync-report.js +119 -0
  157. package/dist/core/memory-engine/sync.d.ts +8 -1
  158. package/dist/core/memory-engine/types.d.ts +6 -0
  159. package/dist/core/mode-policy.d.ts +9 -1
  160. package/dist/core/mode-policy.js +11 -1
  161. package/dist/core/model-receipt.d.ts +39 -0
  162. package/dist/core/model-receipt.js +139 -0
  163. package/dist/core/mods/agent-stations.d.ts +65 -0
  164. package/dist/core/mods/agent-stations.js +105 -0
  165. package/dist/core/mods/classic-events.d.ts +5 -1
  166. package/dist/core/mods/kernel/dispatch.d.ts +5 -1
  167. package/dist/core/mods/kernel/dispatch.js +6 -5
  168. package/dist/core/mods/kernel/events.d.ts +11 -4
  169. package/dist/core/mods/kernel/events.js +11 -7
  170. package/dist/core/mods/kernel/receive.d.ts +5 -0
  171. package/dist/core/mods/kernel/receive.js +10 -0
  172. package/dist/core/mods/kernel/registration.d.ts +4 -0
  173. package/dist/core/mods/kernel/registration.js +3 -0
  174. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  175. package/dist/core/mods/lifecycle-stations.js +35 -0
  176. package/dist/core/mods/stations.d.ts +73 -60
  177. package/dist/core/mods/stations.js +64 -40
  178. package/dist/core/mods/tool-call.d.ts +10 -4
  179. package/dist/core/mods/tool-call.js +28 -12
  180. package/dist/core/mounted-mcp.d.ts +5 -0
  181. package/dist/core/mounted-mcp.js +2 -2
  182. package/dist/core/namespaced-rule-name.d.ts +7 -1
  183. package/dist/core/namespaced-rule-name.js +13 -2
  184. package/dist/core/oracle-isolation.js +1 -1
  185. package/dist/core/own-property-receipt.d.ts +3 -0
  186. package/dist/core/own-property-receipt.js +3 -0
  187. package/dist/core/parent-spec-seat.d.ts +8 -3
  188. package/dist/core/parent-spec-seat.js +2 -0
  189. package/dist/core/park-selfcheck.js +14 -8
  190. package/dist/core/peer-seat.d.ts +133 -16
  191. package/dist/core/peer-seat.js +319 -42
  192. package/dist/core/permission-rule-consent.d.ts +0 -21
  193. package/dist/core/permission-rule-consent.js +11 -6
  194. package/dist/core/permission-rule-model.d.ts +20 -2
  195. package/dist/core/permission-rule-model.js +8 -7
  196. package/dist/core/present-plan-tool.d.ts +11 -3
  197. package/dist/core/present-plan-tool.js +2 -2
  198. package/dist/core/protocol-http-auth.d.ts +14 -2
  199. package/dist/core/protocol-http-auth.js +16 -7
  200. package/dist/core/read-face-seats.d.ts +7 -5
  201. package/dist/core/read-face-seats.js +4 -1
  202. package/dist/core/redaction-marks.d.ts +4 -3
  203. package/dist/core/redaction-marks.js +2 -2
  204. package/dist/core/remote-env.d.ts +146 -98
  205. package/dist/core/remote-env.js +113 -14
  206. package/dist/core/resume-startup-cause.js +1 -0
  207. package/dist/core/retention.js +37 -12
  208. package/dist/core/retired-keys.d.ts +6 -1
  209. package/dist/core/retired-keys.js +4 -1
  210. package/dist/core/rewrite-rejudge.d.ts +13 -5
  211. package/dist/core/rewrite-rejudge.js +9 -5
  212. package/dist/core/roles.d.ts +69 -3
  213. package/dist/core/roles.js +167 -80
  214. package/dist/core/rule-owner.d.ts +3 -0
  215. package/dist/core/runner/announce-once-ledger.d.ts +5 -4
  216. package/dist/core/runner/announce-once-ledger.js +4 -2
  217. package/dist/core/runner/assemble-result.d.ts +0 -5
  218. package/dist/core/runner/assemble-result.js +0 -1
  219. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  220. package/dist/core/runner/call-hook-stations.js +23 -12
  221. package/dist/core/runner/child-tree.d.ts +7 -8
  222. package/dist/core/runner/child-tree.js +6 -6
  223. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  224. package/dist/core/runner/classifier-ladder.js +39 -8
  225. package/dist/core/runner/construction-doors.js +5 -0
  226. package/dist/core/runner/contracts.d.ts +82 -57
  227. package/dist/core/runner/credential-origin-seat.js +4 -3
  228. package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
  229. package/dist/core/runner/cross-boundary-lane.js +11 -2
  230. package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
  231. package/dist/core/runner/cwd-alignment-probe.js +21 -0
  232. package/dist/core/runner/decide-continuation.d.ts +2 -2
  233. package/dist/core/runner/env-capability-census.d.ts +15 -20
  234. package/dist/core/runner/env-capability-census.js +25 -34
  235. package/dist/core/runner/file-history-request.d.ts +2 -2
  236. package/dist/core/runner/file-history-request.js +0 -8
  237. package/dist/core/runner/gate-exit.d.ts +87 -11
  238. package/dist/core/runner/gate-exit.js +30 -8
  239. package/dist/core/runner/git-status-frame.d.ts +5 -2
  240. package/dist/core/runner/git-status-frame.js +3 -4
  241. package/dist/core/runner/image-removed-seat.d.ts +12 -0
  242. package/dist/core/runner/image-removed-seat.js +19 -0
  243. package/dist/core/runner/image.d.ts +7 -2
  244. package/dist/core/runner/image.js +14 -8
  245. package/dist/core/runner/inline-image.d.ts +10 -8
  246. package/dist/core/runner/inline-image.js +11 -9
  247. package/dist/core/runner/memory-consolidation-driver.js +5 -5
  248. package/dist/core/runner/park-commit.d.ts +1 -1
  249. package/dist/core/runner/park-commit.js +3 -0
  250. package/dist/core/runner/permission-rule-lanes.js +1 -1
  251. package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
  252. package/dist/core/runner/prepare-ask-lane.js +2 -1
  253. package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
  254. package/dist/core/runner/prepare-boundary-parks.js +5 -5
  255. package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
  256. package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
  257. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  258. package/dist/core/runner/prepare-config-doors.js +16 -9
  259. package/dist/core/runner/prepare-context-lane.js +2 -0
  260. package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
  261. package/dist/core/runner/prepare-delegation-surface.js +5 -4
  262. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  263. package/dist/core/runner/prepare-file-history.js +3 -12
  264. package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
  265. package/dist/core/runner/prepare-gate-stations.js +4 -3
  266. package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
  267. package/dist/core/runner/prepare-hands-readface.js +19 -6
  268. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
  269. package/dist/core/runner/prepare-inherited-gate.js +22 -31
  270. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  271. package/dist/core/runner/prepare-memory.d.ts +2 -2
  272. package/dist/core/runner/prepare-memory.js +12 -19
  273. package/dist/core/runner/prepare-park-ask.d.ts +4 -6
  274. package/dist/core/runner/prepare-park-ask.js +5 -9
  275. package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
  276. package/dist/core/runner/prepare-policy-chain.js +136 -121
  277. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  278. package/dist/core/runner/prepare-project-context.js +10 -7
  279. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
  280. package/dist/core/runner/prepare-prompt-inputs.js +10 -20
  281. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  282. package/dist/core/runner/prepare-protocol-tools.js +17 -2
  283. package/dist/core/runner/prepare-run-refs.d.ts +2 -3
  284. package/dist/core/runner/prepare-run-refs.js +4 -1
  285. package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
  286. package/dist/core/runner/prepare-suspend-saga.js +5 -7
  287. package/dist/core/runner/prepare-task.js +44 -28
  288. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  289. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  290. package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
  291. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  292. package/dist/core/runner/prepare-workspace-restore.js +3 -3
  293. package/dist/core/runner/reply-pricing.d.ts +30 -0
  294. package/dist/core/runner/reply-pricing.js +19 -0
  295. package/dist/core/runner/resume-admission.js +4 -2
  296. package/dist/core/runner/resume-apply.js +6 -1
  297. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  298. package/dist/core/runner/resume-policy-outcome.js +5 -5
  299. package/dist/core/runner/retired-runner-deps.js +4 -1
  300. package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
  301. package/dist/core/runner/role-seat-defaulted.js +40 -0
  302. package/dist/core/runner/run-attachment-seats.js +3 -3
  303. package/dist/core/runner/run-brain-sinks.js +3 -0
  304. package/dist/core/runner/run-git-lane.d.ts +3 -1
  305. package/dist/core/runner/run-git-lane.js +1 -1
  306. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  307. package/dist/core/runner/run-harness-handlers.js +3 -1
  308. package/dist/core/runner/run-identity-wiring.d.ts +2 -5
  309. package/dist/core/runner/run-identity-wiring.js +6 -5
  310. package/dist/core/runner/run-leg.d.ts +2 -0
  311. package/dist/core/runner/run-leg.js +63 -56
  312. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  313. package/dist/core/runner/run-notification-lane.js +16 -10
  314. package/dist/core/runner/run-settle-and-teardown.js +5 -1
  315. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  316. package/dist/core/runner/run-stop-and-final-verify.js +14 -6
  317. package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
  318. package/dist/core/runner/run-terminal-adoption.js +9 -3
  319. package/dist/core/runner/run-turn-boundary.js +89 -77
  320. package/dist/core/runner/runtask.d.ts +8 -5
  321. package/dist/core/runner/runtask.js +21 -13
  322. package/dist/core/runner/side-call-account.d.ts +1 -1
  323. package/dist/core/runner/side-call-account.js +3 -18
  324. package/dist/core/runner/skills-seat.js +2 -2
  325. package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
  326. package/dist/core/runner/sub-agent-deny-lists.js +20 -7
  327. package/dist/core/runner/synthetic-tools.js +2 -2
  328. package/dist/core/runner/tool-disclosure.js +0 -2
  329. package/dist/core/runner/tool-end-body.js +2 -2
  330. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  331. package/dist/core/runner/tool-face-overlay.js +26 -19
  332. package/dist/core/runner/tool-occurrence.d.ts +1 -1
  333. package/dist/core/runner/tool-occurrence.js +2 -2
  334. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  335. package/dist/core/runner/tool-result-media-seat.js +17 -1
  336. package/dist/core/runner/turn-attachments.d.ts +29 -27
  337. package/dist/core/runner/turn-attachments.js +27 -42
  338. package/dist/core/runner-deps.d.ts +32 -19
  339. package/dist/core/secret-env.d.ts +35 -4
  340. package/dist/core/secret-env.js +65 -3
  341. package/dist/core/sensitive-path-policy.js +3 -3
  342. package/dist/core/session-policy-store.d.ts +12 -3
  343. package/dist/core/session-policy-store.js +29 -10
  344. package/dist/core/session-store.d.ts +5 -7
  345. package/dist/core/session-store.js +50 -11
  346. package/dist/core/side-query.d.ts +11 -1
  347. package/dist/core/side-query.js +9 -0
  348. package/dist/core/skill-grant-binding.d.ts +31 -2
  349. package/dist/core/skill-grant-binding.js +31 -1
  350. package/dist/core/skill-grant.d.ts +17 -5
  351. package/dist/core/skill-grant.js +24 -6
  352. package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
  353. package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
  354. package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
  355. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  356. package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
  357. package/dist/core/stub-env.d.ts +5 -5
  358. package/dist/core/stub-env.js +11 -1
  359. package/dist/core/swappable-deps.d.ts +17 -43
  360. package/dist/core/swappable-deps.js +15 -5
  361. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  362. package/dist/core/synthetic-read-verdict.js +2 -1
  363. package/dist/core/task-event.d.ts +50 -10
  364. package/dist/core/task-notification.d.ts +88 -5
  365. package/dist/core/task-notification.js +146 -17
  366. package/dist/core/task-registry-agent.d.ts +18 -12
  367. package/dist/core/task-registry-agent.js +19 -6
  368. package/dist/core/task-registry-monitor.d.ts +7 -0
  369. package/dist/core/task-registry-monitor.js +28 -1
  370. package/dist/core/task-registry-shared.d.ts +43 -3
  371. package/dist/core/task-registry-shared.js +21 -7
  372. package/dist/core/task-registry-workflow.js +1 -1
  373. package/dist/core/task-registry.d.ts +50 -35
  374. package/dist/core/task-registry.js +64 -23
  375. package/dist/core/task-result.d.ts +3 -12
  376. package/dist/core/task-spec.d.ts +15 -7
  377. package/dist/core/task-stream.d.ts +1 -1
  378. package/dist/core/terminal-cause.d.ts +10 -0
  379. package/dist/core/tool-catalog-entries.js +1 -1
  380. package/dist/core/tool-check-reading.d.ts +1 -0
  381. package/dist/core/tool-check-reading.js +3 -3
  382. package/dist/core/tool-face-reader.d.ts +7 -6
  383. package/dist/core/tool-face-reader.js +4 -3
  384. package/dist/core/tool-name-aliases.d.ts +19 -0
  385. package/dist/core/tool-name-aliases.js +54 -2
  386. package/dist/core/tool-policy.d.ts +21 -4
  387. package/dist/core/tool-policy.js +1 -1
  388. package/dist/core/tool-registry.d.ts +5 -5
  389. package/dist/core/tool-registry.js +2 -2
  390. package/dist/core/tool-result-store.d.ts +88 -5
  391. package/dist/core/tool-result-store.js +51 -12
  392. package/dist/core/tool-roster.d.ts +112 -5
  393. package/dist/core/tool-roster.js +42 -1
  394. package/dist/core/tool-spec.d.ts +23 -5
  395. package/dist/core/trace.d.ts +0 -1
  396. package/dist/core/types.d.ts +5 -5
  397. package/dist/core/types.js +2 -2
  398. package/dist/core/untrusted-text.js +1 -1
  399. package/dist/core/user-attachment.d.ts +10 -5
  400. package/dist/core/user-attachment.js +15 -7
  401. package/dist/core/wiring-manifest.d.ts +6 -3
  402. package/dist/engine/compaction/compaction.js +29 -3
  403. package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
  404. package/dist/engine/execution-env/node-execution-env.js +21 -13
  405. package/dist/engine/harness/agent-harness.d.ts +26 -3
  406. package/dist/engine/harness/agent-harness.js +49 -16
  407. package/dist/engine/harness/messages.d.ts +3 -1
  408. package/dist/engine/harness/messages.js +3 -2
  409. package/dist/engine/harness/types.d.ts +119 -28
  410. package/dist/engine/llm/rejected-images.d.ts +46 -0
  411. package/dist/engine/llm/rejected-images.js +54 -0
  412. package/dist/engine/llm/tool-turns.d.ts +2 -1
  413. package/dist/engine/llm/types.d.ts +18 -7
  414. package/dist/engine/loop/agent-loop.d.ts +20 -12
  415. package/dist/engine/loop/agent-loop.js +205 -36
  416. package/dist/engine/loop/types.d.ts +12 -3
  417. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  418. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  419. package/dist/engine/session/path-to-root.d.ts +38 -0
  420. package/dist/engine/session/path-to-root.js +39 -0
  421. package/dist/engine/session/storage-base.js +4 -21
  422. package/dist/index.d.ts +35 -21
  423. package/dist/index.js +26 -17
  424. package/dist/internal/harness-types.d.ts +1 -1
  425. package/dist/internal/harness.d.ts +1 -0
  426. package/dist/internal/llm.d.ts +1 -0
  427. package/dist/orchestration/run-workflow-tool.d.ts +9 -3
  428. package/dist/orchestration/run-workflow-tool.js +59 -29
  429. package/dist/orchestration/workflow-governance.d.ts +1 -1
  430. package/dist/orchestration/workflow-governance.js +2 -1
  431. package/dist/orchestration/workflow-observe.d.ts +17 -1
  432. package/dist/orchestration/workflow-observe.js +20 -0
  433. package/dist/orchestration/workflow-types.d.ts +32 -7
  434. package/dist/orchestration/workflow.d.ts +4 -0
  435. package/dist/orchestration/workflow.js +762 -491
  436. package/dist/prompts/default.d.ts +1 -10
  437. package/dist/prompts/default.js +0 -2
  438. package/dist/shell/counting-pass.d.ts +50 -0
  439. package/dist/shell/counting-pass.js +502 -0
  440. package/dist/shell/lex.d.ts +4 -2
  441. package/dist/shell/lex.js +93 -34
  442. package/dist/shell/shell-words.d.ts +1 -1
  443. package/dist/shell/shell-words.js +7 -6
  444. package/dist/stores/file/background-agent-store.d.ts +1 -1
  445. package/dist/stores/file/background-agent-store.js +3 -1
  446. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  447. package/dist/stores/file/checkpoint-store.js +19 -14
  448. package/dist/stores/file/file-history-store.d.ts +1 -1
  449. package/dist/stores/file/file-history-store.js +3 -1
  450. package/dist/stores/file/index.d.ts +4 -3
  451. package/dist/stores/file/index.js +17 -8
  452. package/dist/stores/file/mailbox-store.d.ts +1 -1
  453. package/dist/stores/file/mailbox-store.js +9 -11
  454. package/dist/stores/file/memory-store.d.ts +1 -1
  455. package/dist/stores/file/memory-store.js +3 -1
  456. package/dist/stores/file/session-policy-store.d.ts +1 -1
  457. package/dist/stores/file/session-policy-store.js +3 -1
  458. package/dist/stores/file/session-store.d.ts +1 -1
  459. package/dist/stores/file/session-store.js +3 -1
  460. package/dist/stores/file/shared-ledger.d.ts +26 -0
  461. package/dist/stores/file/shared-ledger.js +38 -9
  462. package/dist/stores/file/tool-result-store.d.ts +20 -2
  463. package/dist/stores/file/tool-result-store.js +74 -6
  464. package/dist/stores/file/usage-window-store.d.ts +1 -1
  465. package/dist/stores/file/usage-window-store.js +3 -1
  466. package/dist/stores/file/workflow-journal-store.d.ts +1 -11
  467. package/dist/stores/file/workflow-journal-store.js +3 -2
  468. package/dist/tools/fs/containment-face.d.ts +5 -0
  469. package/dist/tools/fs/encoding.d.ts +13 -4
  470. package/dist/tools/fs/encoding.js +17 -2
  471. package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
  472. package/dist/tools/fs/fs-bash-background-text.js +1 -0
  473. package/dist/tools/fs/fs-bash.d.ts +14 -4
  474. package/dist/tools/fs/fs-bash.js +29 -35
  475. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  476. package/dist/tools/fs/fs-pdf.js +26 -21
  477. package/dist/tools/fs/fs-read.d.ts +5 -4
  478. package/dist/tools/fs/fs-read.js +35 -18
  479. package/dist/tools/fs/fs-search-tools.js +4 -1
  480. package/dist/tools/fs/fs-shared.d.ts +11 -13
  481. package/dist/tools/fs/fs-shared.js +11 -7
  482. package/dist/tools/fs/fs-write.js +5 -5
  483. package/dist/tools/fs/index.d.ts +14 -8
  484. package/dist/tools/fs/index.js +13 -5
  485. package/dist/tools/fs/program-read-model.d.ts +13 -0
  486. package/dist/tools/fs/program-read-model.js +15 -0
  487. package/dist/tools/fs/program-read-model.rows.js +1 -1
  488. package/dist/tools/fs/read-deny.d.ts +13 -10
  489. package/dist/tools/fs/read-deny.js +25 -5
  490. package/dist/tools/fs/read-floor.d.ts +62 -0
  491. package/dist/tools/fs/read-floor.js +58 -0
  492. package/dist/tools/fs/removal-targets.d.ts +9 -4
  493. package/dist/tools/fs/removal-targets.js +17 -9
  494. package/dist/tools/fs/search.d.ts +3 -3
  495. package/dist/tools/fs/search.js +4 -4
  496. package/dist/tools/fs/shell-read-check.d.ts +1 -1
  497. package/dist/tools/fs/shell-read-check.js +2 -1
  498. package/dist/tools/fs/shell-read-judge.d.ts +16 -8
  499. package/dist/tools/fs/shell-read-judge.js +10 -6
  500. package/dist/tools/fs/shell-read-plan.d.ts +6 -1
  501. package/dist/tools/fs/shell-read-plan.js +22 -15
  502. package/dist/tools/fs/shell-read-start.js +1 -0
  503. package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
  504. package/dist/tools/fs/shell-reentry-text.js +25 -3
  505. package/dist/tools/monitor.d.ts +9 -4
  506. package/dist/tools/monitor.js +17 -8
  507. package/dist/tools/scheduler-tools.js +42 -4
  508. package/dist/tools/web.d.ts +0 -10
  509. package/dist/tools/web.js +1 -4
  510. package/package.json +5 -2
  511. package/test/export-surface.snapshot.json +161 -21
  512. package/wire-changes/core-stores-sql@7.59.0.json +29 -0
  513. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  514. package/wire-changes/core@7.59.0.json +2459 -0
  515. package/wire-changes/core@7.60.0.json +3274 -0
  516. package/wire-changes/mods-kernel@7.59.0.json +29 -0
  517. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  518. package/wire-changes/primitives@7.59.0.json +29 -0
  519. package/wire-changes/primitives@7.60.0.json +30 -0
@@ -1,4 +1,5 @@
1
- export const URI_SCHEME_SOURCE = String.raw `[A-Za-z][A-Za-z0-9+.\-_]{0,63}`;
1
+ export const URI_SCHEME_SOURCE = String.raw `(?<![A-Za-z0-9+.\-_])[0-9+.\-_]*[A-Za-z][A-Za-z0-9+.\-_]*`;
2
+ export const URL_USERINFO_SOURCE = String.raw `(?:[^/\s"@]*@)+`;
2
3
  export const CREDENTIAL_MIN_CHARS = 8;
3
4
  const VENDOR_BODY = `[A-Za-z0-9_-]{${CREDENTIAL_MIN_CHARS},}`;
4
5
  const VALUE_END = String.raw `\s"';|&`;
@@ -23,6 +24,13 @@ const BEARER_TAIL = `(?:(?!${QUOTE})\\S${GLUED_RUN}|(?<==)(?:${QUOTED_VALUE}))`;
23
24
  const HEADER_PARAM = String.raw `=[ \t]*(\\{0,${ESCAPE_DEPTH}})(["'])(?:(?!(?<!\\)\2\3)[^\r\n])*(?:(?<!\\)\2\3(?=[\s,;]|\\{0,${ESCAPE_DEPTH}}["']|$)|(?=[\r\n]|$))`;
24
25
  const HEADER_VALUE = String.raw `(?:[A-Za-z][A-Za-z0-9!#$%&*+.^_|~-]*[ \t]+)?(?:${HEADER_PARAM}|[^\s"',]|[ \t]*,[ \t]*(?=[^\s"',])|[ \t]+(?==)|(?<==)[ \t]+(?=[^\s"',]))+${VALUE_RUN_END}`;
25
26
  const headed = (body, flags = "g") => new RegExp(`${WORD_START}${body}`, flags);
27
+ const HUMP_BEFORE = "[a-z0-9]";
28
+ const KEYWORD_VALUE_WORDS = ["token", "secret", "key", "password", "passwd", "credential"];
29
+ const anyCase = (word) => [...word].map((c) => `[${c.toUpperCase()}${c.toLowerCase()}]`).join("");
30
+ const VALUE_ROW_FIELDS = [["Account", "Key"]];
31
+ const leftToItsRow = (keyword) => VALUE_ROW_FIELDS.filter(([, k]) => k.toLowerCase() === keyword).map(([front]) => `(?<!(?<![A-Za-z0-9])${front})`).join("");
32
+ const KEYWORD_HEAD = `(?:${WORD_START}(?:${KEYWORD_VALUE_WORDS.map(anyCase).join("|")})|(?<=${HUMP_BEFORE})(?:${KEYWORD_VALUE_WORDS.map((w) => leftToItsRow(w) + w[0].toUpperCase() + anyCase(w.slice(1))).join("|")})|(?<=[A-Z])(?:${KEYWORD_VALUE_WORDS.map((w) => w[0].toUpperCase() + w[1] + anyCase(w.slice(2))).join("|")}))`;
33
+ const KEY_QUOTE = `(?:\\\\{0,${ESCAPE_DEPTH}}["'])?`;
26
34
  export const CREDENTIAL_VOCABULARY = {
27
35
  values: [
28
36
  { id: "github-token", kind: "prefixed-token", source: "arg-summary", confidence: "high", pass: "vendor-prefixed", match: headed(`gh[opsur][-_]${VENDOR_BODY}`), strict: /\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36,}\b/ },
@@ -42,8 +50,8 @@ export const CREDENTIAL_VOCABULARY = {
42
50
  { id: "bearer-token", kind: "bearer-token", source: "arg-summary", confidence: "high", match: headed(String.raw `()[Bb][Ee][Aa][Rr][Ee][Rr]\s+[A-Za-z0-9._~+/-]{${CREDENTIAL_MIN_CHARS},}=*(?:${BEARER_TAIL})?`), strict: /\bAuthorization:\s*Bearer\s+(?=[A-Za-z0-9._~+/-]*[0-9])[A-Za-z0-9._~+/-]{20,}=*/ },
43
51
  { id: "authorization-header", kind: "authorization-header", source: "arg-summary", confidence: "high", match: headed(String.raw `(authorization(?:\\{0,${ESCAPE_DEPTH}}["'])?[ \t]*[=:][ \t]*(?:\\{0,${ESCAPE_DEPTH}}["'])?)${HEADER_VALUE}`, "gi") },
44
52
  { id: "azure-storage-account-key", kind: "prefixed-token", source: "arg-summary", confidence: "high", match: /(AccountKey=)[A-Za-z0-9+/]{40,}={0,2}/g, strict: /AccountKey=[A-Za-z0-9+/]{40,}={0,2}/ },
45
- { id: "keyword-value", kind: "keyword-value", source: "arg-summary", confidence: "medium", match: headed(String.raw `((?:token|secret|key|password|passwd|credential)["']?\s*[=:]\s*["']?)${VALUE_CHAR}{4,}${VALUE_RUN_END}`, "gi") },
46
- { id: "url-userinfo", kind: "url-credentials", source: "untrusted-egress", confidence: "medium", match: new RegExp(String.raw `(${URI_SCHEME_SOURCE}:\/\/)((?:[^/\s"'@]*@)+)`, "gi") },
53
+ { id: "keyword-value", kind: "keyword-value", source: "arg-summary", confidence: "medium", match: new RegExp(String.raw `(${KEYWORD_HEAD}${KEY_QUOTE}\s*[=:]\s*${KEY_QUOTE})${VALUE_CHAR}{4,}${VALUE_RUN_END}`, "g") },
54
+ { id: "url-userinfo", kind: "url-credentials", source: "untrusted-egress", confidence: "medium", match: new RegExp(String.raw `(${URI_SCHEME_SOURCE}:\/\/)(${URL_USERINFO_SOURCE})`, "gi") },
47
55
  { id: "signed-url-param", kind: "signed-url-param", source: "untrusted-egress", confidence: "high", match: /([?&#](?:sig|signature|sas|code)=)[^&\s"'#]+/gi },
48
56
  ],
49
57
  words: [
@@ -137,7 +145,7 @@ export function envNameView(vocabulary) {
137
145
  export function splitCamelCase(name) {
138
146
  return ["OAuth", "NextAuth"]
139
147
  .reduce((text, word) => text.replaceAll(word, word[0] + word.slice(1).toLowerCase()), name)
140
- .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
148
+ .replace(new RegExp(`(${HUMP_BEFORE})([A-Z])`, "g"), "$1_$2")
141
149
  .replace(/([A-Z])([A-Z][a-z])/g, "$1_$2");
142
150
  }
143
151
  export function recordKeyView(vocabulary) {
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import type { AssertAllKeysHandled } from "./ask-origin.js";
14
14
  import type { EngineNotice } from "./engine-notice.js";
15
+ import type { ExecutionEnv } from "../internal/harness-types.js";
15
16
  import type { HostDecider } from "./gate-outcome.js";
16
17
  /** The run tree's two TAINT bits: the tree executes on a target device (`targetExecutionArmed`), and an off-target read
17
18
  * was allowed into it since (`offTargetReadObserved`). Presence-coded on every carrier: `true` or absent, never `false`. */
@@ -50,13 +51,11 @@ export interface CrossBoundaryObligation {
50
51
  readonly record: boolean;
51
52
  }
52
53
  /** What a `"per_call"` definition's dispatch gives for one call: the legs it travels and, when its `env` leg reaches an
53
- * environment other than the calling leg's own (a background shell's), that environment — its declaration is read as the call
54
- * is judged. */
54
+ * environment other than the calling leg's own (a background shell's), that environment — its declaration
55
+ * (`capabilities.externalContentTarget`) is read as the call is judged. */
55
56
  export interface BoundaryLegsGiven {
56
57
  readonly legs: readonly BoundaryLeg[];
57
- readonly env?: {
58
- readonly externalContentTarget?: boolean;
59
- };
58
+ readonly env?: Pick<ExecutionEnv, "capabilities">;
60
59
  }
61
60
  /** What a leg's session is still owed when the leg ends: the legs each unfinished background task its access (the TaskOutput reach) delivers
62
61
  * along, read as the poll the session's next leg — another tree — would make of it (`TaskRegistry.owedDeliveries`). */
@@ -48,7 +48,7 @@
48
48
  import { canonicalizeTarget, type PathFamily, type PathIdentity, type Win32NamespaceRefusal } from "../tools/fs/safety.js";
49
49
  import type { TargetViews } from "./path-guard-rows.js";
50
50
  import type { ExecutionEnv } from "../internal/harness-types.js";
51
- import type { ToolCallPathTarget } from "./tool-face.js";
51
+ import type { ToolCallPathTarget, ToolPathAbsence, ToolPathBase } from "./tool-face.js";
52
52
  import { type ToolCallLike } from "./tool-registry.js";
53
53
  /** The bases of ONE CALL a target resolves against: the task root, and the live tracked working directory
54
54
  * (absent when no tracker moved or the caller keeps none). Facts of the call, never of the tool. The
@@ -64,6 +64,12 @@ export interface ToolPathBases {
64
64
  * slot names nothing this reader can locate.
65
65
  */
66
66
  export declare function pathTargetBaseOf(pt: Pick<ToolCallPathTarget, "base"> | undefined, bases: ToolPathBases): string | undefined;
67
+ /** A declared slot's resolution with its silences read: the base its relative spellings resolve against and what an empty slot
68
+ * reads — `cwd` and `none` for a declaration that states neither. The ONE place a declaration's silence becomes a resolution. */
69
+ export declare function pathTargetResolutionOf(pt: Pick<ToolCallPathTarget, "base" | "absent">): {
70
+ readonly base: ToolPathBase;
71
+ readonly absent: ToolPathAbsence;
72
+ };
67
73
  /**
68
74
  * design/116 批④ #8 — decompose an ABSOLUTE glob pattern into a base
69
75
  * directory + relative pattern: cut at the last separator before the first glob metachar (`* ? [ {`); a
@@ -271,7 +277,7 @@ export declare function carryArgsReadFrom(original: unknown, copy: unknown): voi
271
277
  * face). Every seat that rewrites a request's arguments and hands it on (a composition's rewrite cascade, a re-judgment of
272
278
  * the final or an edited form) goes through here, so the next layer never judges a request its reading does not describe
273
279
  * nor arguments the tool would run differently. `signal` is the CURRENT call's: a reading never carries one call's
274
- * cancellation into another's.
280
+ * cancellation into another's. The request's grant-binding words follow the new args the same way ({@link withArgsBinding}).
275
281
  */
276
282
  export declare function withArgsReading<R extends {
277
283
  readonly args: unknown;
@@ -4,8 +4,12 @@ import { symlinkChainHops } from "./path-identity.js";
4
4
  import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, withGateTimeout } from "./gate-bounded-await.js";
5
5
  import { thrownText } from "./thrown-value.js";
6
6
  import { canonicalize } from "./canonical-json.js";
7
+ import { withArgsBinding } from "./skill-grant-binding.js";
7
8
  export function pathTargetBaseOf(pt, bases) {
8
- return (pt?.base ?? "cwd") === "root" ? bases.root : (bases.cwd ?? bases.root);
9
+ return pathTargetResolutionOf(pt ?? {}).base === "root" ? bases.root : (bases.cwd ?? bases.root);
10
+ }
11
+ export function pathTargetResolutionOf(pt) {
12
+ return { base: pt.base ?? "cwd", absent: pt.absent ?? "none" };
9
13
  }
10
14
  export function splitAbsoluteGlobPattern(pattern, tree) {
11
15
  const family = tree ?? familyFor("own", pattern);
@@ -44,7 +48,7 @@ export function effectivePathSpellingOf(call, pt, bases) {
44
48
  const spelled = pathTargetValue(call.args, pt);
45
49
  if (spelled !== undefined)
46
50
  return { spelled, base: declaredBase };
47
- if ((pt.absent ?? "none") === "none")
51
+ if (pathTargetResolutionOf(pt).absent === "none")
48
52
  return undefined;
49
53
  if (pt.patternParam !== undefined) {
50
54
  const pattern = pathTargetValue(call.args, { param: pt.patternParam });
@@ -175,7 +179,8 @@ export async function withArgsReading(req, args, signal) {
175
179
  const read = argsAsTheToolReads(req, args);
176
180
  const reading = callTargetReadingOf(req);
177
181
  const reread = reading === undefined ? undefined : REREAD.get(reading);
178
- return reread === undefined ? { ...req, args: read } : { ...req, args: read, targetReading: await reread(read, signal) };
182
+ const moved = withArgsBinding(req, read);
183
+ return reread === undefined ? moved : { ...moved, targetReading: await reread(read, signal) };
179
184
  }
180
185
  function viewFrom(v) {
181
186
  if (v.lexical === undefined)
@@ -97,11 +97,16 @@ export interface EngineNotice {
97
97
  * losses of one ref apart. Dedup key: (code, occurrenceId).
98
98
  * - `"tool_result.media_refused"` — an executed call's result carried media blocks (an image or a document, from
99
99
  * an MCP server, a host tool, an engine tool or a `tool_result` hook's replacement) whose bytes the tool-result
100
- * seat's admission refused: not a base64 payload, a media type outside the closed set, over the cap, or bytes
101
- * without the claimed type's signature. Each such block already stands in the result as a text placeholder naming
100
+ * seat's admission refused: not a base64 payload, a media type outside the closed set, over the cap, bytes
101
+ * without the claimed type's signature, or bytes no processor could bring within the reject edge (or whose header
102
+ * states no size). Each such block already stands in the result as a text placeholder naming
102
103
  * the tool and the refusal (never the bytes), so the model, `tool_end.output` and the transcript read that; this is
103
104
  * the operator's account. ONCE PER CALL. `detail: { toolName, toolCallId, refused: [{ type, reason, bytes, limit?,
104
- * mimeType? }], sessionId, runId }` — closed-set words, counts and a media type only when it can be one.
105
+ * width?, height?, mimeType? }], sessionId, runId }` — closed-set words, counts and a media type only when it can be one.
106
+ * - `"config.image_processor_unavailable"` — an image went to the model as it was, over the image admission's soft
107
+ * target (`IMAGE_ADMISSION.soft.targetBytes`), because the run has no image processor (`RunnerDeps.imageProcessor`
108
+ * is `false`, or sharp did not resolve). ONCE PER RUN, at the first such image wherever it entered (a tool's result,
109
+ * the task's images, an attachment). `detail: { bytes, targetBytes, sessionId, runId }`.
105
110
  * - `"workflow.governance_key_stripped"` (#235) — the fields of an LLM-authored workflow `agent(spec)`
106
111
  * that did NOT cross the governed default-deny whitelist: an unrecognized/control-plane field, or a
107
112
  * `readFace` value that is not the containment-tightening one. The spawn PROCEEDS on the deployment
@@ -167,6 +172,28 @@ export interface EngineNotice {
167
172
  * DOWN, which only the operator can act on. Dedup unit: once per ATTEMPT — never folded per run,
168
173
  * because two attempts on one server are two different answers and folding the second would hide
169
174
  * the one that says the server is still down.
175
+ * - `"mcp.authorization_required"` — an MCP server the user must authorize before it serves them:
176
+ * the leg's dial failed `unauthorized`, or a request was refused so and that refusal is its answer
177
+ * (a repeat-safe call refused 401 and sent once more on a renewed credential announces only if that
178
+ * send is refused too). The SAME fact as the failure record's `authorization`
179
+ * (`McpAuthorization`). `detail: { server, reason, authorizeUrl?, principal?, sessionId, runId }` —
180
+ * `reason` is `rejected` (401) / `scope` (403 insufficient_scope) / `none` (the seat holds no
181
+ * authorization for this user), `authorizeUrl` the seat's own (never the endpoint's
182
+ * `resource_metadata`, which rides the record only). `"user"` audience: nobody but the user can
183
+ * authorize; `sessionId` REQUIRED at the mint. Dedup unit: once per (leg, server) — a resume is a new
184
+ * leg and may announce again. A deployment that waits for the authorization keys on this notice; the
185
+ * leg itself does not park on it.
186
+ * - `"mcp.credential_echoed"` — a protocol peer (an MCP server, an A2A peer) echoed a credential its
187
+ * connection's requests carried into what it said about itself: an MCP server's `serverInfo`, its
188
+ * instructions or its tool listing, an A2A peer's agent card. The engine reads that account through
189
+ * one eraser whose needle is the connection's credentials (`PeerCarrier.credentials`): free text
190
+ * holding one is erased in place (the redaction mark), a NAME holding one is refused, never
191
+ * rewritten (a tool or skill is not mounted, the server's info or the card's name is not
192
+ * projected). `detail: { protocol, server, where, sessionId, runId }` — `protocol` is `mcp` / `a2a`,
193
+ * `server` the declared entry's name, `where` the closed set `CREDENTIAL_ECHO_SITES`
194
+ * (`server_info` / `instructions` / `tool_listing` / `agent_card`); never a value. `"operator"`
195
+ * audience: the endpoint repeats what it is sent, which only whoever wired it can act on. Dedup unit:
196
+ * once per (materialization, server, site) for MCP and per (materialization, peer) for A2A.
170
197
  * - `"mcp.injection_dropped"` (L-167) — an entry of the user's own request-lane MCP injection
171
198
  * was NOT mounted for the leg. The HOST owns the drop sites and supplies the facts; CORE composes
172
199
  * the notice ({@link import("./mcp-injection-drop.js").mcpInjectionDroppedNotice}, the one mint).
@@ -177,12 +204,16 @@ export interface EngineNotice {
177
204
  * routes nowhere — refused, never fabricated). Dedup unit: per leg per server name, the host's.
178
205
  * - `"config.models_swapped"` — `Runner.swapDeps` replaced the model catalog generation
179
206
  * (zero-restart model switching; the `models` / `tiers` seats of the swappable set). `detail:
180
- * { models, tiers, occurrenceId }` — key COUNTS only, never the catalog itself. In-flight tasks
207
+ * { models, tiers, generation, occurrenceId }` — key COUNTS and the `generation` the swap leaves in force (a digest of
208
+ * its key material: the model names the candidate declares and the tier bindings in force over them,
209
+ * `catalogGenerationOf`), never the catalog itself. Every Runner a driver swaps to the SAME model names under the
210
+ * SAME tier bindings announces the SAME `generation` (and its own `occurrenceId`), so a consumer folds one swap
211
+ * announced by N Runners by (code, generation); equal key material is one generation. In-flight tasks
181
212
  * finish on the models they resolved at prepare (natural snapshot); every later prepare resolves
182
213
  * against the new generation. A failed swap (illegal tier binding, a refused candidate) throws
183
214
  * atomically and mints nothing. The verb carries no run and no session and the payload is a pair
184
- * of counts, so the uuidv7 `occurrenceId` minted at the announcement is what tells two swaps of the
185
- * same shape apart. Dedup key: (code, occurrenceId).
215
+ * of counts, so the uuidv7 `occurrenceId` minted at the announcement is what tells two deliveries of the
216
+ * same shape apart. Dedup key of one delivery: (code, occurrenceId); of one swap announced by several Runners: (code, generation).
186
217
  * - `"config.read_face_swapped"` — `Runner.swapDeps` replaced the deployment's read-face
187
218
  * declaration (`RunnerDeps.readFace`, the `readFace` seat of the swappable set) without a
188
219
  * restart. `detail: { from, to, occurrenceId }` — the seat's previous and new value, each
@@ -196,10 +227,10 @@ export interface EngineNotice {
196
227
  * same payload, same laws. A SEPARATE code rather than a face field on the line above: the audience
197
228
  * table and every consumer table are keyed by code.
198
229
  * - `"config.read_deny_swapped"` — `Runner.swapDeps` replaced the deployment's read-deny declaration
199
- * (any of `readDenyPatterns` / `readDenyBuiltinTiers` / `readDenyBuiltinExclude`) without a restart;
200
- * ONE line per swap. `detail: { seats, patterns, tiers, exclude, occurrenceId }` — the seats the swap
201
- * named, then the declaration in force after it (additions and removals as counts, the tier selection
202
- * by name; `null` = no declaration). In-flight legs keep the deny face they prepared under; every later
230
+ * (any of `readDenyPatterns` / `readDenyBuiltinTiers` / `readDenyBuiltinExclude` / `readDenyFloorRequired`) without a
231
+ * restart; ONE line per swap. `detail: { seats, patterns, tiers, exclude, floorRequired, occurrenceId }` — the seats the
232
+ * swap named, then the declaration in force after it (additions and removals as counts, the tier selection
233
+ * by name, the floor requirement as its boolean; `null` = no declaration). In-flight legs keep the deny face they prepared under; every later
203
234
  * prepare compiles against the new declaration. A candidate outside the seats' gates throws atomically
204
235
  * and mints nothing. Dedup key: (code, occurrenceId).
205
236
  * - `"config.context_settings_swapped"` — `Runner.swapDeps` replaced the deployment's per-model
@@ -248,6 +279,16 @@ export interface EngineNotice {
248
279
  * `detail: { from, to, cause, sessionId?, runId? }` — `cause` is the `AutoModeFallbackCause` word, the
249
280
  * two ids are the rungs. Dedup key: (code, from, cause) PER RUN; a second CAUSE on the same rung is
250
281
  * its own line.
282
+ * - `"classifier.seat_rate_limited"` (same file, the per-decision observer; the decider's retirement,
283
+ * `src/core/auto-mode.ts`) — the classifier seat's dispatch ended on the provider's rate limit (an HTTP 429 that
284
+ * outlived the brain's backoff ladder) on `RunnerDeps.autoMode.rateLimitBreakAfter` CONSECUTIVE classifications, so
285
+ * for the rest of this run the seat is NOT ASKED again: every gated call is judged on the model behind it, without
286
+ * first waiting out the seat's backoff. Different fact from `classifier.fallback` (a call re-asked behind the
287
+ * seat; its throttle is the rung's cause) — this is the seat leaving the walk. `detail: { model, to, rung,
288
+ * consecutive, sessionId?, runId? }` — `model` the retired rung's id, `to` the model the walk now starts at,
289
+ * `rung` its ladder position, `consecutive` the count that tripped it (the configured bound). Once per retired
290
+ * rung per run (the retirement is the dedup); only a rung with a rung behind it can retire, so a one-rung ladder
291
+ * (`classifierFallback: "none"`) never mints it. Audience `operator`.
251
292
  * - `"classifier.role_defaulted"` (`src/core/runner/classifier-ladder.ts`, the seat resolver) — no
252
293
  * `classifier` role names a model, so another model STANDS IN for the seat. `detail: { model, reason,
253
294
  * thinkingOffSpelled, sessionId?, runId? }` — `reason` ∈ `tier_below_main` (the nearest directly-bound
@@ -278,7 +319,8 @@ export interface EngineNotice {
278
319
  * - `"route.credential_origin_mismatch"` (key↔URL pairing, `src/brain/route-adjudicator.ts`; announced by
279
320
  * `src/core/runner/credential-origin-seat.ts`) — a request was REFUSED, nothing sent, because the per-model
280
321
  * credential it would carry is bound to another origin: the law binds a per-model credential to the origin
281
- * (scheme + host + port) of the first request sent carrying it, so an entry whose `baseUrl` moved to another
322
+ * (scheme + host + port) of the first request sent carrying it (or the one the host rebinds it to,
323
+ * `route.credential_rebound`), so an entry whose `baseUrl` moved to another
282
324
  * host while its credential stayed the same is refused (same-origin path moves are not). The request's own
283
325
  * failure carries the same code (`[invalid_request] route.credential_origin_mismatch: …`). Minted only for a
284
326
  * request the gate refused (`routeRefusalError`): a pre-flight or read-face judgment reports nothing, and a derived
@@ -286,6 +328,14 @@ export interface EngineNotice {
286
328
  * failed hears why; the operator hears it through the sink. `detail: { modelId, boundOrigin, requestOrigin,
287
329
  * sessionId, runId }` — the two origins in display spelling, never a credential or a digest of one. Once per
288
330
  * run per (modelId, boundOrigin, requestOrigin).
331
+ * - `"route.credential_rebound"` (`rebindCredentialOrigin`, `src/brain/route-adjudicator.ts`) — the HOST moved a
332
+ * per-model credential's binding, explicitly: every secret the credential carries is now bound to the origin the
333
+ * named entry sends to, and a request carrying it anywhere else (another entry still on the old host included) is
334
+ * refused. Minted by the verb's own call, outside any run, through the `onNotice` the host hands it (else the
335
+ * throat's `console.warn` arm); once per call that changed the table, never for one that found every secret already
336
+ * there. Audience `operator`. `detail: { modelId, origin, previous, occurrenceId }` — `origin` and each `previous`
337
+ * origin in display spelling, never a credential or a digest of one; `occurrenceId` is minted at delivery (the
338
+ * call has no run and no session to key it by, as `config.models_swapped`).
289
339
  * - `"route.response_model_mismatch"` — the provider answered a turn naming a model that is NOT the id
290
340
  * the request was sent with (an alias, a pool or a gateway-side substitution looks exactly like this),
291
341
  * so it is advisory, never a refusal: the engine keeps asking for the catalog's id and reports the
@@ -304,7 +354,8 @@ export interface EngineNotice {
304
354
  * or `"duplicate"` (a renamed later call); `rawLength` present for the two shape reasons only; never the raw
305
355
  * bytes. Absent ⇒ no call of the run was folded.
306
356
  * - `"route.finish_reason_unknown"` (#1457) — the provider ended a response with a stream-end word (an
307
- * OpenAI-family `finish_reason`) the brain does not read. The turn is kept — its text and the stop its content
357
+ * OpenAI-family `finish_reason`) the brain does not read, or (#1529, either wire) with an ending seat holding no word
358
+ * at all (a number, `true`, an object — `?`). The turn is kept — its text and the stop its content
308
359
  * implies — and the word rides `AssistantMessage.finishReasonUnknown` (and, when the run completes on that turn,
309
360
  * `terminal.detail`); the notice is what keeps the keep from being a silent clean stop. ONCE PER LEG PER WORD.
310
361
  * Audience `user` (the person reading the answer judges whether it is whole); `detail: { finishReason,
@@ -332,6 +383,15 @@ export interface EngineNotice {
332
383
  * drop arm (`TaskResult.effectiveReasoning.dropped`) is that fact's face. ONCE PER SESSION PER (model, capability)
333
384
  * (the session's announced record); one report per request also becomes the operator trace `vision.placeholder`.
334
385
  * Audience `user`; `detail: { model, capability: "image", status: "declared_off", sessionId, runId }`.
386
+ * - `"model.role_defaulted"` (#2571; `src/core/runner/role-seat-defaulted.ts`) — a role seat of the merged deployment and task
387
+ * maps names a model word the catalog does not hold, so the roles family reads it as an UNSET seat (the tier default and the
388
+ * fallback chain follow; a `subagent` seat's children run on the parent's model) and the run goes on, where it used to be
389
+ * refused at every prepare. Never minted for `default` (the main model's seat: an unknown word there is still refused,
390
+ * `config.unknown_role` / `unknown_model_ref`) nor `classifier` (its own stand-in and its own line, `classifier.role_defaulted`).
391
+ * Named once per SESSION per (seat, word), whether or not a read of this leg reaches the seat; root legs only. Audience
392
+ * `operator`; `detail: { seat, role, model, reason: "unknown_model_ref", fallback, sessionId, runId? }` — `seat` the
393
+ * `roles.<role>` the refusal would have named, `model` the word written there (bounded at 80), `fallback` the roles the seat's
394
+ * chain would reach, nearest first.
335
395
  * - `"context.tool_turn_repaired"` (#1224) — a provider request was built from a transcript that breaks the
336
396
  * tool-turn law, and the request view restored it (`engine/llm/tool-turns.ts`; the transcript is never
337
397
  * rewritten): a block after an assistant's tool calls moved ahead of them (`trailing_text`), a result recorded
@@ -345,6 +405,13 @@ export interface EngineNotice {
345
405
  * the run proceeds on the repaired request. Audience `operator`; `detail: { repairs: [{ form, toolCallIds }],
346
406
  * sessionId, runId }`. ONCE PER RUN PER (form, calls) — the same broken turn is repaired on every request of
347
407
  * the run and announced on the first. Absent ⇒ every request of the run already had the structure.
408
+ * - `"context.image_removed"` (#2874) — the provider refused a request because an image in it could not be processed
409
+ * (the failed turn's `errorKind: "image_unprocessable"`), so the request view removed the images of the newest
410
+ * message still carrying any, each replaced by `[image N removed: rejected by provider: image_unprocessable]`
411
+ * (`engine/llm/rejected-images.ts`); the turn was re-sent without them and every later request of the session
412
+ * reads the same removal. The transcript keeps the images. Audience `user`; `detail: { images, sessionId, runId }`
413
+ * — `images` how many were removed from that message. ONCE PER RUN PER REFUSAL; a refusal recorded before the run
414
+ * began is not announced again.
348
415
  * - `"task.tool_turn_incomplete"` (#1230) — the person's line for a tool turn the model was handed incomplete, beside
349
416
  * the note the model itself reads. `detail.cause` (closed `TOOL_TURN_INCOMPLETE_CAUSES`): `truncated` — calls whose
350
417
  * arguments were cut before they parsed, dropped (they did not run); `unnamed` — calls that arrived with no tool
@@ -399,12 +466,22 @@ export interface EngineNotice {
399
466
  * threw: the `Artifact` tool is not mounted for the task and this is the loud half (an absent seat
400
467
  * is silent; a broken one must not look the same). Once per prepared leg;
401
468
  * `detail: { problem, sessionId, runId }`.
402
- * - `"config.execution_env_capability_invalid"` — a remote env DECLARES a boolean capability key
403
- * (`isolation`, `suspendable`, `canonicalPathAuthoritative`, `sharesProcessTable`) with a non-boolean value; ABSENCE is a
404
- * supported reading of the first three and stays silent, and is announced for `sharesProcessTable`, which has no
405
- * absent reading (`valueType: "undefined"`). Once per key per run; `detail: { key, valueType }`. Also minted for
469
+ * - `"config.execution_env_capability_invalid"` — an env (any env, local or remote) does not declare a key of its
470
+ * REQUIRED capability block (`ExecutionEnvCapabilities`: `isolation`, `suspendable`, `sharesProcessTable`,
471
+ * `canonicalPathAuthoritative`, `hostLocalPaths`, `externalContentTarget`, `io`, `keepsReadFloor`) as a boolean — absent
472
+ * (`valueType: "undefined"`), another type, or unreadable — and each reader takes that key's safe side, which the
473
+ * sentence names; or the block itself is not an object or cannot be read (`key: "capabilities"`), or an optional
474
+ * seam method is present but not a function (`key` = the method). Once per key per run, at admission;
475
+ * `detail: { key, valueType }`. Also minted for
406
476
  * `withheldEnv` (key `"withheldEnv"`) when it is neither a list of findings nor `"unknown"`, read at a shell call of
407
477
  * a root leg (once per run).
478
+ * - `"config.read_deny_floor_unkept"` (#2936) — the run's read-deny table holds rows and its execution environment does
479
+ * not declare it keeps the byte floor (`capabilities.keepsReadFloor`): the engine refuses what a command names, but a
480
+ * recursive read under a root reads the files below it there, deny rows included. The notice dialect of the refusal
481
+ * `RunnerDeps.readDenyFloorRequired` turns it into (the prepare then fails with the same code); never minted for an
482
+ * empty table or an environment that keeps the floor (the Stub of a run without hands keeps it by refusing every
483
+ * start). Once per run — each delegated child on its own environment — and once per construction of a library-direct
484
+ * band that compiles its own table; `detail: { rowCount, sessionId?, runId? }` (the two ids on a run's notice).
408
485
  * - `"config.secret_env_scrubbed"` (#1081) — the D1 fail-closed `scrub` policy, or the deployment's
409
486
  * own credentials (`declareWithheldEnv`: a declared name, or a value equal to a declared or engine-held
410
487
  * credential value), withheld one or more keys from a spawned child's environment (a tool's shell, an
@@ -527,7 +604,12 @@ export interface EngineNotice {
527
604
  * (a returned row does not carry them: its next decide is fresh); when the pause tried to carry them forward and the parked-steer
528
605
  * carrier refused, the row also names the store's refusal as `detail.carry` (`steering.invalid_content` | `steering.queue_full`) and
529
606
  * its sentence says so (`cause` stays `leg_end`: the leg ended with them owed — the closed set has no carrier words);
530
- * `detail: { <countKey>, cause, kind?, carry?, taskId?, sessionId?, runId? }` (the `code` and the `countKey` of each family are the
607
+ * `detail: { <countKey>, cause, inputIds?, kind?, carry?, taskId?, sessionId?, runId? }` (`inputIds` — on the `leg_end` rows of the two
608
+ * families: the id of EACH input the count stands for, in the order the run would have served them (queue order: an
609
+ * `immediate`-tier input leads the ones accepted before it), the same key value the live `human_input` frame
610
+ * carries as `inputId` and a parked entry as `inputId`; present only when the ids name exactly the counted inputs — a lane
611
+ * where any counted input carried none reports its count alone, never a partial list — and never on an `approval_feedback` row,
612
+ * whose words are no input; the `crashed` arm is the serving layer's and does not carry it) (the `code` and the `countKey` of each family are the
531
613
  * table {@link USER_INPUT_UNDRAINED_FAMILIES}, keyed by the lane the input was queued on — `injectionLaneOf` — and the
532
614
  * minter writes exactly those; `cause` on both rows, closed `USER_INPUT_UNDRAINED_CAUSES`: `"leg_end"` — this engine's arm, the
533
615
  * leg ended with it still owed; `"crashed"` — minted by the SERVING LAYER, not this engine, before the
@@ -906,7 +988,10 @@ export interface EngineNotice {
906
988
  *
907
989
  * - `"delegation.transcript_integrity"` (subagent transcript persistence) — a durable agent row
908
990
  * with a BOUND transcript sessionId met a session store that attests `not_found` for it: the
909
- * deployment's declared transcript durability is being contradicted by reality. Announced at
991
+ * deployment's declared transcript durability is being contradicted by reality. Minted only where
992
+ * durability IS declared — a deployment whose `fleet.subagentTranscripts` tier is `full`; under `rows`
993
+ * (transcripts follow a process-local store's fate) a gone transcript is the declared fate and nothing
994
+ * is announced (the per-call refusals still answer), and under `none` no row binds one. Announced at
910
995
  * most once per (scope, handle, process) — `detail: { handle, scope? }`, scope = the resolved
911
996
  * access scope of the read that found the gap — from the continuation read faces (SendMessage preflight /
912
997
  * AgentTranscript's durable leg); the per-call honest refusals are unchanged, and the declared
@@ -1051,21 +1136,23 @@ export declare function deliverEngineNotice(onNotice: ((notice: EngineNotice) =>
1051
1136
  * ({@link settleOwedUserInput}). */
1052
1137
  export interface OwedUserInputAccount {
1053
1138
  /** The harness's at-agent_end snapshot, held because the tail still had something to say about it. */
1054
- readonly held: {
1055
- steer: number;
1056
- followUp: number;
1057
- } | undefined;
1058
- /** What a durable park's migration carried onto the new checkpoint, by family. */
1139
+ readonly held: HeldUserInputs | undefined;
1140
+ /** What a durable park's migration carried onto the new checkpoint, by family (`inputIds`: which inputs they were). */
1059
1141
  readonly migrated: {
1060
1142
  steer: number;
1061
1143
  followUp: number;
1144
+ inputIds?: OwedInputIds;
1062
1145
  };
1063
1146
  /** The resumed leg's undelivered continuation frames, and how many of them the migration carried. */
1064
1147
  readonly continuation: {
1148
+ /** `inputId`: the frame's own correlation key (a parked entry always carries one). */
1065
1149
  frames: ReadonlyArray<{
1066
1150
  seq?: number;
1151
+ inputId?: string;
1067
1152
  }>;
1068
1153
  carried: number;
1154
+ /** The `inputId`s of the frames counted in `carried`, when the migration recorded them. */
1155
+ carriedInputIds?: ReadonlyArray<string>;
1069
1156
  /** The approving person's words (a `policy_ask` allow's `feedback`), counted APART from `frames`: owed, and how many the migration carried.
1070
1157
  * They are on no row of their own, and a returned row (the compensation reopened it) does not carry them either — its next decide is a
1071
1158
  * fresh one the host may re-supply them on — so, unlike the caller's own frames, they are not announced when the row came back (the row is
@@ -1078,6 +1165,28 @@ export interface OwedUserInputAccount {
1078
1165
  };
1079
1166
  };
1080
1167
  }
1168
+ /** The ids of person inputs, per lane — each the `inputId` the input was accepted under (the same key value on the live
1169
+ * `human_input` frame and on a parked entry). */
1170
+ export interface OwedInputIds {
1171
+ readonly steer: ReadonlyArray<string>;
1172
+ readonly followUp: ReadonlyArray<string>;
1173
+ }
1174
+ /** The harness's at-agent_end count of person inputs still queued, per lane, with the ids of the ones that carried a park
1175
+ * record (a list shorter than its count names only some of them). */
1176
+ export interface HeldUserInputs {
1177
+ steer: number;
1178
+ followUp: number;
1179
+ inputIds?: OwedInputIds;
1180
+ }
1181
+ /**
1182
+ * The ids of the person inputs a harness-side park-record list stands for: the `inputId` each record carries (the record is
1183
+ * the steer verb's own `PendingSteerInput`, opaque to the harness). Total — a record without a string id contributes none, so
1184
+ * its lane's list falls short of the count and {@link undrainedUserInputNotices} then leaves that lane's count without a list.
1185
+ */
1186
+ export declare function parkedInputIdsOf(records: {
1187
+ readonly steer: ReadonlyArray<unknown>;
1188
+ readonly followUp: ReadonlyArray<unknown>;
1189
+ }): OwedInputIds;
1081
1190
  /**
1082
1191
  * What this leg still OWES a person, one count per family — the input to {@link undrainedUserInputNotices}.
1083
1192
  * TWO lanes accept caller input and either can be holding some when a run ends: the harness's live queue
@@ -1103,6 +1212,26 @@ export declare function owedUserInputCounts(held: {
1103
1212
  steer: number;
1104
1213
  followUp: number;
1105
1214
  };
1215
+ /**
1216
+ * WHICH inputs {@link owedUserInputCounts} counts — the same two lanes and the same rule, read as ids: the live queue's ids
1217
+ * less the ones the park migrated, plus the continuation frames the reopen did not bring back and the migration did not
1218
+ * carry (steer lane). The counts stay the authority: {@link undrainedUserInputNotices} puts a lane's list on its notice only
1219
+ * where the list names exactly that many inputs, so an input with no id, or a migration that recorded none, leaves that
1220
+ * lane's count without a list rather than with a wrong one.
1221
+ */
1222
+ export declare function owedUserInputIds(held: HeldUserInputs | undefined, migrated: {
1223
+ steer: number;
1224
+ followUp: number;
1225
+ inputIds?: OwedInputIds;
1226
+ }, continuation: {
1227
+ frames: ReadonlyArray<{
1228
+ seq?: number;
1229
+ inputId?: string;
1230
+ }>;
1231
+ carried: number;
1232
+ carriedInputIds?: ReadonlyArray<string>;
1233
+ rowReturned: boolean;
1234
+ }): OwedInputIds;
1106
1235
  /** Close the account — the ONE settlement point, called AFTER the reopen compensation with what that
1107
1236
  * compensation actually did. Ordering is the whole rule: the counts are arithmetic, and the only fact they
1108
1237
  * cannot be computed without is one the lane before this one does not have yet. EXACTLY ONCE per account,
@@ -1177,6 +1306,10 @@ export declare function parentLegIds(internals: {
1177
1306
  export declare function undrainedUserInputNotices(counts: {
1178
1307
  steer: number;
1179
1308
  followUp: number;
1309
+ inputIds?: {
1310
+ steer?: ReadonlyArray<string>;
1311
+ followUp?: ReadonlyArray<string>;
1312
+ };
1180
1313
  approvalFeedback?: number;
1181
1314
  approvalCarry?: ApprovalCarryRefusal;
1182
1315
  }, taskId?: string, sessionId?: string, runId?: string, parent?: ParentLegIds): EngineNotice[];
@@ -37,6 +37,10 @@ export function deliverEngineNotice(onNotice, notice) {
37
37
  }
38
38
  console.warn(notice.message);
39
39
  }
40
+ export function parkedInputIdsOf(records) {
41
+ const ids = (lane) => lane.flatMap((r) => (typeof r === "object" && r !== null && typeof r.inputId === "string" ? [r.inputId] : []));
42
+ return { steer: ids(records.steer), followUp: ids(records.followUp) };
43
+ }
40
44
  export function owedUserInputCounts(held, migrated, continuation) {
41
45
  const owedContinuation = (continuation.rowReturned ? continuation.frames.filter((f) => f.seq === undefined).length : continuation.frames.length) - continuation.carried;
42
46
  return {
@@ -44,16 +48,25 @@ export function owedUserInputCounts(held, migrated, continuation) {
44
48
  followUp: Math.max(0, (held?.followUp ?? 0) - migrated.followUp),
45
49
  };
46
50
  }
51
+ export function owedUserInputIds(held, migrated, continuation) {
52
+ const gone = (lane) => new Set(migrated.inputIds?.[lane] ?? []);
53
+ const live = (lane) => (held?.inputIds?.[lane] ?? []).filter((id) => !gone(lane).has(id));
54
+ const carried = new Set(continuation.carriedInputIds ?? []);
55
+ const frames = (continuation.rowReturned ? continuation.frames.filter((f) => f.seq === undefined) : continuation.frames).filter((f) => !(typeof f.inputId === "string" && carried.has(f.inputId)));
56
+ const continuationIds = frames.flatMap((f) => (typeof f.inputId === "string" ? [f.inputId] : []));
57
+ return { steer: [...continuationIds, ...live("steer")], followUp: live("followUp") };
58
+ }
47
59
  export function settleOwedUserInput(account, rowReturned, ids, onNotice) {
48
60
  if (SETTLED_OWED_ACCOUNTS.has(account))
49
61
  return;
50
62
  SETTLED_OWED_ACCOUNTS.add(account);
51
63
  try {
52
64
  const owed = owedUserInputCounts(account.held, account.migrated, { ...account.continuation, rowReturned });
65
+ const inputIds = owedUserInputIds(account.held, account.migrated, { ...account.continuation, rowReturned });
53
66
  const approval = account.continuation.approval;
54
67
  const approvalFeedback = approval === undefined || rowReturned ? 0 : Math.max(0, approval.owed - approval.carried);
55
68
  const approvalCarry = approvalFeedback > 0 ? approval?.refusal : undefined;
56
- for (const notice of undrainedUserInputNotices({ ...owed, ...(approvalFeedback > 0 ? { approvalFeedback } : {}), ...(approvalCarry !== undefined ? { approvalCarry } : {}) }, ids.taskId, ids.sessionId, ids.runId, ids.parent))
69
+ for (const notice of undrainedUserInputNotices({ ...owed, inputIds, ...(approvalFeedback > 0 ? { approvalFeedback } : {}), ...(approvalCarry !== undefined ? { approvalCarry } : {}) }, ids.taskId, ids.sessionId, ids.runId, ids.parent))
57
70
  deliverEngineNotice(onNotice, notice);
58
71
  }
59
72
  catch {
@@ -86,12 +99,13 @@ export function undrainedUserInputNotices(counts, taskId, sessionId, runId, pare
86
99
  const own = [];
87
100
  const copies = [];
88
101
  const cause = "leg_end";
102
+ const inputIdsOf = (ids, counted) => (ids !== undefined && ids.length === counted ? { inputIds: [...ids] } : {});
89
103
  if (counts.steer > 0) {
90
104
  const message = `${counts.steer} user steer(s) ${tail}`;
91
105
  const count = { [USER_INPUT_UNDRAINED_FAMILIES.steer.countKey]: counts.steer, cause };
92
- own.push({ code: STEER_UNDRAINED, message, detail: { ...count, ...tid, ...sid, ...rid } });
106
+ own.push({ code: STEER_UNDRAINED, message, detail: { ...count, ...inputIdsOf(counts.inputIds?.steer, counts.steer), ...tid, ...sid, ...rid } });
93
107
  if (toParent)
94
- copies.push({ code: STEER_UNDRAINED, message: `${message}${copyTail}`, detail: { ...count, ...ptid, sessionId: parentSession, childSessionId: sessionId } });
108
+ copies.push({ code: STEER_UNDRAINED, message: `${message}${copyTail}`, detail: { ...count, ...inputIdsOf(counts.inputIds?.steer, counts.steer), ...ptid, sessionId: parentSession, childSessionId: sessionId } });
95
109
  }
96
110
  const approvalFeedback = counts.approvalFeedback ?? 0;
97
111
  if (approvalFeedback > 0) {
@@ -109,9 +123,9 @@ export function undrainedUserInputNotices(counts, taskId, sessionId, runId, pare
109
123
  if (counts.followUp > 0) {
110
124
  const message = `${counts.followUp} user follow-up(s) ${tail}`;
111
125
  const count = { [USER_INPUT_UNDRAINED_FAMILIES.followUp.countKey]: counts.followUp, cause };
112
- own.push({ code: FOLLOWUP_UNDRAINED, message, detail: { ...count, ...tid, ...sid, ...rid } });
126
+ own.push({ code: FOLLOWUP_UNDRAINED, message, detail: { ...count, ...inputIdsOf(counts.inputIds?.followUp, counts.followUp), ...tid, ...sid, ...rid } });
113
127
  if (toParent)
114
- copies.push({ code: FOLLOWUP_UNDRAINED, message: `${message}${copyTail}`, detail: { ...count, ...ptid, sessionId: parentSession, childSessionId: sessionId } });
128
+ copies.push({ code: FOLLOWUP_UNDRAINED, message: `${message}${copyTail}`, detail: { ...count, ...inputIdsOf(counts.inputIds?.followUp, counts.followUp), ...ptid, sessionId: parentSession, childSessionId: sessionId } });
115
129
  }
116
130
  return [...own, ...copies];
117
131
  }
@@ -81,6 +81,11 @@ export declare function frameSurvivesInToolResult(committedContent: unknown, fra
81
81
  /** The station that applies a HOST hook's `updatedOutput` marks the carrier — only when an ask rides it, so an
82
82
  * ordinary rewritten result leaves nothing behind. */
83
83
  export declare function noteHostRewrite(seam: FrameSettlement, toolCallId: string): void;
84
+ /** A station WITHHELD a call's result in place of what it produced (a checking extension could not hand back its answer):
85
+ * the host side decided what the model reads, so the carrier is marked as rewritten and its asks are answered now,
86
+ * against the content that replaces the result, through the one writer below — a call whose result no transcript commit
87
+ * follows (an extension's own call) is settled all the same, and the commit of one that does follow finds nothing left. */
88
+ export declare function settleWithheldResult(seam: FrameSettlement, toolCallId: string, content: unknown): void;
84
89
  /** The receipt sink's ONE writer: every ask riding `carrier` is answered — a receipt when its frame is in
85
90
  * the committed content (or it is its own carrier); when it is not, host-withheld if a host hook rewrote the
86
91
  * carrier (the host's decision), withheld otherwise (owed again). */
@@ -22,6 +22,10 @@ export function noteHostRewrite(seam, toolCallId) {
22
22
  }
23
23
  }
24
24
  }
25
+ export function settleWithheldResult(seam, toolCallId, content) {
26
+ noteHostRewrite(seam, toolCallId);
27
+ recordFrameReceipt(seam, toolResultReceiptKey(toolCallId), content, "");
28
+ }
25
29
  export function recordFrameReceipt(seam, carrier, committedContent, entryId) {
26
30
  const hostRewrote = seam.hostRewritten.delete(carrier);
27
31
  for (const [key, ask] of seam.awaiting) {
@@ -2,7 +2,7 @@ import { inlineUntrusted } from "./untrusted-text.js";
2
2
  import { markTightenMessage } from "./safety-axis-vocab.js";
3
3
  import { PROBE_REASON_MAX, normalizeProbeCause } from "./checkpoint-store.js";
4
4
  import { normalizeReadRootCandidate } from "./read-root-candidate.js";
5
- import { engineFailClosedExit, hookDenyExit } from "./runner/gate-exit.js";
5
+ import { engineFailClosedExit, hookDenyExit, settledScreenExit, takeInheritedScreen } from "./runner/gate-exit.js";
6
6
  import { noteRewrite, POLICY_AUTHOR, readRejudge, screenRewrite } from "./rewrite-rejudge.js";
7
7
  import { traceHookCrash } from "./gate-crash-trace.js";
8
8
  import { writeProtectionMandated, writeProtectionReachOf, writeProtectionTightenDecision } from "./write-protect.js";
@@ -43,14 +43,16 @@ export async function runGateFold(pass) {
43
43
  const rewritten = pass.screening !== undefined && pass.decision.action !== "deny" ? readRejudge(pass.req, pass.currentInput, pass.decision) : undefined;
44
44
  if (pass.screening !== undefined && rewritten?.kind === "rewritten") {
45
45
  const second = await screenRewrite(pass.screening, pass.req, rewritten.form, `the rewritten call to "${toolName}"`);
46
- if (second.kind === "refused") {
47
- pass.currentInput = rewritten.form;
48
- return second.by === "hook" ? hookDenyExit(pass, second.reason) : await engineFailClosedExit(pass, second.reason);
46
+ if (second.kind === "refused" || second.kind === "settled") {
47
+ pass.currentInput = second.judged !== undefined ? second.judged : rewritten.form;
48
+ if (second.kind === "settled")
49
+ return await settledScreenExit(pass, second);
50
+ return second.by === "hook" ? hookDenyExit(pass, second.reason, second.extension) : await engineFailClosedExit(pass, second.reason, second.extension);
49
51
  }
50
- if (second.answer?.additionalContext)
51
- pass.preToolContext.push(second.answer.additionalContext);
52
+ pass.preToolContext.push(...second.contexts);
52
53
  pass.hookAsk = second.answer?.action === "ask" ? second.answer : undefined;
53
54
  pass.hookAllowedBy = second.answer?.action === "allow" ? (second.answeredBy !== undefined ? [second.answeredBy] : []) : undefined;
55
+ takeInheritedScreen(pass, second.inherited);
54
56
  }
55
57
  if ((pass.decision.action === "allow" || pass.decision.action === "ask") && pass.decision.updatedInput !== undefined) {
56
58
  pass.policyRewrite = argsAsTheToolReads(pass.req, pass.decision.updatedInput);