@animalabs/agent-framework 0.22.2 → 0.22.3

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 (935) hide show
  1. package/README.md +3 -1
  2. package/dist/src/agent.d.ts +77 -12
  3. package/dist/src/agent.d.ts.map +1 -1
  4. package/dist/src/agent.js +136 -40
  5. package/dist/src/agent.js.map +1 -1
  6. package/dist/src/api/mcp-server-core.js +1 -1
  7. package/dist/src/api/mcp-server-core.js.map +1 -1
  8. package/dist/src/api/server.d.ts.map +1 -1
  9. package/dist/src/api/server.js +5 -1
  10. package/dist/src/api/server.js.map +1 -1
  11. package/dist/src/api/types.d.ts +1 -1
  12. package/dist/src/api/types.d.ts.map +1 -1
  13. package/dist/src/branch-names.d.ts +14 -0
  14. package/dist/src/branch-names.d.ts.map +1 -0
  15. package/dist/src/branch-names.js +22 -0
  16. package/dist/src/branch-names.js.map +1 -0
  17. package/dist/src/closest-names.d.ts +28 -0
  18. package/dist/src/closest-names.d.ts.map +1 -0
  19. package/dist/src/closest-names.js +98 -0
  20. package/dist/src/closest-names.js.map +1 -0
  21. package/dist/src/code-execution/py-runner.d.ts +16 -5
  22. package/dist/src/code-execution/py-runner.d.ts.map +1 -1
  23. package/dist/src/code-execution/py-runner.js +186 -74
  24. package/dist/src/code-execution/py-runner.js.map +1 -1
  25. package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
  26. package/dist/src/code-execution/runtime-py.js +49 -3
  27. package/dist/src/code-execution/runtime-py.js.map +1 -1
  28. package/dist/src/code-execution/tool-definition.d.ts +12 -1
  29. package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
  30. package/dist/src/code-execution/tool-definition.js +21 -3
  31. package/dist/src/code-execution/tool-definition.js.map +1 -1
  32. package/dist/src/config-checks.d.ts +28 -0
  33. package/dist/src/config-checks.d.ts.map +1 -0
  34. package/dist/src/config-checks.js +52 -0
  35. package/dist/src/config-checks.js.map +1 -0
  36. package/dist/src/deadline-timer.d.ts +21 -0
  37. package/dist/src/deadline-timer.d.ts.map +1 -0
  38. package/dist/src/deadline-timer.js +43 -0
  39. package/dist/src/deadline-timer.js.map +1 -0
  40. package/dist/src/error-message.d.ts +30 -0
  41. package/dist/src/error-message.d.ts.map +1 -0
  42. package/dist/src/error-message.js +50 -0
  43. package/dist/src/error-message.js.map +1 -0
  44. package/dist/src/framework.d.ts +828 -88
  45. package/dist/src/framework.d.ts.map +1 -1
  46. package/dist/src/framework.js +5011 -1326
  47. package/dist/src/framework.js.map +1 -1
  48. package/dist/src/gate/event-gate.d.ts +8 -0
  49. package/dist/src/gate/event-gate.d.ts.map +1 -1
  50. package/dist/src/gate/event-gate.js +27 -3
  51. package/dist/src/gate/event-gate.js.map +1 -1
  52. package/dist/src/index.d.ts +4 -2
  53. package/dist/src/index.d.ts.map +1 -1
  54. package/dist/src/index.js +4 -2
  55. package/dist/src/index.js.map +1 -1
  56. package/dist/src/mcpl/channel-registry.d.ts +144 -6
  57. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  58. package/dist/src/mcpl/channel-registry.js +424 -263
  59. package/dist/src/mcpl/channel-registry.js.map +1 -1
  60. package/dist/src/mcpl/checkpoint-manager.d.ts +21 -1
  61. package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
  62. package/dist/src/mcpl/checkpoint-manager.js +91 -30
  63. package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
  64. package/dist/src/mcpl/conversation-router.d.ts +19 -3
  65. package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
  66. package/dist/src/mcpl/conversation-router.js +23 -8
  67. package/dist/src/mcpl/conversation-router.js.map +1 -1
  68. package/dist/src/mcpl/convert-block.d.ts +20 -0
  69. package/dist/src/mcpl/convert-block.d.ts.map +1 -0
  70. package/dist/src/mcpl/convert-block.js +89 -0
  71. package/dist/src/mcpl/convert-block.js.map +1 -0
  72. package/dist/src/mcpl/errors.d.ts +13 -0
  73. package/dist/src/mcpl/errors.d.ts.map +1 -1
  74. package/dist/src/mcpl/errors.js +28 -0
  75. package/dist/src/mcpl/errors.js.map +1 -1
  76. package/dist/src/mcpl/hook-orchestrator.d.ts +23 -0
  77. package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
  78. package/dist/src/mcpl/hook-orchestrator.js +83 -72
  79. package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
  80. package/dist/src/mcpl/inbound-source.d.ts +114 -0
  81. package/dist/src/mcpl/inbound-source.d.ts.map +1 -0
  82. package/dist/src/mcpl/inbound-source.js +83 -0
  83. package/dist/src/mcpl/inbound-source.js.map +1 -0
  84. package/dist/src/mcpl/index.d.ts +3 -1
  85. package/dist/src/mcpl/index.d.ts.map +1 -1
  86. package/dist/src/mcpl/index.js +3 -1
  87. package/dist/src/mcpl/index.js.map +1 -1
  88. package/dist/src/mcpl/inference-router.d.ts +15 -11
  89. package/dist/src/mcpl/inference-router.d.ts.map +1 -1
  90. package/dist/src/mcpl/inference-router.js +153 -84
  91. package/dist/src/mcpl/inference-router.js.map +1 -1
  92. package/dist/src/mcpl/push-coalescer.d.ts +33 -11
  93. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  94. package/dist/src/mcpl/push-coalescer.js +52 -20
  95. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  96. package/dist/src/mcpl/push-handler.d.ts +16 -9
  97. package/dist/src/mcpl/push-handler.d.ts.map +1 -1
  98. package/dist/src/mcpl/push-handler.js +18 -83
  99. package/dist/src/mcpl/push-handler.js.map +1 -1
  100. package/dist/src/mcpl/reference-fetcher.d.ts +14 -2
  101. package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
  102. package/dist/src/mcpl/reference-fetcher.js +72 -30
  103. package/dist/src/mcpl/reference-fetcher.js.map +1 -1
  104. package/dist/src/mcpl/references.d.ts +47 -12
  105. package/dist/src/mcpl/references.d.ts.map +1 -1
  106. package/dist/src/mcpl/references.js +74 -21
  107. package/dist/src/mcpl/references.js.map +1 -1
  108. package/dist/src/mcpl/server-connection.d.ts +89 -10
  109. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  110. package/dist/src/mcpl/server-connection.js +405 -129
  111. package/dist/src/mcpl/server-connection.js.map +1 -1
  112. package/dist/src/mcpl/server-registry.d.ts +10 -1
  113. package/dist/src/mcpl/server-registry.d.ts.map +1 -1
  114. package/dist/src/mcpl/server-registry.js +14 -3
  115. package/dist/src/mcpl/server-registry.js.map +1 -1
  116. package/dist/src/mcpl/skip-reply-wake.d.ts +36 -0
  117. package/dist/src/mcpl/skip-reply-wake.d.ts.map +1 -0
  118. package/dist/src/mcpl/skip-reply-wake.js +55 -0
  119. package/dist/src/mcpl/skip-reply-wake.js.map +1 -0
  120. package/dist/src/mcpl/transport.d.ts +51 -2
  121. package/dist/src/mcpl/transport.d.ts.map +1 -1
  122. package/dist/src/mcpl/transport.js +114 -20
  123. package/dist/src/mcpl/transport.js.map +1 -1
  124. package/dist/src/mcpl/types.d.ts +14 -3
  125. package/dist/src/mcpl/types.d.ts.map +1 -1
  126. package/dist/src/mcpl/types.js.map +1 -1
  127. package/dist/src/mcpl/visible-content.d.ts +15 -0
  128. package/dist/src/mcpl/visible-content.d.ts.map +1 -1
  129. package/dist/src/mcpl/visible-content.js +25 -0
  130. package/dist/src/mcpl/visible-content.js.map +1 -1
  131. package/dist/src/module-registry.d.ts +19 -1
  132. package/dist/src/module-registry.d.ts.map +1 -1
  133. package/dist/src/module-registry.js +54 -25
  134. package/dist/src/module-registry.js.map +1 -1
  135. package/dist/src/modules/api/index.js +1 -1
  136. package/dist/src/modules/api/index.js.map +1 -1
  137. package/dist/src/modules/discord/discord-js-client.d.ts +1 -0
  138. package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
  139. package/dist/src/modules/discord/discord-js-client.js +25 -9
  140. package/dist/src/modules/discord/discord-js-client.js.map +1 -1
  141. package/dist/src/modules/discord/index.d.ts +29 -3
  142. package/dist/src/modules/discord/index.d.ts.map +1 -1
  143. package/dist/src/modules/discord/index.js +379 -143
  144. package/dist/src/modules/discord/index.js.map +1 -1
  145. package/dist/src/modules/discord/types.d.ts +14 -1
  146. package/dist/src/modules/discord/types.d.ts.map +1 -1
  147. package/dist/src/modules/health/index.d.ts.map +1 -1
  148. package/dist/src/modules/health/index.js +2 -1
  149. package/dist/src/modules/health/index.js.map +1 -1
  150. package/dist/src/modules/history/index.d.ts +3 -1
  151. package/dist/src/modules/history/index.d.ts.map +1 -1
  152. package/dist/src/modules/history/index.js +359 -127
  153. package/dist/src/modules/history/index.js.map +1 -1
  154. package/dist/src/modules/history/semantic.d.ts +28 -1
  155. package/dist/src/modules/history/semantic.d.ts.map +1 -1
  156. package/dist/src/modules/history/semantic.js +177 -32
  157. package/dist/src/modules/history/semantic.js.map +1 -1
  158. package/dist/src/modules/unknown-tool.d.ts +10 -0
  159. package/dist/src/modules/unknown-tool.d.ts.map +1 -0
  160. package/dist/src/modules/unknown-tool.js +17 -0
  161. package/dist/src/modules/unknown-tool.js.map +1 -0
  162. package/dist/src/modules/workspace/disk-agreement.d.ts +32 -2
  163. package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
  164. package/dist/src/modules/workspace/disk-agreement.js +30 -2
  165. package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
  166. package/dist/src/modules/workspace/effects.d.ts +64 -6
  167. package/dist/src/modules/workspace/effects.d.ts.map +1 -1
  168. package/dist/src/modules/workspace/effects.js +291 -44
  169. package/dist/src/modules/workspace/effects.js.map +1 -1
  170. package/dist/src/modules/workspace/index.d.ts +119 -23
  171. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  172. package/dist/src/modules/workspace/index.js +793 -247
  173. package/dist/src/modules/workspace/index.js.map +1 -1
  174. package/dist/src/modules/workspace/observe.d.ts +75 -8
  175. package/dist/src/modules/workspace/observe.d.ts.map +1 -1
  176. package/dist/src/modules/workspace/observe.js +174 -14
  177. package/dist/src/modules/workspace/observe.js.map +1 -1
  178. package/dist/src/modules/workspace/reconcile.d.ts +58 -7
  179. package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
  180. package/dist/src/modules/workspace/reconcile.js +521 -56
  181. package/dist/src/modules/workspace/reconcile.js.map +1 -1
  182. package/dist/src/modules/workspace/types.d.ts +18 -4
  183. package/dist/src/modules/workspace/types.d.ts.map +1 -1
  184. package/dist/src/modules/workspace/types.js.map +1 -1
  185. package/dist/src/modules/workspace/watcher.d.ts +7 -2
  186. package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
  187. package/dist/src/modules/workspace/watcher.js +28 -4
  188. package/dist/src/modules/workspace/watcher.js.map +1 -1
  189. package/dist/src/prose-drafts.d.ts +240 -0
  190. package/dist/src/prose-drafts.d.ts.map +1 -0
  191. package/dist/src/prose-drafts.js +362 -0
  192. package/dist/src/prose-drafts.js.map +1 -0
  193. package/dist/src/prose-segments.d.ts +21 -2
  194. package/dist/src/prose-segments.d.ts.map +1 -1
  195. package/dist/src/prose-segments.js +46 -9
  196. package/dist/src/prose-segments.js.map +1 -1
  197. package/dist/src/recovery/offline-branch.d.ts +1 -0
  198. package/dist/src/recovery/offline-branch.d.ts.map +1 -1
  199. package/dist/src/recovery/offline-branch.js +3 -1
  200. package/dist/src/recovery/offline-branch.js.map +1 -1
  201. package/dist/src/safe-slice.d.ts +5 -1
  202. package/dist/src/safe-slice.d.ts.map +1 -1
  203. package/dist/src/safe-slice.js +9 -1
  204. package/dist/src/safe-slice.js.map +1 -1
  205. package/dist/src/tool-image-ledger.d.ts +87 -19
  206. package/dist/src/tool-image-ledger.d.ts.map +1 -1
  207. package/dist/src/tool-image-ledger.js +135 -32
  208. package/dist/src/tool-image-ledger.js.map +1 -1
  209. package/dist/src/tool-presentation.d.ts +9 -0
  210. package/dist/src/tool-presentation.d.ts.map +1 -1
  211. package/dist/src/tool-presentation.js +257 -60
  212. package/dist/src/tool-presentation.js.map +1 -1
  213. package/dist/src/tool-result-guard.d.ts.map +1 -1
  214. package/dist/src/tool-result-guard.js +7 -10
  215. package/dist/src/tool-result-guard.js.map +1 -1
  216. package/dist/src/tool-result-history.d.ts +32 -3
  217. package/dist/src/tool-result-history.d.ts.map +1 -1
  218. package/dist/src/tool-result-history.js +106 -19
  219. package/dist/src/tool-result-history.js.map +1 -1
  220. package/dist/src/tune-out/coordinator.d.ts +25 -1
  221. package/dist/src/tune-out/coordinator.d.ts.map +1 -1
  222. package/dist/src/tune-out/coordinator.js +260 -65
  223. package/dist/src/tune-out/coordinator.js.map +1 -1
  224. package/dist/src/types/agent.d.ts +17 -5
  225. package/dist/src/types/agent.d.ts.map +1 -1
  226. package/dist/src/types/events.d.ts +17 -0
  227. package/dist/src/types/events.d.ts.map +1 -1
  228. package/dist/src/types/framework.d.ts +21 -5
  229. package/dist/src/types/framework.d.ts.map +1 -1
  230. package/dist/src/types/inference-log.d.ts +1 -1
  231. package/dist/src/types/inference-log.d.ts.map +1 -1
  232. package/dist/src/types/module.d.ts +23 -4
  233. package/dist/src/types/module.d.ts.map +1 -1
  234. package/dist/src/types/trace.d.ts +95 -6
  235. package/dist/src/types/trace.d.ts.map +1 -1
  236. package/dist/src/usage/usage-tracker.d.ts +5 -0
  237. package/dist/src/usage/usage-tracker.d.ts.map +1 -1
  238. package/dist/src/usage/usage-tracker.js +35 -8
  239. package/dist/src/usage/usage-tracker.js.map +1 -1
  240. package/package.json +3 -4
  241. package/src/agent.ts +162 -40
  242. package/src/api/mcp-server-core.ts +1 -1
  243. package/src/api/server.ts +4 -1
  244. package/src/api/types.ts +1 -1
  245. package/src/branch-names.ts +19 -0
  246. package/src/closest-names.ts +94 -0
  247. package/src/code-execution/py-runner.ts +200 -76
  248. package/src/code-execution/runtime-py.ts +49 -3
  249. package/src/code-execution/tool-definition.ts +28 -4
  250. package/src/config-checks.ts +48 -0
  251. package/src/deadline-timer.ts +44 -0
  252. package/src/error-message.ts +48 -0
  253. package/src/framework.ts +5352 -1388
  254. package/src/gate/event-gate.ts +28 -3
  255. package/src/index.ts +11 -2
  256. package/src/mcpl/channel-registry.ts +517 -286
  257. package/src/mcpl/checkpoint-manager.ts +104 -29
  258. package/src/mcpl/conversation-router.ts +28 -8
  259. package/src/mcpl/convert-block.ts +97 -0
  260. package/src/mcpl/errors.ts +28 -0
  261. package/src/mcpl/hook-orchestrator.ts +84 -77
  262. package/src/mcpl/inbound-source.ts +156 -0
  263. package/src/mcpl/index.ts +10 -1
  264. package/src/mcpl/inference-router.ts +174 -99
  265. package/src/mcpl/push-coalescer.ts +60 -24
  266. package/src/mcpl/push-handler.ts +20 -90
  267. package/src/mcpl/reference-fetcher.ts +71 -26
  268. package/src/mcpl/references.ts +81 -22
  269. package/src/mcpl/server-connection.ts +427 -132
  270. package/src/mcpl/server-registry.ts +15 -4
  271. package/src/mcpl/skip-reply-wake.ts +73 -0
  272. package/src/mcpl/transport.ts +120 -18
  273. package/src/mcpl/types.ts +14 -3
  274. package/src/mcpl/visible-content.ts +27 -0
  275. package/src/module-registry.ts +58 -23
  276. package/src/modules/api/index.ts +1 -1
  277. package/src/modules/discord/discord-js-client.ts +26 -10
  278. package/src/modules/discord/index.ts +391 -158
  279. package/src/modules/discord/types.ts +15 -2
  280. package/src/modules/health/index.ts +2 -1
  281. package/src/modules/history/index.ts +410 -120
  282. package/src/modules/history/semantic.ts +189 -32
  283. package/src/modules/unknown-tool.ts +16 -0
  284. package/src/modules/workspace/disk-agreement.ts +51 -3
  285. package/src/modules/workspace/effects.ts +279 -35
  286. package/src/modules/workspace/index.ts +810 -260
  287. package/src/modules/workspace/observe.ts +194 -20
  288. package/src/modules/workspace/reconcile.ts +619 -64
  289. package/src/modules/workspace/types.ts +18 -4
  290. package/src/modules/workspace/watcher.ts +27 -4
  291. package/src/prose-drafts.ts +481 -0
  292. package/src/prose-segments.ts +51 -8
  293. package/src/recovery/offline-branch.ts +4 -1
  294. package/src/safe-slice.ts +9 -1
  295. package/src/tool-image-ledger.ts +153 -34
  296. package/src/tool-presentation.ts +224 -40
  297. package/src/tool-result-guard.ts +7 -8
  298. package/src/tool-result-history.ts +124 -20
  299. package/src/tune-out/coordinator.ts +259 -65
  300. package/src/types/agent.ts +17 -7
  301. package/src/types/events.ts +17 -0
  302. package/src/types/framework.ts +21 -5
  303. package/src/types/inference-log.ts +1 -1
  304. package/src/types/module.ts +24 -4
  305. package/src/types/trace.ts +101 -6
  306. package/src/usage/usage-tracker.ts +32 -8
  307. package/dist/test/activation-request-sanitize.test.d.ts +0 -2
  308. package/dist/test/activation-request-sanitize.test.d.ts.map +0 -1
  309. package/dist/test/activation-request-sanitize.test.js +0 -89
  310. package/dist/test/activation-request-sanitize.test.js.map +0 -1
  311. package/dist/test/agent-cache-ttl.test.d.ts +0 -2
  312. package/dist/test/agent-cache-ttl.test.d.ts.map +0 -1
  313. package/dist/test/agent-cache-ttl.test.js +0 -41
  314. package/dist/test/agent-cache-ttl.test.js.map +0 -1
  315. package/dist/test/agent-runtime-settings.test.d.ts +0 -2
  316. package/dist/test/agent-runtime-settings.test.d.ts.map +0 -1
  317. package/dist/test/agent-runtime-settings.test.js +0 -1598
  318. package/dist/test/agent-runtime-settings.test.js.map +0 -1
  319. package/dist/test/api-admin-gate.test.d.ts +0 -2
  320. package/dist/test/api-admin-gate.test.d.ts.map +0 -1
  321. package/dist/test/api-admin-gate.test.js +0 -116
  322. package/dist/test/api-admin-gate.test.js.map +0 -1
  323. package/dist/test/assistant-persist-refusal.test.d.ts +0 -2
  324. package/dist/test/assistant-persist-refusal.test.d.ts.map +0 -1
  325. package/dist/test/assistant-persist-refusal.test.js +0 -63
  326. package/dist/test/assistant-persist-refusal.test.js.map +0 -1
  327. package/dist/test/batched-wake-locus.test.d.ts +0 -2
  328. package/dist/test/batched-wake-locus.test.d.ts.map +0 -1
  329. package/dist/test/batched-wake-locus.test.js +0 -166
  330. package/dist/test/batched-wake-locus.test.js.map +0 -1
  331. package/dist/test/busy-agent-scheduler.test.d.ts +0 -2
  332. package/dist/test/busy-agent-scheduler.test.d.ts.map +0 -1
  333. package/dist/test/busy-agent-scheduler.test.js +0 -92
  334. package/dist/test/busy-agent-scheduler.test.js.map +0 -1
  335. package/dist/test/channel-incoming-targeting.test.d.ts +0 -2
  336. package/dist/test/channel-incoming-targeting.test.d.ts.map +0 -1
  337. package/dist/test/channel-incoming-targeting.test.js +0 -81
  338. package/dist/test/channel-incoming-targeting.test.js.map +0 -1
  339. package/dist/test/channel-label-history.test.d.ts +0 -2
  340. package/dist/test/channel-label-history.test.d.ts.map +0 -1
  341. package/dist/test/channel-label-history.test.js +0 -424
  342. package/dist/test/channel-label-history.test.js.map +0 -1
  343. package/dist/test/channel-lifecycle-provenance.test.d.ts +0 -2
  344. package/dist/test/channel-lifecycle-provenance.test.d.ts.map +0 -1
  345. package/dist/test/channel-lifecycle-provenance.test.js +0 -47
  346. package/dist/test/channel-lifecycle-provenance.test.js.map +0 -1
  347. package/dist/test/channel-registry-routing.test.d.ts +0 -2
  348. package/dist/test/channel-registry-routing.test.d.ts.map +0 -1
  349. package/dist/test/channel-registry-routing.test.js +0 -446
  350. package/dist/test/channel-registry-routing.test.js.map +0 -1
  351. package/dist/test/channel-registry-typing.test.d.ts +0 -2
  352. package/dist/test/channel-registry-typing.test.d.ts.map +0 -1
  353. package/dist/test/channel-registry-typing.test.js +0 -91
  354. package/dist/test/channel-registry-typing.test.js.map +0 -1
  355. package/dist/test/channels-changed-respond-first.test.d.ts +0 -2
  356. package/dist/test/channels-changed-respond-first.test.d.ts.map +0 -1
  357. package/dist/test/channels-changed-respond-first.test.js +0 -74
  358. package/dist/test/channels-changed-respond-first.test.js.map +0 -1
  359. package/dist/test/checkpoint-attribution.test.d.ts +0 -2
  360. package/dist/test/checkpoint-attribution.test.d.ts.map +0 -1
  361. package/dist/test/checkpoint-attribution.test.js +0 -200
  362. package/dist/test/checkpoint-attribution.test.js.map +0 -1
  363. package/dist/test/code-execution.test.d.ts +0 -11
  364. package/dist/test/code-execution.test.d.ts.map +0 -1
  365. package/dist/test/code-execution.test.js +0 -1272
  366. package/dist/test/code-execution.test.js.map +0 -1
  367. package/dist/test/component-defaults.test.d.ts +0 -2
  368. package/dist/test/component-defaults.test.d.ts.map +0 -1
  369. package/dist/test/component-defaults.test.js +0 -54
  370. package/dist/test/component-defaults.test.js.map +0 -1
  371. package/dist/test/conversation-fork-injection-scoping.test.d.ts +0 -2
  372. package/dist/test/conversation-fork-injection-scoping.test.d.ts.map +0 -1
  373. package/dist/test/conversation-fork-injection-scoping.test.js +0 -200
  374. package/dist/test/conversation-fork-injection-scoping.test.js.map +0 -1
  375. package/dist/test/conversation-router.test.d.ts +0 -2
  376. package/dist/test/conversation-router.test.d.ts.map +0 -1
  377. package/dist/test/conversation-router.test.js +0 -174
  378. package/dist/test/conversation-router.test.js.map +0 -1
  379. package/dist/test/conversation-routing.test.d.ts +0 -7
  380. package/dist/test/conversation-routing.test.d.ts.map +0 -1
  381. package/dist/test/conversation-routing.test.js +0 -621
  382. package/dist/test/conversation-routing.test.js.map +0 -1
  383. package/dist/test/deferred-wake-integrity.test.d.ts +0 -29
  384. package/dist/test/deferred-wake-integrity.test.d.ts.map +0 -1
  385. package/dist/test/deferred-wake-integrity.test.js +0 -320
  386. package/dist/test/deferred-wake-integrity.test.js.map +0 -1
  387. package/dist/test/discord-awareness-outbox.test.d.ts +0 -2
  388. package/dist/test/discord-awareness-outbox.test.d.ts.map +0 -1
  389. package/dist/test/discord-awareness-outbox.test.js +0 -371
  390. package/dist/test/discord-awareness-outbox.test.js.map +0 -1
  391. package/dist/test/discord-history-delete-window.test.d.ts +0 -2
  392. package/dist/test/discord-history-delete-window.test.d.ts.map +0 -1
  393. package/dist/test/discord-history-delete-window.test.js +0 -81
  394. package/dist/test/discord-history-delete-window.test.js.map +0 -1
  395. package/dist/test/discord-history-sync.test.d.ts +0 -2
  396. package/dist/test/discord-history-sync.test.d.ts.map +0 -1
  397. package/dist/test/discord-history-sync.test.js +0 -56
  398. package/dist/test/discord-history-sync.test.js.map +0 -1
  399. package/dist/test/discord-typing-keepalive.test.d.ts +0 -2
  400. package/dist/test/discord-typing-keepalive.test.d.ts.map +0 -1
  401. package/dist/test/discord-typing-keepalive.test.js +0 -77
  402. package/dist/test/discord-typing-keepalive.test.js.map +0 -1
  403. package/dist/test/ephemeral-settle.test.d.ts +0 -2
  404. package/dist/test/ephemeral-settle.test.d.ts.map +0 -1
  405. package/dist/test/ephemeral-settle.test.js +0 -354
  406. package/dist/test/ephemeral-settle.test.js.map +0 -1
  407. package/dist/test/event-gate-passthrough.test.d.ts +0 -15
  408. package/dist/test/event-gate-passthrough.test.d.ts.map +0 -1
  409. package/dist/test/event-gate-passthrough.test.js +0 -289
  410. package/dist/test/event-gate-passthrough.test.js.map +0 -1
  411. package/dist/test/event-gate-policy-mutation.test.d.ts +0 -2
  412. package/dist/test/event-gate-policy-mutation.test.d.ts.map +0 -1
  413. package/dist/test/event-gate-policy-mutation.test.js +0 -137
  414. package/dist/test/event-gate-policy-mutation.test.js.map +0 -1
  415. package/dist/test/event-gate-rate-limit.test.d.ts +0 -2
  416. package/dist/test/event-gate-rate-limit.test.d.ts.map +0 -1
  417. package/dist/test/event-gate-rate-limit.test.js +0 -627
  418. package/dist/test/event-gate-rate-limit.test.js.map +0 -1
  419. package/dist/test/event-gate-script.test.d.ts +0 -2
  420. package/dist/test/event-gate-script.test.d.ts.map +0 -1
  421. package/dist/test/event-gate-script.test.js +0 -95
  422. package/dist/test/event-gate-script.test.js.map +0 -1
  423. package/dist/test/event-gate-selfwake.test.d.ts +0 -15
  424. package/dist/test/event-gate-selfwake.test.d.ts.map +0 -1
  425. package/dist/test/event-gate-selfwake.test.js +0 -125
  426. package/dist/test/event-gate-selfwake.test.js.map +0 -1
  427. package/dist/test/event-gate-tags.test.d.ts +0 -2
  428. package/dist/test/event-gate-tags.test.d.ts.map +0 -1
  429. package/dist/test/event-gate-tags.test.js +0 -76
  430. package/dist/test/event-gate-tags.test.js.map +0 -1
  431. package/dist/test/event-gate.test.d.ts +0 -2
  432. package/dist/test/event-gate.test.d.ts.map +0 -1
  433. package/dist/test/event-gate.test.js +0 -919
  434. package/dist/test/event-gate.test.js.map +0 -1
  435. package/dist/test/explicit-prose-routing.test.d.ts +0 -11
  436. package/dist/test/explicit-prose-routing.test.d.ts.map +0 -1
  437. package/dist/test/explicit-prose-routing.test.js +0 -1715
  438. package/dist/test/explicit-prose-routing.test.js.map +0 -1
  439. package/dist/test/framework.test.d.ts +0 -5
  440. package/dist/test/framework.test.d.ts.map +0 -1
  441. package/dist/test/framework.test.js +0 -1048
  442. package/dist/test/framework.test.js.map +0 -1
  443. package/dist/test/gather-context-timeout.test.d.ts +0 -2
  444. package/dist/test/gather-context-timeout.test.d.ts.map +0 -1
  445. package/dist/test/gather-context-timeout.test.js +0 -120
  446. package/dist/test/gather-context-timeout.test.js.map +0 -1
  447. package/dist/test/health-snapshot.test.d.ts +0 -2
  448. package/dist/test/health-snapshot.test.d.ts.map +0 -1
  449. package/dist/test/health-snapshot.test.js +0 -74
  450. package/dist/test/health-snapshot.test.js.map +0 -1
  451. package/dist/test/helpers/coalescing-fixture.d.ts +0 -74
  452. package/dist/test/helpers/coalescing-fixture.d.ts.map +0 -1
  453. package/dist/test/helpers/coalescing-fixture.js +0 -152
  454. package/dist/test/helpers/coalescing-fixture.js.map +0 -1
  455. package/dist/test/helpers/coalescing-kill-child.d.ts +0 -2
  456. package/dist/test/helpers/coalescing-kill-child.d.ts.map +0 -1
  457. package/dist/test/helpers/coalescing-kill-child.js +0 -24
  458. package/dist/test/helpers/coalescing-kill-child.js.map +0 -1
  459. package/dist/test/helpers/mock-membrane.d.ts +0 -53
  460. package/dist/test/helpers/mock-membrane.d.ts.map +0 -1
  461. package/dist/test/helpers/mock-membrane.js +0 -168
  462. package/dist/test/helpers/mock-membrane.js.map +0 -1
  463. package/dist/test/helpers/pytc-stop-rows.d.ts +0 -11
  464. package/dist/test/helpers/pytc-stop-rows.d.ts.map +0 -1
  465. package/dist/test/helpers/pytc-stop-rows.js +0 -143
  466. package/dist/test/helpers/pytc-stop-rows.js.map +0 -1
  467. package/dist/test/helpers/quiesce-crash-child.d.ts +0 -2
  468. package/dist/test/helpers/quiesce-crash-child.d.ts.map +0 -1
  469. package/dist/test/helpers/quiesce-crash-child.js +0 -156
  470. package/dist/test/helpers/quiesce-crash-child.js.map +0 -1
  471. package/dist/test/hide-then-turn.test.d.ts +0 -2
  472. package/dist/test/hide-then-turn.test.d.ts.map +0 -1
  473. package/dist/test/hide-then-turn.test.js +0 -101
  474. package/dist/test/hide-then-turn.test.js.map +0 -1
  475. package/dist/test/history-module-overview.test.d.ts +0 -2
  476. package/dist/test/history-module-overview.test.d.ts.map +0 -1
  477. package/dist/test/history-module-overview.test.js +0 -711
  478. package/dist/test/history-module-overview.test.js.map +0 -1
  479. package/dist/test/history-module-realstore.test.d.ts +0 -2
  480. package/dist/test/history-module-realstore.test.d.ts.map +0 -1
  481. package/dist/test/history-module-realstore.test.js +0 -363
  482. package/dist/test/history-module-realstore.test.js.map +0 -1
  483. package/dist/test/history-module-semantic.test.d.ts +0 -2
  484. package/dist/test/history-module-semantic.test.d.ts.map +0 -1
  485. package/dist/test/history-module-semantic.test.js +0 -213
  486. package/dist/test/history-module-semantic.test.js.map +0 -1
  487. package/dist/test/history-module-ux.test.d.ts +0 -2
  488. package/dist/test/history-module-ux.test.d.ts.map +0 -1
  489. package/dist/test/history-module-ux.test.js +0 -304
  490. package/dist/test/history-module-ux.test.js.map +0 -1
  491. package/dist/test/history-module.test.d.ts +0 -2
  492. package/dist/test/history-module.test.d.ts.map +0 -1
  493. package/dist/test/history-module.test.js +0 -619
  494. package/dist/test/history-module.test.js.map +0 -1
  495. package/dist/test/history-semantic-review-findings.test.d.ts +0 -2
  496. package/dist/test/history-semantic-review-findings.test.d.ts.map +0 -1
  497. package/dist/test/history-semantic-review-findings.test.js +0 -338
  498. package/dist/test/history-semantic-review-findings.test.js.map +0 -1
  499. package/dist/test/history-semantic-sync-converges.test.d.ts +0 -2
  500. package/dist/test/history-semantic-sync-converges.test.d.ts.map +0 -1
  501. package/dist/test/history-semantic-sync-converges.test.js +0 -109
  502. package/dist/test/history-semantic-sync-converges.test.js.map +0 -1
  503. package/dist/test/host-quiesce.test.d.ts +0 -2
  504. package/dist/test/host-quiesce.test.d.ts.map +0 -1
  505. package/dist/test/host-quiesce.test.js +0 -988
  506. package/dist/test/host-quiesce.test.js.map +0 -1
  507. package/dist/test/inference-exhaustion-rewind.test.d.ts +0 -2
  508. package/dist/test/inference-exhaustion-rewind.test.d.ts.map +0 -1
  509. package/dist/test/inference-exhaustion-rewind.test.js +0 -387
  510. package/dist/test/inference-exhaustion-rewind.test.js.map +0 -1
  511. package/dist/test/inference-failure-bounds.test.d.ts +0 -2
  512. package/dist/test/inference-failure-bounds.test.d.ts.map +0 -1
  513. package/dist/test/inference-failure-bounds.test.js +0 -1202
  514. package/dist/test/inference-failure-bounds.test.js.map +0 -1
  515. package/dist/test/inference-failure-observability.test.d.ts +0 -2
  516. package/dist/test/inference-failure-observability.test.d.ts.map +0 -1
  517. package/dist/test/inference-failure-observability.test.js +0 -84
  518. package/dist/test/inference-failure-observability.test.js.map +0 -1
  519. package/dist/test/journal-tool.test.d.ts +0 -2
  520. package/dist/test/journal-tool.test.d.ts.map +0 -1
  521. package/dist/test/journal-tool.test.js +0 -33
  522. package/dist/test/journal-tool.test.js.map +0 -1
  523. package/dist/test/kv-unified-open-flight-retry.test.d.ts +0 -2
  524. package/dist/test/kv-unified-open-flight-retry.test.d.ts.map +0 -1
  525. package/dist/test/kv-unified-open-flight-retry.test.js +0 -189
  526. package/dist/test/kv-unified-open-flight-retry.test.js.map +0 -1
  527. package/dist/test/kv-unified-wiring.test.d.ts +0 -2
  528. package/dist/test/kv-unified-wiring.test.d.ts.map +0 -1
  529. package/dist/test/kv-unified-wiring.test.js +0 -95
  530. package/dist/test/kv-unified-wiring.test.js.map +0 -1
  531. package/dist/test/late-events-after-stop.test.d.ts +0 -2
  532. package/dist/test/late-events-after-stop.test.d.ts.map +0 -1
  533. package/dist/test/late-events-after-stop.test.js +0 -122
  534. package/dist/test/late-events-after-stop.test.js.map +0 -1
  535. package/dist/test/liveness-watchdog.test.d.ts +0 -2
  536. package/dist/test/liveness-watchdog.test.d.ts.map +0 -1
  537. package/dist/test/liveness-watchdog.test.js +0 -94
  538. package/dist/test/liveness-watchdog.test.js.map +0 -1
  539. package/dist/test/machine-close-provenance.test.d.ts +0 -2
  540. package/dist/test/machine-close-provenance.test.d.ts.map +0 -1
  541. package/dist/test/machine-close-provenance.test.js +0 -116
  542. package/dist/test/machine-close-provenance.test.js.map +0 -1
  543. package/dist/test/maintenance-timer.test.d.ts +0 -2
  544. package/dist/test/maintenance-timer.test.d.ts.map +0 -1
  545. package/dist/test/maintenance-timer.test.js +0 -1827
  546. package/dist/test/maintenance-timer.test.js.map +0 -1
  547. package/dist/test/mcp-server-bin.test.d.ts +0 -2
  548. package/dist/test/mcp-server-bin.test.d.ts.map +0 -1
  549. package/dist/test/mcp-server-bin.test.js +0 -142
  550. package/dist/test/mcp-server-bin.test.js.map +0 -1
  551. package/dist/test/mcpl-access-provider.test.d.ts +0 -2
  552. package/dist/test/mcpl-access-provider.test.d.ts.map +0 -1
  553. package/dist/test/mcpl-access-provider.test.js +0 -20
  554. package/dist/test/mcpl-access-provider.test.js.map +0 -1
  555. package/dist/test/mcpl-awareness-barrier.test.d.ts +0 -2
  556. package/dist/test/mcpl-awareness-barrier.test.d.ts.map +0 -1
  557. package/dist/test/mcpl-awareness-barrier.test.js +0 -769
  558. package/dist/test/mcpl-awareness-barrier.test.js.map +0 -1
  559. package/dist/test/mcpl-capability-grant.test.d.ts +0 -10
  560. package/dist/test/mcpl-capability-grant.test.d.ts.map +0 -1
  561. package/dist/test/mcpl-capability-grant.test.js +0 -111
  562. package/dist/test/mcpl-capability-grant.test.js.map +0 -1
  563. package/dist/test/mcpl-capability-scoping.test.d.ts +0 -2
  564. package/dist/test/mcpl-capability-scoping.test.d.ts.map +0 -1
  565. package/dist/test/mcpl-capability-scoping.test.js +0 -266
  566. package/dist/test/mcpl-capability-scoping.test.js.map +0 -1
  567. package/dist/test/mcpl-child-env.test.d.ts +0 -2
  568. package/dist/test/mcpl-child-env.test.d.ts.map +0 -1
  569. package/dist/test/mcpl-child-env.test.js +0 -158
  570. package/dist/test/mcpl-child-env.test.js.map +0 -1
  571. package/dist/test/mcpl-coalesced-content-parity.test.d.ts +0 -2
  572. package/dist/test/mcpl-coalesced-content-parity.test.d.ts.map +0 -1
  573. package/dist/test/mcpl-coalesced-content-parity.test.js +0 -532
  574. package/dist/test/mcpl-coalesced-content-parity.test.js.map +0 -1
  575. package/dist/test/mcpl-coalescing.test.d.ts +0 -2
  576. package/dist/test/mcpl-coalescing.test.d.ts.map +0 -1
  577. package/dist/test/mcpl-coalescing.test.js +0 -1125
  578. package/dist/test/mcpl-coalescing.test.js.map +0 -1
  579. package/dist/test/mcpl-config-diagnostics.test.d.ts +0 -2
  580. package/dist/test/mcpl-config-diagnostics.test.d.ts.map +0 -1
  581. package/dist/test/mcpl-config-diagnostics.test.js +0 -452
  582. package/dist/test/mcpl-config-diagnostics.test.js.map +0 -1
  583. package/dist/test/mcpl-empty-content.test.d.ts +0 -2
  584. package/dist/test/mcpl-empty-content.test.d.ts.map +0 -1
  585. package/dist/test/mcpl-empty-content.test.js +0 -368
  586. package/dist/test/mcpl-empty-content.test.js.map +0 -1
  587. package/dist/test/mcpl-gate-roundtrip.test.d.ts +0 -2
  588. package/dist/test/mcpl-gate-roundtrip.test.d.ts.map +0 -1
  589. package/dist/test/mcpl-gate-roundtrip.test.js +0 -285
  590. package/dist/test/mcpl-gate-roundtrip.test.js.map +0 -1
  591. package/dist/test/mcpl-list-status.test.d.ts +0 -2
  592. package/dist/test/mcpl-list-status.test.d.ts.map +0 -1
  593. package/dist/test/mcpl-list-status.test.js +0 -82
  594. package/dist/test/mcpl-list-status.test.js.map +0 -1
  595. package/dist/test/mcpl-manifest-changed.test.d.ts +0 -2
  596. package/dist/test/mcpl-manifest-changed.test.d.ts.map +0 -1
  597. package/dist/test/mcpl-manifest-changed.test.js +0 -178
  598. package/dist/test/mcpl-manifest-changed.test.js.map +0 -1
  599. package/dist/test/mcpl-push-convert.test.d.ts +0 -2
  600. package/dist/test/mcpl-push-convert.test.d.ts.map +0 -1
  601. package/dist/test/mcpl-push-convert.test.js +0 -42
  602. package/dist/test/mcpl-push-convert.test.js.map +0 -1
  603. package/dist/test/mcpl-reconnect-events.test.d.ts +0 -2
  604. package/dist/test/mcpl-reconnect-events.test.d.ts.map +0 -1
  605. package/dist/test/mcpl-reconnect-events.test.js +0 -144
  606. package/dist/test/mcpl-reconnect-events.test.js.map +0 -1
  607. package/dist/test/mcpl-reconnect-reregistration.test.d.ts +0 -2
  608. package/dist/test/mcpl-reconnect-reregistration.test.d.ts.map +0 -1
  609. package/dist/test/mcpl-reconnect-reregistration.test.js +0 -238
  610. package/dist/test/mcpl-reconnect-reregistration.test.js.map +0 -1
  611. package/dist/test/mcpl-reference-fetcher.test.d.ts +0 -2
  612. package/dist/test/mcpl-reference-fetcher.test.d.ts.map +0 -1
  613. package/dist/test/mcpl-reference-fetcher.test.js +0 -427
  614. package/dist/test/mcpl-reference-fetcher.test.js.map +0 -1
  615. package/dist/test/mcpl-reference-fields.test.d.ts +0 -2
  616. package/dist/test/mcpl-reference-fields.test.d.ts.map +0 -1
  617. package/dist/test/mcpl-reference-fields.test.js +0 -149
  618. package/dist/test/mcpl-reference-fields.test.js.map +0 -1
  619. package/dist/test/mcpl-rejection-log-lines.test.d.ts +0 -2
  620. package/dist/test/mcpl-rejection-log-lines.test.d.ts.map +0 -1
  621. package/dist/test/mcpl-rejection-log-lines.test.js +0 -349
  622. package/dist/test/mcpl-rejection-log-lines.test.js.map +0 -1
  623. package/dist/test/mcpl-request-timeout.test.d.ts +0 -2
  624. package/dist/test/mcpl-request-timeout.test.d.ts.map +0 -1
  625. package/dist/test/mcpl-request-timeout.test.js +0 -138
  626. package/dist/test/mcpl-request-timeout.test.js.map +0 -1
  627. package/dist/test/mcpl-runtime-lifecycle.test.d.ts +0 -7
  628. package/dist/test/mcpl-runtime-lifecycle.test.d.ts.map +0 -1
  629. package/dist/test/mcpl-runtime-lifecycle.test.js +0 -142
  630. package/dist/test/mcpl-runtime-lifecycle.test.js.map +0 -1
  631. package/dist/test/mcpl-stderr-tail.test.d.ts +0 -2
  632. package/dist/test/mcpl-stderr-tail.test.d.ts.map +0 -1
  633. package/dist/test/mcpl-stderr-tail.test.js +0 -210
  634. package/dist/test/mcpl-stderr-tail.test.js.map +0 -1
  635. package/dist/test/mcpl-tool-class-listing.test.d.ts +0 -2
  636. package/dist/test/mcpl-tool-class-listing.test.d.ts.map +0 -1
  637. package/dist/test/mcpl-tool-class-listing.test.js +0 -147
  638. package/dist/test/mcpl-tool-class-listing.test.js.map +0 -1
  639. package/dist/test/mcpl-tool-classes.test.d.ts +0 -7
  640. package/dist/test/mcpl-tool-classes.test.d.ts.map +0 -1
  641. package/dist/test/mcpl-tool-classes.test.js +0 -80
  642. package/dist/test/mcpl-tool-classes.test.js.map +0 -1
  643. package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts +0 -2
  644. package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts.map +0 -1
  645. package/dist/test/mcpl-tool-lifecycle-e2e.test.js +0 -237
  646. package/dist/test/mcpl-tool-lifecycle-e2e.test.js.map +0 -1
  647. package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts +0 -11
  648. package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts.map +0 -1
  649. package/dist/test/mcpl-tool-lifecycle-emitter.test.js +0 -412
  650. package/dist/test/mcpl-tool-lifecycle-emitter.test.js.map +0 -1
  651. package/dist/test/mcpl-tool-lifecycle-script.test.d.ts +0 -2
  652. package/dist/test/mcpl-tool-lifecycle-script.test.d.ts.map +0 -1
  653. package/dist/test/mcpl-tool-lifecycle-script.test.js +0 -288
  654. package/dist/test/mcpl-tool-lifecycle-script.test.js.map +0 -1
  655. package/dist/test/mcpl-tool-lifecycle.test.d.ts +0 -11
  656. package/dist/test/mcpl-tool-lifecycle.test.d.ts.map +0 -1
  657. package/dist/test/mcpl-tool-lifecycle.test.js +0 -270
  658. package/dist/test/mcpl-tool-lifecycle.test.js.map +0 -1
  659. package/dist/test/mcpl-transport-close.test.d.ts +0 -2
  660. package/dist/test/mcpl-transport-close.test.d.ts.map +0 -1
  661. package/dist/test/mcpl-transport-close.test.js +0 -373
  662. package/dist/test/mcpl-transport-close.test.js.map +0 -1
  663. package/dist/test/mcpl-transport-spawn.test.d.ts +0 -2
  664. package/dist/test/mcpl-transport-spawn.test.d.ts.map +0 -1
  665. package/dist/test/mcpl-transport-spawn.test.js +0 -58
  666. package/dist/test/mcpl-transport-spawn.test.js.map +0 -1
  667. package/dist/test/mcpl-ws-transport.test.d.ts +0 -2
  668. package/dist/test/mcpl-ws-transport.test.d.ts.map +0 -1
  669. package/dist/test/mcpl-ws-transport.test.js +0 -259
  670. package/dist/test/mcpl-ws-transport.test.js.map +0 -1
  671. package/dist/test/module-context-integration.test.d.ts +0 -18
  672. package/dist/test/module-context-integration.test.d.ts.map +0 -1
  673. package/dist/test/module-context-integration.test.js +0 -181
  674. package/dist/test/module-context-integration.test.js.map +0 -1
  675. package/dist/test/offline-recovery-branch.test.d.ts +0 -2
  676. package/dist/test/offline-recovery-branch.test.d.ts.map +0 -1
  677. package/dist/test/offline-recovery-branch.test.js +0 -570
  678. package/dist/test/offline-recovery-branch.test.js.map +0 -1
  679. package/dist/test/operator-surgery.test.d.ts +0 -2
  680. package/dist/test/operator-surgery.test.d.ts.map +0 -1
  681. package/dist/test/operator-surgery.test.js +0 -595
  682. package/dist/test/operator-surgery.test.js.map +0 -1
  683. package/dist/test/ops-alert.test.d.ts +0 -2
  684. package/dist/test/ops-alert.test.d.ts.map +0 -1
  685. package/dist/test/ops-alert.test.js +0 -153
  686. package/dist/test/ops-alert.test.js.map +0 -1
  687. package/dist/test/overbudget-drain-breaker.test.d.ts +0 -2
  688. package/dist/test/overbudget-drain-breaker.test.d.ts.map +0 -1
  689. package/dist/test/overbudget-drain-breaker.test.js +0 -198
  690. package/dist/test/overbudget-drain-breaker.test.js.map +0 -1
  691. package/dist/test/pack-installs-alone.test.d.ts +0 -2
  692. package/dist/test/pack-installs-alone.test.d.ts.map +0 -1
  693. package/dist/test/pack-installs-alone.test.js +0 -284
  694. package/dist/test/pack-installs-alone.test.js.map +0 -1
  695. package/dist/test/per-agent-delivery.test.d.ts +0 -2
  696. package/dist/test/per-agent-delivery.test.d.ts.map +0 -1
  697. package/dist/test/per-agent-delivery.test.js +0 -108
  698. package/dist/test/per-agent-delivery.test.js.map +0 -1
  699. package/dist/test/physical-window-restart.test.d.ts +0 -16
  700. package/dist/test/physical-window-restart.test.d.ts.map +0 -1
  701. package/dist/test/physical-window-restart.test.js +0 -487
  702. package/dist/test/physical-window-restart.test.js.map +0 -1
  703. package/dist/test/placed-reaction-baseline.test.d.ts +0 -2
  704. package/dist/test/placed-reaction-baseline.test.d.ts.map +0 -1
  705. package/dist/test/placed-reaction-baseline.test.js +0 -312
  706. package/dist/test/placed-reaction-baseline.test.js.map +0 -1
  707. package/dist/test/present-while-acting.test.d.ts +0 -19
  708. package/dist/test/present-while-acting.test.d.ts.map +0 -1
  709. package/dist/test/present-while-acting.test.js +0 -1649
  710. package/dist/test/present-while-acting.test.js.map +0 -1
  711. package/dist/test/prose-segments.test.d.ts +0 -2
  712. package/dist/test/prose-segments.test.d.ts.map +0 -1
  713. package/dist/test/prose-segments.test.js +0 -52
  714. package/dist/test/prose-segments.test.js.map +0 -1
  715. package/dist/test/prose-stream-router.test.d.ts +0 -2
  716. package/dist/test/prose-stream-router.test.d.ts.map +0 -1
  717. package/dist/test/prose-stream-router.test.js +0 -171
  718. package/dist/test/prose-stream-router.test.js.map +0 -1
  719. package/dist/test/provider-acceleration-cooldown.test.d.ts +0 -2
  720. package/dist/test/provider-acceleration-cooldown.test.d.ts.map +0 -1
  721. package/dist/test/provider-acceleration-cooldown.test.js +0 -435
  722. package/dist/test/provider-acceleration-cooldown.test.js.map +0 -1
  723. package/dist/test/provider-waits.test.d.ts +0 -2
  724. package/dist/test/provider-waits.test.d.ts.map +0 -1
  725. package/dist/test/provider-waits.test.js +0 -2259
  726. package/dist/test/provider-waits.test.js.map +0 -1
  727. package/dist/test/puppet-tool-call.test.d.ts +0 -2
  728. package/dist/test/puppet-tool-call.test.d.ts.map +0 -1
  729. package/dist/test/puppet-tool-call.test.js +0 -226
  730. package/dist/test/puppet-tool-call.test.js.map +0 -1
  731. package/dist/test/puppet-turn-reservation.test.d.ts +0 -2
  732. package/dist/test/puppet-turn-reservation.test.d.ts.map +0 -1
  733. package/dist/test/puppet-turn-reservation.test.js +0 -139
  734. package/dist/test/puppet-turn-reservation.test.js.map +0 -1
  735. package/dist/test/reaction-baseline-platform.test.d.ts +0 -2
  736. package/dist/test/reaction-baseline-platform.test.d.ts.map +0 -1
  737. package/dist/test/reaction-baseline-platform.test.js +0 -124
  738. package/dist/test/reaction-baseline-platform.test.js.map +0 -1
  739. package/dist/test/record-journal.test.d.ts +0 -6
  740. package/dist/test/record-journal.test.d.ts.map +0 -1
  741. package/dist/test/record-journal.test.js +0 -269
  742. package/dist/test/record-journal.test.js.map +0 -1
  743. package/dist/test/refusal-reaction-baseline.test.d.ts +0 -2
  744. package/dist/test/refusal-reaction-baseline.test.d.ts.map +0 -1
  745. package/dist/test/refusal-reaction-baseline.test.js +0 -81
  746. package/dist/test/refusal-reaction-baseline.test.js.map +0 -1
  747. package/dist/test/refusal-rewind.test.d.ts +0 -2
  748. package/dist/test/refusal-rewind.test.d.ts.map +0 -1
  749. package/dist/test/refusal-rewind.test.js +0 -117
  750. package/dist/test/refusal-rewind.test.js.map +0 -1
  751. package/dist/test/refusal-single-call.test.d.ts +0 -2
  752. package/dist/test/refusal-single-call.test.d.ts.map +0 -1
  753. package/dist/test/refusal-single-call.test.js +0 -177
  754. package/dist/test/refusal-single-call.test.js.map +0 -1
  755. package/dist/test/release-bump.test.d.ts +0 -2
  756. package/dist/test/release-bump.test.d.ts.map +0 -1
  757. package/dist/test/release-bump.test.js +0 -248
  758. package/dist/test/release-bump.test.js.map +0 -1
  759. package/dist/test/release-changelog.test.d.ts +0 -2
  760. package/dist/test/release-changelog.test.d.ts.map +0 -1
  761. package/dist/test/release-changelog.test.js +0 -159
  762. package/dist/test/release-changelog.test.js.map +0 -1
  763. package/dist/test/release-holds.test.d.ts +0 -2
  764. package/dist/test/release-holds.test.d.ts.map +0 -1
  765. package/dist/test/release-holds.test.js +0 -456
  766. package/dist/test/release-holds.test.js.map +0 -1
  767. package/dist/test/same-round-think-policy.test.d.ts +0 -2
  768. package/dist/test/same-round-think-policy.test.d.ts.map +0 -1
  769. package/dist/test/same-round-think-policy.test.js +0 -853
  770. package/dist/test/same-round-think-policy.test.js.map +0 -1
  771. package/dist/test/save-recent-image.test.d.ts +0 -26
  772. package/dist/test/save-recent-image.test.d.ts.map +0 -1
  773. package/dist/test/save-recent-image.test.js +0 -974
  774. package/dist/test/save-recent-image.test.js.map +0 -1
  775. package/dist/test/shutdown-errors.test.d.ts +0 -2
  776. package/dist/test/shutdown-errors.test.d.ts.map +0 -1
  777. package/dist/test/shutdown-errors.test.js +0 -662
  778. package/dist/test/shutdown-errors.test.js.map +0 -1
  779. package/dist/test/silent-heartbeat-rows.test.d.ts +0 -2
  780. package/dist/test/silent-heartbeat-rows.test.d.ts.map +0 -1
  781. package/dist/test/silent-heartbeat-rows.test.js +0 -451
  782. package/dist/test/silent-heartbeat-rows.test.js.map +0 -1
  783. package/dist/test/silent-heartbeat.test.d.ts +0 -2
  784. package/dist/test/silent-heartbeat.test.d.ts.map +0 -1
  785. package/dist/test/silent-heartbeat.test.js +0 -165
  786. package/dist/test/silent-heartbeat.test.js.map +0 -1
  787. package/dist/test/state-scaling-e2e.test.d.ts +0 -22
  788. package/dist/test/state-scaling-e2e.test.d.ts.map +0 -1
  789. package/dist/test/state-scaling-e2e.test.js +0 -206
  790. package/dist/test/state-scaling-e2e.test.js.map +0 -1
  791. package/dist/test/state-scaling.test.d.ts +0 -12
  792. package/dist/test/state-scaling.test.d.ts.map +0 -1
  793. package/dist/test/state-scaling.test.js +0 -251
  794. package/dist/test/state-scaling.test.js.map +0 -1
  795. package/dist/test/stop-with-host-operations.test.d.ts +0 -20
  796. package/dist/test/stop-with-host-operations.test.d.ts.map +0 -1
  797. package/dist/test/stop-with-host-operations.test.js +0 -1174
  798. package/dist/test/stop-with-host-operations.test.js.map +0 -1
  799. package/dist/test/stop-with-work-in-flight.test.d.ts +0 -23
  800. package/dist/test/stop-with-work-in-flight.test.d.ts.map +0 -1
  801. package/dist/test/stop-with-work-in-flight.test.js +0 -784
  802. package/dist/test/stop-with-work-in-flight.test.js.map +0 -1
  803. package/dist/test/surgery-marks-receipt.test.d.ts +0 -2
  804. package/dist/test/surgery-marks-receipt.test.d.ts.map +0 -1
  805. package/dist/test/surgery-marks-receipt.test.js +0 -540
  806. package/dist/test/surgery-marks-receipt.test.js.map +0 -1
  807. package/dist/test/thinking-token-stamp.test.d.ts +0 -12
  808. package/dist/test/thinking-token-stamp.test.d.ts.map +0 -1
  809. package/dist/test/thinking-token-stamp.test.js +0 -129
  810. package/dist/test/thinking-token-stamp.test.js.map +0 -1
  811. package/dist/test/timezone.test.d.ts +0 -2
  812. package/dist/test/timezone.test.d.ts.map +0 -1
  813. package/dist/test/timezone.test.js +0 -18
  814. package/dist/test/timezone.test.js.map +0 -1
  815. package/dist/test/tool-batch-hook.test.d.ts +0 -8
  816. package/dist/test/tool-batch-hook.test.d.ts.map +0 -1
  817. package/dist/test/tool-batch-hook.test.js +0 -275
  818. package/dist/test/tool-batch-hook.test.js.map +0 -1
  819. package/dist/test/tool-policy.test.d.ts +0 -2
  820. package/dist/test/tool-policy.test.d.ts.map +0 -1
  821. package/dist/test/tool-policy.test.js +0 -51
  822. package/dist/test/tool-policy.test.js.map +0 -1
  823. package/dist/test/tool-presentation.test.d.ts +0 -2
  824. package/dist/test/tool-presentation.test.d.ts.map +0 -1
  825. package/dist/test/tool-presentation.test.js +0 -268
  826. package/dist/test/tool-presentation.test.js.map +0 -1
  827. package/dist/test/tool-result-content.test.d.ts +0 -2
  828. package/dist/test/tool-result-content.test.d.ts.map +0 -1
  829. package/dist/test/tool-result-content.test.js +0 -37
  830. package/dist/test/tool-result-content.test.js.map +0 -1
  831. package/dist/test/tool-result-guard.test.d.ts +0 -2
  832. package/dist/test/tool-result-guard.test.d.ts.map +0 -1
  833. package/dist/test/tool-result-guard.test.js +0 -3729
  834. package/dist/test/tool-result-guard.test.js.map +0 -1
  835. package/dist/test/tool-result-history.test.d.ts +0 -7
  836. package/dist/test/tool-result-history.test.d.ts.map +0 -1
  837. package/dist/test/tool-result-history.test.js +0 -156
  838. package/dist/test/tool-result-history.test.js.map +0 -1
  839. package/dist/test/tool-result-spill.test.d.ts +0 -13
  840. package/dist/test/tool-result-spill.test.d.ts.map +0 -1
  841. package/dist/test/tool-result-spill.test.js +0 -586
  842. package/dist/test/tool-result-spill.test.js.map +0 -1
  843. package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts +0 -2
  844. package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts.map +0 -1
  845. package/dist/test/tool-wrapper-prose-guard-integration.test.js +0 -485
  846. package/dist/test/tool-wrapper-prose-guard-integration.test.js.map +0 -1
  847. package/dist/test/tool-wrapper-prose-guard.test.d.ts +0 -2
  848. package/dist/test/tool-wrapper-prose-guard.test.d.ts.map +0 -1
  849. package/dist/test/tool-wrapper-prose-guard.test.js +0 -34
  850. package/dist/test/tool-wrapper-prose-guard.test.js.map +0 -1
  851. package/dist/test/tools-observe-parser-conformance.test.d.ts +0 -2
  852. package/dist/test/tools-observe-parser-conformance.test.d.ts.map +0 -1
  853. package/dist/test/tools-observe-parser-conformance.test.js +0 -129
  854. package/dist/test/tools-observe-parser-conformance.test.js.map +0 -1
  855. package/dist/test/trunk-channel-routing.test.d.ts +0 -19
  856. package/dist/test/trunk-channel-routing.test.d.ts.map +0 -1
  857. package/dist/test/trunk-channel-routing.test.js +0 -652
  858. package/dist/test/trunk-channel-routing.test.js.map +0 -1
  859. package/dist/test/tune-out-e2e.test.d.ts +0 -2
  860. package/dist/test/tune-out-e2e.test.d.ts.map +0 -1
  861. package/dist/test/tune-out-e2e.test.js +0 -142
  862. package/dist/test/tune-out-e2e.test.js.map +0 -1
  863. package/dist/test/tune-out-gate-composition.test.d.ts +0 -2
  864. package/dist/test/tune-out-gate-composition.test.d.ts.map +0 -1
  865. package/dist/test/tune-out-gate-composition.test.js +0 -221
  866. package/dist/test/tune-out-gate-composition.test.js.map +0 -1
  867. package/dist/test/tune-out-lifecycle.test.d.ts +0 -2
  868. package/dist/test/tune-out-lifecycle.test.d.ts.map +0 -1
  869. package/dist/test/tune-out-lifecycle.test.js +0 -121
  870. package/dist/test/tune-out-lifecycle.test.js.map +0 -1
  871. package/dist/test/turn-trigger-provenance.test.d.ts +0 -2
  872. package/dist/test/turn-trigger-provenance.test.d.ts.map +0 -1
  873. package/dist/test/turn-trigger-provenance.test.js +0 -137
  874. package/dist/test/turn-trigger-provenance.test.js.map +0 -1
  875. package/dist/test/unconvertible-tool-result.test.d.ts +0 -2
  876. package/dist/test/unconvertible-tool-result.test.d.ts.map +0 -1
  877. package/dist/test/unconvertible-tool-result.test.js +0 -358
  878. package/dist/test/unconvertible-tool-result.test.js.map +0 -1
  879. package/dist/test/unsent-compiles.test.d.ts +0 -2
  880. package/dist/test/unsent-compiles.test.d.ts.map +0 -1
  881. package/dist/test/unsent-compiles.test.js +0 -139
  882. package/dist/test/unsent-compiles.test.js.map +0 -1
  883. package/dist/test/usage-accounting.test.d.ts +0 -2
  884. package/dist/test/usage-accounting.test.d.ts.map +0 -1
  885. package/dist/test/usage-accounting.test.js +0 -13
  886. package/dist/test/usage-accounting.test.js.map +0 -1
  887. package/dist/test/usage-tracker.test.d.ts +0 -2
  888. package/dist/test/usage-tracker.test.d.ts.map +0 -1
  889. package/dist/test/usage-tracker.test.js +0 -129
  890. package/dist/test/usage-tracker.test.js.map +0 -1
  891. package/dist/test/utils-surface.test.d.ts +0 -2
  892. package/dist/test/utils-surface.test.d.ts.map +0 -1
  893. package/dist/test/utils-surface.test.js +0 -145
  894. package/dist/test/utils-surface.test.js.map +0 -1
  895. package/dist/test/workspace-branch-continuation.test.d.ts +0 -15
  896. package/dist/test/workspace-branch-continuation.test.d.ts.map +0 -1
  897. package/dist/test/workspace-branch-continuation.test.js +0 -183
  898. package/dist/test/workspace-branch-continuation.test.js.map +0 -1
  899. package/dist/test/workspace-materialize-freshness.test.d.ts +0 -16
  900. package/dist/test/workspace-materialize-freshness.test.d.ts.map +0 -1
  901. package/dist/test/workspace-materialize-freshness.test.js +0 -252
  902. package/dist/test/workspace-materialize-freshness.test.js.map +0 -1
  903. package/dist/test/workspace-path-containment.test.d.ts +0 -19
  904. package/dist/test/workspace-path-containment.test.d.ts.map +0 -1
  905. package/dist/test/workspace-path-containment.test.js +0 -91
  906. package/dist/test/workspace-path-containment.test.js.map +0 -1
  907. package/dist/test/workspace-read-file-from-disk.test.d.ts +0 -17
  908. package/dist/test/workspace-read-file-from-disk.test.d.ts.map +0 -1
  909. package/dist/test/workspace-read-file-from-disk.test.js +0 -174
  910. package/dist/test/workspace-read-file-from-disk.test.js.map +0 -1
  911. package/dist/test/workspace-read-image.test.d.ts +0 -2
  912. package/dist/test/workspace-read-image.test.d.ts.map +0 -1
  913. package/dist/test/workspace-read-image.test.js +0 -597
  914. package/dist/test/workspace-read-image.test.js.map +0 -1
  915. package/dist/test/workspace-read-text.test.d.ts +0 -2
  916. package/dist/test/workspace-read-text.test.d.ts.map +0 -1
  917. package/dist/test/workspace-read-text.test.js +0 -101
  918. package/dist/test/workspace-read-text.test.js.map +0 -1
  919. package/dist/test/workspace-restore-order.test.d.ts +0 -16
  920. package/dist/test/workspace-restore-order.test.d.ts.map +0 -1
  921. package/dist/test/workspace-restore-order.test.js +0 -140
  922. package/dist/test/workspace-restore-order.test.js.map +0 -1
  923. package/dist/test/workspace-three-way.test.d.ts +0 -12
  924. package/dist/test/workspace-three-way.test.d.ts.map +0 -1
  925. package/dist/test/workspace-three-way.test.js +0 -4094
  926. package/dist/test/workspace-three-way.test.js.map +0 -1
  927. package/dist/test/workspace-watcher.test.d.ts +0 -2
  928. package/dist/test/workspace-watcher.test.d.ts.map +0 -1
  929. package/dist/test/workspace-watcher.test.js +0 -281
  930. package/dist/test/workspace-watcher.test.js.map +0 -1
  931. package/dist/test/xml-round-persist.test.d.ts +0 -19
  932. package/dist/test/xml-round-persist.test.d.ts.map +0 -1
  933. package/dist/test/xml-round-persist.test.js +0 -235
  934. package/dist/test/xml-round-persist.test.js.map +0 -1
  935. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -104,6 +104,19 @@ export declare class ResumeBlockedError extends Error {
104
104
  preview: RuntimeSettingsPreview;
105
105
  }>);
106
106
  }
107
+ /**
108
+ * Thrown by `quiesce()` without `abandon` when the queue of deferred context
109
+ * writes can't reach disk: it's over its cap, so its record can't hold it, or
110
+ * its write failed, and that error is the `cause`. So the queue as it
111
+ * stands isn't on disk. The host's mode is as it was, and the
112
+ * message names the ways out, among them quiescing with `abandon: true`,
113
+ * which goes on with the queue in memory.
114
+ */
115
+ export declare class QuiesceBlockedError extends Error {
116
+ constructor(message: string, options?: {
117
+ cause?: unknown;
118
+ });
119
+ }
107
120
  /**
108
121
  * How `runEphemeralToCompletion` rejects when a retryable provider failure
109
122
  * states a wait the run won't sleep: one longer than an ephemeral run sleeps
@@ -190,10 +203,22 @@ export declare class AgentFramework {
190
203
  private stopPromise;
191
204
  private stopCompleted;
192
205
  private ownedStoreClosed;
206
+ /** Whether the latest stop() stopped in time everything it waits on with
207
+ * its deadline (an operator's operations, modules and MCPL servers),
208
+ * whatever failed after that. create()'s release reads it to say whether
209
+ * part of what a failed create() started may still be running. */
210
+ private stopFinishedTeardown;
193
211
  /** An operator's operations in flight, and the config materializations they
194
212
  * start. stop() waits until this set is empty before it tears down, unless
195
213
  * its wait budget runs out. */
196
214
  private readonly operatorOperations;
215
+ /** What a wait of stop()'s left running when its budget ran out, by its
216
+ * promise: a stream it cancelled or an event loop still in a call. A later
217
+ * stop() waits for each again, beside what it finds, whatever has happened
218
+ * since to the entry it was found under (a run's end removes its stream's,
219
+ * a start() replaces the loop), so a budget never lets the store close
220
+ * under work still running. Each leaves once it settles. */
221
+ private readonly leftRunning;
197
222
  private membrane;
198
223
  private queue;
199
224
  private agents;
@@ -212,6 +237,16 @@ export declare class AgentFramework {
212
237
  * running; only new turns (wake gate in processInferenceRequests) and MCPL
213
238
  * data planes are held. */
214
239
  private quiesced;
240
+ /** Whether the host-mode record may say quiesced, as this process last read
241
+ * or wrote it. quiesce() writes the record before it sets `quiesced`, and
242
+ * resume() clears `quiesced` before the record, so after a resume whose
243
+ * clear failed, or a quiesce whose write failed partway, memory can say
244
+ * serving while the record says quiesced, until a resume() clears it. */
245
+ private hostModeRecordMayBeQuiesced;
246
+ /** Whether a resume() is between serving and clearing the record: it has
247
+ * cleared `quiesced` and is flushing the deferred writes, then clearing the
248
+ * record. A resume() on the serving host leaves the record to it. */
249
+ private resumeInFlight;
215
250
  private quiesceReason?;
216
251
  private quiescedAt?;
217
252
  private traceListeners;
@@ -252,6 +287,11 @@ export declare class AgentFramework {
252
287
  private processLoggingPersist;
253
288
  private processLoggingBroadcast;
254
289
  private activeStreams;
290
+ /** Told once per inbound acceptance (mcpl/inbound-source.ts). An internal
291
+ * seam, unset here: the receipt work (shelf-354) assigns it inside the
292
+ * framework, and tests set it by cast. */
293
+ private inboundAcceptanceObserver?;
294
+ private streamBoundaryEnds;
255
295
  /** A tool boundary injected fresh CONVERSATIONAL input (a real message —
256
296
  * not a reaction or a system marker) into the live stream. Tells
257
297
  * driveStream to clear sticky explicit-send suppression before handling
@@ -262,8 +302,11 @@ export declare class AgentFramework {
262
302
  * (KV-safe, no per-turn chatter). In-memory — after a process restart the
263
303
  * first turn's locus is announced once to re-establish the baseline. */
264
304
  private lastAnnouncedLocus;
265
- /** Latest bounced (undelivered) prose per agent — the `{{unsent}}` source. */
266
- private proseClipboards;
305
+ /** Every resident's held drafts: plain speech that was suppressed, bounced
306
+ * or left without a destination, never published except by their
307
+ * resident's resend, kept until resent or dismissed. A logical turn's own
308
+ * drafts, for its receipt, are its TurnRouting's. */
309
+ private proseDrafts;
267
310
  /**
268
311
  * Each agent's routing state for its current logical turn (TurnRouting):
269
312
  * its trigger channel, locus and engaged channels, the sticky destination,
@@ -329,7 +372,8 @@ export declare class AgentFramework {
329
372
  * The name is single-generation, so these frames still own their terminal
330
373
  * typing/outgoing close even after runEphemeralToCompletion deregisters them. */
331
374
  private disposedEphemeralFrames;
332
- /** Per-agent count of consecutive exhausted inferences (reset on any success).
375
+ /** Per-agent count of consecutive exhausted inferences, reset when a turn
376
+ * completes (inference:completed), not when a call answers mid-turn.
333
377
  * Drives hard-down escalation — see noteInferenceExhausted. */
334
378
  private consecutiveInferenceFailures;
335
379
  /** N consecutive failed inferences ⇒ the agent is treated as hard-down and
@@ -353,7 +397,8 @@ export declare class AgentFramework {
353
397
  * rewind loop — see refusalHandling + rewindTriggeringTurn. */
354
398
  private refusalRewinds;
355
399
  /** Per-agent count of poison-history rewinds performed by the hard-down
356
- * breaker (noteInferenceExhausted). Reset on any successful inference.
400
+ * breaker (noteInferenceExhausted). Reset when a turn completes
401
+ * (inference:completed).
357
402
  * Bounds the automatic quarantine loop the same way refusalRewinds bounds
358
403
  * the refusal loop, so the breaker can never shed the whole history. */
359
404
  private exhaustionRewinds;
@@ -387,9 +432,20 @@ export declare class AgentFramework {
387
432
  /** Agents an abandon could not cancel (token held, no stream) — surfaced
388
433
  * in HostModeStatus until the next quiesce/resume. */
389
434
  private lastUnabandonable;
390
- /** True while the deferred-write queue has a persisted mirror (quiesced). */
435
+ /** True while the deferred-write queue is mirrored to its record, so each
436
+ * change of it writes it: from a write of it that reached or may reach
437
+ * the record, one that failed or met the cap unless quiesce() rejected
438
+ * for it (deferredWritesFellBehind), or a boot that restored it, until a
439
+ * write clears the record once the queue drains. */
391
440
  private deferredWritesPersisted;
392
- private deferredWritesCapWarned;
441
+ /** True from a write of the queue that failed or met the cap, unless
442
+ * quiesce() rejected for it, until one succeeds: a run of failures
443
+ * (deferredWritesFellBehind). A quiesce({ abandon: true }) over the cap
444
+ * goes on rather than rejecting, so its write begins a run too. */
445
+ private deferredWritesBehind;
446
+ /** True once the cap has been met in the current run, so its line is
447
+ * logged once a run, whatever began the run. */
448
+ private deferredWritesCapLogged;
393
449
  /** Branch-independent recovery files (see FrameworkConfig.hostModePath /
394
450
  * deferredWritesPath). Undefined → branch-local slot fallback. */
395
451
  private hostModePath;
@@ -434,6 +490,11 @@ export declare class AgentFramework {
434
490
  private redoStacks;
435
491
  /** Liveness watchdog (fail hard on a wedged main thread). Null unless enabled. */
436
492
  private livenessWatchdog;
493
+ /** The frameworks a SIGUSR2 dumps (joinDiagnostics): each joins in create()
494
+ * where the liveness watchdog starts, or would if it isn't enabled, and
495
+ * leaves in stop() where the watchdog stops. */
496
+ private static readonly diagnosed;
497
+ private static diagnosticsListenerInstalled;
437
498
  private mcplServerRegistry;
438
499
  private featureSetManager;
439
500
  private hookOrchestrator;
@@ -462,7 +523,7 @@ export declare class AgentFramework {
462
523
  * ephemeral agents have isolated slots and are their own only readers.
463
524
  */
464
525
  private readonly sharedSlotAgents;
465
- /** Group commit: one fsync per event-loop turn, shared by every waiter. */
526
+ /** The coalescing commit in flight, if any (see commitCoalescingDurable). */
466
527
  private coalescingCommit;
467
528
  private inferenceRouter;
468
529
  private channelRegistry;
@@ -477,6 +538,9 @@ export declare class AgentFramework {
477
538
  * turn still lands in the right channel.
478
539
  */
479
540
  private conversationAgentHomes;
541
+ /** Forks being spawned, by channel id, each until its spawn settles (see
542
+ * routeConversation). The promise never rejects. */
543
+ private readonly conversationSpawns;
480
544
  /** Last idle-TTL sweep timestamp. */
481
545
  private lastConversationSweep;
482
546
  /** Forks whose TTL closure turn has been queued — disposed (removed from
@@ -489,7 +553,8 @@ export declare class AgentFramework {
489
553
  * result marks the script that made the call, and is applied to that
490
554
  * script's code_execution result instead of cancelling the stream
491
555
  * mid-script (which would wedge the turn). A stopped script's late result
492
- * marks only that script, never the agent's next one. */
556
+ * marks only that script, never the agent's next one. Its `turnId` is the
557
+ * turn of the code_execution call running it, which its calls carry. */
493
558
  private scriptDeferredEndTurn;
494
559
  /** RFC-007: per agent, the origin of the foreground script its runner is
495
560
  * executing, handed to that script's inner calls (scripts run one at a
@@ -565,30 +630,95 @@ export declare class AgentFramework {
565
630
  private discordAwarenessBarrierGeneration;
566
631
  private eventGate;
567
632
  private usageTracker;
568
- /** Explicit-send suppression carried into a tool-result-guard retry. */
633
+ /** Explicit-send or private suppression carried into a tool-result-guard retry. */
569
634
  private guardRetryTurnSilenced;
570
635
  /** Presentation-only wall-clock zone; persistence remains UTC/epoch. */
571
636
  private readonly timeZone;
572
637
  private constructor();
573
638
  /**
574
- * Create and start the framework.
639
+ * Create and start the framework. A create() that fails releases what it
640
+ * had acquired before its error reaches the caller, so that the caller can
641
+ * try again in the same process: the framework it had begun is stopped, as
642
+ * stop() stops one, but giving up after 30 s on each of stop()'s two cleanup
643
+ * waits, for an operator's operations already running and then for its
644
+ * modules and MCPL servers, and a store it opened is closed. A store the
645
+ * caller passed in is left open.
575
646
  */
576
647
  static create(config: FrameworkConfig): Promise<AgentFramework>;
648
+ /**
649
+ * The error a failed create() rejects with, once what it acquired is
650
+ * released: the framework it had begun is stopped, with
651
+ * FAILED_CREATE_TEARDOWN_TIMEOUT_MS as stop()'s teardownTimeoutMs, and a
652
+ * store create() opened is closed even when that stop failed or timed out.
653
+ * stop() keeps an owned store open when any of its waits fails or times
654
+ * out, so that it can be called again, but no one can call it on a
655
+ * framework that create() never returned. When the release doesn't finish
656
+ * cleanly, the rejection carries create()'s error and then the release's,
657
+ * and its message says what didn't finish.
658
+ */
659
+ private static releaseFailedCreate;
660
+ /** create()'s work once it holds its store. The framework is named in
661
+ * `building` as soon as it exists, so that create() can stop it if a later
662
+ * step fails. */
663
+ private static createOn;
664
+ /**
665
+ * Diagnostics: `kill -USR2 <pid>` dumps live wake/inference state to stderr
666
+ * (journal) without a restart — for catching the wake-wedge on the running
667
+ * process. Each framework prints its own line: the gate's `inferring` set
668
+ * and buffered-event count (the wedge signature), active streams, and
669
+ * pending inference requests. A framework joins partway through create(),
670
+ * once its agents, modules and event gate are built, where the liveness
671
+ * watchdog starts (or would, when it isn't enabled). It leaves in stop()
672
+ * where the watchdog stops: after stop() has waited on its streams,
673
+ * maintenance, event loop and operator operations, so a dump shows what
674
+ * those waits are on, and before its modules and MCPL servers stop, so a
675
+ * stop() whose teardown hangs, fails or times out doesn't keep it listed.
676
+ * With none in the set, one line says no framework is running. A framework
677
+ * started again after a completed stop() doesn't rejoin; whether that
678
+ * lifecycle is supported is #315.
679
+ *
680
+ * One listener serves the process, installed by the first create() to
681
+ * reach the join and kept: once a process's last SIGUSR2 listener is
682
+ * removed, the signal's default action ends the process, and a dump can
683
+ * arrive between one framework's stop() and the next one's create(), as on
684
+ * a host's session switch. Until a create() first reaches the join, the
685
+ * process has no listener, and the default action applies.
686
+ */
687
+ private static joinDiagnostics;
688
+ private printDiagnostics;
577
689
  /**
578
690
  * Start the event loop.
579
691
  */
580
692
  start(): void;
581
693
  /**
582
- * Stop the event loop. After a failed or timed-out wait on operator, module
583
- * or MCPL cleanup, storage stays open and stop() can be called again. A
584
- * timed-out wait lets teardown go on while that work may still act on what
585
- * is being torn down.
586
- * @param teardownTimeoutMs Optional budget for each wait on cleanup: an
587
- * operator's operations already running, then modules and MCPL together.
588
- * Omit to wait until cleanup settles, as required by existing module/child
589
- * contracts. This does not bound earlier stream, event-loop or maintenance
590
- * quiescence (a maintenance pass or over-budget drain kick in flight), or
591
- * cancel cleanup.
694
+ * Stop the event loop. After a failed or timed-out wait, storage stays open
695
+ * and stop() can be called again. A timed-out wait lets teardown go on while
696
+ * what it waited for may still act on what is being torn down.
697
+ * @param teardownTimeoutMs Optional budget for each of stop()'s waits, in
698
+ * turn: on the streams it cancels, on maintenance in flight (a pass or an
699
+ * over-budget drain kick), on the event loop, on an operator's operations
700
+ * already running, then on modules and MCPL together. With a budget, a
701
+ * stop() can take up to five of them, besides the withheld-spill deadline
702
+ * of a guard's write still under way. Omit to wait until each settles, as
703
+ * required by existing module/child contracts. A wait whose budget runs out
704
+ * fails the stop() with a ShutdownTimeoutError naming what it waited for;
705
+ * with more than one, or beside another failure, stop() fails with an
706
+ * AggregateError of them all. After it:
707
+ * - an agent still registered whose stream is still running keeps its
708
+ * deferred writes queued, since the stream may still write. The stream's
709
+ * own turn-end flush takes them when it settles, if the process lives on,
710
+ * and a later stop() takes what that leaves; a memory-only queue loses
711
+ * them if the process exits first.
712
+ * - every ephemeral run still registered is ended, as after any stop(), and
713
+ * its end stores what is queued for it, as at any run's end, whatever its
714
+ * stream is doing: once a run has left, its stream's late events are
715
+ * dropped, though a write the stream already had under way can still
716
+ * land in the run's namespace after them.
717
+ * - an event loop still in a call, such as a module's onProcess, finishes
718
+ * that call and the rest of its iteration, and then exits. A start()
719
+ * made meanwhile runs its own loop beside that last iteration.
720
+ * - a later stop() waits again, within its own budget, for any stream or
721
+ * loop this one left running, so the store never closes under it.
592
722
  */
593
723
  stop(teardownTimeoutMs?: number | undefined): Promise<void>;
594
724
  private resetCompletedStop;
@@ -791,23 +921,12 @@ export declare class AgentFramework {
791
921
  /** The strategy's progress snapshot, for diagnostics: one it can't give reads as none. */
792
922
  private contextProgress;
793
923
  /**
794
- * A server's request or notification the host couldn't handle, answered
795
- * with a JSON-RPC error when it is a request (a notification has no one to
796
- * answer, and is logged), rather than thrown out of the connection's
797
- * listener, where it was an unhandled rejection and the server's request
798
- * waited for its timeout.
799
- * - `refused`: the listener turned it away before its handler ran; the
800
- * host is stopping, and none of it was taken. Answered -32000, "the host
801
- * is stopping", the code the push coalescer already gives a stopping
802
- * host: the server can send it again to the host's next run.
803
- * - `failed`: the handler threw, whatever it threw, `undefined` included.
804
- * While the host stops (its queue closed), that's answered -32000 too,
805
- * with the handler's own message after the stop wording; on a live host
806
- * it's a fault, answered -32603 with the handler's message. The handler
807
- * may have admitted part of the request first (an earlier message of a
808
- * batch), so nothing here claims that none of it was taken.
809
- * A request the handler already answered before it threw isn't answered
810
- * again: the failure is logged.
924
+ * A server's request turned away before its handler ran, because the host
925
+ * is stopping and none of it was taken: answered -32000, "the host is
926
+ * stopping", the code the push coalescer already gives a stopping host, so
927
+ * the server can send it again to the host's next run, and logged. A
928
+ * handler's own failure is answered by containedInboundHandler, with
929
+ * -32000 and the stop wording alone once the host is stopping.
811
930
  */
812
931
  private refuseServerItem;
813
932
  /**
@@ -873,6 +992,40 @@ export declare class AgentFramework {
873
992
  * Abort an in-flight inference for an agent.
874
993
  */
875
994
  abortInference(agentName: string, reason?: string): boolean;
995
+ /**
996
+ * Terminal for a deliberate cancellation of a live stream: the host's Stop
997
+ * button, an admin abort, a subagent reclaim — anything that went through
998
+ * Agent.cancelStream(reason) / abortInference(reason). Both of a stream's
999
+ * cancel twins land here (`aborted` with wire reason 'user', or `error`
1000
+ * for implementations that report cancel() that way — see
1001
+ * host-quiesce.test.ts), so the two cannot drift: settle the turn, ONE
1002
+ * inference:aborted carrying the caller's reason, the neutral
1003
+ * [turn-interrupted] marker, an attributable inference-log terminal, gate
1004
+ * release. Deliberately none of the failure accounting: inference:failed /
1005
+ * inference:exhausted feed the consecutive-failure streak, hard-down ops
1006
+ * alerts, the poison-history breaker and the "[inference-failed]" marker —
1007
+ * all of which told a resident, in the user's voice, that its turn failed
1008
+ * and advised remediation for a failure that never happened — and
1009
+ * errorPolicy would relaunch the very inference someone just stopped.
1010
+ *
1011
+ * Only called while `agent` still owns stream `myStreamId`.
1012
+ */
1013
+ private settleDeliberateCancel;
1014
+ /**
1015
+ * Terminal for a stop the framework itself made: stop()'s shutdown and an
1016
+ * operator's quiesce abandon, each recorded in frameworkCancelledStreams
1017
+ * before the cancel. A stream may report that cancel as `aborted`, as
1018
+ * `error`, or by just closing, and each of those ends here, so the three
1019
+ * cannot drift: settle the turn (an ephemeral run rejects with the stop's
1020
+ * own text), an attributable inference-log terminal, ONE inference:aborted
1021
+ * carrying the framework's reason, gate release. No [turn-interrupted]
1022
+ * marker, since nobody stopped the agent, and none of the failure
1023
+ * accounting that inference:failed / inference:exhausted drive.
1024
+ *
1025
+ * The script abort, reset and settle happen only while `agent` still owns
1026
+ * stream `myStreamId`; the log line and the trace are written either way.
1027
+ */
1028
+ private settleFrameworkCancel;
876
1029
  /**
877
1030
  * Get all registered modules.
878
1031
  */
@@ -935,7 +1088,11 @@ export declare class AgentFramework {
935
1088
  private guardSpillsClosedFor;
936
1089
  /** A new agent's guard: its persisted setting, the tool-results spill its
937
1090
  * withheld originals are written to, and the set stop() waits on
938
- * (agent-framework #277). */
1091
+ * (agent-framework #277). The setting is read from framework/state's
1092
+ * toolResultGuards by the agent's own name. A read that fails, or a
1093
+ * toolResultGuards that isn't an object, throws, naming the state: taken
1094
+ * as no setting, the agent would take its recipe's guard, and the next
1095
+ * guard change would store over a toolResultGuards that isn't an object. */
939
1096
  private adoptToolResultGuard;
940
1097
  /** Each guard that may have queued storage work, once, by agent name: the
941
1098
  * live agents' and every other that isn't idle. */
@@ -1014,9 +1171,15 @@ export declare class AgentFramework {
1014
1171
  static readonly QUIESCE_TIMEOUT_MAX_MS = 600000;
1015
1172
  static readonly QUIESCE_TIMEOUT_DEFAULT_MS = 120000;
1016
1173
  /**
1017
- * Enter quiesce mode: persist the flag, suppress gate deliveries, pause all
1018
- * MCPL data planes, and wait for in-flight turns to settle (turn-alive is
1019
- * `activeTurnTokens`, which spans dequeue → settled teardown). Idempotent.
1174
+ * Enter quiesce mode: write the deferred-write queue, persist the flag,
1175
+ * suppress gate deliveries, pause all MCPL data planes, and wait for
1176
+ * in-flight turns to settle (turn-alive is `activeTurnTokens`, which spans
1177
+ * dequeue → settled teardown). Idempotent, but for the queue's write, which
1178
+ * every call makes first: when the queue can't reach disk, because its
1179
+ * write fails or it's over the cap, the call rejects with a
1180
+ * QuiesceBlockedError and the host's mode as it was, unless it has
1181
+ * `abandon`, which goes on with the queue in memory and an alert
1182
+ * (writeDeferredWritesForQuiesce).
1020
1183
  *
1021
1184
  * On drain timeout the host STAYS quiesced (`drained: false` in the
1022
1185
  * result); with `abandon: true` the undrained streams are cancelled via a
@@ -1046,12 +1209,18 @@ export declare class AgentFramework {
1046
1209
  }): Promise<HostModeStatus>;
1047
1210
  private runResume;
1048
1211
  /**
1049
- * Land every deferred write whose target has no turn alive, one at a time,
1050
- * acknowledging each durably as it lands (the persisted queue is rewritten
1051
- * after every message). A crash mid-flush therefore replays exactly the
1052
- * un-acked remainder at the next boot — no loss, no duplicates. A write
1053
- * the store REJECTS is logged and acked too: replaying a poison message
1054
- * forever would wedge every later boot on it.
1212
+ * Land every deferred write whose target has no turn alive, as one batch
1213
+ * acknowledged once: the chronicle is synced, then the persisted queue is
1214
+ * rewritten without the batch (ackDeferredWrites). Until then the batch
1215
+ * stays in the durable queue, so a crash mid-flush replays it at the next
1216
+ * boot, which skips each entry that already landed, by its deferredWriteId
1217
+ * — no loss, no duplicates. The batch is stored in queue order, whatever
1218
+ * its targets (writeDrainedInOrder). A write the store rejects stays
1219
+ * queued, logged, with what is queued behind it for its target, so the
1220
+ * flush never stores that target's later entries ahead of it, and other
1221
+ * targets' entries go on. (A write that isn't deferred can still land
1222
+ * ahead of it, such as one for an idle agent once the host has resumed.)
1223
+ * A boot that meets it again logs it and goes on.
1055
1224
  *
1056
1225
  * Per-target: an agent whose turn is still alive keeps ITS messages
1057
1226
  * deferred for its own turn boundary; everyone else's flush now.
@@ -1078,12 +1247,38 @@ export declare class AgentFramework {
1078
1247
  * Which of `ids` already exist in some agent's store as a landed deferred
1079
1248
  * write (`metadata.deferredWriteId`). Scans each context manager's recent
1080
1249
  * tail blob-free — an interrupted flush is always within the last few
1081
- * hundred slots — and tolerates facades without windowed reads.
1250
+ * hundred slots — and tolerates facades without windowed reads. A context
1251
+ * that can't be read throws, naming its agent: counted as holding none, a
1252
+ * write that landed there before its ack would land a second time.
1082
1253
  */
1083
1254
  private landedDeferredWriteIds;
1084
- /** Atomic JSON write for the recovery files (tmp + rename, 0600) — the
1085
- * same idiom as the Discord awareness outbox. */
1255
+ /** Atomic, durable JSON write for the recovery files. The document goes to
1256
+ * a temp file at 0600, which is synced and renamed over the record, so
1257
+ * the new record's data is asked to reach the disk before the rename
1258
+ * publishes it. Then the directory is synced, for the record's entry in
1259
+ * it, and its parent, for the directory's own entry, which is new when a
1260
+ * write, this one or an earlier one, had to make the directory; levels
1261
+ * above are left to the filesystem. Directories aren't synced on win32,
1262
+ * which syncs the file alone, or where the filesystem can't sync one
1263
+ * (syncRecoveryDirectory). A failure before the rename removes the temp
1264
+ * file, if it was made, and throws an error saying the record was left as
1265
+ * it was, with the original as its cause and its code kept. A directory
1266
+ * sync that fails, other than where the filesystem can't sync one, is
1267
+ * raised as an ops alert, not thrown: the new record is in place, and the
1268
+ * callers go on to record it as written. */
1086
1269
  private writeRecoveryFile;
1270
+ /** Syncs the directory a recovery file is in, or that directory's parent,
1271
+ * so its entries reach the disk. win32 is left out. So is a sync refused
1272
+ * with EINVAL or EBADF, the answer where the filesystem or system can't
1273
+ * sync a directory: that refusal would come again on every write, and
1274
+ * PostgreSQL's fsync_fname_ext lets the same two go. Any other failure is
1275
+ * raised as an ops alert naming the record. */
1276
+ private syncRecoveryDirectory;
1277
+ /** A recovery file's document, or undefined when there's no file. Only a
1278
+ * missing file means none was written: any other failure to read it
1279
+ * (EACCES, ENOTDIR, EIO, which existsSync would answer false for)
1280
+ * throws, and text that isn't JSON throws a StoredFormError carrying
1281
+ * the parser's reason, since reading it again won't change it. */
1087
1282
  private readRecoveryFile;
1088
1283
  private warnRecoveryFallbackOnce;
1089
1284
  /**
@@ -1094,9 +1289,86 @@ export declare class AgentFramework {
1094
1289
  * window is operator-length, not turn-length. Lives in the
1095
1290
  * branch-independent recovery file so a rollback cannot orphan it.
1096
1291
  * Deferrals outside a quiesce window (turn-alive, mid-tool-cycle) are
1097
- * still memory-only: they flush within the turn, as before.
1292
+ * mirrored only while such a queue is still persisted; otherwise they are
1293
+ * memory-only: they land within the turn, at a tool boundary or at its
1294
+ * end, and a crash before then loses them. That window runs to the turn's
1295
+ * end for a message held there and what is queued behind it, and, on a
1296
+ * stream that can't carry injected messages, for every message deferred
1297
+ * during the turn.
1298
+ *
1299
+ * A write that fails, or a queue over the cap, which writes nothing,
1300
+ * leaves the record as it last held it, except that store only, a write
1301
+ * whose sync failed is in the store, where a later sync can still put it
1302
+ * on disk (writeDeferredWritesSlot). The queue stays in memory and
1303
+ * mirrored, so its next change writes it again. Until a write succeeds, a
1304
+ * restart restores what the record holds, or doesn't start if it can't
1305
+ * read the record: it loses writes queued since, and brings back an entry
1306
+ * withdrawn since (removePlacement, RFC-006's removal of an unread
1307
+ * deferred write) that it still lists. The callers go on: a
1308
+ * deferral's caller has already answered its source, so failing it would
1309
+ * lose a write that can still land at resume. The first such write after
1310
+ * one that succeeded raises an ops alert, and a line says when a write
1311
+ * succeeds again (deferredWritesFellBehind). quiesce() writes the queue
1312
+ * itself before it changes the host's mode, and refuses instead, unless
1313
+ * the call has `abandon` (writeDeferredWritesForQuiesce).
1098
1314
  */
1099
1315
  private persistDeferredWrites;
1316
+ /**
1317
+ * Write the queue to its record as it stands, when the host is quiesced
1318
+ * (`quiesced`, which quiesce() passes before it sets the flag) or the
1319
+ * queue is mirrored: the queue when it holds anything, and an empty one
1320
+ * over a record that held one. What the write throws is thrown. A queue
1321
+ * whose JSON is longer than the cap writes nothing.
1322
+ */
1323
+ private writeDeferredWrites;
1324
+ /** Store only, the slot is the record, and a write isn't on disk until the
1325
+ * store syncs, so a sync that fails is the write's failure, as in
1326
+ * persistHostMode. The slot is set by then, and a later sync can still
1327
+ * put it on disk, so writeDeferredWrites marks the queue mirrored before
1328
+ * it writes; a boot that restores such a queue skips each entry that
1329
+ * already landed. */
1330
+ private writeDeferredWritesSlot;
1331
+ /** The durable queue: every deferred write not yet acked, pending and
1332
+ * un-acked, in deferral order. */
1333
+ private durableDeferredWrites;
1334
+ /** Where the queue is recorded, as an operator would look for it. */
1335
+ private deferredWritesRecord;
1336
+ /**
1337
+ * quiesce()'s write of the queue, before it changes the host's mode, as a
1338
+ * quiesced host keeps it: a write held only in memory, such as one
1339
+ * deferred behind a turn still alive, is on disk before quiesce() goes on,
1340
+ * as its record is. When the queue can't reach disk, because its write
1341
+ * fails or it's over the cap, which writes nothing, a call with `abandon`
1342
+ * goes on with the queue in memory and the failure's or the cap's alert.
1343
+ * Any other throws a QuiesceBlockedError naming the ways out, so quiesce()
1344
+ * rejects with the host's mode as it was (store only, the slot set before
1345
+ * a sync that failed leaves the queue mirrored: writeDeferredWritesSlot).
1346
+ * Writes a flush landed stay in the queue until a store sync acks them, so
1347
+ * it first retries an ack whose sync failed: once a sync succeeds they're
1348
+ * on disk, and they leave the queue rather than count against the cap.
1349
+ */
1350
+ private writeDeferredWritesForQuiesce;
1351
+ /**
1352
+ * A write of the queue failed, or met the cap, and quiesce() didn't reject
1353
+ * for it. The queue stays mirrored, so its next change writes it again.
1354
+ * The first such write since one that succeeded raises an ops alert naming
1355
+ * the record, and the rest of the run raises none. A failed write's own
1356
+ * line is logged each time (persistDeferredWrites), and the cap's line the
1357
+ * first time the cap is met in a run, whatever began it. On a host that is
1358
+ * or is about to be quiesced, both say to resume before any restart, since
1359
+ * a quiesced host lands its deferred writes only at a resume.
1360
+ */
1361
+ private deferredWritesFellBehind;
1362
+ /** A write of the queue succeeded after a run of failures: say that the
1363
+ * record has caught up. */
1364
+ private deferredWritesCaughtUp;
1365
+ /**
1366
+ * Restore the deferred-write queue a crash or a stop left durable. Nothing
1367
+ * stored is an empty queue. A queue that can't be read, or that reads as
1368
+ * anything but a queue, throws, since taken as empty the next deferral
1369
+ * would replace the stored one; so does a context that can't be checked
1370
+ * for writes that already landed (see landedDeferredWriteIds).
1371
+ */
1100
1372
  private restorePersistedDeferredWrites;
1101
1373
  /**
1102
1374
  * Operator-driven maintenance: run (or join) one bounded compression pass —
@@ -1241,13 +1513,26 @@ export declare class AgentFramework {
1241
1513
  */
1242
1514
  getMembrane(): Membrane;
1243
1515
  getSessionUsage(): SessionUsageSnapshot;
1516
+ /** Restore the usage totals a prior session stored. None stored starts
1517
+ * fresh (the constructor's tracker). Totals that can't be read, or that
1518
+ * read as anything but totals, throw: taken as none, the next inference's
1519
+ * persistUsageState would store fresh totals over them.
1520
+ *
1521
+ * This is create()'s first read of framework/state, so it also refuses a
1522
+ * framework/state that isn't an object: every reader of that state would
1523
+ * take it as holding nothing, and its first write would replace it. */
1244
1524
  private restoreUsageState;
1245
1525
  private persistUsageState;
1246
- /** An agent's persisted record, or null when it has none; throws when the store can't be read. */
1526
+ /** An agent's persisted record, or null when it has none. Throws the
1527
+ * store's error when it can't be read, and a StoredFormError when what's
1528
+ * stored for the agent, or the map that holds every agent's, isn't a record. */
1247
1529
  private readAgentRuntimeSettings;
1248
1530
  private validatePersistedAgentRuntimeSettings;
1249
1531
  /** Load resident-set inline caps from framework state, dropping (loudly)
1250
- * anything that fails the same validation the live update enforces. */
1532
+ * anything that fails the same validation the live update enforces. A
1533
+ * failed read is logged and boot goes on without them: nothing is lost,
1534
+ * since persistToolResultInlineCap reads the stored caps again before it
1535
+ * writes one. */
1251
1536
  private readPersistedToolResultInlineCaps;
1252
1537
  /** Write (cap) or clear (null) one agent's resident-set inline cap. */
1253
1538
  private persistToolResultInlineCap;
@@ -1303,14 +1588,19 @@ export declare class AgentFramework {
1303
1588
  */
1304
1589
  private recordCompiledContextBudget;
1305
1590
  private persistAgentRuntimeSettings;
1306
- /** Persist (or clear, with null) the host quiesce mode. First process-global
1307
- * key in the framework/state slot: quiesce survives a restart BY DESIGN — a
1308
- * crash mid-surgery must come back up NOT serving against a half-repaired
1309
- * store. Resume is always reachable (public method, WS/HTTP, control-plane
1310
- * host/command), and every quiesced boot logs a loud banner. */
1591
+ /** Persist (or clear, with null) the host quiesce mode: in the recovery file
1592
+ * when there's a path for one, and in framework/state's hostMode otherwise.
1593
+ * (A boot with a path reads that legacy hostMode only while no file exists.)
1594
+ * Quiesce survives a restart BY DESIGN — a crash mid-surgery must come back
1595
+ * up NOT serving against a half-repaired store. Resume is always reachable
1596
+ * (public method, WS/HTTP, control-plane host/command), and every quiesced
1597
+ * boot logs a loud banner. */
1311
1598
  private persistHostMode;
1312
1599
  /** The recovery file wins whenever it exists; the branch-local slot is
1313
- * read only for stores that predate it (or store-only configs). */
1600
+ * read only for stores that predate it (or store-only configs). No record
1601
+ * is a host that was never quiesced. A record that can't be read, or that
1602
+ * reads as anything but a host-mode record, throws: taken as "not
1603
+ * quiesced", a host that stopped mid-maintenance would boot serving. */
1314
1604
  private readHostMode;
1315
1605
  /**
1316
1606
  * Create an ephemeral agent that is NOT registered in the main event loop.
@@ -1395,6 +1685,15 @@ export declare class AgentFramework {
1395
1685
  /** Discoverability for event tags (MCPL RFC-001): the reserved chat:* core,
1396
1686
  * each connected server's declared tag ontology, and gate.js status. */
1397
1687
  private static readonly EVENT_TAGS_TOOL;
1688
+ /** How long, in days, a draft beyond a resident's newest is kept (KEEP_IDLE_MS). */
1689
+ private static readonly DRAFT_KEEP_DAYS;
1690
+ /** Synthesized drafts tool — present whenever MCPL channels are
1691
+ * configured. A resident's held drafts (src/prose-drafts.ts): plain speech
1692
+ * that was not sent, never published except by its resident's resend, and
1693
+ * kept as that module's retention says. Nullable
1694
+ * fields, cast like save_recent_image's: a caller whose provider presents
1695
+ * every property as required can still say "not in use". */
1696
+ private static readonly DRAFTS_TOOL;
1398
1697
  /** Synthesized save_image tool — present when a workspace module is
1399
1698
  * registered. Lets the agent persist an image it has already seen in its
1400
1699
  * own context (Discord attachments arrive inlined as base64 and are
@@ -1448,6 +1747,13 @@ export declare class AgentFramework {
1448
1747
  * Best-effort; mirrors reactToRefusal's locus resolution.
1449
1748
  */
1450
1749
  private announceRewind;
1750
+ /**
1751
+ * A turn that ended WITHOUT a refusal (a natural completion that wasn't
1752
+ * one, or a tool-ended turn) ends the rewind episode: the model responded.
1753
+ * Leave the consolidated marker in place as the durable record; just
1754
+ * clear the per-episode counters, and report a forced `/unstick` done.
1755
+ */
1756
+ private endRefusalEpisode;
1451
1757
  /**
1452
1758
  * Conclude an active `/unstick` session: post the outcome (what was shed and
1453
1759
  * whether the model stopped refusing) to the channel the command came from,
@@ -1601,6 +1907,14 @@ export declare class AgentFramework {
1601
1907
  }): OperatorLogEntry[];
1602
1908
  /** Where the operator log is written, or undefined when disabled. */
1603
1909
  getOperatorLogPath(): string | undefined;
1910
+ /**
1911
+ * A default name for an operator branch: `base`, the timestamped name the
1912
+ * caller passes, when the store doesn't hold it, else the first of `base-2`,
1913
+ * `base-3`, … that it doesn't hold (firstFreeBranchName). Two changes of one
1914
+ * kind made one after the other in a millisecond then get a branch each,
1915
+ * where the second used to be refused under the first one's name.
1916
+ */
1917
+ private newOperatorBranchName;
1604
1918
  /**
1605
1919
  * The surgery gate — STORE-wide, not per agent. A branch switch moves the
1606
1920
  * active chronicle branch for every context manager sharing this store,
@@ -1645,7 +1959,7 @@ export declare class AgentFramework {
1645
1959
  messageId: string;
1646
1960
  requester?: OperatorRequester;
1647
1961
  note?: string;
1648
- /** Branch name for the fork (default `rollback/<agent>/<ts>`). */
1962
+ /** Branch name for the fork (default `rollback/<agent>/<ts>`, or with `-2`, `-3`, … appended when the store already holds that name). */
1649
1963
  branchName?: string;
1650
1964
  }): Promise<{
1651
1965
  agentName: string;
@@ -1671,7 +1985,8 @@ export declare class AgentFramework {
1671
1985
  }>;
1672
1986
  /**
1673
1987
  * Suppress specific messages from the live context without touching the
1674
- * source branch: fork at the current head (`suppress/<agent>/<ts>`), redact
1988
+ * source branch: fork at the current head (by default `suppress/<agent>/<ts>`,
1989
+ * numbered `-2`, `-3`, … when the store already holds that name), redact
1675
1990
  * the messages on the fork, switch to it. Shards of a body group are always
1676
1991
  * removed together. Discord originals get awareness markers via the outbox;
1677
1992
  * the batch is `explicit`-activated only after every removal succeeded, and
@@ -1688,7 +2003,7 @@ export declare class AgentFramework {
1688
2003
  messageIds: string[];
1689
2004
  requester?: OperatorRequester;
1690
2005
  note?: string;
1691
- /** Branch name for the fork (default `suppress/<agent>/<ts>`). */
2006
+ /** Branch name for the fork (default `suppress/<agent>/<ts>`, or with `-2`, `-3`, … appended when the store already holds that name). */
1692
2007
  branchName?: string;
1693
2008
  }): Promise<{
1694
2009
  agentName: string;
@@ -1808,6 +2123,14 @@ export declare class AgentFramework {
1808
2123
  * Drop a departed agent's checkpoint tree key and turn/redo bookkeeping.
1809
2124
  * Without this, spawn-and-dispose agents leave a key (and in-memory map
1810
2125
  * entries) behind for the life of the store/session.
2126
+ *
2127
+ * Its callers are tearing an agent down: a conversation fork's disposal and
2128
+ * an ephemeral run's end. A throw from the store here would stop that
2129
+ * teardown partway, reject a finished ephemeral run in place of its result,
2130
+ * and at a closure turn's end reject a stream promise that nothing holds.
2131
+ * So a failed removal is logged and goes no further, and the agent's
2132
+ * checkpoints stay in the store under its name, as a crash before its
2133
+ * teardown leaves them.
1811
2134
  */
1812
2135
  private evictTurnCheckpoints;
1813
2136
  /**
@@ -1859,8 +2182,53 @@ export declare class AgentFramework {
1859
2182
  * primary.
1860
2183
  */
1861
2184
  private createConversationAgent;
1862
- /** Persist the router's generation counters (see hydration in create()). */
1863
- private persistConversationRouterState;
2185
+ /**
2186
+ * The router's decision for a message or batch on `facts.channelId`, made
2187
+ * once no spawn is in flight for that channel, with a spawn it decides on
2188
+ * already started. A routing that finds its channel's fork being spawned
2189
+ * waits for that spawn to settle and decides then, whatever it would have
2190
+ * decided meanwhile: once the fork is bound, the decision is the fork, and
2191
+ * if the spawn failed, it decides as a message arriving next would, which
2192
+ * proposes the spawn again if the message qualifies. The check, the
2193
+ * decision and the spawn's start are one synchronous step, so at most one
2194
+ * spawn per channel is in flight. Without the wait, a second spawn of the
2195
+ * fork's name failed ("already registered or reserved"), and a message
2196
+ * that didn't qualify on its own was dropped as unrouted; either way its
2197
+ * message was lost. Each path that delivers messages handles them one at
2198
+ * a time, but the event queue and the coalescer run beside each other, and
2199
+ * a spawn can wait, as on its template's annotations
2200
+ * (createConversationAgent); the waiting routing holds its own path for as
2201
+ * long, which none of the spawn's awaits needs.
2202
+ */
2203
+ private routeConversation;
2204
+ /**
2205
+ * Store the router's counters with the spawn's generation, create the fork
2206
+ * the decision names and bind its channel to it, registered in
2207
+ * conversationSpawns under the channel until it settles. The store runs
2208
+ * inside the spawn's promise, still in routeConversation's synchronous
2209
+ * step, so a store that throws rejects the spawn, which each caller reports
2210
+ * as a failed spawn, rather than throwing out of routeConversation before
2211
+ * the caller's try. routeConversation registers a spawn only when none is
2212
+ * in flight for the channel, and only this spawn's settlement removes it,
2213
+ * so the entry it removes is its own. It's removed before anyone waiting
2214
+ * on it resumes, so a waiter that decides again doesn't find it.
2215
+ */
2216
+ private spawnConversationAgent;
2217
+ /**
2218
+ * Store the router's generation counters with a spawn's generation, before
2219
+ * the spawn it names (see hydration in create()). A fork whose counter isn't
2220
+ * stored would have its name reused at the next restart, reopening its
2221
+ * namespace, so a failed read or write throws and the caller refuses the
2222
+ * spawn. The stored counters, the router's own and this spawn's are
2223
+ * merged, each at its highest, in one synchronous step: another channel's
2224
+ * spawn still in flight has stored its counter but not bound it yet, so
2225
+ * the router's map alone would write that counter back down, and the
2226
+ * router's own counters keep the stored ones from going back down when
2227
+ * they read lower, as on a branch with older counters. The merge is a Map,
2228
+ * so a channel id such as "constructor" is a key like any other. The
2229
+ * callers name the channel; the errors name the state and what failed.
2230
+ */
2231
+ private storeConversationGeneration;
1864
2232
  /**
1865
2233
  * Remove a closed conversation fork from the framework: its closure turn
1866
2234
  * has finished, so the home mapping has served its purpose and keeping the
@@ -1906,11 +2274,26 @@ export declare class AgentFramework {
1906
2274
  * replies to the agent) DO still arrive, and nothing warned that answering
1907
2275
  * via option 1 leaves the human's natural un-@'d follow-up invisible (Sol
1908
2276
  * answered four #architecture mentions over four days while the follow-ups
1909
- * to her own replies were silently dropped). The wording now states the
1910
- * actual delivery model, and option 1 carries the consequence inline. When
1911
- * the surface tracks a missed-ambient tally (discord-mcpl sends
1912
- * `missedMessages`/`missedCharacters` in push origin), the invitation shows
1913
- * the count — the cost of staying out, as a number, at decision time.
2277
+ * to her own replies were silently dropped). That pass stated discord-mcpl's
2278
+ * delivery model here.
2279
+ *
2280
+ * #406: what reaches the agent from a channel, open or closed, is its
2281
+ * server's delivery, which MCPL leaves to each server. discord-mcpl
2282
+ * subscribes a channel on channels/open and unsubscribes it on
2283
+ * channels/close. slack-mcpl keeps its own subscription, which decides
2284
+ * whether a conversation's ordinary messages arrive, open or closed; open
2285
+ * state only picks channels/incoming or push/event. So the invitation says
2286
+ * only that messages addressing the agent reach it whether or not it opens
2287
+ * the channel: it is shown only when one has arrived from a closed channel,
2288
+ * and both servers deliver them either way. What else arrives is for the
2289
+ * server to say on its push. Option 1 says a reply opens the channel,
2290
+ * because routeSpeech opens a closed channel before delivering into it. Its
2291
+ * old follow-up warning assumed the channel stays closed after the reply,
2292
+ * which that open makes false (and on discord-mcpl, channels/open also
2293
+ * subscribes). When the surface tracks a missed-ambient tally
2294
+ * (discord-mcpl sends `missedMessages`/`missedCharacters` in push origin),
2295
+ * the invitation shows the count — the cost of staying out, as a number, at
2296
+ * decision time.
1914
2297
  */
1915
2298
  private buildClosedChannelInvitation;
1916
2299
  /**
@@ -1919,13 +2302,55 @@ export declare class AgentFramework {
1919
2302
  * id is reassigned to another endpoint (restartMcplServer with a new config).
1920
2303
  */
1921
2304
  private coalescingBinding;
1922
- private initializePushCoalescer;
2305
+ /**
2306
+ * Report one inbound acceptance to the observer, if one is installed
2307
+ * (InboundAcceptanceObserver). Called where an envelope is first created —
2308
+ * never for a delivery that reuses a frozen one. A failing observer is
2309
+ * reported loudly (stderr + trace) and never affects delivery.
2310
+ */
2311
+ private noteInboundAccepted;
2312
+ /**
2313
+ * The inbound source envelope (mcpl/inbound-source.ts) of an item that
2314
+ * belongs to a registered channel. The one place the framework decides
2315
+ * which conversation an inbound item came from; every lane calls it at the
2316
+ * point the host accepted the item, or reuses the envelope frozen then.
2317
+ * `acceptedAt` falls back to now only for an event no admission path
2318
+ * stamped (a direct framework caller), which is the closest observation.
2319
+ */
2320
+ private channelSource;
2321
+ /** Source envelope of a channels/incoming event (lane facts as given). */
2322
+ private channelEventSource;
2323
+ /** Source envelope of a push event: its derived channel, else unscoped. */
2324
+ private pushSource;
2325
+ /**
2326
+ * Source envelope for conversational input from a non-channel surface: a
2327
+ * module's messages in response to an `external-message` (console, TUI) or
2328
+ * `api:message` event. An event whose metadata names a channel is not a
2329
+ * surface conversation and gets none (never a guessed identity).
2330
+ */
2331
+ private surfaceSourceFor;
2332
+ /**
2333
+ * The push coalescer, built and restored from its stored receipts and
2334
+ * batches. initializeMcpl calls this before it builds anything else, so a
2335
+ * refusal here leaves the MCPL subsystem as it was. Nothing stored is a
2336
+ * coalescer with no history. What can't be read, reads as anything but
2337
+ * this version's snapshot and receipts, or can't be restored, throws, and
2338
+ * so does an agent's context that can't be checked for an occurrence
2339
+ * already delivered (wasPublished): taken as no history, the next
2340
+ * acceptance's receipt and the next flush would replace what's stored, and
2341
+ * taken as undelivered, an occurrence would be delivered again.
2342
+ */
2343
+ private restorePushCoalescer;
2344
+ /** Install a coalescer restorePushCoalescer built: none of this can fail. */
2345
+ private installPushCoalescer;
1923
2346
  /**
1924
2347
  * Durability barrier for coalescing (RFC-006 §3.1/§3.2): everything
1925
- * written so far is fsynced before the caller proceeds. Group-committed —
1926
- * all acceptances that arrive in one event-loop turn share one
1927
- * `store.sync()` — so throughput is bounded by fsync rate per batch, not
1928
- * per message.
2348
+ * written so far is fsynced before the caller proceeds. Commits asked for
2349
+ * in the same event-loop turn would share one `store.sync()`, but the
2350
+ * coalescer asks for every commit under its lock and holds the lock until
2351
+ * the commit resolves, so no two share one. Each acceptance makes an fsync
2352
+ * of its own, and so does each coalesced message a channels/incoming
2353
+ * request newly admits, one at a time.
1929
2354
  */
1930
2355
  private commitCoalescingDurable;
1931
2356
  private scheduleCoalescingSnapshot;
@@ -1996,8 +2421,113 @@ export declare class AgentFramework {
1996
2421
  * turns, whose rows are stored exactly as before.
1997
2422
  */
1998
2423
  private silentTurnRowMetadata;
1999
- /** Record plain-prose segments this turn suppressed. */
2424
+ /** Record plain-prose segments this turn suppressed without drafts (proseRouting=disabled). */
2000
2425
  private recordProseSuppression;
2426
+ /**
2427
+ * Silenced plain speech: an explicit send holds it as resendable drafts; a
2428
+ * deliberate silence (skip_reply, a silent turn, or a private think in
2429
+ * the same native round, where that policy applies: an XML-mode round has
2430
+ * no verbatim content to route live, so its prose is routed at the turn's
2431
+ * end as ordinary speech) keeps it private —
2432
+ * counted for the receipt, never drafted. `segments` are the runs exactly
2433
+ * as written (splitProseRuns), so a draft keeps the resident's words byte
2434
+ * for byte. What it holds, keeps or moves is the round's turn's
2435
+ * (round.routing), whenever the hold runs.
2436
+ */
2437
+ private holdSilencedProse;
2438
+ /**
2439
+ * Hold plain speech as drafts (src/prose-drafts.ts) instead of
2440
+ * letting it vanish: journaled durably and recorded for the receipt of the
2441
+ * turn whose round it came from (opts.routing). `notice: 'now'` also
2442
+ * queues a private notice naming them, which
2443
+ * the resident hears at its next tool boundary — only when the live stream
2444
+ * presents mid-turn injections. Otherwise the turn-end receipt names them
2445
+ * (or, after a crash, the next turn's catch-up). Drafts the journal cannot
2446
+ * hold are reported in the receipt: their words remain in history only.
2447
+ */
2448
+ private holdProseDrafts;
2449
+ private static readonly DRAFT_REASON_TEXT;
2450
+ private static readonly DRAFT_REASON_SHORT;
2451
+ private draftsHeldNotice;
2452
+ /** Compact local time for draft listings. */
2453
+ private draftTime;
2454
+ /** A draft's opening words, for the drafts tool's listing only. */
2455
+ private static draftPreview;
2456
+ private static destinationText;
2457
+ /** One line per draft: id, state, when, why, size, preview. */
2458
+ private draftLine;
2459
+ /** A draft's state in words that claim only what is known. */
2460
+ private draftStateText;
2461
+ /** Why an unconfirmed draft may already have been posted, in full. */
2462
+ private riskText;
2463
+ /** Whether an attempt with no outcome is still out: its draft's latest,
2464
+ * while that draft is being sent. Otherwise it never got one (a crash). */
2465
+ private attemptIsOut;
2466
+ /** Why an attempt has no outcome, in a risk's words. */
2467
+ private noOutcomeText;
2468
+ /** A delivered draft's historical receipt. */
2469
+ private draftReceipt;
2470
+ /**
2471
+ * Turn start (or after a crash): name, privately and before the turn's
2472
+ * compile, any open drafts no notice on the current branch names: none
2473
+ * reached the history (a crash, an aborted turn), or a rollback or branch
2474
+ * move took the notices away. Every draft it marks is named by id, newest
2475
+ * first: the newest eight with their state and why each was held, the rest
2476
+ * by id. Like every notice, it quotes none of their words; the drafts tool
2477
+ * shows them. A draft a recent message already names is recorded as
2478
+ * noticed rather than named again: its notice landed after its turn ended,
2479
+ * as a bounce does when a delivery runs after a tool ends an explicit turn.
2480
+ * It reads only the recent history (draftsNamedInHistory), so its notice
2481
+ * claims no more than that. Left out are the open logical turn's own
2482
+ * drafts, which its receipt names and its settlement records
2483
+ * (settleTurnDrafts), and drafts a notice still waiting in the deferred
2484
+ * queue names.
2485
+ */
2486
+ private noticeUnnoticedDrafts;
2487
+ /**
2488
+ * Logical turn end, after the turn's deferred notices are flushed: record
2489
+ * as noticed exactly the drafts a stored message names (the receipt, a
2490
+ * held-draft notice, a bounce notice), each with the message that names
2491
+ * it. One whose notice never reached the history stays unnoticed, for the
2492
+ * next turn's catch-up. The turn's draft tallies are spent here.
2493
+ */
2494
+ private settleTurnDrafts;
2495
+ /** Record each named draft as noticed, with the message that names it
2496
+ * (draftsNamedInHistory). */
2497
+ private recordDraftNotices;
2498
+ /** How far back draftsNamedInHistory looks: this turn's notices are near
2499
+ * the end. One beyond it leaves its draft for the next turn's catch-up. */
2500
+ private static readonly DRAFT_NOTICE_SCAN;
2501
+ /** Which of these drafts a stored notice or receipt OF THIS RESIDENT names
2502
+ * (draft ids are unique only per resident, and residents can share one
2503
+ * history), each with the newest message that names it, reading only the
2504
+ * recent history, where this turn's notices are. */
2505
+ private draftsNamedInHistory;
2506
+ /** Page size for drafts(action: "list"). */
2507
+ private static readonly DRAFTS_PAGE;
2508
+ /** Drafts with a delivery attempt in flight, `${agent}\u0000${id}`: a
2509
+ * parallel resend (or `{{unsent}}`) of the same draft is refused. */
2510
+ private draftsInFlight;
2511
+ /** The drafts in draftsInFlight whose attempt is out right now (journaled,
2512
+ * its publish awaited). A dismissal of one is refused, and the resident
2513
+ * told to wait for that result, since a dismissal can't call back words
2514
+ * already on their way. A draft only queued in a resend batch can still
2515
+ * be dismissed: the batch honours that when it reaches the draft. */
2516
+ private draftsSending;
2517
+ /** The drafts tool's answer to a resident's call, from the model's own
2518
+ * dispatch or an agent-origin call through executeToolCall (a puppet's):
2519
+ * a failure the handler throws is answered as one. */
2520
+ private draftsToolResult;
2521
+ /**
2522
+ * The resident's `drafts` tool: list, read, resend and dismiss its own held
2523
+ * drafts. Private to the calling resident. `resend` is an explicit send:
2524
+ * each draft is published verbatim, in order, through the normal publish
2525
+ * executor, its attempt journaled durably before the request leaves.
2526
+ */
2527
+ private handleDraftsTool;
2528
+ /** Why a draft can't be resent now (dismissed, or possibly already posted
2529
+ * without the resident's confirmation), or undefined when it can. */
2530
+ private resendRefusal;
2001
2531
  /** Record a successful plain-prose delivery for this turn's receipt. */
2002
2532
  private recordProseDelivery;
2003
2533
  /**
@@ -2081,10 +2611,11 @@ export declare class AgentFramework {
2081
2611
  /**
2082
2612
  * Durable window notice for a channel the agent did not ask to open —
2083
2613
  * subscription-policy admission, or an open forced by the agent's own
2084
- * delivery into a closed channel. The agent must always learn that new
2085
- * traffic will start flowing, and that `channel_close` opts out (their
2086
- * decision outranks policy). System message: never triggers inference,
2087
- * never conversational, never locus-eligible.
2614
+ * delivery into a closed channel. The agent must always learn that the
2615
+ * channel opened, and that `channel_close` opts out (their decision
2616
+ * outranks policy). What an open channel delivers is its server's to say
2617
+ * (#406), so the notice doesn't promise its traffic. System message: never
2618
+ * triggers inference, never conversational, never locus-eligible.
2088
2619
  */
2089
2620
  private recordChannelAutoOpenNotice;
2090
2621
  /**
@@ -2103,7 +2634,7 @@ export declare class AgentFramework {
2103
2634
  * Explicit-prose-routing delivery gateway (docs/explicit-prose-routing.md).
2104
2635
  * Every prose segment of an `explicit`-mode agent flows through here:
2105
2636
  * parse the `>>` prefix, resolve the target, deliver — or bounce to the
2106
- * clipboard with a resend notice. Misdelivery is structurally impossible:
2637
+ * held bounce draft with a resend notice. Misdelivery is structurally impossible:
2107
2638
  * nothing is ever sent to a destination the model did not name (directly
2108
2639
  * or via the turn's sticky target).
2109
2640
  */
@@ -2116,6 +2647,27 @@ export declare class AgentFramework {
2116
2647
  */
2117
2648
  private admitProse;
2118
2649
  private deliverAdmittedProse;
2650
+ /**
2651
+ * `{{unsent}}` in an envelope body: the latest bounce draft's words. One
2652
+ * that is out (being sent, or queued in a resend) or unconfirmed (its last
2653
+ * attempt may have been posted) is never substituted — nothing is sent,
2654
+ * and the resident gets the facts and the explicit route (drafts resend
2655
+ * with confirmDuplicate) instead. The envelope's own words are held, as a
2656
+ * bounced envelope's would be (unsentWords): one bounce draft with the
2657
+ * whole text, `{{unsent}}` written out and its risk carried, so nothing
2658
+ * the resident wrote has to be typed again. A bare `{{unsent}}` holds
2659
+ * nothing new: its words already are that draft.
2660
+ */
2661
+ private takeUnsent;
2662
+ /**
2663
+ * Deliver an envelope that substituted `{{unsent}}`: the substituted
2664
+ * draft's attempt is journaled durably before the request leaves, and its
2665
+ * outcome after, exactly as a drafts resend would.
2666
+ */
2667
+ private deliverWithUnsent;
2668
+ /** A draft's state as the journal reads it now: after a write that failed
2669
+ * and was reconciled, whatever reached the journal counts. */
2670
+ private draftStateNow;
2119
2671
  /**
2120
2672
  * Where a delivered round leaves its turn's sticky destination, as the
2121
2673
  * explicit gateway sets it once the round's envelopes run: each `>>`
@@ -2125,9 +2677,35 @@ export declare class AgentFramework {
2125
2677
  private roundDestination;
2126
2678
  /** Locus-preserving explicit publication. Source remains byte-identical in Chronicle. */
2127
2679
  private deliverHybridProse;
2680
+ /** `>>skip_reply {{unsent}}` and its hybrid form: set the latest bounce
2681
+ * draft aside — unless it is being sent right now, which a dismissal
2682
+ * can't call back: the resident is told instead. So are a dismissal whose
2683
+ * recording fails (with the state the draft reads as after it, and whether
2684
+ * `{{unsent}}` still names it) and one whose draft may already have been
2685
+ * posted. */
2686
+ private dismissLatestBounce;
2128
2687
  private deliverProseEnvelope;
2129
2688
  /** Cap on consecutive bounce-triggered wakes (notices still append after). */
2130
2689
  private static readonly PROSE_BOUNCE_WAKE_CAP;
2690
+ /**
2691
+ * Words about to be held that may use `{{unsent}}` (a bounce, or an
2692
+ * envelope an explicit send suppressed), under the one re-bounce rule. A
2693
+ * bare `{{unsent}}` is the latest bounce itself, which stays the one draft
2694
+ * of those words rather than being copied. Otherwise the whole authored
2695
+ * text is kept, the token expanded to the latest bounce's words, nothing
2696
+ * stripped or substituted. When that draft may already have been posted
2697
+ * (unconfirmed, or in flight) the words carry its duplication risk: they
2698
+ * can be resent only with confirmDuplicate, like the draft they copy. The
2699
+ * evidence is the risk's own: the copied draft's uncertain attempt, else
2700
+ * the risk that draft itself inherited, else (truly) that it was in flight
2701
+ * when copied.
2702
+ */
2703
+ private unsentWords;
2704
+ /**
2705
+ * A routing envelope that could not be delivered: its words are held as a
2706
+ * draft (the `{{unsent}}` source) and the resident is told, privately.
2707
+ * `{{unsent}}` in it follows the re-bounce rule (unsentWords).
2708
+ */
2131
2709
  private bounceProse;
2132
2710
  /**
2133
2711
  * One-time mode primer (docs/explicit-prose-routing.md): when an agent's
@@ -2213,6 +2791,7 @@ export declare class AgentFramework {
2213
2791
  /** puppetToolCall's work, run where stop() can wait for it. */
2214
2792
  private runPuppetToolCall;
2215
2793
  private executeToolCallFrom;
2794
+ /** A programmatic call of an MCPL tool: `serverId` and `prefix` as resolveMcplTool matched them. */
2216
2795
  private executeMcplToolCall;
2217
2796
  /** Event-pushing wrapper for the model-driven dispatch path. */
2218
2797
  private dispatchCodeExecutionToolCall;
@@ -2227,6 +2806,12 @@ export declare class AgentFramework {
2227
2806
  * results reach the running script and never the model context.
2228
2807
  */
2229
2808
  private runCodeExecution;
2809
+ /** Background scripts are the primary agent's, or any agent's when no primary agent is named. */
2810
+ private runsBackgroundScripts;
2811
+ /** How many background scripts an agent may have running at once. */
2812
+ private maxBackgroundScripts;
2813
+ /** How many of this agent's background scripts are running now. */
2814
+ private runningBackgroundScripts;
2230
2815
  /**
2231
2816
  * Start a background script: dedicated interpreter, output journaled to a
2232
2817
  * workspace file, wake_agent() available in-script. The tool result
@@ -2275,6 +2860,22 @@ export declare class AgentFramework {
2275
2860
  * live wire copy can reuse the identical strings.
2276
2861
  */
2277
2862
  private buildStoredToolResultContent;
2863
+ /**
2864
+ * A tool result's text as its stored copy is written before any cut, and
2865
+ * what its live copy showed beside that text (see cutStoredToolResult). An
2866
+ * error result is its error text. Any other is serialized by
2867
+ * nonErrorResultText, which retains each inline image BEFORE its
2868
+ * placeholder is written (issue #104): the placeholder embeds the ref, so
2869
+ * the image stays reachable by provenance after the bytes leave the wire.
2870
+ *
2871
+ * The live copy is the stored text itself unless the result is a content
2872
+ * array carrying an inline image, which tryNativeToolResultContent sends
2873
+ * as native blocks. It takes the same arrays the serializer takes block by
2874
+ * block, and shows each image and each reference block's stub whole and
2875
+ * each text block up to where it cuts that block at the cap (`maxChars`,
2876
+ * toolResultCutAt), so those are the ranges of the text it showed.
2877
+ */
2878
+ private storedToolResultText;
2278
2879
  /** Where a tool result labelled `label` is written: `<first writable
2279
2880
  * mount>/tool-results/<label>.txt`, or null when there is no writable
2280
2881
  * workspace. */
@@ -2320,9 +2921,10 @@ export declare class AgentFramework {
2320
2921
  * RFC-007: with an `origin`, observers see the call as they see a model
2321
2922
  * call (register, dispatch with its refusal sites, open; the terminal at
2322
2923
  * the waiter intercept), under the inner tool's own name and class.
2924
+ * `turnId` is the turn the call was made in (dispatchToolCall).
2323
2925
  */
2324
2926
  private dispatchScriptToolCall;
2325
- /** Abort a running script when the agent's turn dies underneath it. */
2927
+ /** Abort the agent's script, running or still starting, when the turn it belongs to ends or is reset to run again. */
2326
2928
  private abortAgentScript;
2327
2929
  private toMembraneToolResult;
2328
2930
  /**
@@ -2330,7 +2932,9 @@ export declare class AgentFramework {
2330
2932
  * convert to Membrane's native ToolResultContentBlock[]. Returns null when
2331
2933
  * the array is text-only (let JSON path handle it; saves a code path).
2332
2934
  * `maxChars`, when provided, caps each accompanying text block so an image
2333
- * inlined alongside an enormous text payload can't blow the context.
2935
+ * inlined alongside an enormous text payload can't blow the context. A
2936
+ * block is cut as the stored copy is (toolResultCutAt), never inside a
2937
+ * slot, so the stored copy can keep exactly the slots this showed (#403).
2334
2938
  */
2335
2939
  private tryNativeToolResultContent;
2336
2940
  private toolImageLedgerFor;
@@ -2349,6 +2953,10 @@ export declare class AgentFramework {
2349
2953
  private resolveToolResultInlineCap;
2350
2954
  private approximateDecodedBase64Bytes;
2351
2955
  private sanitizeProcessLogValue;
2956
+ /** Writes one inference-log entry. A stream's entries go through its
2957
+ * driveStream's `logStream`, which gives the stream's usage to one entry
2958
+ * only; an end that calls this directly for a stream writes a second
2959
+ * entry for it, and its usage can be counted twice in the log. */
2352
2960
  private logInference;
2353
2961
  private logProcessEvent;
2354
2962
  /** Forget one server's RFC-008 class declarations (see the close handler). */
@@ -2387,20 +2995,127 @@ export declare class AgentFramework {
2387
2995
  /**
2388
2996
  * Find the MCPL server for a tool: [serverId, prefix], or null.
2389
2997
  * Prefixes can nest (`foo` and `foo--bar`), so `foo--bar--x` can match
2390
- * both. The server whose tools/list produced the name decides; a name no
2391
- * live server listed (stale, or invented by the model) goes to the longest
2392
- * matching prefix. Never prefix-map insertion order.
2998
+ * both. The tool listing decides: the server whose tools/list offered the
2999
+ * name, after its tool policy, as of the last tool refresh (a server that
3000
+ * closed since keeps its names until the next one). Where two servers list
3001
+ * the same name, the listing holds the one listed last (#265). A name the
3002
+ * listing doesn't hold (invented by the model, or no longer listed) goes to
3003
+ * the longest matching prefix. Never prefix-map insertion order.
2393
3004
  */
2394
3005
  private resolveMcplTool;
3006
+ /**
3007
+ * Why this host refuses a skip_reply call, as the model will read it, or
3008
+ * undefined when it doesn't (skipReplyWakeRefusal): without an EventGate,
3009
+ * any wake_in_seconds; with one, a wake_in_seconds that isn't a number of
3010
+ * seconds. Only when the channel registry handles skip_reply. The dispatch
3011
+ * that refuses the call reads it here, and so does the turn's bookkeeping of
3012
+ * a refused round, for the model's own calls: the silence before it, which
3013
+ * comes back after its round, and in XML mode which round's prose stays
3014
+ * private. A skip_reply round's own prose stays private by the tool's name,
3015
+ * refused or not.
3016
+ */
3017
+ private skipReplyRefusal;
3018
+ private refusesSelfWake;
3019
+ /**
3020
+ * Dispatch a call the agent made. `turnId` is the turn it was made in
3021
+ * (TurnRouting.turnId), as its caller knows it: a model's call, the turn
3022
+ * whose stream made it; a foreground script's inner call, the turn of the
3023
+ * code_execution call whose script is running when the call arrives. A
3024
+ * background script's call has none.
3025
+ */
2395
3026
  private dispatchToolCall;
2396
3027
  private dispatchToolCallEvent;
2397
3028
  private addMessage;
3029
+ /** Where addMessage delivers: the named agent, else the primary, else the
3030
+ * first registered agent. Undefined when there is no such agent. */
3031
+ private deliveryAgent;
3032
+ /** The notes addMessage takes for a message it stored: an arrival for the
3033
+ * agent when none of its turns is alive or the message was assembled for
3034
+ * the start now beginning (no tool boundary will weigh it), and one for
3035
+ * every other resident's open turn. */
3036
+ private noteStored;
2398
3037
  /**
2399
3038
  * Splice out the deferred messages addressed to `agentName` (explicitly
2400
3039
  * via forAgent, or implicitly when it is the primary), leaving other
2401
- * targets' messages queued for their own boundaries.
3040
+ * targets' messages queued for their own boundaries. With `stopAt`, the
3041
+ * drain ends at the first of them (in queue order) that it matches: that
3042
+ * message and every later one stay queued, so what is drained is always a
3043
+ * prefix of the agent's queue.
2402
3044
  */
2403
3045
  private drainDeferredFor;
3046
+ /**
3047
+ * Put drained entries back into the queue under their ids and seq: out of
3048
+ * the un-acked set, and persisted when the queue is. A memory-only queue
3049
+ * keeps them while the framework runs.
3050
+ */
3051
+ private requeueDrained;
3052
+ /**
3053
+ * Write drained entries in queue (seq) order, whatever their targets:
3054
+ * residents share one message slot, so the order entries arrived in is the
3055
+ * order they're stored. Each target is cut at its own first entry that
3056
+ * can't be stored: that entry and every later one for the same target go
3057
+ * back into the queue under their ids and seq (requeueDrained) before
3058
+ * anything is logged, and other targets' entries go on. Left in the
3059
+ * un-acked set, the next ack would drop them from the durable queue.
3060
+ *
3061
+ * So none of a target's entries lands ahead of an earlier one, and a queued
3062
+ * tool_use that can't be stored keeps the tool_result queued behind it from
3063
+ * being stored alone. (A tool_use that is stored, followed by a tool_result
3064
+ * that can't be, stays stored without it until the tool_result lands at a
3065
+ * later flush. The only queued pair is puppetToolCall's defensive one,
3066
+ * which no path reaches today.) An entry that keeps failing is logged by
3067
+ * id at each flush, and holds its target's later queued writes rather than
3068
+ * letting them land out of order.
3069
+ *
3070
+ * The hold is the queue's alone. A write that isn't deferred is stored at
3071
+ * once and can land ahead of a held entry: a fresh tool_result, whatever
3072
+ * its agent's state, and any write while its agent's turn, stream and tool
3073
+ * cycle are all idle and the host isn't quiesced. So an entry that keeps
3074
+ * failing holds only what is deferred behind it.
3075
+ *
3076
+ * A write can throw after its message is stored: a store listener, the
3077
+ * strategy's handling of the add, or a later shard of a sharded body can
3078
+ * throw once a record is written. Before an entry that threw is put back,
3079
+ * its target's store is read from where it stood before the write, for
3080
+ * messages carrying the entry's `deferredWriteId`. What it finds counts as
3081
+ * written, at most once: the entry isn't requeued and stored a second
3082
+ * time, and what landed, as later compiles render it (asCompiled), is what
3083
+ * it returns as the entry's content. For a sharded body, that can be its
3084
+ * first shards alone, since the append loop stops at the throw; the rest
3085
+ * of the body isn't stored. (Requeued, the
3086
+ * landed shards would be stored twice, and only the rest could not be
3087
+ * appended later without splitting the body.) Boot's scan for landed
3088
+ * writes counts a landed shard the same way.
3089
+ *
3090
+ * Returns what was written (stored, or deferred again by addMessage, whose
3091
+ * id is then empty), in queue order: for one target, a prefix of its
3092
+ * entries. `onLanded` hears an entry whose write threw after storing it,
3093
+ * with the id it landed under, as soon as it's found: before the writes
3094
+ * after it, so whatever it records keeps their order.
3095
+ */
3096
+ private writeDrainedInOrder;
3097
+ /** How many messages the agent's store holds: undefined when its store
3098
+ * can't say. */
3099
+ private storedCountOf;
3100
+ /** The messages carrying `deferredWriteId` among those the agent's store
3101
+ * gained from position `from` on, in store order, with their blobs
3102
+ * resolved, as a request carries them. A sharded body's carry its
3103
+ * `bodyGroupId`. */
3104
+ private storedCopiesOf;
3105
+ /** The line naming a drained write that threw: one that couldn't be stored,
3106
+ * which is already back in the queue, or, with `landed`, one stored before
3107
+ * the throw (for a sharded body, how many of its shards). Logging mustn't
3108
+ * fail the flush that met it, so a thrown value that has no text is named
3109
+ * as such. */
3110
+ private logDeferredWriteError;
3111
+ /** Re-add drained entries through addMessage, which stores each or defers
3112
+ * it again, in queue order and cut per target (writeDrainedInOrder). With
3113
+ * `bypassDeferral`, each is stored past its target's deferral (stop()). A
3114
+ * write that threw after storing missed the notes addMessage takes after a
3115
+ * store, so they're taken for what landed as soon as it's found, before
3116
+ * the writes after it: an open turn's arrivals keep the order the writes
3117
+ * landed in, and its newest stays the newest (remainingArrival). */
3118
+ private readdDrained;
2404
3119
  private editMessage;
2405
3120
  private removeMessage;
2406
3121
  private getMessage;
@@ -2509,7 +3224,7 @@ export declare class AgentFramework {
2509
3224
  * push event to wake the agent onto the same context.
2510
3225
  *
2511
3226
  * Bounded: at most `refusalHandling.maxRewinds` (default 3, hard cap 10)
2512
- * sheds per failure episode; the budget resets on any successful inference.
3227
+ * sheds per failure episode; the budget resets when a turn completes.
2513
3228
  * At the cap (or with nothing left to shed) it stops — the agent stays up
2514
3229
  * and hard-down logging continues, but no further history is consumed.
2515
3230
  */
@@ -2574,6 +3289,13 @@ export declare class AgentFramework {
2574
3289
  private releaseMcplDataPlaneGate;
2575
3290
  private completeMcplDataPlaneGate;
2576
3291
  private failMcplDataPlaneGate;
3292
+ /**
3293
+ * Close a runtime connect's new connection for good, through the registry,
3294
+ * after a step of that connect failed. A close that fails keeps the entry,
3295
+ * so a later disconnect, restart or shutdown can close it again, and is
3296
+ * logged here rather than replacing the failure the connect reports.
3297
+ */
3298
+ private closeFailedRuntimeConnect;
2577
3299
  /**
2578
3300
  * Connect a single MCPL server: register routing entries, open the
2579
3301
  * connection, wire events, and initialize feature sets / scopes /
@@ -2602,6 +3324,12 @@ export declare class AgentFramework {
2602
3324
  * tell→receipt→activate), emit ONE change receipt (§17.6).
2603
3325
  */
2604
3326
  private handleManifestChanged;
3327
+ /** A refresh handleManifestChanged schedules for itself, after the fetch
3328
+ * floor or behind a fetch in flight. It's contained as the announcement's
3329
+ * own run is. Its fetch's own failure is logged by the fetch's catch, as
3330
+ * in 0.22.x; any other failure emits mcpl:request-handler-error and a
3331
+ * stderr line through the containment. */
3332
+ private rerunManifestRefresh;
2605
3333
  /**
2606
3334
  * (Re-)establish a server's host-side MCPL registration: feature-set state
2607
3335
  * (plus the featureSets/update sent to the server), scope patterns, and
@@ -2659,7 +3387,9 @@ export declare class AgentFramework {
2659
3387
  * Connect a new MCPL server at runtime. Refreshes the tool list and
2660
3388
  * notifies the agent of newly available tools. Throws if the MCPL
2661
3389
  * subsystem is not initialized, the id is already connected, or the
2662
- * connection/handshake fails.
3390
+ * connection/handshake fails. A config whose `inheritEnv` (on a stdio
3391
+ * server), `reconnect` or `allowHostCommands` holds anything but true,
3392
+ * false or null is refused, as `create()` refuses one.
2663
3393
  */
2664
3394
  connectMcplServer(config: import('./mcpl/types.js').McplServerConfig): Promise<void>;
2665
3395
  private runConnectMcplServer;
@@ -2677,6 +3407,8 @@ export declare class AgentFramework {
2677
3407
  * same (or an updated) config. This actually respawns a stdio child —
2678
3408
  * unlike `reconnect: true`, which only retries after transport-level
2679
3409
  * failures. Throws if the server has no stored config and none is given.
3410
+ * A config `connectMcplServer` would refuse for its boolean settings is
3411
+ * refused before the running server is disconnected, so it stays up.
2680
3412
  */
2681
3413
  restartMcplServer(id: string, newConfig?: import('./mcpl/types.js').McplServerConfig): Promise<void>;
2682
3414
  private runRestartMcplServer;
@@ -2732,6 +3464,14 @@ export declare class AgentFramework {
2732
3464
  command?: string;
2733
3465
  url?: string;
2734
3466
  }>;
3467
+ /**
3468
+ * An inbound MCPL handler, contained: EventEmitter doesn't consume the
3469
+ * promise a listener returns, so this keeps each handler's throw or
3470
+ * rejection at this boundary, including failures after channels/register or
3471
+ * channels/changed has acknowledged the request. It's invoked at once, so
3472
+ * control-plane replies keep their acknowledge-before-reconcile order.
3473
+ */
3474
+ private containedInboundHandler;
2735
3475
  /**
2736
3476
  * Wire event listeners on an MCPL server connection.
2737
3477
  * Push events and inference requests are deferred to Steps 6/7.