@animalabs/agent-framework 0.21.1 → 0.22.1

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 (348) hide show
  1. package/README.md +54 -4
  2. package/dist/src/agent.d.ts +17 -4
  3. package/dist/src/agent.d.ts.map +1 -1
  4. package/dist/src/agent.js +105 -43
  5. package/dist/src/agent.js.map +1 -1
  6. package/dist/src/api/server.d.ts.map +1 -1
  7. package/dist/src/api/server.js +41 -4
  8. package/dist/src/api/server.js.map +1 -1
  9. package/dist/src/code-execution/py-runner.d.ts +22 -1
  10. package/dist/src/code-execution/py-runner.d.ts.map +1 -1
  11. package/dist/src/code-execution/py-runner.js +64 -9
  12. package/dist/src/code-execution/py-runner.js.map +1 -1
  13. package/dist/src/code-execution/runtime-py.d.ts +4 -0
  14. package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
  15. package/dist/src/code-execution/runtime-py.js +215 -38
  16. package/dist/src/code-execution/runtime-py.js.map +1 -1
  17. package/dist/src/framework.d.ts +569 -59
  18. package/dist/src/framework.d.ts.map +1 -1
  19. package/dist/src/framework.js +3091 -542
  20. package/dist/src/framework.js.map +1 -1
  21. package/dist/src/gate/event-gate.d.ts +21 -0
  22. package/dist/src/gate/event-gate.d.ts.map +1 -1
  23. package/dist/src/gate/event-gate.js +40 -7
  24. package/dist/src/gate/event-gate.js.map +1 -1
  25. package/dist/src/index.d.ts +7 -2
  26. package/dist/src/index.d.ts.map +1 -1
  27. package/dist/src/index.js +4 -0
  28. package/dist/src/index.js.map +1 -1
  29. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  30. package/dist/src/mcpl/channel-registry.js +26 -3
  31. package/dist/src/mcpl/channel-registry.js.map +1 -1
  32. package/dist/src/mcpl/conversation-router.d.ts +28 -1
  33. package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
  34. package/dist/src/mcpl/conversation-router.js +17 -0
  35. package/dist/src/mcpl/conversation-router.js.map +1 -1
  36. package/dist/src/mcpl/feature-set-manager.d.ts +11 -0
  37. package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
  38. package/dist/src/mcpl/feature-set-manager.js +31 -7
  39. package/dist/src/mcpl/feature-set-manager.js.map +1 -1
  40. package/dist/src/mcpl/index.d.ts +4 -0
  41. package/dist/src/mcpl/index.d.ts.map +1 -1
  42. package/dist/src/mcpl/index.js +1 -0
  43. package/dist/src/mcpl/index.js.map +1 -1
  44. package/dist/src/mcpl/prose-stream-router.d.ts +27 -6
  45. package/dist/src/mcpl/prose-stream-router.d.ts.map +1 -1
  46. package/dist/src/mcpl/prose-stream-router.js +85 -22
  47. package/dist/src/mcpl/prose-stream-router.js.map +1 -1
  48. package/dist/src/mcpl/push-coalescer.d.ts +32 -4
  49. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  50. package/dist/src/mcpl/push-coalescer.js +46 -13
  51. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  52. package/dist/src/mcpl/push-handler.d.ts +5 -3
  53. package/dist/src/mcpl/push-handler.d.ts.map +1 -1
  54. package/dist/src/mcpl/push-handler.js +41 -11
  55. package/dist/src/mcpl/push-handler.js.map +1 -1
  56. package/dist/src/mcpl/reference-fetcher.d.ts +2 -1
  57. package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
  58. package/dist/src/mcpl/reference-fetcher.js +20 -9
  59. package/dist/src/mcpl/reference-fetcher.js.map +1 -1
  60. package/dist/src/mcpl/references.d.ts +29 -6
  61. package/dist/src/mcpl/references.d.ts.map +1 -1
  62. package/dist/src/mcpl/references.js +57 -16
  63. package/dist/src/mcpl/references.js.map +1 -1
  64. package/dist/src/mcpl/server-connection.d.ts +32 -1
  65. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  66. package/dist/src/mcpl/server-connection.js +76 -11
  67. package/dist/src/mcpl/server-connection.js.map +1 -1
  68. package/dist/src/mcpl/server-registry.d.ts +5 -2
  69. package/dist/src/mcpl/server-registry.d.ts.map +1 -1
  70. package/dist/src/mcpl/server-registry.js +25 -7
  71. package/dist/src/mcpl/server-registry.js.map +1 -1
  72. package/dist/src/mcpl/tool-lifecycle.d.ts +52 -2
  73. package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
  74. package/dist/src/mcpl/tool-lifecycle.js +47 -1
  75. package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
  76. package/dist/src/mcpl/tool-pattern-check.d.ts +51 -0
  77. package/dist/src/mcpl/tool-pattern-check.d.ts.map +1 -0
  78. package/dist/src/mcpl/tool-pattern-check.js +79 -0
  79. package/dist/src/mcpl/tool-pattern-check.js.map +1 -0
  80. package/dist/src/mcpl/types.d.ts +15 -5
  81. package/dist/src/mcpl/types.d.ts.map +1 -1
  82. package/dist/src/mcpl/types.js.map +1 -1
  83. package/dist/src/mcpl/visible-content.d.ts +39 -0
  84. package/dist/src/mcpl/visible-content.d.ts.map +1 -0
  85. package/dist/src/mcpl/visible-content.js +54 -0
  86. package/dist/src/mcpl/visible-content.js.map +1 -0
  87. package/dist/src/module-registry.d.ts +90 -6
  88. package/dist/src/module-registry.d.ts.map +1 -1
  89. package/dist/src/module-registry.js +260 -18
  90. package/dist/src/module-registry.js.map +1 -1
  91. package/dist/src/modules/workspace/branch-intent.d.ts +72 -0
  92. package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -0
  93. package/dist/src/modules/workspace/branch-intent.js +83 -0
  94. package/dist/src/modules/workspace/branch-intent.js.map +1 -0
  95. package/dist/src/modules/workspace/disk-agreement.d.ts +167 -0
  96. package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -0
  97. package/dist/src/modules/workspace/disk-agreement.js +259 -0
  98. package/dist/src/modules/workspace/disk-agreement.js.map +1 -0
  99. package/dist/src/modules/workspace/effects.d.ts +84 -0
  100. package/dist/src/modules/workspace/effects.d.ts.map +1 -0
  101. package/dist/src/modules/workspace/effects.js +368 -0
  102. package/dist/src/modules/workspace/effects.js.map +1 -0
  103. package/dist/src/modules/workspace/index.d.ts +155 -17
  104. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  105. package/dist/src/modules/workspace/index.js +1101 -424
  106. package/dist/src/modules/workspace/index.js.map +1 -1
  107. package/dist/src/modules/workspace/observe.d.ts +288 -0
  108. package/dist/src/modules/workspace/observe.d.ts.map +1 -0
  109. package/dist/src/modules/workspace/observe.js +825 -0
  110. package/dist/src/modules/workspace/observe.js.map +1 -0
  111. package/dist/src/modules/workspace/reconcile.d.ts +238 -0
  112. package/dist/src/modules/workspace/reconcile.d.ts.map +1 -0
  113. package/dist/src/modules/workspace/reconcile.js +909 -0
  114. package/dist/src/modules/workspace/reconcile.js.map +1 -0
  115. package/dist/src/modules/workspace/sync.d.ts +6 -59
  116. package/dist/src/modules/workspace/sync.d.ts.map +1 -1
  117. package/dist/src/modules/workspace/sync.js +6 -257
  118. package/dist/src/modules/workspace/sync.js.map +1 -1
  119. package/dist/src/modules/workspace/types.d.ts +77 -10
  120. package/dist/src/modules/workspace/types.d.ts.map +1 -1
  121. package/dist/src/modules/workspace/types.js.map +1 -1
  122. package/dist/src/operator-log.d.ts +41 -0
  123. package/dist/src/operator-log.d.ts.map +1 -1
  124. package/dist/src/operator-log.js.map +1 -1
  125. package/dist/src/provider-waits.d.ts +216 -0
  126. package/dist/src/provider-waits.d.ts.map +1 -0
  127. package/dist/src/provider-waits.js +482 -0
  128. package/dist/src/provider-waits.js.map +1 -0
  129. package/dist/src/record-journal.d.ts +127 -0
  130. package/dist/src/record-journal.d.ts.map +1 -0
  131. package/dist/src/record-journal.js +202 -0
  132. package/dist/src/record-journal.js.map +1 -0
  133. package/dist/src/refusal-reactions.d.ts +14 -12
  134. package/dist/src/refusal-reactions.d.ts.map +1 -1
  135. package/dist/src/refusal-reactions.js +14 -12
  136. package/dist/src/refusal-reactions.js.map +1 -1
  137. package/dist/src/shutdown.d.ts +13 -0
  138. package/dist/src/shutdown.d.ts.map +1 -0
  139. package/dist/src/shutdown.js +46 -0
  140. package/dist/src/shutdown.js.map +1 -0
  141. package/dist/src/silent-heartbeat.d.ts +74 -0
  142. package/dist/src/silent-heartbeat.d.ts.map +1 -0
  143. package/dist/src/silent-heartbeat.js +77 -0
  144. package/dist/src/silent-heartbeat.js.map +1 -0
  145. package/dist/src/tool-presentation.d.ts +50 -0
  146. package/dist/src/tool-presentation.d.ts.map +1 -0
  147. package/dist/src/tool-presentation.js +235 -0
  148. package/dist/src/tool-presentation.js.map +1 -0
  149. package/dist/src/tool-result-guard.d.ts +142 -6
  150. package/dist/src/tool-result-guard.d.ts.map +1 -1
  151. package/dist/src/tool-result-guard.js +357 -36
  152. package/dist/src/tool-result-guard.js.map +1 -1
  153. package/dist/src/tool-result-history.d.ts +13 -0
  154. package/dist/src/tool-result-history.d.ts.map +1 -1
  155. package/dist/src/tool-result-history.js +21 -1
  156. package/dist/src/tool-result-history.js.map +1 -1
  157. package/dist/src/types/agent.d.ts +18 -2
  158. package/dist/src/types/agent.d.ts.map +1 -1
  159. package/dist/src/types/events.d.ts +16 -0
  160. package/dist/src/types/events.d.ts.map +1 -1
  161. package/dist/src/types/framework.d.ts +12 -0
  162. package/dist/src/types/framework.d.ts.map +1 -1
  163. package/dist/src/types/module.d.ts +26 -4
  164. package/dist/src/types/module.d.ts.map +1 -1
  165. package/dist/src/types/trace.d.ts +87 -3
  166. package/dist/src/types/trace.d.ts.map +1 -1
  167. package/dist/test/batched-wake-locus.test.d.ts +2 -0
  168. package/dist/test/batched-wake-locus.test.d.ts.map +1 -0
  169. package/dist/test/batched-wake-locus.test.js +166 -0
  170. package/dist/test/batched-wake-locus.test.js.map +1 -0
  171. package/dist/test/code-execution.test.js +386 -2
  172. package/dist/test/code-execution.test.js.map +1 -1
  173. package/dist/test/component-defaults.test.d.ts +2 -0
  174. package/dist/test/component-defaults.test.d.ts.map +1 -0
  175. package/dist/test/component-defaults.test.js +54 -0
  176. package/dist/test/component-defaults.test.js.map +1 -0
  177. package/dist/test/conversation-routing.test.js +57 -1
  178. package/dist/test/conversation-routing.test.js.map +1 -1
  179. package/dist/test/discord-awareness-outbox.test.js +3 -0
  180. package/dist/test/discord-awareness-outbox.test.js.map +1 -1
  181. package/dist/test/ephemeral-settle.test.js +3 -0
  182. package/dist/test/ephemeral-settle.test.js.map +1 -1
  183. package/dist/test/event-gate.test.js +118 -0
  184. package/dist/test/event-gate.test.js.map +1 -1
  185. package/dist/test/explicit-prose-routing.test.js +975 -0
  186. package/dist/test/explicit-prose-routing.test.js.map +1 -1
  187. package/dist/test/framework.test.js +160 -1
  188. package/dist/test/framework.test.js.map +1 -1
  189. package/dist/test/helpers/coalescing-fixture.d.ts.map +1 -1
  190. package/dist/test/helpers/coalescing-fixture.js +3 -2
  191. package/dist/test/helpers/coalescing-fixture.js.map +1 -1
  192. package/dist/test/helpers/pytc-stop-rows.d.ts +11 -0
  193. package/dist/test/helpers/pytc-stop-rows.d.ts.map +1 -0
  194. package/dist/test/helpers/pytc-stop-rows.js +143 -0
  195. package/dist/test/helpers/pytc-stop-rows.js.map +1 -0
  196. package/dist/test/inference-exhaustion-rewind.test.js +142 -14
  197. package/dist/test/inference-exhaustion-rewind.test.js.map +1 -1
  198. package/dist/test/inference-failure-bounds.test.d.ts +2 -0
  199. package/dist/test/inference-failure-bounds.test.d.ts.map +1 -0
  200. package/dist/test/inference-failure-bounds.test.js +1201 -0
  201. package/dist/test/inference-failure-bounds.test.js.map +1 -0
  202. package/dist/test/late-events-after-stop.test.d.ts +2 -0
  203. package/dist/test/late-events-after-stop.test.d.ts.map +1 -0
  204. package/dist/test/late-events-after-stop.test.js +122 -0
  205. package/dist/test/late-events-after-stop.test.js.map +1 -0
  206. package/dist/test/mcpl-awareness-barrier.test.js +141 -0
  207. package/dist/test/mcpl-awareness-barrier.test.js.map +1 -1
  208. package/dist/test/mcpl-coalescing.test.js +97 -22
  209. package/dist/test/mcpl-coalescing.test.js.map +1 -1
  210. package/dist/test/mcpl-config-diagnostics.test.d.ts +2 -0
  211. package/dist/test/mcpl-config-diagnostics.test.d.ts.map +1 -0
  212. package/dist/test/mcpl-config-diagnostics.test.js +452 -0
  213. package/dist/test/mcpl-config-diagnostics.test.js.map +1 -0
  214. package/dist/test/mcpl-empty-content.test.d.ts +2 -0
  215. package/dist/test/mcpl-empty-content.test.d.ts.map +1 -0
  216. package/dist/test/mcpl-empty-content.test.js +368 -0
  217. package/dist/test/mcpl-empty-content.test.js.map +1 -0
  218. package/dist/test/mcpl-manifest-changed.test.js +2 -1
  219. package/dist/test/mcpl-manifest-changed.test.js.map +1 -1
  220. package/dist/test/mcpl-reference-fetcher.test.js +232 -4
  221. package/dist/test/mcpl-reference-fetcher.test.js.map +1 -1
  222. package/dist/test/mcpl-reference-fields.test.js +69 -2
  223. package/dist/test/mcpl-reference-fields.test.js.map +1 -1
  224. package/dist/test/mcpl-tool-lifecycle-emitter.test.js +106 -1
  225. package/dist/test/mcpl-tool-lifecycle-emitter.test.js.map +1 -1
  226. package/dist/test/mcpl-tool-lifecycle-script.test.d.ts +2 -0
  227. package/dist/test/mcpl-tool-lifecycle-script.test.d.ts.map +1 -0
  228. package/dist/test/mcpl-tool-lifecycle-script.test.js +288 -0
  229. package/dist/test/mcpl-tool-lifecycle-script.test.js.map +1 -0
  230. package/dist/test/mcpl-ws-transport.test.js +103 -0
  231. package/dist/test/mcpl-ws-transport.test.js.map +1 -1
  232. package/dist/test/ops-alert.test.js +2 -1
  233. package/dist/test/ops-alert.test.js.map +1 -1
  234. package/dist/test/placed-reaction-baseline.test.d.ts +2 -0
  235. package/dist/test/placed-reaction-baseline.test.d.ts.map +1 -0
  236. package/dist/test/placed-reaction-baseline.test.js +312 -0
  237. package/dist/test/placed-reaction-baseline.test.js.map +1 -0
  238. package/dist/test/prose-stream-router.test.js +41 -0
  239. package/dist/test/prose-stream-router.test.js.map +1 -1
  240. package/dist/test/provider-acceleration-cooldown.test.js +5 -1
  241. package/dist/test/provider-acceleration-cooldown.test.js.map +1 -1
  242. package/dist/test/provider-waits.test.d.ts +2 -0
  243. package/dist/test/provider-waits.test.d.ts.map +1 -0
  244. package/dist/test/provider-waits.test.js +2196 -0
  245. package/dist/test/provider-waits.test.js.map +1 -0
  246. package/dist/test/reaction-baseline-platform.test.d.ts +2 -0
  247. package/dist/test/reaction-baseline-platform.test.d.ts.map +1 -0
  248. package/dist/test/reaction-baseline-platform.test.js +124 -0
  249. package/dist/test/reaction-baseline-platform.test.js.map +1 -0
  250. package/dist/test/record-journal.test.d.ts +6 -0
  251. package/dist/test/record-journal.test.d.ts.map +1 -0
  252. package/dist/test/record-journal.test.js +269 -0
  253. package/dist/test/record-journal.test.js.map +1 -0
  254. package/dist/test/refusal-reaction-baseline.test.js +10 -3
  255. package/dist/test/refusal-reaction-baseline.test.js.map +1 -1
  256. package/dist/test/save-recent-image.test.js +240 -2
  257. package/dist/test/save-recent-image.test.js.map +1 -1
  258. package/dist/test/shutdown-errors.test.d.ts +2 -0
  259. package/dist/test/shutdown-errors.test.d.ts.map +1 -0
  260. package/dist/test/shutdown-errors.test.js +662 -0
  261. package/dist/test/shutdown-errors.test.js.map +1 -0
  262. package/dist/test/silent-heartbeat-rows.test.d.ts +2 -0
  263. package/dist/test/silent-heartbeat-rows.test.d.ts.map +1 -0
  264. package/dist/test/silent-heartbeat-rows.test.js +451 -0
  265. package/dist/test/silent-heartbeat-rows.test.js.map +1 -0
  266. package/dist/test/silent-heartbeat.test.js +49 -38
  267. package/dist/test/silent-heartbeat.test.js.map +1 -1
  268. package/dist/test/stop-with-work-in-flight.test.d.ts +23 -0
  269. package/dist/test/stop-with-work-in-flight.test.d.ts.map +1 -0
  270. package/dist/test/stop-with-work-in-flight.test.js +672 -0
  271. package/dist/test/stop-with-work-in-flight.test.js.map +1 -0
  272. package/dist/test/surgery-marks-receipt.test.d.ts +2 -0
  273. package/dist/test/surgery-marks-receipt.test.d.ts.map +1 -0
  274. package/dist/test/surgery-marks-receipt.test.js +540 -0
  275. package/dist/test/surgery-marks-receipt.test.js.map +1 -0
  276. package/dist/test/tool-batch-hook.test.d.ts +8 -0
  277. package/dist/test/tool-batch-hook.test.d.ts.map +1 -0
  278. package/dist/test/tool-batch-hook.test.js +275 -0
  279. package/dist/test/tool-batch-hook.test.js.map +1 -0
  280. package/dist/test/tool-presentation.test.d.ts +2 -0
  281. package/dist/test/tool-presentation.test.d.ts.map +1 -0
  282. package/dist/test/tool-presentation.test.js +268 -0
  283. package/dist/test/tool-presentation.test.js.map +1 -0
  284. package/dist/test/tool-result-guard.test.js +2545 -19
  285. package/dist/test/tool-result-guard.test.js.map +1 -1
  286. package/dist/test/tool-result-history.test.js +2 -1
  287. package/dist/test/tool-result-history.test.js.map +1 -1
  288. package/dist/test/turn-trigger-provenance.test.js +35 -0
  289. package/dist/test/turn-trigger-provenance.test.js.map +1 -1
  290. package/dist/test/unconvertible-tool-result.test.d.ts +2 -0
  291. package/dist/test/unconvertible-tool-result.test.d.ts.map +1 -0
  292. package/dist/test/unconvertible-tool-result.test.js +358 -0
  293. package/dist/test/unconvertible-tool-result.test.js.map +1 -0
  294. package/dist/test/workspace-materialize-freshness.test.d.ts +16 -0
  295. package/dist/test/workspace-materialize-freshness.test.d.ts.map +1 -0
  296. package/dist/test/workspace-materialize-freshness.test.js +252 -0
  297. package/dist/test/workspace-materialize-freshness.test.js.map +1 -0
  298. package/dist/test/workspace-three-way.test.d.ts +12 -0
  299. package/dist/test/workspace-three-way.test.d.ts.map +1 -0
  300. package/dist/test/workspace-three-way.test.js +3194 -0
  301. package/dist/test/workspace-three-way.test.js.map +1 -0
  302. package/dist/tsconfig.tsbuildinfo +1 -1
  303. package/package.json +2 -2
  304. package/src/agent.ts +124 -45
  305. package/src/api/server.ts +43 -4
  306. package/src/code-execution/py-runner.ts +66 -9
  307. package/src/code-execution/runtime-py.ts +215 -38
  308. package/src/framework.ts +3191 -544
  309. package/src/gate/event-gate.ts +59 -7
  310. package/src/index.ts +18 -2
  311. package/src/mcpl/channel-registry.ts +24 -3
  312. package/src/mcpl/conversation-router.ts +34 -1
  313. package/src/mcpl/feature-set-manager.ts +36 -11
  314. package/src/mcpl/index.ts +4 -0
  315. package/src/mcpl/prose-stream-router.ts +79 -23
  316. package/src/mcpl/push-coalescer.ts +62 -13
  317. package/src/mcpl/push-handler.ts +41 -12
  318. package/src/mcpl/reference-fetcher.ts +18 -8
  319. package/src/mcpl/references.ts +57 -13
  320. package/src/mcpl/server-connection.ts +95 -13
  321. package/src/mcpl/server-registry.ts +24 -7
  322. package/src/mcpl/tool-lifecycle.ts +77 -2
  323. package/src/mcpl/tool-pattern-check.ts +106 -0
  324. package/src/mcpl/types.ts +15 -5
  325. package/src/mcpl/visible-content.ts +57 -0
  326. package/src/module-registry.ts +269 -25
  327. package/src/modules/workspace/branch-intent.ts +123 -0
  328. package/src/modules/workspace/disk-agreement.ts +325 -0
  329. package/src/modules/workspace/effects.ts +362 -0
  330. package/src/modules/workspace/index.ts +1098 -446
  331. package/src/modules/workspace/observe.ts +865 -0
  332. package/src/modules/workspace/reconcile.ts +1157 -0
  333. package/src/modules/workspace/sync.ts +6 -336
  334. package/src/modules/workspace/types.ts +75 -10
  335. package/src/operator-log.ts +30 -0
  336. package/src/provider-waits.ts +523 -0
  337. package/src/record-journal.ts +246 -0
  338. package/src/refusal-reactions.ts +14 -12
  339. package/src/shutdown.ts +49 -0
  340. package/src/silent-heartbeat.ts +141 -0
  341. package/src/tool-presentation.ts +188 -0
  342. package/src/tool-result-guard.ts +384 -34
  343. package/src/tool-result-history.ts +25 -1
  344. package/src/types/agent.ts +18 -2
  345. package/src/types/events.ts +16 -0
  346. package/src/types/framework.ts +12 -0
  347. package/src/types/module.ts +27 -4
  348. package/src/types/trace.ts +94 -3
@@ -1,14 +1,15 @@
1
+ import { type PresentationSnapshot } from "./tool-presentation.js";
1
2
  import { JsStore } from '@animalabs/chronicle';
2
3
  import type { Membrane, NormalizedRequest } from '@animalabs/membrane';
3
4
  import { ContextManager } from '@animalabs/context-manager';
4
5
  import type { TokenBudget } from '@animalabs/context-manager';
5
- import type { FrameworkConfig, TraceEventListener, InferenceLogQuery, InferenceLogQueryResult, InferenceLogEntryWithId, ProcessLogQuery, ProcessLogQueryResult, ProcessLogEntryWithId, ProcessEvent, ToolCall, ToolResult, AgentConfig, InferenceRequest, Module, ContextMaintenanceSnapshot, AgentRuntimeSettingsPatch, AgentRuntimeSettingsSnapshot } from './types/index.js';
6
+ import type { FrameworkConfig, TraceEventListener, InferenceLogQuery, InferenceLogQueryResult, InferenceLogEntryWithId, ProcessLogQuery, ProcessLogQueryResult, ProcessLogEntryWithId, ProcessEvent, ToolCall, ToolResult, AgentConfig, InferenceRequest, Module, ContextMaintenanceSnapshot, AgentRuntimeSettingsPatch, AgentRuntimeSettingsSnapshot, SameRoundThinkTextPolicy } from './types/index.js';
6
7
  import { Agent } from './agent.js';
7
8
  import { type ToolClass, type ToolClassSource } from './mcpl/tool-classes.js';
8
9
  import { ChannelRegistry } from './mcpl/channel-registry.js';
9
10
  import { ConversationRouter } from './mcpl/conversation-router.js';
10
11
  import type { SessionUsageSnapshot } from './usage/types.js';
11
- import { type OperatorLogEntry, type OperatorLogInput, type OperatorRequester } from './operator-log.js';
12
+ import { type SurgeryMarkerReceipt, type OperatorLogEntry, type OperatorLogInput, type OperatorRequester } from './operator-log.js';
12
13
  /**
13
14
  * Feasibility verdict for a runtime-settings patch, derived through the SAME
14
15
  * settings→config mapping the live apply path uses (`Agent.planRuntimeSettings`
@@ -103,9 +104,64 @@ export declare class ResumeBlockedError extends Error {
103
104
  preview: RuntimeSettingsPreview;
104
105
  }>);
105
106
  }
107
+ interface InferenceToolSnapshot {
108
+ sameRoundThinkTextPolicy: SameRoundThinkTextPolicy;
109
+ }
110
+ /**
111
+ * Whether the poison-history breaker may shed the newest exchange for a
112
+ * failure: an `invalid_request` at HTTP 400, 413 or 422 or with no status, or
113
+ * a `context_length` at 413. The status is a heuristic for when a shed may
114
+ * help, not proof that the history is at fault.
115
+ *
116
+ * 400 and 422 are how a provider answers a request that fails its
117
+ * validation, as a history it can't accept does, but other refusals come
118
+ * back the same way, such as Anthropic's 400 for a credit balance that's too
119
+ * low. A 413 is the request's size. When the newest exchange made it too
120
+ * large, as an oversized attachment does, shedding that exchange may bring
121
+ * the request back under the limit, and nothing else in the framework
122
+ * recovers a 413; when the history as a whole is too large, the shed doesn't
123
+ * help, and the breaker stops at its rewind cap. The 413 arm takes both
124
+ * labels a 413 arrives under, invalid_request and context_length, because
125
+ * membrane's label for a 413 differs by version and adapter. Other statuses
126
+ * keep the history, since shed history can't be got back and the status
127
+ * gives no sign that a shed would help: a 404 is a model or an endpoint that
128
+ * doesn't exist, and 405, 409, 410 and 415 are about the HTTP request or the
129
+ * resource, as a rule, rather than the conversation.
130
+ *
131
+ * The table test in test/inference-exhaustion-rewind.test.ts is this
132
+ * predicate's contract. The notes below on which membrane version gives which
133
+ * label are its history, and will go stale as hosts move to newer releases.
134
+ *
135
+ * Which failures reach the gate with which label depends on the membrane:
136
+ * - As membrane 0.5.86 classifies them: Anthropic files a 400 as
137
+ * invalid_request (after its context check) and its other 4xx as unknown.
138
+ * The chat adapters never file one as invalid_request, since they classify
139
+ * by the error's message text, and a context_length they file that way
140
+ * carries status 400 whatever the response's was. The raw-fetch Responses
141
+ * adapter files every status it doesn't list (404, 405, 409, 410, 413,
142
+ * 415, 422 …) as invalid_request, so it alone produces an invalid_request
143
+ * at 413 or 422, and no 0.5.86 adapter produces a context_length at 413.
144
+ * - From membrane #56 (merged, not yet in a release), one table serves every
145
+ * adapter. Auth codes and context overflow are checked on a 400 or 422
146
+ * first, a 404 is invalid_request, a 413 is context_length, and other 4xx
147
+ * are invalid_request. So a 413 still sheds, an Anthropic one included,
148
+ * while a context_length at 400 or 422, a token overflow, keeps the
149
+ * history. The 422 arm then also covers an OpenAI-compatible server, such
150
+ * as a FastAPI one, that answers a validation failure with 422.
151
+ *
152
+ * An error with no status, from a membrane that reports none, keeps the rule
153
+ * the breaker had before: the type alone.
154
+ */
155
+ export declare function shedMayHelp(errorType: string | undefined, httpStatus: number | undefined): boolean;
106
156
  export declare class AgentFramework {
157
+ private toolPresentations;
158
+ private presentationPreviews;
159
+ getRequestToolPresentation(request: object): PresentationSnapshot | null;
107
160
  private store;
108
161
  private ownsStore;
162
+ private stopPromise;
163
+ private stopCompleted;
164
+ private ownedStoreClosed;
109
165
  private membrane;
110
166
  private queue;
111
167
  private agents;
@@ -152,7 +208,13 @@ export declare class AgentFramework {
152
208
  private providerAccelerationDefaultCooldownMs;
153
209
  private providerAccelerationJitterMs;
154
210
  private providerHoldHook;
211
+ /** Provider waits (stated retry-after) per (agent, model), kept across restarts. */
212
+ private providerWaits;
213
+ /** Wakers for error-policy retry waits in progress: stop() ends them. */
214
+ private retryWaitWakers;
155
215
  private providerAdmissionClosed;
216
+ /** Invalidates framework turns still assembling when stop begins. */
217
+ private lifecycleGeneration;
156
218
  /** Last time we reported stale (busy-requeued) inference requests, per agent. */
157
219
  private staleWarnAt;
158
220
  /** Per-agent last inference activity (epoch ms), for /healthz + doctor tooling. */
@@ -186,26 +248,6 @@ export declare class AgentFramework {
186
248
  * keeps unrelated channels from moving the pin. Cleared at every fresh
187
249
  * turn's start; budget restarts keep it. */
188
250
  private turnEngagedChannels;
189
- /** Channels this turn's PLAIN PROSE was actually delivered to, in delivery
190
- * order (deduped at render). Feeds the `[delivered]` receipt appended at
191
- * logical turn end: explicit sends receipt themselves via their
192
- * tool_result, but auto-routed prose previously vanished into the router
193
- * with no in-window record — the agent could never see where its own
194
- * words landed (2026-07-31 misroute series; antra: minimal receipts).
195
- * Cleared at every fresh turn's start; budget restarts keep it (same
196
- * logical turn, receipt covers the whole turn). */
197
- private turnProseDeliveries;
198
- /** Count of plain-prose segments SUPPRESSED this turn by sticky
199
- * explicit-send silencing. The suppression rule itself is untouched
200
- * (antra, 2026-07-31: visibility is enough) — but it must never be a
201
- * silent black hole: Mythos multiplexed two threads in one round (prose
202
- * for the lane + explicit send for another channel, textbook per the
203
- * routing doc), the silencing ate the prose reply, and his own record
204
- * ("scene delivered to #mythos via plain speech — routing confirmed")
205
- * believed it delivered. The receipt now reports suppression, so the
206
- * author sees the segment's fate one turn later. Cleared each fresh
207
- * turn; budget restarts keep it. */
208
- private turnProseSuppressed;
209
251
  /** A tool boundary injected fresh CONVERSATIONAL input (a real message —
210
252
  * not a reaction or a system marker) into the live stream. Tells
211
253
  * driveStream to clear sticky explicit-send suppression before handling
@@ -218,14 +260,43 @@ export declare class AgentFramework {
218
260
  private lastAnnouncedLocus;
219
261
  /** Latest bounced (undelivered) prose per agent — the `{{unsent}}` source. */
220
262
  private proseClipboards;
221
- /** Sticky per-TURN delivery target set by the turn's first `>>` prefix.
222
- * Cleared at every non-restart turn start; survives context restarts. */
223
- private proseTargetPins;
224
- /** Hybrid router is fail-closed after a malformed/unresolved envelope until a new valid target. */
225
- private proseHybridSuppressed;
226
- /** Agents whose current turn requested `!` continuation — re-woken when the
227
- * turn completes instead of pausing until the next external event. */
228
- private proseContinuations;
263
+ /**
264
+ * Each agent's routing state for its current turn (TurnRouting): the
265
+ * sticky destination, the turn's destination for a resumed stream,
266
+ * hybrid's hold, a `!` continuation and receipt tallies. A fresh turn starts a new object
267
+ * instead of clearing the old one, and a stream that resumes the turn
268
+ * (resumesLogicalTurn) keeps it. A queued delivery holds the object of the
269
+ * turn that queued it, so prose a turn leaves queued when it ends (a
270
+ * skip_reply ends it before its posts have run) still follows that turn's
271
+ * destination, and its late writes can't reach the next turn.
272
+ */
273
+ private turnRouting;
274
+ /**
275
+ * The latest link of each agent's chain of queued prose deliveries. Every
276
+ * stream queues its own behind it, a fresh turn's included, so the agent's
277
+ * posts go out in the order they were written, across streams and turns.
278
+ */
279
+ private proseSpeechChains;
280
+ /**
281
+ * Each agent's open logical turn (LogicalTurn). It stays open from the
282
+ * fresh start that opens it until the turn settles (settleAgent: it
283
+ * completes, a tool ends it, or it fails or is abandoned), and every fresh
284
+ * start that routes prose while it is open continues it: a framework
285
+ * retry, the start that consumes tool results the non-streaming fallback
286
+ * left (whichever wake the scheduler starts it with), the later compile a
287
+ * provider-capacity hold defers a turn to. A silent start neither
288
+ * continues nor opens one. A stream that ends without settling needs to do
289
+ * nothing to carry its turn. Settling only detaches the turn from future
290
+ * starts: the settling stream keeps its own object, which its remaining
291
+ * deliveries, its receipt and its ` !` check go on using (a completion
292
+ * settles before it awaits its chain and writes its receipt). So every
293
+ * logical end must close inheritance once, before the next fresh start:
294
+ * a turn left open would hand its object, late writes and all, to an
295
+ * unrelated turn. A tool-ended turn settles before the next turn can
296
+ * start. Only the stream that holds the open turn closes it; disposal
297
+ * drops it, and stop() clears every agent's.
298
+ */
299
+ private openLogical;
229
300
  /** Consecutive bounce-wakes per agent; capped so an agent that keeps
230
301
  * emitting unprefixed prose can't wake-loop (notices still append). */
231
302
  private proseBounceStreaks;
@@ -405,10 +476,16 @@ export declare class AgentFramework {
405
476
  private codeExecutionConfig;
406
477
  private codeExecutionRunners;
407
478
  private scriptToolWaiters;
408
- /** Agents whose running script hit an endTurn-carrying inner result —
409
- * deferred and applied to the final code_execution result instead of
410
- * cancelling the stream mid-script (which would wedge the turn). */
479
+ /** Per agent, the foreground script now running. An endTurn-carrying inner
480
+ * result marks the script that made the call, and is applied to that
481
+ * script's code_execution result instead of cancelling the stream
482
+ * mid-script (which would wedge the turn). A stopped script's late result
483
+ * marks only that script, never the agent's next one. */
411
484
  private scriptDeferredEndTurn;
485
+ /** RFC-007: per agent, the origin of the foreground script its runner is
486
+ * executing, handed to that script's inner calls (scripts run one at a
487
+ * time per runner). Background runners capture theirs in the closure. */
488
+ private foregroundScriptOrigins;
412
489
  /** Background (daemon) scripts: model-authored watchers that outlive their
413
490
  * spawning turn. Each gets a DEDICATED PyRunner; wake_agent() injects a
414
491
  * provenance envelope + payload and requests inference. Keyed by script id. */
@@ -439,6 +516,16 @@ export declare class AgentFramework {
439
516
  /** Namespaced tool name → the server whose tools/list produced it. Prefixes
440
517
  * can nest (`foo`, `foo--bar`), so a prefix match alone can name two. */
441
518
  private mcplToolServers;
519
+ /** Servers whose tools/list answered in the latest refresh. */
520
+ private mcplListedServers;
521
+ /** Zero-match tool-pattern diagnostics (checkToolPatterns): set at the end
522
+ * of create(), when the tool universe is first complete. */
523
+ private toolPatternChecksArmed;
524
+ /** Patterns already reported as matching nothing — each is reported once. */
525
+ private toolPatternsReported;
526
+ /** Every (prefix → serverId) ever configured. A removed or restarting
527
+ * server's patterns stay undecided rather than reported mid-restart. */
528
+ private toolPatternKnownPrefixes;
442
529
  /** Maps serverId → McplServerConfig for prefix lookup. */
443
530
  private mcplServerConfigs;
444
531
  /** Host capabilities advertised during the MCP handshake — stored so servers
@@ -483,9 +570,15 @@ export declare class AgentFramework {
483
570
  */
484
571
  start(): void;
485
572
  /**
486
- * Stop the event loop.
573
+ * Stop the event loop. Failed module/MCPL cleanup can be retried with its
574
+ * original context; storage stays open until that cleanup succeeds.
575
+ * @param teardownTimeoutMs Optional module/MCPL wait budget. Omit to wait
576
+ * until cleanup settles, as required by existing module/child contracts. This
577
+ * does not bound earlier stream or event-loop quiescence, or cancel cleanup.
487
578
  */
488
- stop(): Promise<void>;
579
+ stop(teardownTimeoutMs?: number | undefined): Promise<void>;
580
+ private resetCompletedStop;
581
+ private stopOwned;
489
582
  /**
490
583
  * Advance queued ContextManager work without requiring a new message.
491
584
  *
@@ -496,12 +589,34 @@ export declare class AgentFramework {
496
589
  */
497
590
  private providerGate;
498
591
  private providerGateBlocked;
592
+ /** Acceleration and host holds park the whole agent; a provider wait holds
593
+ * only its own model, which auxiliary admission checks per call. */
594
+ private cooldownBlocksAuxiliary;
499
595
  private acquirePrimaryProviderGate;
500
596
  private releasePrimaryProviderGate;
501
597
  private flushAuxiliaryAdmission;
502
598
  private waitForAuxiliaryIdle;
503
599
  private withAuxiliaryAdmission;
504
600
  private auxiliaryMembraneFor;
601
+ /**
602
+ * A conversation agent's auxiliary calls (its context manager's
603
+ * compression). A conversation agent takes no provider gate: admission
604
+ * belongs to the persistent resident, and a generation-unique fork must not
605
+ * leave a gate behind. But its stated waits are recorded for (agent, model)
606
+ * as a resident's are, so they bind its auxiliary calls too: a held model
607
+ * is refused without a call, and an auxiliary call's own stated wait is
608
+ * recorded for it. (An ephemeral run records nothing, its name being
609
+ * single-use, so its context manager keeps the plain membrane.)
610
+ */
611
+ private conversationAuxiliaryMembraneFor;
612
+ /** The framework's membrane, with each complete() call passed through
613
+ * `admit` along with the model it names. */
614
+ private membraneAdmitting;
615
+ /** An acceleration hold's length: AF's own pacing (`ownMs`: its default
616
+ * plus jitter, capped), or the provider's stated wait in its place
617
+ * (`stated`). The stated wait is a lower bound: jitter only adds to it,
618
+ * and the cap applies only to AF's own default. A negative stated wait is
619
+ * a stated 0, as in ProviderWaits: the 1 s floor, plus jitter. */
505
620
  private accelerationCooldownMs;
506
621
  private sameInferenceRequest;
507
622
  private consultProviderHold;
@@ -509,16 +624,135 @@ export declare class AgentFramework {
509
624
  * inference on it. True = extended in place (held requests stay held). */
510
625
  private extendHostProviderHold;
511
626
  private holdProviderAcceleration;
627
+ /**
628
+ * A provider's stated wait on a turn that doesn't own provider admission:
629
+ * a conversation agent's or an ephemeral run's. Left to the error policy,
630
+ * which returns a stated wait as it is, a 429 stating two hours would hold
631
+ * the turn asleep two hours, up to three times, with nothing recorded and
632
+ * nothing raised (membrane #56 review, M3). So:
633
+ * - A conversation agent's turns come through the scheduler as a resident's
634
+ * do, so it treats the wait as a resident does: recorded for (agent,
635
+ * model), alerted past PROVIDER_WAIT_ALERT_MS, and the turn held until the
636
+ * wait passes or an operator releases it ('held'). A non-retryable failure
637
+ * records the wait for the calls after it and keeps its own disposition.
638
+ * - An ephemeral run's name is single-use, so a wait recorded for it would
639
+ * bind nothing, and its caller is waiting on it. A retryable stated wait
640
+ * up to PROVIDER_ACCELERATION_MAX_COOLDOWN_MS is left to the error policy,
641
+ * slept and retried. A longer one, or one that can't be represented, ends
642
+ * the run now ('fail'): it is never retried before the provider's time,
643
+ * and the caller hears why at once.
644
+ * Anything else is the error policy's.
645
+ */
646
+ private nonOwningProviderWait;
647
+ /** Why an ephemeral run ended instead of sleeping a provider's stated wait,
648
+ * for its caller. */
649
+ private statedWaitNotSlept;
650
+ /** When a hold's timer next fires: at its deadline, stepped past what one
651
+ * timer can hold. A hold with no deadline (a wait held until released, or
652
+ * the stand-in for unreadable records) asks again as often as unreadable
653
+ * records are read again: records that read again end it, and nothing
654
+ * announces that. */
655
+ private providerHoldTimerMs;
512
656
  private releaseProviderAccelerationCooldown;
657
+ /**
658
+ * Wait an error policy's retry delay, all of it: the delay can be a
659
+ * provider's retry-after, and a single timer past 2^31-1 ms fires almost at
660
+ * once. Steps through longer waits; stop() wakes it so a shutting-down
661
+ * framework is never left with a wait parked for days.
662
+ */
663
+ private waitForRetry;
664
+ /**
665
+ * Record a provider's stated wait (a classified error carrying
666
+ * `retryAfterMs`) for (agent, model). Returns the wait that binds now,
667
+ * which is the longer of this one and any outstanding one. A wait that
668
+ * newly binds past PROVIDER_WAIT_ALERT_MS, or until released, raises an
669
+ * ops alert.
670
+ */
671
+ private recordProviderWait;
672
+ /**
673
+ * Hold this agent's primary turns for a provider wait on its model. The
674
+ * requests are kept and released together, into one fresh compile, when
675
+ * the wait ends: the same path an acceleration cooldown takes, without
676
+ * parking auxiliary calls to other models.
677
+ */
678
+ private holdForProviderWait;
679
+ /**
680
+ * Refuse an auxiliary call to a model the provider asked this agent to wait
681
+ * on, without calling it. The refusal is a retryable rate limit carrying
682
+ * the remaining wait, so a caller that paces (context-manager's compression
683
+ * lane, from its corrective round #138 on) waits it out instead of spending
684
+ * a call. It is marked
685
+ * `providerAdmission: 'deferred'`: no call was made, so a caller can keep
686
+ * the wait without counting a failed call (room-225 #47927).
687
+ */
688
+ private refuseHeldProviderModel;
689
+ /**
690
+ * Release provider waits: one model's for an agent, or every model's. The
691
+ * explicit operator override for a wait that should not be honoured (the
692
+ * passing of time needs no call). Recorded, so a restart does not bring the
693
+ * wait back; held primary turns are released into one fresh compile. An
694
+ * acceleration hold the released wait lengthened keeps only AF's own pacing
695
+ * for its failure; a host hold stays the host's.
696
+ */
697
+ releaseProviderWait(agentName: string, model?: string, by?: string): Array<{
698
+ model: string;
699
+ until: string | null;
700
+ release: 'recorded' | 'pending' | 'in-process override';
701
+ }>;
702
+ /** Provider waits binding now, for health and doctor tooling. */
703
+ providerWaitSnapshot(agentName?: string): Array<{
704
+ agent: string;
705
+ model: string;
706
+ until: string | null;
707
+ reason: string;
708
+ setAt: string;
709
+ }>;
513
710
  private recordProviderAccelerationRecovery;
514
711
  private cancelProviderAdmission;
515
712
  private startQueuedMaintenance;
516
713
  private runQueuedMaintenance;
517
714
  private contextProgress;
715
+ /**
716
+ * A server's request or notification the host couldn't handle, answered
717
+ * with a JSON-RPC error when it is a request (a notification has no one to
718
+ * answer, and is logged), rather than thrown out of the connection's
719
+ * listener, where it was an unhandled rejection and the server's request
720
+ * waited for its timeout.
721
+ * - `refused`: the listener turned it away before its handler ran; the
722
+ * host is stopping, and none of it was taken. Answered -32000, "the host
723
+ * is stopping", the code the push coalescer already gives a stopping
724
+ * host: the server can send it again to the host's next run.
725
+ * - `failed`: the handler threw, whatever it threw, `undefined` included.
726
+ * While the host stops (its queue closed), that's answered -32000 too,
727
+ * with the handler's own message after the stop wording; on a live host
728
+ * it's a fault, answered -32603 with the handler's message. The handler
729
+ * may have admitted part of the request first (an earlier message of a
730
+ * batch), so nothing here claims that none of it was taken.
731
+ * A request the handler already answered before it threw isn't answered
732
+ * again: the failure is logged.
733
+ */
734
+ private refuseServerItem;
518
735
  /**
519
736
  * Push a process event to the queue.
737
+ *
738
+ * After stop() the queue is closed and this throws, so a direct caller
739
+ * learns the framework is stopped — except for a tool's result. A call
740
+ * still running at stop() completes later, into a callback with nothing
741
+ * to catch the throw (an unhandled rejection), and nothing could take its
742
+ * result anyway: the queue that would carry it to its stream is closed,
743
+ * stop() is ending the streams, and the tool has already run. That
744
+ * result is dropped, and the drop is logged.
520
745
  */
521
746
  pushEvent(event: ProcessEvent): void;
747
+ /**
748
+ * A module's event. stop() closes the queue before it stops modules, so a
749
+ * module's event can arrive after that: from a listener that fires while
750
+ * stop() runs, or from the module's own stop(). Nothing will process it,
751
+ * and a throw there can go unhandled or fail stop(), so it's dropped with a
752
+ * log line naming the module. Otherwise it's queued as pushEvent() queues
753
+ * it, or, through the deprecated queue handle, without the trace.
754
+ */
755
+ private pushModuleEvent;
522
756
  /**
523
757
  * Add a trace event listener for observability.
524
758
  */
@@ -531,9 +765,11 @@ export declare class AgentFramework {
531
765
  */
532
766
  get channels(): ChannelRegistry | null;
533
767
  /**
534
- * Remove a trace event listener.
768
+ * Remove a trace event listener: its first subscription, if it holds more
769
+ * than one.
535
770
  */
536
771
  offTrace(listener: TraceEventListener): void;
772
+ private removeTraceRegistration;
537
773
  /**
538
774
  * Add a module at runtime.
539
775
  */
@@ -592,11 +828,51 @@ export declare class AgentFramework {
592
828
  private spillSettingsExtension;
593
829
  private captureInferenceToolSnapshot;
594
830
  private toolResultGuardSettingsExtension;
595
- private restoreToolResultGuardSetting;
831
+ /** Every guard's annotation still running, for stop() (agent-framework #277). */
832
+ private readonly guardAnnotations;
833
+ /** Each guard that isn't idle, by agent name, as the guard reports it. An
834
+ * ephemeral run or a closed fork leaves the agent map with an annotation
835
+ * maybe still running, or a stub edit, acceptance edit or audit write
836
+ * queued, which maintenance and stop then retry (agent-framework #277). A
837
+ * guard is here from the moment it has work left until the moment it has
838
+ * none, however that comes about. */
839
+ private readonly busyGuards;
840
+ /** Withheld originals' writes still under way past their deadline: while
841
+ * any is, the workspace isn't answering and no other withheld original's
842
+ * write is started. Several can be, when writes of different agents'
843
+ * batches stalled together. */
844
+ private readonly stalledSpills;
845
+ /** Withheld spills skipped since the current stall began. */
846
+ private stallSkips;
847
+ /** See WITHHELD_SPILL_DEADLINE_MS; an instance field so tests can shorten it. */
848
+ private withheldSpillDeadlineMs;
849
+ /** The lifecycle generation whose stop() has let the running annotations
850
+ * finish: a withheld original is then no longer written to a workspace
851
+ * that is stopping, and its stub names the audit record. A start() after
852
+ * that stop() has finished has a generation of its own, so the spill gate
853
+ * is open again for an instance kept with a store it doesn't own and that
854
+ * is still open (start() doesn't restore stopped modules or MCPL
855
+ * connections, and refuses an owned store that stop() closed). A start()
856
+ * made while a stop() is still draining isn't a supported order. */
857
+ private guardSpillsClosedFor;
858
+ /** A new agent's guard: its persisted setting, the tool-results spill its
859
+ * withheld originals are written to, and the set stop() waits on
860
+ * (agent-framework #277). */
861
+ private adoptToolResultGuard;
862
+ /** Each guard that may have queued storage work, once, by agent name: the
863
+ * live agents' and every other that isn't idle. */
864
+ private guardsWithStorageWork;
596
865
  private buildThinkTool;
597
866
  /** agent_settings tool definition with module extension fields merged in. */
598
867
  private buildAgentSettingsTool;
599
868
  private getToolsForAgent;
869
+ /** Available is independent of presentation visibility; execution callers keep this surface. */
870
+ private availableToolsForPresentation;
871
+ inspectToolPresentation(agentName: string, snapshot?: InferenceToolSnapshot): PresentationSnapshot | null;
872
+ private advertisedToolsForAgent;
873
+ /** Compression can revisit calls to hidden tools; never apply visibility here. */
874
+ private compressionToolsForAgent;
875
+ private editToolPresentation;
600
876
  /**
601
877
  * The tools one agent is shown at inference: its surface (the subconscious
602
878
  * has its own), less what its permissions deny, plus — for explicit-mode
@@ -903,9 +1179,11 @@ export declare class AgentFramework {
903
1179
  * events after an ephemeral/conversation agent has been disposed. */
904
1180
  private recordLogicalTurnToolCalls;
905
1181
  private recordEphemeralToolCalls;
906
- /** Settle an active ephemeral run (no-op for resident agents). The tool-call
907
- * count comes from the run's own counter — the single source of truth,
908
- * which unlike a per-stream local survives budget restarts. */
1182
+ /** A logical turn's end, for every agent: it closes the agent's open
1183
+ * logical turn when it is the settling stream's own (openLogical), and
1184
+ * settles an active ephemeral run. The run's tool-call count comes from
1185
+ * its own counter — the single source of truth, which unlike a
1186
+ * per-stream local survives budget restarts. */
909
1187
  private settleAgent;
910
1188
  /**
911
1189
  * Run an ephemeral agent to completion through the framework's event loop.
@@ -1056,6 +1334,10 @@ export declare class AgentFramework {
1056
1334
  *
1057
1335
  * host-status — report the quiesce state (drained / parked wakes /
1058
1336
  * running background scripts).
1337
+ *
1338
+ * release-provider-wait — end an agent's provider wait (a provider's
1339
+ * stated retry-after, kept across restarts) for one `model` or all, as an
1340
+ * explicit, recorded operator override.
1059
1341
  */
1060
1342
  private handleHostCommand;
1061
1343
  /**
@@ -1158,6 +1440,12 @@ export declare class AgentFramework {
1158
1440
  * Discord messages that left the live context get awareness markers via the
1159
1441
  * durable outbox, exactly as message-granular `undo` does.
1160
1442
  *
1443
+ * Returns once the switch has landed: the body is applied, with a
1444
+ * marker-scheduling receipt (`markers`). It does not wait for Discord to
1445
+ * accept the reactions: delivery is started, behind the MCPL data-plane
1446
+ * gate, and continues without the caller or the store reservation waiting
1447
+ * on it; its per-message outcomes stay in the outbox ledger.
1448
+ *
1161
1449
  * Throws `OperatorActionError` (`agent-busy`, `unknown-message`, …) — the
1162
1450
  * agent must be idle; nothing is queued.
1163
1451
  */
@@ -1181,6 +1469,8 @@ export declare class AgentFramework {
1181
1469
  channelId: string;
1182
1470
  messageId: string;
1183
1471
  }>;
1472
+ /** Whether awareness marks were scheduled; never a delivery claim. */
1473
+ markers: SurgeryMarkerReceipt;
1184
1474
  lastVisible: {
1185
1475
  participant?: string;
1186
1476
  role?: string;
@@ -1194,6 +1484,9 @@ export declare class AgentFramework {
1194
1484
  * removed together. Discord originals get awareness markers via the outbox;
1195
1485
  * the batch is `explicit`-activated only after every removal succeeded, and
1196
1486
  * a crash mid-way is finished at next boot (resumePreparedDiscordSuppressions).
1487
+ * Like rollbackToMessage, it returns once the body change has landed, with
1488
+ * a marker-scheduling receipt (`markers`); delivery continues without the
1489
+ * caller waiting on it.
1197
1490
  *
1198
1491
  * Not retroactive over derived state: a message already folded into an
1199
1492
  * autobiographical summary stays in that summary — roll back to before it
@@ -1216,12 +1509,64 @@ export declare class AgentFramework {
1216
1509
  channelId: string;
1217
1510
  messageId: string;
1218
1511
  }>;
1512
+ /** Whether awareness marks were scheduled; never a delivery claim. */
1513
+ markers: SurgeryMarkerReceipt;
1219
1514
  lastVisible: {
1220
1515
  participant?: string;
1221
1516
  role?: string;
1222
1517
  preview?: string;
1223
1518
  } | null;
1224
1519
  }>;
1520
+ /**
1521
+ * Record a surgery's prepared marker batch as active once its body change
1522
+ * has landed, and say what happened. Never throws: the body is already
1523
+ * applied, so a ledger failure here is reported in the receipt rather than
1524
+ * as a failed surgery an operator might retry. A batch that could not be
1525
+ * activated is retired, so no later reconciliation can deliver it behind a
1526
+ * receipt saying it was not scheduled (`not-scheduled`). If retiring fails
1527
+ * too, the receipt says only that the outcome is `unresolved`: the batch is
1528
+ * retained, and it may still be delivered. A rollback's batch
1529
+ * (activated by target branch) may be promoted by the very next
1530
+ * reconciliation, the one the delivery it starts runs; a suppression's
1531
+ * (activated explicitly) waits for the next start.
1532
+ *
1533
+ * A batch with no refs (a suppression journal with nothing addressable) is
1534
+ * still activated, which closes its resume journal. It schedules no marks,
1535
+ * so it reports `none` whatever the ledger does. If it can be neither
1536
+ * activated nor retired, its journal is left prepared and closes at the
1537
+ * next start: every interval it names has already committed, so the resume
1538
+ * skips them all and activates it.
1539
+ */
1540
+ private activateSurgeryMarkers;
1541
+ /**
1542
+ * Start awareness delivery after a branch move (a surgery, a switch, an
1543
+ * undo or redo) without the caller awaiting it. No operator response waits
1544
+ * for Discord to accept marks: the MCPL data-plane gate alone holds channel
1545
+ * traffic that arrives after it until they are attempted.
1546
+ * `syncDiscordAwarenessMarkers` installs that gate synchronously, before
1547
+ * its first await, so calling this while a surgery still holds the store
1548
+ * puts the gate up before the store is released. With no drain running, the
1549
+ * drain starts in the same synchronous run (the first reaction request can
1550
+ * be written before this returns); with one running, this generation's pass
1551
+ * follows it (drainForGeneration). Either way delivery continues
1552
+ * independently: the caller's response and any store reservation stop
1553
+ * waiting on remote reactions. A turn may run during delivery when its wake
1554
+ * carries no channel traffic (a scheduler timer, a provider admission), and
1555
+ * also when its channel traffic was admitted before the gate went up
1556
+ * (queued when a surgery began, or arriving during its switch or fork): the
1557
+ * surgery's store reservation, which used to hold such a turn through the
1558
+ * drain, now ends once the gate is up. A failure is accounted by the gate
1559
+ * itself: the current generation's failure recycles the connections, and a
1560
+ * superseded one leaves that to the newer generation, whose own pass meets
1561
+ * the same ledger. Here it is logged and raised as an ops alert, and the
1562
+ * next sync, reconnect or start delivers what is still pending.
1563
+ *
1564
+ * @param after What moved the branch, for the log and the alert
1565
+ * ("rollback", "branch switch", "undo" …).
1566
+ * @param agentName The agent the move was for, or "framework" for a
1567
+ * branch switch that names none.
1568
+ */
1569
+ startDiscordAwarenessDelivery(after: string, agentName?: string): void;
1225
1570
  /** Re-materialize config files from the (new) active branch — fire and
1226
1571
  * forget; the gate picks changes up via mtime. Mirrors undoLastTurn. */
1227
1572
  private materializeConfigMountAfterBranchSwitch;
@@ -1413,6 +1758,13 @@ export declare class AgentFramework {
1413
1758
  * Convert an MCPL push event to a context message.
1414
1759
  */
1415
1760
  private handleMcplPushEvent;
1761
+ /**
1762
+ * Whether a batched gate wake's addressed route may become `agentName`'s
1763
+ * speech locus. The gate broadcasts to every agent, conversation forks
1764
+ * included. A fork speaks only in its home channel, and a channel bound to
1765
+ * a fork is that fork's conversation, so no other agent takes it.
1766
+ */
1767
+ private mayTakeGateRoute;
1416
1768
  /**
1417
1769
  * Derive the MCPL composite channel id (the outbound routing locus) for a
1418
1770
  * push event from its server-defined `origin`, if it carries one.
@@ -1431,7 +1783,17 @@ export declare class AgentFramework {
1431
1783
  */
1432
1784
  private derivePushEventChannel;
1433
1785
  private processInferenceRequests;
1434
- /** Record prose segments suppressed by explicit-send silencing. */
1786
+ /**
1787
+ * Metadata for rows the agent's current turn stores: a silent heartbeat
1788
+ * tick stamps each of them (assistant responses, tool_result rows) so they
1789
+ * stay identifiable after the turn — request builds key the tick separator
1790
+ * on it, and a later retention policy can find or collapse them. The stamp
1791
+ * names the agent: residents share one message slot and a broadcast tick
1792
+ * reaches each of them with the same eventId. Undefined for ordinary
1793
+ * turns, whose rows are stored exactly as before.
1794
+ */
1795
+ private silentTurnRowMetadata;
1796
+ /** Record plain-prose segments this turn suppressed. */
1435
1797
  private recordProseSuppression;
1436
1798
  /** Record a successful plain-prose delivery for this turn's receipt. */
1437
1799
  private recordProseDelivery;
@@ -1469,6 +1831,18 @@ export declare class AgentFramework {
1469
1831
  * never conversational, never locus-eligible.
1470
1832
  */
1471
1833
  private recordChannelAutoOpenNotice;
1834
+ /**
1835
+ * A `!` continuation the turn asked for (`>>#x !`, `>>>#x !`): start another
1836
+ * turn now instead of pausing until the next external event. It reads the
1837
+ * logical turn of the stream that asked (shared with a retry or a
1838
+ * re-inference that continues it), once its deliveries have run, when the
1839
+ * turn completes or a tool ends it. A stream that ends in an error asks for
1840
+ * none itself, but a framework retry that follows it carries the request;
1841
+ * a turn abandoned by a quiesce asks for none.
1842
+ */
1843
+ private requestProseContinuation;
1844
+ /** The agent's routing state for its current turn, made when it has none. */
1845
+ private routingOf;
1472
1846
  /**
1473
1847
  * Explicit-prose-routing delivery gateway (docs/explicit-prose-routing.md).
1474
1848
  * Every prose segment of an `explicit`-mode agent flows through here:
@@ -1478,6 +1852,21 @@ export declare class AgentFramework {
1478
1852
  * or via the turn's sticky target).
1479
1853
  */
1480
1854
  private deliverProse;
1855
+ /**
1856
+ * Explicit prose's envelopes, each `>>` target resolved now, once. A live
1857
+ * round is admitted at its boundary: its turn's destination is decided from
1858
+ * these resolutions (roundDestination), and its queued delivery posts to
1859
+ * them, however the registry's names change before it runs.
1860
+ */
1861
+ private admitProse;
1862
+ private deliverAdmittedProse;
1863
+ /**
1864
+ * Where a delivered round leaves its turn's sticky destination, as the
1865
+ * explicit gateway sets it once the round's envelopes run: each `>>`
1866
+ * envelope whose target resolved becomes the destination. One that didn't
1867
+ * resolve bounces and leaves it, as do `>>skip_reply` and unprefixed text.
1868
+ */
1869
+ private roundDestination;
1481
1870
  /** Locus-preserving explicit publication. Source remains byte-identical in Chronicle. */
1482
1871
  private deliverHybridProse;
1483
1872
  private deliverProseEnvelope;
@@ -1616,6 +2005,30 @@ export declare class AgentFramework {
1616
2005
  * live wire copy can reuse the identical strings.
1617
2006
  */
1618
2007
  private buildStoredToolResultContent;
2008
+ /** Where a tool result labelled `label` is written: `<first writable
2009
+ * mount>/tool-results/<label>.txt`, or null when there is no writable
2010
+ * workspace. */
2011
+ private toolResultFilePlace;
2012
+ /**
2013
+ * A withheld original uses the remaining time in its batch's deadline.
2014
+ * A write still under way at that deadline is reported as unfinished and
2015
+ * goes on; the guard stops waiting for it, though stop() still waits for
2016
+ * the workspace's turn it holds (bounded only by a teardown timeout). From
2017
+ * then until every
2018
+ * overdue write settles, new withheld spills are workspace_unanswered.
2019
+ * Writes from other batches can start before the first deadline fires.
2020
+ * An exhausted batch starts no more writes even if none is overdue.
2021
+ * The inline cap's spills use writeToolResultFile without this deadline.
2022
+ */
2023
+ private spillWithheld;
2024
+ /**
2025
+ * Write one tool result's text to its tool-results file (see
2026
+ * toolResultFilePlace): the one place both the inline cap's spill and the
2027
+ * guard's withheld originals go. null when there is no writable workspace.
2028
+ * A failed write is reported, traced and logged here, never thrown. With a
2029
+ * branch, the file lands on that branch or isn't written (see writeBinary).
2030
+ */
2031
+ private writeToolResultFile;
1619
2032
  private spillOrTruncate;
1620
2033
  private getOrCreateScriptRunner;
1621
2034
  /**
@@ -1633,6 +2046,10 @@ export declare class AgentFramework {
1633
2046
  * resolve with its result. The waiter intercept in handleProcessEvent
1634
2047
  * (keyed by the pytc- call ID) routes the tool-result event here instead
1635
2048
  * of into the agent's pending tool round.
2049
+ *
2050
+ * RFC-007: with an `origin`, observers see the call as they see a model
2051
+ * call (register, dispatch with its refusal sites, open; the terminal at
2052
+ * the waiter intercept), under the inner tool's own name and class.
1636
2053
  */
1637
2054
  private dispatchScriptToolCall;
1638
2055
  /** Abort a running script when the agent's turn dies underneath it. */
@@ -1734,15 +2151,18 @@ export declare class AgentFramework {
1734
2151
  * inference, so this never causes a retry/wake loop.
1735
2152
  * 3. escalation — after N consecutive failures the agent is hard-down;
1736
2153
  * log that loudly (a repeated identical failure is the textbook signal).
1737
- * 4. breaker — when the failures are an `invalid_request` (a 400-class
1738
- * rejection of the history itself, e.g. corrupted tool_use/tool_result
1739
- * pairing or an oversized attachment), retrying the same context can
1740
- * never succeed: every new push event wakes the agent onto the same
1741
- * poisoned history forever. At the hard-down threshold, automatically
1742
- * quarantine: shed the newest complete exchange (the same forced-rewind
1743
- * primitive `/unstick` uses — shedNewestTurn never orphans a
1744
- * tool_use/thinking block) and retry, bounded by the same rewind cap so
1745
- * the breaker can never eat the whole history.
2154
+ * 4. breaker — when a failure at or past the hard-down threshold suggests
2155
+ * the provider refused the request's content or size (shedMayHelp:
2156
+ * an `invalid_request` at HTTP 400, 413 or 422 or with no status, or a
2157
+ * `context_length` at 413, such as a provider's answer to a corrupted
2158
+ * tool_use/tool_result pairing or an oversized attachment), retrying
2159
+ * the same context is likely to fail the same way, and every new push
2160
+ * event would wake the agent onto that same history. At the hard-down
2161
+ * threshold, automatically quarantine: shed the newest complete
2162
+ * exchange (the same forced-rewind primitive `/unstick` uses —
2163
+ * shedNewestTurn never orphans a tool_use/thinking block) and retry,
2164
+ * bounded by the same rewind cap so the breaker can never eat the
2165
+ * whole history.
1746
2166
  */
1747
2167
  /**
1748
2168
  * Live health snapshot for /healthz and doctor tooling: gate state, queued
@@ -1784,9 +2204,12 @@ export declare class AgentFramework {
1784
2204
  private noteRefusal;
1785
2205
  /**
1786
2206
  * Classify a terminal inference error for the `inference:exhausted` trace.
1787
- * Single-sourced for every emit site: the downstream breakers (poison-history
1788
- * quarantine, OverBudget drain kick) gate on `errorType`, so classification
1789
- * drift between sites would silently disable a safety net.
2207
+ * Single-sourced for every emit site that has an error to classify (a
2208
+ * stream the framework aborted has none): the downstream breakers gate on
2209
+ * what it returns (the poison-history quarantine on `errorType` and
2210
+ * `httpStatus`, through shedMayHelp; the OverBudget drain kick on
2211
+ * `errorType`), so classification drift between sites would silently
2212
+ * change when a safety net acts.
1790
2213
  *
1791
2214
  * context-manager's refusal errors are matched by a real `instanceof` since
1792
2215
  * CM exports them from its package root (context-manager#41 / #71; floor
@@ -1813,7 +2236,7 @@ export declare class AgentFramework {
1813
2236
  * primitives as the refusal auto-rewind / `/unstick` (shedNewestTurn +
1814
2237
  * the single consolidated episode marker) — and queues a retry so the
1815
2238
  * rewound history is verified immediately instead of waiting for the next
1816
- * push event to wake the agent onto the same poisoned context.
2239
+ * push event to wake the agent onto the same context.
1817
2240
  *
1818
2241
  * Bounded: at most `refusalHandling.maxRewinds` (default 3, hard cap 10)
1819
2242
  * sheds per failure episode; the budget resets on any successful inference.
@@ -1826,7 +2249,11 @@ export declare class AgentFramework {
1826
2249
  * Fail-open: individual server connection failures don't prevent framework startup.
1827
2250
  */
1828
2251
  private initializeMcpl;
1829
- /** Reconcile the durable ledger with Chronicle, then deliver every server's work. */
2252
+ /**
2253
+ * Reconcile the durable ledger with Chronicle, then deliver every server's
2254
+ * work. A drain still running is waited for and then followed by a fresh
2255
+ * pass (drainForGeneration).
2256
+ */
1830
2257
  syncDiscordAwarenessMarkers(_onlyServerId?: string): Promise<void>;
1831
2258
  private resumePreparedDiscordSuppressions;
1832
2259
  /**
@@ -1839,12 +2266,32 @@ export declare class AgentFramework {
1839
2266
  private writeDiscordAwarenessSuccess;
1840
2267
  private writeDiscordAwarenessFailure;
1841
2268
  private beginDiscordAwarenessBarrier;
2269
+ /**
2270
+ * One server's drain for a new generation: a gate completes only after
2271
+ * every operation pending when it was armed has been attempted. A drain
2272
+ * already running can't promise that. It never re-sends a key it has
2273
+ * attempted, so an operation re-pended while it runs (a rollback, its undo,
2274
+ * then a redo, all mid-drain) stays pending, and it may already have made
2275
+ * its last read of the ledger, missing a batch activated since. So a
2276
+ * generation that finds a drain running waits for it, then drains again
2277
+ * with a fresh pass that reads the ledger anew. Two generations waiting on
2278
+ * the same drain share the fresh pass that follows it.
2279
+ */
2280
+ private drainForGeneration;
2281
+ /**
2282
+ * Wait out the awareness gate for an inbound event: the generation current
2283
+ * now, and any generation installed while waiting, until none is current
2284
+ * or the current one is one already waited for. A handler that waited only
2285
+ * for the generation it first saw would go on behind a newer one armed
2286
+ * meanwhile. Rejects as the generation it waited for rejects.
2287
+ */
2288
+ private awaitDiscordAwarenessBarriers;
1842
2289
  /**
1843
2290
  * Install one framework-global Discord-awareness generation before releasing
1844
- * any inference-bearing event. With pending work, every MCPL data plane is
1845
- * paused while all control planes remain live. With no pending work, ready()
1846
- * runs synchronously so request responders preserve their historical
1847
- * same-stack behavior.
2291
+ * any inference-bearing event. With pending work or a drain still running,
2292
+ * every MCPL data plane is paused while all control planes remain live.
2293
+ * With neither, ready() runs synchronously so request responders preserve
2294
+ * their historical same-stack behavior.
1848
2295
  */
1849
2296
  private installMcplDataPlaneGate;
1850
2297
  private releaseMcplDataPlaneGate;
@@ -1864,6 +2311,13 @@ export declare class AgentFramework {
1864
2311
  * coalescing. */
1865
2312
  private manifestRefreshState;
1866
2313
  private static readonly MANIFEST_FETCH_FLOOR_MS;
2314
+ /**
2315
+ * The `mcpl:policy-refused` fields from a refusal receipt, as the host
2316
+ * acts on them: the receipt is server-supplied, so `fallback` is the
2317
+ * branch actually taken (anything but `close` is treated as `mcp-only`)
2318
+ * and a non-string `reason` is dropped.
2319
+ */
2320
+ private static policyRefusalFields;
1867
2321
  /**
1868
2322
  * §17.5 host processing: fetch the complete manifest, validate exactly as
1869
2323
  * at initialize, diff, apply §6.7 consequences (removals eagerly even
@@ -1887,6 +2341,43 @@ export declare class AgentFramework {
1887
2341
  * disconnect are resumed, not reset.
1888
2342
  */
1889
2343
  private registerMcplServerFeatures;
2344
+ /**
2345
+ * Snapshot the protective Discord reaction default for this deployment, as
2346
+ * suppression tokens: the forms the Discord adapter's suppression matcher
2347
+ * reads, not marker payloads for an add, a remove or a replay. It covers
2348
+ * the reactions the framework places: refusal markers, the adapter's own
2349
+ * default awareness marker, the configured awareness marker, and retained
2350
+ * outbox markers (including offline recovery choices and marks that can
2351
+ * later be removed or replayed). A custom emoji appears as its bare ID,
2352
+ * which suppression matches even after a rename; stored markers and the
2353
+ * actual add/remove payloads stay unchanged. Explicit adapter or operator
2354
+ * suppression settings still take precedence. Throws on an unreadable
2355
+ * ledger rather than reporting a partial baseline.
2356
+ */
2357
+ getPlacedReactionBaseline(): readonly string[];
2358
+ /**
2359
+ * The reaction baseline an operator chose for a stdio server, if any: a
2360
+ * value declared in its env, or one inherited from the host with
2361
+ * `inheritEnv`, the declared one first. A value with no tokens, as
2362
+ * discord-mcpl's parser reads them, counts as unset: the adapter splits on
2363
+ * commas and keeps a token only when its normalizer leaves something of it
2364
+ * (blank, `:`, `::` and a lone U+FE0F leave nothing), so such a value (an
2365
+ * empty systemd `Environment=`, say, or `${A},${B}` or `:${NAME}:` with the
2366
+ * variables empty) would otherwise turn the protective default off without
2367
+ * anyone choosing that.
2368
+ *
2369
+ * Windows names are matched in both sources: Workers expose a case-
2370
+ * sensitive `process.env` copy. Within one source, Node's spawn keeps the
2371
+ * first spelling in sorted order, so each source is resolved that way.
2372
+ *
2373
+ * A value is read as the child will see it. A config loaded from JSON can
2374
+ * carry a non-string there despite the type, and spawn writes every
2375
+ * defined value as its string form, so a number is a declared value, not a
2376
+ * failed connect. A null counts as unset, like a blank: written in JSON it
2377
+ * means no value, and read as spawn's "null" it would replace the
2378
+ * protective default with a list that suppresses nothing.
2379
+ */
2380
+ private declaredReactionBaseline;
1890
2381
  /**
1891
2382
  * Connect a new MCPL server at runtime. Refreshes the tool list and
1892
2383
  * notifies the agent of newly available tools. Throws if the MCPL
@@ -1971,6 +2462,24 @@ export declare class AgentFramework {
1971
2462
  * Tools are namespaced as `{toolPrefix}--{toolName}` per server config.
1972
2463
  */
1973
2464
  private refreshMcplTools;
2465
+ /**
2466
+ * Report operator tool-name patterns that match no model-facing tool:
2467
+ * `toolClassOverrides` keys and each server's `toolLifecycle.observe.tools`
2468
+ * / `toolLifecycle.inputs.tools`. These match `<toolPrefix>--<tool>`, and
2469
+ * the default prefix is `mcpl--<serverId>`, so a pattern written against
2470
+ * the bare server id is valid config that silently does nothing.
2471
+ *
2472
+ * Each pattern is reported at most once (console line + a
2473
+ * `mcpl:tool-pattern-unmatched` trace). A pattern that could still name
2474
+ * tools of a server whose listing is not in (not connected yet,
2475
+ * reconnecting, restarting) stays undecided until that listing arrives.
2476
+ * Diagnostic only: never throws into the refresh that called it.
2477
+ */
2478
+ private checkToolPatterns;
2479
+ /** Every tool name the framework offers to anyone: the shared board plus
2480
+ * each agent's own surface, before presentation visibility (a hidden tool
2481
+ * is still callable, so classes and lifecycle still apply to it). */
2482
+ private modelFacingToolNames;
1974
2483
  /**
1975
2484
  * Handle a tools/list_changed notification with collapse logic.
1976
2485
  * At most 2 refresh cycles can be in-flight: one running and one pending.
@@ -2061,4 +2570,5 @@ export declare class AgentFramework {
2061
2570
  private dispatchGateToolCall;
2062
2571
  private buildBeforeInferenceParams;
2063
2572
  }
2573
+ export {};
2064
2574
  //# sourceMappingURL=framework.d.ts.map