@sema-agent/core 7.60.0 → 7.62.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 (560) hide show
  1. package/CHANGELOG.md +917 -0
  2. package/README.md +2 -2
  3. package/dist/agents/agent-transcript-tool.d.ts +2 -2
  4. package/dist/agents/agent-transcript-tool.js +1 -1
  5. package/dist/agents/cascade.d.ts +71 -12
  6. package/dist/agents/cascade.js +61 -21
  7. package/dist/agents/composition-allowance.d.ts +53 -0
  8. package/dist/agents/composition-allowance.js +49 -0
  9. package/dist/agents/composition-placement.d.ts +29 -0
  10. package/dist/agents/composition-placement.js +24 -0
  11. package/dist/agents/cumulative-stats.d.ts +4 -0
  12. package/dist/agents/cumulative-stats.js +3 -0
  13. package/dist/agents/inherited-tool-pool.d.ts +5 -3
  14. package/dist/agents/inherited-tool-pool.js +2 -2
  15. package/dist/agents/list-agents-tool.d.ts +1 -1
  16. package/dist/agents/peer-held-queue.d.ts +27 -4
  17. package/dist/agents/peer-held-queue.js +81 -36
  18. package/dist/agents/peer-notice-route.d.ts +1 -1
  19. package/dist/agents/peer-notice-route.js +4 -3
  20. package/dist/agents/peer-notices.d.ts +4 -4
  21. package/dist/agents/peer-notices.js +8 -4
  22. package/dist/agents/peer-session-drain.d.ts +8 -1
  23. package/dist/agents/peer-session-drain.js +49 -10
  24. package/dist/agents/repair-loop.js +16 -6
  25. package/dist/agents/retain-ledger.js +3 -1
  26. package/dist/agents/roster-store.d.ts +1 -1
  27. package/dist/agents/roster-store.js +7 -4
  28. package/dist/agents/send-message-tool.d.ts +8 -10
  29. package/dist/agents/send-message-tool.js +43 -23
  30. package/dist/agents/subagent-completion-gate.d.ts +35 -0
  31. package/dist/agents/subagent-completion-gate.js +62 -0
  32. package/dist/agents/subagent-steps.d.ts +7 -6
  33. package/dist/agents/subagent.d.ts +36 -41
  34. package/dist/agents/subagent.js +245 -200
  35. package/dist/agents/suspend-guard.d.ts +47 -16
  36. package/dist/agents/suspend-guard.js +13 -4
  37. package/dist/agents/verify.d.ts +41 -14
  38. package/dist/agents/verify.js +41 -30
  39. package/dist/brain/anthropic.js +1 -0
  40. package/dist/brain/errors.d.ts +7 -1
  41. package/dist/brain/errors.js +6 -0
  42. package/dist/brain/failover.js +2 -1
  43. package/dist/brain/open-responses.js +1 -0
  44. package/dist/brain/openai.js +1 -0
  45. package/dist/brain/provider-dialect.d.ts +10 -0
  46. package/dist/brain/provider-dialect.js +13 -2
  47. package/dist/brain/stream-engine.d.ts +3 -0
  48. package/dist/brain/stream-engine.js +4 -0
  49. package/dist/core/agent-state.d.ts +1 -1
  50. package/dist/core/allow-entry.d.ts +59 -23
  51. package/dist/core/allow-entry.js +131 -38
  52. package/dist/core/ask-origin.d.ts +79 -0
  53. package/dist/core/ask-origin.js +76 -0
  54. package/dist/core/ask-question.d.ts +19 -13
  55. package/dist/core/ask-question.js +8 -2
  56. package/dist/core/auto-compaction.d.ts +2 -0
  57. package/dist/core/auto-compaction.js +2 -1
  58. package/dist/core/auto-mode.js +3 -5
  59. package/dist/core/background-agent-store.d.ts +7 -5
  60. package/dist/core/background-agent-store.js +12 -11
  61. package/dist/core/checkpoint-features.d.ts +722 -0
  62. package/dist/core/checkpoint-features.js +98 -0
  63. package/dist/core/checkpoint-requirements.d.ts +33 -5
  64. package/dist/core/checkpoint-requirements.js +18 -5
  65. package/dist/core/checkpoint-row-verdict.d.ts +99 -0
  66. package/dist/core/checkpoint-row-verdict.js +225 -0
  67. package/dist/core/checkpoint-store.d.ts +107 -738
  68. package/dist/core/checkpoint-store.js +45 -143
  69. package/dist/core/child-clamp-seats.d.ts +3 -2
  70. package/dist/core/child-clamp-seats.js +4 -3
  71. package/dist/core/closest-name.d.ts +13 -0
  72. package/dist/core/closest-name.js +35 -0
  73. package/dist/core/context-settings.js +3 -5
  74. package/dist/core/cross-boundary-taint.d.ts +1 -1
  75. package/dist/core/decision-receipt.d.ts +14 -1
  76. package/dist/core/decision-receipt.js +6 -3
  77. package/dist/core/delegation-frames.d.ts +13 -9
  78. package/dist/core/effective-path-target.js +2 -3
  79. package/dist/core/engine-attestation.d.ts +11 -1
  80. package/dist/core/engine-attestation.js +2 -0
  81. package/dist/core/engine-notice.d.ts +68 -21
  82. package/dist/core/engine-notice.js +9 -2
  83. package/dist/core/file-history-retention.d.ts +8 -0
  84. package/dist/core/file-history-retention.js +14 -11
  85. package/dist/core/file-history-store.d.ts +31 -1
  86. package/dist/core/file-history-store.js +31 -2
  87. package/dist/core/frame-settlement.d.ts +10 -0
  88. package/dist/core/frame-settlement.js +6 -1
  89. package/dist/core/fs-write-gate-policy.d.ts +3 -3
  90. package/dist/core/fs-write-gate-policy.js +8 -7
  91. package/dist/core/gate-fold.js +4 -3
  92. package/dist/core/gate-lanes.js +7 -4
  93. package/dist/core/gate-outcome.d.ts +40 -1
  94. package/dist/core/gate-outcome.js +10 -0
  95. package/dist/core/git-worktree-env.d.ts +7 -3
  96. package/dist/core/git-worktree-env.js +16 -13
  97. package/dist/core/governance-codes.d.ts +14 -4
  98. package/dist/core/governance-codes.js +19 -4
  99. package/dist/core/hooks.d.ts +25 -4
  100. package/dist/core/hooks.js +11 -4
  101. package/dist/core/host-floor.js +3 -5
  102. package/dist/core/human-input-projection.d.ts +1 -0
  103. package/dist/core/human-input-projection.js +3 -0
  104. package/dist/core/image-admission.d.ts +47 -7
  105. package/dist/core/image-admission.js +35 -4
  106. package/dist/core/input-author.d.ts +36 -0
  107. package/dist/core/input-author.js +39 -0
  108. package/dist/core/leg-identity.d.ts +62 -0
  109. package/dist/core/leg-identity.js +18 -0
  110. package/dist/core/locked-config.d.ts +4 -3
  111. package/dist/core/locked-config.js +5 -3
  112. package/dist/core/lsp.d.ts +5 -3
  113. package/dist/core/lsp.js +3 -2
  114. package/dist/core/mailbox-store.d.ts +85 -10
  115. package/dist/core/mailbox-store.js +31 -10
  116. package/dist/core/mcp-connection-pool.d.ts +6 -20
  117. package/dist/core/mcp-connection-pool.js +10 -28
  118. package/dist/core/mcp-failure.d.ts +76 -15
  119. package/dist/core/mcp-failure.js +60 -33
  120. package/dist/core/mcp-host-seat.d.ts +92 -53
  121. package/dist/core/mcp-host-seat.js +225 -46
  122. package/dist/core/mcp-probe.js +2 -2
  123. package/dist/core/mcp-server-link.d.ts +18 -6
  124. package/dist/core/mcp-server-link.js +19 -4
  125. package/dist/core/mcp-server-spec.d.ts +2 -1
  126. package/dist/core/mcp-session-end.d.ts +1 -2
  127. package/dist/core/mcp-session-end.js +1 -1
  128. package/dist/core/mcp.d.ts +6 -49
  129. package/dist/core/mcp.js +115 -111
  130. package/dist/core/media-byte-cap.d.ts +21 -46
  131. package/dist/core/media-byte-cap.js +55 -55
  132. package/dist/core/member-group.d.ts +7 -0
  133. package/dist/core/member-group.js +35 -0
  134. package/dist/core/memory-engine/consolidation-driver.d.ts +1 -1
  135. package/dist/core/memory-engine/consolidation.d.ts +1 -1
  136. package/dist/core/memory-engine/consolidation.js +7 -1
  137. package/dist/core/memory-engine/dual-root.d.ts +31 -0
  138. package/dist/core/memory-engine/dual-root.js +59 -11
  139. package/dist/core/memory-engine/engine.js +27 -24
  140. package/dist/core/memory-engine/file-backend.d.ts +13 -0
  141. package/dist/core/memory-engine/file-backend.js +35 -15
  142. package/dist/core/memory-engine/layout.d.ts +3 -0
  143. package/dist/core/memory-engine/layout.js +13 -3
  144. package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
  145. package/dist/core/memory-engine/memory-deployment.js +182 -0
  146. package/dist/core/memory-engine/sync-client.d.ts +39 -18
  147. package/dist/core/memory-engine/sync-client.js +72 -14
  148. package/dist/core/memory-engine/sync-report.d.ts +7 -4
  149. package/dist/core/memory-engine/sync.d.ts +9 -1
  150. package/dist/core/memory-vector.d.ts +1 -1
  151. package/dist/core/memory.d.ts +10 -10
  152. package/dist/core/mode-policy.d.ts +8 -8
  153. package/dist/core/mode-policy.js +8 -6
  154. package/dist/core/mods/agent-stations.d.ts +39 -4
  155. package/dist/core/mods/agent-stations.js +59 -10
  156. package/dist/core/mods/classic-events.d.ts +9 -1
  157. package/dist/core/mods/dollar.d.ts +94 -1
  158. package/dist/core/mods/dollar.js +13 -1
  159. package/dist/core/mods/extension-call.d.ts +15 -1
  160. package/dist/core/mods/extension-call.js +7 -2
  161. package/dist/core/mods/kernel/dispatch.d.ts +4 -3
  162. package/dist/core/mods/kernel/dispatch.js +4 -4
  163. package/dist/core/mods/kernel/events.d.ts +14 -3
  164. package/dist/core/mods/kernel/events.js +18 -15
  165. package/dist/core/mods/kernel/registration.d.ts +3 -0
  166. package/dist/core/mods/kernel/registration.js +5 -0
  167. package/dist/core/mods/kernel/site-rules.d.ts +6 -3
  168. package/dist/core/mods/kernel/site-rules.js +10 -2
  169. package/dist/core/mods/lifecycle-stations.d.ts +36 -4
  170. package/dist/core/mods/lifecycle-stations.js +44 -9
  171. package/dist/core/mods/session-append.d.ts +118 -0
  172. package/dist/core/mods/session-append.js +318 -0
  173. package/dist/core/mods/session-compact.d.ts +48 -0
  174. package/dist/core/mods/session-compact.js +194 -0
  175. package/dist/core/mods/session-receive.d.ts +93 -0
  176. package/dist/core/mods/session-receive.js +138 -0
  177. package/dist/core/mods/session-send.d.ts +72 -0
  178. package/dist/core/mods/session-send.js +88 -0
  179. package/dist/core/mods/stations.d.ts +88 -21
  180. package/dist/core/mods/stations.js +149 -11
  181. package/dist/core/mods/tool-call.d.ts +2 -0
  182. package/dist/core/mods/tool-call.js +4 -4
  183. package/dist/core/output-style.js +3 -4
  184. package/dist/core/own-property-receipt.d.ts +68 -2
  185. package/dist/core/own-property-receipt.js +45 -2
  186. package/dist/core/park-selfcheck.js +4 -2
  187. package/dist/core/path-identity.d.ts +11 -0
  188. package/dist/core/path-identity.js +4 -0
  189. package/dist/core/path-rule-binding.d.ts +3 -1
  190. package/dist/core/path-rule-binding.js +3 -1
  191. package/dist/core/peer-seat.d.ts +3 -3
  192. package/dist/core/peer-seat.js +20 -8
  193. package/dist/core/permission-rule-consent.d.ts +21 -5
  194. package/dist/core/permission-rule-consent.js +21 -1
  195. package/dist/core/permission-rule-model.d.ts +34 -11
  196. package/dist/core/permission-rule-model.js +47 -10
  197. package/dist/core/permission-rule-org.d.ts +1 -1
  198. package/dist/core/permission-rule-provider.js +4 -1
  199. package/dist/core/permission-rules.d.ts +4 -0
  200. package/dist/core/permission-rules.js +11 -16
  201. package/dist/core/read-root-candidate.js +1 -1
  202. package/dist/core/remote-env.d.ts +74 -26
  203. package/dist/core/remote-env.js +20 -0
  204. package/dist/core/resume-startup-cause.d.ts +5 -4
  205. package/dist/core/retention-policy.d.ts +24 -23
  206. package/dist/core/retention-policy.js +36 -2
  207. package/dist/core/retention.d.ts +4 -1
  208. package/dist/core/retired-keys.d.ts +4 -4
  209. package/dist/core/row-admission.d.ts +10 -0
  210. package/dist/core/row-admission.js +5 -0
  211. package/dist/core/runner/advisor-instructions.d.ts +2 -1
  212. package/dist/core/runner/advisor-instructions.js +2 -1
  213. package/dist/core/runner/announce-once-ledger.d.ts +4 -4
  214. package/dist/core/runner/assemble-result.d.ts +13 -3
  215. package/dist/core/runner/assemble-result.js +12 -7
  216. package/dist/core/runner/caller-roster.d.ts +12 -9
  217. package/dist/core/runner/caller-roster.js +5 -2
  218. package/dist/core/runner/checkpoint-scope.d.ts +16 -1
  219. package/dist/core/runner/checkpoint-scope.js +21 -0
  220. package/dist/core/runner/compact-session.js +18 -3
  221. package/dist/core/runner/compaction-call-options.d.ts +1 -1
  222. package/dist/core/runner/compaction-restate.d.ts +2 -2
  223. package/dist/core/runner/compaction-restate.js +4 -3
  224. package/dist/core/runner/construction-doors.d.ts +2 -2
  225. package/dist/core/runner/construction-doors.js +2 -2
  226. package/dist/core/runner/contracts.d.ts +116 -34
  227. package/dist/core/runner/cross-boundary-lane.d.ts +1 -1
  228. package/dist/core/runner/decide-continuation.d.ts +4 -2
  229. package/dist/core/runner/decide-continuation.js +7 -4
  230. package/dist/core/runner/delegation-owner.d.ts +43 -0
  231. package/dist/core/runner/delegation-owner.js +59 -0
  232. package/dist/core/runner/denial-limit-arms.d.ts +15 -21
  233. package/dist/core/runner/denial-limit-arms.js +17 -10
  234. package/dist/core/runner/expire-settle.d.ts +44 -0
  235. package/dist/core/runner/expire-settle.js +55 -0
  236. package/dist/core/runner/git-status-frame.d.ts +3 -3
  237. package/dist/core/runner/git-status-frame.js +2 -1
  238. package/dist/core/runner/halt-attribution.d.ts +2 -1
  239. package/dist/core/runner/halt-attribution.js +2 -1
  240. package/dist/core/runner/lineage-reroot-view.d.ts +56 -0
  241. package/dist/core/runner/lineage-reroot-view.js +108 -0
  242. package/dist/core/runner/local-claims.d.ts +17 -0
  243. package/dist/core/runner/local-claims.js +18 -0
  244. package/dist/core/runner/media-removed-seat.d.ts +46 -0
  245. package/dist/core/runner/media-removed-seat.js +88 -0
  246. package/dist/core/runner/park-commit.d.ts +2 -2
  247. package/dist/core/runner/permission-rule-lanes.d.ts +7 -2
  248. package/dist/core/runner/permission-rule-lanes.js +28 -9
  249. package/dist/core/runner/person-path-rows.d.ts +15 -0
  250. package/dist/core/runner/person-path-rows.js +27 -4
  251. package/dist/core/runner/placement-fence.d.ts +26 -0
  252. package/dist/core/runner/placement-fence.js +38 -0
  253. package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -1
  254. package/dist/core/runner/prepare-acquire-reconcile.js +7 -2
  255. package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
  256. package/dist/core/runner/prepare-ask-lane.js +4 -4
  257. package/dist/core/runner/prepare-boundary-parks.d.ts +4 -1
  258. package/dist/core/runner/prepare-boundary-parks.js +2 -2
  259. package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -0
  260. package/dist/core/runner/prepare-caps-and-workflow.js +2 -1
  261. package/dist/core/runner/prepare-config-doors.d.ts +6 -6
  262. package/dist/core/runner/prepare-config-doors.js +19 -21
  263. package/dist/core/runner/prepare-context-lane.d.ts +6 -2
  264. package/dist/core/runner/prepare-context-lane.js +13 -13
  265. package/dist/core/runner/prepare-delegation-surface.d.ts +9 -9
  266. package/dist/core/runner/prepare-delegation-surface.js +4 -5
  267. package/dist/core/runner/prepare-execution-env.d.ts +5 -2
  268. package/dist/core/runner/prepare-execution-env.js +7 -4
  269. package/dist/core/runner/prepare-gate-stations.d.ts +19 -14
  270. package/dist/core/runner/prepare-gate-stations.js +6 -4
  271. package/dist/core/runner/prepare-hands-readface.d.ts +6 -6
  272. package/dist/core/runner/prepare-hands-readface.js +32 -11
  273. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -0
  274. package/dist/core/runner/prepare-inherited-gate.js +10 -3
  275. package/dist/core/runner/prepare-lsp.d.ts +3 -0
  276. package/dist/core/runner/prepare-lsp.js +2 -2
  277. package/dist/core/runner/prepare-park-ask.d.ts +5 -2
  278. package/dist/core/runner/prepare-park-ask.js +4 -5
  279. package/dist/core/runner/prepare-policy-chain.d.ts +10 -21
  280. package/dist/core/runner/prepare-policy-chain.js +16 -25
  281. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  282. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -4
  283. package/dist/core/runner/prepare-prompt-inputs.js +3 -2
  284. package/dist/core/runner/prepare-question-face.d.ts +6 -4
  285. package/dist/core/runner/prepare-question-face.js +2 -2
  286. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  287. package/dist/core/runner/prepare-run-refs.js +2 -2
  288. package/dist/core/runner/prepare-suspend-saga.d.ts +11 -7
  289. package/dist/core/runner/prepare-suspend-saga.js +17 -7
  290. package/dist/core/runner/prepare-task.d.ts +1 -1
  291. package/dist/core/runner/prepare-task.js +61 -30
  292. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
  293. package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
  294. package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -0
  295. package/dist/core/runner/prepare-wiring-manifest.js +2 -1
  296. package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
  297. package/dist/core/runner/prepare-workspace-restore.js +10 -6
  298. package/dist/core/runner/read-root-grant.d.ts +1 -1
  299. package/dist/core/runner/read-root-grant.js +2 -1
  300. package/dist/core/runner/resume-admission.d.ts +8 -6
  301. package/dist/core/runner/resume-admission.js +23 -6
  302. package/dist/core/runner/resume-apply.d.ts +4 -0
  303. package/dist/core/runner/resume-apply.js +14 -5
  304. package/dist/core/runner/resume-checkpoint-screen.d.ts +9 -0
  305. package/dist/core/runner/resume-checkpoint-screen.js +4 -84
  306. package/dist/core/runner/resume-claim.d.ts +8 -3
  307. package/dist/core/runner/resume-claim.js +28 -12
  308. package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
  309. package/dist/core/runner/resume-internals-and-config.js +10 -1
  310. package/dist/core/runner/resume-preflight.d.ts +3 -2
  311. package/dist/core/runner/resume-preflight.js +13 -26
  312. package/dist/core/runner/retired-runner-deps.js +2 -0
  313. package/dist/core/runner/run-git-lane.d.ts +2 -0
  314. package/dist/core/runner/run-git-lane.js +6 -2
  315. package/dist/core/runner/run-harness-handlers.d.ts +2 -0
  316. package/dist/core/runner/run-harness-handlers.js +5 -4
  317. package/dist/core/runner/run-identity-wiring.d.ts +2 -2
  318. package/dist/core/runner/run-identity-wiring.js +14 -5
  319. package/dist/core/runner/run-leg.d.ts +3 -3
  320. package/dist/core/runner/run-leg.js +64 -36
  321. package/dist/core/runner/run-notification-lane.js +20 -2
  322. package/dist/core/runner/run-recovery-lanes.js +3 -2
  323. package/dist/core/runner/run-settle-and-teardown.js +12 -9
  324. package/dist/core/runner/run-stop-and-final-verify.js +2 -1
  325. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
  326. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  327. package/dist/core/runner/run-terminal-adoption.js +26 -17
  328. package/dist/core/runner/run-turn-boundary.js +34 -18
  329. package/dist/core/runner/runtask.d.ts +18 -3
  330. package/dist/core/runner/runtask.js +33 -17
  331. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  332. package/dist/core/runner/session-rule-policy.js +6 -1
  333. package/dist/core/runner/shell-env-withheld.d.ts +1 -1
  334. package/dist/core/runner/steering-preview.d.ts +9 -0
  335. package/dist/core/runner/steering-preview.js +5 -0
  336. package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
  337. package/dist/core/runner/stream-halt-verbs.js +4 -3
  338. package/dist/core/runner/stream-reap.d.ts +7 -6
  339. package/dist/core/runner/stream-reap.js +13 -16
  340. package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
  341. package/dist/core/runner/stream-settle-backstop.js +5 -3
  342. package/dist/core/runner/stream-steer-verb.d.ts +5 -2
  343. package/dist/core/runner/stream-steer-verb.js +16 -7
  344. package/dist/core/runner/terminal-account.d.ts +11 -1
  345. package/dist/core/runner/terminal-account.js +20 -0
  346. package/dist/core/runner/terminal-projection.d.ts +8 -2
  347. package/dist/core/runner/terminal-projection.js +2 -2
  348. package/dist/core/runner/tool-disclosure.d.ts +3 -0
  349. package/dist/core/runner/tool-disclosure.js +5 -2
  350. package/dist/core/runner/tool-end-body.d.ts +3 -3
  351. package/dist/core/runner/tool-end-body.js +1 -1
  352. package/dist/core/runner/tool-face-overlay.js +2 -0
  353. package/dist/core/runner/tool-output-projection.d.ts +3 -3
  354. package/dist/core/runner/tool-output-projection.js +7 -6
  355. package/dist/core/runner/tool-table-view.d.ts +56 -0
  356. package/dist/core/runner/tool-table-view.js +51 -0
  357. package/dist/core/runner/turn-attachments.d.ts +8 -2
  358. package/dist/core/runner/turn-attachments.js +2 -2
  359. package/dist/core/runner/void-verifier-pause.d.ts +33 -0
  360. package/dist/core/runner/void-verifier-pause.js +41 -0
  361. package/dist/core/runner-deps.d.ts +26 -27
  362. package/dist/core/secret-env.d.ts +19 -16
  363. package/dist/core/secret-env.js +45 -27
  364. package/dist/core/session-log-transfer.js +9 -10
  365. package/dist/core/session-policy-store.d.ts +1 -1
  366. package/dist/core/session-policy-store.js +5 -2
  367. package/dist/core/session-reconcile.d.ts +3 -2
  368. package/dist/core/session-reconcile.js +7 -4
  369. package/dist/core/session-store.d.ts +3 -1
  370. package/dist/core/session-store.js +10 -8
  371. package/dist/core/session.d.ts +16 -5
  372. package/dist/core/shell-confinement.d.ts +37 -0
  373. package/dist/core/shell-confinement.js +56 -0
  374. package/dist/core/skill-grant.js +1 -1
  375. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +8 -2
  376. package/dist/core/store-contracts/checkpoint-store-contract.js +83 -2
  377. package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
  378. package/dist/core/store-contracts/file-history-store-contract.js +25 -1
  379. package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
  380. package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
  381. package/dist/core/store-contracts/session-store-contract.js +22 -8
  382. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  383. package/dist/core/store-contracts/tool-result-store-contract.js +30 -0
  384. package/dist/core/task-event.d.ts +24 -9
  385. package/dist/core/task-limits.d.ts +5 -0
  386. package/dist/core/task-notification.d.ts +89 -12
  387. package/dist/core/task-notification.js +89 -14
  388. package/dist/core/task-registry-agent.d.ts +32 -50
  389. package/dist/core/task-registry-agent.js +36 -56
  390. package/dist/core/task-registry-monitor.d.ts +1 -1
  391. package/dist/core/task-registry-monitor.js +15 -60
  392. package/dist/core/task-registry-shared.d.ts +22 -112
  393. package/dist/core/task-registry-shared.js +3 -41
  394. package/dist/core/task-registry-workflow.js +5 -21
  395. package/dist/core/task-registry.d.ts +32 -62
  396. package/dist/core/task-registry.js +30 -110
  397. package/dist/core/task-result.d.ts +29 -12
  398. package/dist/core/task-spec-members.d.ts +39 -0
  399. package/dist/core/task-spec-members.js +92 -0
  400. package/dist/core/task-spec.d.ts +11 -11
  401. package/dist/core/task-tool-shape.d.ts +7 -57
  402. package/dist/core/task-tool-shape.js +7 -66
  403. package/dist/core/terminal-cause.d.ts +36 -6
  404. package/dist/core/terminal-cause.js +1 -0
  405. package/dist/core/tool-catalog-entries.js +2 -5
  406. package/dist/core/tool-check-reading.js +16 -10
  407. package/dist/core/tool-conformance.js +1 -2
  408. package/dist/core/tool-errors.d.ts +6 -3
  409. package/dist/core/tool-errors.js +2 -0
  410. package/dist/core/tool-face-reader.js +3 -2
  411. package/dist/core/tool-face.d.ts +8 -5
  412. package/dist/core/tool-face.js +1 -1
  413. package/dist/core/tool-name-aliases.d.ts +5 -29
  414. package/dist/core/tool-name-aliases.js +9 -5
  415. package/dist/core/tool-name-readings.d.ts +14 -3
  416. package/dist/core/tool-name-readings.js +2 -0
  417. package/dist/core/tool-policy.d.ts +109 -18
  418. package/dist/core/tool-policy.js +84 -14
  419. package/dist/core/tool-result-store.d.ts +23 -0
  420. package/dist/core/tool-result-store.js +3 -2
  421. package/dist/core/tool-roster.d.ts +4 -4
  422. package/dist/core/tool-spec.d.ts +23 -6
  423. package/dist/core/trace.d.ts +18 -1
  424. package/dist/core/types.d.ts +1 -1
  425. package/dist/core/types.js +1 -1
  426. package/dist/core/user-attachment.js +26 -21
  427. package/dist/core/workflow-journal-store.d.ts +1 -1
  428. package/dist/core/workflow-run-store.d.ts +2 -0
  429. package/dist/core/workflow-run-store.js +6 -5
  430. package/dist/core/workflow-settled-run.d.ts +5 -0
  431. package/dist/core/workflow-settled-run.js +7 -0
  432. package/dist/engine/execution-env/node-execution-env.d.ts +37 -9
  433. package/dist/engine/execution-env/node-execution-env.js +221 -22
  434. package/dist/engine/harness/agent-harness.d.ts +65 -18
  435. package/dist/engine/harness/agent-harness.js +90 -23
  436. package/dist/engine/harness/messages.d.ts +4 -3
  437. package/dist/engine/harness/messages.js +2 -2
  438. package/dist/engine/harness/types.d.ts +52 -7
  439. package/dist/engine/llm/media-removed.d.ts +14 -0
  440. package/dist/engine/llm/media-removed.js +9 -0
  441. package/dist/engine/llm/rejected-images.d.ts +35 -25
  442. package/dist/engine/llm/rejected-images.js +59 -10
  443. package/dist/engine/llm/types.d.ts +24 -3
  444. package/dist/engine/llm/types.js +7 -3
  445. package/dist/engine/loop/agent-loop.d.ts +6 -1
  446. package/dist/engine/loop/agent-loop.js +20 -11
  447. package/dist/engine/loop/types.d.ts +12 -3
  448. package/dist/engine/session/import-validate.js +7 -0
  449. package/dist/engine/session/parent-chain-guard.d.ts +3 -3
  450. package/dist/engine/session/parent-chain-guard.js +1 -1
  451. package/dist/engine/session/path-to-root.d.ts +18 -3
  452. package/dist/engine/session/path-to-root.js +15 -1
  453. package/dist/engine/session/repo-utils.d.ts +12 -1
  454. package/dist/engine/session/repo-utils.js +41 -0
  455. package/dist/engine/session/session.js +1 -1
  456. package/dist/engine/session/storage-base.d.ts +20 -0
  457. package/dist/engine/session/storage-base.js +28 -9
  458. package/dist/fixtures/index.d.ts +7 -5
  459. package/dist/fixtures/index.js +5 -3
  460. package/dist/index.d.ts +29 -18
  461. package/dist/index.js +19 -11
  462. package/dist/internal/harness-types.d.ts +2 -0
  463. package/dist/internal/harness.d.ts +4 -3
  464. package/dist/internal/harness.js +3 -2
  465. package/dist/internal/llm.d.ts +2 -1
  466. package/dist/internal/llm.js +1 -0
  467. package/dist/orchestration/goal.d.ts +6 -2
  468. package/dist/orchestration/goal.js +6 -3
  469. package/dist/orchestration/run-workflow-tool.d.ts +14 -17
  470. package/dist/orchestration/run-workflow-tool.js +43 -50
  471. package/dist/orchestration/workflow-types.d.ts +2 -2
  472. package/dist/orchestration/workflow.d.ts +7 -0
  473. package/dist/orchestration/workflow.js +10 -12
  474. package/dist/stores/file/background-agent-store.js +18 -15
  475. package/dist/stores/file/checkpoint-store.d.ts +2 -0
  476. package/dist/stores/file/checkpoint-store.js +13 -9
  477. package/dist/stores/file/file-history-store.js +3 -2
  478. package/dist/stores/file/fs-atomic.d.ts +0 -22
  479. package/dist/stores/file/fs-atomic.js +0 -17
  480. package/dist/stores/file/index.d.ts +7 -12
  481. package/dist/stores/file/index.js +25 -12
  482. package/dist/stores/file/ledger-tuning.d.ts +23 -0
  483. package/dist/stores/file/ledger-tuning.js +21 -0
  484. package/dist/stores/file/mailbox-store.js +42 -22
  485. package/dist/stores/file/memory-store.js +3 -2
  486. package/dist/stores/file/permission-rule-adopt.js +24 -21
  487. package/dist/stores/file/permission-rule-store.js +6 -3
  488. package/dist/stores/file/session-policy-store.js +3 -2
  489. package/dist/stores/file/session-store.d.ts +26 -7
  490. package/dist/stores/file/session-store.js +59 -35
  491. package/dist/stores/file/tool-result-store.d.ts +11 -0
  492. package/dist/stores/file/tool-result-store.js +57 -3
  493. package/dist/stores/file/usage-window-store.js +3 -2
  494. package/dist/stores/file/workflow-journal-store.d.ts +0 -2
  495. package/dist/stores/file/workflow-journal-store.js +3 -18
  496. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  497. package/dist/stores/file/workflow-run-store.js +15 -10
  498. package/dist/tools/fs/bash-program-position.d.ts +3 -2
  499. package/dist/tools/fs/bash-program-position.js +7 -7
  500. package/dist/tools/fs/dead-cwd.d.ts +5 -5
  501. package/dist/tools/fs/dead-cwd.js +4 -11
  502. package/dist/tools/fs/fs-bash-background-text.d.ts +6 -0
  503. package/dist/tools/fs/fs-bash-background-text.js +6 -0
  504. package/dist/tools/fs/fs-bash.d.ts +3 -18
  505. package/dist/tools/fs/fs-bash.js +37 -124
  506. package/dist/tools/fs/fs-pdf.js +8 -6
  507. package/dist/tools/fs/fs-read.js +2 -2
  508. package/dist/tools/fs/fs-shared.d.ts +28 -3
  509. package/dist/tools/fs/fs-shared.js +15 -0
  510. package/dist/tools/fs/index.d.ts +1 -1
  511. package/dist/tools/fs/index.js +4 -14
  512. package/dist/tools/fs/pdf.d.ts +4 -4
  513. package/dist/tools/fs/pdf.js +6 -6
  514. package/dist/tools/fs/read-deny-home.js +8 -1
  515. package/dist/tools/fs/read-deny.d.ts +26 -2
  516. package/dist/tools/fs/read-deny.js +9 -2
  517. package/dist/tools/fs/read-floor.d.ts +13 -5
  518. package/dist/tools/fs/read-floor.js +206 -2
  519. package/dist/tools/fs/removal-targets.js +2 -2
  520. package/dist/tools/fs/search.d.ts +3 -2
  521. package/dist/tools/fs/search.js +6 -6
  522. package/dist/tools/fs/shell-read-argv.d.ts +4 -2
  523. package/dist/tools/fs/shell-read-argv.js +14 -3
  524. package/dist/tools/fs/shell-read-bindings.d.ts +18 -2
  525. package/dist/tools/fs/shell-read-bindings.js +148 -68
  526. package/dist/tools/fs/shell-read-check.js +20 -4
  527. package/dist/tools/fs/shell-read-establish.js +25 -9
  528. package/dist/tools/fs/shell-read-functions.js +2 -2
  529. package/dist/tools/fs/shell-read-identity.d.ts +3 -1
  530. package/dist/tools/fs/shell-read-identity.js +4 -2
  531. package/dist/tools/fs/shell-read-judge.d.ts +7 -1
  532. package/dist/tools/fs/shell-read-judge.js +1 -1
  533. package/dist/tools/fs/shell-read-object-path.d.ts +59 -0
  534. package/dist/tools/fs/shell-read-object-path.js +119 -0
  535. package/dist/tools/fs/shell-read-plan.d.ts +8 -0
  536. package/dist/tools/fs/shell-read-plan.js +47 -30
  537. package/dist/tools/fs/shell-read-start.d.ts +66 -13
  538. package/dist/tools/fs/shell-read-start.js +89 -17
  539. package/dist/tools/fs/shell-read-workdir.d.ts +29 -8
  540. package/dist/tools/fs/shell-read-workdir.js +31 -8
  541. package/dist/tools/monitor.d.ts +8 -7
  542. package/dist/tools/monitor.js +12 -10
  543. package/dist/tools/worktree.d.ts +5 -1
  544. package/dist/tools/worktree.js +20 -17
  545. package/package.json +6 -3
  546. package/test/export-surface.snapshot.json +112 -42
  547. package/wire-changes/core-stores-sql@7.61.0.json +480 -0
  548. package/wire-changes/core-stores-sql@7.62.0.json +30 -0
  549. package/wire-changes/core@7.61.0.json +4405 -0
  550. package/wire-changes/core@7.62.0.json +2181 -0
  551. package/wire-changes/mods-kernel@7.61.0.json +65 -0
  552. package/wire-changes/mods-kernel@7.62.0.json +42 -0
  553. package/wire-changes/primitives@7.61.0.json +30 -0
  554. package/wire-changes/primitives@7.62.0.json +30 -0
  555. package/dist/core/consolidate-scope.d.ts +0 -93
  556. package/dist/core/consolidate-scope.js +0 -98
  557. package/dist/core/runner/image-removed-seat.d.ts +0 -12
  558. package/dist/core/runner/image-removed-seat.js +0 -19
  559. package/dist/core/runner/memory-consolidation.d.ts +0 -109
  560. package/dist/core/runner/memory-consolidation.js +0 -251
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The model's VIEW of the leg's tool table — the tools one request shows it.
3
+ *
4
+ * ONE rule: a tool whose every call the run's deny rules refuse is not shown. The reference removes a tool a whole-tool deny
5
+ * rule names from the tool pool before the model sees it (built-in and protocol tools alike; a deny wins, no allow is
6
+ * consulted). Here every face that can refuse a model's call answers by its own whole-tool reading, the one its refusal of a
7
+ * call already takes: the leg's effective policy (the fold the gate runs — the caller policy, the session and ancestor rules,
8
+ * the inherited parent policies; {@link ToolPolicy.wholeToolRefusals}), and the stored rules — the person's persisted rows and
9
+ * the org's rows, over one read of the store (`PermissionRuleLanes.wholeToolRefusals`). Only a WHOLE-TOOL rule speaks here: a
10
+ * rule about some calls of a tool (a command, a path, a value) leaves the tool shown, and its calls meet the gate.
11
+ *
12
+ * Read once per request, every reading side by side, each settled by the fold's own law ({@link toolPolicyWholeToolRefusals}):
13
+ * one that cannot answer (it throws, it does not answer in time) refuses nothing here, and the readings beside it stand — its
14
+ * calls still meet the gate, which is where a refusal is decided. The leg's tools stay
15
+ * mounted: a call the model makes anyway (a name it learned elsewhere) meets the gate and its rule's refusal. The view and
16
+ * the gate never decide the same question: the view says what the model is shown, the gate whether a call runs.
17
+ */
18
+ import type { Context, StreamFn } from "../../internal/llm.js";
19
+ import type { TurnPromptSnapshot } from "../../prompt-assembly/turn-snapshot.js";
20
+ import { type ToolFingerprintInput } from "../cache-break-detector.js";
21
+ import { type ToolRoster } from "../tool-roster.js";
22
+ import { type ToolPolicy } from "../tool-policy.js";
23
+ /** The faces the view reads, the roster whose face the gate stamps on a call of a tool, and the leg's prefix seats (the
24
+ * cache-break fingerprint and the turn snapshot name the tools ACTUALLY sent). */
25
+ export interface ToolTableViewFaces {
26
+ readonly policy: Pick<ToolPolicy, "wholeToolRefusals"> | undefined;
27
+ /** The stored rules — the person's rows and the org's, one read of the store for both. */
28
+ readonly stored: Pick<ToolPolicy, "wholeToolRefusals"> | undefined;
29
+ readonly roster: {
30
+ readonly current: ToolRoster | undefined;
31
+ };
32
+ readonly fpRef: {
33
+ current?: {
34
+ systemPrompt: string;
35
+ tools: ToolFingerprintInput[];
36
+ };
37
+ };
38
+ readonly turnSnapshotRef: {
39
+ current?: TurnPromptSnapshot;
40
+ };
41
+ }
42
+ export interface ToolTableView {
43
+ /** The request `context` as the model is shown it: its tools block without the tools the faces refuse whole (the same
44
+ * object when none is) — over one read of every face. */
45
+ request(context: Context, signal?: AbortSignal): Promise<Context>;
46
+ /** Whether the last request showed the tool (before any request: every tool) — the search space of a lane that answers the
47
+ * model about tools between requests (ToolSearch: a tool the model is not shown is no tool it can find). */
48
+ shows(toolName: string): boolean;
49
+ }
50
+ /** The leg's view — `undefined` when no face reads a whole-tool rule (every request then shows the tools block as built). */
51
+ export declare function createToolTableView(faces: ToolTableViewFaces): ToolTableView | undefined;
52
+ /** A request stream that rides the view: its tools block shows what {@link ToolTableView.request} shows. A leg whose view is
53
+ * not seated yet rides unchanged. */
54
+ export declare function streamShowingView(seat: {
55
+ readonly current?: ToolTableView;
56
+ }, stream: StreamFn): StreamFn;
@@ -0,0 +1,51 @@
1
+ import { toolsToFingerprintInputs } from "../cache-break-detector.js";
2
+ import { callFaceSeat, toolCallFaceOf } from "../tool-roster.js";
3
+ import { toolPolicyWholeToolRefusals } from "../tool-policy.js";
4
+ export function createToolTableView(faces) {
5
+ const read = toolPolicyWholeToolRefusals([faces.policy, faces.stored]);
6
+ if (read === undefined)
7
+ return undefined;
8
+ let refused = () => false;
9
+ let hidOne = false;
10
+ return {
11
+ async request(context, signal) {
12
+ const tools = context.tools;
13
+ if (tools === undefined || tools.length === 0)
14
+ return context;
15
+ const refuses = await read(signal);
16
+ const answers = new Map();
17
+ const judged = (toolName) => {
18
+ const known = answers.get(toolName);
19
+ if (known !== undefined)
20
+ return known;
21
+ const answer = refuses({ toolName, ...callFaceSeat(toolCallFaceOf(faces.roster.current, toolName)) });
22
+ answers.set(toolName, answer);
23
+ return answer;
24
+ };
25
+ refused = judged;
26
+ const shown = tools.filter((t) => !judged(t.name));
27
+ const hides = shown.length < tools.length;
28
+ if (hides || hidOne) {
29
+ const inputs = toolsToFingerprintInputs(shown);
30
+ const fingerprint = faces.fpRef.current;
31
+ if (fingerprint !== undefined && !sameNames(fingerprint.tools, shown))
32
+ fingerprint.tools = inputs;
33
+ faces.turnSnapshotRef.current?.refreshTools(inputs);
34
+ }
35
+ hidOne = hides;
36
+ return hides ? { ...context, tools: shown } : context;
37
+ },
38
+ shows: (toolName) => !refused(toolName),
39
+ };
40
+ }
41
+ function sameNames(a, b) {
42
+ return a.length === b.length && a.every((t, i) => t.name === b[i].name);
43
+ }
44
+ export function streamShowingView(seat, stream) {
45
+ return (model, context, options) => {
46
+ const view = seat.current;
47
+ if (view === undefined || context.tools === undefined || context.tools.length === 0)
48
+ return stream(model, context, options);
49
+ return view.request(context, options?.signal).then((shown) => stream(model, shown, options));
50
+ };
51
+ }
@@ -194,6 +194,11 @@ export interface TurnAttachment {
194
194
  * run: the caller runs it on the receipt of the message carrying the frame (`FrameReceipt`). A frame the lane cap
195
195
  * drops is not returned, so its step never runs and the frame is due again; a clipped frame keeps it. */
196
196
  commit?: () => void;
197
+ /** The bound, in characters, of this frame's `steering_injected` echo when the shared display budget would cut it
198
+ * mid-row: a frame whose body is a list of rows its renderer already bounds states the bound of that list (here, the
199
+ * lane cap it rides under) so the echo is the list the model received, not the first row or two of it. Absent = the
200
+ * shared budget ({@link import("./steering-preview.js").STEERING_PREVIEW_BUDGET}). */
201
+ echoBound?: number;
197
202
  }
198
203
  /** H4 — the thin projection of a todo list kept run-local (NEVER the wire-capped `tool_end.structured` card).
199
204
  * Pure CONTENT memory: the write-window anchor lives on {@link AttachmentState.todoLastWriteTurn}
@@ -975,9 +980,10 @@ export declare function commitSkillsListing(state: AttachmentState, entries: Rea
975
980
  * neither lane it rides has a cap above this one: the stable system-prompt lane has none, and the
976
981
  * `mcp_instructions` attachment is intact-class (the bundle cap never clips it), so this bound IS the
977
982
  * producer's promise — without it a single server could pin an arbitrarily large blob into the cached
978
- * prompt prefix or into one boundary frame.
983
+ * prompt prefix or into one boundary frame. The number is the reference's own, the same as the tool-description cap in
984
+ * `mcp.ts` ((cli309.js:274179) "MCP server instructions from 2,048 to 4,096 characters").
979
985
  */
980
- export declare const MCP_INSTRUCTIONS_MAX_CHARS: number;
986
+ export declare const MCP_INSTRUCTIONS_MAX_CHARS = 4096;
981
987
  /**
982
988
  * The ONE way MCP server-provided instruction text becomes model-facing, used by BOTH the
983
989
  * stable system-prompt lane (prepare-task's `# MCP Server Instructions` block) and
@@ -210,7 +210,7 @@ export function collectDueAttachments(state, inp) {
210
210
  }
211
211
  if (inp.config.backgroundTasks && state.postCompactPending) {
212
212
  if (inp.backgroundTasks !== undefined && inp.backgroundTasks.length > 0) {
213
- (out ??= []).push({ source: "background_tasks", body: renderBackgroundTasks(inp.backgroundTasks), commit: () => void (state.postCompactPending = false) });
213
+ (out ??= []).push({ source: "background_tasks", body: renderBackgroundTasks(inp.backgroundTasks), echoBound: ATTACHMENT_BYTE_CAP, commit: () => void (state.postCompactPending = false) });
214
214
  }
215
215
  else {
216
216
  state.postCompactPending = false;
@@ -684,7 +684,7 @@ export function renderSkillsListingDelta(state, entries, budget) {
684
684
  export function commitSkillsListing(state, entries) {
685
685
  state.announcedSkills = new Map(entries.map((e) => [e.name, e.description]));
686
686
  }
687
- export const MCP_INSTRUCTIONS_MAX_CHARS = 8 * 1024;
687
+ export const MCP_INSTRUCTIONS_MAX_CHARS = 4096;
688
688
  export function fenceMcpServerInstructions(server, text) {
689
689
  const fence = delimitUntrustedWithClip(`MCP server "${server}" instructions`, text, MCP_INSTRUCTIONS_MAX_CHARS);
690
690
  return fence.clipped ? `${fence.text}\n${MCP_INSTRUCTIONS_TRUNCATION_NOTE}` : fence.text;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `Runner.voidVerifierPause` — the verb that voids a verification gate's VERIFIER card: the card a verifier leg parks records
3
+ * `CheckpointState.compositionLeg` with entry `verify`, and that recorded leg is what this verb reads, the same member a host
4
+ * reads to tell a verifier's card from one its own run's resume reaches. One reading, one seat: a card that records no leg, or
5
+ * another entry's, is refused before anything is settled (`resume.composition_mismatch`), so the verb never voids a card the
6
+ * gate did not mint.
7
+ *
8
+ * Voiding = the settle every in-Runner terminal settle makes (`expireRowWithDuty`: the single-shot `expire` CAS — the row ends
9
+ * `expired` exactly as an expiry leaves it — with the duty its win carries: the parked-constraint entry evicted, the paused env
10
+ * this process holds destroyed) plus the one thing an expiry alone leaves behind: the verifier session's PIN, taken at the park
11
+ * mint, is released here — the same end state the resumed run's terminal leaves (unpinned, not released: the transcript stays
12
+ * the session store's to evict). Only the CAS winner unpins; a card another settler already took (a resume won, the reaper or
13
+ * an earlier void expired it) answers `false` and its winner owns the unpin. An unpin that throws or does not settle is said on
14
+ * `onError` and thrown (`checkpoint.void_unpin_failed`): the card IS voided, its session still pinned — never a silent `true`.
15
+ */
16
+ import { type CheckpointToken } from "../checkpoint-store.js";
17
+ import type { SessionStore } from "../session.js";
18
+ import type { InheritedGate, RunnerDepsSeat, SuspendReap } from "./contracts.js";
19
+ import type { LocalClaims } from "./local-claims.js";
20
+ export interface VoidVerifierPauseInput {
21
+ /** borrowed-readonly — the verifier card's token (`VerificationOutcome.verifierPause.checkpointToken`). */
22
+ token: CheckpointToken;
23
+ /** borrowed-readonly — the Runner's deployment deps, read LIVE (the checkpoint store; `onError` for the bounded legs). */
24
+ runner: RunnerDepsSeat;
25
+ /** borrowed-readonly — the Runner's session store: the card's session is unpinned on a win. */
26
+ sessions: SessionStore;
27
+ /** borrowed-mutable — the Runner's same-Runner claims (this void's attempt opens and closes its own), parked-constraint registry and suspended-env reap handles. */
28
+ locallyClaimedTokens: LocalClaims;
29
+ parentConstraintRegistry: Map<CheckpointToken, NonNullable<InheritedGate["parentConstraints"]>>;
30
+ suspendedEnvReaps: Map<CheckpointToken, SuspendReap>;
31
+ }
32
+ /** Void the verifier card `token` names: `true` = this call voided it and unpinned its session, `false` = already settled (throws `checkpoint.void_unpin_failed` when voided but not unpinned). */
33
+ export declare function voidVerifierPause(input: VoidVerifierPauseInput): Promise<boolean>;
@@ -0,0 +1,41 @@
1
+ import { CheckpointError, resolveCheckpointStore } from "../checkpoint-store.js";
2
+ import { compositionLegRecord } from "./checkpoint-scope.js";
3
+ import { expireRowWithDuty } from "./expire-settle.js";
4
+ import { settleTeardownLeg } from "./teardown-bounded.js";
5
+ export async function voidVerifierPause(input) {
6
+ const { token, runner, sessions, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps } = input;
7
+ const store = resolveCheckpointStore({}, runner.deps);
8
+ if (store === undefined)
9
+ throw new CheckpointError("checkpoint.not_found", "no CheckpointStore wired (RunnerDeps.checkpointStore) — there is no verifier card to void");
10
+ const cp = await store.get(token);
11
+ if (cp === null)
12
+ throw new CheckpointError("checkpoint.not_found", "no checkpoint row for this token — nothing was voided");
13
+ const leg = compositionLegRecord(cp.state.compositionLeg);
14
+ if (leg?.entry !== "verify") {
15
+ throw new CheckpointError("resume.composition_mismatch", `this card was not parked by a verification gate's verifier leg (it records ${leg === undefined ? "no composition leg" : `a ${leg.entry} leg`}) — ` +
16
+ "voidVerifierPause voids only a verifier's own card; nothing was settled and the row is as it was");
17
+ }
18
+ const report = (err, sessionId) => {
19
+ try {
20
+ runner.deps.onError?.(err, { phase: "config", sessionId });
21
+ }
22
+ catch {
23
+ }
24
+ };
25
+ const won = await expireRowWithDuty({
26
+ token, scope: cp.scope, store, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps,
27
+ destroyLabel: "voided verifier pause env destroy",
28
+ onDestroyError: report,
29
+ });
30
+ if (!won)
31
+ return false;
32
+ let unpinErr;
33
+ await settleTeardownLeg(() => sessions.unpin?.(cp.sessionId), "sessions.unpin (voided verifier pause)", (err) => {
34
+ unpinErr = err;
35
+ report(err, cp.sessionId);
36
+ });
37
+ if (unpinErr !== undefined) {
38
+ throw new CheckpointError("checkpoint.void_unpin_failed", `the verifier card was voided (the row is expired) but its session's pin was not released: ${unpinErr.message} — the session stays pinned until it is unpinned`);
39
+ }
40
+ return true;
41
+ }
@@ -71,7 +71,7 @@ export interface ResumePreflightInfo {
71
71
  * the resume entry's identity-continuity rung already refused a contradicting supplied principal
72
72
  * before this hook runs, so a present value IS the resumed leg's identity. */
73
73
  principal?: string;
74
- /** provider / deviceId / mountPath — the placement facts: the row handle's one frozen copy (as `resumeWorkspace`, `priorHandle`). */
74
+ /** provider / deviceId / mountPath — the placement facts: the row handle's one frozen copy (as the restore's `priorHandle`). */
75
75
  workspaceHandle?: Readonly<import("./remote-env.js").WorkspaceHandle>;
76
76
  gateKind: import("./checkpoint-store.js").CheckpointGate["kind"];
77
77
  }
@@ -284,7 +284,7 @@ export interface RunnerDeps {
284
284
  * tool that is ITSELF classified polluting still marks pre-call.
285
285
  * ACCEPTED COST (the deployment's to own, stated as mechanism, not as absence of risk): under
286
286
  * `"attested-only"` a BACKGROUND child's real external contact does not mark this session — its
287
- * content re-enters through the TaskOutput result, the task-notification injection, or the
287
+ * content re-enters through the task-notification injection, a stored result read back by ref, or the
288
288
  * AgentTranscript step summaries, none of which carries an attestation — and a foreground child
289
289
  * that ended abnormally (crash/salvage) is likewise not marked on its face alone (the chain still
290
290
  * records `incomplete`). Already-marked sessions are never retroactively cleaned; the key only
@@ -464,6 +464,12 @@ export interface RunnerDeps {
464
464
  * deployment default cannot override a load-bearing containment wall) — TaskSpec.readFace's own
465
465
  * "open" there is the genuine per-task contradiction, and that one still refuses loudly (#123).
466
466
  *
467
+ * `RunnerDeps` is one Runner's deployment statement: a run resolves its read face from the deployment seat of the Runner that
468
+ * runs it, two lanes that need two read faces are two Runners (they may share a session store, a governance seat and a notice
469
+ * port), and a delegated child takes the deployment statement of the Runner its `Agent` tool is bound to
470
+ * (`createSubagentTool({ runner })`) — the parent's `roots` still reaches it through the restricting clamp, so the stricter side
471
+ * wins.
472
+ *
467
473
  * A LIVE seat: `Runner.swapDeps({ readFace })` replaces it without a restart (the same natural
468
474
  * snapshot the model catalog has — a leg reads the seat at its prepare and keeps that reading; every
469
475
  * later prepare reads the new declaration; announced as `config.read_face_swapped`). A host whose
@@ -636,9 +642,10 @@ export interface RunnerDeps {
636
642
  * deployment's), and a call it clears is attributed to it (`decisionReason: "deployment_rule"`). Lives for the Runner —
637
643
  * read once at construction: a value that is not a list of strings refuses construction (`config.invalid_permission_rules`,
638
644
  * with its issues), and the entries that read as nothing are announced once, when the Runner is built
639
- * (`permission.allowed_tool_not_granted`, `detail.entries[].source: "deployment"`).
645
+ * (`permission.allowed_tool_not_granted`, `detail.entries[].source: "deployment"`). A member may carry its rule set's anchors
646
+ * (`{ rule, pathBases }`), read as the request's list reads them.
640
647
  */
641
- allowedTools?: readonly string[];
648
+ allowedTools?: readonly import("./allow-entry.js").AllowListEntry[];
642
649
  /**
643
650
  * design/182 §9 — DECLARE that this deployment drives cloud sync (`syncPermissionRules`) for the
644
651
  * wired rule store. Purely a disclosure input: it is reported as `permissionRules.syncWired` on the
@@ -902,7 +909,7 @@ export interface RunnerDeps {
902
909
  * history (opt-in; in-process runs are still subscribable without it). */
903
910
  workflowRunStore?: import("./workflow-run-store.js").WorkflowRunStore;
904
911
  /** design/151 S1a — the durable background-agent execution ledger (the `workflowRunStore` twin for
905
- * `a*` rows): registrations write restart-surviving rows, and the auto-mounted TaskOutput/TaskStop
912
+ * `a*` rows): registrations write restart-surviving rows, and the auto-mounted TaskStop and the host task poll
906
913
  * fall back to it on a live-registry miss (terminal snapshots / honest cross-instance reads, behind
907
914
  * the fail-closed §3.1c predicate). Opt-in; absent ⇒ the in-memory-only pre-151 lifecycle. A
908
915
  * deployment that composes its own Agent tool MUST pass the SAME instance as
@@ -910,7 +917,7 @@ export interface RunnerDeps {
910
917
  * verify the pairing (the Agent tool is deployment-composed), and a half-wired deployment is a
911
918
  * SILENT degrade: reader-only ⇒ no rows ever exist; writer-only ⇒ the auto-mounted fallbacks
912
919
  * here never see them (RB-37). Third consumer: delegated
913
- * CHILDREN's auto-mounted TaskOutput/TaskStop/AgentTranscript read THIS deps too (prepare-task
920
+ * CHILDREN's auto-mounted TaskStop/AgentTranscript read THIS deps too (prepare-task
914
921
  * wires them from the child's runner) — a sub-runner with different deps splits the read face. */
915
922
  backgroundAgentStore?: import("./background-agent-store.js").BackgroundAgentStore;
916
923
  /** design/151 §7 S3c — the durable SendMessage mailbox (delivery-ladder third rung): a message to a
@@ -928,8 +935,8 @@ export interface RunnerDeps {
928
935
  * `DELEGATION_MAX_PER_SESSION_DEFAULT`). Key = `(scope, rootSessionId)`, full depth (grandchildren
929
936
  * share the tree's pool). `maxConcurrent` bounds the tree's RUNNING children of every local lane:
930
937
  * running/pending a* handles in this process's registry PLUS the synchronous and forked children in
931
- * flight in this process (parked does not burn a slot — a suspension is not concurrency; a revival
932
- * claim counts like a spawn); `maxCumulativePerSession` bounds the RETAINED-WINDOW cumulative count
938
+ * flight in this process (parked burns no slot; a CONTINUATION — a revival or a wake — counts but is
939
+ * never refused, so the count can pass the cap); `maxCumulativePerSession` bounds the RETAINED-WINDOW cumulative count
933
940
  * (registry-retained + store-retained rows, plus those same in-flight local children — a reaped row
934
941
  * returns its quota, and a synchronous child retains nothing so it leaves the window when it
935
942
  * settles; deliberately NOT CC's lifetime-monotonic session counter, which would require a
@@ -1365,8 +1372,8 @@ export interface RunnerDeps {
1365
1372
  * errors and do not affect the run, which the engine otherwise prints via `console.warn` (e.g. a
1366
1373
  * configured timeout/env value discarded in favor of another). When wired, a notice goes HERE
1367
1374
  * INSTEAD of `console.warn` (structured replaces the console line — a host forwarding notices to
1368
- * its own surface must not show every fact twice); when absent, the historic `console.warn` line
1369
- * is printed verbatim, so an unwired build keeps its exact loudness. Swallow-guarded at every
1375
+ * its own surface must not show every fact twice); when absent, the default seat the host installed
1376
+ * (`setDefaultEngineNoticeSeat`) takes it, else the historic `console.warn` line is printed verbatim. Swallow-guarded at every
1370
1377
  * emission point (`onError`/`tracer` posture): neither a throwing sink nor an async sink's
1371
1378
  * rejected promise ever affects the run. A PRESENT NON-function value (an untyped host wiring
1372
1379
  * null/junk) is a bad deployment value, not a wired sink: every notice then falls back to the
@@ -1464,23 +1471,15 @@ export interface RunnerDeps {
1464
1471
  */
1465
1472
  cacheBreakDetection?: boolean;
1466
1473
  /**
1467
- * Aggregate inline-MEDIA (image) byte budget for the request (batch-C/§17.2 sibling of the text budget;
1468
- * `tengu_media_byte_cap` in the reference). Image reads (`Read` → ImageContent) are per-image-capped but
1469
- * accumulate across turns; this bounds the SUM in the request by stripping the OLDEST images (replaced with a
1470
- * marker) — request-only, non-destructive (the durable session keeps the image; the model can re-Read it).
1471
- * The same budget bounds the media of one `tool_end.output` (spent there as base64 on the wire, x 4/3); both readers
1472
- * read it through `mediaBudgetBytes`. Default {@link AGGREGATE_MEDIA_BUDGET_BYTES}; set `Infinity`/`0` to disable. A
1473
- * non-number, `NaN` or a negative is refused at `new Runner` (`config.invalid_argument`), never read as "no budget".
1474
- */
1475
- mediaByteCapBytes?: number;
1476
- /** Optional telemetry fired when {@link mediaByteCapBytes} strips media in a request (CC's
1477
- * `tengu_media_byte_cap_stripped` fields). Pure observability — no effect on the request. */
1478
- onMediaStripped?: (info: {
1479
- totalBytes: number;
1480
- limitBytes: number;
1481
- removedCount: number;
1482
- removedBytes: number;
1483
- }) => void;
1474
+ * The request's media budget, in base64 characters (the unit a provider counts; CC `tengu_media_byte_cap`): the media
1475
+ * blocks a conversation holds accumulate across turns, and past the budget a request leaves the OLDEST out (each slot a
1476
+ * line saying so; the person hears it once per block per session, `context.media_removed` with reason `media_budget`) —
1477
+ * request-only, the session keeps every block. The same budget bounds the media of one `tool_end.output`; both readers
1478
+ * read it through `requestMediaBudget`. Absent ⇒ `IMAGE_ADMISSION.request.budgetBase64Chars`; `0` or `Infinity` ⇒ no
1479
+ * budget (the media-block count limit still holds). Else a whole number no smaller than twice
1480
+ * `IMAGE_ADMISSION.request.hysteresisBase64Chars`; anything else is refused at `new Runner` (`config.invalid_argument`).
1481
+ */
1482
+ mediaBudgetBase64Chars?: number;
1484
1483
  /**
1485
1484
  * Deferred-tool disclosure policy (design/36). Two rules govern deferral. ① The caller's list is
1486
1485
  * literal: {@link TaskSpec.deferTools} names defer on every request, `ToolSpec.alwaysLoad` /
@@ -4,7 +4,7 @@
4
4
  * A child the engine spawns may run what the MODEL chose (a tool shell, a gate over model-written code, a language
5
5
  * server). Under the `"scrub"` policy (the default) it inherits every variable but those the judgment below names —
6
6
  * deleted whole, never rewritten; `"all"` and a `string[]` allow list are the caller's explicit alternatives
7
- * ({@link inheritedHostEnv}). Whatever the policy, an entry that is this deployment's own credential is never inherited:
7
+ * ({@link inheritedHostEnv}). Whatever the policy, an entry that is one of the engine's own credentials is never inherited:
8
8
  * its name is one the deployment declared, or its value equals a credential value the deployment declared or the
9
9
  * engine holds ({@link declareWithheldEnv}, {@link holdOwnCredentialValues}). One judgment per variable ({@link classifySecretEnvEntry}), the first rule that answers:
10
10
  * 1. exempt — git's environment config and the proxy variables, handed on as written ({@link isExemptEnvName});
@@ -27,8 +27,8 @@ import { type EngineNotice } from "./engine-notice.js";
27
27
  * Reads the first {@link VALUE_SCAN_LIMIT} code units. The value half of the judgment, exported apart from the env
28
28
  * entry's exemptions ({@link isExemptEnvName}): a caller holding a value that is no environment variable asks this. */
29
29
  export declare function looksLikeCredentialValue(value: string): boolean;
30
- /** Which rule withheld an entry: one of the scrub's rules, or `own-credential` — the entry is this deployment's own
31
- * credential (its name is declared, or its value equals a declared or engine-held credential value:
30
+ /** Which rule withheld an entry: one of the scrub's rules, or `own-credential` — the entry is one of the engine's own
31
+ * credentials (its name is declared, or its value equals a declared or engine-held credential value:
32
32
  * {@link declareWithheldEnv}), which every policy withholds. */
33
33
  export type SecretEnvFindingKind = "exact-name" | "name-rule" | "namespace-rule" | "prefix-rule" | "value-rule" | "own-credential";
34
34
  /** One env entry withheld (deleted) from a child's environment: its name — never its value, so the record is
@@ -52,9 +52,9 @@ export declare function isSecretEnvKey(key: string, value?: string): boolean;
52
52
  export declare function scrubSecretEnv(env: NodeJS.ProcessEnv, findings?: SecretEnvFinding[]): NodeJS.ProcessEnv;
53
53
  /** How much of this process's environment a child spawned on this host inherits — the `inheritEnv` value. */
54
54
  export type InheritEnvPolicy = "all" | "scrub" | string[];
55
- /** What {@link declareWithheldEnv} takes: this deployment's own credentials in this process's environment. */
55
+ /** What {@link declareWithheldEnv} takes: the engine's own credentials in this process's environment. */
56
56
  export interface WithheldEnvDeclaration {
57
- /** Names of variables that are this deployment's own credentials: never inherited, and an allow list naming one is refused. */
57
+ /** Names of variables that are the engine's own credentials: never inherited, and an allow list naming one is refused. */
58
58
  readonly names: readonly string[];
59
59
  /** Credential values this deployment holds: an inherited entry whose value equals one — the same string, compared
60
60
  * whole, never as a part — is never inherited, whatever its name. A value must be a credential: not white space only,
@@ -76,10 +76,10 @@ export declare function isBlankCredential(value: string): boolean;
76
76
  * one-letter key) is left in the words, as it is left to every child. */
77
77
  export declare function namesASecret(value: string): boolean;
78
78
  /**
79
- * Declare this deployment's OWN credentials in this process's environment — the engine's or its host's: an approval
79
+ * Declare the engine's own credentials in this process's environment — the engine's or its host's: an approval
80
80
  * bearer, a service token — by name and by value. From then on no child spawned on this host inherits one, whatever the
81
81
  * policy: every spawn site reads its environment through {@link inheritedHostEnv}, which subtracts from `"all"`, from the
82
- * scrub's result and from an allow list's every entry that is this deployment's own credential (each one present is a
82
+ * scrub's result and from an allow list's every entry that is one of the engine's own credentials (each one present is a
83
83
  * finding of kind `own-credential`), and {@link inheritEnvPolicyProblem} refuses an allow list naming a declared name.
84
84
  * A NAME is compared as the platform compares variable names: exactly, but case-blind on Windows. A VALUE is compared
85
85
  * whole, as the same string: an entry holding it as a part (`Bearer <value>`, a URL, an encoding of it) is not its value.
@@ -97,7 +97,8 @@ export declare function namesASecret(value: string): boolean;
97
97
  * word, one character repeated, fewer than {@link CREDENTIAL_MIN_CHARS} characters — withholding it would take a setting
98
98
  * such as `CI=true` from every child) or that is, in this process's environment now, the value of such a variable —
99
99
  * throws and leaves the declaration as it was. A value listed twice is the one value (the declaration is a set). No
100
- * refusal sentence repeats a value.
100
+ * refusal sentence repeats a value. A value refused as no credential is the one value the refusal names: the host was
101
+ * told of it there, so the engine's intake ({@link holdOwnCredentialValues}) does not say it again.
101
102
  *
102
103
  * Two Windows readings, measured on a real machine: a withheld name that the child's own shell or runtime re-creates
103
104
  * with a DEFAULT of its own (`ComSpec`, `PATHEXT`, `HOME`, `CommonProgramFiles`, …) shows up in the child's table with
@@ -121,9 +122,11 @@ export declare function declareWithheldEnv(table: WithheldEnvDeclaration): void;
121
122
  * gateway is told to be handed) is not taken in: its holder uses it as given (it is no bad value), and the variables
122
123
  * that hold the same string stay with every child. Said once per process per value, never the value, as the notice
123
124
  * `config.credential_not_withheld` through the engine's one notice throat ({@link deliverEngineNotice}): to `onNotice`
124
- * when the intake has the structured seat in hand (the `RunnerDeps` receipt at `new Runner`), else as that notice's
125
- * line on `console.warn` (the throat's own arm for an absent seat — a brain's construction, a request's route reading,
126
- * a peer's dial, a directly built distiller seat). A value that is, in this process's
125
+ * when the intake has the structured seat in hand (the `RunnerDeps` receipt at `new Runner`), else to the process's
126
+ * default seat ({@link import("./engine-notice.js").setDefaultEngineNoticeSeat}) when a host installed one, else as that
127
+ * notice's line on `console.warn` (the throat's own arm for an absent seat — a brain's construction, a request's route
128
+ * reading, a peer's dial, a directly built distiller seat). A value the host's declaration refused as no credential
129
+ * ({@link declareWithheldEnv}) was told in that refusal and is on the same account: not said again. A value that is, in this process's
127
130
  * environment now, the value of a variable every child is handed whatever the spawn passes cannot be withheld: the intake
128
131
  * throws (`config.invalid_argument`, the variable named, never the value) and takes nothing in — the brain is not built,
129
132
  * the peer is not dialed.
@@ -160,7 +163,7 @@ export declare function credentialHeaderValues(headers: Readonly<Record<string,
160
163
  /** Test seam: never called by production code (a host re-declares `{ names: [], values: [] }`; what the engine took in stays). */
161
164
  export declare function __resetWithheldEnv(): void;
162
165
  /**
163
- * THE environment a child spawned ON THIS HOST inherits: the policy's arm, less this deployment's own credentials — a
166
+ * THE environment a child spawned ON THIS HOST inherits: the policy's arm, less the engine's own credentials — a
164
167
  * declared name, or a value equal to a declared or engine-held credential value ({@link declareWithheldEnv},
165
168
  * {@link holdOwnCredentialValues}). The arms: `"scrub"` (and absent) is this process's environment through
166
169
  * {@link scrubSecretEnv}; `"all"` is this process's environment as written; a `string[]` is exactly the named
@@ -198,8 +201,8 @@ export declare function hostChildEnv(policy: InheritEnvPolicy | undefined, ...gr
198
201
  export declare function inheritEnvPolicyProblem(value: unknown): string | undefined;
199
202
  /** Test seam: never called by production code. */
200
203
  export declare function __resetSecretEnvScrubNoticeAnnouncement(): void;
201
- /** What both disclosures say about one set of findings: every withheld name, and those that are this deployment's own
202
- * credential — withheld under every policy — whichever rule withheld them first ({@link ownCredentialJudge}, the
204
+ /** What both disclosures say about one set of findings: every withheld name, and those that are the engine's own
205
+ * credentials — withheld under every policy — whichever rule withheld them first ({@link ownCredentialJudge}, the
203
206
  * subtraction's own judgment, over the entry's value in this process's environment: every finding names an entry of
204
207
  * it). The rest the scrub withheld, and `"all"` or an allow list naming them hands them on. */
205
208
  export declare function withheldEnvNames(findings: readonly SecretEnvFinding[]): {
@@ -209,9 +212,9 @@ export declare function withheldEnvNames(findings: readonly SecretEnvFinding[]):
209
212
  /**
210
213
  * The ONE disclosure point for a scrub's withheld keys. Routed through {@link deliverEngineNotice} — the
211
214
  * engine's one notice throat — so a wired `onNotice` seat REPLACES the console line exactly as every
212
- * other `EngineNotice` does, and an absent seat prints the same words `console.warn` always printed here.
215
+ * other `EngineNotice` does, and an absent seat (no default seat installed) prints the same words `console.warn` always printed here.
213
216
  * `detail` is {@link withheldEnvNames}: `names` every withheld key, `ownCredentials` (present only when one was
214
- * withheld) the subset that is the deployment's own credential. Once per PROCESS, never per call or per site; an
217
+ * withheld) the subset that is the engine's own credentials. Once per PROCESS, never per call or per site; an
215
218
  * EMPTY findings array is a no-op.
216
219
  */
217
220
  export declare function announceSecretEnvScrub(onNotice: ((notice: EngineNotice) => void) | undefined, findings: readonly SecretEnvFinding[]): void;
@@ -1,9 +1,9 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { types } from "node:util";
3
3
  import { CREDENTIAL_MIN_CHARS, CREDENTIAL_VOCABULARY, envNameView, isSensitiveHeaderName, splitCamelCase } from "./credential-vocabulary.js";
4
- import { DEFAULT_INHERITED_ENV_VARS } from "@modelcontextprotocol/sdk/client/stdio.js";
4
+ import { DEFAULT_INHERITED_ENV_VARS } from "@modelcontextprotocol/client/stdio";
5
5
  import { deliverEngineNotice } from "./engine-notice.js";
6
- import { receiveOwnProperties } from "./own-property-receipt.js";
6
+ import { optionKeys, receiveMembers } from "./own-property-receipt.js";
7
7
  const GIT_CONFIG_ENV_RE = /^GIT_CONFIG_(?:COUNT|PARAMETERS|(?:KEY|VALUE)_[0-9]+)$/;
8
8
  const PROXY_ENV_RE = /^(?:(?:https?|ftp|all|no)_proxy|npm_config_(?:https?_)?proxy|npm_config_noproxy|yarn_proxy|(?:yarn|global_agent|docker|claude_code)_(?:https?|no)_proxy|cloudsdk_proxy_[a-z]+|electron_get_use_proxy)$/i;
9
9
  function isExemptEnvName(name) {
@@ -94,6 +94,7 @@ export function looksLikeCredentialValue(value) {
94
94
  TOKEN_WORD_RE.test(text) ||
95
95
  BEARER_BASIC_RE.test(text));
96
96
  }
97
+ const OWN_CREDENTIAL = "the engine's own service credential";
97
98
  const SECRET_ENV_KIND_CONFIDENCE = {
98
99
  "exact-name": "high",
99
100
  "prefix-rule": "high",
@@ -176,6 +177,7 @@ const withheldEnvOf = () => {
176
177
  Reflect.set(globalThis, WITHHELD_ENV, fresh);
177
178
  return fresh;
178
179
  };
180
+ const WITHHELD_ENV_TABLE_KEYS = optionKeys()({ names: 0, values: 0 });
179
181
  const kindOf = (v) => (v === null ? "null" : Array.isArray(v) ? "an array" : typeof v);
180
182
  function listCopy(label, list) {
181
183
  if (types.isProxy(list))
@@ -215,20 +217,23 @@ function notACredentialReason(value) {
215
217
  export function namesASecret(value) {
216
218
  return notACredentialReason(value) === undefined;
217
219
  }
218
- function credentialValueProblem(v) {
220
+ function notVariableValueReason(v) {
219
221
  if (typeof v !== "string")
220
222
  return kindOf(v);
221
223
  if (v === "")
222
224
  return "an empty string, which every variable set to nothing equals";
223
225
  if (v.includes("\0") || UNPAIRED_SURROGATE_RE.test(v))
224
226
  return `a value holding ${v.includes("\0") ? "a NUL" : "an unpaired surrogate"}, which no variable can hold`;
225
- return notACredentialReason(v);
227
+ return undefined;
226
228
  }
227
- function credentialValueListProblem(value) {
228
- for (const [i, v] of value.entries()) {
229
+ function credentialValueProblem(v) {
230
+ return notVariableValueReason(v) ?? notACredentialReason(v);
231
+ }
232
+ function firstRefusedValue(value) {
233
+ for (const [index, v] of value.entries()) {
229
234
  const why = credentialValueProblem(v);
230
235
  if (why !== undefined)
231
- return `values[${i}] is not a credential value (got ${why})`;
236
+ return { index, why };
232
237
  }
233
238
  return undefined;
234
239
  }
@@ -237,10 +242,7 @@ export function declareWithheldEnv(table) {
237
242
  if (given === null || typeof given !== "object" || Array.isArray(given)) {
238
243
  throw new Error(`declareWithheldEnv: the declaration must be a table { names, values } (got ${Array.isArray(given) ? "an array — a names-only list is no longer a declaration: pass { names, values }" : kindOf(given)})`);
239
244
  }
240
- const received = receiveOwnProperties(given, { subject: "declareWithheldEnv's table", unit: "member", moment: "at the declaration" });
241
- const stray = Object.keys(received).find((k) => k !== "names" && k !== "values");
242
- if (stray !== undefined)
243
- throw new Error(`declareWithheldEnv: the table has a member ${JSON.stringify(stray.slice(0, 64))} — it holds names and values only`);
245
+ const received = receiveMembers(given, { subject: "declareWithheldEnv's table", unit: "member", moment: "at the declaration" }, WITHHELD_ENV_TABLE_KEYS, (_, [stray]) => new Error(`declareWithheldEnv: the table has a member ${JSON.stringify(String(stray).slice(0, 64))} — it holds names and values only`));
244
246
  const givenNames = received.names;
245
247
  if (!Array.isArray(givenNames))
246
248
  throw new Error(`declareWithheldEnv: names must be an array of variable names (got ${kindOf(givenNames)})`);
@@ -256,9 +258,13 @@ export function declareWithheldEnv(table) {
256
258
  if (!Array.isArray(givenValues))
257
259
  throw new Error(`declareWithheldEnv: values must be an array of credential values (got ${kindOf(givenValues)})`);
258
260
  const values = listCopy("values", givenValues);
259
- const valueProblem = credentialValueListProblem(values);
260
- if (valueProblem !== undefined)
261
- throw new Error(`declareWithheldEnv: ${valueProblem}`);
261
+ const refused = firstRefusedValue(values);
262
+ if (refused !== undefined) {
263
+ const told = values[refused.index];
264
+ if (typeof told === "string" && notVariableValueReason(told) === undefined && !isBlankCredential(told))
265
+ noteIntakeSaid(told);
266
+ throw new Error(`declareWithheldEnv: values[${refused.index}] is not a credential value (got ${refused.why})`);
267
+ }
262
268
  for (const [i, v] of values.entries()) {
263
269
  const holder = runtimeSuppliedHolderOf(v);
264
270
  if (holder !== undefined)
@@ -271,20 +277,27 @@ export function declareWithheldEnv(table) {
271
277
  }
272
278
  export function holdOwnCredentialValues(values, onNotice) {
273
279
  const given = [...values].filter((v) => typeof v === "string" && !isBlankCredential(v));
280
+ const notTaken = new Map();
274
281
  const taken = given.filter((v) => {
275
282
  const why = notACredentialReason(v);
276
283
  if (why !== undefined)
277
- sayNotTaken(v, why, onNotice);
284
+ notTaken.set(v, why);
278
285
  return why === undefined;
279
286
  });
280
- for (const v of taken) {
281
- const holder = runtimeSuppliedHolderOf(v);
282
- if (holder !== undefined)
283
- throw Object.assign(new Error(`a credential the engine was handed is the value of ${holder}, ${CANNOT_BE_WITHHELD}; the credential is refused`), { code: "config.invalid_argument" });
287
+ try {
288
+ for (const v of taken) {
289
+ const holder = runtimeSuppliedHolderOf(v);
290
+ if (holder !== undefined)
291
+ throw Object.assign(new Error(`a credential the engine was handed is the value of ${holder}, ${CANNOT_BE_WITHHELD}; the credential is refused`), { code: "config.invalid_argument" });
292
+ }
293
+ const { held } = withheldEnvOf();
294
+ for (const v of taken)
295
+ indexAdd(held, v);
296
+ }
297
+ finally {
298
+ for (const [v, why] of notTaken)
299
+ sayNotTaken(v, why, onNotice);
284
300
  }
285
- const { held } = withheldEnvOf();
286
- for (const v of taken)
287
- indexAdd(held, v);
288
301
  }
289
302
  const AUTH_SCHEME_VALUE_RE = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+ +(\S[\s\S]*)$/;
290
303
  export function authSchemeCredentials(value) {
@@ -314,11 +327,16 @@ export function credentialHeaderValues(headers) {
314
327
  return out;
315
328
  }
316
329
  const intakeSaid = new Set();
317
- function sayNotTaken(value, why, onNotice) {
330
+ function noteIntakeSaid(value) {
318
331
  const key = valueDigest(value.trim());
319
332
  if (intakeSaid.has(key))
320
- return;
333
+ return false;
321
334
  intakeSaid.add(key);
335
+ return true;
336
+ }
337
+ function sayNotTaken(value, why, onNotice) {
338
+ if (!noteIntakeSaid(value))
339
+ return;
322
340
  try {
323
341
  deliverEngineNotice(onNotice, {
324
342
  code: "config.credential_not_withheld",
@@ -444,7 +462,7 @@ export function inheritEnvPolicyProblem(value) {
444
462
  return shape;
445
463
  const own = new Set(names.map(envNameKey));
446
464
  const named = value.findIndex((k) => own.has(envNameKey(k)));
447
- return named === -1 ? undefined : `inheritEnv[${named}] names ${value[named]}, which is this deployment's own credential and cannot be inherited by a child (a configuration error: no retry succeeds until the policy or the declaration changes)`;
465
+ return named === -1 ? undefined : `inheritEnv[${named}] names ${value[named]}, which is ${OWN_CREDENTIAL} and cannot be inherited by a child (a configuration error: no retry succeeds until the policy or the declaration changes)`;
448
466
  }
449
467
  let secretEnvScrubNoticeAnnounced = false;
450
468
  export function __resetSecretEnvScrubNoticeAnnouncement() {
@@ -461,7 +479,7 @@ export function announceSecretEnvScrub(onNotice, findings) {
461
479
  return;
462
480
  secretEnvScrubNoticeAnnounced = true;
463
481
  const { names, ownCredentials } = withheldEnvNames(findings);
464
- const own = ownCredentials.length > 0 ? `; ${ownCredentials.length} of them this deployment's own credential(s) (${ownCredentials.join(", ")})` : "";
482
+ const own = ownCredentials.length > 0 ? `; ${ownCredentials.length} of them ${OWN_CREDENTIAL}(s) (${ownCredentials.join(", ")})` : "";
465
483
  deliverEngineNotice(onNotice, {
466
484
  code: "config.secret_env_scrubbed",
467
485
  message: `secret_env_scrubbed: ${names.length} env key(s) withheld from a spawned child's environment (${names.join(", ")})${own} — once per process; wire onNotice for the structured form`,
@@ -483,7 +501,7 @@ export function withheldEnvUserNotice(withheld, at) {
483
501
  const scrubbed = names.filter((k) => !ownCredentials.includes(k));
484
502
  const halves = [
485
503
  ...(scrubbed.length > 0 ? [`${scrubbed.join(", ")} — withheld by the credential scrub; the run's inheritEnv ("all", or a list naming them) hands them on`] : []),
486
- ...(ownCredentials.length > 0 ? [`${ownCredentials.join(", ")} — this deployment's own credential(s), withheld under every inheritEnv`] : []),
504
+ ...(ownCredentials.length > 0 ? [`${ownCredentials.join(", ")} — ${OWN_CREDENTIAL}(s), withheld under every inheritEnv`] : []),
487
505
  ];
488
506
  return {
489
507
  code: "inherit_env.names_withheld",