@sema-agent/core 7.55.0 → 7.57.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 (502) hide show
  1. package/CHANGELOG.md +1054 -0
  2. package/LICENSE +1 -1
  3. package/dist/agents/cascade.js +1 -1
  4. package/dist/agents/cc-peer-directory.js +1 -0
  5. package/dist/agents/child-model-seat.d.ts +0 -11
  6. package/dist/agents/child-model-seat.js +0 -3
  7. package/dist/agents/list-agents-tool.d.ts +3 -1
  8. package/dist/agents/list-agents-tool.js +7 -7
  9. package/dist/agents/org-delivery-gate.js +3 -4
  10. package/dist/agents/peer-directory.d.ts +22 -4
  11. package/dist/agents/peer-directory.js +24 -2
  12. package/dist/agents/peer-held-queue.d.ts +69 -49
  13. package/dist/agents/peer-held-queue.js +255 -106
  14. package/dist/agents/peer-session-drain.js +65 -45
  15. package/dist/agents/repair-loop.js +2 -2
  16. package/dist/agents/send-message-tool.js +7 -6
  17. package/dist/agents/subagent.d.ts +6 -4
  18. package/dist/agents/subagent.js +72 -68
  19. package/dist/agents/tool-filter.d.ts +7 -5
  20. package/dist/agents/tool-filter.js +12 -9
  21. package/dist/agents/verify.d.ts +3 -2
  22. package/dist/agents/verify.js +3 -3
  23. package/dist/brain/anthropic.js +45 -80
  24. package/dist/brain/media-degrade.d.ts +18 -7
  25. package/dist/brain/media-degrade.js +13 -2
  26. package/dist/brain/model-capability.d.ts +37 -0
  27. package/dist/brain/model-capability.js +34 -0
  28. package/dist/brain/model-presets.d.ts +2 -8
  29. package/dist/brain/model-presets.js +1 -6
  30. package/dist/brain/open-responses.js +23 -34
  31. package/dist/brain/openai.js +25 -96
  32. package/dist/brain/provider-dialect.d.ts +3 -2
  33. package/dist/brain/provider-dialect.js +2 -2
  34. package/dist/brain/reasoning-request.d.ts +96 -0
  35. package/dist/brain/reasoning-request.js +174 -0
  36. package/dist/brain/reasoning.d.ts +11 -11
  37. package/dist/brain/reasoning.js +4 -3
  38. package/dist/brain/request-params.d.ts +13 -4
  39. package/dist/brain/request-params.js +21 -5
  40. package/dist/brain/status-sink.d.ts +20 -0
  41. package/dist/brain/status-sink.js +7 -0
  42. package/dist/brain/stream-engine.d.ts +9 -0
  43. package/dist/brain/stream-engine.js +24 -10
  44. package/dist/brain/stream-shared.d.ts +5 -4
  45. package/dist/brain/stream-shared.js +4 -4
  46. package/dist/core/a2a.d.ts +2 -1
  47. package/dist/core/a2a.js +19 -13
  48. package/dist/core/agent-definition.d.ts +10 -0
  49. package/dist/core/allow-entry.d.ts +23 -23
  50. package/dist/core/allow-entry.js +42 -46
  51. package/dist/core/allow-rule-shadow.d.ts +3 -3
  52. package/dist/core/approval-object.d.ts +21 -5
  53. package/dist/core/approval-object.js +44 -17
  54. package/dist/core/ask-origin.d.ts +66 -20
  55. package/dist/core/ask-origin.js +63 -23
  56. package/dist/core/ask-question.d.ts +51 -8
  57. package/dist/core/ask-question.js +3 -4
  58. package/dist/core/ask-unresolvable-notice.d.ts +8 -3
  59. package/dist/core/ask-unresolvable-notice.js +16 -2
  60. package/dist/core/auto-compaction.d.ts +71 -6
  61. package/dist/core/auto-compaction.js +42 -26
  62. package/dist/core/background-agent-store.d.ts +6 -2
  63. package/dist/core/background-agent-store.js +1 -1
  64. package/dist/core/checkpoint-generation.d.ts +53 -0
  65. package/dist/core/checkpoint-generation.js +35 -0
  66. package/dist/core/checkpoint-queries.d.ts +180 -0
  67. package/dist/core/checkpoint-queries.js +272 -0
  68. package/dist/core/checkpoint-requirements.d.ts +19 -1
  69. package/dist/core/checkpoint-requirements.js +6 -0
  70. package/dist/core/checkpoint-store.d.ts +105 -53
  71. package/dist/core/checkpoint-store.js +43 -20
  72. package/dist/core/cross-boundary-taint.d.ts +6 -5
  73. package/dist/core/cross-boundary-taint.js +5 -5
  74. package/dist/core/decision-receipt.d.ts +37 -3
  75. package/dist/core/decision-receipt.js +17 -17
  76. package/dist/core/delegation-not-started.d.ts +6 -0
  77. package/dist/core/delegation-not-started.js +17 -0
  78. package/dist/core/engine-attestation.d.ts +93 -0
  79. package/dist/core/engine-attestation.js +70 -0
  80. package/dist/core/engine-capabilities.d.ts +4 -1
  81. package/dist/core/engine-capabilities.js +1 -1
  82. package/dist/core/engine-notice.d.ts +32 -12
  83. package/dist/core/engine-notice.js +6 -0
  84. package/dist/core/file-history-store.d.ts +104 -22
  85. package/dist/core/file-history-store.js +37 -19
  86. package/dist/core/gate-fold.d.ts +1 -1
  87. package/dist/core/gate-fold.js +22 -10
  88. package/dist/core/gate-lanes.js +73 -65
  89. package/dist/core/gate-outcome.d.ts +26 -5
  90. package/dist/core/gate-outcome.js +26 -0
  91. package/dist/core/governance-codes.d.ts +5 -1
  92. package/dist/core/governance-codes.js +6 -0
  93. package/dist/core/hooks.d.ts +19 -18
  94. package/dist/core/hooks.js +3 -1
  95. package/dist/core/host-floor.d.ts +128 -0
  96. package/dist/core/host-floor.js +206 -0
  97. package/dist/core/host-target.d.ts +38 -3
  98. package/dist/core/host-target.js +38 -5
  99. package/dist/core/mailbox-store.d.ts +62 -1
  100. package/dist/core/mailbox-store.js +59 -0
  101. package/dist/core/mcp-name-judge.d.ts +46 -0
  102. package/dist/core/mcp-name-judge.js +61 -0
  103. package/dist/core/mcp-probe.d.ts +1 -1
  104. package/dist/core/mcp-probe.js +2 -5
  105. package/dist/core/mcp.d.ts +5 -1
  106. package/dist/core/mcp.js +70 -64
  107. package/dist/core/memory-engine/consolidation-driver.js +4 -3
  108. package/dist/core/memory-engine/delegation-settlement.js +15 -24
  109. package/dist/core/memory-engine/distiller.js +26 -17
  110. package/dist/core/memory-engine/engine.js +4 -4
  111. package/dist/core/memory-engine/layout.d.ts +60 -8
  112. package/dist/core/memory-engine/layout.js +70 -8
  113. package/dist/core/model-seat.d.ts +10 -3
  114. package/dist/core/mods/classic-events.d.ts +67 -0
  115. package/dist/core/mods/classic-events.js +1 -0
  116. package/dist/core/mods/dollar.d.ts +13 -0
  117. package/dist/core/mods/extension-call.d.ts +31 -0
  118. package/dist/core/mods/extension-call.js +43 -0
  119. package/dist/core/mods/kernel/dispatch.d.ts +20 -3
  120. package/dist/core/mods/kernel/dispatch.js +140 -69
  121. package/dist/core/mods/kernel/events.d.ts +47 -11
  122. package/dist/core/mods/kernel/events.js +66 -42
  123. package/dist/core/mods/kernel/index.d.ts +4 -4
  124. package/dist/core/mods/kernel/index.js +2 -2
  125. package/dist/core/mods/kernel/receive.d.ts +39 -5
  126. package/dist/core/mods/kernel/receive.js +290 -17
  127. package/dist/core/mods/kernel/registration.d.ts +33 -2
  128. package/dist/core/mods/kernel/registration.js +6 -7
  129. package/dist/core/mods/kernel/site-rules.d.ts +44 -16
  130. package/dist/core/mods/kernel/site-rules.js +24 -42
  131. package/dist/core/mods/spec-seats.d.ts +69 -0
  132. package/dist/core/mods/spec-seats.js +114 -0
  133. package/dist/core/mods/stations.d.ts +28 -8
  134. package/dist/core/mods/stations.js +29 -13
  135. package/dist/core/mods/tool-call.d.ts +79 -0
  136. package/dist/core/mods/tool-call.js +152 -0
  137. package/dist/core/namespaced-rule-name.d.ts +32 -38
  138. package/dist/core/namespaced-rule-name.js +29 -36
  139. package/dist/core/parent-spec-seat.d.ts +6 -1
  140. package/dist/core/parent-spec-seat.js +2 -0
  141. package/dist/core/park-selfcheck.js +3 -0
  142. package/dist/core/permission-rule-consent.d.ts +24 -3
  143. package/dist/core/permission-rule-consent.js +136 -41
  144. package/dist/core/permission-rule-model.d.ts +57 -5
  145. package/dist/core/permission-rule-model.js +90 -31
  146. package/dist/core/permission-rule-org.d.ts +6 -2
  147. package/dist/core/permission-rule-org.js +8 -4
  148. package/dist/core/permission-rule-provider.d.ts +5 -2
  149. package/dist/core/permission-rule-provider.js +41 -11
  150. package/dist/core/permission-rule-store.d.ts +3 -2
  151. package/dist/core/permission-rule-store.js +11 -2
  152. package/dist/core/permission-rule-sync.js +3 -2
  153. package/dist/core/permission-rule-syntax.d.ts +5 -4
  154. package/dist/core/permission-rule-syntax.js +2 -2
  155. package/dist/core/permission-rules.d.ts +4 -4
  156. package/dist/core/permission-rules.js +11 -20
  157. package/dist/core/persisted-rule-arms.d.ts +2 -2
  158. package/dist/core/persisted-rule-arms.js +10 -12
  159. package/dist/core/principal-name.d.ts +20 -0
  160. package/dist/core/principal-name.js +22 -0
  161. package/dist/core/prompt-section-seat.js +4 -6
  162. package/dist/core/protocol-http-auth.d.ts +40 -5
  163. package/dist/core/protocol-http-auth.js +168 -4
  164. package/dist/core/protocol-naming.d.ts +20 -0
  165. package/dist/core/protocol-naming.js +20 -3
  166. package/dist/core/read-only-shell.d.ts +20 -5
  167. package/dist/core/read-only-shell.js +29 -14
  168. package/dist/core/remote-env.d.ts +37 -1
  169. package/dist/core/remote-env.js +11 -0
  170. package/dist/core/resume-startup-cause.d.ts +24 -2
  171. package/dist/core/resume-startup-cause.js +20 -1
  172. package/dist/core/retired-keys.d.ts +16 -0
  173. package/dist/core/retired-keys.js +16 -4
  174. package/dist/core/rewrite-rejudge.d.ts +60 -0
  175. package/dist/core/rewrite-rejudge.js +36 -0
  176. package/dist/core/roles.d.ts +28 -1
  177. package/dist/core/roles.js +81 -26
  178. package/dist/core/rule-lane-reads.d.ts +20 -15
  179. package/dist/core/rule-lane-reads.js +45 -17
  180. package/dist/core/rule-owner.d.ts +3 -3
  181. package/dist/core/rule-owner.js +3 -2
  182. package/dist/core/runner/announce-once-ledger.d.ts +14 -0
  183. package/dist/core/runner/announce-once-ledger.js +5 -0
  184. package/dist/core/runner/assemble-result.d.ts +1 -0
  185. package/dist/core/runner/assemble-result.js +1 -1
  186. package/dist/core/runner/call-hook-stations.d.ts +3 -2
  187. package/dist/core/runner/caller-roster.d.ts +16 -4
  188. package/dist/core/runner/caller-roster.js +33 -6
  189. package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
  190. package/dist/core/runner/capability-withheld-seat.js +24 -0
  191. package/dist/core/runner/classifier-ladder.d.ts +7 -9
  192. package/dist/core/runner/classifier-ladder.js +3 -3
  193. package/dist/core/runner/compact-session.d.ts +10 -0
  194. package/dist/core/runner/compact-session.js +202 -0
  195. package/dist/core/runner/compaction-call-options.d.ts +2 -2
  196. package/dist/core/runner/compaction-seams.d.ts +21 -1
  197. package/dist/core/runner/compaction-seams.js +11 -8
  198. package/dist/core/runner/construction-doors.js +3 -0
  199. package/dist/core/runner/contracts.d.ts +50 -40
  200. package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
  201. package/dist/core/runner/cross-boundary-lane.js +40 -27
  202. package/dist/core/runner/denial-limit-arms.d.ts +2 -2
  203. package/dist/core/runner/denial-limit-arms.js +1 -1
  204. package/dist/core/runner/derived-route-fallback.d.ts +13 -0
  205. package/dist/core/runner/derived-route-fallback.js +6 -0
  206. package/dist/core/runner/env-capability-census.d.ts +3 -2
  207. package/dist/core/runner/env-capability-census.js +9 -3
  208. package/dist/core/runner/file-history-request.d.ts +18 -0
  209. package/dist/core/runner/file-history-request.js +21 -13
  210. package/dist/core/runner/file-history-restore.d.ts +45 -0
  211. package/dist/core/runner/file-history-restore.js +46 -0
  212. package/dist/core/runner/gate-exit.d.ts +3 -3
  213. package/dist/core/runner/gate-exit.js +4 -3
  214. package/dist/core/runner/image.d.ts +7 -17
  215. package/dist/core/runner/image.js +9 -60
  216. package/dist/core/runner/permission-rule-lanes.d.ts +11 -11
  217. package/dist/core/runner/permission-rule-lanes.js +39 -17
  218. package/dist/core/runner/person-path-rows.d.ts +12 -9
  219. package/dist/core/runner/person-path-rows.js +18 -7
  220. package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
  221. package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
  222. package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
  223. package/dist/core/runner/prepare-ask-lane.js +5 -2
  224. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
  225. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  226. package/dist/core/runner/prepare-config-doors.d.ts +35 -38
  227. package/dist/core/runner/prepare-config-doors.js +46 -28
  228. package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
  229. package/dist/core/runner/prepare-defer-classify.js +7 -8
  230. package/dist/core/runner/prepare-file-history.d.ts +48 -8
  231. package/dist/core/runner/prepare-file-history.js +7 -39
  232. package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
  233. package/dist/core/runner/prepare-gate-stations.js +10 -1
  234. package/dist/core/runner/prepare-hands-readface.d.ts +5 -9
  235. package/dist/core/runner/prepare-hands-readface.js +17 -14
  236. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
  237. package/dist/core/runner/prepare-inherited-gate.js +5 -3
  238. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  239. package/dist/core/runner/prepare-park-ask.d.ts +2 -0
  240. package/dist/core/runner/prepare-park-ask.js +7 -7
  241. package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
  242. package/dist/core/runner/prepare-policy-chain.js +67 -76
  243. package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
  244. package/dist/core/runner/prepare-prompt-assembly.js +10 -8
  245. package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
  246. package/dist/core/runner/prepare-prompt-inputs.js +3 -5
  247. package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
  248. package/dist/core/runner/prepare-protocol-tools.js +3 -3
  249. package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
  250. package/dist/core/runner/prepare-safety-scan.js +0 -17
  251. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  252. package/dist/core/runner/prepare-suspend-saga.js +5 -6
  253. package/dist/core/runner/prepare-task.d.ts +5 -2
  254. package/dist/core/runner/prepare-task.js +48 -43
  255. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +20 -4
  256. package/dist/core/runner/prepare-tool-disclosure-mount.js +33 -23
  257. package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
  258. package/dist/core/runner/prepare-turn-wiring.js +2 -7
  259. package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -2
  260. package/dist/core/runner/prepare-wiring-manifest.js +3 -3
  261. package/dist/core/runner/resume-admission.js +1 -1
  262. package/dist/core/runner/resume-apply.js +11 -12
  263. package/dist/core/runner/resume-checkpoint-screen.js +3 -0
  264. package/dist/core/runner/resume-claim.d.ts +4 -2
  265. package/dist/core/runner/resume-claim.js +15 -8
  266. package/dist/core/runner/retired-runner-deps.js +1 -0
  267. package/dist/core/runner/rewind-files.d.ts +12 -0
  268. package/dist/core/runner/rewind-files.js +90 -0
  269. package/dist/core/runner/run-attachment-seats.js +2 -1
  270. package/dist/core/runner/run-brain-sinks.d.ts +4 -1
  271. package/dist/core/runner/run-brain-sinks.js +4 -2
  272. package/dist/core/runner/run-harness-handlers.js +12 -4
  273. package/dist/core/runner/run-leg.d.ts +1 -1
  274. package/dist/core/runner/run-leg.js +40 -39
  275. package/dist/core/runner/run-notification-lane.d.ts +2 -0
  276. package/dist/core/runner/run-notification-lane.js +2 -2
  277. package/dist/core/runner/run-recovery-lanes.js +3 -4
  278. package/dist/core/runner/run-settle-and-teardown.js +7 -12
  279. package/dist/core/runner/run-terminal-adoption.js +3 -4
  280. package/dist/core/runner/run-turn-boundary.js +4 -15
  281. package/dist/core/runner/runtask.d.ts +10 -0
  282. package/dist/core/runner/runtask.js +35 -42
  283. package/dist/core/runner/send-message-continuation.js +1 -1
  284. package/dist/core/runner/session-read-file-states.d.ts +15 -0
  285. package/dist/core/runner/session-read-file-states.js +28 -0
  286. package/dist/core/runner/session-rule-policy.js +4 -3
  287. package/dist/core/runner/session-verb-doors.d.ts +28 -0
  288. package/dist/core/runner/session-verb-doors.js +48 -0
  289. package/dist/core/runner/session-write-ledger.d.ts +30 -0
  290. package/dist/core/runner/session-write-ledger.js +101 -0
  291. package/dist/core/runner/shell-env-withheld.d.ts +33 -0
  292. package/dist/core/runner/shell-env-withheld.js +51 -0
  293. package/dist/core/runner/skills-seat.js +6 -2
  294. package/dist/core/runner/stream-settle-backstop.js +12 -15
  295. package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
  296. package/dist/core/runner/sub-agent-deny-lists.js +25 -17
  297. package/dist/core/runner/synthetic-tools.d.ts +6 -0
  298. package/dist/core/runner/synthetic-tools.js +4 -1
  299. package/dist/core/runner/teardown-bounded.d.ts +1 -0
  300. package/dist/core/runner/teardown-bounded.js +1 -0
  301. package/dist/core/runner/tool-disclosure.d.ts +10 -12
  302. package/dist/core/runner/tool-disclosure.js +1 -3
  303. package/dist/core/runner/tool-end-body.d.ts +1 -1
  304. package/dist/core/runner/tool-end-body.js +10 -9
  305. package/dist/core/runner/tool-not-executed.d.ts +5 -0
  306. package/dist/core/runner/tool-not-executed.js +11 -0
  307. package/dist/core/runner/tool-occurrence.d.ts +8 -0
  308. package/dist/core/runner/tool-occurrence.js +7 -0
  309. package/dist/core/runner/turn-attachments.d.ts +33 -15
  310. package/dist/core/runner/turn-attachments.js +62 -37
  311. package/dist/core/runner-deps.d.ts +7 -7
  312. package/dist/core/safety-axis-vocab.d.ts +6 -4
  313. package/dist/core/safety-axis-vocab.js +6 -5
  314. package/dist/core/safety-merge-corpus.js +11 -3
  315. package/dist/core/secret-env.d.ts +30 -3
  316. package/dist/core/secret-env.js +47 -8
  317. package/dist/core/select-model.js +3 -3
  318. package/dist/core/session-policy-store.d.ts +32 -15
  319. package/dist/core/session-policy-store.js +156 -36
  320. package/dist/core/session-store.d.ts +29 -10
  321. package/dist/core/session-store.js +51 -19
  322. package/dist/core/session.d.ts +82 -16
  323. package/dist/core/session.js +53 -0
  324. package/dist/core/shell-read-silence.d.ts +11 -12
  325. package/dist/core/shell-read-silence.js +9 -5
  326. package/dist/core/shell-run-candidates.js +3 -1
  327. package/dist/core/shell-wrapper-projection.d.ts +1 -1
  328. package/dist/core/shell-wrapper-projection.js +1 -1
  329. package/dist/core/shell-wrapper-table.d.ts +14 -7
  330. package/dist/core/shell-wrapper-table.js +5 -4
  331. package/dist/core/side-query.js +10 -1
  332. package/dist/core/skill-grant.d.ts +7 -2
  333. package/dist/core/skill-grant.js +5 -0
  334. package/dist/core/skills-directory.js +6 -2
  335. package/dist/core/store-contracts/background-agent-store-contract.js +1 -0
  336. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
  337. package/dist/core/store-contracts/checkpoint-store-contract.js +141 -2
  338. package/dist/core/store-contracts/file-history-store-contract.js +40 -1
  339. package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
  340. package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
  341. package/dist/core/store-contracts/peer-directory-contract.js +14 -2
  342. package/dist/core/store-contracts/session-repo-contract.js +51 -0
  343. package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
  344. package/dist/core/store-contracts/session-store-contract.js +150 -14
  345. package/dist/core/stub-env.d.ts +2 -0
  346. package/dist/core/stub-env.js +1 -0
  347. package/dist/core/synthetic-read-verdict.js +3 -3
  348. package/dist/core/task-event.d.ts +32 -4
  349. package/dist/core/task-notification.d.ts +16 -12
  350. package/dist/core/task-registry-agent.d.ts +8 -4
  351. package/dist/core/task-registry-agent.js +14 -8
  352. package/dist/core/task-registry-shared.d.ts +35 -6
  353. package/dist/core/task-registry-shared.js +11 -0
  354. package/dist/core/task-registry.d.ts +10 -1
  355. package/dist/core/task-registry.js +12 -2
  356. package/dist/core/task-result.d.ts +18 -0
  357. package/dist/core/task-spec.d.ts +18 -13
  358. package/dist/core/tighten-task-spec.js +2 -1
  359. package/dist/core/tool-catalog-entries.d.ts +23 -0
  360. package/dist/core/tool-catalog-entries.js +14 -2
  361. package/dist/core/tool-check-reading.d.ts +11 -0
  362. package/dist/core/tool-check-reading.js +11 -6
  363. package/dist/core/tool-model-gate.d.ts +2 -2
  364. package/dist/core/tool-name-aliases.d.ts +48 -18
  365. package/dist/core/tool-name-aliases.js +36 -19
  366. package/dist/core/tool-name-readings.d.ts +6 -32
  367. package/dist/core/tool-name-readings.js +2 -9
  368. package/dist/core/tool-policy.d.ts +78 -204
  369. package/dist/core/tool-policy.js +152 -204
  370. package/dist/core/tool-result-store.js +3 -0
  371. package/dist/core/tool-roster.d.ts +14 -19
  372. package/dist/core/tool-roster.js +11 -44
  373. package/dist/core/tool-spec-members.js +7 -2
  374. package/dist/core/tool-spec.d.ts +19 -11
  375. package/dist/core/tools.js +49 -9
  376. package/dist/core/trace.d.ts +6 -3
  377. package/dist/core/trace.js +2 -1
  378. package/dist/core/types.d.ts +1 -1
  379. package/dist/core/untrusted-egress.d.ts +20 -0
  380. package/dist/core/untrusted-egress.js +77 -3
  381. package/dist/core/user-attachment.d.ts +8 -1
  382. package/dist/core/user-attachment.js +64 -4
  383. package/dist/core/wiring-manifest.d.ts +9 -0
  384. package/dist/core/wiring-manifest.js +1 -0
  385. package/dist/core/workflow-journal-store.js +1 -1
  386. package/dist/engine/compaction/compaction.js +3 -2
  387. package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
  388. package/dist/engine/execution-env/node-execution-env.js +11 -2
  389. package/dist/engine/harness/agent-harness.d.ts +32 -6
  390. package/dist/engine/harness/agent-harness.js +65 -9
  391. package/dist/engine/harness/types.d.ts +29 -2
  392. package/dist/engine/llm/types.d.ts +28 -11
  393. package/dist/engine/loop/agent-loop.d.ts +23 -4
  394. package/dist/engine/loop/agent-loop.js +42 -30
  395. package/dist/engine/loop/types.d.ts +16 -6
  396. package/dist/engine/session/memory-repo.d.ts +9 -2
  397. package/dist/engine/session/memory-repo.js +11 -1
  398. package/dist/engine/session/repo-utils.d.ts +6 -5
  399. package/dist/engine/session/repo-utils.js +14 -6
  400. package/dist/index.d.ts +34 -17
  401. package/dist/index.js +22 -11
  402. package/dist/internal/harness-types.d.ts +1 -1
  403. package/dist/internal/harness.d.ts +2 -1
  404. package/dist/internal/harness.js +1 -0
  405. package/dist/internal/llm.d.ts +1 -1
  406. package/dist/orchestration/run-workflow-tool.d.ts +6 -4
  407. package/dist/orchestration/run-workflow-tool.js +5 -3
  408. package/dist/orchestration/workflow.d.ts +3 -0
  409. package/dist/orchestration/workflow.js +36 -18
  410. package/dist/primitives/credential-ref.d.ts +89 -0
  411. package/dist/primitives/credential-ref.js +125 -0
  412. package/dist/primitives/index.d.ts +2 -0
  413. package/dist/primitives/index.js +1 -0
  414. package/dist/prompt-assembly/artifact.d.ts +2 -2
  415. package/dist/prompt-assembly/artifact.js +5 -3
  416. package/dist/prompt-assembly/assemble.d.ts +3 -2
  417. package/dist/prompt-assembly/assemble.js +1 -1
  418. package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
  419. package/dist/prompt-assembly/catalog/schema.js +34 -2
  420. package/dist/prompt-assembly/catalog/sections.js +0 -1
  421. package/dist/prompt-assembly/composer.d.ts +3 -1
  422. package/dist/prompt-assembly/composer.js +1 -1
  423. package/dist/prompt-assembly/event-registry.js +1 -0
  424. package/dist/prompt-assembly/overlay.js +3 -3
  425. package/dist/prompt-assembly/renderers.d.ts +1 -1
  426. package/dist/prompt-assembly/renderers.js +0 -3
  427. package/dist/prompt-assembly/role-base.d.ts +15 -0
  428. package/dist/prompt-assembly/role-base.js +9 -0
  429. package/dist/prompt-assembly/select.d.ts +39 -14
  430. package/dist/prompt-assembly/select.js +47 -16
  431. package/dist/prompt-assembly/sugar.d.ts +17 -11
  432. package/dist/prompt-assembly/sugar.js +8 -3
  433. package/dist/prompt-assembly/tool-catalog.d.ts +37 -3
  434. package/dist/prompt-assembly/tool-catalog.js +114 -4
  435. package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
  436. package/dist/prompt-assembly/turn-snapshot.js +0 -3
  437. package/dist/prompt-assembly/types.d.ts +0 -7
  438. package/dist/scenarios/full-body.d.ts +11 -11
  439. package/dist/scenarios/full-body.js +4 -3
  440. package/dist/shell/lex.js +10 -1
  441. package/dist/stores/file/adoption/adopt.js +4 -3
  442. package/dist/stores/file/adoption/marker.js +3 -2
  443. package/dist/stores/file/checkpoint-store.d.ts +21 -4
  444. package/dist/stores/file/checkpoint-store.js +38 -7
  445. package/dist/stores/file/file-history-store.js +18 -11
  446. package/dist/stores/file/index.js +2 -1
  447. package/dist/stores/file/mailbox-store.d.ts +2 -1
  448. package/dist/stores/file/mailbox-store.js +26 -1
  449. package/dist/stores/file/permission-rule-adopt.js +4 -3
  450. package/dist/stores/file/permission-rule-store.js +11 -5
  451. package/dist/stores/file/session-store.d.ts +29 -6
  452. package/dist/stores/file/session-store.js +42 -50
  453. package/dist/tools/artifact/artifact-tool.js +3 -2
  454. package/dist/tools/fs/bash-program-position.d.ts +19 -2
  455. package/dist/tools/fs/bash-program-position.js +56 -9
  456. package/dist/tools/fs/bash-readonly-classifier.d.ts +15 -19
  457. package/dist/tools/fs/bash-readonly-classifier.js +5 -10
  458. package/dist/tools/fs/fs-bash.js +15 -8
  459. package/dist/tools/fs/fs-glob.d.ts +86 -0
  460. package/dist/tools/fs/fs-glob.js +226 -0
  461. package/dist/tools/fs/fs-read.js +14 -14
  462. package/dist/tools/fs/fs-search-tools.js +7 -7
  463. package/dist/tools/fs/pattern-kill-guard.d.ts +23 -0
  464. package/dist/tools/fs/pattern-kill-guard.js +429 -0
  465. package/dist/tools/fs/pdf.d.ts +9 -6
  466. package/dist/tools/fs/pdf.js +3 -3
  467. package/dist/tools/fs/program-read-model.d.ts +57 -7
  468. package/dist/tools/fs/program-read-model.js +11 -1
  469. package/dist/tools/fs/program-read-model.rows.js +78 -21
  470. package/dist/tools/fs/read-deny-home.js +3 -2
  471. package/dist/tools/fs/removal-targets.d.ts +17 -7
  472. package/dist/tools/fs/removal-targets.js +47 -20
  473. package/dist/tools/fs/search.d.ts +10 -0
  474. package/dist/tools/fs/search.js +20 -26
  475. package/dist/tools/fs/shell-read-argv.js +89 -12
  476. package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
  477. package/dist/tools/fs/shell-read-bindings.js +41 -0
  478. package/dist/tools/fs/shell-read-check.d.ts +10 -0
  479. package/dist/tools/fs/shell-read-check.js +13 -20
  480. package/dist/tools/fs/shell-read-environment.d.ts +5 -1
  481. package/dist/tools/fs/shell-read-environment.js +3 -2
  482. package/dist/tools/fs/shell-read-establish.d.ts +15 -0
  483. package/dist/tools/fs/shell-read-establish.js +19 -20
  484. package/dist/tools/fs/shell-read-identity.d.ts +12 -9
  485. package/dist/tools/fs/shell-read-identity.js +9 -4
  486. package/dist/tools/fs/shell-read-plan.js +24 -16
  487. package/dist/tools/fs/shell-read-start.d.ts +6 -1
  488. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
  489. package/dist/tools/fs/shell-read-write-targets.js +2 -3
  490. package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
  491. package/dist/tools/fs/shell-reentry-text.js +40 -2
  492. package/dist/tools/todo.js +63 -63
  493. package/dist/tools/web.d.ts +19 -14
  494. package/dist/tools/web.js +46 -61
  495. package/package.json +1 -1
  496. package/test/export-surface.snapshot.json +221 -7
  497. package/wire-changes/core-stores-sql@7.57.0.json +29 -0
  498. package/wire-changes/core@7.56.0.json +3891 -0
  499. package/wire-changes/core@7.57.0.json +1487 -0
  500. package/wire-changes/mods-kernel@7.56.0.json +303 -0
  501. package/wire-changes/mods-kernel@7.57.0.json +29 -0
  502. package/wire-changes/primitives@7.57.0.json +245 -0
@@ -1,5 +1,5 @@
1
- import { errorCodeOf, thrownFailureOf } from "./terminal-account.js";
2
- import { reopenReasonOf, resumeStartupCauseOf } from "../resume-startup-cause.js";
1
+ import { thrownFailureOf } from "./terminal-account.js";
2
+ import { compensateUnstarted, reopenReasonOf, resumeStartupCauseOf, unstartedRowSentence } from "../resume-startup-cause.js";
3
3
  import { resumeDecisionWasNegative } from "./decide-continuation.js";
4
4
  import { drainForwardedFramesBeforeDone, forwardsSubagentEvents } from "./prepare-run-refs.js";
5
5
  import { hasDestroy } from "../remote-env.js";
@@ -13,23 +13,20 @@ export function streamSettleBackstop(input) {
13
13
  const onRunRejected = async (err) => {
14
14
  let { code, message, detail } = thrownFailureOf(err, thrownText(err));
15
15
  const reopenReason = reopenReasonOf(resumeStartupCauseOf(code));
16
- const reopenable = resume !== undefined && resume.pendingActionStarted !== true && reopenReason !== undefined && !(resumeDecisionWasNegative(resume) && resume.decisionDelivered === true);
16
+ const reopenable = resume !== undefined && live.resultValue === undefined && resume.pendingActionStarted !== true && !(resumeDecisionWasNegative(resume) && resume.decisionDelivered === true);
17
17
  let reopenCommitted = false;
18
18
  let reopenStateUnknown = false;
19
- if (reopenable && resume?.onEnvRestoreFailed) {
20
- try {
21
- await resume.onEnvRestoreFailed(reopenReason);
19
+ if (reopenable && resume !== undefined) {
20
+ const row = await compensateUnstarted(resume.reopenUnstarted, reopenReason);
21
+ if (row.kind === "reopened") {
22
22
  reopenCommitted = true;
23
+ message = `${message} — ${unstartedRowSentence(row)}`;
23
24
  }
24
- catch (reopenErr) {
25
+ else {
25
26
  parentConstraintRegistry.delete(resume.cp.token);
26
27
  const original = asThrownError(err);
27
- const reopenMsg = thrownText(reopenErr);
28
- const definitive = errorCodeOf(reopenErr) === "checkpoint.reopen_failed";
29
- reopenStateUnknown = !definitive;
30
- err = Object.assign(new Error(definitive
31
- ? `${reopenMsg} (original resume failure: ${original.message})`
32
- : `checkpoint reopen threw mid-flight — state UNKNOWN, confirm via the checkpoint store before retrying: ${reopenMsg} (original resume failure: ${original.message})`, { cause: original }), { code: "checkpoint.reopen_failed" });
28
+ reopenStateUnknown = row.kind === "unknown";
29
+ err = Object.assign(new Error(`${original.message} — ${unstartedRowSentence(row)}`, { cause: original }), { code: "checkpoint.reopen_failed" });
33
30
  const replacement = thrownFailureOf(err, thrownText(err));
34
31
  code = replacement.code;
35
32
  message = replacement.message;
@@ -38,7 +35,7 @@ export function streamSettleBackstop(input) {
38
35
  }
39
36
  if (resume)
40
37
  locallyClaimedTokens.delete(resume.cp.token);
41
- if (resume && !reopenCommitted) {
38
+ if (resume && !reopenCommitted && live.resultValue === undefined) {
42
39
  parentConstraintRegistry.delete(resume.cp.token);
43
40
  await settleTeardownLeg(() => sessions.unpin?.(resume.cp.sessionId), "sessions.unpin (resume-failure leg)", (e) => runner.deps.onError?.(e, { phase: "config", sessionId: resume.cp.sessionId }));
44
41
  if (!reopenStateUnknown) {
@@ -74,7 +71,7 @@ export function streamSettleBackstop(input) {
74
71
  sessionId: taskIdRef.sessionId ?? "unknown",
75
72
  ...(taskIdRef.runId !== undefined ? { runId: taskIdRef.runId } : {}),
76
73
  terminal: { kind: "failed", ...(code !== undefined ? { code } : {}), message, ...(detail !== undefined ? { detail } : {}) },
77
- result: "",
74
+ result: "", resultEntryIds: [],
78
75
  ...(remoteEnvFailure !== undefined ? { remoteEnvFailures: remoteEnvFailure } : {}),
79
76
  ...(taskIdRef.effectiveMemoryScopes !== undefined ? { effectiveMemoryScopes: taskIdRef.effectiveMemoryScopes } : {}),
80
77
  ...(taskIdRef.effectiveReasoning !== undefined ? { effectiveReasoning: taskIdRef.effectiveReasoning } : {}),
@@ -36,7 +36,7 @@
36
36
  import type { AgentTool } from "../../internal/harness.js";
37
37
  import { valveLeaves } from "../../agents/tool-filter.js";
38
38
  import { type ProtocolId } from "../protocol-table.js";
39
- import type { ToolLegKind, ToolSelectorLayer } from "../tool-face.js";
39
+ import type { ToolLegKind, ToolSelector, ToolSelectorLayer } from "../tool-face.js";
40
40
  import { type ConstraintChainEntry } from "../tool-policy.js";
41
41
  import type { TaskSpec } from "../types.js";
42
42
  import type { CheckpointErrorReason } from "../checkpoint-store.js";
@@ -87,6 +87,27 @@ export type PersistedToolFaceReason = Extract<CheckpointErrorReason, "not_a_list
87
87
  * leg's roster and a sink; the leg's own policy-name audit is what reads them.
88
88
  */
89
89
  export declare function deniedToolNamesOf(where: string, value: unknown): string[];
90
+ /**
91
+ * Whose lists a run's own layer are, in the words every sentence about them uses: the delegation tool (and agent definition) that wrote
92
+ * them when the run records one (`RunInternals.ownToolLists`), else `undefined` — the run's own `TaskSpec` seats.
93
+ */
94
+ export declare function ownListsWhereOf(ownBy: RunInternals["ownToolLists"]): string | undefined;
95
+ /**
96
+ * THE build of a leg's tool selector: `layers` are the ceiling it was spawned under, then its own lists (the last is its own), and
97
+ * `legs` the kinds of leg it is. Every layer is read by the one layer reader ({@link readSelectorLayer}), once, whoever judged it and
98
+ * whatever evidence the run carries — a live ceiling and the run's own lists were judged by the engine that wrote them, which may have
99
+ * read what this one cannot (a list that is not one, a member that is not a string, an entry no rule syntax reads), so the leg does not
100
+ * start without a layer that says something. The selector is compiled from what was read, never from the layers again: a getter that
101
+ * answers differently the second time is not asked a second time, and the selector's layers (handed to the leg's children as their
102
+ * ceiling) are the frozen product. Built before anything reads it, and before the session is acquired, so a refusal needs nothing given
103
+ * back. `where` is whose lists the own layer is ({@link ownListsWhereOf}). (A ceiling a resumed row restored was read by the same reader
104
+ * before the claim — `persistedToolNamesRefusal`.)
105
+ */
106
+ export declare function readToolSelector(input: {
107
+ readonly layers: readonly unknown[];
108
+ readonly where: string | undefined;
109
+ readonly legs: readonly ToolLegKind[];
110
+ }): ToolSelector;
90
111
  /**
91
112
  * THE read-back of the tool names a checkpoint row carries, before the claim: the ceiling the resumed leg will run under when it is
92
113
  * the row's (`ceiling`: absent when a live seat hands one) — each layer read by {@link readSelectorLayer} as a recorded layer — and
@@ -141,8 +162,9 @@ export interface RunToolListsInput {
141
162
  readonly allow: readonly string[] | undefined;
142
163
  readonly exclude: readonly string[] | undefined;
143
164
  };
144
- /** borrowed-readonly — every layer of the run's selector (the ceiling, then its own) and the kinds of leg it is. */
145
- layers: readonly ToolSelectorLayer[];
165
+ /** borrowed-readonly — the run's selector, as {@link readToolSelector} built it: every layer of it (the ceiling, then its own) already read, and judged here as read. */
166
+ selector: ToolSelector;
167
+ /** The kinds of leg the run is (the ones the selector was built for). */
146
168
  legs: readonly ToolLegKind[];
147
169
  /** True ⇔ the spawning run's prepare judged exactly these own lists where they were mounted, against a pool it could list (as the
148
170
  * child-facing lists of the delegation tool or definition that wrote them) — the evidence digest it handed down (live, or recorded
@@ -6,7 +6,7 @@ import { ENGINE_TOOLS } from "../tool-catalog-entries.js";
6
6
  import { callerToolNameProblem } from "../caller-tool-name.js";
7
7
  import { mintNamespacePrefix } from "../protocol-naming.js";
8
8
  import { PROTOCOL_TABLE, protocolOf } from "../protocol-table.js";
9
- import { mountedToolNames, splitNamespacedName, wholeProtocolOf } from "../tool-name-aliases.js";
9
+ import { grantWildcardRefusalOf, mountedToolNames, splitNamespacedName } from "../tool-name-aliases.js";
10
10
  import { projectionToolNames } from "../tool-policy.js";
11
11
  import { declaredDelegationNameOf } from "../delegation-name.js";
12
12
  export function renamedDelegationMountSentence(...rosters) {
@@ -97,9 +97,6 @@ function readableToolNameList(where, side, value, code) {
97
97
  throw refused(notAStringSentence(where, side, index, read.type), code, "not_a_string");
98
98
  if (read.kind === "unreadable")
99
99
  throw grammarRefusal(where, side, { entry: read.entry, reason: "grammar" }, code);
100
- if (side === "denied" && read.name === "*") {
101
- throw refused(`${where} declares ${renderListEntry(entry)} in its ${LIST_WORD[side]}: a denied list has no wildcard — the entry would hide nothing. To give the agent no tools, write an empty allowed list.`, code, "unsupported_pattern");
102
- }
103
100
  return { entry: entry, name: read.name, content: read.content };
104
101
  });
105
102
  }
@@ -117,11 +114,11 @@ function judgeToolNameList(where, side, value, universe, advise, code) {
117
114
  const content = side === "denied" && written;
118
115
  const reach = side === "denied" ? readDeniedToolList([entry]) : (readAllowedToolList([entry]) ?? readDeniedToolList([]));
119
116
  const split = splitNamespacedName(name);
120
- const whole = wholeProtocolOf(name);
121
- if (whole !== undefined) {
117
+ const toolSplit = splitNamespacedName(toolName);
118
+ if (toolName.includes("*") && (toolSplit === undefined || toolSplit.peer.includes("*"))) {
122
119
  if (side === "denied")
123
120
  continue;
124
- throw refused(`${where} declares ${renderListEntry(entry)} in its ${LIST_WORD[side]}: an allowed list has no protocol-wide form — name a peer (\`${whole.prefix}<peer>\`) or one of its tools (\`${whole.prefix}<peer>__<tool>\`).`, code, "unsupported_pattern");
121
+ throw refused(`${where} declares ${renderListEntry(entry)} in its ${LIST_WORD[side]}: ${grantWildcardRefusalOf(name)}.`, code, "unsupported_pattern");
125
122
  }
126
123
  const { inert } = compileAllowList([toolName], "deny", universe.known);
127
124
  const flaw = inert[0] === undefined ? undefined : { ...inert[0], entry, ...(inert[0].reason === "near_miss" && inert[0].currentName !== undefined ? { carriedBy: universe.carrierOf(inert[0].currentName) } : {}) };
@@ -153,14 +150,31 @@ function readSelectorLayer(layer, layerWhere, listWhere, recorded) {
153
150
  if (!isToolSelectorLayer(layer)) {
154
151
  throw refused(`${layerWhere} are a value that is ${valueTypeLabel(layer)}, not a pair of tool-name lists (an allowed and a denied list) — the leg does not start. Fix the layer.`, "config.tool_face_control", "not_a_list");
155
152
  }
153
+ const lists = {};
156
154
  for (const side of ["allowed", "denied"]) {
157
155
  const where = listWhere(side);
158
- const entries = readableToolNameList(where, side, side === "allowed" ? layer.allow : layer.deny, "config.tool_face_control");
156
+ const value = side === "allowed" ? layer.allow : layer.deny;
157
+ const entries = readableToolNameList(where, side, value, "config.tool_face_control");
159
158
  const written = recorded ? entries.find((read) => !isCanonicalToolName(read.entry)) : undefined;
160
159
  if (written !== undefined) {
161
160
  throw refused(`${where} declares ${renderListEntry(written.entry)} in its ${LIST_WORD[side]}: a row records each tool name in its bare spelling (\`Read\`, never \`Read()\`, \`Read(*)\` or \`Read(…)\`), and this entry was recorded by an engine that read the list otherwise — it is read here neither as that engine read it nor as this one would`, "config.tool_face_control", "unsupported_pattern");
162
161
  }
162
+ if (value !== undefined && value !== null)
163
+ lists[side] = Object.freeze(entries.map((read) => read.entry));
163
164
  }
165
+ return Object.freeze({ ...(lists.allowed !== undefined ? { allow: lists.allowed } : {}), deny: lists.denied ?? Object.freeze([]) });
166
+ }
167
+ export function ownListsWhereOf(ownBy) {
168
+ return ownBy !== undefined ? delegationListWhere(ownBy.toolName, ownBy.definition) : undefined;
169
+ }
170
+ export function readToolSelector(input) {
171
+ const layers = [...input.layers];
172
+ const ceilings = layers.length - 1;
173
+ const read = layers.map((layer, i) => {
174
+ const inherited = i === ceilings ? undefined : inheritedListsWhere(ceilings, i);
175
+ return readSelectorLayer(layer, inherited ?? "this run's own tool lists", (side) => inherited ?? input.where ?? (side === "allowed" ? "TaskSpec.allowTools" : "TaskSpec.excludeTools"), false);
176
+ });
177
+ return compileToolSelector(read, input.legs);
164
178
  }
165
179
  function ownToolListsFlaw(value) {
166
180
  try {
@@ -258,14 +272,9 @@ export function judgeRunToolLists(input) {
258
272
  catch {
259
273
  }
260
274
  };
261
- const ownWhere = input.ownBy !== undefined ? delegationListWhere(input.ownBy.toolName, input.ownBy.definition) : undefined;
262
- const ceilings = input.layers.length - 1;
263
- input.layers.forEach((layer, i) => {
264
- const own = i === ceilings;
265
- const inherited = own ? undefined : inheritedListsWhere(ceilings, i);
266
- readSelectorLayer(layer, inherited ?? "this run's own tool lists", (side) => inherited ?? ownWhere ?? (side === "allowed" ? "TaskSpec.allowTools" : "TaskSpec.excludeTools"), false);
267
- });
268
- const denied = deniedProtocolTools(input.layers, input.legs);
275
+ const ownWhere = ownListsWhereOf(input.ownBy);
276
+ const selector = input.selector;
277
+ const denied = deniedProtocolTools(selector.layers, input.legs);
269
278
  if (denied.length > 0) {
270
279
  const names = [...new Set(denied.map((h) => `"${h.name}"`))];
271
280
  const one = names.length === 1;
@@ -276,7 +285,6 @@ export function judgeRunToolLists(input) {
276
285
  const by = [...deniedBy(true, ownWhere ?? "this run's own excludeTools"), ...deniedBy(false, "an inherited list (the spawning run's excludeTools, or one it inherits)")];
277
286
  throw refused(`This kind of leg (${input.legs.join(", ")}) relies on ${names.join(", ")}, but ${by.join(" and ")} — the leg cannot work without ${one ? "it" : "them"}. Remove the entry from the list that names it.`, "config.tool_face_control", "protocol_denied");
278
287
  }
279
- const selector = compileToolSelector(input.layers, input.legs);
280
288
  const pool = delegationPoolReading(spec.tools ?? [], valveLeaves(spec, selector));
281
289
  const mounted = mountedToolNames([...tools, ...(spec.tools ?? [])]);
282
290
  if (!input.judgedUpstream) {
@@ -58,6 +58,12 @@ export declare const SKILL_TOOL_NAME = "Skill";
58
58
  * an oversized skill is excluded from the disclosure block and the tool, with an operator-visible config error. The compaction-time retention caps are a
59
59
  * different door, deliberately. */
60
60
  export declare const SKILL_CONTENT_MAX_CHARS: number;
61
+ /** The skills a leg LOADS — those the load gate above passes ({@link skillLoadReading}, the one predicate): the skills whose
62
+ * hooks the leg's mods admission takes, as the roster's filter (which also reports each one it excludes) takes the same. */
63
+ export declare function skillsThatLoad<T extends {
64
+ readonly content: string;
65
+ readonly baseDir?: unknown;
66
+ }>(skills: readonly T[] | undefined): T[];
61
67
  /** Total per-invoke cap for a skill's inlined attachments (`SkillSpec.files`) — an ATTACHMENT-face budget, distinct from the (gone) body truncation door:
62
68
  * the body is delivered untruncated at invoke time (CC parity), while attachments ride along bounded and truncation-disclosed. */
63
69
  export declare const SKILL_ATTACHMENTS_MAX_CHARS = 50000;
@@ -4,7 +4,7 @@ import { sanitizeUntrustedText, SHELLED_BODY_ENVELOPE_TAGS } from "../untrusted-
4
4
  import { SKILL_LISTING_DEFAULT_BUDGET, SKILL_LISTING_DESC_MAX_CHARS_DEFAULT } from "../skill-listing-budget.js";
5
5
  import { readSkillTable, skillNamedBy } from "../skill-grant.js";
6
6
  import { OUTPUT_TOOL_NAME, mountRuleFace, toolFace } from "../tool-catalog-entries.js";
7
- import { substituteSkillRoot, substituteSkillRootBounded } from "./skill-base-dir.js";
7
+ import { skillLoadReading, substituteSkillRoot, substituteSkillRootBounded } from "./skill-base-dir.js";
8
8
  import { readSkillsSeat } from "./skills-seat.js";
9
9
  import { foldListingWithin } from "./listing-fold.js";
10
10
  export const REPORT_BLOCKED_TOOL_NAME = "ReportBlocked";
@@ -90,6 +90,9 @@ export function createReportFindingsTool() {
90
90
  }
91
91
  export const SKILL_TOOL_NAME = "Skill";
92
92
  export const SKILL_CONTENT_MAX_CHARS = 1024 * 1024;
93
+ export function skillsThatLoad(skills) {
94
+ return (skills ?? []).filter((s) => skillLoadReading(s, SKILL_CONTENT_MAX_CHARS).loads);
95
+ }
93
96
  export const SKILL_ATTACHMENTS_MAX_CHARS = 50_000;
94
97
  export const SKILL_ATTACHMENT_PATH_MAX_CHARS = 512;
95
98
  const SKILL_FILES_LIST_MAX_CHARS = 200;
@@ -27,6 +27,7 @@
27
27
  export declare const TEARDOWN_LEG_MAX_MS = 15000;
28
28
  /** Test hook (fs-atomic TxnLockTimings precedent): shrink the budget so wedge pins need no real 15s. */
29
29
  export declare function setTeardownLegBudgetForTests(ms: number | undefined): void;
30
+ export declare const teardownLegBudget: () => number;
30
31
  /** The typed timeout incident — `leg` names the site so a leak is attributable from the report alone. */
31
32
  export declare class TeardownLegTimeoutError extends Error {
32
33
  readonly leg: string;
@@ -4,6 +4,7 @@ let teardownLegBudgetMs = TEARDOWN_LEG_MAX_MS;
4
4
  export function setTeardownLegBudgetForTests(ms) {
5
5
  teardownLegBudgetMs = ms ?? TEARDOWN_LEG_MAX_MS;
6
6
  }
7
+ export const teardownLegBudget = () => teardownLegBudgetMs;
7
8
  export class TeardownLegTimeoutError extends Error {
8
9
  leg;
9
10
  constructor(leg, budgetMs) {
@@ -64,20 +64,18 @@ export declare function buildDeferredRegistry(deferred: ReadonlySet<string>, too
64
64
  * validation, not activation state: a call whose arguments validate against the REAL tool's
65
65
  * declared schema runs the real tool directly (activation is only about whether the model has
66
66
  * been SHOWN the schema, never an execution gate). Governance cannot be laundered through this
67
- * lane: policy/effect/irreversibility gates key on the tool NAME maps built from the real
68
- * declarations, and the engine's approval pipeline runs before any execute — the placeholder
69
- * object on the harness list plays no part in adjudication.
67
+ * lane: the gate judges the call before any execute, and the call runs the one mounted instance its
68
+ * placeholder stands for — the harness resolves a call to its placeholder before the gate, as it
69
+ * resolves any call to its tool, so what runs is fixed before anything is judged.
70
70
  */
71
71
  export interface PlaceholderDirectCall {
72
72
  /**
73
- * Resolve the real tool AT CALL TIME, never from a prepare-time snapshot. The mounted
74
- * roster is a LIVE array: an MCP refresh splices a server's name domain out and pushes freshly
75
- * materialized tool objects back in, so a Map captured when the placeholder was built would hand
76
- * this lane the WITHDRAWN object (stale schema shape gate, stale transport client) long after the
77
- * roster moved on. Returns `undefined` when the name no longer resolves — a withdrawn name has no
78
- * direct lane, and the caller falls back to the teaching rejection.
73
+ * The mounted instance this placeholder stands for, bound when the placeholder is minted for it (one
74
+ * placeholder per instance; a refresh that replaces the instance mints a new placeholder for the new
75
+ * one). Never re-resolved by name: a call the gate judged while a refresh landed runs the instance it
76
+ * was resolved to, whose own checks answer a declaration that changed meanwhile.
79
77
  */
80
- resolveReal: () => PlaceholderDirectTarget | undefined;
78
+ real: PlaceholderDirectTarget;
81
79
  /**
82
80
  * The scheduling declaration this placeholder carries while it stands in for the real
83
81
  * tool. Mirrors the REAL tool's own `executionMode` (see the mirror rationale in
@@ -91,7 +89,7 @@ export interface PlaceholderDirectCall {
91
89
  * schema it hands back actually lives (this result only, versus this result AND every later
92
90
  * request's tools block). Absent ⇒ the swap posture.
93
91
  *
94
- * A FUNCTION, evaluated per call, for the same reason `resolveReal` is: the answer is not
92
+ * A FUNCTION, evaluated per call: the answer is not
95
93
  * a prepare-time constant. The run-wide strategy is, but the per-tool exemption on top of it reads
96
94
  * the LIVE roster — an MCP refresh can replace a tool with a declaration that no longer fits the
97
95
  * result-text carrier (or one that now does), and a boolean captured when the placeholder was built
@@ -113,7 +111,7 @@ export interface PlaceholderDirectCall {
113
111
  */
114
112
  activate: () => Promise<string | undefined>;
115
113
  }
116
- /** The live view of the real tool behind a placeholder, resolved per call (see {@link PlaceholderDirectCall.resolveReal}). */
114
+ /** The real tool behind a placeholder (see {@link PlaceholderDirectCall.real}). */
117
115
  export interface PlaceholderDirectTarget {
118
116
  /** The REAL tool's declared parameter schema — the shape gate for a direct call. */
119
117
  parameters: TSchema;
@@ -93,9 +93,7 @@ export function createPlaceholderTool(info, direct) {
93
93
  parameters: EMPTY_PARAMS,
94
94
  ...(direct.executionMode !== undefined ? { executionMode: direct.executionMode } : {}),
95
95
  execute: async (toolCallId, params, signal, onUpdate) => {
96
- const real = direct.resolveReal();
97
- if (real === undefined)
98
- return teachingRejection();
96
+ const { real } = direct;
99
97
  if (Value.Check(real.parameters, params)) {
100
98
  lastFailureShape = undefined;
101
99
  repeats = 0;
@@ -95,7 +95,7 @@ export interface SettledOccurrence extends Pick<OccurrenceEnd, "notExecuted"> {
95
95
  * The END projection — the ONE mint of `tool_end`, for every station that closes a call: the live loop's
96
96
  * `tool_execution_end`, the resumed leg's resolution, an interrupted run's reconcile and the reconcile replayed at
97
97
  * the next process start. It reads the occurrence and nothing else: `gate` is its latest gate record, `isError` is
98
- * the tool's bit or the refusal that record names, and `notExecuted` rides on positive evidence only: the station's own or `refusedBeforeRelease` (returned for the rows).
98
+ * the tool's bit or the refusal that record names, and `notExecuted` rides on positive evidence only: the station's own or `neverExecuted` (returned for the rows).
99
99
  *
100
100
  * A call whose start never went out on this stream (a call the loop never reached, a call announced by a dead
101
101
  * process) gets its start minted here first, marked `recovered` and carrying the input the closing station holds —
@@ -1,6 +1,6 @@
1
1
  import {} from "../../internal/harness.js";
2
- import { readMember } from "../thrown-value.js";
3
- import { refusedBeforeRelease } from "./tool-not-executed.js";
2
+ import { isPlainRecord } from "../mods/kernel/receive.js";
3
+ import { neverExecuted } from "./tool-not-executed.js";
4
4
  import { MCP_DELIVERY_VERDICTS } from "../mcp-failure.js";
5
5
  import { closeNeverExecuted } from "../session-reconcile.js";
6
6
  import { TOOL_SEARCH_NAME } from "./tool-disclosure.js";
@@ -38,11 +38,12 @@ export function batchResponseDigest(result) {
38
38
  export function toolEndBodyFrom(result, isError, leg, gate, gatedCallIdOfRun) {
39
39
  const o = toolOutputFrom(result, leg.mediaByteCapBytes);
40
40
  const st = leg.structured(result);
41
- const det = isError ? readMember(result, "details") : undefined;
42
- const codeRaw = readMember(det, "code");
43
- const kindRaw = readMember(det, "errorKind");
41
+ const det = isError ? result?.details : undefined;
42
+ const card = isPlainRecord(det) ? det : undefined;
43
+ const codeRaw = card?.code;
44
+ const kindRaw = card?.errorKind;
44
45
  const code = typeof codeRaw === "string" ? codeRaw : typeof kindRaw === "string" ? kindRaw : undefined;
45
- const deliveredRaw = readMember(det, "delivered");
46
+ const deliveredRaw = card?.delivered;
46
47
  const delivered = typeof deliveredRaw === "string" && MCP_DELIVERY_VERDICTS.includes(deliveredRaw) ? deliveredRaw : undefined;
47
48
  const gatedCallId = code === "gate.parked" ? gatedCallIdOfRun : undefined;
48
49
  return {
@@ -54,7 +55,7 @@ export function toolEndBodyFrom(result, isError, leg, gate, gatedCallIdOfRun) {
54
55
  ...(gate !== undefined ? { gate } : {}),
55
56
  };
56
57
  }
57
- const startFrameOf = (o, recovered) => ({ type: "tool_start", toolCallId: o.toolCallId, toolName: o.spelledName, ...(o.label !== undefined ? { label: o.label } : {}), args: o.args, ...(recovered ? { recovered: true } : {}) });
58
+ const startFrameOf = (o, recovered) => ({ type: "tool_start", toolCallId: o.toolCallId, toolName: o.spelledName, ...(o.label !== undefined ? { label: o.label } : {}), args: o.args, ...(recovered ? { recovered: true } : {}), ...(o.requestedBy !== undefined ? { requestedBy: o.requestedBy } : {}) });
58
59
  export function announceToolCall(table, start, frames) {
59
60
  table.open(start);
60
61
  frames.push(startFrameOf(start, false));
@@ -65,7 +66,7 @@ export function emitSettled(table, start, end, frames) {
65
66
  if (!occ.startEmitted)
66
67
  frames.push(startFrameOf(occ, true));
67
68
  const gate = occ.gateRounds.at(-1);
68
- const isError = end.isError || gate?.disposition.kind === "denied", notExecuted = end.notExecuted === true || refusedBeforeRelease(occ);
69
+ const isError = end.isError || gate?.disposition.kind === "denied", notExecuted = end.notExecuted === true || neverExecuted(occ);
69
70
  table.close(occ.toolCallId, end.interrupted === true ? "interrupted" : "settled");
70
71
  frames.push({
71
72
  type: "tool_end",
@@ -75,7 +76,7 @@ export function emitSettled(table, start, end, frames) {
75
76
  isError,
76
77
  ...toolEndBodyFrom(end.result, isError, frames, gate, end.gatedCallIdOfRun),
77
78
  ...(gate?.disposition.kind === "denied" && occ.wireName !== undefined ? { wireName: occ.wireName } : {}),
78
- ...(notExecuted ? { notExecuted: true } : {}),
79
+ ...(notExecuted ? { notExecuted: true } : {}), ...(occ.answeredInPlaceBy !== undefined ? { answeredBy: occ.answeredInPlaceBy } : {}), ...(occ.requestedBy !== undefined ? { requestedBy: occ.requestedBy } : {}),
79
80
  });
80
81
  return { ...(gate !== undefined ? { gate } : {}), isError, ...(notExecuted ? { notExecuted: true } : {}) };
81
82
  }
@@ -4,9 +4,14 @@ import type { ToolOccurrence } from "./tool-occurrence.js";
4
4
  * release, by a station inside the execution, is not). A call whose start this stream never carried (a recovered
5
5
  * one, closed by a station that knows only its own class) is not read here. */
6
6
  export declare function refusedBeforeRelease(occ: Pick<ToolOccurrence, "life" | "gateRounds" | "startEmitted">): boolean;
7
+ /** The one reading of the engine's positive evidence that a call never ran: refused before it was let go
8
+ * ({@link refusedBeforeRelease}), or answered in place of its body by an extension at `tool.call` (the body was never called). */
9
+ export declare function neverExecuted(occ: Pick<ToolOccurrence, "life" | "gateRounds" | "startEmitted" | "answeredInPlaceBy">): boolean;
7
10
  /** `details` as a persisted `toolResult` row carries it: `notExecuted` is the ENGINE's key — the settlement's fact when it holds,
8
11
  * absent otherwise, whatever a tool wrote under that name. Returns `details` itself unless the key has to move; never mutates it. */
9
12
  export declare function rowDetailsOf(details: unknown, notExecuted: boolean): unknown;
13
+ /** The persisted row's mark: the call this `toolResult` row closes never ran (the key {@link rowDetailsOf} writes). */
14
+ export declare function rowNotExecuted(details: unknown): boolean;
10
15
  /** A row the resumed leg mints (`toolResultMsg`) with the settlement's fact on it. */
11
16
  export declare function withRowNotExecuted<T extends object>(row: T, notExecuted: boolean): T;
12
17
  /** Write the end projection's one `notExecuted` onto the result the live loop persists as the call's row: the loop builds that message
@@ -2,6 +2,9 @@ import { readOwnMembers } from "../thrown-value.js";
2
2
  export function refusedBeforeRelease(occ) {
3
3
  return occ.life === "announced" && occ.startEmitted && occ.gateRounds.at(-1)?.disposition.kind === "denied";
4
4
  }
5
+ export function neverExecuted(occ) {
6
+ return refusedBeforeRelease(occ) || occ.answeredInPlaceBy !== undefined;
7
+ }
5
8
  export function rowDetailsOf(details, notExecuted) {
6
9
  const carries = (() => { try {
7
10
  return details !== null && typeof details === "object" && !Array.isArray(details) && Object.keys(details).includes("notExecuted");
@@ -18,6 +21,14 @@ export function rowDetailsOf(details, notExecuted) {
18
21
  delete bag["notExecuted"];
19
22
  return bag;
20
23
  }
24
+ export function rowNotExecuted(details) {
25
+ try {
26
+ return details !== null && typeof details === "object" && details.notExecuted === true;
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
21
32
  export function withRowNotExecuted(row, notExecuted) {
22
33
  return notExecuted ? { ...row, details: rowDetailsOf(undefined, true) } : row;
23
34
  }
@@ -42,6 +42,8 @@ export interface OccurrenceStart {
42
42
  readonly label?: string;
43
43
  /** The arguments the start frame carries (for a recovered start: the call's own input as the transcript holds it). */
44
44
  readonly args: unknown;
45
+ /** An extension's own call (`$.tool.call`): who asked for it — the frames carry it. Absent for a call a model message carried. */
46
+ readonly requestedBy?: import("../task-event.js").ExtensionRequester;
45
47
  }
46
48
  /** The record, as its readers see it. Written only through {@link ToolOccurrenceTable}. */
47
49
  export interface ToolOccurrence extends OccurrenceStart {
@@ -63,6 +65,9 @@ export interface ToolOccurrence extends OccurrenceStart {
63
65
  /** The heartbeat covers it. Cleared when the loop leaves the call behind at a turn end with no end of its own:
64
66
  * the record stays (a later settlement must still know its start frame went out) but no beat describes it. */
65
67
  readonly beating: boolean;
68
+ /** An extension at `tool.call` answered for the call in place of its body — its result, or its refusal — and named here:
69
+ * the body was never called (positive evidence the call did not run). Absent: no station answered in its place. */
70
+ readonly answeredInPlaceBy?: string;
66
71
  }
67
72
  /** The table of one leg's occurrences — the record's only writer. */
68
73
  export interface ToolOccurrenceTable {
@@ -86,6 +91,9 @@ export interface ToolOccurrenceTable {
86
91
  /** A station after the gate refused the call: one more gate record, minted as a veto of whatever the latest one
87
92
  * settled (a person's yes stays on the settlement; the refusing layer is the disposition). Returns the record. */
88
93
  refuse(toolCallId: string, layer: DeniedBy): GateOutcome;
94
+ /** An extension at `tool.call` answered for the call before its body was called (the kernel's record says the body had
95
+ * not started): the body is never called for this attempt. Once per attempt; a second is an engine defect. */
96
+ answeredInPlace(toolCallId: string, by: string): void;
89
97
  /** An ask for this call is put to the person: the count rises, and the returned `resumeFromUser` lowers it once
90
98
  * (a second call is a no-op). The pair is bound to THIS attempt — a return after the call ended, or after a
91
99
  * reused id re-opened, touches nothing — and an ask for a call this leg does not hold counts nothing: the wait
@@ -21,6 +21,7 @@ export function createToolOccurrenceTable() {
21
21
  ...(start.wireName !== undefined ? { wireName: start.wireName } : {}),
22
22
  ...(start.label !== undefined ? { label: start.label } : {}),
23
23
  args: start.args,
24
+ ...(start.requestedBy !== undefined ? { requestedBy: start.requestedBy } : {}),
24
25
  attempt,
25
26
  life: "announced",
26
27
  awaitingUser: 0,
@@ -96,6 +97,12 @@ export function createToolOccurrenceTable() {
96
97
  occ.gateRounds.push(round);
97
98
  return round;
98
99
  },
100
+ answeredInPlace(toolCallId, by) {
101
+ const occ = held(toolCallId, "an answer in place of the body");
102
+ if (occ.answeredInPlaceBy !== undefined)
103
+ throw new Error(`tool occurrence: call "${toolCallId}" (attempt ${occ.attempt}) was already answered in place`);
104
+ occ.answeredInPlaceBy = by;
105
+ },
99
106
  heard(toolCallId) {
100
107
  const occ = byId.get(toolCallId);
101
108
  if (occ !== undefined)
@@ -1,4 +1,5 @@
1
1
  import type { McpDroppedTool } from "../mcp.js";
2
+ import type { AnnouncedMcpFailure } from "../../internal/harness.js";
2
3
  import type { McpInstructionsEntry } from "../prompt-section-seat.js";
3
4
  import type { TaskSpec } from "../types.js";
4
5
  import { type SkillListingEntry, type SkillsBlockRender } from "./synthetic-tools.js";
@@ -75,7 +76,7 @@ export declare const CHANGED_FILES_MTIME_EPS_MS = 2000;
75
76
  /** Per-boundary byte cap over the bundle's CLIPPABLE frames (weak-model context economics). Intact-class
76
77
  * frames ride outside it — see {@link ATTACHMENT_DELIVERY_CLASS}. */
77
78
  export declare const ATTACHMENT_BYTE_CAP: number;
78
- export type AttachmentSource = "todo_reminder" | "task_reminder" | "tool_search_usage_reminder" | "changed_files" | "output_style" | "date_change" | "instructions_change" | "workflow_size_guideline_change" | "budget_usd" | "total_tokens_reminder" | "background_tasks" | "tools_delta" | "agent_listing" | "skills_listing" | "mcp_instructions" | "mcp_dropped_tools";
79
+ export type AttachmentSource = "todo_reminder" | "task_reminder" | "tool_search_usage_reminder" | "changed_files" | "output_style" | "date_change" | "instructions_change" | "workflow_size_guideline_change" | "budget_usd" | "total_tokens_reminder" | "background_tasks" | "tools_delta" | "mcp_unavailable" | "agent_listing" | "skills_listing" | "mcp_instructions" | "mcp_dropped_tools";
79
80
  /** How the bundle cap treats a source — see {@link ATTACHMENT_DELIVERY_CLASS}. */
80
81
  export type AttachmentDeliveryClass = {
81
82
  readonly class: "clippable";
@@ -125,6 +126,10 @@ export declare const ATTACHMENT_DELIVERY_CLASS: {
125
126
  readonly class: "intact";
126
127
  readonly bound: (inp: AttachmentInputs) => number;
127
128
  };
129
+ readonly mcp_unavailable: {
130
+ readonly class: "intact";
131
+ readonly bound: () => number;
132
+ };
128
133
  readonly agent_listing: {
129
134
  readonly class: "intact";
130
135
  readonly bound: (inp: AttachmentInputs) => number;
@@ -548,7 +553,7 @@ export interface AttachmentInputs {
548
553
  path: string;
549
554
  mtimeMs: number;
550
555
  }>;
551
- /** G1 backgroundTasks: registry snapshot (pending/running only, filtered by the runtask getter).
556
+ /** G1 backgroundTasks: the leg's live background tasks, every one (`Prepared.listBackgroundTasks`); the renderer caps the list.
552
557
  * Only fetched when opted in AND `state.postCompactPending` — OFF means zero registry reads. */
553
558
  backgroundTasks?: ReadonlyArray<BackgroundTaskSnapshot>;
554
559
  /** G1 toolsDelta: deferred tools MATERIALIZED since the last announcement (prepare-task's
@@ -565,7 +570,7 @@ export interface AttachmentInputs {
565
570
  newToolsSwappedUnderStatic?: readonly string[];
566
571
  /** The same fact for the READDED arm. See {@link renderToolsDelta}. */
567
572
  readdedToolsSwappedUnderStatic?: readonly string[];
568
- /** The MCP-driven arms of the SAME tools_delta frame (removed / readded / failed servers).
573
+ /** The MCP-driven arms of the SAME tools_delta frame (removed / readded).
569
574
  * Same pre-diffed input + CALLER-owned intact-survival consumption discipline as `newTools`; only
570
575
  * passed when `config.toolsDelta` is opted in. See {@link McpToolsDeltaFacts} for reachability. */
571
576
  mcpToolsDelta?: McpToolsDeltaFacts;
@@ -740,14 +745,30 @@ export interface McpToolsDeltaFacts {
740
745
  removed?: readonly string[];
741
746
  /** Previously-announced-then-withdrawn deferred tools that came BACK. */
742
747
  readded?: readonly string[];
743
- /** Declared MCP servers that failed to connect at materialize (`MaterializedMcp.statuses`, status
744
- * `"failed"`). `error` is REMOTE/transport text — the producer neutralizes + bounds it at intake.
745
- * */
746
- failedServers?: ReadonlyArray<{
747
- name: string;
748
- error?: string;
749
- }>;
750
748
  }
749
+ /**
750
+ * The `mcp_unavailable` frame — the declared MCP servers that did not connect for this message, each the once-per-session ledger's
751
+ * pair (`name` and the REMOTE `error` text, neutralized and bounded at intake). The reference's failed-servers arm
752
+ * (cli296.js:250575) "configured but failed to connect", with its duration clause made true of this engine: a server that stays declared is tried again by the
753
+ * next run that prepares, so it is unavailable "for now", not "for this session", and whether it connects then depends on the error.
754
+ */
755
+ export declare function renderMcpUnavailable(failed: ReadonlyArray<AnnouncedMcpFailure>): string | undefined;
756
+ /** Whether the `mcp_unavailable` lane is on for a task's attachments config — the one reading, asked by the config door (so a switch
757
+ * nobody can read refuses the task before any resource is acquired) and by the leg's first request: absent is the registry's
758
+ * default, a boolean is itself (an explicit `true` is not vetoed by a registry flip), anything else is refused by name
759
+ * (`config.invalid_argument`, `detail.field`), never read as either state. */
760
+ export declare function mcpUnavailableOn(cfg: TaskSpec["attachments"] | null): boolean;
761
+ /** The `mcp_unavailable` frame a leg's first request owes — a fresh leg's first message or a resumed leg's continuation, the one
762
+ * request every leg makes — or undefined (the lane is off, or nothing is pending). `entries` is what the frame names; the
763
+ * carrying message's receipt settles exactly those. */
764
+ export declare function owedMcpUnavailable(prepared: {
765
+ readonly mcpUnavailable?: {
766
+ pending: AnnouncedMcpFailure[];
767
+ };
768
+ }, cfg: TaskSpec["attachments"] | null): {
769
+ body: string;
770
+ entries: AnnouncedMcpFailure[];
771
+ } | undefined;
751
772
  /**
752
773
  * G1 — deferred-tool materialization announce (boundary notice). The reference's template (cli296.js:128211): "The following deferred tools are now available via", in full:
753
774
  * "The following deferred
@@ -766,15 +787,12 @@ export interface McpToolsDeltaFacts {
766
787
  * listing back, so a withdrawn tool genuinely leaves (and a re-advertised one genuinely returns)
767
788
  * the roster mid-task. CC's trailing "Load via ToolSearch as before" / "Do not search for them —
768
789
  * ToolSearch will return no match" clauses are kept, because sema mounts the SAME ToolSearch name.
769
- * - `failed`: reachable from `MaterializedMcp.statuses` (`status: "failed"`, fail-open
770
- * connect skip). CC additionally splits a MANAGED-POLICY sub-arm off this list (`jlr`/`Oy_` error
771
- * codes @626575) — sema has no managed-policy error taxonomy, so only the connection-failure form
772
- * is rendered.
790
+ * The reference's `failed` arm is its own frame here ({@link renderMcpUnavailable}): it must reach the leg's first request.
773
791
  * DELIBERATELY ABSENT (state unreachable — announcing them would be a §25 honesty breach):
774
792
  * - `needs-auth` (@626543): sema's MCP auth surface is STATIC deployment-supplied headers
775
793
  * (`McpServerSpec.transport.headers` / `principalHeader`) with no OAuth flow and no
776
794
  * authorization-required status — an auth rejection surfaces as an ordinary connect failure and is
777
- * covered by the `failed` arm above.
795
+ * covered by the `mcp_unavailable` frame.
778
796
  * - `pending`: `materializeMcpTools` is fully AWAITED inside prepareTask (one
779
797
  * `Promise.allSettled` over every server) before the run loop's first turn, so "still connecting"
780
798
  * does not exist at any turn boundary — `McpServerStatus.status` is `connected | failed` only.