@sema-agent/core 7.59.0 → 7.61.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 (643) hide show
  1. package/CHANGELOG.md +1169 -0
  2. package/README.md +2 -2
  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 +4 -3
  6. package/dist/agents/agent-transcript-tool.js +4 -2
  7. package/dist/agents/cascade.d.ts +61 -10
  8. package/dist/agents/cascade.js +60 -20
  9. package/dist/agents/child-model-seat.js +6 -3
  10. package/dist/agents/composition-allowance.d.ts +53 -0
  11. package/dist/agents/composition-allowance.js +49 -0
  12. package/dist/agents/composition-placement.d.ts +29 -0
  13. package/dist/agents/composition-placement.js +24 -0
  14. package/dist/agents/cumulative-stats.d.ts +4 -0
  15. package/dist/agents/cumulative-stats.js +3 -1
  16. package/dist/agents/inherited-tool-pool.d.ts +28 -1
  17. package/dist/agents/inherited-tool-pool.js +22 -0
  18. package/dist/agents/list-agents-tool.d.ts +1 -1
  19. package/dist/agents/peer-notice-route.d.ts +1 -1
  20. package/dist/agents/peer-notice-route.js +4 -3
  21. package/dist/agents/peer-notices.d.ts +4 -4
  22. package/dist/agents/peer-notices.js +8 -4
  23. package/dist/agents/peer-session-drain.d.ts +8 -1
  24. package/dist/agents/peer-session-drain.js +36 -7
  25. package/dist/agents/repair-loop.js +16 -6
  26. package/dist/agents/retain-ledger.d.ts +11 -1
  27. package/dist/agents/retain-ledger.js +16 -3
  28. package/dist/agents/roster-store.d.ts +2 -2
  29. package/dist/agents/roster-store.js +8 -3
  30. package/dist/agents/send-message-tool.d.ts +14 -27
  31. package/dist/agents/send-message-tool.js +47 -54
  32. package/dist/agents/subagent-completion-gate.d.ts +35 -0
  33. package/dist/agents/subagent-completion-gate.js +62 -0
  34. package/dist/agents/subagent-steps.d.ts +7 -6
  35. package/dist/agents/subagent.d.ts +52 -28
  36. package/dist/agents/subagent.js +276 -246
  37. package/dist/agents/suspend-guard.d.ts +9 -0
  38. package/dist/agents/suspend-guard.js +4 -0
  39. package/dist/agents/tool-filter.d.ts +1 -3
  40. package/dist/agents/tool-filter.js +4 -12
  41. package/dist/agents/verify.d.ts +41 -14
  42. package/dist/agents/verify.js +37 -27
  43. package/dist/bench/metrics.d.ts +3 -5
  44. package/dist/bench/metrics.js +0 -1
  45. package/dist/brain/anthropic.js +1 -0
  46. package/dist/brain/degrading.js +3 -1
  47. package/dist/brain/errors.d.ts +7 -1
  48. package/dist/brain/errors.js +6 -0
  49. package/dist/brain/failover.js +2 -1
  50. package/dist/brain/open-responses.js +1 -0
  51. package/dist/brain/openai.js +1 -0
  52. package/dist/brain/provider-dialect.d.ts +10 -0
  53. package/dist/brain/provider-dialect.js +13 -2
  54. package/dist/brain/route-adjudicator.js +3 -1
  55. package/dist/brain/status-sink.d.ts +7 -1
  56. package/dist/brain/status-sink.js +6 -0
  57. package/dist/brain/stream-engine.d.ts +3 -0
  58. package/dist/brain/stream-engine.js +4 -0
  59. package/dist/brain/timeout.d.ts +3 -1
  60. package/dist/brain/timeout.js +18 -5
  61. package/dist/core/a2a.d.ts +15 -5
  62. package/dist/core/a2a.js +34 -19
  63. package/dist/core/agent-definition.d.ts +20 -0
  64. package/dist/core/agent-state.d.ts +1 -1
  65. package/dist/core/allow-entry.d.ts +61 -23
  66. package/dist/core/allow-entry.js +134 -39
  67. package/dist/core/artifact-host.d.ts +0 -2
  68. package/dist/core/artifact-host.js +0 -1
  69. package/dist/core/ask-origin.d.ts +79 -0
  70. package/dist/core/ask-origin.js +76 -0
  71. package/dist/core/ask-question.d.ts +19 -13
  72. package/dist/core/ask-question.js +8 -2
  73. package/dist/core/auto-compaction.d.ts +2 -0
  74. package/dist/core/auto-compaction.js +2 -1
  75. package/dist/core/auto-mode-defaults.d.ts +8 -0
  76. package/dist/core/auto-mode-defaults.js +1 -0
  77. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  78. package/dist/core/auto-mode.d.ts +39 -4
  79. package/dist/core/auto-mode.js +66 -17
  80. package/dist/core/background-agent-store.d.ts +17 -6
  81. package/dist/core/background-agent-store.js +15 -13
  82. package/dist/core/background-shell.d.ts +12 -1
  83. package/dist/core/background-shell.js +12 -0
  84. package/dist/core/checkpoint-requirements.d.ts +24 -3
  85. package/dist/core/checkpoint-requirements.js +9 -1
  86. package/dist/core/checkpoint-store.d.ts +86 -32
  87. package/dist/core/checkpoint-store.js +10 -5
  88. package/dist/core/child-clamp-seats.d.ts +3 -2
  89. package/dist/core/child-clamp-seats.js +4 -3
  90. package/dist/core/closest-name.d.ts +13 -0
  91. package/dist/core/closest-name.js +35 -0
  92. package/dist/core/compliance.d.ts +1 -1
  93. package/dist/core/context-settings.js +3 -5
  94. package/dist/core/credential-echo.d.ts +52 -0
  95. package/dist/core/credential-echo.js +65 -0
  96. package/dist/core/credential-vocabulary.d.ts +13 -3
  97. package/dist/core/credential-vocabulary.js +12 -4
  98. package/dist/core/cross-boundary-taint.d.ts +5 -6
  99. package/dist/core/decision-receipt.d.ts +14 -1
  100. package/dist/core/decision-receipt.js +6 -3
  101. package/dist/core/delegation-frames.d.ts +13 -9
  102. package/dist/core/effective-path-target.js +2 -3
  103. package/dist/core/engine-attestation.d.ts +11 -1
  104. package/dist/core/engine-attestation.js +2 -0
  105. package/dist/core/engine-notice.d.ts +106 -32
  106. package/dist/core/file-history-retention.d.ts +8 -0
  107. package/dist/core/file-history-retention.js +14 -11
  108. package/dist/core/file-history-store.d.ts +31 -1
  109. package/dist/core/file-history-store.js +31 -2
  110. package/dist/core/frame-settlement.d.ts +15 -0
  111. package/dist/core/frame-settlement.js +10 -1
  112. package/dist/core/fs-write-gate-policy.d.ts +3 -3
  113. package/dist/core/fs-write-gate-policy.js +8 -7
  114. package/dist/core/gate-fold.js +9 -6
  115. package/dist/core/gate-lanes.js +46 -12
  116. package/dist/core/gate-outcome.d.ts +40 -1
  117. package/dist/core/gate-outcome.js +10 -0
  118. package/dist/core/git-worktree-env.d.ts +7 -3
  119. package/dist/core/git-worktree-env.js +16 -13
  120. package/dist/core/governance-codes.d.ts +19 -3
  121. package/dist/core/governance-codes.js +27 -3
  122. package/dist/core/hands-band-screen.js +0 -1
  123. package/dist/core/hands-band.d.ts +0 -3
  124. package/dist/core/hooks.d.ts +51 -60
  125. package/dist/core/hooks.js +131 -78
  126. package/dist/core/host-floor.js +3 -5
  127. package/dist/core/image-admission.d.ts +145 -52
  128. package/dist/core/image-admission.js +202 -47
  129. package/dist/core/image-downsample.d.ts +36 -69
  130. package/dist/core/image-downsample.js +111 -73
  131. package/dist/core/input-author.d.ts +36 -0
  132. package/dist/core/input-author.js +39 -0
  133. package/dist/core/integer-option.d.ts +21 -0
  134. package/dist/core/integer-option.js +13 -0
  135. package/dist/core/leg-identity.d.ts +62 -0
  136. package/dist/core/leg-identity.js +18 -0
  137. package/dist/core/locked-config.d.ts +55 -3
  138. package/dist/core/locked-config.js +84 -51
  139. package/dist/core/lsp.d.ts +5 -3
  140. package/dist/core/lsp.js +3 -2
  141. package/dist/core/mailbox-store.d.ts +85 -10
  142. package/dist/core/mailbox-store.js +31 -10
  143. package/dist/core/mcp-call-meta.d.ts +2 -2
  144. package/dist/core/mcp-call-meta.js +9 -10
  145. package/dist/core/mcp-connection-pool.d.ts +6 -20
  146. package/dist/core/mcp-connection-pool.js +10 -28
  147. package/dist/core/mcp-failure.d.ts +83 -16
  148. package/dist/core/mcp-failure.js +67 -30
  149. package/dist/core/mcp-host-seat.d.ts +131 -0
  150. package/dist/core/mcp-host-seat.js +305 -0
  151. package/dist/core/mcp-probe.d.ts +7 -2
  152. package/dist/core/mcp-probe.js +9 -4
  153. package/dist/core/mcp-server-link.d.ts +18 -6
  154. package/dist/core/mcp-server-link.js +19 -4
  155. package/dist/core/mcp-server-spec.d.ts +39 -9
  156. package/dist/core/mcp-server-spec.js +55 -21
  157. package/dist/core/mcp-session-end.d.ts +1 -2
  158. package/dist/core/mcp-session-end.js +1 -1
  159. package/dist/core/mcp.d.ts +23 -55
  160. package/dist/core/mcp.js +172 -156
  161. package/dist/core/media-byte-cap.d.ts +21 -46
  162. package/dist/core/media-byte-cap.js +55 -55
  163. package/dist/core/member-group.d.ts +7 -0
  164. package/dist/core/member-group.js +35 -0
  165. package/dist/core/memory-admission.d.ts +23 -6
  166. package/dist/core/memory-admission.js +19 -9
  167. package/dist/core/memory-engine/consolidation.d.ts +1 -1
  168. package/dist/core/memory-engine/consolidation.js +7 -1
  169. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  170. package/dist/core/memory-engine/content-origin.js +21 -3
  171. package/dist/core/memory-engine/dual-root.d.ts +31 -0
  172. package/dist/core/memory-engine/dual-root.js +59 -11
  173. package/dist/core/memory-engine/engine.js +27 -24
  174. package/dist/core/memory-engine/file-backend.d.ts +13 -0
  175. package/dist/core/memory-engine/file-backend.js +35 -15
  176. package/dist/core/memory-engine/index.d.ts +2 -1
  177. package/dist/core/memory-engine/index.js +2 -1
  178. package/dist/core/memory-engine/layout.d.ts +3 -0
  179. package/dist/core/memory-engine/layout.js +13 -3
  180. package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
  181. package/dist/core/memory-engine/memory-deployment.js +182 -0
  182. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  183. package/dist/core/memory-engine/scope-contract.js +2 -2
  184. package/dist/core/memory-engine/sync-client.d.ts +68 -13
  185. package/dist/core/memory-engine/sync-client.js +147 -18
  186. package/dist/core/memory-engine/sync-report.d.ts +106 -0
  187. package/dist/core/memory-engine/sync-report.js +119 -0
  188. package/dist/core/memory-engine/sync.d.ts +13 -3
  189. package/dist/core/mode-policy.d.ts +15 -7
  190. package/dist/core/mode-policy.js +18 -6
  191. package/dist/core/model-receipt.d.ts +39 -0
  192. package/dist/core/model-receipt.js +139 -0
  193. package/dist/core/mods/agent-stations.d.ts +100 -0
  194. package/dist/core/mods/agent-stations.js +154 -0
  195. package/dist/core/mods/dollar.d.ts +62 -0
  196. package/dist/core/mods/extension-call.d.ts +15 -1
  197. package/dist/core/mods/extension-call.js +7 -2
  198. package/dist/core/mods/kernel/dispatch.d.ts +9 -4
  199. package/dist/core/mods/kernel/dispatch.js +8 -8
  200. package/dist/core/mods/kernel/events.d.ts +13 -4
  201. package/dist/core/mods/kernel/events.js +14 -10
  202. package/dist/core/mods/kernel/receive.d.ts +5 -0
  203. package/dist/core/mods/kernel/receive.js +10 -0
  204. package/dist/core/mods/kernel/registration.d.ts +3 -0
  205. package/dist/core/mods/kernel/registration.js +5 -0
  206. package/dist/core/mods/kernel/site-rules.d.ts +6 -3
  207. package/dist/core/mods/kernel/site-rules.js +10 -2
  208. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  209. package/dist/core/mods/lifecycle-stations.js +35 -0
  210. package/dist/core/mods/session-append.d.ts +115 -0
  211. package/dist/core/mods/session-append.js +311 -0
  212. package/dist/core/mods/session-compact.d.ts +48 -0
  213. package/dist/core/mods/session-compact.js +194 -0
  214. package/dist/core/mods/session-receive.d.ts +93 -0
  215. package/dist/core/mods/session-receive.js +141 -0
  216. package/dist/core/mods/session-send.d.ts +72 -0
  217. package/dist/core/mods/session-send.js +88 -0
  218. package/dist/core/mods/stations.d.ts +89 -75
  219. package/dist/core/mods/stations.js +57 -53
  220. package/dist/core/mods/tool-call.d.ts +12 -4
  221. package/dist/core/mods/tool-call.js +32 -16
  222. package/dist/core/mounted-mcp.d.ts +5 -0
  223. package/dist/core/mounted-mcp.js +2 -2
  224. package/dist/core/namespaced-rule-name.d.ts +7 -1
  225. package/dist/core/namespaced-rule-name.js +13 -2
  226. package/dist/core/oracle-isolation.js +1 -1
  227. package/dist/core/output-style.js +3 -4
  228. package/dist/core/own-property-receipt.d.ts +62 -0
  229. package/dist/core/own-property-receipt.js +43 -0
  230. package/dist/core/park-selfcheck.js +12 -10
  231. package/dist/core/path-identity.d.ts +11 -0
  232. package/dist/core/path-identity.js +4 -0
  233. package/dist/core/path-rule-binding.d.ts +3 -1
  234. package/dist/core/path-rule-binding.js +3 -1
  235. package/dist/core/peer-seat.d.ts +66 -11
  236. package/dist/core/peer-seat.js +199 -42
  237. package/dist/core/permission-rule-consent.d.ts +21 -26
  238. package/dist/core/permission-rule-consent.js +22 -3
  239. package/dist/core/permission-rule-model.d.ts +38 -13
  240. package/dist/core/permission-rule-model.js +54 -16
  241. package/dist/core/permission-rule-org.d.ts +1 -1
  242. package/dist/core/permission-rule-provider.js +4 -1
  243. package/dist/core/permission-rules.d.ts +4 -0
  244. package/dist/core/permission-rules.js +11 -16
  245. package/dist/core/protocol-http-auth.d.ts +14 -2
  246. package/dist/core/protocol-http-auth.js +16 -7
  247. package/dist/core/read-face-seats.d.ts +7 -5
  248. package/dist/core/read-face-seats.js +4 -1
  249. package/dist/core/redaction-marks.d.ts +4 -3
  250. package/dist/core/redaction-marks.js +2 -2
  251. package/dist/core/remote-env.d.ts +218 -122
  252. package/dist/core/remote-env.js +133 -14
  253. package/dist/core/retention-policy.d.ts +24 -23
  254. package/dist/core/retention-policy.js +36 -2
  255. package/dist/core/retention.d.ts +4 -1
  256. package/dist/core/retention.js +37 -12
  257. package/dist/core/retired-keys.d.ts +8 -3
  258. package/dist/core/retired-keys.js +4 -1
  259. package/dist/core/rewrite-rejudge.d.ts +12 -5
  260. package/dist/core/rewrite-rejudge.js +9 -5
  261. package/dist/core/roles.d.ts +37 -3
  262. package/dist/core/roles.js +126 -78
  263. package/dist/core/row-admission.d.ts +10 -0
  264. package/dist/core/row-admission.js +5 -0
  265. package/dist/core/rule-owner.d.ts +3 -0
  266. package/dist/core/runner/advisor-instructions.d.ts +2 -1
  267. package/dist/core/runner/advisor-instructions.js +2 -1
  268. package/dist/core/runner/announce-once-ledger.d.ts +4 -4
  269. package/dist/core/runner/assemble-result.d.ts +13 -8
  270. package/dist/core/runner/assemble-result.js +12 -8
  271. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  272. package/dist/core/runner/call-hook-stations.js +21 -10
  273. package/dist/core/runner/caller-roster.d.ts +12 -9
  274. package/dist/core/runner/caller-roster.js +5 -2
  275. package/dist/core/runner/checkpoint-scope.d.ts +16 -1
  276. package/dist/core/runner/checkpoint-scope.js +21 -0
  277. package/dist/core/runner/child-tree.d.ts +7 -8
  278. package/dist/core/runner/child-tree.js +6 -6
  279. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  280. package/dist/core/runner/classifier-ladder.js +39 -8
  281. package/dist/core/runner/compact-session.js +14 -2
  282. package/dist/core/runner/compaction-call-options.d.ts +1 -1
  283. package/dist/core/runner/compaction-restate.d.ts +2 -2
  284. package/dist/core/runner/compaction-restate.js +4 -3
  285. package/dist/core/runner/construction-doors.d.ts +2 -2
  286. package/dist/core/runner/construction-doors.js +7 -2
  287. package/dist/core/runner/contracts.d.ts +158 -65
  288. package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
  289. package/dist/core/runner/cross-boundary-lane.js +11 -2
  290. package/dist/core/runner/decide-continuation.d.ts +4 -2
  291. package/dist/core/runner/decide-continuation.js +7 -4
  292. package/dist/core/runner/denial-limit-arms.d.ts +15 -21
  293. package/dist/core/runner/denial-limit-arms.js +17 -10
  294. package/dist/core/runner/env-capability-census.d.ts +15 -20
  295. package/dist/core/runner/env-capability-census.js +25 -34
  296. package/dist/core/runner/expire-settle.d.ts +44 -0
  297. package/dist/core/runner/expire-settle.js +55 -0
  298. package/dist/core/runner/file-history-request.d.ts +2 -2
  299. package/dist/core/runner/file-history-request.js +0 -8
  300. package/dist/core/runner/gate-exit.d.ts +75 -7
  301. package/dist/core/runner/gate-exit.js +20 -1
  302. package/dist/core/runner/git-status-frame.d.ts +5 -2
  303. package/dist/core/runner/git-status-frame.js +4 -4
  304. package/dist/core/runner/halt-attribution.d.ts +2 -1
  305. package/dist/core/runner/halt-attribution.js +2 -1
  306. package/dist/core/runner/image.d.ts +7 -2
  307. package/dist/core/runner/image.js +14 -8
  308. package/dist/core/runner/inline-image.d.ts +10 -8
  309. package/dist/core/runner/inline-image.js +11 -9
  310. package/dist/core/runner/local-claims.d.ts +17 -0
  311. package/dist/core/runner/local-claims.js +18 -0
  312. package/dist/core/runner/media-removed-seat.d.ts +46 -0
  313. package/dist/core/runner/media-removed-seat.js +88 -0
  314. package/dist/core/runner/memory-consolidation-driver.js +4 -4
  315. package/dist/core/runner/park-commit.d.ts +2 -2
  316. package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
  317. package/dist/core/runner/permission-rule-lanes.js +29 -10
  318. package/dist/core/runner/person-path-rows.js +1 -1
  319. package/dist/core/runner/placement-fence.d.ts +26 -0
  320. package/dist/core/runner/placement-fence.js +38 -0
  321. package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
  322. package/dist/core/runner/prepare-ask-lane.js +4 -4
  323. package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
  324. package/dist/core/runner/prepare-boundary-parks.js +4 -4
  325. package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
  326. package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
  327. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  328. package/dist/core/runner/prepare-config-doors.js +30 -26
  329. package/dist/core/runner/prepare-context-lane.d.ts +6 -2
  330. package/dist/core/runner/prepare-context-lane.js +13 -13
  331. package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
  332. package/dist/core/runner/prepare-delegation-surface.js +7 -8
  333. package/dist/core/runner/prepare-execution-env.d.ts +5 -2
  334. package/dist/core/runner/prepare-execution-env.js +7 -4
  335. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  336. package/dist/core/runner/prepare-file-history.js +3 -12
  337. package/dist/core/runner/prepare-gate-stations.d.ts +23 -17
  338. package/dist/core/runner/prepare-gate-stations.js +10 -7
  339. package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
  340. package/dist/core/runner/prepare-hands-readface.js +19 -11
  341. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  342. package/dist/core/runner/prepare-inherited-gate.js +12 -5
  343. package/dist/core/runner/prepare-lsp.d.ts +3 -0
  344. package/dist/core/runner/prepare-lsp.js +2 -2
  345. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  346. package/dist/core/runner/prepare-memory.d.ts +2 -2
  347. package/dist/core/runner/prepare-memory.js +2 -2
  348. package/dist/core/runner/prepare-park-ask.d.ts +8 -7
  349. package/dist/core/runner/prepare-park-ask.js +6 -12
  350. package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
  351. package/dist/core/runner/prepare-policy-chain.js +131 -128
  352. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  353. package/dist/core/runner/prepare-project-context.js +8 -5
  354. package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
  355. package/dist/core/runner/prepare-prompt-inputs.js +4 -2
  356. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  357. package/dist/core/runner/prepare-protocol-tools.js +9 -2
  358. package/dist/core/runner/prepare-question-face.d.ts +6 -4
  359. package/dist/core/runner/prepare-question-face.js +2 -2
  360. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  361. package/dist/core/runner/prepare-run-refs.js +2 -2
  362. package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
  363. package/dist/core/runner/prepare-suspend-saga.js +21 -13
  364. package/dist/core/runner/prepare-task.d.ts +1 -1
  365. package/dist/core/runner/prepare-task.js +84 -42
  366. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
  367. package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
  368. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  369. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  370. package/dist/core/runner/prepare-wiring-manifest.d.ts +7 -3
  371. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  372. package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
  373. package/dist/core/runner/prepare-workspace-restore.js +12 -8
  374. package/dist/core/runner/read-root-grant.d.ts +1 -1
  375. package/dist/core/runner/read-root-grant.js +2 -1
  376. package/dist/core/runner/resume-admission.d.ts +5 -3
  377. package/dist/core/runner/resume-admission.js +17 -3
  378. package/dist/core/runner/resume-apply.js +3 -1
  379. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  380. package/dist/core/runner/resume-claim.d.ts +8 -3
  381. package/dist/core/runner/resume-claim.js +28 -12
  382. package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
  383. package/dist/core/runner/resume-internals-and-config.js +10 -1
  384. package/dist/core/runner/resume-preflight.d.ts +3 -2
  385. package/dist/core/runner/resume-preflight.js +13 -26
  386. package/dist/core/runner/retired-runner-deps.js +6 -1
  387. package/dist/core/runner/run-attachment-seats.js +3 -3
  388. package/dist/core/runner/run-brain-sinks.js +1 -0
  389. package/dist/core/runner/run-git-lane.d.ts +3 -1
  390. package/dist/core/runner/run-git-lane.js +3 -2
  391. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  392. package/dist/core/runner/run-harness-handlers.js +5 -3
  393. package/dist/core/runner/run-identity-wiring.d.ts +2 -2
  394. package/dist/core/runner/run-identity-wiring.js +15 -6
  395. package/dist/core/runner/run-leg.d.ts +3 -3
  396. package/dist/core/runner/run-leg.js +65 -56
  397. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  398. package/dist/core/runner/run-notification-lane.js +36 -12
  399. package/dist/core/runner/run-recovery-lanes.js +3 -2
  400. package/dist/core/runner/run-settle-and-teardown.js +14 -8
  401. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  402. package/dist/core/runner/run-stop-and-final-verify.js +12 -4
  403. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
  404. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  405. package/dist/core/runner/run-terminal-adoption.js +26 -17
  406. package/dist/core/runner/run-turn-boundary.js +37 -19
  407. package/dist/core/runner/runtask.d.ts +25 -7
  408. package/dist/core/runner/runtask.js +46 -22
  409. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  410. package/dist/core/runner/session-rule-policy.js +6 -1
  411. package/dist/core/runner/shell-env-withheld.d.ts +1 -1
  412. package/dist/core/runner/skills-seat.js +2 -2
  413. package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
  414. package/dist/core/runner/stream-halt-verbs.js +4 -3
  415. package/dist/core/runner/stream-reap.d.ts +7 -6
  416. package/dist/core/runner/stream-reap.js +13 -16
  417. package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
  418. package/dist/core/runner/stream-settle-backstop.js +5 -3
  419. package/dist/core/runner/stream-steer-verb.d.ts +5 -2
  420. package/dist/core/runner/stream-steer-verb.js +8 -7
  421. package/dist/core/runner/sub-agent-deny-lists.js +10 -7
  422. package/dist/core/runner/synthetic-tools.js +2 -2
  423. package/dist/core/runner/terminal-account.d.ts +11 -1
  424. package/dist/core/runner/terminal-account.js +20 -0
  425. package/dist/core/runner/terminal-projection.d.ts +8 -2
  426. package/dist/core/runner/terminal-projection.js +2 -2
  427. package/dist/core/runner/tool-disclosure.d.ts +3 -0
  428. package/dist/core/runner/tool-disclosure.js +5 -4
  429. package/dist/core/runner/tool-end-body.d.ts +3 -3
  430. package/dist/core/runner/tool-end-body.js +1 -1
  431. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  432. package/dist/core/runner/tool-face-overlay.js +26 -19
  433. package/dist/core/runner/tool-output-projection.d.ts +3 -3
  434. package/dist/core/runner/tool-output-projection.js +7 -6
  435. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  436. package/dist/core/runner/tool-result-media-seat.js +17 -1
  437. package/dist/core/runner/tool-table-view.d.ts +56 -0
  438. package/dist/core/runner/tool-table-view.js +51 -0
  439. package/dist/core/runner/turn-attachments.d.ts +6 -7
  440. package/dist/core/runner/turn-attachments.js +4 -17
  441. package/dist/core/runner/void-verifier-pause.d.ts +33 -0
  442. package/dist/core/runner/void-verifier-pause.js +41 -0
  443. package/dist/core/runner-deps.d.ts +55 -43
  444. package/dist/core/secret-env.d.ts +14 -13
  445. package/dist/core/secret-env.js +8 -9
  446. package/dist/core/session-log-transfer.js +9 -10
  447. package/dist/core/session-policy-store.d.ts +10 -3
  448. package/dist/core/session-policy-store.js +21 -3
  449. package/dist/core/session-reconcile.d.ts +3 -2
  450. package/dist/core/session-reconcile.js +7 -4
  451. package/dist/core/session-store.d.ts +5 -2
  452. package/dist/core/session-store.js +53 -16
  453. package/dist/core/session.d.ts +2 -1
  454. package/dist/core/shell-confinement.d.ts +37 -0
  455. package/dist/core/shell-confinement.js +56 -0
  456. package/dist/core/skill-grant.d.ts +9 -0
  457. package/dist/core/skill-grant.js +18 -0
  458. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
  459. package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
  460. package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
  461. package/dist/core/store-contracts/file-history-store-contract.js +25 -1
  462. package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
  463. package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
  464. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  465. package/dist/core/store-contracts/tool-result-store-contract.js +67 -0
  466. package/dist/core/stub-env.d.ts +5 -5
  467. package/dist/core/stub-env.js +11 -1
  468. package/dist/core/swappable-deps.d.ts +17 -43
  469. package/dist/core/swappable-deps.js +15 -5
  470. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  471. package/dist/core/task-event.d.ts +35 -10
  472. package/dist/core/task-limits.d.ts +5 -0
  473. package/dist/core/task-notification.d.ts +172 -12
  474. package/dist/core/task-notification.js +209 -12
  475. package/dist/core/task-registry-agent.d.ts +23 -55
  476. package/dist/core/task-registry-agent.js +41 -56
  477. package/dist/core/task-registry-monitor.d.ts +8 -1
  478. package/dist/core/task-registry-monitor.js +43 -61
  479. package/dist/core/task-registry-shared.d.ts +52 -114
  480. package/dist/core/task-registry-shared.js +24 -48
  481. package/dist/core/task-registry-workflow.js +5 -22
  482. package/dist/core/task-registry.d.ts +64 -90
  483. package/dist/core/task-registry.js +73 -119
  484. package/dist/core/task-result.d.ts +27 -19
  485. package/dist/core/task-spec-members.d.ts +39 -0
  486. package/dist/core/task-spec-members.js +92 -0
  487. package/dist/core/task-spec.d.ts +13 -16
  488. package/dist/core/task-stream.d.ts +1 -1
  489. package/dist/core/task-tool-shape.d.ts +7 -57
  490. package/dist/core/task-tool-shape.js +7 -66
  491. package/dist/core/terminal-cause.d.ts +30 -0
  492. package/dist/core/terminal-cause.js +1 -0
  493. package/dist/core/tool-catalog-entries.js +3 -6
  494. package/dist/core/tool-check-reading.js +16 -10
  495. package/dist/core/tool-conformance.js +1 -2
  496. package/dist/core/tool-errors.d.ts +6 -3
  497. package/dist/core/tool-errors.js +2 -0
  498. package/dist/core/tool-face-reader.d.ts +7 -6
  499. package/dist/core/tool-face-reader.js +6 -4
  500. package/dist/core/tool-face.d.ts +2 -3
  501. package/dist/core/tool-name-aliases.d.ts +23 -28
  502. package/dist/core/tool-name-aliases.js +63 -7
  503. package/dist/core/tool-name-readings.d.ts +14 -3
  504. package/dist/core/tool-name-readings.js +2 -0
  505. package/dist/core/tool-policy.d.ts +113 -22
  506. package/dist/core/tool-policy.js +85 -15
  507. package/dist/core/tool-registry.d.ts +5 -5
  508. package/dist/core/tool-registry.js +2 -2
  509. package/dist/core/tool-result-store.d.ts +111 -5
  510. package/dist/core/tool-result-store.js +52 -12
  511. package/dist/core/tool-spec.d.ts +39 -10
  512. package/dist/core/trace.d.ts +18 -2
  513. package/dist/core/types.d.ts +3 -3
  514. package/dist/core/types.js +1 -1
  515. package/dist/core/untrusted-text.js +1 -1
  516. package/dist/core/user-attachment.d.ts +10 -5
  517. package/dist/core/user-attachment.js +40 -27
  518. package/dist/core/workflow-journal-store.d.ts +1 -1
  519. package/dist/core/workflow-run-store.d.ts +2 -0
  520. package/dist/core/workflow-run-store.js +6 -5
  521. package/dist/core/workflow-settled-run.d.ts +5 -0
  522. package/dist/core/workflow-settled-run.js +7 -0
  523. package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
  524. package/dist/engine/execution-env/node-execution-env.js +224 -21
  525. package/dist/engine/harness/agent-harness.d.ts +66 -19
  526. package/dist/engine/harness/agent-harness.js +98 -27
  527. package/dist/engine/harness/messages.d.ts +4 -3
  528. package/dist/engine/harness/messages.js +2 -2
  529. package/dist/engine/harness/types.d.ts +151 -34
  530. package/dist/engine/llm/media-removed.d.ts +14 -0
  531. package/dist/engine/llm/media-removed.js +9 -0
  532. package/dist/engine/llm/rejected-images.d.ts +35 -25
  533. package/dist/engine/llm/rejected-images.js +59 -10
  534. package/dist/engine/llm/types.d.ts +24 -3
  535. package/dist/engine/llm/types.js +7 -3
  536. package/dist/engine/loop/agent-loop.d.ts +18 -13
  537. package/dist/engine/loop/agent-loop.js +173 -32
  538. package/dist/engine/loop/types.d.ts +21 -5
  539. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  540. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  541. package/dist/engine/session/import-validate.js +7 -0
  542. package/dist/fixtures/index.d.ts +7 -5
  543. package/dist/fixtures/index.js +5 -3
  544. package/dist/index.d.ts +41 -23
  545. package/dist/index.js +29 -16
  546. package/dist/internal/harness-types.d.ts +3 -1
  547. package/dist/internal/llm.d.ts +2 -1
  548. package/dist/internal/llm.js +1 -0
  549. package/dist/orchestration/goal.d.ts +6 -2
  550. package/dist/orchestration/goal.js +6 -3
  551. package/dist/orchestration/run-workflow-tool.d.ts +20 -20
  552. package/dist/orchestration/run-workflow-tool.js +63 -56
  553. package/dist/orchestration/workflow-governance.d.ts +1 -1
  554. package/dist/orchestration/workflow-governance.js +2 -1
  555. package/dist/orchestration/workflow-types.d.ts +2 -2
  556. package/dist/orchestration/workflow.d.ts +8 -0
  557. package/dist/orchestration/workflow.js +33 -9
  558. package/dist/prompts/default.d.ts +1 -10
  559. package/dist/prompts/default.js +0 -2
  560. package/dist/stores/file/background-agent-store.d.ts +1 -1
  561. package/dist/stores/file/background-agent-store.js +19 -14
  562. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  563. package/dist/stores/file/checkpoint-store.js +24 -16
  564. package/dist/stores/file/file-history-store.d.ts +1 -1
  565. package/dist/stores/file/file-history-store.js +4 -1
  566. package/dist/stores/file/index.d.ts +9 -6
  567. package/dist/stores/file/index.js +33 -9
  568. package/dist/stores/file/ledger-tuning.d.ts +23 -0
  569. package/dist/stores/file/ledger-tuning.js +21 -0
  570. package/dist/stores/file/mailbox-store.d.ts +1 -1
  571. package/dist/stores/file/mailbox-store.js +43 -21
  572. package/dist/stores/file/memory-store.d.ts +1 -1
  573. package/dist/stores/file/memory-store.js +4 -1
  574. package/dist/stores/file/permission-rule-adopt.js +24 -21
  575. package/dist/stores/file/permission-rule-store.js +6 -3
  576. package/dist/stores/file/session-policy-store.d.ts +1 -1
  577. package/dist/stores/file/session-policy-store.js +4 -1
  578. package/dist/stores/file/session-store.d.ts +17 -4
  579. package/dist/stores/file/session-store.js +22 -19
  580. package/dist/stores/file/shared-ledger.d.ts +26 -0
  581. package/dist/stores/file/shared-ledger.js +38 -9
  582. package/dist/stores/file/tool-result-store.d.ts +31 -2
  583. package/dist/stores/file/tool-result-store.js +129 -7
  584. package/dist/stores/file/usage-window-store.d.ts +1 -1
  585. package/dist/stores/file/usage-window-store.js +4 -1
  586. package/dist/stores/file/workflow-journal-store.d.ts +1 -13
  587. package/dist/stores/file/workflow-journal-store.js +4 -18
  588. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  589. package/dist/stores/file/workflow-run-store.js +15 -10
  590. package/dist/tools/fs/containment-face.d.ts +5 -0
  591. package/dist/tools/fs/dead-cwd.d.ts +5 -5
  592. package/dist/tools/fs/dead-cwd.js +4 -11
  593. package/dist/tools/fs/encoding.d.ts +13 -4
  594. package/dist/tools/fs/encoding.js +17 -2
  595. package/dist/tools/fs/fs-bash-background-text.d.ts +13 -0
  596. package/dist/tools/fs/fs-bash-background-text.js +7 -0
  597. package/dist/tools/fs/fs-bash.d.ts +11 -22
  598. package/dist/tools/fs/fs-bash.js +58 -154
  599. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  600. package/dist/tools/fs/fs-pdf.js +34 -27
  601. package/dist/tools/fs/fs-read.d.ts +5 -4
  602. package/dist/tools/fs/fs-read.js +35 -18
  603. package/dist/tools/fs/fs-search-tools.js +4 -1
  604. package/dist/tools/fs/fs-shared.d.ts +39 -16
  605. package/dist/tools/fs/fs-shared.js +25 -6
  606. package/dist/tools/fs/fs-write.js +5 -5
  607. package/dist/tools/fs/index.d.ts +15 -9
  608. package/dist/tools/fs/index.js +12 -18
  609. package/dist/tools/fs/pdf.d.ts +4 -4
  610. package/dist/tools/fs/pdf.js +6 -6
  611. package/dist/tools/fs/read-deny-home.js +8 -1
  612. package/dist/tools/fs/read-deny.d.ts +26 -2
  613. package/dist/tools/fs/read-deny.js +9 -2
  614. package/dist/tools/fs/read-floor.d.ts +57 -6
  615. package/dist/tools/fs/read-floor.js +241 -2
  616. package/dist/tools/fs/removal-targets.d.ts +9 -4
  617. package/dist/tools/fs/removal-targets.js +17 -9
  618. package/dist/tools/fs/search.d.ts +6 -5
  619. package/dist/tools/fs/search.js +10 -10
  620. package/dist/tools/fs/shell-read-establish.js +3 -1
  621. package/dist/tools/fs/shell-read-identity.d.ts +3 -1
  622. package/dist/tools/fs/shell-read-identity.js +4 -2
  623. package/dist/tools/fs/shell-read-judge.d.ts +7 -1
  624. package/dist/tools/fs/shell-read-judge.js +1 -1
  625. package/dist/tools/monitor.d.ts +12 -10
  626. package/dist/tools/monitor.js +22 -13
  627. package/dist/tools/scheduler-tools.js +42 -4
  628. package/dist/tools/web.d.ts +0 -10
  629. package/dist/tools/web.js +1 -4
  630. package/dist/tools/worktree.d.ts +5 -1
  631. package/dist/tools/worktree.js +20 -17
  632. package/package.json +8 -3
  633. package/test/export-surface.snapshot.json +166 -30
  634. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  635. package/wire-changes/core-stores-sql@7.61.0.json +480 -0
  636. package/wire-changes/core@7.60.0.json +3274 -0
  637. package/wire-changes/core@7.61.0.json +4405 -0
  638. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  639. package/wire-changes/mods-kernel@7.61.0.json +65 -0
  640. package/wire-changes/primitives@7.60.0.json +30 -0
  641. package/wire-changes/primitives@7.61.0.json +30 -0
  642. package/dist/core/runner/image-removed-seat.d.ts +0 -12
  643. package/dist/core/runner/image-removed-seat.js +0 -19
@@ -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
+ }
@@ -2,6 +2,7 @@ import type { McpDroppedTool } from "../mcp.js";
2
2
  import { type McpUnavailableEntry } from "../mcp-failure.js";
3
3
  import type { McpInstructionsEntry } from "../prompt-section-seat.js";
4
4
  import type { TaskSpec } from "../types.js";
5
+ import { type BackgroundTaskTableRow } from "../task-notification.js";
5
6
  import { type SkillListingEntry, type SkillsBlockRender } from "./synthetic-tools.js";
6
7
  import { type ResolvedSkillListingBudget } from "../skill-listing-budget.js";
7
8
  /**
@@ -182,11 +183,8 @@ export interface AgentListingEntry {
182
183
  }
183
184
  /** G1 通告层: a background task visible to THIS run, snapshotted at the boundary by the
184
185
  * runtask-side getter (registry ground truth — the producer never touches the registry itself). */
185
- export interface BackgroundTaskSnapshot {
186
- id: string;
187
- description?: string;
188
- status: string;
189
- }
186
+ /** A row of the background-task table ({@link BackgroundTaskTableRow}). */
187
+ export type BackgroundTaskSnapshot = BackgroundTaskTableRow;
190
188
  export declare function attachmentEnvelopeTags(source: AttachmentSource): string[];
191
189
  /** One due reminder. `body` is the inner text — the steerer adds the `<system-reminder>` wrapper (F3). */
192
190
  export interface TurnAttachment {
@@ -977,9 +975,10 @@ export declare function commitSkillsListing(state: AttachmentState, entries: Rea
977
975
  * neither lane it rides has a cap above this one: the stable system-prompt lane has none, and the
978
976
  * `mcp_instructions` attachment is intact-class (the bundle cap never clips it), so this bound IS the
979
977
  * producer's promise — without it a single server could pin an arbitrarily large blob into the cached
980
- * prompt prefix or into one boundary frame.
978
+ * prompt prefix or into one boundary frame. The number is the reference's own, the same as the tool-description cap in
979
+ * `mcp.ts` ((cli309.js:274179) "MCP server instructions from 2,048 to 4,096 characters").
981
980
  */
982
- export declare const MCP_INSTRUCTIONS_MAX_CHARS: number;
981
+ export declare const MCP_INSTRUCTIONS_MAX_CHARS = 4096;
983
982
  /**
984
983
  * The ONE way MCP server-provided instruction text becomes model-facing, used by BOTH the
985
984
  * stable system-prompt lane (prepare-task's `# MCP Server Instructions` block) and
@@ -2,6 +2,7 @@ import { isPlainRecord } from "../mods/kernel/receive.js";
2
2
  import { needsAuthorizationArm } from "../mcp-failure.js";
3
3
  import { delimitUntrustedWithClip, inlineUntrusted, sanitizeUntrustedText, SHELLED_BODY_ENVELOPE_TAGS } from "../untrusted-text.js";
4
4
  import { protocolOf } from "../protocol-table.js";
5
+ import { renderBackgroundTaskTable } from "../task-notification.js";
5
6
  import { renderSkillLinesWithin, renderSkillsBlock } from "./synthetic-tools.js";
6
7
  import { SKILL_LISTING_DEFAULT_BUDGET } from "../skill-listing-budget.js";
7
8
  import { foldListingWithin, foldRemovalArmWithin, removalArmFloor } from "./listing-fold.js";
@@ -406,23 +407,9 @@ function renderChangedFiles(paths) {
406
407
  paths.map((p) => `- ${p}`).join("\n"));
407
408
  }
408
409
  function renderBackgroundTasks(tasks) {
409
- const unlisted = tasks.length - PROJECTION_ITEMS_MAX;
410
- const lines = tasks.slice(0, PROJECTION_ITEMS_MAX).map((t) => {
411
- const phrase = t.status === "completed"
412
- ? "completed in background"
413
- : t.status === "killed"
414
- ? "stopped"
415
- : t.status === "running"
416
- ? "still running in background"
417
- : t.status === "parked"
418
- ? "parked awaiting an out-of-band approval — do NOT re-issue the gated call"
419
- : t.status;
420
- return `- [${t.id}] Task "${(t.description ?? "background task").slice(0, PROJECTION_CONTENT_MAX)}" ${phrase}`;
421
- });
422
- return ("Context was compacted. Background tasks from before the compaction (check output with TaskOutput, " +
410
+ return ("Context was compacted. Background tasks from before the compaction (read output where its row says, " +
423
411
  "terminate with TaskStop):\n" +
424
- lines.join("\n") +
425
- (unlisted > 0 ? `\n(+${unlisted} more background tasks, not listed here)` : ""));
412
+ renderBackgroundTaskTable(tasks));
426
413
  }
427
414
  export const TOOLS_DELTA_LIST_MAX = 30;
428
415
  function groupByMcpServer(names) {
@@ -697,7 +684,7 @@ export function renderSkillsListingDelta(state, entries, budget) {
697
684
  export function commitSkillsListing(state, entries) {
698
685
  state.announcedSkills = new Map(entries.map((e) => [e.name, e.description]));
699
686
  }
700
- export const MCP_INSTRUCTIONS_MAX_CHARS = 8 * 1024;
687
+ export const MCP_INSTRUCTIONS_MAX_CHARS = 4096;
701
688
  export function fenceMcpServerInstructions(server, text) {
702
689
  const fence = delimitUntrustedWithClip(`MCP server "${server}" instructions`, text, MCP_INSTRUCTIONS_MAX_CHARS);
703
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
+ }
@@ -14,14 +14,14 @@ import type { OnElicit } from "./mcp-server-spec.js";
14
14
  import type { Brain, ModelRef, ModelRoles } from "./model-seat.js";
15
15
  import type { RuntimeCaps, WorkflowGovernanceBaseline } from "./runtime-caps.js";
16
16
  /**
17
- * parity-204 — structured `RunnerDeps.loadProjectMemory` return (backward-compatible, RL-1336-project-memory-bare: a bare
18
- * `string | null` keeps its exact historical meaning). Adds the `seededFromContext`
17
+ * parity-204 — the `RunnerDeps.loadProjectMemory` return: the one form a loader answers in (a loader with nothing to
18
+ * inject answers `{ content: null }`; a bare `string | null` is not read). Carries the `seededFromContext`
19
19
  * seam (cc204-bundle @17917159: CC preloads readFileState for CLAUDE.md/nested-memory files it
20
20
  * placed in context, and a DEFAULT whole-file Read of an unchanged seeded file answers with the
21
21
  * already-in-context reminder instead of re-transmitting the body — token economy, GA in 204).
22
22
  */
23
23
  export interface ProjectMemoryLoad {
24
- /** The project-context text to inject — same semantics as returning a bare string (null/blank ⇒ no injection). */
24
+ /** The project-context text to inject (null/blank ⇒ no injection). */
25
25
  content: string | null;
26
26
  /**
27
27
  * Files whose FULL, disk-verbatim text the deployment has placed in the model's context (e.g. the
@@ -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
  }
@@ -223,6 +223,17 @@ export interface RunnerDeps {
223
223
  * ignored). Same deployment-only seat, clamp argument and checkpoint posture as the tiers key.
224
224
  */
225
225
  readDenyBuiltinExclude?: readonly string[];
226
+ /**
227
+ * #2936 — whether the deployment REQUIRES the byte floor kept: `true` ⇒ a run whose read-deny table holds a row, on an
228
+ * execution environment that does not declare it keeps the floor (`capabilities.keepsReadFloor`), is refused at prepare
229
+ * (`config.read_deny_floor_unkept`) before any command starts. Absent or `false` = not required — the documented
230
+ * reading, not a silent default: such a run is then announced once to the operator under the same code, because a
231
+ * recursive read under a root reads the files below it there, deny rows included. A present non-boolean value refuses
232
+ * (`config.read_face_seat`). The read-deny family's deployment seat (hot-swappable with it, `config.read_deny_swapped`);
233
+ * DEPLOYMENT seat ONLY, like the tier switch: a task can add deny rows, never change the deployment's gate. Mirrored on
234
+ * `HandsToolkitOptions.readDenyFloorRequired` for a library-direct band that compiles its own table.
235
+ */
236
+ readDenyFloorRequired?: boolean;
226
237
  /**
227
238
  * Where the host keeps the agent's configuration directory when it is not `<home>/.sema` — an ABSOLUTE path of an
228
239
  * existing directory, resolved by the host (the engine reads no environment variable for it). The rows of the
@@ -273,7 +284,7 @@ export interface RunnerDeps {
273
284
  * tool that is ITSELF classified polluting still marks pre-call.
274
285
  * ACCEPTED COST (the deployment's to own, stated as mechanism, not as absence of risk): under
275
286
  * `"attested-only"` a BACKGROUND child's real external contact does not mark this session — its
276
- * 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
277
288
  * AgentTranscript step summaries, none of which carries an attestation — and a foreground child
278
289
  * that ended abnormally (crash/salvage) is likewise not marked on its face alone (the chain still
279
290
  * records `incomplete`). Already-marked sessions are never retroactively cleaned; the key only
@@ -347,8 +358,8 @@ export interface RunnerDeps {
347
358
  * (single-process/single-host deployments: byte-identical behavior). A deployment whose control
348
359
  * plane does not survive into resume replicas (the stateless multi-replica server form) supplies
349
360
  * a durable store here; see {@link import("./memory-engine/layout.js").SessionCaptureRecordStore}
350
- * for the per-leg fail-closed contract. Also the §2.1b capability signal: on a REMOTE-execution
351
- * deployment with no store supplied here, a `capture:"off"` declaration is refused
361
+ * for the per-leg fail-closed contract. Also the §2.1b capability signal: where the execution env's paths are not
362
+ * the host's (`pathsAreHostLocal`) and no store is supplied here, a `capture:"off"` declaration is refused
352
363
  * (`config.memory_capture_unsupported`) rather than accepted onto a carrier that the next resume
353
364
  * cannot see — a false privacy promise is worse than a loud one.
354
365
  */
@@ -453,6 +464,12 @@ export interface RunnerDeps {
453
464
  * deployment default cannot override a load-bearing containment wall) — TaskSpec.readFace's own
454
465
  * "open" there is the genuine per-task contradiction, and that one still refuses loudly (#123).
455
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
+ *
456
473
  * A LIVE seat: `Runner.swapDeps({ readFace })` replaces it without a restart (the same natural
457
474
  * snapshot the model catalog has — a leg reads the seat at its prepare and keeps that reading; every
458
475
  * later prepare reads the new declaration; announced as `config.read_face_swapped`). A host whose
@@ -625,9 +642,10 @@ export interface RunnerDeps {
625
642
  * deployment's), and a call it clears is attributed to it (`decisionReason: "deployment_rule"`). Lives for the Runner —
626
643
  * read once at construction: a value that is not a list of strings refuses construction (`config.invalid_permission_rules`,
627
644
  * with its issues), and the entries that read as nothing are announced once, when the Runner is built
628
- * (`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.
629
647
  */
630
- allowedTools?: readonly string[];
648
+ allowedTools?: readonly import("./allow-entry.js").AllowListEntry[];
631
649
  /**
632
650
  * design/182 §9 — DECLARE that this deployment drives cloud sync (`syncPermissionRules`) for the
633
651
  * wired rule store. Purely a disclosure input: it is reported as `permissionRules.syncWired` on the
@@ -783,6 +801,8 @@ export interface RunnerDeps {
783
801
  * (`config.auto_mode_classifier_fallback_invalid`) — never clamped, never read as the default.
784
802
  */
785
803
  classifierFallback?: import("./auto-mode.js").AutoModeClassifierFallback;
804
+ /** Consecutive classifications ending on the classifier SEAT's rate limit (an HTTP 429 after the brain's own backoff) before the seat is not asked again this run — the walk starts on the model behind it, `classifier.seat_rate_limited` says so once; default 3 (`AUTO_MODE_RATE_LIMIT_BREAK_AFTER_DEFAULT`); any other outcome zeroes the count; inert under `classifierFallback: "none"`; a value that is not a whole number of at least 1 is REFUSED at every leg's prepare (`config.auto_mode_rate_limit_break_invalid`), never clamped; no OFF. See the header of `auto-mode.ts`. */
805
+ rateLimitBreakAfter?: number;
786
806
  /**
787
807
  * The classifier DENIAL LIMIT: a run whose classifier keeps blocking falls
788
808
  * back to a PERSON instead of being denied without end. Per run: a `block` first increments the
@@ -889,7 +909,7 @@ export interface RunnerDeps {
889
909
  * history (opt-in; in-process runs are still subscribable without it). */
890
910
  workflowRunStore?: import("./workflow-run-store.js").WorkflowRunStore;
891
911
  /** design/151 S1a — the durable background-agent execution ledger (the `workflowRunStore` twin for
892
- * `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
893
913
  * fall back to it on a live-registry miss (terminal snapshots / honest cross-instance reads, behind
894
914
  * the fail-closed §3.1c predicate). Opt-in; absent ⇒ the in-memory-only pre-151 lifecycle. A
895
915
  * deployment that composes its own Agent tool MUST pass the SAME instance as
@@ -897,7 +917,7 @@ export interface RunnerDeps {
897
917
  * verify the pairing (the Agent tool is deployment-composed), and a half-wired deployment is a
898
918
  * SILENT degrade: reader-only ⇒ no rows ever exist; writer-only ⇒ the auto-mounted fallbacks
899
919
  * here never see them (RB-37). Third consumer: delegated
900
- * 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
901
921
  * wires them from the child's runner) — a sub-runner with different deps splits the read face. */
902
922
  backgroundAgentStore?: import("./background-agent-store.js").BackgroundAgentStore;
903
923
  /** design/151 §7 S3c — the durable SendMessage mailbox (delivery-ladder third rung): a message to a
@@ -915,8 +935,8 @@ export interface RunnerDeps {
915
935
  * `DELEGATION_MAX_PER_SESSION_DEFAULT`). Key = `(scope, rootSessionId)`, full depth (grandchildren
916
936
  * share the tree's pool). `maxConcurrent` bounds the tree's RUNNING children of every local lane:
917
937
  * running/pending a* handles in this process's registry PLUS the synchronous and forked children in
918
- * flight in this process (parked does not burn a slot — a suspension is not concurrency; a revival
919
- * 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
920
940
  * (registry-retained + store-retained rows, plus those same in-flight local children — a reaped row
921
941
  * returns its quota, and a synchronous child retains nothing so it leaves the window when it
922
942
  * settles; deliberately NOT CC's lifetime-monotonic session counter, which would require a
@@ -1136,16 +1156,18 @@ export interface RunnerDeps {
1136
1156
  * unserializable (durable resume) and reading files for an UNTRUSTED caller would be a confused-deputy hole
1137
1157
  * (design/44 §7 Q4). DECOUPLED from `memoryStore` — injects even with NO long-term memory configured (H5).
1138
1158
  *
1139
- * `undefined` (default) ⇒ the whole path is skipped = byte-identical to today (full parity, H3). Returning
1140
- * `null`/blank ⇒ no injection (also byte-identical). The content is fenced/sanitized like every other memory
1159
+ * `undefined` (default) ⇒ the whole path is skipped = byte-identical to today (full parity, H3). The loader answers a
1160
+ * {@link ProjectMemoryLoad}; `{ content: null }` (or blank content) ⇒ no injection (also byte-identical). Any other
1161
+ * answer (a bare string, `null`, a non-object) is not read: it is disclosed on `onError` (phase `config`) and the leg runs
1162
+ * with no project layer, as when the loader throws. The content is fenced/sanitized like every other memory
1141
1163
  * layer (repo-controlled CLAUDE.md is UNTRUSTED data, not an instruction — H2). The ctx lets a profile tailor
1142
- * or suppress: `handsEnabled:false` = a hands-less chat with no real project (return null); `isSubagent` =
1164
+ * or suppress: `handsEnabled:false` = a hands-less chat with no real project (answer `{ content: null }`); `isSubagent` =
1143
1165
  * a delegated child (a profile may trim CLAUDE.md for a cheap "grep this" subagent — H7).
1144
1166
  */
1145
1167
  loadProjectMemory?: (ctx: {
1146
1168
  /** The task's working directory (= the execution env's cwd; a worktree task = its worktree root). */
1147
1169
  cwd: string;
1148
- /** False ⇒ a hands-less chat (no real filesystem/project) — a profile typically returns null. */
1170
+ /** False ⇒ a hands-less chat (no real filesystem/project) — a profile typically answers `{ content: null }`. */
1149
1171
  handsEnabled: boolean;
1150
1172
  /** True ⇒ a delegated subagent run (a profile may trim/suppress project content to control cost). */
1151
1173
  isSubagent: boolean;
@@ -1174,12 +1196,10 @@ export interface RunnerDeps {
1174
1196
  * docs/REVIEW-BACKLOG.md): a compaction followed by a mid-run user-role
1175
1197
  * injection (steer) before the next prepare reads as `"resume"` — the freshness
1176
1198
  * gap is covered by the C-4 `instructions_change` lane, not by this signal.
1177
- * - `"post-clear"` — RESERVED: core has no session-clear primitive today (a CC `/clear` maps to a
1178
- * NEW session ⇒ `"fresh"`; rewinding past the root is rejected), so core never
1179
- * emits this value — it exists so the seam's enum is stable when a clear verb lands.
1199
+ * A session clear starts a NEW session, which reads `"fresh"` (rewinding past the root is rejected).
1180
1200
  */
1181
- phase?: "fresh" | "resume" | "post-compact" | "post-clear";
1182
- }) => Promise<string | null | ProjectMemoryLoad> | string | null | ProjectMemoryLoad;
1201
+ phase?: "fresh" | "resume" | "post-compact";
1202
+ }) => Promise<ProjectMemoryLoad> | ProjectMemoryLoad;
1183
1203
  /**
1184
1204
  * design-A C-4 ([A2]) — the mid-session instruction-file change PROBE (the server half of the
1185
1205
  * `instructions_change` attachment lane). At eligible turn boundaries (continuation-gated like
@@ -1212,11 +1232,11 @@ export interface RunnerDeps {
1212
1232
  */
1213
1233
  onElicit?: OnElicit;
1214
1234
  /**
1215
- * design/116 CONFIRM-1 (加 seam 保体验): resize an over-limit MCP image so the model still SEES a
1216
- * degraded image instead of a spill-to-disk note. Absent ⇒ core auto-detects `sharp` (dynamic import;
1217
- * turnkey deployments with sharp installed get the CC experience with zero config) and otherwise spills.
1235
+ * The ONE image processor seat: every image a run hands the model (Read, PDF pages, Bash data URIs, MCP and any tool's results,
1236
+ * `TaskSpec.images`, attachments) passes the one admission with it (frame ladder, then toward `IMAGE_ADMISSION.soft.targetBytes`).
1237
+ * `false` = none (images go on as they are within the hard limits; the run says so once past the soft target); absent ⇒ detect sharp.
1218
1238
  */
1219
- mcpImageResizer?: import("./mcp.js").McpImageResizer;
1239
+ imageProcessor?: import("./image-downsample.js").ImageDownsampler | false;
1220
1240
  /** Default tool-call gate for all tasks (a task's own `toolPolicy` overrides this). */
1221
1241
  toolPolicy?: import("./tool-policy.js").ToolPolicy;
1222
1242
  /**
@@ -1451,23 +1471,15 @@ export interface RunnerDeps {
1451
1471
  */
1452
1472
  cacheBreakDetection?: boolean;
1453
1473
  /**
1454
- * Aggregate inline-MEDIA (image) byte budget for the request (batch-C/§17.2 sibling of the text budget;
1455
- * `tengu_media_byte_cap` in the reference). Image reads (`Read` → ImageContent) are per-image-capped but
1456
- * accumulate across turns; this bounds the SUM in the request by stripping the OLDEST images (replaced with a
1457
- * marker) — request-only, non-destructive (the durable session keeps the image; the model can re-Read it).
1458
- * The same budget bounds the media of one `tool_end.output` (spent there as base64 on the wire, x 4/3); both readers
1459
- * read it through `mediaBudgetBytes`. Default {@link AGGREGATE_MEDIA_BUDGET_BYTES}; set `Infinity`/`0` to disable. A
1460
- * non-number, `NaN` or a negative is refused at `new Runner` (`config.invalid_argument`), never read as "no budget".
1461
- */
1462
- mediaByteCapBytes?: number;
1463
- /** Optional telemetry fired when {@link mediaByteCapBytes} strips media in a request (CC's
1464
- * `tengu_media_byte_cap_stripped` fields). Pure observability — no effect on the request. */
1465
- onMediaStripped?: (info: {
1466
- totalBytes: number;
1467
- limitBytes: number;
1468
- removedCount: number;
1469
- removedBytes: number;
1470
- }) => 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;
1471
1483
  /**
1472
1484
  * Deferred-tool disclosure policy (design/36). Two rules govern deferral. ① The caller's list is
1473
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.
@@ -107,8 +107,9 @@ export declare function namesASecret(value: string): boolean;
107
107
  export declare function declareWithheldEnv(table: WithheldEnvDeclaration): void;
108
108
  /**
109
109
  * The engine takes credential values in — each where the engine receives it: a first-party brain's construction
110
- * credential (`brainConfigSnapshot`), a model entry's own credential headers (`resolveRouteCredential`), a protocol
111
- * peer's credential headers (`resolveProtocolHttpHeaders`), the memory distiller's chat seat key (`openAiCompatChatSeat`,
110
+ * credential (`brainConfigSnapshot`), a model entry's own credential headers (`resolveRouteCredential`), the credential
111
+ * headers and variables a protocol peer's seat answers (`PeerCarrier`, before the answer is judged — a refused answer's
112
+ * values are taken in too), the memory distiller's chat seat key (`openAiCompatChatSeat`,
112
113
  * and `RunnerDeps.memoryConsolidationDriver.chat` at `new Runner`, before that seat is built). From then on, for the
113
114
  * life of the process, no child spawned on this host inherits an entry whose value equals one: the same table, the same
114
115
  * subtraction, finding and disclosure as a declared value ({@link declareWithheldEnv}). A credential the engine is handed
@@ -159,7 +160,7 @@ export declare function credentialHeaderValues(headers: Readonly<Record<string,
159
160
  /** Test seam: never called by production code (a host re-declares `{ names: [], values: [] }`; what the engine took in stays). */
160
161
  export declare function __resetWithheldEnv(): void;
161
162
  /**
162
- * THE environment a child spawned ON THIS HOST inherits: the policy's arm, less this deployment's own credentials — a
163
+ * THE environment a child spawned ON THIS HOST inherits: the policy's arm, less the engine's own credentials — a
163
164
  * declared name, or a value equal to a declared or engine-held credential value ({@link declareWithheldEnv},
164
165
  * {@link holdOwnCredentialValues}). The arms: `"scrub"` (and absent) is this process's environment through
165
166
  * {@link scrubSecretEnv}; `"all"` is this process's environment as written; a `string[]` is exactly the named
@@ -197,8 +198,8 @@ export declare function hostChildEnv(policy: InheritEnvPolicy | undefined, ...gr
197
198
  export declare function inheritEnvPolicyProblem(value: unknown): string | undefined;
198
199
  /** Test seam: never called by production code. */
199
200
  export declare function __resetSecretEnvScrubNoticeAnnouncement(): void;
200
- /** What both disclosures say about one set of findings: every withheld name, and those that are this deployment's own
201
- * credential — withheld under every policy — whichever rule withheld them first ({@link ownCredentialJudge}, the
201
+ /** What both disclosures say about one set of findings: every withheld name, and those that are the engine's own
202
+ * credentials — withheld under every policy — whichever rule withheld them first ({@link ownCredentialJudge}, the
202
203
  * subtraction's own judgment, over the entry's value in this process's environment: every finding names an entry of
203
204
  * it). The rest the scrub withheld, and `"all"` or an allow list naming them hands them on. */
204
205
  export declare function withheldEnvNames(findings: readonly SecretEnvFinding[]): {
@@ -210,7 +211,7 @@ export declare function withheldEnvNames(findings: readonly SecretEnvFinding[]):
210
211
  * engine's one notice throat — so a wired `onNotice` seat REPLACES the console line exactly as every
211
212
  * other `EngineNotice` does, and an absent seat prints the same words `console.warn` always printed here.
212
213
  * `detail` is {@link withheldEnvNames}: `names` every withheld key, `ownCredentials` (present only when one was
213
- * withheld) the subset that is the deployment's own credential. Once per PROCESS, never per call or per site; an
214
+ * withheld) the subset that is the engine's own credentials. Once per PROCESS, never per call or per site; an
214
215
  * EMPTY findings array is a no-op.
215
216
  */
216
217
  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))
@@ -237,10 +239,7 @@ export function declareWithheldEnv(table) {
237
239
  if (given === null || typeof given !== "object" || Array.isArray(given)) {
238
240
  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
241
  }
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`);
242
+ 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
243
  const givenNames = received.names;
245
244
  if (!Array.isArray(givenNames))
246
245
  throw new Error(`declareWithheldEnv: names must be an array of variable names (got ${kindOf(givenNames)})`);
@@ -444,7 +443,7 @@ export function inheritEnvPolicyProblem(value) {
444
443
  return shape;
445
444
  const own = new Set(names.map(envNameKey));
446
445
  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)`;
446
+ 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
447
  }
449
448
  let secretEnvScrubNoticeAnnounced = false;
450
449
  export function __resetSecretEnvScrubNoticeAnnouncement() {
@@ -461,7 +460,7 @@ export function announceSecretEnvScrub(onNotice, findings) {
461
460
  return;
462
461
  secretEnvScrubNoticeAnnounced = true;
463
462
  const { names, ownCredentials } = withheldEnvNames(findings);
464
- const own = ownCredentials.length > 0 ? `; ${ownCredentials.length} of them this deployment's own credential(s) (${ownCredentials.join(", ")})` : "";
463
+ const own = ownCredentials.length > 0 ? `; ${ownCredentials.length} of them ${OWN_CREDENTIAL}(s) (${ownCredentials.join(", ")})` : "";
465
464
  deliverEngineNotice(onNotice, {
466
465
  code: "config.secret_env_scrubbed",
467
466
  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 +482,7 @@ export function withheldEnvUserNotice(withheld, at) {
483
482
  const scrubbed = names.filter((k) => !ownCredentials.includes(k));
484
483
  const halves = [
485
484
  ...(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`] : []),
485
+ ...(ownCredentials.length > 0 ? [`${ownCredentials.join(", ")} — ${OWN_CREDENTIAL}(s), withheld under every inheritEnv`] : []),
487
486
  ];
488
487
  return {
489
488
  code: "inherit_env.names_withheld",