@sema-agent/core 7.58.0 → 7.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (519) hide show
  1. package/CHANGELOG.md +1340 -0
  2. package/README.md +6 -4
  3. package/dist/agents/agent-definition.d.ts +7 -0
  4. package/dist/agents/agent-definition.js +12 -0
  5. package/dist/agents/agent-transcript-tool.d.ts +2 -1
  6. package/dist/agents/agent-transcript-tool.js +3 -1
  7. package/dist/agents/cc-peer-directory.js +8 -8
  8. package/dist/agents/child-model-seat.d.ts +4 -2
  9. package/dist/agents/child-model-seat.js +9 -4
  10. package/dist/agents/cumulative-stats.js +0 -1
  11. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  12. package/dist/agents/inherited-tool-pool.js +22 -0
  13. package/dist/agents/peer-directory.d.ts +9 -0
  14. package/dist/agents/peer-directory.js +6 -2
  15. package/dist/agents/retain-ledger.d.ts +11 -1
  16. package/dist/agents/retain-ledger.js +13 -2
  17. package/dist/agents/roster-store.d.ts +1 -1
  18. package/dist/agents/roster-store.js +3 -1
  19. package/dist/agents/send-message-tool.d.ts +8 -19
  20. package/dist/agents/send-message-tool.js +32 -50
  21. package/dist/agents/subagent.d.ts +51 -17
  22. package/dist/agents/subagent.js +150 -112
  23. package/dist/agents/tool-filter.d.ts +1 -3
  24. package/dist/agents/tool-filter.js +4 -12
  25. package/dist/bench/metrics.d.ts +3 -5
  26. package/dist/bench/metrics.js +0 -1
  27. package/dist/brain/anthropic.js +161 -45
  28. package/dist/brain/degrading.js +3 -1
  29. package/dist/brain/errors.d.ts +9 -3
  30. package/dist/brain/errors.js +7 -1
  31. package/dist/brain/failover.js +2 -1
  32. package/dist/brain/open-responses.js +3 -3
  33. package/dist/brain/openai.js +103 -53
  34. package/dist/brain/provider-dialect.d.ts +11 -0
  35. package/dist/brain/provider-dialect.js +5 -2
  36. package/dist/brain/reasoning-request.js +5 -4
  37. package/dist/brain/reasoning.d.ts +19 -0
  38. package/dist/brain/reasoning.js +17 -2
  39. package/dist/brain/request-route.d.ts +4 -1
  40. package/dist/brain/request-route.js +4 -1
  41. package/dist/brain/route-adjudicator.d.ts +84 -18
  42. package/dist/brain/route-adjudicator.js +90 -22
  43. package/dist/brain/route-conformance.js +1 -1
  44. package/dist/brain/status-sink.d.ts +7 -1
  45. package/dist/brain/status-sink.js +6 -0
  46. package/dist/brain/stream-engine.js +84 -49
  47. package/dist/brain/stream-shared.d.ts +30 -0
  48. package/dist/brain/stream-shared.js +34 -1
  49. package/dist/brain/timeout.d.ts +65 -6
  50. package/dist/brain/timeout.js +111 -11
  51. package/dist/core/a2a.d.ts +15 -5
  52. package/dist/core/a2a.js +34 -19
  53. package/dist/core/account-row.d.ts +61 -0
  54. package/dist/core/account-row.js +51 -0
  55. package/dist/core/advisor-verdict.d.ts +2 -1
  56. package/dist/core/advisor-verdict.js +1 -1
  57. package/dist/core/agent-definition.d.ts +20 -0
  58. package/dist/core/allow-entry.d.ts +20 -6
  59. package/dist/core/allow-entry.js +17 -7
  60. package/dist/core/approval-object.d.ts +29 -15
  61. package/dist/core/approval-object.js +47 -19
  62. package/dist/core/artifact-host.d.ts +0 -2
  63. package/dist/core/artifact-host.js +0 -1
  64. package/dist/core/auto-compaction.js +1 -1
  65. package/dist/core/auto-mode-defaults.d.ts +8 -0
  66. package/dist/core/auto-mode-defaults.js +1 -0
  67. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  68. package/dist/core/auto-mode.d.ts +39 -4
  69. package/dist/core/auto-mode.js +63 -12
  70. package/dist/core/background-agent-store.d.ts +26 -4
  71. package/dist/core/background-agent-store.js +3 -2
  72. package/dist/core/background-shell.d.ts +12 -1
  73. package/dist/core/background-shell.js +12 -0
  74. package/dist/core/checkpoint-requirements.d.ts +13 -1
  75. package/dist/core/checkpoint-requirements.js +3 -1
  76. package/dist/core/checkpoint-store.d.ts +66 -25
  77. package/dist/core/checkpoint-store.js +22 -9
  78. package/dist/core/child-clamp-seats.d.ts +29 -0
  79. package/dist/core/child-clamp-seats.js +56 -1
  80. package/dist/core/compliance.d.ts +3 -3
  81. package/dist/core/compliance.js +1 -1
  82. package/dist/core/credential-echo.d.ts +52 -0
  83. package/dist/core/credential-echo.js +65 -0
  84. package/dist/core/credential-vocabulary.d.ts +13 -3
  85. package/dist/core/credential-vocabulary.js +12 -4
  86. package/dist/core/cross-boundary-taint.d.ts +4 -5
  87. package/dist/core/effective-path-target.d.ts +8 -2
  88. package/dist/core/effective-path-target.js +8 -3
  89. package/dist/core/engine-notice.d.ts +156 -23
  90. package/dist/core/engine-notice.js +19 -5
  91. package/dist/core/frame-settlement.d.ts +5 -0
  92. package/dist/core/frame-settlement.js +4 -0
  93. package/dist/core/gate-fold.js +8 -6
  94. package/dist/core/gate-lanes.js +47 -12
  95. package/dist/core/gate-outcome.d.ts +32 -3
  96. package/dist/core/gate-outcome.js +19 -1
  97. package/dist/core/governance-codes.d.ts +17 -1
  98. package/dist/core/governance-codes.js +25 -0
  99. package/dist/core/hands-band-screen.js +0 -1
  100. package/dist/core/hands-band.d.ts +0 -3
  101. package/dist/core/hooks.d.ts +70 -59
  102. package/dist/core/hooks.js +125 -80
  103. package/dist/core/image-admission.d.ts +106 -52
  104. package/dist/core/image-admission.js +184 -56
  105. package/dist/core/image-downsample.d.ts +36 -69
  106. package/dist/core/image-downsample.js +111 -73
  107. package/dist/core/integer-option.d.ts +21 -0
  108. package/dist/core/integer-option.js +13 -0
  109. package/dist/core/locked-config.d.ts +59 -5
  110. package/dist/core/locked-config.js +82 -50
  111. package/dist/core/mailbox-store.d.ts +45 -1
  112. package/dist/core/mailbox-store.js +53 -9
  113. package/dist/core/mcp-call-meta.d.ts +2 -2
  114. package/dist/core/mcp-call-meta.js +9 -10
  115. package/dist/core/mcp-failure.d.ts +122 -20
  116. package/dist/core/mcp-failure.js +73 -5
  117. package/dist/core/mcp-host-seat.d.ts +92 -0
  118. package/dist/core/mcp-host-seat.js +131 -0
  119. package/dist/core/mcp-probe.d.ts +7 -2
  120. package/dist/core/mcp-probe.js +7 -2
  121. package/dist/core/mcp-server-link.d.ts +22 -1
  122. package/dist/core/mcp-server-link.js +25 -1
  123. package/dist/core/mcp-server-spec.d.ts +38 -9
  124. package/dist/core/mcp-server-spec.js +55 -21
  125. package/dist/core/mcp.d.ts +27 -12
  126. package/dist/core/mcp.js +105 -76
  127. package/dist/core/memory-admission.d.ts +23 -6
  128. package/dist/core/memory-admission.js +19 -9
  129. package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
  130. package/dist/core/memory-engine/consolidation-driver.js +3 -3
  131. package/dist/core/memory-engine/consolidation.d.ts +4 -0
  132. package/dist/core/memory-engine/consolidation.js +1 -0
  133. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  134. package/dist/core/memory-engine/content-origin.js +21 -3
  135. package/dist/core/memory-engine/delegation-settlement.js +5 -12
  136. package/dist/core/memory-engine/distiller.js +2 -2
  137. package/dist/core/memory-engine/dual-root.d.ts +50 -1
  138. package/dist/core/memory-engine/dual-root.js +44 -1
  139. package/dist/core/memory-engine/engine.d.ts +67 -14
  140. package/dist/core/memory-engine/engine.js +384 -212
  141. package/dist/core/memory-engine/export-bundle.d.ts +23 -0
  142. package/dist/core/memory-engine/export-bundle.js +23 -4
  143. package/dist/core/memory-engine/file-backend.d.ts +128 -55
  144. package/dist/core/memory-engine/file-backend.js +290 -117
  145. package/dist/core/memory-engine/index.d.ts +3 -2
  146. package/dist/core/memory-engine/index.js +2 -1
  147. package/dist/core/memory-engine/layout.d.ts +59 -11
  148. package/dist/core/memory-engine/layout.js +190 -40
  149. package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
  150. package/dist/core/memory-engine/memory-backend-contract.js +39 -2
  151. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  152. package/dist/core/memory-engine/scope-contract.js +2 -2
  153. package/dist/core/memory-engine/sync-client.d.ts +51 -9
  154. package/dist/core/memory-engine/sync-client.js +107 -13
  155. package/dist/core/memory-engine/sync-report.d.ts +103 -0
  156. package/dist/core/memory-engine/sync-report.js +119 -0
  157. package/dist/core/memory-engine/sync.d.ts +8 -1
  158. package/dist/core/memory-engine/types.d.ts +6 -0
  159. package/dist/core/mode-policy.d.ts +9 -1
  160. package/dist/core/mode-policy.js +11 -1
  161. package/dist/core/model-receipt.d.ts +39 -0
  162. package/dist/core/model-receipt.js +139 -0
  163. package/dist/core/mods/agent-stations.d.ts +65 -0
  164. package/dist/core/mods/agent-stations.js +105 -0
  165. package/dist/core/mods/classic-events.d.ts +5 -1
  166. package/dist/core/mods/kernel/dispatch.d.ts +5 -1
  167. package/dist/core/mods/kernel/dispatch.js +6 -5
  168. package/dist/core/mods/kernel/events.d.ts +11 -4
  169. package/dist/core/mods/kernel/events.js +11 -7
  170. package/dist/core/mods/kernel/receive.d.ts +5 -0
  171. package/dist/core/mods/kernel/receive.js +10 -0
  172. package/dist/core/mods/kernel/registration.d.ts +4 -0
  173. package/dist/core/mods/kernel/registration.js +3 -0
  174. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  175. package/dist/core/mods/lifecycle-stations.js +35 -0
  176. package/dist/core/mods/stations.d.ts +73 -60
  177. package/dist/core/mods/stations.js +64 -40
  178. package/dist/core/mods/tool-call.d.ts +10 -4
  179. package/dist/core/mods/tool-call.js +28 -12
  180. package/dist/core/mounted-mcp.d.ts +5 -0
  181. package/dist/core/mounted-mcp.js +2 -2
  182. package/dist/core/namespaced-rule-name.d.ts +7 -1
  183. package/dist/core/namespaced-rule-name.js +13 -2
  184. package/dist/core/oracle-isolation.js +1 -1
  185. package/dist/core/own-property-receipt.d.ts +3 -0
  186. package/dist/core/own-property-receipt.js +3 -0
  187. package/dist/core/parent-spec-seat.d.ts +8 -3
  188. package/dist/core/parent-spec-seat.js +2 -0
  189. package/dist/core/park-selfcheck.js +14 -8
  190. package/dist/core/peer-seat.d.ts +133 -16
  191. package/dist/core/peer-seat.js +319 -42
  192. package/dist/core/permission-rule-consent.d.ts +0 -21
  193. package/dist/core/permission-rule-consent.js +11 -6
  194. package/dist/core/permission-rule-model.d.ts +20 -2
  195. package/dist/core/permission-rule-model.js +8 -7
  196. package/dist/core/present-plan-tool.d.ts +11 -3
  197. package/dist/core/present-plan-tool.js +2 -2
  198. package/dist/core/protocol-http-auth.d.ts +14 -2
  199. package/dist/core/protocol-http-auth.js +16 -7
  200. package/dist/core/read-face-seats.d.ts +7 -5
  201. package/dist/core/read-face-seats.js +4 -1
  202. package/dist/core/redaction-marks.d.ts +4 -3
  203. package/dist/core/redaction-marks.js +2 -2
  204. package/dist/core/remote-env.d.ts +146 -98
  205. package/dist/core/remote-env.js +113 -14
  206. package/dist/core/resume-startup-cause.js +1 -0
  207. package/dist/core/retention.js +37 -12
  208. package/dist/core/retired-keys.d.ts +6 -1
  209. package/dist/core/retired-keys.js +4 -1
  210. package/dist/core/rewrite-rejudge.d.ts +13 -5
  211. package/dist/core/rewrite-rejudge.js +9 -5
  212. package/dist/core/roles.d.ts +69 -3
  213. package/dist/core/roles.js +167 -80
  214. package/dist/core/rule-owner.d.ts +3 -0
  215. package/dist/core/runner/announce-once-ledger.d.ts +5 -4
  216. package/dist/core/runner/announce-once-ledger.js +4 -2
  217. package/dist/core/runner/assemble-result.d.ts +0 -5
  218. package/dist/core/runner/assemble-result.js +0 -1
  219. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  220. package/dist/core/runner/call-hook-stations.js +23 -12
  221. package/dist/core/runner/child-tree.d.ts +7 -8
  222. package/dist/core/runner/child-tree.js +6 -6
  223. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  224. package/dist/core/runner/classifier-ladder.js +39 -8
  225. package/dist/core/runner/construction-doors.js +5 -0
  226. package/dist/core/runner/contracts.d.ts +82 -57
  227. package/dist/core/runner/credential-origin-seat.js +4 -3
  228. package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
  229. package/dist/core/runner/cross-boundary-lane.js +11 -2
  230. package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
  231. package/dist/core/runner/cwd-alignment-probe.js +21 -0
  232. package/dist/core/runner/decide-continuation.d.ts +2 -2
  233. package/dist/core/runner/env-capability-census.d.ts +15 -20
  234. package/dist/core/runner/env-capability-census.js +25 -34
  235. package/dist/core/runner/file-history-request.d.ts +2 -2
  236. package/dist/core/runner/file-history-request.js +0 -8
  237. package/dist/core/runner/gate-exit.d.ts +87 -11
  238. package/dist/core/runner/gate-exit.js +30 -8
  239. package/dist/core/runner/git-status-frame.d.ts +5 -2
  240. package/dist/core/runner/git-status-frame.js +3 -4
  241. package/dist/core/runner/image-removed-seat.d.ts +12 -0
  242. package/dist/core/runner/image-removed-seat.js +19 -0
  243. package/dist/core/runner/image.d.ts +7 -2
  244. package/dist/core/runner/image.js +14 -8
  245. package/dist/core/runner/inline-image.d.ts +10 -8
  246. package/dist/core/runner/inline-image.js +11 -9
  247. package/dist/core/runner/memory-consolidation-driver.js +5 -5
  248. package/dist/core/runner/park-commit.d.ts +1 -1
  249. package/dist/core/runner/park-commit.js +3 -0
  250. package/dist/core/runner/permission-rule-lanes.js +1 -1
  251. package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
  252. package/dist/core/runner/prepare-ask-lane.js +2 -1
  253. package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
  254. package/dist/core/runner/prepare-boundary-parks.js +5 -5
  255. package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
  256. package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
  257. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  258. package/dist/core/runner/prepare-config-doors.js +16 -9
  259. package/dist/core/runner/prepare-context-lane.js +2 -0
  260. package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
  261. package/dist/core/runner/prepare-delegation-surface.js +5 -4
  262. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  263. package/dist/core/runner/prepare-file-history.js +3 -12
  264. package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
  265. package/dist/core/runner/prepare-gate-stations.js +4 -3
  266. package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
  267. package/dist/core/runner/prepare-hands-readface.js +19 -6
  268. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
  269. package/dist/core/runner/prepare-inherited-gate.js +22 -31
  270. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  271. package/dist/core/runner/prepare-memory.d.ts +2 -2
  272. package/dist/core/runner/prepare-memory.js +12 -19
  273. package/dist/core/runner/prepare-park-ask.d.ts +4 -6
  274. package/dist/core/runner/prepare-park-ask.js +5 -9
  275. package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
  276. package/dist/core/runner/prepare-policy-chain.js +136 -121
  277. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  278. package/dist/core/runner/prepare-project-context.js +10 -7
  279. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
  280. package/dist/core/runner/prepare-prompt-inputs.js +10 -20
  281. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  282. package/dist/core/runner/prepare-protocol-tools.js +17 -2
  283. package/dist/core/runner/prepare-run-refs.d.ts +2 -3
  284. package/dist/core/runner/prepare-run-refs.js +4 -1
  285. package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
  286. package/dist/core/runner/prepare-suspend-saga.js +5 -7
  287. package/dist/core/runner/prepare-task.js +44 -28
  288. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  289. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  290. package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
  291. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  292. package/dist/core/runner/prepare-workspace-restore.js +3 -3
  293. package/dist/core/runner/reply-pricing.d.ts +30 -0
  294. package/dist/core/runner/reply-pricing.js +19 -0
  295. package/dist/core/runner/resume-admission.js +4 -2
  296. package/dist/core/runner/resume-apply.js +6 -1
  297. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  298. package/dist/core/runner/resume-policy-outcome.js +5 -5
  299. package/dist/core/runner/retired-runner-deps.js +4 -1
  300. package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
  301. package/dist/core/runner/role-seat-defaulted.js +40 -0
  302. package/dist/core/runner/run-attachment-seats.js +3 -3
  303. package/dist/core/runner/run-brain-sinks.js +3 -0
  304. package/dist/core/runner/run-git-lane.d.ts +3 -1
  305. package/dist/core/runner/run-git-lane.js +1 -1
  306. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  307. package/dist/core/runner/run-harness-handlers.js +3 -1
  308. package/dist/core/runner/run-identity-wiring.d.ts +2 -5
  309. package/dist/core/runner/run-identity-wiring.js +6 -5
  310. package/dist/core/runner/run-leg.d.ts +2 -0
  311. package/dist/core/runner/run-leg.js +63 -56
  312. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  313. package/dist/core/runner/run-notification-lane.js +16 -10
  314. package/dist/core/runner/run-settle-and-teardown.js +5 -1
  315. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  316. package/dist/core/runner/run-stop-and-final-verify.js +14 -6
  317. package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
  318. package/dist/core/runner/run-terminal-adoption.js +9 -3
  319. package/dist/core/runner/run-turn-boundary.js +89 -77
  320. package/dist/core/runner/runtask.d.ts +8 -5
  321. package/dist/core/runner/runtask.js +21 -13
  322. package/dist/core/runner/side-call-account.d.ts +1 -1
  323. package/dist/core/runner/side-call-account.js +3 -18
  324. package/dist/core/runner/skills-seat.js +2 -2
  325. package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
  326. package/dist/core/runner/sub-agent-deny-lists.js +20 -7
  327. package/dist/core/runner/synthetic-tools.js +2 -2
  328. package/dist/core/runner/tool-disclosure.js +0 -2
  329. package/dist/core/runner/tool-end-body.js +2 -2
  330. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  331. package/dist/core/runner/tool-face-overlay.js +26 -19
  332. package/dist/core/runner/tool-occurrence.d.ts +1 -1
  333. package/dist/core/runner/tool-occurrence.js +2 -2
  334. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  335. package/dist/core/runner/tool-result-media-seat.js +17 -1
  336. package/dist/core/runner/turn-attachments.d.ts +29 -27
  337. package/dist/core/runner/turn-attachments.js +27 -42
  338. package/dist/core/runner-deps.d.ts +32 -19
  339. package/dist/core/secret-env.d.ts +35 -4
  340. package/dist/core/secret-env.js +65 -3
  341. package/dist/core/sensitive-path-policy.js +3 -3
  342. package/dist/core/session-policy-store.d.ts +12 -3
  343. package/dist/core/session-policy-store.js +29 -10
  344. package/dist/core/session-store.d.ts +5 -7
  345. package/dist/core/session-store.js +50 -11
  346. package/dist/core/side-query.d.ts +11 -1
  347. package/dist/core/side-query.js +9 -0
  348. package/dist/core/skill-grant-binding.d.ts +31 -2
  349. package/dist/core/skill-grant-binding.js +31 -1
  350. package/dist/core/skill-grant.d.ts +17 -5
  351. package/dist/core/skill-grant.js +24 -6
  352. package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
  353. package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
  354. package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
  355. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  356. package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
  357. package/dist/core/stub-env.d.ts +5 -5
  358. package/dist/core/stub-env.js +11 -1
  359. package/dist/core/swappable-deps.d.ts +17 -43
  360. package/dist/core/swappable-deps.js +15 -5
  361. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  362. package/dist/core/synthetic-read-verdict.js +2 -1
  363. package/dist/core/task-event.d.ts +50 -10
  364. package/dist/core/task-notification.d.ts +88 -5
  365. package/dist/core/task-notification.js +146 -17
  366. package/dist/core/task-registry-agent.d.ts +18 -12
  367. package/dist/core/task-registry-agent.js +19 -6
  368. package/dist/core/task-registry-monitor.d.ts +7 -0
  369. package/dist/core/task-registry-monitor.js +28 -1
  370. package/dist/core/task-registry-shared.d.ts +43 -3
  371. package/dist/core/task-registry-shared.js +21 -7
  372. package/dist/core/task-registry-workflow.js +1 -1
  373. package/dist/core/task-registry.d.ts +50 -35
  374. package/dist/core/task-registry.js +64 -23
  375. package/dist/core/task-result.d.ts +3 -12
  376. package/dist/core/task-spec.d.ts +15 -7
  377. package/dist/core/task-stream.d.ts +1 -1
  378. package/dist/core/terminal-cause.d.ts +10 -0
  379. package/dist/core/tool-catalog-entries.js +1 -1
  380. package/dist/core/tool-check-reading.d.ts +1 -0
  381. package/dist/core/tool-check-reading.js +3 -3
  382. package/dist/core/tool-face-reader.d.ts +7 -6
  383. package/dist/core/tool-face-reader.js +4 -3
  384. package/dist/core/tool-name-aliases.d.ts +19 -0
  385. package/dist/core/tool-name-aliases.js +54 -2
  386. package/dist/core/tool-policy.d.ts +21 -4
  387. package/dist/core/tool-policy.js +1 -1
  388. package/dist/core/tool-registry.d.ts +5 -5
  389. package/dist/core/tool-registry.js +2 -2
  390. package/dist/core/tool-result-store.d.ts +88 -5
  391. package/dist/core/tool-result-store.js +51 -12
  392. package/dist/core/tool-roster.d.ts +112 -5
  393. package/dist/core/tool-roster.js +42 -1
  394. package/dist/core/tool-spec.d.ts +23 -5
  395. package/dist/core/trace.d.ts +0 -1
  396. package/dist/core/types.d.ts +5 -5
  397. package/dist/core/types.js +2 -2
  398. package/dist/core/untrusted-text.js +1 -1
  399. package/dist/core/user-attachment.d.ts +10 -5
  400. package/dist/core/user-attachment.js +15 -7
  401. package/dist/core/wiring-manifest.d.ts +6 -3
  402. package/dist/engine/compaction/compaction.js +29 -3
  403. package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
  404. package/dist/engine/execution-env/node-execution-env.js +21 -13
  405. package/dist/engine/harness/agent-harness.d.ts +26 -3
  406. package/dist/engine/harness/agent-harness.js +49 -16
  407. package/dist/engine/harness/messages.d.ts +3 -1
  408. package/dist/engine/harness/messages.js +3 -2
  409. package/dist/engine/harness/types.d.ts +119 -28
  410. package/dist/engine/llm/rejected-images.d.ts +46 -0
  411. package/dist/engine/llm/rejected-images.js +54 -0
  412. package/dist/engine/llm/tool-turns.d.ts +2 -1
  413. package/dist/engine/llm/types.d.ts +18 -7
  414. package/dist/engine/loop/agent-loop.d.ts +20 -12
  415. package/dist/engine/loop/agent-loop.js +205 -36
  416. package/dist/engine/loop/types.d.ts +12 -3
  417. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  418. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  419. package/dist/engine/session/path-to-root.d.ts +38 -0
  420. package/dist/engine/session/path-to-root.js +39 -0
  421. package/dist/engine/session/storage-base.js +4 -21
  422. package/dist/index.d.ts +35 -21
  423. package/dist/index.js +26 -17
  424. package/dist/internal/harness-types.d.ts +1 -1
  425. package/dist/internal/harness.d.ts +1 -0
  426. package/dist/internal/llm.d.ts +1 -0
  427. package/dist/orchestration/run-workflow-tool.d.ts +9 -3
  428. package/dist/orchestration/run-workflow-tool.js +59 -29
  429. package/dist/orchestration/workflow-governance.d.ts +1 -1
  430. package/dist/orchestration/workflow-governance.js +2 -1
  431. package/dist/orchestration/workflow-observe.d.ts +17 -1
  432. package/dist/orchestration/workflow-observe.js +20 -0
  433. package/dist/orchestration/workflow-types.d.ts +32 -7
  434. package/dist/orchestration/workflow.d.ts +4 -0
  435. package/dist/orchestration/workflow.js +762 -491
  436. package/dist/prompts/default.d.ts +1 -10
  437. package/dist/prompts/default.js +0 -2
  438. package/dist/shell/counting-pass.d.ts +50 -0
  439. package/dist/shell/counting-pass.js +502 -0
  440. package/dist/shell/lex.d.ts +4 -2
  441. package/dist/shell/lex.js +93 -34
  442. package/dist/shell/shell-words.d.ts +1 -1
  443. package/dist/shell/shell-words.js +7 -6
  444. package/dist/stores/file/background-agent-store.d.ts +1 -1
  445. package/dist/stores/file/background-agent-store.js +3 -1
  446. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  447. package/dist/stores/file/checkpoint-store.js +19 -14
  448. package/dist/stores/file/file-history-store.d.ts +1 -1
  449. package/dist/stores/file/file-history-store.js +3 -1
  450. package/dist/stores/file/index.d.ts +4 -3
  451. package/dist/stores/file/index.js +17 -8
  452. package/dist/stores/file/mailbox-store.d.ts +1 -1
  453. package/dist/stores/file/mailbox-store.js +9 -11
  454. package/dist/stores/file/memory-store.d.ts +1 -1
  455. package/dist/stores/file/memory-store.js +3 -1
  456. package/dist/stores/file/session-policy-store.d.ts +1 -1
  457. package/dist/stores/file/session-policy-store.js +3 -1
  458. package/dist/stores/file/session-store.d.ts +1 -1
  459. package/dist/stores/file/session-store.js +3 -1
  460. package/dist/stores/file/shared-ledger.d.ts +26 -0
  461. package/dist/stores/file/shared-ledger.js +38 -9
  462. package/dist/stores/file/tool-result-store.d.ts +20 -2
  463. package/dist/stores/file/tool-result-store.js +74 -6
  464. package/dist/stores/file/usage-window-store.d.ts +1 -1
  465. package/dist/stores/file/usage-window-store.js +3 -1
  466. package/dist/stores/file/workflow-journal-store.d.ts +1 -11
  467. package/dist/stores/file/workflow-journal-store.js +3 -2
  468. package/dist/tools/fs/containment-face.d.ts +5 -0
  469. package/dist/tools/fs/encoding.d.ts +13 -4
  470. package/dist/tools/fs/encoding.js +17 -2
  471. package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
  472. package/dist/tools/fs/fs-bash-background-text.js +1 -0
  473. package/dist/tools/fs/fs-bash.d.ts +14 -4
  474. package/dist/tools/fs/fs-bash.js +29 -35
  475. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  476. package/dist/tools/fs/fs-pdf.js +26 -21
  477. package/dist/tools/fs/fs-read.d.ts +5 -4
  478. package/dist/tools/fs/fs-read.js +35 -18
  479. package/dist/tools/fs/fs-search-tools.js +4 -1
  480. package/dist/tools/fs/fs-shared.d.ts +11 -13
  481. package/dist/tools/fs/fs-shared.js +11 -7
  482. package/dist/tools/fs/fs-write.js +5 -5
  483. package/dist/tools/fs/index.d.ts +14 -8
  484. package/dist/tools/fs/index.js +13 -5
  485. package/dist/tools/fs/program-read-model.d.ts +13 -0
  486. package/dist/tools/fs/program-read-model.js +15 -0
  487. package/dist/tools/fs/program-read-model.rows.js +1 -1
  488. package/dist/tools/fs/read-deny.d.ts +13 -10
  489. package/dist/tools/fs/read-deny.js +25 -5
  490. package/dist/tools/fs/read-floor.d.ts +62 -0
  491. package/dist/tools/fs/read-floor.js +58 -0
  492. package/dist/tools/fs/removal-targets.d.ts +9 -4
  493. package/dist/tools/fs/removal-targets.js +17 -9
  494. package/dist/tools/fs/search.d.ts +3 -3
  495. package/dist/tools/fs/search.js +4 -4
  496. package/dist/tools/fs/shell-read-check.d.ts +1 -1
  497. package/dist/tools/fs/shell-read-check.js +2 -1
  498. package/dist/tools/fs/shell-read-judge.d.ts +16 -8
  499. package/dist/tools/fs/shell-read-judge.js +10 -6
  500. package/dist/tools/fs/shell-read-plan.d.ts +6 -1
  501. package/dist/tools/fs/shell-read-plan.js +22 -15
  502. package/dist/tools/fs/shell-read-start.js +1 -0
  503. package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
  504. package/dist/tools/fs/shell-reentry-text.js +25 -3
  505. package/dist/tools/monitor.d.ts +9 -4
  506. package/dist/tools/monitor.js +17 -8
  507. package/dist/tools/scheduler-tools.js +42 -4
  508. package/dist/tools/web.d.ts +0 -10
  509. package/dist/tools/web.js +1 -4
  510. package/package.json +5 -2
  511. package/test/export-surface.snapshot.json +161 -21
  512. package/wire-changes/core-stores-sql@7.59.0.json +29 -0
  513. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  514. package/wire-changes/core@7.59.0.json +2459 -0
  515. package/wire-changes/core@7.60.0.json +3274 -0
  516. package/wire-changes/mods-kernel@7.59.0.json +29 -0
  517. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  518. package/wire-changes/primitives@7.59.0.json +29 -0
  519. package/wire-changes/primitives@7.60.0.json +30 -0
@@ -30,8 +30,9 @@ export declare function deploymentCanRerootChild(deps: Pick<RunnerDeps, "executi
30
30
  */
31
31
  export declare function childPlacementOf(env: Pick<ExecutionEnv, "canonicalPath">, childRoot: string, asked: string | undefined, callerRoot: string): Promise<ChildPlacement>;
32
32
  /** A delegated leg's placement: the place asked for is the hint (a minted worktree, an explicit cwd, the caller's own cwd)
33
- * — or, for a worktree the factory mints itself (`isolation`), that worktree on the caller's host (a remote environment's
34
- * is another namespace). A leg no delegation caller placed (no `callerRoot`) has no placement and reads nothing. */
33
+ * — or, for a worktree the factory mints itself (`isolation`), that worktree on the caller's host when the environment's
34
+ * paths are the host's (`pathsAreHostLocal`; any other environment's is another namespace). A leg no delegation caller
35
+ * placed (no `callerRoot`) has no placement and reads nothing. */
35
36
  export declare function childPlacementOnLeg(env: ExecutionEnv, internals: Pick<RunInternals, "isolation" | "parentCwd"> & {
36
37
  readonly callerRoot: string;
37
38
  }, root: string): Promise<ChildPlacement>;
@@ -66,7 +67,7 @@ export type ChainInstallationGap = "absent" | "misaligned" | "invalid";
66
67
  * installing those entries anywhere else (the chain's top leg, this leg) would move what they protect. Entries whose rules
67
68
  * do not depend on it, and installed entries, never need a record.
68
69
  */
69
- export declare function chainInstallationGaps(chain: readonly ToolPolicy[], installations: ChainInstallations, rebase: (p: string) => string): Array<{
70
+ export declare function chainInstallationGaps(chain: readonly (ToolPolicy | undefined)[], installations: ChainInstallations, rebase: (p: string) => string): Array<{
70
71
  readonly position: number;
71
72
  readonly gap: ChainInstallationGap;
72
73
  }>;
@@ -90,7 +91,7 @@ export declare function chainPolicyOnLeg(cfg: {
90
91
  leg: PathRuleBases;
91
92
  chainTop: PathRuleBases;
92
93
  placement: ChildPlacement | undefined;
93
- chain: readonly ToolPolicy[];
94
+ chain: readonly (ToolPolicy | undefined)[];
94
95
  installations: ChainInstallations;
95
96
  rebase: (p: string) => string;
96
97
  }): {
@@ -98,13 +99,11 @@ export declare function chainPolicyOnLeg(cfg: {
98
99
  chained: (policy: ToolPolicy, position: number) => ToolPolicy;
99
100
  };
100
101
  /** The installation record of a chain entry (its root and home), `null` for an entry with no path rules installed. */
101
- export declare function installationRecordOf(policy: ToolPolicy): {
102
+ export declare function installationRecordOf(policy: ToolPolicy | undefined): {
102
103
  readonly root: string;
103
104
  readonly home?: string;
104
105
  } | null;
105
106
  /** What a leg hands its children about anchors (data half): the chain's top leg's anchors — the person's global / session
106
107
  * rows and every `~/` row anchor there — and where each entry handed down was installed, position for position (a chain
107
108
  * re-supplied uninstalled is installed there again; absent when no entry is an installation). */
108
- export declare function chainAnchorRecords(chainTop: PathRuleBases, chain: readonly {
109
- readonly policy: ToolPolicy;
110
- }[]): Pick<InheritedGate, "pathRuleAnchors" | "pathRuleInstallations">;
109
+ export declare function chainAnchorRecords(chainTop: PathRuleBases, chain: NonNullable<InheritedGate["parentConstraints"]>): Pick<InheritedGate, "pathRuleAnchors" | "pathRuleInstallations">;
@@ -1,4 +1,4 @@
1
- import { isRemoteExecutionEnv } from "../remote-env.js";
1
+ import { pathsAreHostLocal } from "../remote-env.js";
2
2
  import { validatePath } from "../effective-path-target.js";
3
3
  import { installPolicyAnchors, installationAnchorsOf, installedFrom } from "../path-rule-binding.js";
4
4
  import { CheckpointError } from "../checkpoint-store.js";
@@ -23,7 +23,7 @@ export async function childPlacementOf(env, childRoot, asked, callerRoot) {
23
23
  return root === tree || root.startsWith(tree.endsWith(sep) ? tree : tree + sep) ? "caller_tree" : "elsewhere";
24
24
  }
25
25
  export function childPlacementOnLeg(env, internals, root) {
26
- const asked = internals.isolation === "worktree" ? (isRemoteExecutionEnv(env) ? undefined : root) : internals.parentCwd;
26
+ const asked = internals.isolation === "worktree" ? (pathsAreHostLocal(env) ? root : undefined) : internals.parentCwd;
27
27
  return childPlacementOf(env, root, asked, internals.callerRoot);
28
28
  }
29
29
  export function worktreeNotHonored(cwd) {
@@ -64,7 +64,7 @@ function recordedInstallation(installations, chainLength, position, rebase) {
64
64
  }
65
65
  export function chainInstallationGaps(chain, installations, rebase) {
66
66
  return chain.flatMap((policy, position) => {
67
- if (!dependsOnInstallation(policy))
67
+ if (policy === undefined || !dependsOnInstallation(policy))
68
68
  return [];
69
69
  const r = recordedInstallation(installations, chain.length, position, rebase);
70
70
  return typeof r === "string" ? [{ position, gap: r }] : [];
@@ -90,18 +90,18 @@ export function chainPolicyOnLeg(cfg) {
90
90
  const own = (policy) => {
91
91
  if (policy === undefined)
92
92
  return undefined;
93
- const position = cfg.placement === "elsewhere" ? -1 : cfg.chain.findIndex((c) => (installedFrom(c) ?? c) === (installedFrom(policy) ?? policy));
93
+ const position = cfg.placement === "elsewhere" ? -1 : cfg.chain.findIndex((c) => c !== undefined && (installedFrom(c) ?? c) === (installedFrom(policy) ?? policy));
94
94
  return position >= 0 ? chained(cfg.chain[position], position) : installPolicyAnchors(policy, cfg.leg);
95
95
  };
96
96
  return { own, chained };
97
97
  }
98
98
  export function installationRecordOf(policy) {
99
- const a = installationAnchorsOf(policy);
99
+ const a = policy !== undefined ? installationAnchorsOf(policy) : undefined;
100
100
  return a?.root === undefined ? null : { root: a.root, ...(a.home !== undefined ? { home: a.home } : {}) };
101
101
  }
102
102
  export function chainAnchorRecords(chainTop, chain) {
103
103
  return {
104
104
  ...(chainTop.root !== undefined ? { pathRuleAnchors: { root: chainTop.root, ...(chainTop.home !== undefined ? { home: chainTop.home } : {}) } } : {}),
105
- ...(chain.some((pc) => installationAnchorsOf(pc.policy)?.root !== undefined) ? { pathRuleInstallations: chain.map((pc) => installationRecordOf(pc.policy)) } : {}),
105
+ ...(chain.some((pc) => installationRecordOf(pc.policy) !== null) ? { pathRuleInstallations: chain.map((pc) => installationRecordOf(pc.policy)) } : {}),
106
106
  };
107
107
  }
@@ -25,6 +25,10 @@
25
25
  * ② THE LADDER — here, AFTER a call. Trigger: the rung produced no RULING. Effect: the next rung is asked.
26
26
  * Record: `GateDisposition.classifier.fallback` on every classification this run's own gate decided (an
27
27
  * inherited-ancestor chain carries the form and no attribution) + the throttled `classifier.fallback`.
28
+ * The ladder has ONE terminating law: a rung whose dispatch ended on the provider's rate limit on
29
+ * `rateLimitBreakAfter` classifications in a row is not asked again this run (the decider's retirement,
30
+ * `auto-mode.ts`) — the walk starts behind it, and `classifier.seat_rate_limited` says so once. It is the
31
+ * ladder's own end-of-the-line for a rung, not a second retry beside the brain's backoff.
28
32
  *
29
33
  * They FOLD rather than stack: after a ① SWAP the seat and the main model are the same route, so
30
34
  * {@link classifierLadderRungs} returns ONE rung and ② cannot fire in the same run (and under `"none"`, where
@@ -277,12 +281,16 @@ export declare function classifierReplyAsksAgain(reply: AssistantMessage): boole
277
281
  * and the decider maps the throw to `unavailable` (`error`), as it maps every leg failure; the sibling
278
282
  * side-channel legs (compaction, consolidation) already read an error stop this way. The cap-cut form
279
283
  * (`errorKind: "length_empty"`) is not a failure: it is the empty-at-cap reply the re-ask owns.
284
+ *
285
+ * A failure whose provider status was a 429 (`apiErrorStatus`, stamped by the brain on the terminal of a call whose own
286
+ * backoff ladder ran out) carries `AUTO_MODE_RUNG_RATE_LIMITED_CODE`: the one fact the decider's retirement count reads.
287
+ * Nothing else about the failure changes — it is still the leg failure the decider maps to `unavailable` / `error`.
280
288
  */
281
289
  export declare function classifierReplyFailure(reply: AssistantMessage): Error | undefined;
282
290
  /**
283
291
  * The per-decision READ of a classification, as one seat: the `auto_mode.classified` trace frame (wall time,
284
- * verdict, cause), the ladder's throttled `classifier.fallback` disclosure and the per-model
285
- * `classifier.contract_broken` streak. All are observers — a throwing sink never reaches the gate (the decider
292
+ * verdict, cause), the ladder's throttled `classifier.fallback` disclosure, the per-model
293
+ * `classifier.contract_broken` streak and the decider's one `classifier.seat_rate_limited` report. All are observers — a throwing sink never reaches the gate (the decider
286
294
  * swallows it), and none changes a verdict.
287
295
  *
288
296
  * The frame's `model` is the model the classification RAN ON, which is what the field has always meant (its
@@ -1,9 +1,9 @@
1
1
  import { sameRouteIdentity } from "../../brain/route-adjudicator.js";
2
2
  import { lowestReasoningSeat } from "../../brain/reasoning-request.js";
3
3
  import { AUTO_MODE_CLASSIFIER_CONTRACT_BROKEN_AFTER, AUTO_MODE_CLASSIFIER_LOW_REASONING_BUDGET_TOKENS, AUTO_MODE_CLASSIFIER_MAX_TOKENS, AUTO_MODE_CLASSIFIER_THINK_BUDGET_TOKENS } from "../auto-mode-defaults.js";
4
- import { autoModeClassifierFallbackOf, parseAutoModeResponse } from "../auto-mode.js";
4
+ import { AUTO_MODE_RUNG_RATE_LIMITED_CODE, autoModeClassifierFallbackOf, parseAutoModeResponse } from "../auto-mode.js";
5
5
  import { classifierUnavailableDispositionOf } from "../classifier-unavailable-arm.js";
6
- import { DEFAULT_TIER_ORDER, expandTiers, resolveTaskModel, roleSpecNamesModel } from "../roles.js";
6
+ import { catalogModel, DEFAULT_TIER_ORDER, isReceivedCatalog, receiveModelCatalog, receiveRoleMap, resolveTaskModel, roleSpecNamesModel } from "../roles.js";
7
7
  import { emitTrace } from "../trace.js";
8
8
  import { deliverEngineNotice } from "../types.js";
9
9
  export function classifierLadderRungs(knob, classifier, main) {
@@ -22,7 +22,8 @@ function sameRouteQuietly(a, b) {
22
22
  export const CLASSIFIER_ROLE_DEFAULT_REASONS = Object.freeze(["tier_below_main", "tier_table", "role_fallback", "main_only", "role_unresolvable"]);
23
23
  export function classifierSeatModel(args) {
24
24
  const { main } = args;
25
- const deps = normalizeSeatDeps(args.deps);
25
+ const normalized = normalizeSeatDeps(args.deps);
26
+ const deps = { ...normalized, roles: receiveRoleMap(normalized.roles, "RunnerDeps.roles") };
26
27
  if (roleSpecNamesModel(deps.roles?.classifier)) {
27
28
  try {
28
29
  return { model: resolveTaskModel({ modelRole: "classifier" }, deps).model };
@@ -45,20 +46,28 @@ export function classifierSeatModel(args) {
45
46
  }
46
47
  }
47
48
  export function normalizeSeatDeps(deps) {
48
- if (deps.tiers === undefined)
49
+ if (deps.tiers === undefined || isReceivedCatalog(deps.models))
49
50
  return deps;
50
51
  try {
51
- return { ...deps, models: expandTiers(deps.models, deps.tiers) };
52
+ return { ...deps, ...receiveModelCatalog(deps.models, deps.tiers, "RunnerDeps") };
52
53
  }
53
54
  catch {
54
55
  return deps;
55
56
  }
56
57
  }
58
+ function tierModelQuietly(deps, tier) {
59
+ try {
60
+ return catalogModel(tier, deps.models, `tiers.${tier}`);
61
+ }
62
+ catch {
63
+ return undefined;
64
+ }
65
+ }
57
66
  export function tierIndexOf(deps, model) {
58
67
  if (deps.tiers === undefined || Object.keys(deps.tiers).length === 0 || deps.models === undefined)
59
68
  return undefined;
60
69
  for (let i = DEFAULT_TIER_ORDER.length - 1; i >= 0; i--) {
61
- const m = deps.models[DEFAULT_TIER_ORDER[i]];
70
+ const m = tierModelQuietly(deps, DEFAULT_TIER_ORDER[i]);
62
71
  if (m !== undefined && sameRouteQuietly(m, model))
63
72
  return i;
64
73
  }
@@ -68,7 +77,7 @@ function tierBelowMain(deps, main) {
68
77
  const mainTier = tierIndexOf(deps, main);
69
78
  if (mainTier === undefined)
70
79
  return undefined;
71
- const bound = DEFAULT_TIER_ORDER.map((tier) => deps.models?.[tier]);
80
+ const bound = DEFAULT_TIER_ORDER.map((tier) => tierModelQuietly(deps, tier));
72
81
  for (let i = mainTier + 1; i < bound.length; i++) {
73
82
  const m = bound[i];
74
83
  if (m !== undefined && !sameRouteQuietly(m, main))
@@ -191,6 +200,23 @@ function classifierContractAnnouncer(args) {
191
200
  streak.delete(`${landed}:${record.modelUsed}`);
192
201
  };
193
202
  }
203
+ function announceRateLimitBreak(args, brk) {
204
+ deliverEngineNotice(args.onNotice, {
205
+ code: "classifier.seat_rate_limited",
206
+ message: `the auto-mode classifier model "${brk.model}" was rate limited (HTTP 429) on ${brk.consecutive} consecutive classifications — ` +
207
+ `for the rest of this run it is not asked again, and every gated call is judged on "${brk.to}" without waiting for it. ` +
208
+ "Raise that model's rate limit at its gateway, or name a different `classifier` role; RunnerDeps.autoMode.rateLimitBreakAfter sets how many in a row it takes.",
209
+ detail: {
210
+ model: brk.model,
211
+ to: brk.to,
212
+ rung: brk.rung,
213
+ consecutive: brk.consecutive,
214
+ ...(args.sessionId !== undefined ? { sessionId: args.sessionId } : {}),
215
+ ...(args.runId !== undefined ? { runId: args.runId } : {}),
216
+ },
217
+ ...(args.sessionId !== undefined ? { sessionId: args.sessionId } : {}),
218
+ });
219
+ }
194
220
  export const CLASSIFIER_OFF_SEAT = { reasoning: "off", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS };
195
221
  export const CLASSIFIER_LOW_SEAT = { reasoning: "low", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS + AUTO_MODE_CLASSIFIER_LOW_REASONING_BUDGET_TOKENS };
196
222
  export const CLASSIFIER_THINK_SEAT = { reasoning: "low", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS + AUTO_MODE_CLASSIFIER_THINK_BUDGET_TOKENS };
@@ -236,7 +262,10 @@ export function classifierReplyFailure(reply) {
236
262
  return new Error("the auto-mode classifier request was aborted");
237
263
  if (reply.stopReason !== "error" || reply.errorKind === "length_empty")
238
264
  return undefined;
239
- return new Error(`the auto-mode classifier request failed: ${reply.errorMessage ?? "the model leg reported an error with no message"}`);
265
+ const failure = new Error(`the auto-mode classifier request failed: ${reply.errorMessage ?? "the model leg reported an error with no message"}`);
266
+ if (reply.apiErrorStatus === 429)
267
+ failure.code = AUTO_MODE_RUNG_RATE_LIMITED_CODE;
268
+ return failure;
240
269
  }
241
270
  export function classifierRoundObserver(args) {
242
271
  const announceFallback = classifierFallbackAnnouncer(args);
@@ -256,5 +285,7 @@ export function classifierRoundObserver(args) {
256
285
  }));
257
286
  announceFallback(info.classifier);
258
287
  countContract(info);
288
+ for (const brk of info.rateLimitBreaks ?? [])
289
+ announceRateLimitBreak(args, brk);
259
290
  };
260
291
  }
@@ -1,10 +1,12 @@
1
1
  import { checkedAgentConfigDir } from "../agent-config-dir.js";
2
2
  import { checkedMediaByteCap } from "../media-byte-cap.js";
3
+ import { checkedImageProcessorSeat } from "../image-downsample.js";
3
4
  import { receiptRefusal, receiveOwnProperties, refuseProxy } from "../own-property-receipt.js";
4
5
  import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
5
6
  import { copyReadDenySeat, READ_DENY_DEPLOYMENT_SEATS } from "../read-face-seats.js";
6
7
  import { receiveHostFloor } from "../host-floor.js";
7
8
  import { holdOwnCredentialValues } from "../secret-env.js";
9
+ import { receivePeerSeat } from "../peer-seat.js";
8
10
  export function retainRunnerDeps(deps) {
9
11
  const words = { subject: "RunnerDeps", unit: "seat", moment: "at new Runner" };
10
12
  refuseProxy(deps, words);
@@ -12,12 +14,15 @@ export function retainRunnerDeps(deps) {
12
14
  const retained = receiveOwnProperties(deps, words);
13
15
  checkedAgentConfigDir(retained.agentConfigDir, "RunnerDeps.agentConfigDir");
14
16
  checkedMediaByteCap(retained.mediaByteCapBytes, "RunnerDeps.mediaByteCapBytes");
17
+ checkedImageProcessorSeat(retained.imageProcessor, "RunnerDeps.imageProcessor");
15
18
  for (const seat of READ_DENY_DEPLOYMENT_SEATS) {
16
19
  if (Object.hasOwn(retained, seat))
17
20
  Object.defineProperty(retained, seat, { value: copyReadDenySeat(Reflect.get(retained, seat)), enumerable: true, writable: true, configurable: true });
18
21
  }
19
22
  if (Object.hasOwn(retained, "hostFloor"))
20
23
  Object.defineProperty(retained, "hostFloor", { value: receiveHostFloor(Reflect.get(retained, "hostFloor")), enumerable: true, writable: true, configurable: true });
24
+ if (Object.hasOwn(retained, "peerSeat"))
25
+ Object.defineProperty(retained, "peerSeat", { value: receivePeerSeat(Reflect.get(retained, "peerSeat"), "RunnerDeps.peerSeat"), enumerable: true, writable: true, configurable: true });
21
26
  let consolidationKey;
22
27
  try {
23
28
  const chat = retained.memoryConsolidationDriver?.chat;
@@ -17,7 +17,7 @@ import type { HumanReviewGateRow } from "../task-result.js";
17
17
  import type { RepairBundle } from "../../agents/repair-loop.js";
18
18
  import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
19
19
  import type { BrainCallGuardrailRef } from "../../brain/timeout.js";
20
- import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput, AnnouncedMcpFailure, ExecutionEnv, ThinkingLevel } from "../../internal/harness.js";
20
+ import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput, ExecutionEnv, ThinkingLevel } from "../../internal/harness.js";
21
21
  import type { Model } from "../../internal/llm.js";
22
22
  import type { WorkflowSizeGuideline } from "../../orchestration/workflow-size-guideline.js";
23
23
  import type { ToolManifestRow } from "../../prompt-assembly/tool-catalog.js";
@@ -37,7 +37,7 @@ import type { Checkpoint, CheckpointState, CheckpointStore, CheckpointToken, Pen
37
37
  import type { ExecutionOutcomeRecordWord } from "../checkpoint-execution-record.js";
38
38
  import type { ClearedProjectionLedger, MicroCompactMachine, OccurrenceIndex } from "../context-edit.js";
39
39
  import type { ModBus } from "../mods/kernel/index.js";
40
- import type { LegModBus, LegMods, ModChainLink } from "../mods/stations.js";
40
+ import type { LegModBus, LegMods } from "../mods/stations.js";
41
41
  import type { HookInvocationIdentity, OrgGateVerdict, PermissionDeniedPayload, PostToolBatchCall, ToolGateInput } from "../hooks.js";
42
42
  import type { MaterializedMcp } from "../mcp.js";
43
43
  import type { MemoryEngine } from "../memory-engine/engine.js";
@@ -63,7 +63,7 @@ import type { GitStatusLaneRef } from "./git-status-frame.js";
63
63
  import type { SessionReadFileStates } from "./session-read-file-states.js";
64
64
  import type { LegModeCeiling, SessionModeSeats } from "./session-mode-seats.js";
65
65
  import type { BlockedRef, OutputRef, SkillListingEntry } from "./synthetic-tools.js";
66
- import type { createAttachmentState, WriteFamily } from "./turn-attachments.js";
66
+ import type { AttachmentSource, createAttachmentState, WriteFamily } from "./turn-attachments.js";
67
67
  import type { SideCallBook } from "./side-call-account.js";
68
68
  import type { cacheFamilyOf } from "./usage-accounting.js";
69
69
  /**
@@ -221,20 +221,20 @@ export interface DateAnchorRead {
221
221
  * One engine frame whose commit waits for the receipt of the message carrying it.
222
222
  *
223
223
  * @contract frames.commit_on_receipt — an engine-minted frame that rides a user message (the git-status
224
- * frame, an `agent_listing`, `skills_listing` or `date_change` frame) is recorded as announced ONLY when the run loop's
225
- * `message_end` walk sees a persisted user entry whose text equals the carrying text it was registered
226
- * with; every receipt with that text settles on that one entry. Until then nothing is recorded — a
227
- * message that never reaches the transcript (a pre-append failure, a suppressed or undrained steer, a
228
- * leg that ends first) leaves the frame unannounced, and the next boundary or leg renders it again.
229
- * The error asymmetry is one-directional by design: a lost receipt costs a duplicate frame, never a
230
- * fact the model was recorded as told and was not.
224
+ * frame, a leg's first-request frames, every turn-boundary attachment, a limit-approach notice) is recorded —
225
+ * an announced set or value, a drained pending entry, a once digest, a window's stamp, a latch, its echo and count
226
+ * — ONLY when the run loop's `message_end` walk sees a persisted user entry whose text equals the carrying text it
227
+ * was registered with; every receipt with that text settles on that one entry. Collection records nothing: a
228
+ * message that never reaches the transcript (a pre-append failure, a suppressed or undrained steer, a leg that
229
+ * ends first) leaves the frame unannounced, and the next boundary or leg renders it again. A lost receipt costs a
230
+ * duplicate frame, never a fact the model was recorded as told and was not.
231
231
  */
232
232
  export interface FrameReceipt {
233
233
  /** The carrying message's exact text (its first text block) — the receipt's match key. */
234
234
  text: string;
235
235
  /** Which frame this receipt settles. No collector renders a frame whose receipt is still pending (the frame is on
236
236
  * its way, not yet in the transcript) — the one reading is `frameCarried` (compaction-restate.ts). */
237
- source: "git_status" | "agent_listing" | "skills_listing" | "date_change" | "output_style" | "mcp_unavailable" | "posture" | "advisor_tool";
237
+ source: "git_status" | "posture" | "advisor_tool" | "limit_approach" | AttachmentSource;
238
238
  /** Runs inside the `message_end` walk (synchronous, never awaited): advances the run-local record
239
239
  * and parks any session write for the next serialization point. */
240
240
  commit: (entryId: string) => void;
@@ -472,8 +472,8 @@ export interface Prepared {
472
472
  decidedBy: HostDecider;
473
473
  }) => Promise<{
474
474
  readonly refused: string;
475
+ readonly extension?: string;
475
476
  } | {
476
- readonly args: unknown;
477
477
  readonly admit: () => void;
478
478
  }>;
479
479
  /** The leg's `tool.call` station (`mods/tool-call.ts`) — every execution of a call passes it; absent when no handler hangs on the event. */
@@ -569,6 +569,8 @@ export interface Prepared {
569
569
  /** The pending commits of this leg's attachment frames, settled by the transcript-append receipt sink — the one place
570
570
  * an attachment's read effects are applied. Always present. */
571
571
  attachmentDelivery: import("../user-attachment.js").AttachmentDelivery;
572
+ /** The run's once-per-run account of an image sent unprocessed over the soft target — the tool-result seat's and the leg's (task images, attachments). */
573
+ imageUnprocessed: (bytes: number) => void;
572
574
  /** The leg's one file reader — the Read tool's own (one read state, one set of disclosure windows and counters),
573
575
  * handed to the leg's other carriers of a file. Present iff hands are mounted. */
574
576
  modelFileReader?: import("../../tools/fs/fs-read.js").ModelFileReader;
@@ -890,18 +892,17 @@ export interface Prepared {
890
892
  /** Set by a tool calling `ctx.requestReview()` (the first-party `present_plan` tool, CC
891
893
  * ExitPlanMode parity): the run loop honors it at the next CLEAN turn boundary by minting a `plan_review`
892
894
  * checkpoint. `{ pending }` is set (with an optional reason) the moment a tool requests review; the boundary
893
- * reads + clears it. First request in a batch wins (idempotent). */
895
+ * reads + clears it. First request in a batch wins (idempotent), and so does its `requestedByCallId` — the
896
+ * engine-bound id of the call that asked, which the mint writes onto the parked row. */
894
897
  reviewRequestRef: {
895
- pending?: {
896
- reason?: string;
897
- };
898
+ pending?: import("../present-plan-tool.js").ReviewRequest;
898
899
  };
899
900
  /** Present (≠ undefined) ONLY when a `checkpointStore` is wired (the deployment can pause). The
900
901
  * run loop calls it at a CLEAN turn boundary when `reviewRequestRef.pending` is set: it mints a `plan_review`
901
902
  * checkpoint (`status:"needs_review"` by its registry row) + pauses the workspace + aborts the loop, reusing
902
903
  * the SAME commit saga as the human/resource suspends. Returns true iff it committed a resumable checkpoint;
903
904
  * false ⇒ the request could not be honored (caller drops it and continues). */
904
- suspendForReview?: (reason?: string) => Promise<boolean>;
905
+ suspendForReview?: (reason?: string, requestedByCallId?: string) => Promise<boolean>;
905
906
  /** The prior cross-slice {@link ResourceLedger} (from the resumed checkpoint), so the run
906
907
  * loop can size this slice's effective budget = `min(maxCostUsd, remaining)`. Undefined on the first slice
907
908
  * (or a non-resource task). */
@@ -1165,7 +1166,7 @@ export interface Prepared {
1165
1166
  * task whose every MCP tool went missing with its server is exactly the one that must say so. Carried by the leg's first
1166
1167
  * request (a fresh leg's first message, a resumed leg's continuation) and drained by that message's receipt (`settleMcpUnavailable`). */
1167
1168
  mcpUnavailable?: {
1168
- pending: AnnouncedMcpFailure[];
1169
+ pending: import("../mcp-failure.js").McpUnavailableEntry[];
1169
1170
  };
1170
1171
  /** G1 通告层续批 (CC `agent_listing_delta` parity) — the mounted delegation tool's agent-type roster
1171
1172
  * (read off `ToolSpec.agentListing`, filled by createSubagentTool), plus the tool's mounted name for
@@ -1219,15 +1220,23 @@ export interface Prepared {
1219
1220
  /** The posture composition's run-local half (the newest carrier's protection slot; the row last composed for). */
1220
1221
  postureFrameRef: import("../auto-mode-directive.js").PostureFrameRef;
1221
1222
  /** G1 通告层 — narrow getter over the process task registry: THIS run's visible live background tasks
1222
- * (pending / running / parked under the same owner/scope/session identity the TaskOutput/TaskStop tools
1223
- * use), EVERY one (`TaskRegistry.liveTasks`), as a projection (id/description/status — never
1224
- * handles/env/abort). Read by the post-compact listing (which caps what it renders), the resume's orphan
1225
- * diff and the stop hook's `backgroundTasks` view. */
1226
- listBackgroundTasks: () => Array<{
1223
+ * (pending / running / parked under the same owner/scope/session identity the TaskStop tool
1224
+ * uses), EVERY one (`TaskRegistry.liveTasks`), as a projection (id/description/status and the row's read handle,
1225
+ * `TaskRegistry.readHandleOf` — never handles/env/abort). Read by the post-compact listing (which caps what it
1226
+ * renders), the resume's orphan diff and the stop hook's `backgroundTasks` view. `{ settled: true }` = the same rows with
1227
+ * the finished ones too (`TaskRegistry.list`) — the whole-session notification loss's table, where a finished task's
1228
+ * lost frame is the likeliest loss and its read handle the one way back. */
1229
+ listBackgroundTasks: (opts?: {
1230
+ settled?: true;
1231
+ }) => Array<{
1227
1232
  id: string;
1228
1233
  description?: string;
1229
1234
  status: string;
1235
+ read?: string;
1230
1236
  }>;
1237
+ /** One task's read handle under the same identity (`TaskRegistry.readHandleOf`) — a live or terminal row this leg reaches;
1238
+ * `undefined` for an unreachable id or a row with nothing to read. Read by a dropped notification's disclosure line. */
1239
+ taskReadHandleOf: (taskId: string) => string | undefined;
1231
1240
  /** The parent-run subagent-retain ledger (present ONLY when `spec.retainSubagentSessions`
1232
1241
  * is enabled). The Runner disposes it (abort in-flight resumes + unpin + release every retained child
1233
1242
  * session) in the task's terminal `finally` — same UNCONDITIONAL posture as the background-agent reap:
@@ -1374,13 +1383,15 @@ export interface PrepareResume {
1374
1383
  * (`"always"`): a child inherits it and cannot lift it. `permissionMode` is the ceiling a child's own
1375
1384
  * declaration is clamped under.
1376
1385
  * - **Opaque half** (`parentConstraints`): each ancestor's live caller `ToolPolicy` plus its FROZEN
1377
- * `onAsk`, ancestors first — and, for a hook-wired ancestor, a SECOND entry: its PreToolUse screening
1378
- * face folded into a `ToolPolicy` (`createPreToolUseConstraintPolicy`), carrying its own frozen
1379
- * approver/mandate/env axes (the `preToolUse`/`hookEnv` fields below). Folded AFTER the child's own caller policy and BEFORE the trailing
1380
- * deny-narrowing re-check, each wrapper resolving its own `ask` via the ancestor's frozen approver —
1381
- * so a parent `ask` never widens into a child auto-allow, and a parent `allow{updatedInput}` rewrite
1382
- * is still re-checked by the child's narrowing layers. NOT serializable: a durable resume must
1383
- * re-supply it via `resumeStream(..., internals)` (see {@link CheckpointState.inheritedGate}).
1386
+ * `onAsk`, ancestors first — and, for a mods-wired ancestor, a SECOND entry: its installation (the bus
1387
+ * its admission mounted, `installation`), carrying its own frozen approver/mandate/env axes. A caller
1388
+ * policy is folded AFTER the child's own caller policy and BEFORE the trailing deny-narrowing re-check,
1389
+ * each wrapper resolving its own `ask` via the ancestor's frozen approver — so a parent `ask` never
1390
+ * widens into a child auto-allow, and a parent `allow{updatedInput}` rewrite is still re-checked by the
1391
+ * child's narrowing layers. An installation judges the child's calls at the child's gate, on the
1392
+ * installation's own bus (`classic.PreToolUse` at phase 1, `tool.check` at the verdict read), its
1393
+ * question settled under the same frozen axes. NOT serializable: a durable resume must re-supply it via
1394
+ * `resumeStream(..., internals)` (see {@link CheckpointState.inheritedGate}).
1384
1395
  *
1385
1396
  * Chain assembly is single-sited in prepareTask's ctx injection (`inheritedGateForChildren`): upstream
1386
1397
  * chain + THIS task's own contribution (its session-rule snapshot, its RESOLVED caller policy —
@@ -1489,9 +1500,18 @@ export interface InheritedGate extends InheritedAutoModeFace {
1489
1500
  * same frozen `onAsk` — no mandate). It is a CONSERVATIVE descendant-side mandate: whether or not a given ask would actually
1490
1501
  * have parked at the ancestor (the regime may be scoped), the durable-park semantics cannot be
1491
1502
  * reconstructed in a delegated child's context — so a wrapper seeing `ask` under this flag denies
1492
- * fail-closed (tighten-only holds) instead of resolving synchronously. */
1493
- parentConstraints?: ReadonlyArray<{
1503
+ * fail-closed (tighten-only holds) instead of resolving synchronously.
1504
+ *
1505
+ * Each entry is exactly ONE of two kinds: a caller policy (`policy`), or a screening installation
1506
+ * (`installation` — the bus a leg's admission mounted, or {@link import("../mods/stations.js").admitModChain}'s on a
1507
+ * cross-process re-supply). A chain naming both, neither, or an installation no engine admission mounted is refused. */
1508
+ parentConstraints?: ReadonlyArray<({
1494
1509
  policy: ToolPolicy;
1510
+ installation?: undefined;
1511
+ } | {
1512
+ installation: LegModBus;
1513
+ policy?: undefined;
1514
+ }) & {
1495
1515
  onAsk?: OnAsk;
1496
1516
  durableMandate?: boolean;
1497
1517
  /** The CONTENT-ask twin of `durableMandate`, frozen from the QUESTION seat (`spec.onQuestion ??
@@ -1543,26 +1563,14 @@ export interface InheritedGate extends InheritedAutoModeFace {
1543
1563
  };
1544
1564
  };
1545
1565
  /**
1546
- * Set by the constraint mint's caller on an entry whose `policy` is the folded form of an ancestor's
1547
- * `classic.PreToolUse` chain (`createPreToolUseConstraintPolicy`): the chain that leg's admission MOUNTED, as the
1548
- * entry declares it. It is read for ONE thing — a declaration that this entry carries a chain: beside a policy the
1549
- * mint did not make, a declared judging `tool.check` handler is refused (`config.mods_invalid`; the guard has no bus to
1550
- * be raised on), and such an entry is never treated as a caller policy (it licenses no ask grant). It is NEVER the
1551
- * entry's identity: the chain an entry stands for is read off the bus its policy was minted over (that bus's admission
1552
- * recorded it), so a host may hand any list here (`[]` included, or none) without moving what is judged.
1553
- *
1554
- * The identity (`sameInstallation`) is that chain plus the context the entry's questions are settled in — the frozen
1555
- * approver, the two durable mandates, the environment, the classifier instance — and it is the CONSERVATIVE test:
1556
- * two chains over the same registrations in a different order, or a re-built registration object, compare unequal,
1557
- * and a bus no engine admission mounted is no leg's installation. Chain assembly does not re-append a leg already on
1558
- * the chain; a descendant's own gate stands in for an entry only when that identity holds under no mandate (the
1559
- * pass-through of its `classic.PreToolUse`, the skip of its `tool.check`); any other entry is judged on both events
1560
- * under its own context — judged twice rather than skipped, never toward a missed one.
1561
- */
1562
- mods?: readonly ModChainLink[];
1563
- /**
1564
- * The environment this screening face was installed against — the source of the `HookEnvCapabilities`
1565
- * handed to it, compared BY REFERENCE, `undefined` when the installation had no env face. Part of the
1566
+ * The environment this installation was installed against — the source of the `HookEnvCapabilities` face its
1567
+ * `classic.PreToolUse` e carries (`env`), compared BY REFERENCE, `undefined` when the installation had no env. The
1568
+ * installation identity (`sameInstallation`) is the chain its bus's admission recorded plus the context its questions are
1569
+ * settled in — the frozen approver, the two durable mandates, this environment, the classifier instance — the
1570
+ * CONSERVATIVE test: two chains over the same registrations in a different order, or a re-built registration object,
1571
+ * compare unequal. Chain assembly does not re-append a leg already on the chain; a descendant's own gate stands in for an
1572
+ * installation only when that identity holds under no mandate; any other is judged on both events under its own context
1573
+ * — judged twice rather than skipped, never toward a missed one. Part of the
1566
1574
  * installation's identity for the same reason the frozen approver is (HIGH): a face that
1567
1575
  * resolves paths through `ctx.env` answers a different question in a different environment, so an
1568
1576
  * ancestor running against the deployment's tree and a descendant running in an isolated worktree are
@@ -1634,6 +1642,11 @@ export interface RunInternals {
1634
1642
  * releases the lease when its materialization is disposed — see `mcp-connection-pool.ts`. Trusted, never a TaskSpec field.
1635
1643
  */
1636
1644
  mcpPool?: import("../mcp-connection-pool.js").McpConnectionPool;
1645
+ /** This leg's host seats by declaration name: a `{ kind: "host" }` server of `TaskSpec.mcp` / `ResumeTaskConfig.mcp` dials through its
1646
+ * seat (mcp-host-seat.ts); a declaration with no seat fails its dial (`config.mcp_host_seat_missing`), a seat with no declaration is
1647
+ * announced once (`config.mcp_host_seat_undeclared`). The leg's own: a delegated child is handed the seats of the host servers it
1648
+ * is declared (inherited or its definition's own), a retained child's snapshot keeps none (its waker's seats ride each wake). Trusted, never a TaskSpec field. */
1649
+ mcpHostSeats?: ReadonlyMap<string, import("../mcp-host-seat.js").McpHostSeat>;
1637
1650
  /**
1638
1651
  * The tool-selector layers of the run that spawned this leg — its ceiling ({@link ToolFaceSnapshot.selector}`.layers`): this
1639
1652
  * leg's selector is these layers plus its own `allowTools` / `excludeTools`, so nothing a child names can widen what its
@@ -1839,6 +1852,10 @@ export interface RunInternals {
1839
1852
  * mirroring `insideFork`.
1840
1853
  */
1841
1854
  isDelegatedChild?: boolean;
1855
+ /** `true` iff this delegated leg's objective carries an operator's words — minted ONLY by a retained child's resume
1856
+ * through its steer handle (a SendMessage resume is a peer's): it passes `classic.UserPromptSubmit` before the leg
1857
+ * opens on `classic.SubagentStart`. TRUSTED run-scoped channel (NOT a {@link TaskSpec} field). */
1858
+ operatorObjective?: true;
1842
1859
  /**
1843
1860
  * Subagent transcript persistence — the child transcript session's PLACEMENT declaration, minted
1844
1861
  * by the background delegation lane (the trusted spawner: it knows the a* handle, scope and root)
@@ -2099,6 +2116,9 @@ export interface RunInternals {
2099
2116
  * per run" true across the lanes that forward. A caller value is overridden like the refs beside it;
2100
2117
  * absent ⇒ the door mints a per-object one, so containment never depends on the threading. */
2101
2118
  forwardScope?: import("./forward-sink.js").ForwardSinkScope;
2119
+ /** The door's receipt of this leg's `mcp` / `a2a` declarations — ENGINE-owned, taken by `Runner.runTaskStream` at the call for every
2120
+ * leg (a caller value is overridden): the leg's door judges this copy, and the references it names are what the leg holds (peer-seat.ts). */
2121
+ receivedPeers?: import("../locked-config.js").ReceivedPeerDeclarations;
2102
2122
  /**
2103
2123
  * The Runner's per-session read-file-state seats (CC parity: readFileState is
2104
2124
  * session-scoped). Always set by the Runner's own prepare call (overriding any caller value, like
@@ -2345,10 +2365,11 @@ export interface ResolvedWorkspace {
2345
2365
  cwd: string;
2346
2366
  /** True only for an accepted `isolation: "worktree"` request (⇒ `cwd` is this agent's own worktree). */
2347
2367
  isolated: boolean;
2348
- /** True when the task's execution env is REMOTE: `cwd` then names a path INSIDE the remote
2349
- * target (a per-task sandbox on the shape-(d) exemption leg, e.g. `/workspace`), which does not exist —
2350
- * or names an unrelated directory — on the host. `isolated && !remote` is the only combination under
2351
- * which `cwd` is a host path a consumer may diff / merge / remove. */
2368
+ /** True when the task's execution env does not declare its paths the host's (`pathsAreHostLocal` is false — whatever
2369
+ * interface drives it): `cwd` then names a path INSIDE that target (a per-task sandbox on the shape-(d) exemption leg,
2370
+ * e.g. `/workspace`), which does not exist — or names an unrelated directory — on the host. A host lane driven through
2371
+ * the remote seam reads `false`. `isolated && !remote` is the only combination under which `cwd` is a host path a
2372
+ * consumer may diff / merge / remove. */
2352
2373
  remote: boolean;
2353
2374
  /** Where a delegated child's environment placed it against where its caller asked; absent on a leg no delegation
2354
2375
  * caller placed. */
@@ -2428,7 +2449,7 @@ export interface SuspendSaga {
2428
2449
  suspendLoopCapHit: (count: number, cap: number | undefined, detail: string) => boolean;
2429
2450
  /** The `suspendVM` target by CAPABILITY, or undefined. */
2430
2451
  suspendableEnv: RemoteExecutionEnv | undefined;
2431
- /** The park-only remote target (non-suspendable, externally durable), or undefined. */
2452
+ /** The park-only remote target (declares `suspendable: false`: externally durable), or undefined. */
2432
2453
  parkOnlyRemoteEnv: RemoteExecutionEnv | undefined;
2433
2454
  /** The park-only identity capture (snapshotId stripped, `restoreMode: "park_only"`). */
2434
2455
  parkOnlyHandle: (env: RemoteExecutionEnv) => WorkspaceHandle;
@@ -2547,6 +2568,7 @@ export interface RunState {
2547
2568
  turnResponseModel: string | undefined;
2548
2569
  /** B15 三期使能:postToolBatch 的本回合聚集批(每回合边界消费并重置 — 回合语义,故归 turn)。 */
2549
2570
  toolBatch: PostToolBatchCall[];
2571
+ completed?: readonly import("../mods/lifecycle-stations.js").CompletedTurn[];
2550
2572
  };
2551
2573
  counters: {
2552
2574
  /** How many LIMIT-APPROACH frames have been injected this run (0..2). Also the
@@ -2860,6 +2882,9 @@ export interface RunnerSelfSeat {
2860
2882
  canRerootChild?(): boolean;
2861
2883
  /** Fire `RunnerDeps.onTaskOutcome` through the swallow-guarded chokepoint (thin compositions emit at their terminal state). */
2862
2884
  emitTaskOutcome(outcome: TaskOutcome): void;
2885
+ /** A hold, on the peer seat THIS runner's legs ask, of the references `declared` names — taken by a keeper of declarations
2886
+ * outside a leg (a retained child's ledger entry), released by it once (peer-seat.ts `holdPeerDeclarations`). */
2887
+ holdDeclarations(declared: import("../peer-seat.js").PeerDeclarations): import("../peer-seat.js").PeerDeclarationHold;
2863
2888
  /** Run a task to completion. `internals` is the TRUSTED run-scoped channel (never a TaskSpec field). */
2864
2889
  runTask(spec: TaskSpec, internals?: RunInternals): Promise<TaskResult>;
2865
2890
  /** Streaming form of {@link RunnerSelfSeat.runTask}; `resume` is the run loop's resume plan, `internals` the trusted channel. */
@@ -1,3 +1,4 @@
1
+ import { KEYLESS_EXIT } from "../../brain/route-adjudicator.js";
1
2
  import { runWithCredentialOriginRefusals } from "../../brain/status-sink.js";
2
3
  import { deliverEngineNotice } from "../engine-notice.js";
3
4
  export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId }) {
@@ -9,10 +10,10 @@ export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId
9
10
  announced.add(key);
10
11
  deliverEngineNotice(onNotice, {
11
12
  code: "route.credential_origin_mismatch",
12
- message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin}, the host it was ` +
13
- `first sent to, and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
13
+ message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin} (the host it was ` +
14
+ `first sent to, or the one the deployment rebound it to), and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
14
15
  `the deployment has to give the model a credential for ${requestOrigin} (or point it back at ${boundOrigin}). ` +
15
- `Said once per run for this model and these two hosts.`,
16
+ `If ${requestOrigin} takes no credential, ${KEYLESS_EXIT}. Said once per run for this model and these two hosts.`,
16
17
  detail: { modelId, boundOrigin, requestOrigin, sessionId, runId },
17
18
  });
18
19
  }, fn);
@@ -21,7 +21,7 @@
21
21
  * leg reaches declares itself the target NOW, and the tree's state NOW.
22
22
  */
23
23
  import type { AgentTool } from "../../internal/harness.js";
24
- import type { SessionTreeEntry } from "../../internal/harness-types.js";
24
+ import type { ExecutionEnv, SessionTreeEntry } from "../../internal/harness-types.js";
25
25
  import { type CrossBoundaryCheck, type CrossBoundaryPosture, type CrossBoundaryTreeToken, type OwedDeliveries } from "../cross-boundary-taint.js";
26
26
  import { type ToolRoster } from "../tool-roster.js";
27
27
  import type { RunnerDeps } from "../types.js";
@@ -73,10 +73,8 @@ export interface CrossBoundaryLaneInput {
73
73
  posture: CrossBoundaryPosture | undefined;
74
74
  /** The run fold: this leg's environment declares the target, or the row it resumes was minted on one. */
75
75
  externalContentTargetActive: boolean;
76
- /** The leg's own environment — read for its CURRENT declaration at each judgment. */
77
- env: {
78
- readonly externalContentTarget?: boolean;
79
- };
76
+ /** The leg's own environment — read for its CURRENT declaration (`targetIsExternal`) at each judgment. */
77
+ env: Pick<ExecutionEnv, "capabilities">;
80
78
  session: {
81
79
  getBranch(): Promise<ReadonlyArray<SessionTreeEntry>>;
82
80
  getLeafId(): Promise<string | null>;