@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
@@ -716,7 +716,8 @@ export type ResumeOutcome = {
716
716
  * trusted/untrusted delivery framing as {@link CheckpointState.pendingSteerQueue}). It rides the resume
717
717
  * continuation's steer tail as its OWN segment, appended AFTER any already-parked queue entry
718
718
  * (X5: both are delivered — the wake message never displaces a parked, undelivered supervisor steer;
719
- * each segment is framed under its own `trusted` semantics, never one merged trust domain). WITHOUT a
719
+ * each segment is framed under its own `trusted` semantics, never one merged trust domain). Under a held
720
+ * `inputId` it is judged by {@link judgeParkedSteerRepeat}: identical ⇒ that entry, once. WITHOUT a
720
721
  * `message`, the checkpoint must already carry a parked steer — a wake with nothing to
721
722
  * deliver is rejected (`wake.nothing_to_deliver`, anti spin-wake). Idempotency rides the existing
722
723
  * resolve CAS: a second wake of the same token loses the CAS (`checkpoint.already_resolved`). */
@@ -877,9 +878,9 @@ export type PendingAction = {
877
878
  * this action against, read off the leg's tool roster at the suspend station — `capabilityId`
878
879
  * (engine-minted over {source, peer, name, contractId}), `contractId`, `shapeDigest`,
879
880
  * `implementationRevision`. With the face below they are the TOOL member of the row's approval object
880
- * (`judgeApprovalObject`): an identity member that differs from the same-name row on the resuming leg, or is missing
881
- * while another is present, is a replacement wearing the name (`resume.tool_contract_mismatch`, a reopen); a face
882
- * that differs vetoes the call (`resume.target_moved`). All four ABSENT ⇒ a pre-identity row: the name alone is bound.
881
+ * (`judgeApprovalObject`): an identity member that differs from the same-name row on the resuming leg is a replacement
882
+ * wearing the name (`resume.tool_contract_mismatch`, a reopen); a face or declaration that differs vetoes the call
883
+ * (`resume.target_moved`). Any of them ABSENT (or the family, or the declaration digest) ⇒ the row binds no tool.
883
884
  */
884
885
  capabilityId?: string;
885
886
  contractId?: string;
@@ -890,7 +891,7 @@ export type PendingAction = {
890
891
  * display `family` + declared `pathTarget` — off the same roster row at the same mint. The pre-CAS resume-edit
891
892
  * recheck has no roster yet; it rebuilds the call face from these (`parkedCallFaceOf`) and judges the edit as
892
893
  * the live gate judged the original (merge-seam H1: without them a caller slot fell to the catalog's slot for
893
- * the NAME). Any member absent ⇒ pre-388 row ⇒ the recheck falls to the catalog, never a widened grant — including #635's resolution members, which a row written before them simply lacks (they then read as their documented defaults).
894
+ * the NAME). Read only on a whole tool member: an absent `pathTarget` (or resolution member) is then the declaration's own silence.
894
895
  */
895
896
  family?: import("./tool-face.js").ToolFamily;
896
897
  pathTarget?: import("./tool-face.js").ToolRosterPathTarget;
@@ -909,6 +910,8 @@ export type PendingAction = {
909
910
  * carries): what the identity members above cannot say (a host-mounted engine definition has the same ones). The pre-CAS
910
911
  * recheck rebuilds the face from the row (`parkedCallFaceOf`); absent ⇒ judged as an ordinary tool. Word `mount_site`. */
911
912
  engineMounted?: true;
913
+ /** The digest of the roster row's DECLARATION members (`toolDeclarationDigestOf`): a live row whose declaration differs vetoes the call (`resume.target_moved`). Word `tool_declaration`. */
914
+ declarationDigest?: string;
912
915
  /** The approval object's TARGETS (`approvalTargetsOf`): per reading of the path slot, where it resolved when the card
913
916
  * was asked; absent ⇒ not judged. A role resolving elsewhere at the execution vetoes the call (`resume.target_moved`). */
914
917
  targets?: import("./approval-object.js").ApprovalTargets;
@@ -964,9 +967,18 @@ export type PendingAction = {
964
967
  * reviews the PLAN, not a tool call — so this arm has no tool fields. Every consumer that reads the
965
968
  * `tool_approval` fields above MUST branch on `kind` FIRST: a `plan_review` checkpoint must never flow into
966
969
  * a `resource_limit`- or `tool_approval`-shaped continuation (a contract test pins this). The plan artifact
967
- * is a PROFILE concern (a REF — design/76 §9); core stores no plan here. */
970
+ * is a PROFILE concern (a REF — design/76 §9); core stores no plan here.
971
+ *
972
+ * `requestedByCallId` is the id of the tool call that ASKED for this pause (the `ExitPlanMode` call for the
973
+ * first-party plan tool): which transcript call carries the plan awaiting a decision, so a card can join the pause to
974
+ * the call that presented it instead of guessing by adjacency. It is PROVENANCE, not a binding — the pause
975
+ * still gates no call, `toolCallId` stays absent on this arm, and nothing on the resume path reads the id. Written
976
+ * once, at the park mint, from the engine-bound call id (a tool cannot name another call's id); the paused
977
+ * cause and the inbox summary echo it. ABSENT for a pause whose requester carried no call id (a revive context,
978
+ * a row a deployment minted itself, a row from an engine before this member). */
968
979
  | {
969
980
  kind: "plan_review";
981
+ requestedByCallId?: string;
970
982
  }
971
983
  /** design/144 §3 (X2) — the NON-GATE arm: nothing pends a decision. The shape of a deployment-minted
972
984
  * PARK checkpoint (approval-timeout park / pure suspend; paired with `gate.kind === "task_done"`, the
@@ -1355,7 +1367,7 @@ export interface CheckpointState {
1355
1367
  placementRootSessionId?: string;
1356
1368
  /**
1357
1369
  * design/380 O9a — MONOTONIC presence bit: this run's hand-tool content fold was EXTERNAL-TARGET
1358
- * armed (the env declared `ExecutionEnv.externalContentTarget`, or an earlier leg of this suspend
1370
+ * armed (the env declared `capabilities.externalContentTarget`, or an earlier leg of this suspend
1359
1371
  * chain did). Stamped at the suspend mint from the run's RESOLVED fold state — never from first
1360
1372
  * tool use, so a park landing BEFORE the first hand call is covered too. Presence-coded like
1361
1373
  * {@link isDelegatedChild} (absent = never armed; never `false`). The resume side folds
@@ -1962,6 +1974,13 @@ export interface CheckpointIndexFacts {
1962
1974
  /** Derive a row's {@link CheckpointIndexFacts}. Pure: reads no clock, writes nothing; the approval card is read
1963
1975
  * through {@link parkedApprovalCardOf} (the one card reading), the tool fields only off a `tool_approval` action. */
1964
1976
  export declare function checkpointIndexFacts(cp: Checkpoint): CheckpointIndexFacts;
1977
+ /**
1978
+ * The ONE reading of {@link PendingAction} `plan_review.requestedByCallId` — the id of the call that asked for a plan
1979
+ * pause. A non-empty string on a `plan_review` pending action; every other kind, an absent member and a damaged value
1980
+ * (a non-string, an empty string) read as `undefined`, so no consumer echoes a value the mint never wrote. The paused
1981
+ * cause and the inbox summary both read it here.
1982
+ */
1983
+ export declare function planReviewRequesterOf(pendingAction: PendingAction): string | undefined;
1965
1984
  /**
1966
1985
  * design/80 assistant-scheduler seam #1: a LIGHTWEIGHT projection of one PENDING
1967
1986
  * checkpoint, returned in bulk by {@link CheckpointStore.listByScope} so a supervisor scheduler can list a
@@ -2014,6 +2033,11 @@ export interface CheckpointSummary {
2014
2033
  * face) must not materialize the keys as `null` on the way out. Pinned in
2015
2034
  * `test/checkpoint-store.test.ts` ("tool-less park …"). */
2016
2035
  toolCallId?: string;
2036
+ /** The id of the tool call that asked for this plan pause ({@link PendingAction} `plan_review.requestedByCallId`) —
2037
+ * present ONLY on a `plan_review` row whose requester carried a call id; OMITTED on every other row (the
2038
+ * {@link toolCallId} absence-shape note applies). It names the call that PRESENTED the plan, not a call the pause
2039
+ * gates: `toolCallId` stays omitted on a plan_review row. */
2040
+ requestedByCallId?: string;
2017
2041
  /** The pending tool's name ({@link PendingAction} `tool_approval.toolName`) when this is an approval suspend.
2018
2042
  * OMITTED (not `null`) for a non-`tool_approval` pendingAction — see {@link toolCallId}'s absence-shape note. */
2019
2043
  toolName?: string;
@@ -2175,7 +2199,9 @@ export declare function summarizeCheckpoint(cp: Checkpoint, disclose?: (sentence
2175
2199
  * worker), `"env_factory_missing"` (retryable on a factory-wired worker),
2176
2200
  * `"governed_unwired"` (retryable on an org-wired worker), `"origin_missing"` (a pending approval row
2177
2201
  * minted before the ask's origin was persisted on the park — terminal for the row's bytes; the host
2178
- * decides the orphaned card itself, no worker version redeems it), `"ledger_event_unknown"` (a durable
2202
+ * decides the orphaned card itself, no worker version redeems it), `"tool_identity_missing"` (a pending approval row
2203
+ * whose tool member is not whole — parked before 7.58.0 recorded the declaration, or damaged: an allow is refused, a deny
2204
+ * settles it; a worker of the release that parked it still reads it), `"ledger_event_unknown"` (a durable
2179
2205
  * LEDGER carries an event kind this binary does not know, so the replay is refused rather than served
2180
2206
  * incomplete — the one arm that is not row-scoped: NO row in that data directory is readable here, so
2181
2207
  * the host rolls the binary forward instead of routing one token elsewhere), `"seat_retired"` (the row
@@ -2183,10 +2209,14 @@ export declare function summarizeCheckpoint(cp: Checkpoint, disclose?: (sentence
2183
2209
  * steer seat, which no worker version reads and the host decides itself, or a retired mode-seed member of
2184
2210
  * `inheritedGate`, which an engine at 7.38.x or earlier still reads once).
2185
2211
  * · `invalid_outcome` pre-CAS row-integrity arms: `"real_approval_damaged"`, `"real_approval_forged"`,
2186
- * `"read_face_damaged"`, `"read_face_forged"`, `"write_face_damaged"`, `"skill_grants_damaged"`, `"skill_scopes_damaged"`, `"constraint_chain_missing"`, `"hands_coordinates_damaged"`, `"requirements_damaged"` (all terminal for the row's
2212
+ * `"read_face_damaged"`, `"read_face_forged"`, `"write_face_damaged"`, `"skill_grants_damaged"`, `"skill_scopes_damaged"`, `"constraint_chain_missing"`, `"hands_coordinates_damaged"`, `"requirements_damaged"`, `"bound_input_hash_missing"` (all terminal for the row's
2187
2213
  * current bytes — no worker version redeems a damaged row).
2214
+ *
2215
+ * THE ONE RULE for `checkpoint.invalid_outcome` (registered in `docs/CLOSED-SETS.md`, which also says what a host reads from it): `detail.reason` is a
2216
+ * ROW-INTEGRITY word and only that, `detail.field` ({@link CheckpointErrorField}) names the cell of the decision to act on, a refusal carries at most
2217
+ * one of them, and a refusal with neither is never a damaged row.
2188
2218
  */
2189
- export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "governed_unwired" | "origin_missing" | "ledger_event_unknown" | "seat_retired" | "real_approval_damaged" | "real_approval_forged" | "read_face_damaged" | "read_face_forged"
2219
+ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "governed_unwired" | "origin_missing" | "tool_identity_missing" | "ledger_event_unknown" | "seat_retired" | "real_approval_damaged" | "real_approval_forged" | "read_face_damaged" | "read_face_forged"
2190
2220
  /** `state.writeFace` is present but not a well-formed section. No `_forged` twin: the section is
2191
2221
  * legal-and-absent at every version, so there is no version to judge a fabrication against — and a
2192
2222
  * fabricated "open" still needs the LIVE resolution to say open too. */
@@ -2199,6 +2229,10 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
2199
2229
  * is present below v10, or does not equal the words the row's content carries (a segment dropped, or a word not
2200
2230
  * declared) — terminal for the row's bytes. */
2201
2231
  | "requirements_damaged"
2232
+ /** A pending tool approval whose row format is at or above the binding era carries no persisted `boundInputHash` — every mint at that
2233
+ * version writes one, so its absence is corruption or a caller-declared downgrade, and the decision-action input binding has nothing to
2234
+ * bind to. Terminal for the row's bytes (a pre-binding row, which never minted a hash, binds on `boundCallId` alone and is not this). */
2235
+ | "bound_input_hash_missing"
2202
2236
  /** On `resume.parent_constraint_mismatch`: a re-supplied chain entry whose path rules depend on the leg that installed it has
2203
2237
  * no installation record (a chain written before the record existed) / a record that does not cover the chain entry for
2204
2238
  * entry / a record member naming no absolute root. */
@@ -2212,9 +2246,8 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
2212
2246
  | "not_a_list" | "not_a_string" | "unknown_name" | "unsupported_pattern" | "invalid_record" | "renamed_mount" | "registry_occupied"
2213
2247
  /** On `config.unknown_role` (a fresh run's terminal `detail.detail.reason`; on a resume, `detail.reason` of `checkpoint.config_refused` with `detail.code` `config.unknown_role`)
2214
2248
  * — a model binding or a role word the engine cannot read: a word the model catalog does not hold (`"unknown_model_ref"`), a value that is
2215
- * no model reference at all — a number, a boolean, a list (`"not_a_model_ref"`), or a role word outside the vocabulary — a `roles` key, a
2216
- * `modelRole` value (`"unknown_role_word"`). The sentence names the seat the refusal's `field` names (`roles.consolidate`, `tiers.pro`, `TaskSpec.model`). */
2217
- | "unknown_model_ref" | "not_a_model_ref" | "unknown_role_word";
2249
+ * no model reference at all — a number, a boolean, a list (`"not_a_model_ref"`), or a role word outside the vocabulary — a `roles` key, a `modelRole` value (`"unknown_role_word"`) — or a task naming no model whose requested role and fallback chain supply none (`"no_model_for_role"`, `field` the requested role's seat). The sentence names the seat the refusal's `field` names (`roles.consolidate`, `tiers.pro`, `TaskSpec.model`). */
2250
+ | "unknown_model_ref" | "not_a_model_ref" | "unknown_role_word" | "no_model_for_role";
2218
2251
  /**
2219
2252
  * The codes a RESUME's pre-claim configuration screen carries as `detail.code` of a `checkpoint.config_refused` — the words prepare's
2220
2253
  * doors throw, held unchanged so one refusal reads the same on a fresh run (`TaskResult.errorCode`) and on a resume: the mode, output-style,
@@ -2237,7 +2270,7 @@ export type CheckpointConfigRefusalCode = (typeof CHECKPOINT_CONFIG_REFUSAL_CODE
2237
2270
  export declare const isCheckpointConfigRefusalCode: (word: unknown) => word is CheckpointConfigRefusalCode;
2238
2271
  /** The words of a {@link CheckpointError}'s optional `detail.field` (what each means: the `detail` member's doc). A CLOSED SET with one home, registered in
2239
2272
  * `docs/CLOSED-SETS.md`: a consumer holding a table over it is tsc-red on a new word until it places the word. */
2240
- export type CheckpointErrorField = "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "feedback" | "taskConfig" | "deps" | "inheritedGate";
2273
+ export type CheckpointErrorField = "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "feedback" | "outcome" | "updatedInput" | "decision" | "reason" | "taskConfig" | "deps" | "inheritedGate";
2241
2274
  /** A typed checkpoint-store error so callers branch on `code` (mirrors `SessionError`). */
2242
2275
  export declare class CheckpointError extends Error {
2243
2276
  readonly code: "checkpoint.already_exists" | "checkpoint.already_resolved" | "checkpoint.not_found"
@@ -2420,7 +2453,10 @@ export declare class CheckpointError extends Error {
2420
2453
  * resolve, or try to supply the minted record), or — design/252 G-7 — `"approver"` (the attribution is not a
2421
2454
  * well-formed identifier: re-decide with a plain, bounded, control-character-free string, or omit
2422
2455
  * it), or `"feedback"` (the allow's `feedback` is not fit to deliver — it carries the engine's `<system-reminder>` tag, is not a string, rides a deny,
2423
- * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2456
+ * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change), or — an approval decide's own
2457
+ * payload — `"outcome"` (the resume's outcome is not an object naming its gate: send one), `"updatedInput"` (the person's edit is not plain JSON data the
2458
+ * engine can capture: re-decide with a plain edit, or without one), `"decision"` (the verdict word is neither `allow` nor `deny`) or `"reason"` (the deny's
2459
+ * words are not a plain string, or carry the engine's `<system-reminder>` tag: change or drop them; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2424
2460
  * (the re-supplied config: correct it and resume the same token), `"deps"` (the deployment's own seat — and the policies the
2425
2461
  * caller re-supplies as inherited constraints: correct them and resume the same token) or `"inheritedGate"` (the row's record: no config reaches it; expire the row). The throw
2426
2462
  * sites always knew which arm fired; this carries that fact instead of dropping it (ruled
@@ -2633,7 +2669,10 @@ export declare class CheckpointError extends Error {
2633
2669
  * resolve, or try to supply the minted record), or — design/252 G-7 — `"approver"` (the attribution is not a
2634
2670
  * well-formed identifier: re-decide with a plain, bounded, control-character-free string, or omit
2635
2671
  * it), or `"feedback"` (the allow's `feedback` is not fit to deliver — it carries the engine's `<system-reminder>` tag, is not a string, rides a deny,
2636
- * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2672
+ * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change), or — an approval decide's own
2673
+ * payload — `"outcome"` (the resume's outcome is not an object naming its gate: send one), `"updatedInput"` (the person's edit is not plain JSON data the
2674
+ * engine can capture: re-decide with a plain edit, or without one), `"decision"` (the verdict word is neither `allow` nor `deny`) or `"reason"` (the deny's
2675
+ * words are not a plain string, or carry the engine's `<system-reminder>` tag: change or drop them; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2637
2676
  * (the re-supplied config: correct it and resume the same token), `"deps"` (the deployment's own seat — and the policies the
2638
2677
  * caller re-supplies as inherited constraints: correct them and resume the same token) or `"inheritedGate"` (the row's record: no config reaches it; expire the row). The throw
2639
2678
  * sites always knew which arm fired; this carries that fact instead of dropping it (ruled
@@ -3036,12 +3075,9 @@ export interface CheckpointStore {
3036
3075
  * full {@link Checkpoint} payloads. Read-only — it never mutates a row, takes no CAS, and has ZERO effect on
3037
3076
  * the once-only resolve. The PENDING predicate is byte-for-byte the {@link resolve} CAS's (`scope === scope &&
3038
3077
  * status === 'pending'`), so the list reflects exactly the rows that are still resumable. Order is unspecified
3039
- * (the inbox sorts by `severity`/`deadline` itself). An empty scope returns `[]`.
3040
- *
3041
- * **OPTIONAL** for backward-compat (RL-1336-checkpoint-listbyscope) with external {@link CheckpointStore} impls (a caller probes
3042
- * `store.listByScope?.(scope) ?? []`); ALL THREE first-party impls (in-memory, file, Pg) provide it.
3078
+ * (the inbox sorts by `severity`/`deadline` itself). An empty scope returns `[]`. Required: every store answers it.
3043
3079
  */
3044
- listByScope?(scope: string): Promise<CheckpointSummary[]>;
3080
+ listByScope(scope: string): Promise<CheckpointSummary[]>;
3045
3081
  /**
3046
3082
  * Deployment seam: the DISTINCT scopes that currently have at least one PENDING checkpoint — the
3047
3083
  * enumeration face `listByScope` lacks. A host keeping its own scope registry (e.g. a sidecar file for a
@@ -3050,7 +3086,7 @@ export interface CheckpointStore {
3050
3086
  * it matches `listByScope`'s visible surface, so `listScopes() × listByScope()` is exactly the full inbox,
3051
3087
  * and a member the summary does not project is read with `get(token)` on the listed token — the composition
3052
3088
  * a deployment's approval queue is, rather than a query of its own over the store's rows.
3053
- * **OPTIONAL** like {@link listByScope}; the in-memory and file first-party impls provide it.
3089
+ * **OPTIONAL** (unlike the required {@link listByScope}); the in-memory and file first-party impls provide it.
3054
3090
  */
3055
3091
  listScopes?(): Promise<string[]>;
3056
3092
  /** The PENDING rows of every scope past their deadline, one facet per call ({@link CheckpointOverdueQuery}; read by
@@ -3139,6 +3175,12 @@ export declare const ACTOR_ASSERTION_FROZEN_FIELDS: readonly ["id", "hostAsserte
3139
3175
  * on its own surface and parks it again through `setPendingSteer` if it still applies.
3140
3176
  */
3141
3177
  export declare function readPendingSteerQueue(state: Pick<CheckpointState, "pendingSteerQueue">): PendingSteerEntry[];
3178
+ /**
3179
+ * The parked queue's ONE identity judgment (the append below and the wake entrance read it): the held entry
3180
+ * when `entry` repeats it identically (the replay), `undefined` for a new `inputId`, else
3181
+ * `steering.duplicate_input_id` naming the facets that differ — the key alone is no proof of a replay.
3182
+ */
3183
+ export declare function judgeParkedSteerRepeat(queue: readonly PendingSteerEntry[], entry: Omit<PendingSteerEntry, "seq">): PendingSteerEntry | undefined;
3142
3184
  /**
3143
3185
  * design/171 §5.3/§6.3 — THE append, shared by every backend so the bounds and the ordering are one
3144
3186
  * implementation rather than one per store.
@@ -3204,9 +3246,8 @@ export declare class InMemoryCheckpointStore implements CheckpointStore {
3204
3246
  readonly deleteSessionCheckpoints?: (sessionId: string, guard: CheckpointDeleteGuard) => Promise<number>;
3205
3247
  /** `disclose` is the listing projections' own seat ({@link summarizeCheckpoint}'s and the listing faces'): this store has no
3206
3248
  * path, so it forwards each sentence for a row read past a damage, called synchronously by the listing that read it.
3207
- * `sessionHeadOf` (a session store's `headOf`) is what {@link CheckpointStore.deleteSessionCheckpoints} judges its guard by.
3208
- * `holderIsCurrent` ({@link HolderJudge}) is what a resolve's `expect.holder` is judged by. */
3209
- constructor(opts?: {
3249
+ * `sessionHeadOf` (a session store's `headOf`) is what {@link CheckpointStore.deleteSessionCheckpoints} judges its guard by; `holderIsCurrent` ({@link HolderJudge}), a resolve's `expect.holder`. */
3250
+ constructor(options?: {
3210
3251
  disclose?: (sentence: string) => void;
3211
3252
  sessionHeadOf?: (sessionId: string) => Promise<{
3212
3253
  readonly owner: string | null;
@@ -3,7 +3,7 @@ import { uuidv7 } from "../internal/harness.js";
3
3
  import { PROBE_CAUSE_PATH_MAX, PROBE_REASON_MAX, inlineUntrusted, sanitizeUntrustedText } from "./untrusted-text.js";
4
4
  import { carriesBidiControls } from "./tool-policy.js";
5
5
  import { isAutoModeFallbackCause, readDenialLimitFallback } from "./auto-mode.js";
6
- import { isAskOrigin, isPersistedRuleMandate } from "./ask-origin.js";
6
+ import { isAskOrigin, isPermissionMode, isPersistedRuleMandate } from "./ask-origin.js";
7
7
  import { isRunOrigin, RUN_ORIGINS } from "./run-origin.js";
8
8
  import { describeRejectedValue } from "./tool-search-setting.js";
9
9
  import { readBoundBinding } from "./skill-grant-binding.js";
@@ -14,8 +14,8 @@ import { checkpointDeadlinePassed, deleteSessionRowsAtStart, readCheckpointOverd
14
14
  import { renderUntrustedCommandText, stripFormatCharacters } from "./permission-rule-model.js";
15
15
  import { egressText } from "./untrusted-egress.js";
16
16
  import { steerReplayRefusal } from "./steer-replay.js";
17
- import { isPermissionMode } from "./ask-origin.js";
18
17
  import { readRetentionDeclaration } from "./retention.js";
18
+ import { receiveOptions } from "./own-property-receipt.js";
19
19
  export function mintCheckpointToken() {
20
20
  return randomBytes(16).toString("hex");
21
21
  }
@@ -275,6 +275,12 @@ export function checkpointIndexFacts(cp) {
275
275
  hasBidiControls: tool?.hasBidiControls === true ? true : null,
276
276
  };
277
277
  }
278
+ export function planReviewRequesterOf(pendingAction) {
279
+ if (pendingAction.kind !== "plan_review")
280
+ return undefined;
281
+ const id = pendingAction.requestedByCallId;
282
+ return typeof id === "string" && id !== "" ? id : undefined;
283
+ }
278
284
  export function summarizeCheckpoint(cp, disclose) {
279
285
  const facts = checkpointIndexFacts(cp);
280
286
  const descriptor = facts.riskDescriptor;
@@ -285,6 +291,7 @@ export function summarizeCheckpoint(cp, disclose) {
285
291
  }
286
292
  const cardReading = parkedApprovalCardOf(cp.gate);
287
293
  const tool = cp.pendingAction.kind === "tool_approval" ? cp.pendingAction : undefined;
294
+ const requestedByCallId = planReviewRequesterOf(cp.pendingAction);
288
295
  let toolInput;
289
296
  if (tool !== undefined) {
290
297
  try {
@@ -313,6 +320,7 @@ export function summarizeCheckpoint(cp, disclose) {
313
320
  ...(cp.sourceTaskId !== undefined ? { sourceTaskId: cp.sourceTaskId } : {}),
314
321
  ...(cp.principal !== undefined ? { principal: cp.principal } : {}),
315
322
  ...(facts.toolCallId !== null ? { toolCallId: facts.toolCallId } : {}),
323
+ ...(requestedByCallId !== undefined ? { requestedByCallId } : {}),
316
324
  ...(facts.toolName !== null ? { toolName: facts.toolName } : {}),
317
325
  ...(cardReading.kind === "card" ? { approvalCard: cardReading.card } : {}),
318
326
  ...(toolInput !== undefined ? { toolInput } : {}),
@@ -536,15 +544,19 @@ export function readPendingSteerQueue(state) {
536
544
  }
537
545
  return [...(state.pendingSteerQueue ?? [])].sort((a, b) => a.seq - b.seq);
538
546
  }
547
+ export function judgeParkedSteerRepeat(queue, entry) {
548
+ const collision = queue.find((e) => e.inputId === entry.inputId);
549
+ if (collision === undefined)
550
+ return undefined;
551
+ const refusal = steerReplayRefusal(collision, entry, { seat: "parked", inputId: entry.inputId });
552
+ if (refusal !== undefined)
553
+ throw new CheckpointError("steering.duplicate_input_id", refusal.message, refusal.detail);
554
+ return collision;
555
+ }
539
556
  export function appendPendingSteer(state, entry) {
540
557
  const current = readPendingSteerQueue(state);
541
- const collision = current.find((e) => e.inputId === entry.inputId);
542
- if (collision !== undefined) {
543
- const refusal = steerReplayRefusal(collision, entry, { seat: "parked", inputId: entry.inputId });
544
- if (refusal !== undefined)
545
- throw new CheckpointError("steering.duplicate_input_id", refusal.message, refusal.detail);
558
+ if (judgeParkedSteerRepeat(current, entry) !== undefined)
546
559
  return current;
547
- }
548
560
  const nextSeq = current.reduce((max, e) => Math.max(max, e.seq), 0) + 1;
549
561
  const next = [...current, { ...entry, seq: nextSeq }];
550
562
  const totalEntries = next.length;
@@ -571,7 +583,8 @@ export class InMemoryCheckpointStore {
571
583
  fault = null;
572
584
  disclose;
573
585
  holderIsCurrent;
574
- constructor(opts = {}) {
586
+ constructor(options) {
587
+ const opts = receiveOptions(options, "InMemoryCheckpointStore");
575
588
  this.retention = readRetentionDeclaration("InMemoryCheckpointStore.retention", opts.retention);
576
589
  this.disclose = opts.disclose;
577
590
  this.holderIsCurrent = opts.holderIsCurrent;
@@ -125,6 +125,12 @@ export declare const CLAMP_SET: Readonly<{
125
125
  readonly script: true;
126
126
  readonly carrier: "specSeat";
127
127
  }>;
128
+ classifyAllShell: Readonly<{
129
+ readonly law: "restricting";
130
+ readonly value: true;
131
+ readonly script: true;
132
+ readonly carrier: "specSeat";
133
+ }>;
128
134
  fileHistory: Readonly<{
129
135
  readonly law: "restricting";
130
136
  readonly value: "disabled";
@@ -257,6 +263,23 @@ export declare function clampRecordError(message: string): Error & {
257
263
  * whose value is `undefined` carries nothing and is read as absent (the retired-key door's presence rule).
258
264
  */
259
265
  export declare function assertClampRecord(record: unknown, owner: string, carrier?: ClampCarrier, extra?: readonly string[]): void;
266
+ /**
267
+ * Read a STATED floor — the clamp values a durable record says its run was born under — back under the table's law, or say
268
+ * why it cannot be read. A floor is the table's own value shape ({@link ClampValues}) and nothing looser: every key a row,
269
+ * a restricting row's value exactly its restricting value (a field row: exactly `{ <field>: <value> }`), an add-only row a
270
+ * non-empty list whose every entry its row's entry law accepts. `{}` is a floor (nothing was clamped); ABSENT is not — a
271
+ * record that states no floor cannot say what a revival under it would widen, and a key this build's table does not have
272
+ * (a newer writer's row) is refused rather than ignored, because ignoring it drops a restriction.
273
+ * The floor is judged and projected from ONE plain-data copy (`structuredClone`): a value that is not plain data refuses, and
274
+ * nothing an accessor answers on a second read can differ from what was judged.
275
+ */
276
+ export declare function readClampFloor(floor: unknown): {
277
+ ok: true;
278
+ floor: ClampValues;
279
+ } | {
280
+ ok: false;
281
+ why: string;
282
+ };
260
283
  /** The restricting values of every row that ANY of `records` carries — the clamp seat a waker hands a revival. */
261
284
  export declare function clampValuesOf(...records: ReadonlyArray<object | undefined>): ClampValues;
262
285
  /**
@@ -286,6 +309,12 @@ export declare const CHILD_CLAMP_SEATS_NOT_CARRIED: Readonly<Record<string, stri
286
309
  * shape it misses leaves the real constructor invisible while a namesake answers for it.
287
310
  */
288
311
  export declare const ENGINE_CHILD_SPEC_CONSTRUCTORS: readonly ["src/agents/subagent.ts#buildChildSpec", "src/agents/subagent.ts#observerSpec", "src/agents/subagent.ts#resumeSpec", "src/agents/verify.ts#verifierSpec", "src/agents/verify.ts#fixLegSpec", "src/orchestration/workflow-primitives.ts#workflowChildClamps"];
312
+ /** Do these clamps leave nobody on the leg to ask — the hard-headless clamp (`interactiveTools: false`) or the declaration
313
+ * that nobody can be asked (`approvalReach: "none"`)? The one reading {@link postureUnderClamps} and a revival's posture read. */
314
+ export declare function clampsReachNoPerson(clamps: {
315
+ readonly interactiveTools: boolean | undefined;
316
+ readonly approvalReach: TaskSpec["approvalReach"] | undefined;
317
+ }): boolean;
289
318
  /**
290
319
  * The interaction posture a leg keeps under the clamps it inherited: `"interactive"` promises a person on the leg, and a
291
320
  * leg that inherited the hard-headless clamp (`interactiveTools: false`) or the declaration that nobody can be asked
@@ -86,6 +86,7 @@ export const CLAMP_SET = Object.freeze({
86
86
  complianceAdditionalDenies: Object.freeze({ law: "addOnly", identity: complianceIdentity, entry: complianceCapabilityProblem, script: COMPLIANCE_SCRIPT_LAW, deploymentLayer: "compliancePostureResolver", carrier: "clamp" }),
87
87
  oneShot: Object.freeze({ law: "restricting", value: true, script: true, carrier: "specSeat" }),
88
88
  memoryPersistenceCapable: Object.freeze({ law: "restricting", value: false, script: true, carrier: "specSeat" }),
89
+ classifyAllShell: Object.freeze({ law: "restricting", value: true, script: true, carrier: "specSeat" }),
89
90
  fileHistory: Object.freeze({ law: "restricting", value: "disabled", script: false, carrier: "specSeat" }),
90
91
  projectMemory: Object.freeze({ law: "restricting", value: "disabled", script: false, carrier: "specSeat" }),
91
92
  promptForm: Object.freeze({ law: "restricting", value: "minimal", script: false, carrier: "specSeat" }),
@@ -239,6 +240,57 @@ export function assertClampRecord(record, owner, carrier, extra = []) {
239
240
  throw clampRecordError(`${owner} names ${unknown.map((k) => JSON.stringify(k)).join(", ")}, which the clamp table does not carry there — the legal seats are ${legal.join(", ")}. Refused rather than ignored: a seat nobody reads would read to the caller as wired.`);
240
241
  }
241
242
  }
243
+ export function readClampFloor(floor) {
244
+ if (floor === undefined)
245
+ return { ok: false, why: "the record states no policy floor (written before records carried one, or by a store that does not keep it)" };
246
+ let copy;
247
+ try {
248
+ copy = structuredClone(floor);
249
+ }
250
+ catch {
251
+ return { ok: false, why: "the record's policy floor is not plain data" };
252
+ }
253
+ const proto = typeof copy === "object" && copy !== null ? Object.getPrototypeOf(copy) : undefined;
254
+ if (copy === null || typeof copy !== "object" || Array.isArray(copy) || (proto !== Object.prototype && proto !== null)) {
255
+ return { ok: false, why: `the record's policy floor is not a record of clamp seats (got ${copy === null ? "null" : Array.isArray(copy) ? "an array" : typeof copy})` };
256
+ }
257
+ const stated = copy;
258
+ for (const [key, v] of Object.entries(stated)) {
259
+ if (v === undefined)
260
+ continue;
261
+ const row = CLAMP_SEATS.includes(key) ? CLAMP_SET[key] : undefined;
262
+ if (row === undefined)
263
+ return { ok: false, why: `the record's policy floor names ${describeStated(key)}, which this build's clamp table does not have` };
264
+ const seat = key;
265
+ if (row.law === "restricting") {
266
+ const field = fieldOf(row);
267
+ const exact = field === undefined ? v === row.value : typeof v === "object" && v !== null && !Array.isArray(v) && Object.keys(v).length === 1 && cellOf(row, v) === row.value;
268
+ if (!exact)
269
+ return { ok: false, why: `the record's policy floor states ${clampCellPath(seat)} as ${describeStated(v)}, which is not its restricting value ${describeStated(row.value)}` };
270
+ continue;
271
+ }
272
+ if (!Array.isArray(v) || v.length === 0)
273
+ return { ok: false, why: `the record's policy floor states ${seat} as ${Array.isArray(v) ? "an empty list" : describeStated(v)} — a floor's add-only seat is a non-empty list` };
274
+ const entries = v;
275
+ for (const e of entries) {
276
+ const problem = row.entry(e, `policyFloor.${seat}`);
277
+ if (problem !== undefined)
278
+ return { ok: false, why: problem };
279
+ }
280
+ }
281
+ return { ok: true, floor: clampSeatsOf(stated) };
282
+ }
283
+ function describeStated(v) {
284
+ try {
285
+ const s = JSON.stringify(v);
286
+ if (s === undefined)
287
+ return typeof v;
288
+ return s.length > 80 ? `${s.slice(0, 77)}...` : s;
289
+ }
290
+ catch {
291
+ return typeof v;
292
+ }
293
+ }
242
294
  export function clampValuesOf(...records) {
243
295
  return clampSeatsOf(foldClampSources(...records));
244
296
  }
@@ -263,8 +315,11 @@ export const ENGINE_CHILD_SPEC_CONSTRUCTORS = Object.freeze([
263
315
  "src/agents/verify.ts#fixLegSpec",
264
316
  "src/orchestration/workflow-primitives.ts#workflowChildClamps",
265
317
  ]);
318
+ export function clampsReachNoPerson(clamps) {
319
+ return clamps.interactiveTools === false || clamps.approvalReach === "none";
320
+ }
266
321
  export function postureUnderClamps(posture, clamps) {
267
- return posture === "interactive" && (clamps.interactiveTools === false || clamps.approvalReach === "none") ? "headless" : posture;
322
+ return posture === "interactive" && clampsReachNoPerson(clamps) ? "headless" : posture;
268
323
  }
269
324
  export function engineHeadlessLegSeats() {
270
325
  return { interactiveTools: false, approvalReach: "none", interactionPosture: "headless" };
@@ -2,10 +2,10 @@
2
2
  export type ComplianceProfile = "hipaa" | "zdr";
3
3
  /** Closed capability set the ENGINE can veto end-to-end (see the module header for the entry-point
4
4
  * map — a capability is admitted here only with its full interception story). */
5
- export type ComplianceCapability = "mcp_servers" | "workflows" | "web_fetch" | "org_memory_mount";
5
+ export type ComplianceCapability = "mcp_servers" | "workflows" | "web_fetch" | "org_memory_mount" | "a2a_peers";
6
6
  /** Every member of {@link ComplianceCapability} — the fail-closed "deny everything managed" set used
7
7
  * when the posture resolver itself fails. `satisfies` keeps it in lockstep with the union. */
8
- export declare const COMPLIANCE_CAPABILITIES: readonly ["mcp_servers", "workflows", "web_fetch", "org_memory_mount"];
8
+ export declare const COMPLIANCE_CAPABILITIES: readonly ["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers"];
9
9
  /**
10
10
  * A principal's resolved compliance posture, supplied by the trusted deployment resolver. The
11
11
  * effective deny set is `BUILTIN_COMPLIANCE_DENIES[profile] ∪ additionalDenies` — supply can only
@@ -32,7 +32,7 @@ export declare function resolveComplianceDenies(posture: CompliancePosture): Rea
32
32
  /** One deny list member's refusal under the closed capability set, labelled with the list that carried it, or
33
33
  * `undefined` when it is a member. */
34
34
  export declare function complianceCapabilityProblem(cap: unknown, owner: string): string | undefined;
35
- /** The core web-fetch tool face's canonical mounted name (`createWebFetchTool` in tools/web.ts). */
35
+ /** The core web-fetch tool face's canonical mounted name (`webFetchToolSpec` in tools/web.ts). */
36
36
  export declare const WEB_FETCH_TOOL_NAME = "WebFetch";
37
37
  /**
38
38
  * The CALL-TIME half of the `web_fetch` double point (CC form — mount check + call guard): given the
@@ -1,5 +1,5 @@
1
1
  import { describeRejectedValue } from "./tool-search-setting.js";
2
- export const COMPLIANCE_CAPABILITIES = Object.freeze(["mcp_servers", "workflows", "web_fetch", "org_memory_mount"]);
2
+ export const COMPLIANCE_CAPABILITIES = Object.freeze(["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers"]);
3
3
  export const BUILTIN_COMPLIANCE_DENIES = {
4
4
  hipaa: ["web_fetch", "org_memory_mount"],
5
5
  zdr: ["org_memory_mount"],
@@ -0,0 +1,52 @@
1
+ /**
2
+ * A protocol peer's account of itself, read without the credentials its connection's requests carried — the MCP server's `serverInfo`,
3
+ * its instructions and its tool listing, the A2A peer's agent card. The needle is the connection's credentials (`PeerCarrier.credentials`:
4
+ * what the seat answered that the withheld table holds) and the one eraser is `eraseSentCredentials` (protocol-http-auth.ts, beside the
5
+ * failure text's). Free text holding the needle is erased in place; a NAME holding it (a tool's name or input schema, the server's own
6
+ * name, a skill's id, the card's name) is never rewritten — what it names is refused instead. Either way the site is announced, once per
7
+ * (materialization, peer, site), as `mcp.credential_echoed` (operator) through {@link credentialEchoNotice}.
8
+ */
9
+ import { type EngineNotice } from "./engine-notice.js";
10
+ import type { PeerCarrier } from "./peer-seat.js";
11
+ /** Where a peer echoed its connection's credentials into what it said about itself — the closed set `mcp.credential_echoed` names
12
+ * (`detail.where`). */
13
+ export declare const CREDENTIAL_ECHO_SITES: readonly ["server_info", "instructions", "tool_listing", "agent_card"];
14
+ export type CredentialEchoSite = (typeof CREDENTIAL_ECHO_SITES)[number];
15
+ /** What a peer's account is read with: the needle, and who hears that a site held it. */
16
+ export interface CredentialEcho {
17
+ readonly credentials: readonly string[];
18
+ readonly announce: (where: CredentialEchoSite) => void;
19
+ }
20
+ export declare const NO_CREDENTIAL_ECHO: CredentialEcho;
21
+ /** The drop reason of a tool whose name or input schema holds its connection's credential. */
22
+ export declare const CREDENTIAL_ECHO_DROP_REASON = "its name or input schema holds a credential this connection's requests carried (the server echoed it back); neither is rewritten, so the tool is not mounted";
23
+ /** A free text of the peer's with the needle erased in place (absent stays absent); a text that held it announces `where`. */
24
+ export declare function erasedEcho(text: string | undefined, echo: CredentialEcho, where: CredentialEchoSite): string | undefined;
25
+ /** Whether a NAME the peer gave holds the needle (announced as `where` when it does): such a name is refused, never rewritten. */
26
+ export declare function nameEchoes(name: string, echo: CredentialEcho, where: CredentialEchoSite): boolean;
27
+ /** A listed input schema as one text for the needle (its keys and values, JSON-escaped as the echo spellings expect); a schema JSON cannot
28
+ * carry reads as nothing (the schema gate refuses it on its own). */
29
+ export declare function schemaText(schema: unknown): string;
30
+ /** A listed tool the needle refuses — named with it, or its input schema holding it (the schema is the tool's structure: its property
31
+ * names are what the model sends, not prose to edit) — as its drop record, the name erased; `undefined` for a tool the needle leaves. */
32
+ export declare function echoedToolDrop(name: string, inputSchema: unknown, echo: CredentialEcho): {
33
+ tool: string;
34
+ reason: string;
35
+ } | undefined;
36
+ /** How a connection's account is read: its carrier's credentials, a site that held one announced through `announce`. */
37
+ export declare function carrierEcho(carrier: {
38
+ readonly credentials: PeerCarrier["credentials"] | readonly string[];
39
+ }, announce: ((where: CredentialEchoSite) => void) | undefined): CredentialEcho;
40
+ /** The server's `serverInfo` as its status projects it: `name` is a name (holding the needle, the record is not projected — never
41
+ * rewritten), `version` free text (erased in place). */
42
+ export declare function serverInfoOf(info: {
43
+ name: string;
44
+ version: string;
45
+ } | undefined, echo: CredentialEcho): {
46
+ name: string;
47
+ version: string;
48
+ } | undefined;
49
+ /** One materialization's announcer: each (peer, site) heard once, a throwing listener never a fault of the dial it describes. */
50
+ export declare function echoAnnouncer(onCredentialEchoed: ((peer: string, where: CredentialEchoSite) => void) | undefined): (peer: string, where: CredentialEchoSite) => void;
51
+ /** The runner's listener → `mcp.credential_echoed` (engine-notice.ts): the peer and the site, never a value; operator audience. */
52
+ export declare function credentialEchoNotice(onNotice: ((notice: EngineNotice) => void) | undefined, sessionId: string, runId: string, protocol: "mcp" | "a2a"): (server: string, where: CredentialEchoSite) => void;
@@ -0,0 +1,65 @@
1
+ import { deliverEngineNotice } from "./engine-notice.js";
2
+ import { eraseSentCredentials } from "./protocol-http-auth.js";
3
+ import { inlineUntrusted } from "./untrusted-text.js";
4
+ export const CREDENTIAL_ECHO_SITES = Object.freeze(["server_info", "instructions", "tool_listing", "agent_card"]);
5
+ export const NO_CREDENTIAL_ECHO = Object.freeze({ credentials: Object.freeze([]), announce: () => undefined });
6
+ export const CREDENTIAL_ECHO_DROP_REASON = "its name or input schema holds a credential this connection's requests carried (the server echoed it back); neither is rewritten, so the tool is not mounted";
7
+ export function erasedEcho(text, echo, where) {
8
+ if (typeof text !== "string")
9
+ return text;
10
+ const erased = eraseSentCredentials(text, echo.credentials);
11
+ if (erased !== text)
12
+ echo.announce(where);
13
+ return erased;
14
+ }
15
+ export function nameEchoes(name, echo, where) {
16
+ const echoed = typeof name === "string" && eraseSentCredentials(name, echo.credentials) !== name;
17
+ if (echoed)
18
+ echo.announce(where);
19
+ return echoed;
20
+ }
21
+ export function schemaText(schema) {
22
+ try {
23
+ return JSON.stringify(schema) ?? "";
24
+ }
25
+ catch {
26
+ return "";
27
+ }
28
+ }
29
+ export function echoedToolDrop(name, inputSchema, echo) {
30
+ if (!nameEchoes(name, echo, "tool_listing") && !nameEchoes(schemaText(inputSchema), echo, "tool_listing"))
31
+ return undefined;
32
+ return { tool: inlineUntrusted(eraseSentCredentials(name, echo.credentials)), reason: CREDENTIAL_ECHO_DROP_REASON };
33
+ }
34
+ export function carrierEcho(carrier, announce) {
35
+ return { credentials: carrier.credentials, announce: announce ?? NO_CREDENTIAL_ECHO.announce };
36
+ }
37
+ export function serverInfoOf(info, echo) {
38
+ if (info === undefined)
39
+ return undefined;
40
+ if (nameEchoes(info.name, echo, "server_info"))
41
+ return undefined;
42
+ return { name: info.name, version: erasedEcho(info.version, echo, "server_info") ?? info.version };
43
+ }
44
+ export function echoAnnouncer(onCredentialEchoed) {
45
+ const announced = new Set();
46
+ return (peer, where) => {
47
+ const key = `${peer}\u0000${where}`;
48
+ if (onCredentialEchoed === undefined || announced.has(key))
49
+ return;
50
+ announced.add(key);
51
+ try {
52
+ onCredentialEchoed(peer, where);
53
+ }
54
+ catch {
55
+ }
56
+ };
57
+ }
58
+ const SITE_WORDS = { server_info: "serverInfo", instructions: "instructions", tool_listing: "tool listing", agent_card: "agent card" };
59
+ export function credentialEchoNotice(onNotice, sessionId, runId, protocol) {
60
+ return (server, where) => deliverEngineNotice(onNotice, {
61
+ code: "mcp.credential_echoed",
62
+ message: `${protocol === "mcp" ? "MCP server" : "A2A peer"} "${inlineUntrusted(server, 120)}" echoed a credential its requests carried into its ${SITE_WORDS[where]} — the engine erased it there (a name holding it was refused, not rewritten); the endpoint repeats what it is sent, so check what it logs and publishes.`,
63
+ detail: { protocol, server, where, sessionId, runId },
64
+ });
65
+ }
@@ -94,11 +94,21 @@ export interface CredentialVocabulary {
94
94
  readonly policy: VocabularyPolicy;
95
95
  }
96
96
  /**
97
- * The URI scheme, bounded so it cannot backtrack: RFC 3986's scheme production plus `_`, at most 64 characters. An
98
- * unbounded `\w+` made every `://` pattern quadratic in the longest unbroken word run (one long base64 paste cost
99
- * seconds of synchronous CPU); the bound makes it linear and redacts no less on any URL.
97
+ * The URI scheme: RFC 3986's scheme production plus `_`, of any length, read from the START of its run of scheme characters
98
+ * (a run's leading digits and marks are taken into it, so the match keeps them). An unanchored unbounded `\w+` made every
99
+ * `://` pattern quadratic in the longest unbroken word run (one long base64 paste cost seconds of synchronous CPU), and a
100
+ * 64-character cap that replaced it missed a longer scheme; anchored at the run's start, each run is tried once — linear, and
101
+ * no scheme is too long to be read.
100
102
  */
101
103
  export declare const URI_SCHEME_SOURCE: string;
104
+ /**
105
+ * A URL's userinfo with the `@` that ends it, up to the LAST `@` before the host (a password may hold `@`): runs of characters
106
+ * that are no `/`, white space, `"` or `@`, each closed by an `@`. The class holds all of RFC 3986's userinfo (unreserved,
107
+ * pct-encoded, sub-delims — `'` among them — and `:`) and the characters a password written unencoded carries (`#`, `?`, …);
108
+ * `"` ends it, the quote of a string around the URL. The one userinfo grammar: every reader that removes a userinfo matches
109
+ * this, and each renders the match its own way.
110
+ */
111
+ export declare const URL_USERINFO_SOURCE: string;
102
112
  /** The fewest characters a string can have and still be read as a credential: the floor of a vendor-prefixed token's body
103
113
  * and of a bearer / authorization credential run in this table, and of the value rules of the env scrub. A shorter
104
114
  * string names no secret, whoever holds it. */