@animalabs/agent-framework 0.22.1 → 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 (946) hide show
  1. package/README.md +4 -2
  2. package/dist/src/agent.d.ts +266 -28
  3. package/dist/src/agent.d.ts.map +1 -1
  4. package/dist/src/agent.js +539 -104
  5. package/dist/src/agent.js.map +1 -1
  6. package/dist/src/api/mcp-server-core.d.ts +41 -0
  7. package/dist/src/api/mcp-server-core.d.ts.map +1 -0
  8. package/dist/src/api/mcp-server-core.js +593 -0
  9. package/dist/src/api/mcp-server-core.js.map +1 -0
  10. package/dist/src/api/mcp-server.d.ts +2 -36
  11. package/dist/src/api/mcp-server.d.ts.map +1 -1
  12. package/dist/src/api/mcp-server.js +15 -595
  13. package/dist/src/api/mcp-server.js.map +1 -1
  14. package/dist/src/api/server.d.ts +9 -1
  15. package/dist/src/api/server.d.ts.map +1 -1
  16. package/dist/src/api/server.js +55 -27
  17. package/dist/src/api/server.js.map +1 -1
  18. package/dist/src/api/types.d.ts +10 -2
  19. package/dist/src/api/types.d.ts.map +1 -1
  20. package/dist/src/branch-names.d.ts +14 -0
  21. package/dist/src/branch-names.d.ts.map +1 -0
  22. package/dist/src/branch-names.js +22 -0
  23. package/dist/src/branch-names.js.map +1 -0
  24. package/dist/src/closest-names.d.ts +28 -0
  25. package/dist/src/closest-names.d.ts.map +1 -0
  26. package/dist/src/closest-names.js +98 -0
  27. package/dist/src/closest-names.js.map +1 -0
  28. package/dist/src/code-execution/py-runner.d.ts +16 -5
  29. package/dist/src/code-execution/py-runner.d.ts.map +1 -1
  30. package/dist/src/code-execution/py-runner.js +186 -74
  31. package/dist/src/code-execution/py-runner.js.map +1 -1
  32. package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
  33. package/dist/src/code-execution/runtime-py.js +49 -3
  34. package/dist/src/code-execution/runtime-py.js.map +1 -1
  35. package/dist/src/code-execution/tool-definition.d.ts +12 -1
  36. package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
  37. package/dist/src/code-execution/tool-definition.js +21 -3
  38. package/dist/src/code-execution/tool-definition.js.map +1 -1
  39. package/dist/src/config-checks.d.ts +28 -0
  40. package/dist/src/config-checks.d.ts.map +1 -0
  41. package/dist/src/config-checks.js +52 -0
  42. package/dist/src/config-checks.js.map +1 -0
  43. package/dist/src/deadline-timer.d.ts +21 -0
  44. package/dist/src/deadline-timer.d.ts.map +1 -0
  45. package/dist/src/deadline-timer.js +43 -0
  46. package/dist/src/deadline-timer.js.map +1 -0
  47. package/dist/src/error-message.d.ts +30 -0
  48. package/dist/src/error-message.d.ts.map +1 -0
  49. package/dist/src/error-message.js +50 -0
  50. package/dist/src/error-message.js.map +1 -0
  51. package/dist/src/framework.d.ts +1212 -192
  52. package/dist/src/framework.d.ts.map +1 -1
  53. package/dist/src/framework.js +6686 -1835
  54. package/dist/src/framework.js.map +1 -1
  55. package/dist/src/gate/event-gate.d.ts +8 -0
  56. package/dist/src/gate/event-gate.d.ts.map +1 -1
  57. package/dist/src/gate/event-gate.js +27 -3
  58. package/dist/src/gate/event-gate.js.map +1 -1
  59. package/dist/src/gate/gate-script.d.ts.map +1 -1
  60. package/dist/src/gate/gate-script.js.map +1 -1
  61. package/dist/src/index.d.ts +5 -3
  62. package/dist/src/index.d.ts.map +1 -1
  63. package/dist/src/index.js +5 -3
  64. package/dist/src/index.js.map +1 -1
  65. package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
  66. package/dist/src/mcpl/channel-registry.d.ts +170 -13
  67. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  68. package/dist/src/mcpl/channel-registry.js +499 -258
  69. package/dist/src/mcpl/channel-registry.js.map +1 -1
  70. package/dist/src/mcpl/checkpoint-manager.d.ts +21 -1
  71. package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
  72. package/dist/src/mcpl/checkpoint-manager.js +91 -30
  73. package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
  74. package/dist/src/mcpl/conversation-router.d.ts +19 -3
  75. package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
  76. package/dist/src/mcpl/conversation-router.js +23 -8
  77. package/dist/src/mcpl/conversation-router.js.map +1 -1
  78. package/dist/src/mcpl/convert-block.d.ts +20 -0
  79. package/dist/src/mcpl/convert-block.d.ts.map +1 -0
  80. package/dist/src/mcpl/convert-block.js +89 -0
  81. package/dist/src/mcpl/convert-block.js.map +1 -0
  82. package/dist/src/mcpl/errors.d.ts +13 -0
  83. package/dist/src/mcpl/errors.d.ts.map +1 -1
  84. package/dist/src/mcpl/errors.js +28 -0
  85. package/dist/src/mcpl/errors.js.map +1 -1
  86. package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
  87. package/dist/src/mcpl/feature-set-manager.js +4 -3
  88. package/dist/src/mcpl/feature-set-manager.js.map +1 -1
  89. package/dist/src/mcpl/hook-orchestrator.d.ts +23 -0
  90. package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
  91. package/dist/src/mcpl/hook-orchestrator.js +83 -72
  92. package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
  93. package/dist/src/mcpl/inbound-source.d.ts +114 -0
  94. package/dist/src/mcpl/inbound-source.d.ts.map +1 -0
  95. package/dist/src/mcpl/inbound-source.js +83 -0
  96. package/dist/src/mcpl/inbound-source.js.map +1 -0
  97. package/dist/src/mcpl/index.d.ts +3 -1
  98. package/dist/src/mcpl/index.d.ts.map +1 -1
  99. package/dist/src/mcpl/index.js +3 -1
  100. package/dist/src/mcpl/index.js.map +1 -1
  101. package/dist/src/mcpl/inference-router.d.ts +15 -11
  102. package/dist/src/mcpl/inference-router.d.ts.map +1 -1
  103. package/dist/src/mcpl/inference-router.js +153 -84
  104. package/dist/src/mcpl/inference-router.js.map +1 -1
  105. package/dist/src/mcpl/log-value.d.ts +54 -0
  106. package/dist/src/mcpl/log-value.d.ts.map +1 -0
  107. package/dist/src/mcpl/log-value.js +109 -0
  108. package/dist/src/mcpl/log-value.js.map +1 -0
  109. package/dist/src/mcpl/prose-stream-router.d.ts +6 -6
  110. package/dist/src/mcpl/prose-stream-router.d.ts.map +1 -1
  111. package/dist/src/mcpl/prose-stream-router.js +4 -4
  112. package/dist/src/mcpl/prose-stream-router.js.map +1 -1
  113. package/dist/src/mcpl/push-coalescer.d.ts +64 -7
  114. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  115. package/dist/src/mcpl/push-coalescer.js +121 -24
  116. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  117. package/dist/src/mcpl/push-handler.d.ts +38 -8
  118. package/dist/src/mcpl/push-handler.d.ts.map +1 -1
  119. package/dist/src/mcpl/push-handler.js +77 -78
  120. package/dist/src/mcpl/push-handler.js.map +1 -1
  121. package/dist/src/mcpl/reference-fetcher.d.ts +14 -2
  122. package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
  123. package/dist/src/mcpl/reference-fetcher.js +72 -30
  124. package/dist/src/mcpl/reference-fetcher.js.map +1 -1
  125. package/dist/src/mcpl/references.d.ts +49 -14
  126. package/dist/src/mcpl/references.d.ts.map +1 -1
  127. package/dist/src/mcpl/references.js +74 -21
  128. package/dist/src/mcpl/references.js.map +1 -1
  129. package/dist/src/mcpl/refusal-lines.d.ts +37 -0
  130. package/dist/src/mcpl/refusal-lines.d.ts.map +1 -0
  131. package/dist/src/mcpl/refusal-lines.js +61 -0
  132. package/dist/src/mcpl/refusal-lines.js.map +1 -0
  133. package/dist/src/mcpl/scope-manager.d.ts.map +1 -1
  134. package/dist/src/mcpl/server-connection.d.ts +107 -12
  135. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  136. package/dist/src/mcpl/server-connection.js +470 -139
  137. package/dist/src/mcpl/server-connection.js.map +1 -1
  138. package/dist/src/mcpl/server-registry.d.ts +10 -1
  139. package/dist/src/mcpl/server-registry.d.ts.map +1 -1
  140. package/dist/src/mcpl/server-registry.js +14 -3
  141. package/dist/src/mcpl/server-registry.js.map +1 -1
  142. package/dist/src/mcpl/skip-reply-wake.d.ts +36 -0
  143. package/dist/src/mcpl/skip-reply-wake.d.ts.map +1 -0
  144. package/dist/src/mcpl/skip-reply-wake.js +55 -0
  145. package/dist/src/mcpl/skip-reply-wake.js.map +1 -0
  146. package/dist/src/mcpl/tool-classes.d.ts +1 -1
  147. package/dist/src/mcpl/tool-classes.d.ts.map +1 -1
  148. package/dist/src/mcpl/tool-classes.js +3 -2
  149. package/dist/src/mcpl/tool-classes.js.map +1 -1
  150. package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
  151. package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
  152. package/dist/src/mcpl/transport.d.ts +74 -7
  153. package/dist/src/mcpl/transport.d.ts.map +1 -1
  154. package/dist/src/mcpl/transport.js +209 -22
  155. package/dist/src/mcpl/transport.js.map +1 -1
  156. package/dist/src/mcpl/types.d.ts +43 -28
  157. package/dist/src/mcpl/types.d.ts.map +1 -1
  158. package/dist/src/mcpl/types.js.map +1 -1
  159. package/dist/src/mcpl/visible-content.d.ts +15 -0
  160. package/dist/src/mcpl/visible-content.d.ts.map +1 -1
  161. package/dist/src/mcpl/visible-content.js +25 -0
  162. package/dist/src/mcpl/visible-content.js.map +1 -1
  163. package/dist/src/module-registry.d.ts +19 -1
  164. package/dist/src/module-registry.d.ts.map +1 -1
  165. package/dist/src/module-registry.js +54 -25
  166. package/dist/src/module-registry.js.map +1 -1
  167. package/dist/src/modules/api/index.d.ts.map +1 -1
  168. package/dist/src/modules/api/index.js +1 -1
  169. package/dist/src/modules/api/index.js.map +1 -1
  170. package/dist/src/modules/discord/discord-js-client.d.ts +1 -0
  171. package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
  172. package/dist/src/modules/discord/discord-js-client.js +25 -9
  173. package/dist/src/modules/discord/discord-js-client.js.map +1 -1
  174. package/dist/src/modules/discord/index.d.ts +29 -3
  175. package/dist/src/modules/discord/index.d.ts.map +1 -1
  176. package/dist/src/modules/discord/index.js +383 -145
  177. package/dist/src/modules/discord/index.js.map +1 -1
  178. package/dist/src/modules/discord/types.d.ts +14 -1
  179. package/dist/src/modules/discord/types.d.ts.map +1 -1
  180. package/dist/src/modules/health/index.d.ts.map +1 -1
  181. package/dist/src/modules/health/index.js +2 -1
  182. package/dist/src/modules/health/index.js.map +1 -1
  183. package/dist/src/modules/history/index.d.ts +3 -1
  184. package/dist/src/modules/history/index.d.ts.map +1 -1
  185. package/dist/src/modules/history/index.js +359 -127
  186. package/dist/src/modules/history/index.js.map +1 -1
  187. package/dist/src/modules/history/semantic.d.ts +28 -1
  188. package/dist/src/modules/history/semantic.d.ts.map +1 -1
  189. package/dist/src/modules/history/semantic.js +177 -32
  190. package/dist/src/modules/history/semantic.js.map +1 -1
  191. package/dist/src/modules/unknown-tool.d.ts +10 -0
  192. package/dist/src/modules/unknown-tool.d.ts.map +1 -0
  193. package/dist/src/modules/unknown-tool.js +17 -0
  194. package/dist/src/modules/unknown-tool.js.map +1 -0
  195. package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
  196. package/dist/src/modules/workspace/branch-intent.js.map +1 -1
  197. package/dist/src/modules/workspace/disk-agreement.d.ts +54 -6
  198. package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
  199. package/dist/src/modules/workspace/disk-agreement.js +93 -27
  200. package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
  201. package/dist/src/modules/workspace/effects.d.ts +64 -6
  202. package/dist/src/modules/workspace/effects.d.ts.map +1 -1
  203. package/dist/src/modules/workspace/effects.js +291 -44
  204. package/dist/src/modules/workspace/effects.js.map +1 -1
  205. package/dist/src/modules/workspace/index.d.ts +127 -27
  206. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  207. package/dist/src/modules/workspace/index.js +821 -248
  208. package/dist/src/modules/workspace/index.js.map +1 -1
  209. package/dist/src/modules/workspace/observe.d.ts +117 -15
  210. package/dist/src/modules/workspace/observe.d.ts.map +1 -1
  211. package/dist/src/modules/workspace/observe.js +436 -51
  212. package/dist/src/modules/workspace/observe.js.map +1 -1
  213. package/dist/src/modules/workspace/reconcile.d.ts +75 -8
  214. package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
  215. package/dist/src/modules/workspace/reconcile.js +576 -68
  216. package/dist/src/modules/workspace/reconcile.js.map +1 -1
  217. package/dist/src/modules/workspace/types.d.ts +42 -3
  218. package/dist/src/modules/workspace/types.d.ts.map +1 -1
  219. package/dist/src/modules/workspace/types.js.map +1 -1
  220. package/dist/src/modules/workspace/watcher.d.ts +7 -2
  221. package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
  222. package/dist/src/modules/workspace/watcher.js +28 -4
  223. package/dist/src/modules/workspace/watcher.js.map +1 -1
  224. package/dist/src/operator-log.d.ts.map +1 -1
  225. package/dist/src/operator-log.js.map +1 -1
  226. package/dist/src/prose-drafts.d.ts +240 -0
  227. package/dist/src/prose-drafts.d.ts.map +1 -0
  228. package/dist/src/prose-drafts.js +362 -0
  229. package/dist/src/prose-drafts.js.map +1 -0
  230. package/dist/src/prose-segments.d.ts +21 -2
  231. package/dist/src/prose-segments.d.ts.map +1 -1
  232. package/dist/src/prose-segments.js +46 -9
  233. package/dist/src/prose-segments.js.map +1 -1
  234. package/dist/src/provider-waits.d.ts.map +1 -1
  235. package/dist/src/provider-waits.js.map +1 -1
  236. package/dist/src/queue.d.ts.map +1 -1
  237. package/dist/src/record-journal.d.ts.map +1 -1
  238. package/dist/src/record-journal.js.map +1 -1
  239. package/dist/src/recovery/discord-awareness-outbox.d.ts.map +1 -1
  240. package/dist/src/recovery/discord-awareness-outbox.js.map +1 -1
  241. package/dist/src/recovery/offline-branch.d.ts +1 -0
  242. package/dist/src/recovery/offline-branch.d.ts.map +1 -1
  243. package/dist/src/recovery/offline-branch.js +32 -25
  244. package/dist/src/recovery/offline-branch.js.map +1 -1
  245. package/dist/src/recovery/recover-cli.js.map +1 -1
  246. package/dist/src/runtime/liveness-watchdog.d.ts.map +1 -1
  247. package/dist/src/runtime/liveness-watchdog.js.map +1 -1
  248. package/dist/src/safe-slice.d.ts +5 -1
  249. package/dist/src/safe-slice.d.ts.map +1 -1
  250. package/dist/src/safe-slice.js +9 -1
  251. package/dist/src/safe-slice.js.map +1 -1
  252. package/dist/src/shutdown.d.ts.map +1 -1
  253. package/dist/src/shutdown.js.map +1 -1
  254. package/dist/src/stored-removal.d.ts +73 -0
  255. package/dist/src/stored-removal.d.ts.map +1 -0
  256. package/dist/src/stored-removal.js +100 -0
  257. package/dist/src/stored-removal.js.map +1 -0
  258. package/dist/src/thinking-token-stamp.js.map +1 -1
  259. package/dist/src/tool-image-ledger.d.ts +87 -19
  260. package/dist/src/tool-image-ledger.d.ts.map +1 -1
  261. package/dist/src/tool-image-ledger.js +135 -32
  262. package/dist/src/tool-image-ledger.js.map +1 -1
  263. package/dist/src/tool-presentation.d.ts +9 -0
  264. package/dist/src/tool-presentation.d.ts.map +1 -1
  265. package/dist/src/tool-presentation.js +257 -60
  266. package/dist/src/tool-presentation.js.map +1 -1
  267. package/dist/src/tool-result-guard.d.ts.map +1 -1
  268. package/dist/src/tool-result-guard.js +7 -10
  269. package/dist/src/tool-result-guard.js.map +1 -1
  270. package/dist/src/tool-result-history.d.ts +32 -3
  271. package/dist/src/tool-result-history.d.ts.map +1 -1
  272. package/dist/src/tool-result-history.js +106 -19
  273. package/dist/src/tool-result-history.js.map +1 -1
  274. package/dist/src/tune-out/coordinator.d.ts +25 -1
  275. package/dist/src/tune-out/coordinator.d.ts.map +1 -1
  276. package/dist/src/tune-out/coordinator.js +260 -65
  277. package/dist/src/tune-out/coordinator.js.map +1 -1
  278. package/dist/src/tune-out/tools.d.ts +1 -1
  279. package/dist/src/tune-out/tools.d.ts.map +1 -1
  280. package/dist/src/types/agent.d.ts +59 -11
  281. package/dist/src/types/agent.d.ts.map +1 -1
  282. package/dist/src/types/events.d.ts +17 -0
  283. package/dist/src/types/events.d.ts.map +1 -1
  284. package/dist/src/types/framework.d.ts +31 -5
  285. package/dist/src/types/framework.d.ts.map +1 -1
  286. package/dist/src/types/inference-log.d.ts +1 -1
  287. package/dist/src/types/inference-log.d.ts.map +1 -1
  288. package/dist/src/types/module.d.ts +30 -7
  289. package/dist/src/types/module.d.ts.map +1 -1
  290. package/dist/src/types/trace.d.ts +151 -11
  291. package/dist/src/types/trace.d.ts.map +1 -1
  292. package/dist/src/usage/usage-tracker.d.ts +5 -0
  293. package/dist/src/usage/usage-tracker.d.ts.map +1 -1
  294. package/dist/src/usage/usage-tracker.js +35 -8
  295. package/dist/src/usage/usage-tracker.js.map +1 -1
  296. package/package.json +10 -9
  297. package/src/agent.ts +572 -105
  298. package/src/api/mcp-server-core.ts +681 -0
  299. package/src/api/mcp-server.ts +16 -685
  300. package/src/api/server.ts +55 -30
  301. package/src/api/types.ts +10 -2
  302. package/src/branch-names.ts +19 -0
  303. package/src/closest-names.ts +94 -0
  304. package/src/code-execution/py-runner.ts +200 -76
  305. package/src/code-execution/runtime-py.ts +49 -3
  306. package/src/code-execution/tool-definition.ts +28 -4
  307. package/src/config-checks.ts +48 -0
  308. package/src/deadline-timer.ts +44 -0
  309. package/src/error-message.ts +48 -0
  310. package/src/framework.ts +7158 -1936
  311. package/src/gate/event-gate.ts +28 -3
  312. package/src/index.ts +12 -3
  313. package/src/mcpl/channel-registry.ts +615 -289
  314. package/src/mcpl/checkpoint-manager.ts +104 -29
  315. package/src/mcpl/conversation-router.ts +28 -8
  316. package/src/mcpl/convert-block.ts +97 -0
  317. package/src/mcpl/errors.ts +28 -0
  318. package/src/mcpl/feature-set-manager.ts +4 -3
  319. package/src/mcpl/hook-orchestrator.ts +84 -77
  320. package/src/mcpl/inbound-source.ts +156 -0
  321. package/src/mcpl/index.ts +10 -1
  322. package/src/mcpl/inference-router.ts +174 -99
  323. package/src/mcpl/log-value.ts +116 -0
  324. package/src/mcpl/prose-stream-router.ts +6 -6
  325. package/src/mcpl/push-coalescer.ts +124 -24
  326. package/src/mcpl/push-handler.ts +86 -84
  327. package/src/mcpl/reference-fetcher.ts +71 -26
  328. package/src/mcpl/references.ts +81 -22
  329. package/src/mcpl/refusal-lines.ts +59 -0
  330. package/src/mcpl/server-connection.ts +496 -142
  331. package/src/mcpl/server-registry.ts +15 -4
  332. package/src/mcpl/skip-reply-wake.ts +73 -0
  333. package/src/mcpl/tool-classes.ts +3 -2
  334. package/src/mcpl/transport.ts +219 -26
  335. package/src/mcpl/types.ts +18 -3
  336. package/src/mcpl/visible-content.ts +27 -0
  337. package/src/module-registry.ts +58 -23
  338. package/src/modules/api/index.ts +1 -1
  339. package/src/modules/discord/discord-js-client.ts +26 -10
  340. package/src/modules/discord/index.ts +395 -160
  341. package/src/modules/discord/types.ts +15 -2
  342. package/src/modules/health/index.ts +2 -1
  343. package/src/modules/history/index.ts +410 -120
  344. package/src/modules/history/semantic.ts +189 -32
  345. package/src/modules/unknown-tool.ts +16 -0
  346. package/src/modules/workspace/disk-agreement.ts +125 -21
  347. package/src/modules/workspace/effects.ts +279 -35
  348. package/src/modules/workspace/index.ts +841 -261
  349. package/src/modules/workspace/observe.ts +456 -56
  350. package/src/modules/workspace/reconcile.ts +688 -76
  351. package/src/modules/workspace/types.ts +41 -2
  352. package/src/modules/workspace/watcher.ts +27 -4
  353. package/src/prose-drafts.ts +481 -0
  354. package/src/prose-segments.ts +51 -8
  355. package/src/recovery/offline-branch.ts +36 -29
  356. package/src/safe-slice.ts +9 -1
  357. package/src/stored-removal.ts +126 -0
  358. package/src/tool-image-ledger.ts +153 -34
  359. package/src/tool-presentation.ts +224 -40
  360. package/src/tool-result-guard.ts +7 -8
  361. package/src/tool-result-history.ts +124 -20
  362. package/src/tune-out/coordinator.ts +259 -65
  363. package/src/types/agent.ts +59 -13
  364. package/src/types/events.ts +17 -0
  365. package/src/types/framework.ts +31 -5
  366. package/src/types/inference-log.ts +1 -1
  367. package/src/types/module.ts +31 -7
  368. package/src/types/trace.ts +158 -12
  369. package/src/usage/usage-tracker.ts +32 -8
  370. package/dist/test/activation-request-sanitize.test.d.ts +0 -2
  371. package/dist/test/activation-request-sanitize.test.d.ts.map +0 -1
  372. package/dist/test/activation-request-sanitize.test.js +0 -89
  373. package/dist/test/activation-request-sanitize.test.js.map +0 -1
  374. package/dist/test/agent-cache-ttl.test.d.ts +0 -2
  375. package/dist/test/agent-cache-ttl.test.d.ts.map +0 -1
  376. package/dist/test/agent-cache-ttl.test.js +0 -41
  377. package/dist/test/agent-cache-ttl.test.js.map +0 -1
  378. package/dist/test/agent-runtime-settings.test.d.ts +0 -2
  379. package/dist/test/agent-runtime-settings.test.d.ts.map +0 -1
  380. package/dist/test/agent-runtime-settings.test.js +0 -462
  381. package/dist/test/agent-runtime-settings.test.js.map +0 -1
  382. package/dist/test/api-admin-gate.test.d.ts +0 -2
  383. package/dist/test/api-admin-gate.test.d.ts.map +0 -1
  384. package/dist/test/api-admin-gate.test.js +0 -116
  385. package/dist/test/api-admin-gate.test.js.map +0 -1
  386. package/dist/test/assistant-persist-refusal.test.d.ts +0 -2
  387. package/dist/test/assistant-persist-refusal.test.d.ts.map +0 -1
  388. package/dist/test/assistant-persist-refusal.test.js +0 -63
  389. package/dist/test/assistant-persist-refusal.test.js.map +0 -1
  390. package/dist/test/batched-wake-locus.test.d.ts +0 -2
  391. package/dist/test/batched-wake-locus.test.d.ts.map +0 -1
  392. package/dist/test/batched-wake-locus.test.js +0 -166
  393. package/dist/test/batched-wake-locus.test.js.map +0 -1
  394. package/dist/test/busy-agent-scheduler.test.d.ts +0 -2
  395. package/dist/test/busy-agent-scheduler.test.d.ts.map +0 -1
  396. package/dist/test/busy-agent-scheduler.test.js +0 -92
  397. package/dist/test/busy-agent-scheduler.test.js.map +0 -1
  398. package/dist/test/channel-incoming-targeting.test.d.ts +0 -2
  399. package/dist/test/channel-incoming-targeting.test.d.ts.map +0 -1
  400. package/dist/test/channel-incoming-targeting.test.js +0 -81
  401. package/dist/test/channel-incoming-targeting.test.js.map +0 -1
  402. package/dist/test/channel-label-history.test.d.ts +0 -2
  403. package/dist/test/channel-label-history.test.d.ts.map +0 -1
  404. package/dist/test/channel-label-history.test.js +0 -424
  405. package/dist/test/channel-label-history.test.js.map +0 -1
  406. package/dist/test/channel-lifecycle-provenance.test.d.ts +0 -2
  407. package/dist/test/channel-lifecycle-provenance.test.d.ts.map +0 -1
  408. package/dist/test/channel-lifecycle-provenance.test.js +0 -47
  409. package/dist/test/channel-lifecycle-provenance.test.js.map +0 -1
  410. package/dist/test/channel-registry-routing.test.d.ts +0 -2
  411. package/dist/test/channel-registry-routing.test.d.ts.map +0 -1
  412. package/dist/test/channel-registry-routing.test.js +0 -446
  413. package/dist/test/channel-registry-routing.test.js.map +0 -1
  414. package/dist/test/channel-registry-typing.test.d.ts +0 -2
  415. package/dist/test/channel-registry-typing.test.d.ts.map +0 -1
  416. package/dist/test/channel-registry-typing.test.js +0 -91
  417. package/dist/test/channel-registry-typing.test.js.map +0 -1
  418. package/dist/test/channels-changed-respond-first.test.d.ts +0 -2
  419. package/dist/test/channels-changed-respond-first.test.d.ts.map +0 -1
  420. package/dist/test/channels-changed-respond-first.test.js +0 -74
  421. package/dist/test/channels-changed-respond-first.test.js.map +0 -1
  422. package/dist/test/checkpoint-attribution.test.d.ts +0 -2
  423. package/dist/test/checkpoint-attribution.test.d.ts.map +0 -1
  424. package/dist/test/checkpoint-attribution.test.js +0 -200
  425. package/dist/test/checkpoint-attribution.test.js.map +0 -1
  426. package/dist/test/code-execution.test.d.ts +0 -11
  427. package/dist/test/code-execution.test.d.ts.map +0 -1
  428. package/dist/test/code-execution.test.js +0 -1272
  429. package/dist/test/code-execution.test.js.map +0 -1
  430. package/dist/test/component-defaults.test.d.ts +0 -2
  431. package/dist/test/component-defaults.test.d.ts.map +0 -1
  432. package/dist/test/component-defaults.test.js +0 -54
  433. package/dist/test/component-defaults.test.js.map +0 -1
  434. package/dist/test/conversation-fork-injection-scoping.test.d.ts +0 -2
  435. package/dist/test/conversation-fork-injection-scoping.test.d.ts.map +0 -1
  436. package/dist/test/conversation-fork-injection-scoping.test.js +0 -200
  437. package/dist/test/conversation-fork-injection-scoping.test.js.map +0 -1
  438. package/dist/test/conversation-router.test.d.ts +0 -2
  439. package/dist/test/conversation-router.test.d.ts.map +0 -1
  440. package/dist/test/conversation-router.test.js +0 -174
  441. package/dist/test/conversation-router.test.js.map +0 -1
  442. package/dist/test/conversation-routing.test.d.ts +0 -7
  443. package/dist/test/conversation-routing.test.d.ts.map +0 -1
  444. package/dist/test/conversation-routing.test.js +0 -387
  445. package/dist/test/conversation-routing.test.js.map +0 -1
  446. package/dist/test/deferred-wake-integrity.test.d.ts +0 -29
  447. package/dist/test/deferred-wake-integrity.test.d.ts.map +0 -1
  448. package/dist/test/deferred-wake-integrity.test.js +0 -320
  449. package/dist/test/deferred-wake-integrity.test.js.map +0 -1
  450. package/dist/test/discord-awareness-outbox.test.d.ts +0 -2
  451. package/dist/test/discord-awareness-outbox.test.d.ts.map +0 -1
  452. package/dist/test/discord-awareness-outbox.test.js +0 -267
  453. package/dist/test/discord-awareness-outbox.test.js.map +0 -1
  454. package/dist/test/discord-history-delete-window.test.d.ts +0 -2
  455. package/dist/test/discord-history-delete-window.test.d.ts.map +0 -1
  456. package/dist/test/discord-history-delete-window.test.js +0 -81
  457. package/dist/test/discord-history-delete-window.test.js.map +0 -1
  458. package/dist/test/discord-history-sync.test.d.ts +0 -2
  459. package/dist/test/discord-history-sync.test.d.ts.map +0 -1
  460. package/dist/test/discord-history-sync.test.js +0 -56
  461. package/dist/test/discord-history-sync.test.js.map +0 -1
  462. package/dist/test/ephemeral-settle.test.d.ts +0 -2
  463. package/dist/test/ephemeral-settle.test.d.ts.map +0 -1
  464. package/dist/test/ephemeral-settle.test.js +0 -354
  465. package/dist/test/ephemeral-settle.test.js.map +0 -1
  466. package/dist/test/event-gate-passthrough.test.d.ts +0 -15
  467. package/dist/test/event-gate-passthrough.test.d.ts.map +0 -1
  468. package/dist/test/event-gate-passthrough.test.js +0 -289
  469. package/dist/test/event-gate-passthrough.test.js.map +0 -1
  470. package/dist/test/event-gate-policy-mutation.test.d.ts +0 -2
  471. package/dist/test/event-gate-policy-mutation.test.d.ts.map +0 -1
  472. package/dist/test/event-gate-policy-mutation.test.js +0 -137
  473. package/dist/test/event-gate-policy-mutation.test.js.map +0 -1
  474. package/dist/test/event-gate-rate-limit.test.d.ts +0 -2
  475. package/dist/test/event-gate-rate-limit.test.d.ts.map +0 -1
  476. package/dist/test/event-gate-rate-limit.test.js +0 -627
  477. package/dist/test/event-gate-rate-limit.test.js.map +0 -1
  478. package/dist/test/event-gate-script.test.d.ts +0 -2
  479. package/dist/test/event-gate-script.test.d.ts.map +0 -1
  480. package/dist/test/event-gate-script.test.js +0 -95
  481. package/dist/test/event-gate-script.test.js.map +0 -1
  482. package/dist/test/event-gate-selfwake.test.d.ts +0 -15
  483. package/dist/test/event-gate-selfwake.test.d.ts.map +0 -1
  484. package/dist/test/event-gate-selfwake.test.js +0 -125
  485. package/dist/test/event-gate-selfwake.test.js.map +0 -1
  486. package/dist/test/event-gate-tags.test.d.ts +0 -2
  487. package/dist/test/event-gate-tags.test.d.ts.map +0 -1
  488. package/dist/test/event-gate-tags.test.js +0 -76
  489. package/dist/test/event-gate-tags.test.js.map +0 -1
  490. package/dist/test/event-gate.test.d.ts +0 -2
  491. package/dist/test/event-gate.test.d.ts.map +0 -1
  492. package/dist/test/event-gate.test.js +0 -919
  493. package/dist/test/event-gate.test.js.map +0 -1
  494. package/dist/test/explicit-prose-routing.test.d.ts +0 -11
  495. package/dist/test/explicit-prose-routing.test.d.ts.map +0 -1
  496. package/dist/test/explicit-prose-routing.test.js +0 -1394
  497. package/dist/test/explicit-prose-routing.test.js.map +0 -1
  498. package/dist/test/framework.test.d.ts +0 -5
  499. package/dist/test/framework.test.d.ts.map +0 -1
  500. package/dist/test/framework.test.js +0 -1048
  501. package/dist/test/framework.test.js.map +0 -1
  502. package/dist/test/gather-context-timeout.test.d.ts +0 -2
  503. package/dist/test/gather-context-timeout.test.d.ts.map +0 -1
  504. package/dist/test/gather-context-timeout.test.js +0 -120
  505. package/dist/test/gather-context-timeout.test.js.map +0 -1
  506. package/dist/test/health-snapshot.test.d.ts +0 -2
  507. package/dist/test/health-snapshot.test.d.ts.map +0 -1
  508. package/dist/test/health-snapshot.test.js +0 -74
  509. package/dist/test/health-snapshot.test.js.map +0 -1
  510. package/dist/test/helpers/coalescing-fixture.d.ts +0 -72
  511. package/dist/test/helpers/coalescing-fixture.d.ts.map +0 -1
  512. package/dist/test/helpers/coalescing-fixture.js +0 -146
  513. package/dist/test/helpers/coalescing-fixture.js.map +0 -1
  514. package/dist/test/helpers/coalescing-kill-child.d.ts +0 -2
  515. package/dist/test/helpers/coalescing-kill-child.d.ts.map +0 -1
  516. package/dist/test/helpers/coalescing-kill-child.js +0 -24
  517. package/dist/test/helpers/coalescing-kill-child.js.map +0 -1
  518. package/dist/test/helpers/mock-membrane.d.ts +0 -53
  519. package/dist/test/helpers/mock-membrane.d.ts.map +0 -1
  520. package/dist/test/helpers/mock-membrane.js +0 -168
  521. package/dist/test/helpers/mock-membrane.js.map +0 -1
  522. package/dist/test/helpers/pytc-stop-rows.d.ts +0 -11
  523. package/dist/test/helpers/pytc-stop-rows.d.ts.map +0 -1
  524. package/dist/test/helpers/pytc-stop-rows.js +0 -143
  525. package/dist/test/helpers/pytc-stop-rows.js.map +0 -1
  526. package/dist/test/helpers/quiesce-crash-child.d.ts +0 -2
  527. package/dist/test/helpers/quiesce-crash-child.d.ts.map +0 -1
  528. package/dist/test/helpers/quiesce-crash-child.js +0 -156
  529. package/dist/test/helpers/quiesce-crash-child.js.map +0 -1
  530. package/dist/test/history-module-overview.test.d.ts +0 -2
  531. package/dist/test/history-module-overview.test.d.ts.map +0 -1
  532. package/dist/test/history-module-overview.test.js +0 -711
  533. package/dist/test/history-module-overview.test.js.map +0 -1
  534. package/dist/test/history-module-realstore.test.d.ts +0 -2
  535. package/dist/test/history-module-realstore.test.d.ts.map +0 -1
  536. package/dist/test/history-module-realstore.test.js +0 -363
  537. package/dist/test/history-module-realstore.test.js.map +0 -1
  538. package/dist/test/history-module-semantic.test.d.ts +0 -2
  539. package/dist/test/history-module-semantic.test.d.ts.map +0 -1
  540. package/dist/test/history-module-semantic.test.js +0 -213
  541. package/dist/test/history-module-semantic.test.js.map +0 -1
  542. package/dist/test/history-module-ux.test.d.ts +0 -2
  543. package/dist/test/history-module-ux.test.d.ts.map +0 -1
  544. package/dist/test/history-module-ux.test.js +0 -304
  545. package/dist/test/history-module-ux.test.js.map +0 -1
  546. package/dist/test/history-module.test.d.ts +0 -2
  547. package/dist/test/history-module.test.d.ts.map +0 -1
  548. package/dist/test/history-module.test.js +0 -619
  549. package/dist/test/history-module.test.js.map +0 -1
  550. package/dist/test/history-semantic-review-findings.test.d.ts +0 -2
  551. package/dist/test/history-semantic-review-findings.test.d.ts.map +0 -1
  552. package/dist/test/history-semantic-review-findings.test.js +0 -338
  553. package/dist/test/history-semantic-review-findings.test.js.map +0 -1
  554. package/dist/test/history-semantic-sync-converges.test.d.ts +0 -2
  555. package/dist/test/history-semantic-sync-converges.test.d.ts.map +0 -1
  556. package/dist/test/history-semantic-sync-converges.test.js +0 -109
  557. package/dist/test/history-semantic-sync-converges.test.js.map +0 -1
  558. package/dist/test/host-quiesce.test.d.ts +0 -2
  559. package/dist/test/host-quiesce.test.d.ts.map +0 -1
  560. package/dist/test/host-quiesce.test.js +0 -863
  561. package/dist/test/host-quiesce.test.js.map +0 -1
  562. package/dist/test/inference-exhaustion-rewind.test.d.ts +0 -2
  563. package/dist/test/inference-exhaustion-rewind.test.d.ts.map +0 -1
  564. package/dist/test/inference-exhaustion-rewind.test.js +0 -309
  565. package/dist/test/inference-exhaustion-rewind.test.js.map +0 -1
  566. package/dist/test/inference-failure-bounds.test.d.ts +0 -2
  567. package/dist/test/inference-failure-bounds.test.d.ts.map +0 -1
  568. package/dist/test/inference-failure-bounds.test.js +0 -1201
  569. package/dist/test/inference-failure-bounds.test.js.map +0 -1
  570. package/dist/test/inference-failure-observability.test.d.ts +0 -2
  571. package/dist/test/inference-failure-observability.test.d.ts.map +0 -1
  572. package/dist/test/inference-failure-observability.test.js +0 -84
  573. package/dist/test/inference-failure-observability.test.js.map +0 -1
  574. package/dist/test/journal-tool.test.d.ts +0 -2
  575. package/dist/test/journal-tool.test.d.ts.map +0 -1
  576. package/dist/test/journal-tool.test.js +0 -33
  577. package/dist/test/journal-tool.test.js.map +0 -1
  578. package/dist/test/kv-unified-open-flight-retry.test.d.ts +0 -2
  579. package/dist/test/kv-unified-open-flight-retry.test.d.ts.map +0 -1
  580. package/dist/test/kv-unified-open-flight-retry.test.js +0 -189
  581. package/dist/test/kv-unified-open-flight-retry.test.js.map +0 -1
  582. package/dist/test/kv-unified-wiring.test.d.ts +0 -2
  583. package/dist/test/kv-unified-wiring.test.d.ts.map +0 -1
  584. package/dist/test/kv-unified-wiring.test.js +0 -95
  585. package/dist/test/kv-unified-wiring.test.js.map +0 -1
  586. package/dist/test/late-events-after-stop.test.d.ts +0 -2
  587. package/dist/test/late-events-after-stop.test.d.ts.map +0 -1
  588. package/dist/test/late-events-after-stop.test.js +0 -122
  589. package/dist/test/late-events-after-stop.test.js.map +0 -1
  590. package/dist/test/liveness-watchdog.test.d.ts +0 -2
  591. package/dist/test/liveness-watchdog.test.d.ts.map +0 -1
  592. package/dist/test/liveness-watchdog.test.js +0 -94
  593. package/dist/test/liveness-watchdog.test.js.map +0 -1
  594. package/dist/test/machine-close-provenance.test.d.ts +0 -2
  595. package/dist/test/machine-close-provenance.test.d.ts.map +0 -1
  596. package/dist/test/machine-close-provenance.test.js +0 -116
  597. package/dist/test/machine-close-provenance.test.js.map +0 -1
  598. package/dist/test/maintenance-timer.test.d.ts +0 -2
  599. package/dist/test/maintenance-timer.test.d.ts.map +0 -1
  600. package/dist/test/maintenance-timer.test.js +0 -265
  601. package/dist/test/maintenance-timer.test.js.map +0 -1
  602. package/dist/test/mcpl-access-provider.test.d.ts +0 -2
  603. package/dist/test/mcpl-access-provider.test.d.ts.map +0 -1
  604. package/dist/test/mcpl-access-provider.test.js +0 -20
  605. package/dist/test/mcpl-access-provider.test.js.map +0 -1
  606. package/dist/test/mcpl-awareness-barrier.test.d.ts +0 -2
  607. package/dist/test/mcpl-awareness-barrier.test.d.ts.map +0 -1
  608. package/dist/test/mcpl-awareness-barrier.test.js +0 -769
  609. package/dist/test/mcpl-awareness-barrier.test.js.map +0 -1
  610. package/dist/test/mcpl-capability-grant.test.d.ts +0 -10
  611. package/dist/test/mcpl-capability-grant.test.d.ts.map +0 -1
  612. package/dist/test/mcpl-capability-grant.test.js +0 -111
  613. package/dist/test/mcpl-capability-grant.test.js.map +0 -1
  614. package/dist/test/mcpl-capability-scoping.test.d.ts +0 -2
  615. package/dist/test/mcpl-capability-scoping.test.d.ts.map +0 -1
  616. package/dist/test/mcpl-capability-scoping.test.js +0 -266
  617. package/dist/test/mcpl-capability-scoping.test.js.map +0 -1
  618. package/dist/test/mcpl-child-env.test.d.ts +0 -2
  619. package/dist/test/mcpl-child-env.test.d.ts.map +0 -1
  620. package/dist/test/mcpl-child-env.test.js +0 -158
  621. package/dist/test/mcpl-child-env.test.js.map +0 -1
  622. package/dist/test/mcpl-coalescing.test.d.ts +0 -2
  623. package/dist/test/mcpl-coalescing.test.d.ts.map +0 -1
  624. package/dist/test/mcpl-coalescing.test.js +0 -1125
  625. package/dist/test/mcpl-coalescing.test.js.map +0 -1
  626. package/dist/test/mcpl-config-diagnostics.test.d.ts +0 -2
  627. package/dist/test/mcpl-config-diagnostics.test.d.ts.map +0 -1
  628. package/dist/test/mcpl-config-diagnostics.test.js +0 -452
  629. package/dist/test/mcpl-config-diagnostics.test.js.map +0 -1
  630. package/dist/test/mcpl-empty-content.test.d.ts +0 -2
  631. package/dist/test/mcpl-empty-content.test.d.ts.map +0 -1
  632. package/dist/test/mcpl-empty-content.test.js +0 -368
  633. package/dist/test/mcpl-empty-content.test.js.map +0 -1
  634. package/dist/test/mcpl-gate-roundtrip.test.d.ts +0 -2
  635. package/dist/test/mcpl-gate-roundtrip.test.d.ts.map +0 -1
  636. package/dist/test/mcpl-gate-roundtrip.test.js +0 -285
  637. package/dist/test/mcpl-gate-roundtrip.test.js.map +0 -1
  638. package/dist/test/mcpl-list-status.test.d.ts +0 -2
  639. package/dist/test/mcpl-list-status.test.d.ts.map +0 -1
  640. package/dist/test/mcpl-list-status.test.js +0 -82
  641. package/dist/test/mcpl-list-status.test.js.map +0 -1
  642. package/dist/test/mcpl-manifest-changed.test.d.ts +0 -2
  643. package/dist/test/mcpl-manifest-changed.test.d.ts.map +0 -1
  644. package/dist/test/mcpl-manifest-changed.test.js +0 -178
  645. package/dist/test/mcpl-manifest-changed.test.js.map +0 -1
  646. package/dist/test/mcpl-push-convert.test.d.ts +0 -2
  647. package/dist/test/mcpl-push-convert.test.d.ts.map +0 -1
  648. package/dist/test/mcpl-push-convert.test.js +0 -42
  649. package/dist/test/mcpl-push-convert.test.js.map +0 -1
  650. package/dist/test/mcpl-reconnect-events.test.d.ts +0 -2
  651. package/dist/test/mcpl-reconnect-events.test.d.ts.map +0 -1
  652. package/dist/test/mcpl-reconnect-events.test.js +0 -144
  653. package/dist/test/mcpl-reconnect-events.test.js.map +0 -1
  654. package/dist/test/mcpl-reconnect-reregistration.test.d.ts +0 -2
  655. package/dist/test/mcpl-reconnect-reregistration.test.d.ts.map +0 -1
  656. package/dist/test/mcpl-reconnect-reregistration.test.js +0 -236
  657. package/dist/test/mcpl-reconnect-reregistration.test.js.map +0 -1
  658. package/dist/test/mcpl-reference-fetcher.test.d.ts +0 -2
  659. package/dist/test/mcpl-reference-fetcher.test.d.ts.map +0 -1
  660. package/dist/test/mcpl-reference-fetcher.test.js +0 -427
  661. package/dist/test/mcpl-reference-fetcher.test.js.map +0 -1
  662. package/dist/test/mcpl-reference-fields.test.d.ts +0 -2
  663. package/dist/test/mcpl-reference-fields.test.d.ts.map +0 -1
  664. package/dist/test/mcpl-reference-fields.test.js +0 -149
  665. package/dist/test/mcpl-reference-fields.test.js.map +0 -1
  666. package/dist/test/mcpl-request-timeout.test.d.ts +0 -2
  667. package/dist/test/mcpl-request-timeout.test.d.ts.map +0 -1
  668. package/dist/test/mcpl-request-timeout.test.js +0 -138
  669. package/dist/test/mcpl-request-timeout.test.js.map +0 -1
  670. package/dist/test/mcpl-runtime-lifecycle.test.d.ts +0 -7
  671. package/dist/test/mcpl-runtime-lifecycle.test.d.ts.map +0 -1
  672. package/dist/test/mcpl-runtime-lifecycle.test.js +0 -142
  673. package/dist/test/mcpl-runtime-lifecycle.test.js.map +0 -1
  674. package/dist/test/mcpl-tool-class-listing.test.d.ts +0 -2
  675. package/dist/test/mcpl-tool-class-listing.test.d.ts.map +0 -1
  676. package/dist/test/mcpl-tool-class-listing.test.js +0 -147
  677. package/dist/test/mcpl-tool-class-listing.test.js.map +0 -1
  678. package/dist/test/mcpl-tool-classes.test.d.ts +0 -7
  679. package/dist/test/mcpl-tool-classes.test.d.ts.map +0 -1
  680. package/dist/test/mcpl-tool-classes.test.js +0 -80
  681. package/dist/test/mcpl-tool-classes.test.js.map +0 -1
  682. package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts +0 -2
  683. package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts.map +0 -1
  684. package/dist/test/mcpl-tool-lifecycle-e2e.test.js +0 -237
  685. package/dist/test/mcpl-tool-lifecycle-e2e.test.js.map +0 -1
  686. package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts +0 -11
  687. package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts.map +0 -1
  688. package/dist/test/mcpl-tool-lifecycle-emitter.test.js +0 -412
  689. package/dist/test/mcpl-tool-lifecycle-emitter.test.js.map +0 -1
  690. package/dist/test/mcpl-tool-lifecycle-script.test.d.ts +0 -2
  691. package/dist/test/mcpl-tool-lifecycle-script.test.d.ts.map +0 -1
  692. package/dist/test/mcpl-tool-lifecycle-script.test.js +0 -288
  693. package/dist/test/mcpl-tool-lifecycle-script.test.js.map +0 -1
  694. package/dist/test/mcpl-tool-lifecycle.test.d.ts +0 -11
  695. package/dist/test/mcpl-tool-lifecycle.test.d.ts.map +0 -1
  696. package/dist/test/mcpl-tool-lifecycle.test.js +0 -270
  697. package/dist/test/mcpl-tool-lifecycle.test.js.map +0 -1
  698. package/dist/test/mcpl-ws-transport.test.d.ts +0 -2
  699. package/dist/test/mcpl-ws-transport.test.d.ts.map +0 -1
  700. package/dist/test/mcpl-ws-transport.test.js +0 -258
  701. package/dist/test/mcpl-ws-transport.test.js.map +0 -1
  702. package/dist/test/module-context-integration.test.d.ts +0 -18
  703. package/dist/test/module-context-integration.test.d.ts.map +0 -1
  704. package/dist/test/module-context-integration.test.js +0 -181
  705. package/dist/test/module-context-integration.test.js.map +0 -1
  706. package/dist/test/offline-recovery-branch.test.d.ts +0 -2
  707. package/dist/test/offline-recovery-branch.test.d.ts.map +0 -1
  708. package/dist/test/offline-recovery-branch.test.js +0 -226
  709. package/dist/test/offline-recovery-branch.test.js.map +0 -1
  710. package/dist/test/operator-surgery.test.d.ts +0 -2
  711. package/dist/test/operator-surgery.test.d.ts.map +0 -1
  712. package/dist/test/operator-surgery.test.js +0 -398
  713. package/dist/test/operator-surgery.test.js.map +0 -1
  714. package/dist/test/ops-alert.test.d.ts +0 -2
  715. package/dist/test/ops-alert.test.d.ts.map +0 -1
  716. package/dist/test/ops-alert.test.js +0 -153
  717. package/dist/test/ops-alert.test.js.map +0 -1
  718. package/dist/test/overbudget-drain-breaker.test.d.ts +0 -2
  719. package/dist/test/overbudget-drain-breaker.test.d.ts.map +0 -1
  720. package/dist/test/overbudget-drain-breaker.test.js +0 -197
  721. package/dist/test/overbudget-drain-breaker.test.js.map +0 -1
  722. package/dist/test/per-agent-delivery.test.d.ts +0 -2
  723. package/dist/test/per-agent-delivery.test.d.ts.map +0 -1
  724. package/dist/test/per-agent-delivery.test.js +0 -108
  725. package/dist/test/per-agent-delivery.test.js.map +0 -1
  726. package/dist/test/physical-window-restart.test.d.ts +0 -14
  727. package/dist/test/physical-window-restart.test.d.ts.map +0 -1
  728. package/dist/test/physical-window-restart.test.js +0 -222
  729. package/dist/test/physical-window-restart.test.js.map +0 -1
  730. package/dist/test/placed-reaction-baseline.test.d.ts +0 -2
  731. package/dist/test/placed-reaction-baseline.test.d.ts.map +0 -1
  732. package/dist/test/placed-reaction-baseline.test.js +0 -312
  733. package/dist/test/placed-reaction-baseline.test.js.map +0 -1
  734. package/dist/test/present-while-acting.test.d.ts +0 -19
  735. package/dist/test/present-while-acting.test.d.ts.map +0 -1
  736. package/dist/test/present-while-acting.test.js +0 -706
  737. package/dist/test/present-while-acting.test.js.map +0 -1
  738. package/dist/test/prose-segments.test.d.ts +0 -2
  739. package/dist/test/prose-segments.test.d.ts.map +0 -1
  740. package/dist/test/prose-segments.test.js +0 -52
  741. package/dist/test/prose-segments.test.js.map +0 -1
  742. package/dist/test/prose-stream-router.test.d.ts +0 -2
  743. package/dist/test/prose-stream-router.test.d.ts.map +0 -1
  744. package/dist/test/prose-stream-router.test.js +0 -171
  745. package/dist/test/prose-stream-router.test.js.map +0 -1
  746. package/dist/test/provider-acceleration-cooldown.test.d.ts +0 -2
  747. package/dist/test/provider-acceleration-cooldown.test.d.ts.map +0 -1
  748. package/dist/test/provider-acceleration-cooldown.test.js +0 -435
  749. package/dist/test/provider-acceleration-cooldown.test.js.map +0 -1
  750. package/dist/test/provider-waits.test.d.ts +0 -2
  751. package/dist/test/provider-waits.test.d.ts.map +0 -1
  752. package/dist/test/provider-waits.test.js +0 -2196
  753. package/dist/test/provider-waits.test.js.map +0 -1
  754. package/dist/test/puppet-tool-call.test.d.ts +0 -2
  755. package/dist/test/puppet-tool-call.test.d.ts.map +0 -1
  756. package/dist/test/puppet-tool-call.test.js +0 -224
  757. package/dist/test/puppet-tool-call.test.js.map +0 -1
  758. package/dist/test/puppet-turn-reservation.test.d.ts +0 -2
  759. package/dist/test/puppet-turn-reservation.test.d.ts.map +0 -1
  760. package/dist/test/puppet-turn-reservation.test.js +0 -139
  761. package/dist/test/puppet-turn-reservation.test.js.map +0 -1
  762. package/dist/test/reaction-baseline-platform.test.d.ts +0 -2
  763. package/dist/test/reaction-baseline-platform.test.d.ts.map +0 -1
  764. package/dist/test/reaction-baseline-platform.test.js +0 -124
  765. package/dist/test/reaction-baseline-platform.test.js.map +0 -1
  766. package/dist/test/record-journal.test.d.ts +0 -6
  767. package/dist/test/record-journal.test.d.ts.map +0 -1
  768. package/dist/test/record-journal.test.js +0 -269
  769. package/dist/test/record-journal.test.js.map +0 -1
  770. package/dist/test/refusal-reaction-baseline.test.d.ts +0 -2
  771. package/dist/test/refusal-reaction-baseline.test.d.ts.map +0 -1
  772. package/dist/test/refusal-reaction-baseline.test.js +0 -81
  773. package/dist/test/refusal-reaction-baseline.test.js.map +0 -1
  774. package/dist/test/refusal-rewind.test.d.ts +0 -2
  775. package/dist/test/refusal-rewind.test.d.ts.map +0 -1
  776. package/dist/test/refusal-rewind.test.js +0 -108
  777. package/dist/test/refusal-rewind.test.js.map +0 -1
  778. package/dist/test/refusal-single-call.test.d.ts +0 -2
  779. package/dist/test/refusal-single-call.test.d.ts.map +0 -1
  780. package/dist/test/refusal-single-call.test.js +0 -177
  781. package/dist/test/refusal-single-call.test.js.map +0 -1
  782. package/dist/test/release-changelog.test.d.ts +0 -2
  783. package/dist/test/release-changelog.test.d.ts.map +0 -1
  784. package/dist/test/release-changelog.test.js +0 -159
  785. package/dist/test/release-changelog.test.js.map +0 -1
  786. package/dist/test/same-round-think-policy.test.d.ts +0 -2
  787. package/dist/test/same-round-think-policy.test.d.ts.map +0 -1
  788. package/dist/test/same-round-think-policy.test.js +0 -853
  789. package/dist/test/same-round-think-policy.test.js.map +0 -1
  790. package/dist/test/save-recent-image.test.d.ts +0 -26
  791. package/dist/test/save-recent-image.test.d.ts.map +0 -1
  792. package/dist/test/save-recent-image.test.js +0 -974
  793. package/dist/test/save-recent-image.test.js.map +0 -1
  794. package/dist/test/shutdown-errors.test.d.ts +0 -2
  795. package/dist/test/shutdown-errors.test.d.ts.map +0 -1
  796. package/dist/test/shutdown-errors.test.js +0 -662
  797. package/dist/test/shutdown-errors.test.js.map +0 -1
  798. package/dist/test/silent-heartbeat-rows.test.d.ts +0 -2
  799. package/dist/test/silent-heartbeat-rows.test.d.ts.map +0 -1
  800. package/dist/test/silent-heartbeat-rows.test.js +0 -451
  801. package/dist/test/silent-heartbeat-rows.test.js.map +0 -1
  802. package/dist/test/silent-heartbeat.test.d.ts +0 -2
  803. package/dist/test/silent-heartbeat.test.d.ts.map +0 -1
  804. package/dist/test/silent-heartbeat.test.js +0 -165
  805. package/dist/test/silent-heartbeat.test.js.map +0 -1
  806. package/dist/test/state-scaling-e2e.test.d.ts +0 -22
  807. package/dist/test/state-scaling-e2e.test.d.ts.map +0 -1
  808. package/dist/test/state-scaling-e2e.test.js +0 -206
  809. package/dist/test/state-scaling-e2e.test.js.map +0 -1
  810. package/dist/test/state-scaling.test.d.ts +0 -12
  811. package/dist/test/state-scaling.test.d.ts.map +0 -1
  812. package/dist/test/state-scaling.test.js +0 -251
  813. package/dist/test/state-scaling.test.js.map +0 -1
  814. package/dist/test/stop-with-work-in-flight.test.d.ts +0 -23
  815. package/dist/test/stop-with-work-in-flight.test.d.ts.map +0 -1
  816. package/dist/test/stop-with-work-in-flight.test.js +0 -672
  817. package/dist/test/stop-with-work-in-flight.test.js.map +0 -1
  818. package/dist/test/surgery-marks-receipt.test.d.ts +0 -2
  819. package/dist/test/surgery-marks-receipt.test.d.ts.map +0 -1
  820. package/dist/test/surgery-marks-receipt.test.js +0 -540
  821. package/dist/test/surgery-marks-receipt.test.js.map +0 -1
  822. package/dist/test/thinking-token-stamp.test.d.ts +0 -12
  823. package/dist/test/thinking-token-stamp.test.d.ts.map +0 -1
  824. package/dist/test/thinking-token-stamp.test.js +0 -129
  825. package/dist/test/thinking-token-stamp.test.js.map +0 -1
  826. package/dist/test/timezone.test.d.ts +0 -2
  827. package/dist/test/timezone.test.d.ts.map +0 -1
  828. package/dist/test/timezone.test.js +0 -18
  829. package/dist/test/timezone.test.js.map +0 -1
  830. package/dist/test/tool-batch-hook.test.d.ts +0 -8
  831. package/dist/test/tool-batch-hook.test.d.ts.map +0 -1
  832. package/dist/test/tool-batch-hook.test.js +0 -275
  833. package/dist/test/tool-batch-hook.test.js.map +0 -1
  834. package/dist/test/tool-policy.test.d.ts +0 -2
  835. package/dist/test/tool-policy.test.d.ts.map +0 -1
  836. package/dist/test/tool-policy.test.js +0 -51
  837. package/dist/test/tool-policy.test.js.map +0 -1
  838. package/dist/test/tool-presentation.test.d.ts +0 -2
  839. package/dist/test/tool-presentation.test.d.ts.map +0 -1
  840. package/dist/test/tool-presentation.test.js +0 -268
  841. package/dist/test/tool-presentation.test.js.map +0 -1
  842. package/dist/test/tool-result-content.test.d.ts +0 -2
  843. package/dist/test/tool-result-content.test.d.ts.map +0 -1
  844. package/dist/test/tool-result-content.test.js +0 -37
  845. package/dist/test/tool-result-content.test.js.map +0 -1
  846. package/dist/test/tool-result-guard.test.d.ts +0 -2
  847. package/dist/test/tool-result-guard.test.d.ts.map +0 -1
  848. package/dist/test/tool-result-guard.test.js +0 -3607
  849. package/dist/test/tool-result-guard.test.js.map +0 -1
  850. package/dist/test/tool-result-history.test.d.ts +0 -7
  851. package/dist/test/tool-result-history.test.d.ts.map +0 -1
  852. package/dist/test/tool-result-history.test.js +0 -156
  853. package/dist/test/tool-result-history.test.js.map +0 -1
  854. package/dist/test/tool-result-spill.test.d.ts +0 -13
  855. package/dist/test/tool-result-spill.test.d.ts.map +0 -1
  856. package/dist/test/tool-result-spill.test.js +0 -586
  857. package/dist/test/tool-result-spill.test.js.map +0 -1
  858. package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts +0 -2
  859. package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts.map +0 -1
  860. package/dist/test/tool-wrapper-prose-guard-integration.test.js +0 -485
  861. package/dist/test/tool-wrapper-prose-guard-integration.test.js.map +0 -1
  862. package/dist/test/tool-wrapper-prose-guard.test.d.ts +0 -2
  863. package/dist/test/tool-wrapper-prose-guard.test.d.ts.map +0 -1
  864. package/dist/test/tool-wrapper-prose-guard.test.js +0 -34
  865. package/dist/test/tool-wrapper-prose-guard.test.js.map +0 -1
  866. package/dist/test/tools-observe-parser-conformance.test.d.ts +0 -2
  867. package/dist/test/tools-observe-parser-conformance.test.d.ts.map +0 -1
  868. package/dist/test/tools-observe-parser-conformance.test.js +0 -129
  869. package/dist/test/tools-observe-parser-conformance.test.js.map +0 -1
  870. package/dist/test/trunk-channel-routing.test.d.ts +0 -19
  871. package/dist/test/trunk-channel-routing.test.d.ts.map +0 -1
  872. package/dist/test/trunk-channel-routing.test.js +0 -329
  873. package/dist/test/trunk-channel-routing.test.js.map +0 -1
  874. package/dist/test/tune-out-e2e.test.d.ts +0 -2
  875. package/dist/test/tune-out-e2e.test.d.ts.map +0 -1
  876. package/dist/test/tune-out-e2e.test.js +0 -142
  877. package/dist/test/tune-out-e2e.test.js.map +0 -1
  878. package/dist/test/tune-out-gate-composition.test.d.ts +0 -2
  879. package/dist/test/tune-out-gate-composition.test.d.ts.map +0 -1
  880. package/dist/test/tune-out-gate-composition.test.js +0 -221
  881. package/dist/test/tune-out-gate-composition.test.js.map +0 -1
  882. package/dist/test/tune-out-lifecycle.test.d.ts +0 -2
  883. package/dist/test/tune-out-lifecycle.test.d.ts.map +0 -1
  884. package/dist/test/tune-out-lifecycle.test.js +0 -121
  885. package/dist/test/tune-out-lifecycle.test.js.map +0 -1
  886. package/dist/test/turn-trigger-provenance.test.d.ts +0 -2
  887. package/dist/test/turn-trigger-provenance.test.d.ts.map +0 -1
  888. package/dist/test/turn-trigger-provenance.test.js +0 -137
  889. package/dist/test/turn-trigger-provenance.test.js.map +0 -1
  890. package/dist/test/unconvertible-tool-result.test.d.ts +0 -2
  891. package/dist/test/unconvertible-tool-result.test.d.ts.map +0 -1
  892. package/dist/test/unconvertible-tool-result.test.js +0 -358
  893. package/dist/test/unconvertible-tool-result.test.js.map +0 -1
  894. package/dist/test/usage-accounting.test.d.ts +0 -2
  895. package/dist/test/usage-accounting.test.d.ts.map +0 -1
  896. package/dist/test/usage-accounting.test.js +0 -13
  897. package/dist/test/usage-accounting.test.js.map +0 -1
  898. package/dist/test/usage-tracker.test.d.ts +0 -2
  899. package/dist/test/usage-tracker.test.d.ts.map +0 -1
  900. package/dist/test/usage-tracker.test.js +0 -129
  901. package/dist/test/usage-tracker.test.js.map +0 -1
  902. package/dist/test/utils-surface.test.d.ts +0 -2
  903. package/dist/test/utils-surface.test.d.ts.map +0 -1
  904. package/dist/test/utils-surface.test.js +0 -145
  905. package/dist/test/utils-surface.test.js.map +0 -1
  906. package/dist/test/workspace-branch-continuation.test.d.ts +0 -15
  907. package/dist/test/workspace-branch-continuation.test.d.ts.map +0 -1
  908. package/dist/test/workspace-branch-continuation.test.js +0 -183
  909. package/dist/test/workspace-branch-continuation.test.js.map +0 -1
  910. package/dist/test/workspace-materialize-freshness.test.d.ts +0 -16
  911. package/dist/test/workspace-materialize-freshness.test.d.ts.map +0 -1
  912. package/dist/test/workspace-materialize-freshness.test.js +0 -252
  913. package/dist/test/workspace-materialize-freshness.test.js.map +0 -1
  914. package/dist/test/workspace-path-containment.test.d.ts +0 -19
  915. package/dist/test/workspace-path-containment.test.d.ts.map +0 -1
  916. package/dist/test/workspace-path-containment.test.js +0 -91
  917. package/dist/test/workspace-path-containment.test.js.map +0 -1
  918. package/dist/test/workspace-read-file-from-disk.test.d.ts +0 -17
  919. package/dist/test/workspace-read-file-from-disk.test.d.ts.map +0 -1
  920. package/dist/test/workspace-read-file-from-disk.test.js +0 -174
  921. package/dist/test/workspace-read-file-from-disk.test.js.map +0 -1
  922. package/dist/test/workspace-read-image.test.d.ts +0 -2
  923. package/dist/test/workspace-read-image.test.d.ts.map +0 -1
  924. package/dist/test/workspace-read-image.test.js +0 -597
  925. package/dist/test/workspace-read-image.test.js.map +0 -1
  926. package/dist/test/workspace-read-text.test.d.ts +0 -2
  927. package/dist/test/workspace-read-text.test.d.ts.map +0 -1
  928. package/dist/test/workspace-read-text.test.js +0 -101
  929. package/dist/test/workspace-read-text.test.js.map +0 -1
  930. package/dist/test/workspace-restore-order.test.d.ts +0 -16
  931. package/dist/test/workspace-restore-order.test.d.ts.map +0 -1
  932. package/dist/test/workspace-restore-order.test.js +0 -140
  933. package/dist/test/workspace-restore-order.test.js.map +0 -1
  934. package/dist/test/workspace-three-way.test.d.ts +0 -12
  935. package/dist/test/workspace-three-way.test.d.ts.map +0 -1
  936. package/dist/test/workspace-three-way.test.js +0 -3194
  937. package/dist/test/workspace-three-way.test.js.map +0 -1
  938. package/dist/test/workspace-watcher.test.d.ts +0 -2
  939. package/dist/test/workspace-watcher.test.d.ts.map +0 -1
  940. package/dist/test/workspace-watcher.test.js +0 -281
  941. package/dist/test/workspace-watcher.test.js.map +0 -1
  942. package/dist/test/xml-round-persist.test.d.ts +0 -19
  943. package/dist/test/xml-round-persist.test.d.ts.map +0 -1
  944. package/dist/test/xml-round-persist.test.js +0 -235
  945. package/dist/test/xml-round-persist.test.js.map +0 -1
  946. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -104,6 +104,35 @@ 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
+ }
120
+ /**
121
+ * How `runEphemeralToCompletion` rejects when a retryable provider failure
122
+ * states a wait the run won't sleep: one longer than an ephemeral run sleeps
123
+ * in its turn (600 s), an infinite one, or one that is `NaN`. The run ends at
124
+ * once, without retrying inside the wait, and every other ending of the run
125
+ * rejects with a plain `Error`. `retryAfterMs` is the wait as the provider
126
+ * stated it, in milliseconds, so `Infinity` or `NaN` in those two cases: a
127
+ * host that schedules a rerun from it handles a value that isn't finite, and
128
+ * one past the 2,147,483,647 ms a timer can hold. The message says the same
129
+ * in words. A host can test `instanceof` or the `name`, which also holds for
130
+ * an error from another copy of this package.
131
+ */
132
+ export declare class ProviderWaitNotSleptError extends Error {
133
+ readonly retryAfterMs: number;
134
+ constructor(message: string, retryAfterMs: number);
135
+ }
107
136
  interface InferenceToolSnapshot {
108
137
  sameRoundThinkTextPolicy: SameRoundThinkTextPolicy;
109
138
  }
@@ -115,18 +144,19 @@ interface InferenceToolSnapshot {
115
144
  *
116
145
  * 400 and 422 are how a provider answers a request that fails its
117
146
  * validation, as a history it can't accept does, but other refusals come
118
- * back the same way, such as Anthropic's 400 for a credit balance that's too
119
- * low. A 413 is the request's size. When the newest exchange made it too
120
- * large, as an oversized attachment does, shedding that exchange may bring
121
- * the request back under the limit, and nothing else in the framework
122
- * recovers a 413; when the history as a whole is too large, the shed doesn't
123
- * help, and the breaker stops at its rewind cap. The 413 arm takes both
124
- * labels a 413 arrives under, invalid_request and context_length, because
125
- * membrane's label for a 413 differs by version and adapter. Other statuses
126
- * keep the history, since shed history can't be got back and the status
127
- * gives no sign that a shed would help: a 404 is a model or an endpoint that
128
- * doesn't exist, and 405, 409, 410 and 415 are about the HTTP request or the
129
- * resource, as a rule, rather than the conversation.
147
+ * back the same way, such as a refusal of the account that membrane doesn't
148
+ * recognize by its text. A 413 is the request's size. When the newest
149
+ * exchange made it too large, as an oversized attachment does, shedding that
150
+ * exchange may bring the request back under the limit, and nothing else in
151
+ * the framework recovers a 413; when the history as a whole is too large,
152
+ * the shed doesn't help, and the breaker stops at its rewind cap. The 413 arm
153
+ * takes both labels membranes have given a 413, invalid_request and
154
+ * context_length (see the notes below). Other statuses keep the history,
155
+ * since a shed takes the exchange out of the agent's context, which only an
156
+ * operator's undo brings back, and the status gives no sign that a shed
157
+ * would help: a 404 is a model or an endpoint that doesn't exist, and 405,
158
+ * 409, 410 and 415 are about the HTTP request or the resource, as a rule,
159
+ * rather than the conversation.
130
160
  *
131
161
  * The table test in test/inference-exhaustion-rewind.test.ts is this
132
162
  * predicate's contract. The notes below on which membrane version gives which
@@ -141,13 +171,24 @@ interface InferenceToolSnapshot {
141
171
  * adapter files every status it doesn't list (404, 405, 409, 410, 413,
142
172
  * 415, 422 …) as invalid_request, so it alone produces an invalid_request
143
173
  * at 413 or 422, and no 0.5.86 adapter produces a context_length at 413.
144
- * - From membrane #56 (merged, not yet in a release), one table serves every
145
- * adapter. Auth codes and context overflow are checked on a 400 or 422
146
- * first, a 404 is invalid_request, a 413 is context_length, and other 4xx
147
- * are invalid_request. So a 413 still sheds, an Anthropic one included,
148
- * while a context_length at 400 or 422, a token overflow, keeps the
149
- * history. The 422 arm then also covers an OpenAI-compatible server, such
150
- * as a FastAPI one, that answers a validation failure with 422.
174
+ * - From membrane 0.5.87 (membrane #56 and #107), this package's floor, every
175
+ * adapter sends an HTTP failure through one status table
176
+ * (errorFromProviderStatus). On a 400 or 422, auth codes and reasons and
177
+ * the two account refusals it recognizes by their text (a balance too low,
178
+ * usage limits reached) are auth, and a context overflow, by its code or
179
+ * text, is context_length. A 401, 402 or 403 is auth, a 408 timeout, a 429
180
+ * rate_limit, a 404 invalid_request and a 413 context_length; other 4xx
181
+ * are invalid_request. So a 413 the table types sheds, an Anthropic one
182
+ * included, while a context_length at 400 or 422, a token overflow, keeps
183
+ * the history, and so does an account refusal, which is auth. An adapter
184
+ * can type a failure before the table does, as Anthropic's does for a
185
+ * gateway's aggregate error (server). A failure with no HTTP status takes
186
+ * the status its provider code implies when the table knows the code, as
187
+ * for Anthropic's mid-stream errors, and is otherwise typed from its
188
+ * message, with no status. The 422 arm also covers an
189
+ * OpenAI-compatible server, such as a FastAPI one, that answers a
190
+ * validation failure with 422. The test of provider answers through the
191
+ * table, beside the table test, pins how the two meet at the floor.
151
192
  *
152
193
  * An error with no status, from a membrane that reports none, keeps the rule
153
194
  * the breaker had before: the type alone.
@@ -162,6 +203,22 @@ export declare class AgentFramework {
162
203
  private stopPromise;
163
204
  private stopCompleted;
164
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;
211
+ /** An operator's operations in flight, and the config materializations they
212
+ * start. stop() waits until this set is empty before it tears down, unless
213
+ * its wait budget runs out. */
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;
165
222
  private membrane;
166
223
  private queue;
167
224
  private agents;
@@ -169,16 +226,6 @@ export declare class AgentFramework {
169
226
  private inferencePolicy;
170
227
  private errorPolicy;
171
228
  private pendingRequests;
172
- /**
173
- * Per-agent channel that triggered the agent's CURRENT inference turn, if any
174
- * (item-3 redux). Read by the ChannelRegistry's `activeChannelResolver` to
175
- * route a single-trunk agent's plain-text speech back to the channel it is
176
- * answering, instead of the process-global most-recent-inbound locus that a
177
- * concurrent message elsewhere can hijack. Set at turn start (or cleared for a
178
- * heartbeat / no-trigger turn) in startAgentStream; overwritten by the next
179
- * turn. Never read between turns (a given agent runs one turn at a time).
180
- */
181
- private activeTriggerChannels;
182
229
  private running;
183
230
  private loopPromise;
184
231
  /** Quiesce/maintenance mode (issue #122). DELIBERATELY separate from
@@ -190,6 +237,16 @@ export declare class AgentFramework {
190
237
  * running; only new turns (wake gate in processInferenceRequests) and MCPL
191
238
  * data planes are held. */
192
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;
193
250
  private quiesceReason?;
194
251
  private quiescedAt?;
195
252
  private traceListeners;
@@ -201,6 +258,14 @@ export declare class AgentFramework {
201
258
  private maintenanceRunId;
202
259
  private currentMaintenanceRun;
203
260
  private maintenanceHistory;
261
+ /** Each agent's last reported maintenance failure, its whole text and when
262
+ * it was alerted, until its maintenance goes without one
263
+ * (reportMaintenanceFailure). */
264
+ private maintenanceFailureReported;
265
+ /** Run records whose failure repeated one already reported, and whose report was suppressed. */
266
+ private maintenanceRepeats;
267
+ /** An operator's maintain (maintenanceTick) asked for the pass running or about to run: the run it records is kept in the history whatever it met. A pass with nothing to run records none. */
268
+ private maintenancePassRequested;
204
269
  private providerGates;
205
270
  private providerAccelerationCooldowns;
206
271
  private providerAccelerationRecoveries;
@@ -222,32 +287,11 @@ export declare class AgentFramework {
222
287
  private processLoggingPersist;
223
288
  private processLoggingBroadcast;
224
289
  private activeStreams;
225
- /** Per-agent output locus FROZEN for the CURRENT logical turn. Resolved
226
- * eagerly in startAgentStream (home → addressed trigger → global default)
227
- * and never moved until the next turn: mid-turn injected messages — ambient
228
- * chatter, reactions, system markers — must not hijack where the agent's
229
- * plain prose lands (2026-07-21 Cairn lounge misroute). Lives here — not in
230
- * driveStream locals — so the pin survives a context-budget stream restart,
231
- * which continues the same logical turn in a fresh driveStream. Cleared or
232
- * re-set at the start of every non-restart turn. Since 2026-07-31 the pin
233
- * is no longer fully frozen: an ADDRESSED conversational injection — or a
234
- * conversational follow-up in a channel the agent itself explicitly sent
235
- * into this turn (turnEngagedChannels) — re-pins it at the boundary (see
236
- * the addressed re-pin block in the tool-result handler). Ambient chatter
237
- * elsewhere, reactions, and system markers still cannot move it. */
238
- private turnLocusPins;
239
- /** Channels the agent EXPLICITLY sent into during the CURRENT turn
240
- * (SEND_ENGAGEMENT_TOOLS, successful calls), per agent. Second re-pin
241
- * signal: a conversational reply in a channel the agent just engaged is
242
- * addressed by context even without a mention (2026-07-31 n=7: q's
243
- * #portables follow-up — no @mention — was answered in trailing prose
244
- * that followed the stale pin into repligate's DM). No author-kind
245
- * filter: agent-residents are full participants, and the bot flag
246
- * tracks nothing that matters (antra). Reactions/system markers are
247
- * excluded by isConversationalInjection; the engaged-this-turn scope
248
- * keeps unrelated channels from moving the pin. Cleared at every fresh
249
- * turn's start; budget restarts keep it. */
250
- private turnEngagedChannels;
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;
251
295
  /** A tool boundary injected fresh CONVERSATIONAL input (a real message —
252
296
  * not a reaction or a system marker) into the live stream. Tells
253
297
  * driveStream to clear sticky explicit-send suppression before handling
@@ -258,15 +302,19 @@ export declare class AgentFramework {
258
302
  * (KV-safe, no per-turn chatter). In-memory — after a process restart the
259
303
  * first turn's locus is announced once to re-establish the baseline. */
260
304
  private lastAnnouncedLocus;
261
- /** Latest bounced (undelivered) prose per agent — the `{{unsent}}` source. */
262
- private proseClipboards;
263
- /**
264
- * Each agent's routing state for its current turn (TurnRouting): the
265
- * sticky destination, the turn's destination for a resumed stream,
266
- * hybrid's hold, a `!` continuation and receipt tallies. A fresh turn starts a new object
267
- * instead of clearing the old one, and a stream that resumes the turn
268
- * (resumesLogicalTurn) keeps it. A queued delivery holds the object of the
269
- * turn that queued it, so prose a turn leaves queued when it ends (a
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;
310
+ /**
311
+ * Each agent's routing state for its current logical turn (TurnRouting):
312
+ * its trigger channel, locus and engaged channels, the sticky destination,
313
+ * the turn's destination, hybrid's hold, a ` !` continuation and receipt
314
+ * tallies. The start that opens a turn makes a
315
+ * new object instead of clearing the old one, and every later stream of
316
+ * the turn shares it (openLogical). A queued delivery holds the object of
317
+ * the turn that queued it, so prose a turn leaves queued when it ends (a
270
318
  * skip_reply ends it before its posts have run) still follows that turn's
271
319
  * destination, and its late writes can't reach the next turn.
272
320
  */
@@ -278,23 +326,25 @@ export declare class AgentFramework {
278
326
  */
279
327
  private proseSpeechChains;
280
328
  /**
281
- * Each agent's open logical turn (LogicalTurn). It stays open from the
282
- * fresh start that opens it until the turn settles (settleAgent: it
283
- * completes, a tool ends it, or it fails or is abandoned), and every fresh
284
- * start that routes prose while it is open continues it: a framework
285
- * retry, the start that consumes tool results the non-streaming fallback
286
- * left (whichever wake the scheduler starts it with), the later compile a
287
- * provider-capacity hold defers a turn to. A silent start neither
288
- * continues nor opens one. A stream that ends without settling needs to do
289
- * nothing to carry its turn. Settling only detaches the turn from future
290
- * starts: the settling stream keeps its own object, which its remaining
291
- * deliveries, its receipt and its ` !` check go on using (a completion
292
- * settles before it awaits its chain and writes its receipt). So every
293
- * logical end must close inheritance once, before the next fresh start:
294
- * a turn left open would hand its object, late writes and all, to an
295
- * unrelated turn. A tool-ended turn settles before the next turn can
296
- * start. Only the stream that holds the open turn closes it; disposal
297
- * drops it, and stop() clears every agent's.
329
+ * Each agent's open logical turn: its routing state and receipt tallies
330
+ * (TurnRouting). It stays open from the start that opens it until the
331
+ * turn settles (settleAgent: it completes, a tool ends it, or it fails or
332
+ * is abandoned), and every start that routes prose while it is open
333
+ * continues it with that object: a framework retry, the start that
334
+ * consumes tool results the non-streaming fallback left (whichever wake
335
+ * the scheduler starts it with), the later compile a provider-capacity
336
+ * hold defers a turn to. A silent start neither continues nor opens one,
337
+ * and leaves the open turn's object untouched (its own is the live routing
338
+ * while it runs: turnRouting). A stream that ends without
339
+ * settling needs to do nothing to carry its turn. Settling only detaches
340
+ * the turn from future starts: the settling stream keeps its own object,
341
+ * which its remaining deliveries, its receipt and its ` !` check go on
342
+ * using (a completion settles before it awaits its chain and writes its
343
+ * receipt). So every logical end must close inheritance once, before the
344
+ * next fresh start: a turn left open would hand its object, late writes
345
+ * and all, to an unrelated turn. A tool-ended turn settles before the
346
+ * next turn can start. Only the stream that holds the open turn closes
347
+ * it; disposal drops it, and stop() clears every agent's.
298
348
  */
299
349
  private openLogical;
300
350
  /** Consecutive bounce-wakes per agent; capped so an agent that keeps
@@ -322,7 +372,8 @@ export declare class AgentFramework {
322
372
  * The name is single-generation, so these frames still own their terminal
323
373
  * typing/outgoing close even after runEphemeralToCompletion deregisters them. */
324
374
  private disposedEphemeralFrames;
325
- /** 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.
326
377
  * Drives hard-down escalation — see noteInferenceExhausted. */
327
378
  private consecutiveInferenceFailures;
328
379
  /** N consecutive failed inferences ⇒ the agent is treated as hard-down and
@@ -346,7 +397,8 @@ export declare class AgentFramework {
346
397
  * rewind loop — see refusalHandling + rewindTriggeringTurn. */
347
398
  private refusalRewinds;
348
399
  /** Per-agent count of poison-history rewinds performed by the hard-down
349
- * breaker (noteInferenceExhausted). Reset on any successful inference.
400
+ * breaker (noteInferenceExhausted). Reset when a turn completes
401
+ * (inference:completed).
350
402
  * Bounds the automatic quarantine loop the same way refusalRewinds bounds
351
403
  * the refusal loop, so the breaker can never shed the whole history. */
352
404
  private exhaustionRewinds;
@@ -357,6 +409,8 @@ export declare class AgentFramework {
357
409
  * tick counts in the success log stop meaning anything. One kick per agent
358
410
  * at a time; cleared when the kick settles (success or failure). */
359
411
  private overBudgetDrainInFlight;
412
+ /** The over-budget drain kicks running, which a branch move waits for as it waits for a maintenance pass. */
413
+ private overBudgetDrains;
360
414
  /** Per-agent current rewind episode: the single consolidated marker's id and
361
415
  * how many turns have been shed so far. One marker per episode, updated in
362
416
  * place (see updateRewindMarker); cleared when the episode ends. */
@@ -378,9 +432,20 @@ export declare class AgentFramework {
378
432
  /** Agents an abandon could not cancel (token held, no stream) — surfaced
379
433
  * in HostModeStatus until the next quiesce/resume. */
380
434
  private lastUnabandonable;
381
- /** 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. */
382
440
  private deferredWritesPersisted;
383
- 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;
384
449
  /** Branch-independent recovery files (see FrameworkConfig.hostModePath /
385
450
  * deferredWritesPath). Undefined → branch-local slot fallback. */
386
451
  private hostModePath;
@@ -425,6 +490,11 @@ export declare class AgentFramework {
425
490
  private redoStacks;
426
491
  /** Liveness watchdog (fail hard on a wedged main thread). Null unless enabled. */
427
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;
428
498
  private mcplServerRegistry;
429
499
  private featureSetManager;
430
500
  private hookOrchestrator;
@@ -453,7 +523,7 @@ export declare class AgentFramework {
453
523
  * ephemeral agents have isolated slots and are their own only readers.
454
524
  */
455
525
  private readonly sharedSlotAgents;
456
- /** Group commit: one fsync per event-loop turn, shared by every waiter. */
526
+ /** The coalescing commit in flight, if any (see commitCoalescingDurable). */
457
527
  private coalescingCommit;
458
528
  private inferenceRouter;
459
529
  private channelRegistry;
@@ -468,6 +538,9 @@ export declare class AgentFramework {
468
538
  * turn still lands in the right channel.
469
539
  */
470
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;
471
544
  /** Last idle-TTL sweep timestamp. */
472
545
  private lastConversationSweep;
473
546
  /** Forks whose TTL closure turn has been queued — disposed (removed from
@@ -480,7 +553,8 @@ export declare class AgentFramework {
480
553
  * result marks the script that made the call, and is applied to that
481
554
  * script's code_execution result instead of cancelling the stream
482
555
  * mid-script (which would wedge the turn). A stopped script's late result
483
- * 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. */
484
558
  private scriptDeferredEndTurn;
485
559
  /** RFC-007: per agent, the origin of the foreground script its runner is
486
560
  * executing, handed to that script's inner calls (scripts run one at a
@@ -556,28 +630,114 @@ export declare class AgentFramework {
556
630
  private discordAwarenessBarrierGeneration;
557
631
  private eventGate;
558
632
  private usageTracker;
559
- /** Explicit-send suppression carried into a tool-result-guard retry. */
633
+ /** Explicit-send or private suppression carried into a tool-result-guard retry. */
560
634
  private guardRetryTurnSilenced;
561
635
  /** Presentation-only wall-clock zone; persistence remains UTC/epoch. */
562
636
  private readonly timeZone;
563
637
  private constructor();
564
638
  /**
565
- * 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.
566
646
  */
567
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;
568
689
  /**
569
690
  * Start the event loop.
570
691
  */
571
692
  start(): void;
572
693
  /**
573
- * Stop the event loop. Failed module/MCPL cleanup can be retried with its
574
- * original context; storage stays open until that cleanup succeeds.
575
- * @param teardownTimeoutMs Optional module/MCPL wait budget. Omit to wait
576
- * until cleanup settles, as required by existing module/child contracts. This
577
- * does not bound earlier stream or event-loop quiescence, or cancel cleanup.
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.
578
722
  */
579
723
  stop(teardownTimeoutMs?: number | undefined): Promise<void>;
580
724
  private resetCompletedStop;
725
+ /** Register before invoking the body, so the set holds the operation for
726
+ * its whole life: its synchronous trace callbacks can reenter stop(), and
727
+ * that stop() must find it. Invocation stays in this stack, preserving
728
+ * immediate mode changes; the returned promise carries its result to the
729
+ * caller. */
730
+ private trackOperatorOperation;
731
+ /** Whether stop() has begun: an attempt in flight (stopPromise is set before
732
+ * its body runs, which emits traces before the queue closes) or a closed
733
+ * queue (after a failed or completed stop()). The admission rule for every
734
+ * operator entry point, the host/command listener included. */
735
+ private stopHasBegun;
736
+ private refuseOperatorAfterStop;
737
+ /** Wait in rounds until the set is empty: admitted work can still start work
738
+ * of its own. All rounds share the caller's deadline rather than renewing
739
+ * its budget. */
740
+ private waitForOperatorOperations;
581
741
  private stopOwned;
582
742
  /**
583
743
  * Advance queued ContextManager work without requiring a new message.
@@ -597,6 +757,20 @@ export declare class AgentFramework {
597
757
  private flushAuxiliaryAdmission;
598
758
  private waitForAuxiliaryIdle;
599
759
  private withAuxiliaryAdmission;
760
+ /**
761
+ * Maintenance makes no provider call while a surgery holds the store. The
762
+ * surgery waits for the maintenance work that is running before it moves
763
+ * the branch, so a call that parked at the gate would make it wait on
764
+ * whatever reopens the gate: the end of a cooldown, or the retry turn a
765
+ * cooldown queues, which the hold itself keeps from starting.
766
+ */
767
+ private withdrawMaintenanceUnderSurgery;
768
+ /**
769
+ * Nor once stop() has closed provider admission: a stop that catches a
770
+ * tick is the framework stopping on purpose, so the call is withdrawn, as
771
+ * under a surgery's hold, and no failure is reported for it.
772
+ */
773
+ private withdrawMaintenanceWhenStopping;
600
774
  private auxiliaryMembraneFor;
601
775
  /**
602
776
  * A conversation agent's auxiliary calls (its context manager's
@@ -606,7 +780,11 @@ export declare class AgentFramework {
606
780
  * as a resident's are, so they bind its auxiliary calls too: a held model
607
781
  * is refused without a call, and an auxiliary call's own stated wait is
608
782
  * recorded for it. (An ephemeral run records nothing, its name being
609
- * single-use, so its context manager keeps the plain membrane.)
783
+ * single-use, so its context manager keeps the plain membrane.) Its
784
+ * compression is the background work a resident's is, whether a
785
+ * maintenance tick or a drain after a message starts it, so it is withdrawn
786
+ * as a resident's is: a call made while a surgery holds the store, or once
787
+ * stop() has closed provider admission, is withdrawn without being sent.
610
788
  */
611
789
  private conversationAuxiliaryMembraneFor;
612
790
  /** The framework's membrane, with each complete() call passed through
@@ -645,7 +823,8 @@ export declare class AgentFramework {
645
823
  */
646
824
  private nonOwningProviderWait;
647
825
  /** Why an ephemeral run ended instead of sleeping a provider's stated wait,
648
- * for its caller. */
826
+ * for its caller: the text, and the wait itself, which its rejection
827
+ * carries (ProviderWaitNotSleptError). */
649
828
  private statedWaitNotSlept;
650
829
  /** When a hold's timer next fires: at its deadline, stepped past what one
651
830
  * timer can hold. A hold with no deadline (a wait held until released, or
@@ -710,26 +889,44 @@ export declare class AgentFramework {
710
889
  private recordProviderAccelerationRecovery;
711
890
  private cancelProviderAdmission;
712
891
  private startQueuedMaintenance;
892
+ /** resume()'s refusal while a surgery holds the store. */
893
+ private refuseResumeUnderSurgery;
894
+ /** Whether maintenance work is running: a pass, or an over-budget drain kick. */
895
+ private maintenanceRunning;
896
+ /** Wait for the maintenance work that is running, whatever its outcome. */
897
+ private settleMaintenancePass;
713
898
  private runQueuedMaintenance;
899
+ /**
900
+ * One agent's maintenance failure: recorded on its run, bounded as every
901
+ * failure sink is (`record.error`), and logged and alerted for that agent
902
+ * with the whole text. A failure that lasts, such as a manager whose
903
+ * strategy failed to initialize, meets every pass, a few seconds apart. It
904
+ * is logged and alerted again only when its whole text changes, once
905
+ * opsAlert's cooldown for it has passed since the webhook last posted it
906
+ * (so the webhook, which posts a kind at most once per cooldown, hears a
907
+ * failure that lasts), or after a pass in which that agent's maintenance
908
+ * went without a failure (maintenanceFailureReported). A record whose
909
+ * failure isn't reported again is marked as a repeat, and a pass whose
910
+ * every record is a repeat that took no tick stays out of the history.
911
+ */
912
+ private reportMaintenanceFailure;
913
+ /**
914
+ * An agent's context readiness, or the error that reading it threw. The
915
+ * context manager refuses while its strategy's initialization is pending
916
+ * or has failed (context-manager 0.14), and a strategy can refuse on its
917
+ * own, as the autobiographical one does after a store-level branch switch
918
+ * it hasn't reloaded for. Every such throw is that agent's failure.
919
+ */
920
+ private contextReadiness;
921
+ /** The strategy's progress snapshot, for diagnostics: one it can't give reads as none. */
714
922
  private contextProgress;
715
923
  /**
716
- * A server's request or notification the host couldn't handle, answered
717
- * with a JSON-RPC error when it is a request (a notification has no one to
718
- * answer, and is logged), rather than thrown out of the connection's
719
- * listener, where it was an unhandled rejection and the server's request
720
- * waited for its timeout.
721
- * - `refused`: the listener turned it away before its handler ran; the
722
- * host is stopping, and none of it was taken. Answered -32000, "the host
723
- * is stopping", the code the push coalescer already gives a stopping
724
- * host: the server can send it again to the host's next run.
725
- * - `failed`: the handler threw, whatever it threw, `undefined` included.
726
- * While the host stops (its queue closed), that's answered -32000 too,
727
- * with the handler's own message after the stop wording; on a live host
728
- * it's a fault, answered -32603 with the handler's message. The handler
729
- * may have admitted part of the request first (an earlier message of a
730
- * batch), so nothing here claims that none of it was taken.
731
- * A request the handler already answered before it threw isn't answered
732
- * again: the failure is logged.
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.
733
930
  */
734
931
  private refuseServerItem;
735
932
  /**
@@ -795,6 +992,40 @@ export declare class AgentFramework {
795
992
  * Abort an in-flight inference for an agent.
796
993
  */
797
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;
798
1029
  /**
799
1030
  * Get all registered modules.
800
1031
  */
@@ -857,7 +1088,11 @@ export declare class AgentFramework {
857
1088
  private guardSpillsClosedFor;
858
1089
  /** A new agent's guard: its persisted setting, the tool-results spill its
859
1090
  * withheld originals are written to, and the set stop() waits on
860
- * (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. */
861
1096
  private adoptToolResultGuard;
862
1097
  /** Each guard that may have queued storage work, once, by agent name: the
863
1098
  * live agents' and every other that isn't idle. */
@@ -936,9 +1171,15 @@ export declare class AgentFramework {
936
1171
  static readonly QUIESCE_TIMEOUT_MAX_MS = 600000;
937
1172
  static readonly QUIESCE_TIMEOUT_DEFAULT_MS = 120000;
938
1173
  /**
939
- * Enter quiesce mode: persist the flag, suppress gate deliveries, pause all
940
- * MCPL data planes, and wait for in-flight turns to settle (turn-alive is
941
- * `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).
942
1183
  *
943
1184
  * On drain timeout the host STAYS quiesced (`drained: false` in the
944
1185
  * result); with `abandon: true` the undrained streams are cancelled via a
@@ -950,6 +1191,7 @@ export declare class AgentFramework {
950
1191
  timeoutMs?: number;
951
1192
  abandon?: boolean;
952
1193
  }): Promise<HostModeStatus>;
1194
+ private runQuiesce;
953
1195
  /** Cancel every turn-alive stream via the quiesce_abandoned kind and give
954
1196
  * teardown a bounded grace to settle. Shared by the drain-timeout path and
955
1197
  * the already-quiesced escalation path. */
@@ -965,13 +1207,20 @@ export declare class AgentFramework {
965
1207
  resume(opts?: {
966
1208
  force?: boolean;
967
1209
  }): Promise<HostModeStatus>;
968
- /**
969
- * Land every deferred write whose target has no turn alive, one at a time,
970
- * acknowledging each durably as it lands (the persisted queue is rewritten
971
- * after every message). A crash mid-flush therefore replays exactly the
972
- * un-acked remainder at the next boot — no loss, no duplicates. A write
973
- * the store REJECTS is logged and acked too: replaying a poison message
974
- * forever would wedge every later boot on it.
1210
+ private runResume;
1211
+ /**
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.
975
1224
  *
976
1225
  * Per-target: an agent whose turn is still alive keeps ITS messages
977
1226
  * deferred for its own turn boundary; everyone else's flush now.
@@ -998,12 +1247,38 @@ export declare class AgentFramework {
998
1247
  * Which of `ids` already exist in some agent's store as a landed deferred
999
1248
  * write (`metadata.deferredWriteId`). Scans each context manager's recent
1000
1249
  * tail blob-free — an interrupted flush is always within the last few
1001
- * 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.
1002
1253
  */
1003
1254
  private landedDeferredWriteIds;
1004
- /** Atomic JSON write for the recovery files (tmp + rename, 0600) — the
1005
- * 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. */
1006
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. */
1007
1282
  private readRecoveryFile;
1008
1283
  private warnRecoveryFallbackOnce;
1009
1284
  /**
@@ -1014,9 +1289,86 @@ export declare class AgentFramework {
1014
1289
  * window is operator-length, not turn-length. Lives in the
1015
1290
  * branch-independent recovery file so a rollback cannot orphan it.
1016
1291
  * Deferrals outside a quiesce window (turn-alive, mid-tool-cycle) are
1017
- * 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).
1018
1314
  */
1019
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
+ */
1020
1372
  private restorePersistedDeferredWrites;
1021
1373
  /**
1022
1374
  * Operator-driven maintenance: run (or join) one bounded compression pass —
@@ -1035,13 +1387,28 @@ export declare class AgentFramework {
1035
1387
  * were activated right now — WITHOUT running inference, opening a stream, or
1036
1388
  * mutating agent state. Intended for debug/preview tooling.
1037
1389
  *
1038
- * Transparency contract (default): the preview is side-effect-free and
1039
- * leaves no trace on the system. It does only read-only work —
1040
- * `ContextManager.compile` (which never triggers compression itself;
1041
- * compression runs in the background out-of-band), tool filtering, and
1042
- * system-prompt assembly — then delegates to `Agent.buildActivationRequest`.
1043
- * No tokens are spent, nothing is written to Chronicle, and no external
1044
- * MCPL server is contacted.
1390
+ * What a preview commits (default): nothing of its own. It compiles as a
1391
+ * dry run (`dryRun`), filters tools and assembles the system prompt, then
1392
+ * delegates to `Agent.buildActivationRequest`. No tokens are spent, no
1393
+ * external MCPL server is contacted, no fold resolution is persisted and
1394
+ * none of the compression its fold plan calls for is queued; the consumed
1395
+ * watermark and any prepared budget change are left alone; and once
1396
+ * context-manager's thinking binding (context-manager#160, not yet
1397
+ * released) ships, no stamps are committed and no compile awaits
1398
+ * acceptance. In context-manager 0.14 its dry run leaves nothing else
1399
+ * behind but the release of an expired compression hold, as any compile
1400
+ * does (see `Agent.compileWithInjections`). The preview keeps in-memory
1401
+ * bookkeeping of its own, such as handing the context manager the
1402
+ * compression tool definitions, as every activation request does.
1403
+ * Under the autobiographical strategy, a budget the context can't fit
1404
+ * still throws, as for a committing compile: a dry run skips only
1405
+ * context-manager's post-pick check, and an adaptive fold plan that
1406
+ * doesn't fit then overruns at the middle's emission, with a refusal that
1407
+ * names the tokens and the limit. Windowed passthrough's newest message
1408
+ * alone is the one window that comes back larger than the budget. For a
1409
+ * verdict instead of the refusal, `previewContextSettings` returns
1410
+ * context-manager's own at a budget, with the agent's `maxTokens` reserved
1411
+ * for the response.
1045
1412
  *
1046
1413
  * The trade-off is fidelity: the dynamically-gathered ContextInjection[]
1047
1414
  * (module `gatherContext` + MCPL `beforeInference` hooks) are NOT included
@@ -1066,15 +1433,18 @@ export declare class AgentFramework {
1066
1433
  *
1067
1434
  * Unlike `previewActivation` (which renders a request), this returns the
1068
1435
  * picker's plan: resulting tokens, whether it fits, how many summaries would
1069
- * have to be produced first, and the per-chunk fold levels. Commits nothing:
1070
- * no resolution persistence, no compression enqueue, no transition
1071
- * bookkeeping — see `AutobiographicalStrategy.previewContext`.
1436
+ * have to be produced first, and the per-chunk fold levels. It commits
1437
+ * nothing: its select is a dry run, which in context-manager 0.14 leaves
1438
+ * what a select leaves behind as the last committing compile left it —
1439
+ * see `AutobiographicalStrategy.previewContext` and
1440
+ * `Agent.compileWithInjections`.
1072
1441
  *
1073
1442
  * Returns null when the agent's strategy has no fold plan (non-adaptive).
1074
1443
  */
1075
1444
  previewContextSettings(agentName: string, budgetTokens: number, overrides?: Record<string, unknown>, opts?: {
1076
1445
  render?: boolean;
1077
1446
  }): unknown;
1447
+ private previewContextFor;
1078
1448
  /**
1079
1449
  * Feasibility preview for a runtime-settings patch — or, with no patch, for
1080
1450
  * the agent's CURRENT settings (the resume-gate case: quiesce maintenance
@@ -1089,11 +1459,18 @@ export declare class AgentFramework {
1089
1459
  * the compile budget and rejected safe-by-construction paced descents.
1090
1460
  *
1091
1461
  * Never throws for preview-layer reasons: strategy without previewContext,
1092
- * preview overlap, stale branch generation, and the hierarchical (non-
1093
- * adaptive) path all come back as `{available: false, reason}`. Unknown
1094
- * agent still throws, matching the sibling accessors.
1462
+ * preview overlap, stale branch generation, the hierarchical (non-
1463
+ * adaptive) path, and a context manager that refuses its queries (its
1464
+ * strategy's initialization pending or failed) all come back as
1465
+ * `{available: false, reason}`. Unknown agent still throws, matching the
1466
+ * sibling accessors, and so does a patch whose values the agent refuses,
1467
+ * whatever its context manager's state. Whether the strategy takes live
1468
+ * tail and pace settings is the manager's to say, so while it refuses, a
1469
+ * patch that sets them gets no verdict either.
1095
1470
  */
1096
1471
  previewAgentRuntimeSettings(agentName: string, patch?: AgentRuntimeSettingsPatch): RuntimeSettingsPreview;
1472
+ /** previewAgentRuntimeSettings for an agent in hand: boot restore previews one not yet registered. */
1473
+ private previewRuntimeSettingsFor;
1097
1474
  /**
1098
1475
  * Check if process logging is enabled.
1099
1476
  */
@@ -1136,24 +1513,94 @@ export declare class AgentFramework {
1136
1513
  */
1137
1514
  getMembrane(): Membrane;
1138
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. */
1139
1524
  private restoreUsageState;
1140
1525
  private persistUsageState;
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. */
1141
1529
  private readAgentRuntimeSettings;
1142
1530
  private validatePersistedAgentRuntimeSettings;
1143
1531
  /** Load resident-set inline caps from framework state, dropping (loudly)
1144
- * 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. */
1145
1536
  private readPersistedToolResultInlineCaps;
1146
1537
  /** Write (cap) or clear (null) one agent's resident-set inline cap. */
1147
1538
  private persistToolResultInlineCap;
1539
+ /**
1540
+ * Apply an agent's persisted settings at boot, each on its own, the budget
1541
+ * last. A persisted setting never stops the agent booting, except a
1542
+ * think-text policy, which fails closed: an invalid one is refused before
1543
+ * this (validatePersistedAgentRuntimeSettings), and a valid one always
1544
+ * applies. A tail, pace or budget that can't be applied now (a tail or pace
1545
+ * on a strategy without live settings, a budget no longer above maxTokens,
1546
+ * a lower one restored paced on a strategy that can't prepare a smaller
1547
+ * window) is kept set but unapplied (Agent.keepRuntimeSettings), so a later
1548
+ * persisting write keeps it in the record.
1549
+ *
1550
+ * A budget below the recipe's restores as a paced descent from it, unless
1551
+ * the record carries its marker (`contextBudgetReachedTokens`, written when
1552
+ * a compile fit at it) and the preflight says it fits now: then it is
1553
+ * applied at once. The preflight plans the stored context as the context
1554
+ * manager will, with the restored tail and pace, so it sees what a restart
1555
+ * can change there: a new maxTokens (the response reserve) or strategy
1556
+ * configuration. It also sees a context that grew while the agent ran at
1557
+ * another budget after the record was written, through a persist: false
1558
+ * change. The system prompt, tools and injections are outside the context
1559
+ * manager's budget, so they don't enter it (context-manager #162). If a
1560
+ * compile at a budget applied at once this way is refused, the agent
1561
+ * restores it paced then (armed by Agent.restoreRuntimeSettings, run in
1562
+ * Agent.compileAtLiveBudgetNoting). A budget at or above the recipe's is
1563
+ * applied at once with or without the marker, as an increase always is.
1564
+ *
1565
+ * When a marked budget isn't applied at once or a setting can't be
1566
+ * applied, one line says why, what couldn't be applied, and the budget set
1567
+ * beside the one compiles plan at.
1568
+ */
1569
+ private restorePersistedRuntimeSettings;
1570
+ /**
1571
+ * What persists for an agent: its overrides, and `contextBudgetReachedTokens`
1572
+ * when the agent's proof stands for the overridden budget: a compile fit at
1573
+ * it, or the boot applied it at once on the record's proof, and the live
1574
+ * budget hasn't changed since (context-manager #162). A
1575
+ * change of budget, immediate or not, carries none until a compile at it
1576
+ * fits; arming or cancelling a descent leaves the proof as it was.
1577
+ */
1578
+ private persistedRuntimeSettingsOf;
1579
+ /**
1580
+ * A compile at the agent's live budget came out differently from the last
1581
+ * (Agent.onContextBudgetCompiled). Keep the persisted record's
1582
+ * `contextBudgetReachedTokens` true to it: written when a compile fits at
1583
+ * the record's own budget, withdrawn when the context manager refuses that
1584
+ * budget. Nothing else in the record changes, and a budget other than the
1585
+ * record's (one applied with `persist: false`, or a descent's starting
1586
+ * budget) writes nothing. A record that can't be read, or written, is
1587
+ * logged, and the next compile at that budget tells it again.
1588
+ */
1589
+ private recordCompiledContextBudget;
1148
1590
  private persistAgentRuntimeSettings;
1149
- /** Persist (or clear, with null) the host quiesce mode. First process-global
1150
- * key in the framework/state slot: quiesce survives a restart BY DESIGN — a
1151
- * crash mid-surgery must come back up NOT serving against a half-repaired
1152
- * store. Resume is always reachable (public method, WS/HTTP, control-plane
1153
- * 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. */
1154
1598
  private persistHostMode;
1155
1599
  /** The recovery file wins whenever it exists; the branch-local slot is
1156
- * 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. */
1157
1604
  private readHostMode;
1158
1605
  /**
1159
1606
  * Create an ephemeral agent that is NOT registered in the main event loop.
@@ -1179,6 +1626,17 @@ export declare class AgentFramework {
1179
1626
  * events after an ephemeral/conversation agent has been disposed. */
1180
1627
  private recordLogicalTurnToolCalls;
1181
1628
  private recordEphemeralToolCalls;
1629
+ /**
1630
+ * A start dropped before its stream sends anything (its agent was replaced,
1631
+ * or stop() closed admission or ended the lifecycle the start began in)
1632
+ * ends the logical turn it was running. stop() ends every open turn
1633
+ * (openLogical), but a fresh start that awaited its batches' assembly
1634
+ * across a stop() reaches its routing after it and opens its turn. That
1635
+ * turn would then stay open, and the agent's first start after a restart
1636
+ * would continue the dropped turn's routing. The identity check leaves any
1637
+ * other turn open.
1638
+ */
1639
+ private endDroppedTurn;
1182
1640
  /** A logical turn's end, for every agent: it closes the agent's open
1183
1641
  * logical turn when it is the settling stream's own (openLogical), and
1184
1642
  * settles an active ephemeral run. The run's tool-call count comes from
@@ -1191,6 +1649,9 @@ export declare class AgentFramework {
1191
1649
  * The agent is temporarily registered, inference is triggered, and the
1192
1650
  * framework drives the stream (emitting traces, logging, dispatching tools).
1193
1651
  * Returns the agent's speech output when it finishes (no more tool calls).
1652
+ * Rejects with ProviderWaitNotSleptError when the run ends rather than sleep
1653
+ * a retryable failure's stated wait, and with a plain Error for any other
1654
+ * ending.
1194
1655
  *
1195
1656
  * The caller provides a pre-created agent + contextManager (from createEphemeralAgent).
1196
1657
  * The task message should already be in the context manager.
@@ -1224,6 +1685,15 @@ export declare class AgentFramework {
1224
1685
  /** Discoverability for event tags (MCPL RFC-001): the reserved chat:* core,
1225
1686
  * each connected server's declared tag ontology, and gate.js status. */
1226
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;
1227
1697
  /** Synthesized save_image tool — present when a workspace module is
1228
1698
  * registered. Lets the agent persist an image it has already seen in its
1229
1699
  * own context (Discord attachments arrive inlined as base64 and are
@@ -1277,6 +1747,13 @@ export declare class AgentFramework {
1277
1747
  * Best-effort; mirrors reactToRefusal's locus resolution.
1278
1748
  */
1279
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;
1280
1757
  /**
1281
1758
  * Conclude an active `/unstick` session: post the outcome (what was shed and
1282
1759
  * whether the model stopped refusing) to the channel the command came from,
@@ -1340,6 +1817,8 @@ export declare class AgentFramework {
1340
1817
  * explicit, recorded operator override.
1341
1818
  */
1342
1819
  private handleHostCommand;
1820
+ /** handleHostCommand's work, run where stop() can wait for it. */
1821
+ private runHostCommand;
1343
1822
  /**
1344
1823
  * The last message the agent would see in its context right now, via the
1345
1824
  * transparent `previewActivation` render (no inference, no Chronicle
@@ -1370,6 +1849,22 @@ export declare class AgentFramework {
1370
1849
  * Get the most recent process logs (tail).
1371
1850
  */
1372
1851
  tailProcessLogs(count?: number, eventType?: string): ProcessLogEntryWithId[];
1852
+ /**
1853
+ * Switch the store to an existing branch, start the delivery of the
1854
+ * Discord awareness marks the move changes (startDiscordAwarenessDelivery),
1855
+ * and re-materialize the config mount from it. Resolves once the mount has
1856
+ * run; if it fails, it rejects with the store already moved. The marks'
1857
+ * delivery isn't awaited, and its failure doesn't fail the switch. The
1858
+ * store has moved by the time the call returns, before its promise
1859
+ * settles, and a refusal moves nothing. An operator's operation: refused
1860
+ * once stop() has begun, and waited for by stop() while it runs.
1861
+ *
1862
+ * The branch moves under every agent sharing the store, so the switch
1863
+ * reserves the store as a surgery does: every agent must be idle, or it is
1864
+ * refused (OperatorActionError 'agent-busy'), and no turn starts until the
1865
+ * switch is done.
1866
+ */
1867
+ switchBranch(name: string): Promise<void>;
1373
1868
  /**
1374
1869
  * Undo the last inference turn for an agent.
1375
1870
  *
@@ -1386,6 +1881,9 @@ export declare class AgentFramework {
1386
1881
  fromBranch?: string;
1387
1882
  toBranch?: string;
1388
1883
  };
1884
+ /** undoLastTurn's work, for a host/command undo already admitted: a stop()
1885
+ * begun by a trace of one of its turns doesn't refuse the next. */
1886
+ private runUndoLastTurn;
1389
1887
  /**
1390
1888
  * Redo a previously undone turn for an agent.
1391
1889
  *
@@ -1409,6 +1907,14 @@ export declare class AgentFramework {
1409
1907
  }): OperatorLogEntry[];
1410
1908
  /** Where the operator log is written, or undefined when disabled. */
1411
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;
1412
1918
  /**
1413
1919
  * The surgery gate — STORE-wide, not per agent. A branch switch moves the
1414
1920
  * active chronicle branch for every context manager sharing this store,
@@ -1453,7 +1959,7 @@ export declare class AgentFramework {
1453
1959
  messageId: string;
1454
1960
  requester?: OperatorRequester;
1455
1961
  note?: string;
1456
- /** 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). */
1457
1963
  branchName?: string;
1458
1964
  }): Promise<{
1459
1965
  agentName: string;
@@ -1479,7 +1985,8 @@ export declare class AgentFramework {
1479
1985
  }>;
1480
1986
  /**
1481
1987
  * Suppress specific messages from the live context without touching the
1482
- * 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
1483
1990
  * the messages on the fork, switch to it. Shards of a body group are always
1484
1991
  * removed together. Discord originals get awareness markers via the outbox;
1485
1992
  * the batch is `explicit`-activated only after every removal succeeded, and
@@ -1496,7 +2003,7 @@ export declare class AgentFramework {
1496
2003
  messageIds: string[];
1497
2004
  requester?: OperatorRequester;
1498
2005
  note?: string;
1499
- /** 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). */
1500
2007
  branchName?: string;
1501
2008
  }): Promise<{
1502
2009
  agentName: string;
@@ -1543,9 +2050,9 @@ export declare class AgentFramework {
1543
2050
  * undo or redo) without the caller awaiting it. No operator response waits
1544
2051
  * for Discord to accept marks: the MCPL data-plane gate alone holds channel
1545
2052
  * traffic that arrives after it until they are attempted.
1546
- * `syncDiscordAwarenessMarkers` installs that gate synchronously, before
1547
- * its first await, so calling this while a surgery still holds the store
1548
- * puts the gate up before the store is released. With no drain running, the
2053
+ * The sync's body installs that gate synchronously, before its first
2054
+ * await, so calling this while a surgery still holds the store puts the
2055
+ * gate up before the store is released. With no drain running, the
1549
2056
  * drain starts in the same synchronous run (the first reaction request can
1550
2057
  * be written before this returns); with one running, this generation's pass
1551
2058
  * follows it (drainForGeneration). Either way delivery continues
@@ -1556,10 +2063,20 @@ export declare class AgentFramework {
1556
2063
  * (queued when a surgery began, or arriving during its switch or fork): the
1557
2064
  * surgery's store reservation, which used to hold such a turn through the
1558
2065
  * drain, now ends once the gate is up. A failure is accounted by the gate
1559
- * itself: the current generation's failure recycles the connections, and a
1560
- * superseded one leaves that to the newer generation, whose own pass meets
1561
- * the same ledger. Here it is logged and raised as an ops alert, and the
1562
- * next sync, reconnect or start delivers what is still pending.
2066
+ * itself: the current generation's failure recycles the connections (or,
2067
+ * once the host is stopping, releases the gate instead), and a superseded
2068
+ * one leaves that to the newer generation, whose own pass meets the same
2069
+ * ledger. Here it is logged and raised as an ops alert, and the next sync,
2070
+ * reconnect or start delivers what is still pending.
2071
+ *
2072
+ * Like a server's drain, the delivery runs apart from the operation that
2073
+ * started it: it isn't an operator's operation, so stop() doesn't wait for
2074
+ * it. A drain already running when stop() begins runs on while the
2075
+ * connections close, and what it can't deliver stays pending in the
2076
+ * durable outbox. Once stop() has begun, none is started, since there's
2077
+ * no point opening a drain that the teardown is about to cut off: the
2078
+ * marks stay pending, and the next start's barrier reconciles the outbox
2079
+ * with the branch and delivers them.
1563
2080
  *
1564
2081
  * @param after What moved the branch, for the log and the alert
1565
2082
  * ("rollback", "branch switch", "undo" …).
@@ -1567,8 +2084,8 @@ export declare class AgentFramework {
1567
2084
  * branch switch that names none.
1568
2085
  */
1569
2086
  startDiscordAwarenessDelivery(after: string, agentName?: string): void;
1570
- /** Re-materialize config files from the (new) active branch — fire and
1571
- * forget; the gate picks changes up via mtime. Mirrors undoLastTurn. */
2087
+ /** Start config file IO without holding the caller or a surgery's store
2088
+ * reservation. The gate picks it up by mtime; stop() still waits for it. */
1572
2089
  private materializeConfigMountAfterBranchSwitch;
1573
2090
  /**
1574
2091
  * Check if undo/redo is available for an agent.
@@ -1606,6 +2123,14 @@ export declare class AgentFramework {
1606
2123
  * Drop a departed agent's checkpoint tree key and turn/redo bookkeeping.
1607
2124
  * Without this, spawn-and-dispose agents leave a key (and in-memory map
1608
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.
1609
2134
  */
1610
2135
  private evictTurnCheckpoints;
1611
2136
  /**
@@ -1651,13 +2176,59 @@ export declare class AgentFramework {
1651
2176
  /**
1652
2177
  * Spawn a persistent per-channel conversation agent ("fork") from the
1653
2178
  * template agent: own ContextManager under `conversations/{name}`, seeded
1654
- * with a copy of the template's compiled context (the SubagentModule
1655
- * wholesale-copy pattern), registered in the event loop like any agent —
1656
- * but never primary.
2179
+ * with the template's compiled context without its thinking or its unpaired
2180
+ * tool blocks (the SubagentModule wholesale-copy pattern; see the seeding
2181
+ * comment below), registered in the event loop like any agent — but never
2182
+ * primary.
1657
2183
  */
1658
2184
  private createConversationAgent;
1659
- /** Persist the router's generation counters (see hydration in create()). */
1660
- 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;
1661
2232
  /**
1662
2233
  * Remove a closed conversation fork from the framework: its closure turn
1663
2234
  * has finished, so the home mapping has served its purpose and keeping the
@@ -1703,11 +2274,26 @@ export declare class AgentFramework {
1703
2274
  * replies to the agent) DO still arrive, and nothing warned that answering
1704
2275
  * via option 1 leaves the human's natural un-@'d follow-up invisible (Sol
1705
2276
  * answered four #architecture mentions over four days while the follow-ups
1706
- * to her own replies were silently dropped). The wording now states the
1707
- * actual delivery model, and option 1 carries the consequence inline. When
1708
- * the surface tracks a missed-ambient tally (discord-mcpl sends
1709
- * `missedMessages`/`missedCharacters` in push origin), the invitation shows
1710
- * 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.
1711
2297
  */
1712
2298
  private buildClosedChannelInvitation;
1713
2299
  /**
@@ -1716,13 +2302,55 @@ export declare class AgentFramework {
1716
2302
  * id is reassigned to another endpoint (restartMcplServer with a new config).
1717
2303
  */
1718
2304
  private coalescingBinding;
1719
- 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;
1720
2346
  /**
1721
2347
  * Durability barrier for coalescing (RFC-006 §3.1/§3.2): everything
1722
- * written so far is fsynced before the caller proceeds. Group-committed —
1723
- * all acceptances that arrive in one event-loop turn share one
1724
- * `store.sync()` — so throughput is bounded by fsync rate per batch, not
1725
- * 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.
1726
2354
  */
1727
2355
  private commitCoalescingDurable;
1728
2356
  private scheduleCoalescingSnapshot;
@@ -1793,8 +2421,113 @@ export declare class AgentFramework {
1793
2421
  * turns, whose rows are stored exactly as before.
1794
2422
  */
1795
2423
  private silentTurnRowMetadata;
1796
- /** Record plain-prose segments this turn suppressed. */
2424
+ /** Record plain-prose segments this turn suppressed without drafts (proseRouting=disabled). */
1797
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;
1798
2531
  /** Record a successful plain-prose delivery for this turn's receipt. */
1799
2532
  private recordProseDelivery;
1800
2533
  /**
@@ -1822,13 +2555,67 @@ export declare class AgentFramework {
1822
2555
  * inference; never locus-eligible itself (system + no channel metadata).
1823
2556
  */
1824
2557
  private announceLocusIfChanged;
2558
+ /**
2559
+ * The channel a message moves its turn's locus to, by the addressed
2560
+ * re-pin rule (2026-07-31, n=6 and n=7): a conversational message (not a
2561
+ * reaction or a system marker) that addressed the agent, or that follows
2562
+ * up in a channel the turn sent into (TurnRouting.engaged). Undefined for
2563
+ * any other message. A tool boundary weighs the messages it injects by it,
2564
+ * and noteArrival the ones no boundary of the turn weighs.
2565
+ */
2566
+ private repinChannel;
2567
+ /**
2568
+ * Weigh a message that no tool boundary of the agent's open logical turn
2569
+ * will weigh: one that would re-pin the locus becomes one of the turn's
2570
+ * arrivals (TurnRouting.arrivals). A message tune-out diverted
2571
+ * (metadata.tuneOut) never enters a resident's compiled view, so the agent
2572
+ * won't see it, and it moves nothing.
2573
+ */
2574
+ private noteArrival;
2575
+ /**
2576
+ * Whether `agent`'s store is the residents' one message slot, which every
2577
+ * ordinary resident reads (sharedSlotAgents). The subconscious reads that
2578
+ * slot through a merged view, but its own store is isolated, as a fork's
2579
+ * or an ephemeral agent's is.
2580
+ */
2581
+ private isOrdinaryResident;
2582
+ /**
2583
+ * Weigh a message just stored in an ordinary resident's store for every
2584
+ * other ordinary resident's open turn, running or not: residents read one
2585
+ * message slot, and a tool boundary weighs only the messages drained for
2586
+ * its own agent, so no boundary of another resident's turn weighs it.
2587
+ */
2588
+ private noteForOtherResidents;
2589
+ /**
2590
+ * The channel of the turn's newest arrival whose message is still in the
2591
+ * agent's store (TurnRouting.arrivals). A message removed since it was
2592
+ * stored, such as an unread coalesced message its server retracted, moves
2593
+ * nothing, and an earlier one that remains still does. Compression keeps a
2594
+ * message in the store; the last compile can't be the test, since an
2595
+ * arrival between the turn's streams isn't in it yet.
2596
+ */
2597
+ private remainingArrival;
2598
+ /**
2599
+ * Move a turn's locus to the channel its conversation moved to: an
2600
+ * addressed message, or a follow-up in a channel the turn engaged (the
2601
+ * addressed re-pin, repinChannel). Ambient chatter never moves it. Leaves
2602
+ * a durable `[routing]` notice in the window and updates
2603
+ * lastAnnouncedLocus once it's stored, so the next turn's announce-on-change
2604
+ * diffs against what the agent was last told. Returns the notice as stored, for a live
2605
+ * stream to inject with its boundary's other messages. Returns undefined
2606
+ * when the locus is already there, and when the notice couldn't be
2607
+ * stored. The locus has moved then too, but the announce baseline hasn't,
2608
+ * so the agent's next turn announces where its speech lands.
2609
+ */
2610
+ private repinTurnLocus;
1825
2611
  /**
1826
2612
  * Durable window notice for a channel the agent did not ask to open —
1827
2613
  * subscription-policy admission, or an open forced by the agent's own
1828
- * delivery into a closed channel. The agent must always learn that new
1829
- * traffic will start flowing, and that `channel_close` opts out (their
1830
- * decision outranks policy). System message: never triggers inference,
1831
- * 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.
1832
2619
  */
1833
2620
  private recordChannelAutoOpenNotice;
1834
2621
  /**
@@ -1847,7 +2634,7 @@ export declare class AgentFramework {
1847
2634
  * Explicit-prose-routing delivery gateway (docs/explicit-prose-routing.md).
1848
2635
  * Every prose segment of an `explicit`-mode agent flows through here:
1849
2636
  * parse the `>>` prefix, resolve the target, deliver — or bounce to the
1850
- * clipboard with a resend notice. Misdelivery is structurally impossible:
2637
+ * held bounce draft with a resend notice. Misdelivery is structurally impossible:
1851
2638
  * nothing is ever sent to a destination the model did not name (directly
1852
2639
  * or via the turn's sticky target).
1853
2640
  */
@@ -1860,6 +2647,27 @@ export declare class AgentFramework {
1860
2647
  */
1861
2648
  private admitProse;
1862
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;
1863
2671
  /**
1864
2672
  * Where a delivered round leaves its turn's sticky destination, as the
1865
2673
  * explicit gateway sets it once the round's envelopes run: each `>>`
@@ -1869,9 +2677,35 @@ export declare class AgentFramework {
1869
2677
  private roundDestination;
1870
2678
  /** Locus-preserving explicit publication. Source remains byte-identical in Chronicle. */
1871
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;
1872
2687
  private deliverProseEnvelope;
1873
2688
  /** Cap on consecutive bounce-triggered wakes (notices still append after). */
1874
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
+ */
1875
2709
  private bounceProse;
1876
2710
  /**
1877
2711
  * One-time mode primer (docs/explicit-prose-routing.md): when an agent's
@@ -1881,6 +2715,18 @@ export declare class AgentFramework {
1881
2715
  */
1882
2716
  private maybePrimeProseMode;
1883
2717
  private startAgentStream;
2718
+ /**
2719
+ * End a turn that beginAgentTurn drops before it sends anything. The turn
2720
+ * emitted inference:started, and listeners that bracket a turn, such as a
2721
+ * typing loop or an activity indicator, end it on a terminal event, so it
2722
+ * gets inference:aborted with `reason`, and lastInference records its end
2723
+ * as driveStream's would, when the record is still this turn's. Nothing of
2724
+ * the kind when another turn of this agent's name holds the turn token (one
2725
+ * begun after a stop and start, or by a replacement agent object): the
2726
+ * event and the record carry only the name, so this frame's would end that
2727
+ * newer turn instead.
2728
+ */
2729
+ private abortDroppedTurn;
1884
2730
  /**
1885
2731
  * Body of startAgentStream, split out so the caller's try/finally owns the
1886
2732
  * turn token unconditionally. Returns true iff the token was handed off to
@@ -1942,7 +2788,10 @@ export declare class AgentFramework {
1942
2788
  toolUseId: string;
1943
2789
  result: ToolResult;
1944
2790
  }>;
2791
+ /** puppetToolCall's work, run where stop() can wait for it. */
2792
+ private runPuppetToolCall;
1945
2793
  private executeToolCallFrom;
2794
+ /** A programmatic call of an MCPL tool: `serverId` and `prefix` as resolveMcplTool matched them. */
1946
2795
  private executeMcplToolCall;
1947
2796
  /** Event-pushing wrapper for the model-driven dispatch path. */
1948
2797
  private dispatchCodeExecutionToolCall;
@@ -1957,6 +2806,12 @@ export declare class AgentFramework {
1957
2806
  * results reach the running script and never the model context.
1958
2807
  */
1959
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;
1960
2815
  /**
1961
2816
  * Start a background script: dedicated interpreter, output journaled to a
1962
2817
  * workspace file, wake_agent() available in-script. The tool result
@@ -2005,6 +2860,22 @@ export declare class AgentFramework {
2005
2860
  * live wire copy can reuse the identical strings.
2006
2861
  */
2007
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;
2008
2879
  /** Where a tool result labelled `label` is written: `<first writable
2009
2880
  * mount>/tool-results/<label>.txt`, or null when there is no writable
2010
2881
  * workspace. */
@@ -2050,9 +2921,10 @@ export declare class AgentFramework {
2050
2921
  * RFC-007: with an `origin`, observers see the call as they see a model
2051
2922
  * call (register, dispatch with its refusal sites, open; the terminal at
2052
2923
  * the waiter intercept), under the inner tool's own name and class.
2924
+ * `turnId` is the turn the call was made in (dispatchToolCall).
2053
2925
  */
2054
2926
  private dispatchScriptToolCall;
2055
- /** 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. */
2056
2928
  private abortAgentScript;
2057
2929
  private toMembraneToolResult;
2058
2930
  /**
@@ -2060,7 +2932,9 @@ export declare class AgentFramework {
2060
2932
  * convert to Membrane's native ToolResultContentBlock[]. Returns null when
2061
2933
  * the array is text-only (let JSON path handle it; saves a code path).
2062
2934
  * `maxChars`, when provided, caps each accompanying text block so an image
2063
- * 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).
2064
2938
  */
2065
2939
  private tryNativeToolResultContent;
2066
2940
  private toolImageLedgerFor;
@@ -2079,6 +2953,10 @@ export declare class AgentFramework {
2079
2953
  private resolveToolResultInlineCap;
2080
2954
  private approximateDecodedBase64Bytes;
2081
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. */
2082
2960
  private logInference;
2083
2961
  private logProcessEvent;
2084
2962
  /** Forget one server's RFC-008 class declarations (see the close handler). */
@@ -2117,20 +2995,127 @@ export declare class AgentFramework {
2117
2995
  /**
2118
2996
  * Find the MCPL server for a tool: [serverId, prefix], or null.
2119
2997
  * Prefixes can nest (`foo` and `foo--bar`), so `foo--bar--x` can match
2120
- * both. The server whose tools/list produced the name decides; a name no
2121
- * live server listed (stale, or invented by the model) goes to the longest
2122
- * 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.
2123
3004
  */
2124
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
+ */
2125
3026
  private dispatchToolCall;
2126
3027
  private dispatchToolCallEvent;
2127
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;
2128
3037
  /**
2129
3038
  * Splice out the deferred messages addressed to `agentName` (explicitly
2130
3039
  * via forAgent, or implicitly when it is the primary), leaving other
2131
- * 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.
2132
3044
  */
2133
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;
2134
3119
  private editMessage;
2135
3120
  private removeMessage;
2136
3121
  private getMessage;
@@ -2239,7 +3224,7 @@ export declare class AgentFramework {
2239
3224
  * push event to wake the agent onto the same context.
2240
3225
  *
2241
3226
  * Bounded: at most `refusalHandling.maxRewinds` (default 3, hard cap 10)
2242
- * sheds per failure episode; the budget resets on any successful inference.
3227
+ * sheds per failure episode; the budget resets when a turn completes.
2243
3228
  * At the cap (or with nothing left to shed) it stops — the agent stays up
2244
3229
  * and hard-down logging continues, but no further history is consumed.
2245
3230
  */
@@ -2252,9 +3237,16 @@ export declare class AgentFramework {
2252
3237
  /**
2253
3238
  * Reconcile the durable ledger with Chronicle, then deliver every server's
2254
3239
  * work. A drain still running is waited for and then followed by a fresh
2255
- * pass (drainForGeneration).
2256
- */
2257
- syncDiscordAwarenessMarkers(_onlyServerId?: string): Promise<void>;
3240
+ * pass (drainForGeneration). Like the other operator entry points, it's
3241
+ * refused once stop() has begun, and stop() waits for one already running.
3242
+ * The framework's own branch moves start their delivery without awaiting
3243
+ * it (startDiscordAwarenessDelivery).
3244
+ */
3245
+ syncDiscordAwarenessMarkers(onlyServerId?: string): Promise<void>;
3246
+ /** The sync's work. It installs the MCPL data-plane gate before its first
3247
+ * await, so a caller that starts it while holding the store puts the gate
3248
+ * up before releasing the store. */
3249
+ private runDiscordAwarenessSync;
2258
3250
  private resumePreparedDiscordSuppressions;
2259
3251
  /**
2260
3252
  * Deliver every due ref independently. Permanent Discord failures are kept
@@ -2297,6 +3289,13 @@ export declare class AgentFramework {
2297
3289
  private releaseMcplDataPlaneGate;
2298
3290
  private completeMcplDataPlaneGate;
2299
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;
2300
3299
  /**
2301
3300
  * Connect a single MCPL server: register routing entries, open the
2302
3301
  * connection, wire events, and initialize feature sets / scopes /
@@ -2325,6 +3324,12 @@ export declare class AgentFramework {
2325
3324
  * tell→receipt→activate), emit ONE change receipt (§17.6).
2326
3325
  */
2327
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;
2328
3333
  /**
2329
3334
  * (Re-)establish a server's host-side MCPL registration: feature-set state
2330
3335
  * (plus the featureSets/update sent to the server), scope patterns, and
@@ -2382,9 +3387,12 @@ export declare class AgentFramework {
2382
3387
  * Connect a new MCPL server at runtime. Refreshes the tool list and
2383
3388
  * notifies the agent of newly available tools. Throws if the MCPL
2384
3389
  * subsystem is not initialized, the id is already connected, or the
2385
- * 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.
2386
3393
  */
2387
3394
  connectMcplServer(config: import('./mcpl/types.js').McplServerConfig): Promise<void>;
3395
+ private runConnectMcplServer;
2388
3396
  /**
2389
3397
  * Disconnect an MCPL server at runtime: close the connection, destroy its
2390
3398
  * feature-set and checkpoint state (permanent removal — unlike a transient
@@ -2393,13 +3401,17 @@ export declare class AgentFramework {
2393
3401
  * No-op-ish if the server is not connected (still clears routing state).
2394
3402
  */
2395
3403
  disconnectMcplServer(id: string): Promise<void>;
3404
+ private runDisconnectMcplServer;
2396
3405
  /**
2397
3406
  * Restart an MCPL server at runtime: disconnect, then reconnect with the
2398
3407
  * same (or an updated) config. This actually respawns a stdio child —
2399
3408
  * unlike `reconnect: true`, which only retries after transport-level
2400
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.
2401
3412
  */
2402
3413
  restartMcplServer(id: string, newConfig?: import('./mcpl/types.js').McplServerConfig): Promise<void>;
3414
+ private runRestartMcplServer;
2403
3415
  /**
2404
3416
  * List configured MCPL servers with live connection status and the number
2405
3417
  * of tools each currently contributes.
@@ -2452,6 +3464,14 @@ export declare class AgentFramework {
2452
3464
  command?: string;
2453
3465
  url?: string;
2454
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;
2455
3475
  /**
2456
3476
  * Wire event listeners on an MCPL server connection.
2457
3477
  * Push events and inference requests are deferred to Steps 6/7.