@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
@@ -1,4 +1,6 @@
1
1
  import type { AssertAllKeysHandled } from "./ask-origin.js";
2
+ import type { AnnouncedMcpFailure } from "../internal/harness.js";
3
+ import type { McpTransportKind } from "./mcp-server-spec.js";
2
4
  /**
3
5
  * The closed set of failure classes ({@link McpFailure.kind}):
4
6
  * · `connect_refused` — a connect-phase errno (ECONNREFUSED / ENOTFOUND / EAI_AGAIN / EHOSTUNREACH /
@@ -9,8 +11,14 @@ import type { AssertAllKeysHandled } from "./ask-origin.js";
9
11
  * · `connection_closed` — the SDK reported the transport closed (`McpError` `ConnectionClosed`): in
10
12
  * flight the fate is unknowable, and for a server already known dead the
11
13
  * request was never attempted — the two are told apart by `delivered`;
12
- * · `http_status` — the HTTP endpoint answered with a status instead of an MCP response
13
- * (`httpStatus` carries the number: 401/403 = re-authorize, 5xx = down);
14
+ * · `unauthorized` — the principal must authorize this server before it serves them: the endpoint
15
+ * answered 401 (after the peer seat was asked once more), or 403 whose
16
+ * challenge says `insufficient_scope`, or the deployment's peer seat answered
17
+ * that the principal is not authorized here. `authorization` carries which
18
+ * ({@link McpAuthorization}); the next step is the user's, not an outage's;
19
+ * · `http_status` — the HTTP endpoint answered with any other status instead of an MCP response
20
+ * (`httpStatus` carries the number: 5xx = down, a 403 without a scope
21
+ * challenge = refused by policy);
14
22
  * · `not_mcp_response` — the HTTP endpoint answered something that is not an MCP payload and no status;
15
23
  * · `spawn_failed` — a stdio server process could not be started (a missing/unexecutable command);
16
24
  * · `timeout` — the request timed out (the SDK's per-call timer, the total ceiling, or the
@@ -20,13 +28,43 @@ import type { AssertAllKeysHandled } from "./ask-origin.js";
20
28
  * · `invalid_config` — the declaration itself could not be dialed (a malformed `url`): a fault to
21
29
  * fix in the spec, never an outage to wait out;
22
30
  * · `credential_unavailable` — the deployment's peer seat did not furnish the request (it threw, did not
23
- * answer in time, answered something the engine cannot carry, or answered that
24
- * the principal is not authorized): that request was not sent — a fault for the
25
- * deployment to fix, not an outage of the server;
26
- * · `unknown` — the thrown value carried no structure this table reads.
31
+ * answer in time, or answered something the engine cannot carry): that request
32
+ * was not sent — a fault for the deployment to fix, not an outage of the server;
33
+ * · `host_refused` — the host seat of a host-supplied transport (mcp-host-seat.ts) did not hand the request to the
34
+ * remote: nothing ran, and nothing is said about whether the remote can be reached;
35
+ * · `unknown` — the thrown value carried no structure this table reads, or the host seat took the request
36
+ * and cannot tell how it ended.
27
37
  */
28
- export declare const MCP_FAILURE_KINDS: readonly ["connect_refused", "connection_failed", "connection_closed", "http_status", "not_mcp_response", "spawn_failed", "timeout", "protocol", "invalid_config", "credential_unavailable", "unknown"];
38
+ export declare const MCP_FAILURE_KINDS: readonly ["connect_refused", "connection_failed", "connection_closed", "unauthorized", "http_status", "not_mcp_response", "spawn_failed", "timeout", "protocol", "invalid_config", "credential_unavailable", "host_refused", "unknown"];
29
39
  export type McpFailureKind = (typeof MCP_FAILURE_KINDS)[number];
40
+ /**
41
+ * Why a server is `unauthorized` ({@link McpAuthorization.reason}), closed:
42
+ * · `rejected` — the HTTP endpoint answered 401: the request's credential (or its absence) was refused, and asking the peer seat once
43
+ * more did not answer a credential that passed;
44
+ * · `scope` — the HTTP endpoint answered 403 with a Bearer challenge whose `error` is `insufficient_scope` (RFC 6750 §3.1): the
45
+ * credential is good and does not cover this request;
46
+ * · `none` — the deployment's peer seat answered `unauthorized`: it holds no credential for this principal and this server, so
47
+ * nothing was sent.
48
+ */
49
+ export declare const MCP_AUTHORIZATION_REASONS: readonly ["rejected", "scope", "none"];
50
+ export type McpAuthorizationReason = (typeof MCP_AUTHORIZATION_REASONS)[number];
51
+ /**
52
+ * The authorization fact an `unauthorized` failure carries — one record, read whole by every face (the status record, the wiring
53
+ * manifest row, the thrown request error's `details`, the `mcp.authorization_required` notice, the model's needs-authorization line).
54
+ * The two URLs are separate members because their trust differs:
55
+ * · `authorizeUrl` comes ONLY from the deployment's peer seat (its `unauthorized` answer, to the send or to the re-ask after a 401) —
56
+ * TRUSTED; the engine never makes one up;
57
+ * · `resourceMetadataUrl` comes ONLY from the endpoint's own `WWW-Authenticate` challenge (`resource_metadata`, RFC 9728) — the
58
+ * REMOTE's claim, UNTRUSTED, and never rendered to the model by the engine.
59
+ * Both are read by one URL law at the point they arrive (`authorizationUrlOf`, peer-seat.ts): an absolute http(s) URL within
60
+ * {@link import("./peer-seat.js").AUTHORIZATION_URL_MAX} code units, kept as the URL parser serializes it (percent-encoded: no
61
+ * whitespace, no markup); the seat's URL that breaks the law refuses its answer, the remote's is dropped.
62
+ */
63
+ export interface McpAuthorization {
64
+ reason: McpAuthorizationReason;
65
+ authorizeUrl?: string;
66
+ resourceMetadataUrl?: string;
67
+ }
30
68
  /** The closed set of delivery verdicts ({@link McpFailure.delivered}). */
31
69
  export declare const MCP_DELIVERY_VERDICTS: readonly ["yes", "no", "unknown"];
32
70
  export type McpDelivered = (typeof MCP_DELIVERY_VERDICTS)[number];
@@ -41,6 +79,7 @@ export declare const DELIVERED_BY_KIND: {
41
79
  readonly connect_refused: "no";
42
80
  readonly connection_failed: "unknown";
43
81
  readonly connection_closed: "unknown";
82
+ readonly unauthorized: "unknown";
44
83
  readonly http_status: "unknown";
45
84
  readonly not_mcp_response: "unknown";
46
85
  readonly spawn_failed: "no";
@@ -48,6 +87,7 @@ export declare const DELIVERED_BY_KIND: {
48
87
  readonly protocol: "yes";
49
88
  readonly invalid_config: "no";
50
89
  readonly credential_unavailable: "no";
90
+ readonly host_refused: "no";
51
91
  readonly unknown: "unknown";
52
92
  };
53
93
  /** The fence over the delivery table: `never` while every kind has a verdict. */
@@ -103,6 +143,7 @@ export declare const LIVENESS_BY_FAILURE_KIND: {
103
143
  readonly connect_refused: "unreachable";
104
144
  readonly connection_failed: "unreachable";
105
145
  readonly connection_closed: "unreachable";
146
+ readonly unauthorized: "unknown";
106
147
  readonly http_status: "unknown";
107
148
  readonly not_mcp_response: "unknown";
108
149
  readonly spawn_failed: "unreachable";
@@ -110,21 +151,23 @@ export declare const LIVENESS_BY_FAILURE_KIND: {
110
151
  readonly protocol: "reachable";
111
152
  readonly invalid_config: undefined;
112
153
  readonly credential_unavailable: undefined;
154
+ readonly host_refused: undefined;
113
155
  readonly unknown: "unknown";
114
156
  };
115
157
  /** The fence over the liveness table: `never` while every kind has a verdict. */
116
158
  export type LivenessTableCoversEveryMcpFailureKind = AssertAllKeysHandled<Exclude<McpFailureKind, keyof typeof LIVENESS_BY_FAILURE_KIND>>;
117
159
  /**
118
- * What ONE exchange with a server tells the liveness record: the CLASS of the failure it ended in, or
119
- * `"completed"` when it finished. Every round trip the engine makes — a dial, a tool call, a resource
120
- * read, a listing, a refresh — reports exactly this, so the engine needs no second vocabulary and no
121
- * per-site judgment about which failures "count".
160
+ * What ONE exchange with a server tells the liveness record: the CLASS of the failure it ended in,
161
+ * `"completed"` when it finished, or `"unsent"` when the engine's own seat refused to send it (nothing
162
+ * was attempted, whatever the class — see {@link readMcpFailure}). Every round trip the engine makes — a
163
+ * dial, a tool call, a resource read, a listing, a refresh — reports exactly this, so the engine needs no
164
+ * second vocabulary and no per-site judgment about which failures "count".
122
165
  */
123
- export type McpExchangeOutcome = McpFailureKind | "completed";
166
+ export type McpExchangeOutcome = McpFailureKind | "completed" | "unsent";
124
167
  /** The liveness observation an exchange supports, or `undefined` when the outcome is not an observation
125
- * at all (see {@link LIVENESS_BY_FAILURE_KIND}: a declaration that could never be dialed). THE single
126
- * mint of the record — no two sites can disagree about the word, about which words may carry
127
- * `errorCode`, or about what a completed exchange proves. */
168
+ * at all (see {@link LIVENESS_BY_FAILURE_KIND}: a declaration that could never be dialed; a request the
169
+ * engine never sent). THE single mint of the record — no two sites can disagree about the word, about
170
+ * which words may carry `errorCode`, or about what a completed exchange proves. */
128
171
  export declare function livenessOf(outcome: McpExchangeOutcome, observedAt: number): McpServerLiveness | undefined;
129
172
  /** A request over an established connection; `session` when the request carried the session id the server issued at the handshake. */
130
173
  export type McpRequestSite = {
@@ -135,11 +178,11 @@ export type McpRequestSite = {
135
178
  * transport is the child process failing to spawn, or on a request over an established connection. */
136
179
  export type McpFailureSite = {
137
180
  phase: "connect";
138
- transport: "stdio" | "http" | undefined;
181
+ transport: McpTransportKind | undefined;
139
182
  } | McpRequestSite;
140
183
  /**
141
184
  * The one MCP failure record. Both fields are always present; `httpStatus` rides only with
142
- * `kind === "http_status"`.
185
+ * `kind === "http_status"`, `authorization` only with `kind === "unauthorized"`.
143
186
  */
144
187
  export interface McpFailure {
145
188
  /**
@@ -171,7 +214,23 @@ export interface McpFailure {
171
214
  delivered: McpDelivered;
172
215
  /** The HTTP status the endpoint answered with; present iff `kind === "http_status"`. */
173
216
  httpStatus?: number;
217
+ /** @contract mcp.failure.authorization — why the principal must authorize, and where ({@link McpAuthorization}); present iff
218
+ * `kind === "unauthorized"`. */
219
+ authorization?: McpAuthorization;
220
+ }
221
+ /**
222
+ * The failure record as a row carries it, spread flat: {@link McpFailure.kind} as `errorCode` beside `delivered`, and the class's own
223
+ * members (`httpStatus`, `authorization`). Every row that carries the record — the per-server status, the wiring manifest's `mcp[]`
224
+ * row — is written by {@link failureFields}, so a member the record gains rides every row without a second spelling.
225
+ */
226
+ export interface McpFailureFields {
227
+ errorCode: McpFailureKind;
228
+ delivered: McpDelivered;
229
+ httpStatus?: number;
230
+ authorization?: McpAuthorization;
174
231
  }
232
+ /** {@link McpFailureFields} of a record, or of a row that already carries them (`errorCode` absent ⇒ none) — fresh objects, never aliased. */
233
+ export declare function failureFields(of: McpFailure | Partial<McpFailureFields>): Partial<McpFailureFields>;
175
234
  /**
176
235
  * The first errno-shaped / undici-shaped `code` on an error's cause chain (`E[A-Z_]+`, `UND_ERR_*`,
177
236
  * Node's `ERR_*`). `fetch` reports every network failure as a bare `TypeError: fetch failed` with the
@@ -180,12 +239,16 @@ export interface McpFailure {
180
239
  * DNS-temporary-failure errno is literally `EAI_AGAIN`.
181
240
  */
182
241
  export declare function networkErrorCode(err: unknown, depth?: number): string | undefined;
183
- /** What a row reads OFF the thrown value: the failure's class, and the status the `http_status` class
184
- * carries. A row does NOT write the delivery verdict — that follows from the kind and the SITE, in
185
- * one place ({@link DELIVERED_BY_KIND} + {@link classifyMcpFailure}), so a row cannot spell it wrong. */
242
+ /** What a row reads OFF the thrown value: the failure's class, the status the `http_status` class carries, the authorization fact
243
+ * the `unauthorized` class carries, and `unsent` — the thrown value is the engine's OWN refusal to send (the peer seat did not
244
+ * furnish the request: {@link PeerSeatFailure}), a structural fact about our side of the exchange that makes the verdict `"no"`
245
+ * whatever the class. A row does NOT write the delivery verdict — that follows from the kind, `unsent` and the SITE, in one place
246
+ * ({@link DELIVERED_BY_KIND} + {@link classifyMcpFailure}), so a row cannot spell it wrong. */
186
247
  export type McpFailureClass = {
187
248
  kind: McpFailureKind;
188
249
  httpStatus?: number;
250
+ authorization?: McpAuthorization;
251
+ unsent?: true;
189
252
  };
190
253
  /** One row of the classifier: `when` reads structure only; `reads` names the class it saw. */
191
254
  export interface McpFailureRule {
@@ -209,6 +272,45 @@ export declare const FAILURE_CLASSIFIER: ReadonlyArray<McpFailureRule>;
209
272
  * Total: every input maps to a record.
210
273
  */
211
274
  export declare function classifyMcpFailure(err: unknown, at: McpFailureSite): McpFailure;
275
+ /**
276
+ * One failure, read once: the record ({@link classifyMcpFailure}) and what the exchange tells the liveness record
277
+ * ({@link McpExchangeOutcome} — `"unsent"` for the engine's own refusal to send, else the class). A refusal of our own is `"no"` at every
278
+ * site and is no observation about the server; at the dial every other class but those minted from an answer is `"no"`
279
+ * ({@link CONNECT_KEEPS_THE_TABLE_VERDICT}); elsewhere the table says.
280
+ */
281
+ export declare function readMcpFailure(err: unknown, at: McpFailureSite): {
282
+ failure: McpFailure;
283
+ exchange: McpExchangeOutcome;
284
+ };
285
+ /**
286
+ * A failed server as the `mcp_unavailable` frame tells it: the session's told-record identity pair (`name`, `error` — the ledger judges
287
+ * telling by the pair, announce-once-ledger.ts) and, for an `unauthorized` failure, the record's own `authorization` — what the frame's
288
+ * needs-authorization arm renders. The told record keeps the pair only (`settleMcpUnavailable`): the pair already differs when the
289
+ * failure does.
290
+ */
291
+ export interface McpUnavailableEntry extends AnnouncedMcpFailure {
292
+ authorization?: McpAuthorization;
293
+ }
294
+ /** Where the user authorizes, as every model-facing line names it: the seat's URL, or the deployment's connector settings. */
295
+ export declare function whereToAuthorize(authorizeUrl: string | undefined): string;
296
+ /**
297
+ * The `mcp_unavailable` frame's needs-authorization arm — the servers among `entries` whose failure record carries `authorization`, or
298
+ * `undefined` when there are none. CC 2.1.309's arm, minted as `needsAuthMcpServers` (cli309.js:265582), read back as `needsAuthMcpServers` (cli309.js:267398),
299
+ * worded (cli309.js:267399) "The following MCP servers require authentication before their tools can be used" — ahead of the
300
+ * failed-to-connect arm; this engine never runs an authorization flow itself, so it is always the reference's cannot-start-the-flow form.
301
+ * `<where>` is the deployment seat's `authorizeUrl` when it gave one (listed beside the server), else the connector settings; no error
302
+ * text rides it (the fact is the record's). At most `max` servers are named, the rest counted.
303
+ */
304
+ export declare function needsAuthorizationArm(entries: readonly McpUnavailableEntry[], max: number): string | undefined;
305
+ /**
306
+ * The model's line for a request refused as `unauthorized` — the call-time twin of the needs-authorization arm the `mcp_unavailable`
307
+ * frame carries for a server that could not mount (turn-attachments.ts): who must act (the user), where ({@link whereToAuthorize}: the
308
+ * seat's URL only), what not to ask for, and the delivery tail (`writeTail`, the caller's write-class sentence) the verdict owes. A 401
309
+ * after which the deployment answered another credential that no request has carried yet (`renewed`: the first attempt, not sent again)
310
+ * may pass on a new call: the line says so, and that only a refusal of that call too is the user's — a seat that answers a fresh
311
+ * credential every time still reaches the user. A re-send refused again is the plain line.
312
+ */
313
+ export declare function unauthorizedLine(what: string, serverLabel: string, a: McpAuthorization, renewed: boolean, writeTail: string): string;
212
314
  /**
213
315
  * What a transport-level HTTP failure can be said to be, in words for a model-facing line: the
214
316
  * condition to name, and the delivery verdict. `undefined` for every failure that is NOT of the HTTP
@@ -1,11 +1,13 @@
1
1
  import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
2
2
  import { StreamableHTTPError } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3
3
  import { proxyTunnelRefusedSentence, readConnectFailure } from "../brain/errors.js";
4
- import { PeerSeatFailure } from "./peer-seat.js";
4
+ import { PeerAuthorizationRefused, PeerSeatFailure } from "./peer-seat.js";
5
+ import { hostSeatVerdictOf } from "./mcp-host-seat.js";
5
6
  export const MCP_FAILURE_KINDS = Object.freeze([
6
7
  "connect_refused",
7
8
  "connection_failed",
8
9
  "connection_closed",
10
+ "unauthorized",
9
11
  "http_status",
10
12
  "not_mcp_response",
11
13
  "spawn_failed",
@@ -13,13 +15,16 @@ export const MCP_FAILURE_KINDS = Object.freeze([
13
15
  "protocol",
14
16
  "invalid_config",
15
17
  "credential_unavailable",
18
+ "host_refused",
16
19
  "unknown",
17
20
  ]);
21
+ export const MCP_AUTHORIZATION_REASONS = Object.freeze(["rejected", "scope", "none"]);
18
22
  export const MCP_DELIVERY_VERDICTS = Object.freeze(["yes", "no", "unknown"]);
19
23
  export const DELIVERED_BY_KIND = {
20
24
  connect_refused: "no",
21
25
  connection_failed: "unknown",
22
26
  connection_closed: "unknown",
27
+ unauthorized: "unknown",
23
28
  http_status: "unknown",
24
29
  not_mcp_response: "unknown",
25
30
  spawn_failed: "no",
@@ -27,6 +32,7 @@ export const DELIVERED_BY_KIND = {
27
32
  protocol: "yes",
28
33
  invalid_config: "no",
29
34
  credential_unavailable: "no",
35
+ host_refused: "no",
30
36
  unknown: "unknown",
31
37
  };
32
38
  export const MCP_LIVENESS_STATES = Object.freeze(["reachable", "unreachable", "unknown"]);
@@ -34,6 +40,7 @@ export const LIVENESS_BY_FAILURE_KIND = {
34
40
  connect_refused: "unreachable",
35
41
  connection_failed: "unreachable",
36
42
  connection_closed: "unreachable",
43
+ unauthorized: "unknown",
37
44
  http_status: "unknown",
38
45
  not_mcp_response: "unknown",
39
46
  spawn_failed: "unreachable",
@@ -41,17 +48,31 @@ export const LIVENESS_BY_FAILURE_KIND = {
41
48
  protocol: "reachable",
42
49
  invalid_config: undefined,
43
50
  credential_unavailable: undefined,
51
+ host_refused: undefined,
44
52
  unknown: "unknown",
45
53
  };
46
54
  export function livenessOf(outcome, observedAt) {
47
55
  if (outcome === "completed")
48
56
  return { state: "reachable", observedAt };
57
+ if (outcome === "unsent")
58
+ return undefined;
49
59
  const state = LIVENESS_BY_FAILURE_KIND[outcome];
50
60
  if (state === undefined)
51
61
  return undefined;
52
62
  return state === "unreachable" ? { state, observedAt, errorCode: outcome } : { state, observedAt };
53
63
  }
54
- const CONNECT_KEEPS_THE_TABLE_VERDICT = new Set(["protocol", "http_status"]);
64
+ const CONNECT_KEEPS_THE_TABLE_VERDICT = new Set(["protocol", "http_status", "unauthorized"]);
65
+ export function failureFields(of) {
66
+ const kind = "kind" in of ? of.kind : of.errorCode;
67
+ if (kind === undefined)
68
+ return {};
69
+ return {
70
+ errorCode: kind,
71
+ ...(of.delivered !== undefined ? { delivered: of.delivered } : {}),
72
+ ...(of.httpStatus !== undefined ? { httpStatus: of.httpStatus } : {}),
73
+ ...(of.authorization !== undefined ? { authorization: { ...of.authorization } } : {}),
74
+ };
75
+ }
55
76
  const NETWORK_CODES_NEVER_DELIVERED = new Set([
56
77
  "ECONNREFUSED",
57
78
  "ENOTFOUND",
@@ -78,10 +99,20 @@ export function networkErrorCode(err, depth = 0) {
78
99
  const isNodeErrCode = (code) => code.startsWith("ERR_");
79
100
  const isDeclarationFault = (code) => code === "ERR_INVALID_URL" || (typeof code === "string" && code.startsWith("config."));
80
101
  export const FAILURE_CLASSIFIER = [
102
+ {
103
+ name: "peer seat answered the principal is not authorized",
104
+ when: (err) => err instanceof PeerSeatFailure && err.reason === "unauthorized",
105
+ reads: (err) => ({ kind: "unauthorized", authorization: authorizationOf("none", err.authorizeUrl, undefined), unsent: true }),
106
+ },
81
107
  {
82
108
  name: "peer seat did not furnish the request",
83
109
  when: (err) => err instanceof PeerSeatFailure,
84
- reads: () => ({ kind: "credential_unavailable" }),
110
+ reads: () => ({ kind: "credential_unavailable", unsent: true }),
111
+ },
112
+ {
113
+ name: "host seat did not carry the request",
114
+ when: (err) => hostSeatVerdictOf(err) !== undefined,
115
+ reads: (err) => ({ kind: hostSeatVerdictOf(err).delivered === "no" ? "host_refused" : "unknown" }),
85
116
  },
86
117
  {
87
118
  name: "sdk connection closed",
@@ -98,6 +129,13 @@ export const FAILURE_CLASSIFIER = [
98
129
  when: (err) => err instanceof McpError,
99
130
  reads: () => ({ kind: "protocol" }),
100
131
  },
132
+ {
133
+ name: "http endpoint refused the authorization",
134
+ when: (err) => err instanceof StreamableHTTPError && (err.code === 401 || err instanceof PeerAuthorizationRefused),
135
+ reads: (err) => err instanceof PeerAuthorizationRefused
136
+ ? { kind: "unauthorized", authorization: authorizationOf(err.reason, err.authorizeUrl, err.resourceMetadataUrl) }
137
+ : { kind: "unauthorized", authorization: { reason: "rejected" } },
138
+ },
101
139
  {
102
140
  name: "http endpoint answered a status",
103
141
  when: (err) => err instanceof StreamableHTTPError && typeof err.code === "number" && err.code > 0,
@@ -151,9 +189,37 @@ export const FAILURE_CLASSIFIER = [
151
189
  },
152
190
  ];
153
191
  export function classifyMcpFailure(err, at) {
154
- const read = classOf(err, at);
192
+ return readMcpFailure(err, at).failure;
193
+ }
194
+ export function readMcpFailure(err, at) {
195
+ const { unsent, ...read } = classOf(err, at);
155
196
  const dialled = at.phase === "connect" && !CONNECT_KEEPS_THE_TABLE_VERDICT.has(read.kind);
156
- return { ...read, delivered: dialled ? "no" : DELIVERED_BY_KIND[read.kind] };
197
+ return { failure: { ...read, delivered: unsent === true || dialled ? "no" : DELIVERED_BY_KIND[read.kind] }, exchange: unsent === true ? "unsent" : read.kind };
198
+ }
199
+ function authorizationOf(reason, authorizeUrl, resourceMetadataUrl) {
200
+ return { reason, ...(authorizeUrl !== undefined ? { authorizeUrl } : {}), ...(resourceMetadataUrl !== undefined ? { resourceMetadataUrl } : {}) };
201
+ }
202
+ export function whereToAuthorize(authorizeUrl) {
203
+ return authorizeUrl !== undefined ? `at ${authorizeUrl}` : "through the deployment's connector settings";
204
+ }
205
+ export function needsAuthorizationArm(entries, max) {
206
+ const named = entries.filter((f) => f.authorization !== undefined);
207
+ if (named.length === 0)
208
+ return undefined;
209
+ const withUrl = named.filter((f) => f.authorization?.authorizeUrl !== undefined).length;
210
+ const where = withUrl === named.length ? "at the address listed beside it" : withUrl === 0 ? whereToAuthorize(undefined) : `at the address listed beside it, or, for a server listed without one, ${whereToAuthorize(undefined)}`;
211
+ const lines = named.slice(0, max).map((f) => `${f.name}${f.authorization?.authorizeUrl !== undefined ? ` — authorize ${whereToAuthorize(f.authorization.authorizeUrl)}` : ""}`);
212
+ return (`The following MCP servers require authentication before their tools can be used:\n${lines.join("\n")}${named.length > max ? `\n…and ${named.length - max} more` : ""}\n\n` +
213
+ `You cannot start the authorization flow yourself. If the user's request depends on one of these servers (even if they didn't name it explicitly), ` +
214
+ `or they ask about it, tell them that it needs to be authorized — ${where} — and that the capability is unavailable until they do. ` +
215
+ `Otherwise carry on with the request and do not mention these servers. Do not ask the user for authorization codes, tokens, or callback URLs.`);
216
+ }
217
+ export function unauthorizedLine(what, serverLabel, a, renewed, writeTail) {
218
+ const owed = `The user needs to authorize this server${a.reason === "scope" ? " for the access this request needs" : ""} ${whereToAuthorize(a.authorizeUrl)}; its capability is unavailable until they do. Do not ask the user for authorization codes, tokens, or callback URLs.`;
219
+ if (a.reason === "none")
220
+ return `${what} was not sent to MCP server "${serverLabel}": the deployment holds no authorization of this user for it. ${owed} The request was not delivered, so the server did not execute it.`;
221
+ const refused = `${what} on MCP server "${serverLabel}" was refused ${a.reason === "scope" ? "for insufficient scope (HTTP 403)" : "as unauthorized (HTTP 401)"}`;
222
+ return renewed ? `${refused}; the deployment has since answered another credential, which a new call carries — this call was not sent again. If that call is refused too: ${owed}${writeTail}` : `${refused}. ${owed}${writeTail}`;
157
223
  }
158
224
  function classOf(err, at) {
159
225
  for (const rule of FAILURE_CLASSIFIER)
@@ -185,11 +251,13 @@ export function describeHttpTransportFailure(err, at = { phase: "request" }) {
185
251
  case "connection_failed":
186
252
  return { condition: `the connection to its HTTP endpoint failed (${networkErrorCode(err)})`, delivered: f.delivered };
187
253
  case "connection_closed":
254
+ case "unauthorized":
188
255
  case "spawn_failed":
189
256
  case "timeout":
190
257
  case "protocol":
191
258
  case "invalid_config":
192
259
  case "credential_unavailable":
260
+ case "host_refused":
193
261
  case "unknown":
194
262
  return undefined;
195
263
  }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * The host seat: an MCP pipe the HOST supplies for one leg, mounted by a declaration whose transport is `{ kind: "host" }`
3
+ * ({@link import("./mcp-server-spec.js").McpServerSpec}). The engine owns the seat's shape and the one adapter that turns it
4
+ * into an MCP transport ({@link HostSeatTransport}); the host owns what is behind it. The declaration is data (it rides
5
+ * `TaskSpec.mcp`, the wiring manifest and a resume config like any other entry); the seat is a live object and rides the
6
+ * trusted channel only (`RunInternals.mcpHostSeats`, keyed by the declaration's `name`), never a spec, a checkpoint or a
7
+ * retained child's snapshot.
8
+ *
9
+ * A host-seat server goes through the one MCP pipeline every server does — the dial, the listing intake, the call lane, the
10
+ * failure record — so its listed `_meta`, its call `_meta` and its tool names are what a stdio or http server's would be.
11
+ * What the adapter does itself, and only this:
12
+ * · answers `initialize` locally: the server's name is the declaration's `name`, its version the empty string (a host-seat
13
+ * declaration states no version), its capabilities `tools` only, no instructions; swallows `notifications/initialized`;
14
+ * · hands `tools/list` and `tools/call` to the seat, one {@link McpHostSeat.request} each, with a signal of the request's own
15
+ * — aborted when the engine cancels that request (its abort, its timeout, the idle watchdog) and when the connection closes;
16
+ * · refuses every other method locally (the request is not handed on), and drops an answer that arrives after its request
17
+ * was cancelled.
18
+ * Every outcome reaches the SDK as a JSON-RPC response: the seat's answer as it gave it, a seat failure as an error response
19
+ * whose `data` is a verdict object only this module mints ({@link hostSeatVerdictOf}) — `send` itself never rejects, so the
20
+ * SDK's per-request handlers are always cleared by the response.
21
+ */
22
+ import { type JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
23
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
24
+ /** The requests a host seat answers: a listing and a call. */
25
+ export type McpHostSeatMethod = "tools/list" | "tools/call";
26
+ /** A host seat's answer to one request: the JSON-RPC result, or the JSON-RPC error the remote answered with. */
27
+ export type McpHostSeatAnswer = {
28
+ readonly result: unknown;
29
+ } | {
30
+ readonly error: {
31
+ readonly code: number;
32
+ readonly message: string;
33
+ readonly data?: unknown;
34
+ };
35
+ };
36
+ /**
37
+ * The host's MCP pipe for one leg (`RunInternals.mcpHostSeats`, TRUSTED). `request` answers one request; `signal` is that
38
+ * request's own cancellation. A request the host could not hand to the remote, or whose ending it cannot tell, is answered by
39
+ * throwing {@link McpHostSeatFailure}. The engine never disposes a seat: the host releases it when its leg ends.
40
+ */
41
+ export interface McpHostSeat {
42
+ request(method: McpHostSeatMethod, params: Readonly<Record<string, unknown>>, signal: AbortSignal): Promise<McpHostSeatAnswer>;
43
+ }
44
+ /**
45
+ * A host seat's failure to carry one request, in the one fact the host knows: `delivered: "no"` — the request was not handed to the
46
+ * remote (nothing ran; the failure word is `host_refused`); `delivered: "unknown"` — it was handed on and the host cannot tell how it
47
+ * ended (the failure word is `unknown`). `condition` is the host's own sentence about why, read as untrusted text and bounded; the
48
+ * engine adds what the verdict owes the model (retry safety, the verify-first warning of a write-capable tool) itself, so the
49
+ * condition carries none of it. Any other value thrown by a seat — or this class built with a delivery word outside the two — is a
50
+ * request whose ending the engine cannot tell either: it reads as `unknown`, in the engine's own words, never the thrown text.
51
+ */
52
+ export declare class McpHostSeatFailure extends Error {
53
+ readonly delivered: "no" | "unknown";
54
+ readonly condition: string;
55
+ constructor(o: {
56
+ delivered: "no" | "unknown";
57
+ condition: string;
58
+ });
59
+ }
60
+ /** What a host seat said about a request it did not answer: the delivery fact and the sentence a failure renders. */
61
+ export interface HostSeatVerdict {
62
+ readonly delivered: "no" | "unknown";
63
+ readonly condition: string;
64
+ }
65
+ /** The host seat's verdict a failure carries (the SDK's error for a response this module synthesized), else `undefined`. Structure only. */
66
+ export declare function hostSeatVerdictOf(err: unknown): HostSeatVerdict | undefined;
67
+ /** The sentence a host seat's verdict becomes on the call lane: who failed and why, then the tail the delivery fact owes. */
68
+ export declare function hostSeatLine(what: string, serverLabel: string, seat: HostSeatVerdict, writeTail: string): string;
69
+ /** A host-seat declaration whose leg holds no seat of its name: refused at its dial (`config.mcp_host_seat_missing`), nothing sent. */
70
+ export declare function hostSeatMissing(server: string): Error & {
71
+ code: string;
72
+ };
73
+ /**
74
+ * The one adapter from a {@link McpHostSeat} to the SDK's `Transport` (see the module note). One per connection: `close` aborts every
75
+ * request still in the seat's hands and closes the connection.
76
+ */
77
+ export declare class HostSeatTransport implements Transport {
78
+ private readonly seat;
79
+ private readonly serverName;
80
+ onclose?: () => void;
81
+ onerror?: (error: Error) => void;
82
+ onmessage?: <T extends JSONRPCMessage>(message: T) => void;
83
+ /** The requests in the seat's hands, by id: an answer is delivered only while its request is still here. */
84
+ private readonly inFlight;
85
+ private closed;
86
+ constructor(seat: McpHostSeat, serverName: string);
87
+ start(): Promise<void>;
88
+ send(message: JSONRPCMessage): Promise<void>;
89
+ close(): Promise<void>;
90
+ /** One response to the request `id`, on its own turn (never inside the `send` that carried the request). */
91
+ private deliver;
92
+ }
@@ -0,0 +1,131 @@
1
+ import { ErrorCode, McpError, isJSONRPCErrorResponse, isJSONRPCNotification, isJSONRPCRequest, isJSONRPCResultResponse } from "@modelcontextprotocol/sdk/types.js";
2
+ import { inlineUntrusted } from "./untrusted-text.js";
3
+ export class McpHostSeatFailure extends Error {
4
+ delivered;
5
+ condition;
6
+ constructor(o) {
7
+ if (o.delivered !== "no" && o.delivered !== "unknown")
8
+ throw new TypeError(`McpHostSeatFailure: delivered must be "no" or "unknown"`);
9
+ if (typeof o.condition !== "string")
10
+ throw new TypeError("McpHostSeatFailure: condition must be a string");
11
+ super(o.condition);
12
+ this.name = "McpHostSeatFailure";
13
+ this.delivered = o.delivered;
14
+ this.condition = o.condition;
15
+ }
16
+ }
17
+ const VERDICTS = new WeakSet();
18
+ function verdict(delivered, condition) {
19
+ const minted = Object.freeze({ delivered, condition: inlineUntrusted(condition, 400) });
20
+ VERDICTS.add(minted);
21
+ return minted;
22
+ }
23
+ export function hostSeatVerdictOf(err) {
24
+ if (!(err instanceof McpError))
25
+ return undefined;
26
+ const data = err.data;
27
+ return typeof data === "object" && data !== null && VERDICTS.has(data) ? data : undefined;
28
+ }
29
+ function verdictOfThrown(thrown) {
30
+ try {
31
+ if (thrown instanceof McpHostSeatFailure) {
32
+ const { delivered, condition } = thrown;
33
+ if ((delivered === "no" || delivered === "unknown") && typeof condition === "string")
34
+ return verdict(delivered, condition);
35
+ }
36
+ }
37
+ catch {
38
+ }
39
+ return verdict("unknown", "the host seat failed without saying whether it handed the request on");
40
+ }
41
+ function responseOf(id, raw) {
42
+ let answer;
43
+ try {
44
+ answer = JSON.parse(JSON.stringify(raw) ?? "null");
45
+ }
46
+ catch {
47
+ answer = undefined;
48
+ }
49
+ const member = (name) => (typeof answer === "object" && answer !== null && Object.hasOwn(answer, name) ? answer[name] : undefined);
50
+ const result = member("result");
51
+ const candidate = result !== undefined ? { jsonrpc: "2.0", id, result } : { jsonrpc: "2.0", id, error: member("error") };
52
+ if (isJSONRPCResultResponse(candidate) || isJSONRPCErrorResponse(candidate))
53
+ return candidate;
54
+ return verdict("unknown", "the host seat answered something the protocol cannot carry as a result or an error");
55
+ }
56
+ export function hostSeatLine(what, serverLabel, seat, writeTail) {
57
+ return seat.delivered === "no"
58
+ ? `${what} was not sent to MCP server "${serverLabel}": ${seat.condition}. The host did not hand the request on, so the server did not execute it; sending it again is safe.`
59
+ : `${what} on MCP server "${serverLabel}" ended without an outcome the host could report: ${seat.condition}. The request may or may not have executed on the server — the outcome is unknown.${writeTail}`;
60
+ }
61
+ export function hostSeatMissing(server) {
62
+ return Object.assign(new Error(`MCP server "${inlineUntrusted(server, 120)}" is declared with a host-supplied transport, and this leg holds no host seat of that name (RunInternals.mcpHostSeats) — not dialed`), { code: "config.mcp_host_seat_missing" });
63
+ }
64
+ export class HostSeatTransport {
65
+ seat;
66
+ serverName;
67
+ onclose;
68
+ onerror;
69
+ onmessage;
70
+ inFlight = new Map();
71
+ closed = false;
72
+ constructor(seat, serverName) {
73
+ this.seat = seat;
74
+ this.serverName = serverName;
75
+ }
76
+ async start() { }
77
+ async send(message) {
78
+ if (isJSONRPCNotification(message)) {
79
+ if (message.method === "notifications/cancelled") {
80
+ const id = message.params?.requestId;
81
+ const held = typeof id === "string" || typeof id === "number" ? this.inFlight.get(id) : undefined;
82
+ if (held !== undefined) {
83
+ this.inFlight.delete(id);
84
+ held.abort(new Error("the engine cancelled the request"));
85
+ }
86
+ }
87
+ return;
88
+ }
89
+ if (!isJSONRPCRequest(message))
90
+ return;
91
+ const { id, method } = message;
92
+ const params = (message.params ?? {});
93
+ if (method === "initialize") {
94
+ const protocolVersion = params["protocolVersion"];
95
+ return this.deliver(id, { jsonrpc: "2.0", id, result: { protocolVersion, capabilities: { tools: {} }, serverInfo: { name: this.serverName, version: "" } } });
96
+ }
97
+ if (this.closed)
98
+ return this.deliver(id, verdict("no", "the host seat's connection to this leg is closed"));
99
+ if (method !== "tools/list" && method !== "tools/call")
100
+ return this.deliver(id, verdict("no", `the host seat carries tools/list and tools/call only, and ${inlineUntrusted(method, 80)} was not handed on`));
101
+ const stop = new AbortController();
102
+ this.inFlight.set(id, stop);
103
+ void (async () => {
104
+ let answered;
105
+ try {
106
+ answered = responseOf(id, await this.seat.request(method, params, stop.signal));
107
+ }
108
+ catch (thrown) {
109
+ answered = verdictOfThrown(thrown);
110
+ }
111
+ if (this.inFlight.get(id) !== stop)
112
+ return;
113
+ this.inFlight.delete(id);
114
+ this.deliver(id, answered);
115
+ })();
116
+ }
117
+ async close() {
118
+ if (this.closed)
119
+ return;
120
+ this.closed = true;
121
+ const held = [...this.inFlight.values()];
122
+ this.inFlight.clear();
123
+ for (const stop of held)
124
+ stop.abort(new Error("the connection to the host seat closed"));
125
+ this.onclose?.();
126
+ }
127
+ deliver(id, answered) {
128
+ const message = VERDICTS.has(answered) ? { jsonrpc: "2.0", id, error: { code: ErrorCode.InternalError, message: answered.condition, data: answered } } : answered;
129
+ queueMicrotask(() => this.onmessage?.(message));
130
+ }
131
+ }
@@ -1,6 +1,7 @@
1
1
  import { type McpFailureKind } from "./mcp-failure.js";
2
- import type { McpServerSpec, OnElicit } from "./mcp-server-spec.js";
3
- import type { PeerSeat } from "./peer-seat.js";
2
+ import { type McpServerSpec, type OnElicit } from "./mcp-server-spec.js";
3
+ import { type PeerSeat } from "./peer-seat.js";
4
+ import { type HostFloorDeclaration } from "./host-floor.js";
4
5
  import type { WiringManifestMcpEntry } from "./wiring-manifest.js";
5
6
  /** One server's probe reading, beside its manifest row. `connectMs` is wall time this probe measured
6
7
  * for THIS server's dial — the spawn/handshake, the initial `tools/list` walk and the intake, ending
@@ -60,6 +61,10 @@ export interface McpProbeOptions {
60
61
  /** The peer seat a prepared leg dials with (`RunnerDeps.peerSeat`): what each request carries. Absent ⇒ nothing is carried, and a
61
62
  * server whose declaration names `credentials` reads `failed` (`invalid_config`, `config.peer_seat_missing`). */
62
63
  peerSeat?: PeerSeat;
64
+ /** The deployment's host floor, as `RunnerDeps.hostFloor` declares it: compiled by the one compile ({@link compileHostFloor} — a
65
+ * declaration that does not read is refused before anything is dialed) and judged at the one dial, so an http server whose
66
+ * endpoint a task's floor refuses is refused here too and never contacted. Absent ⇒ no floor, as a deployment that declares none. */
67
+ hostFloor?: HostFloorDeclaration;
63
68
  /** Abort reading, stated once: the call rejects with the signal's own reason when that reason is an
64
69
  * Error (a bare `abort()` supplies a DOMException named `AbortError`) and with this module's own
65
70
  * `AbortError` otherwise — a face that throws a string is a face no `catch` can read. A condition