@animalabs/agent-framework 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/README.md +340 -22
  2. package/dist/src/admission/admit.d.ts +18 -0
  3. package/dist/src/admission/admit.d.ts.map +1 -1
  4. package/dist/src/admission/admit.js +16 -3
  5. package/dist/src/admission/admit.js.map +1 -1
  6. package/dist/src/agent.d.ts +208 -80
  7. package/dist/src/agent.d.ts.map +1 -1
  8. package/dist/src/agent.js +345 -113
  9. package/dist/src/agent.js.map +1 -1
  10. package/dist/src/api/mcp-server-core.d.ts.map +1 -1
  11. package/dist/src/api/mcp-server-core.js +50 -12
  12. package/dist/src/api/mcp-server-core.js.map +1 -1
  13. package/dist/src/api/server.d.ts.map +1 -1
  14. package/dist/src/api/server.js +4 -20
  15. package/dist/src/api/server.js.map +1 -1
  16. package/dist/src/append-all.d.ts +5 -0
  17. package/dist/src/append-all.d.ts.map +1 -0
  18. package/dist/src/append-all.js +8 -0
  19. package/dist/src/append-all.js.map +1 -0
  20. package/dist/src/code-execution/isolate/scripts.d.ts +12 -8
  21. package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -1
  22. package/dist/src/code-execution/isolate/scripts.js +24 -0
  23. package/dist/src/code-execution/isolate/scripts.js.map +1 -1
  24. package/dist/src/config-checks.d.ts +7 -0
  25. package/dist/src/config-checks.d.ts.map +1 -1
  26. package/dist/src/config-checks.js +14 -0
  27. package/dist/src/config-checks.js.map +1 -1
  28. package/dist/src/context-manager-errors.d.ts +25 -0
  29. package/dist/src/context-manager-errors.d.ts.map +1 -0
  30. package/dist/src/context-manager-errors.js +31 -0
  31. package/dist/src/context-manager-errors.js.map +1 -0
  32. package/dist/src/context-options.d.ts +70 -0
  33. package/dist/src/context-options.d.ts.map +1 -0
  34. package/dist/src/context-options.js +90 -0
  35. package/dist/src/context-options.js.map +1 -0
  36. package/dist/src/cut-off-round.js +4 -4
  37. package/dist/src/deferred-import.d.ts +93 -0
  38. package/dist/src/deferred-import.d.ts.map +1 -0
  39. package/dist/src/deferred-import.js +177 -0
  40. package/dist/src/deferred-import.js.map +1 -0
  41. package/dist/src/dendrite/audience.d.ts +223 -0
  42. package/dist/src/dendrite/audience.d.ts.map +1 -0
  43. package/dist/src/dendrite/audience.js +202 -0
  44. package/dist/src/dendrite/audience.js.map +1 -0
  45. package/dist/src/dendrite/index.d.ts +5 -3
  46. package/dist/src/dendrite/index.d.ts.map +1 -1
  47. package/dist/src/dendrite/index.js +2 -1
  48. package/dist/src/dendrite/index.js.map +1 -1
  49. package/dist/src/dendrite/presets.d.ts +10 -5
  50. package/dist/src/dendrite/presets.d.ts.map +1 -1
  51. package/dist/src/dendrite/presets.js +17 -5
  52. package/dist/src/dendrite/presets.js.map +1 -1
  53. package/dist/src/dendrite/registry.d.ts +62 -7
  54. package/dist/src/dendrite/registry.d.ts.map +1 -1
  55. package/dist/src/dendrite/registry.js +183 -12
  56. package/dist/src/dendrite/registry.js.map +1 -1
  57. package/dist/src/dendrite/types.d.ts +91 -8
  58. package/dist/src/dendrite/types.d.ts.map +1 -1
  59. package/dist/src/failure-text.d.ts +36 -0
  60. package/dist/src/failure-text.d.ts.map +1 -0
  61. package/dist/src/failure-text.js +89 -0
  62. package/dist/src/failure-text.js.map +1 -0
  63. package/dist/src/foreign-rounds.d.ts +69 -0
  64. package/dist/src/foreign-rounds.d.ts.map +1 -0
  65. package/dist/src/foreign-rounds.js +152 -0
  66. package/dist/src/foreign-rounds.js.map +1 -0
  67. package/dist/src/framework.d.ts +2064 -842
  68. package/dist/src/framework.d.ts.map +1 -1
  69. package/dist/src/framework.js +8586 -3739
  70. package/dist/src/framework.js.map +1 -1
  71. package/dist/src/gate/event-gate.d.ts +125 -21
  72. package/dist/src/gate/event-gate.d.ts.map +1 -1
  73. package/dist/src/gate/event-gate.js +487 -72
  74. package/dist/src/gate/event-gate.js.map +1 -1
  75. package/dist/src/gate/index.d.ts +1 -1
  76. package/dist/src/gate/index.d.ts.map +1 -1
  77. package/dist/src/gate/index.js.map +1 -1
  78. package/dist/src/gate/reply-judge.d.ts +4 -0
  79. package/dist/src/gate/reply-judge.d.ts.map +1 -1
  80. package/dist/src/gate/reply-judge.js +12 -3
  81. package/dist/src/gate/reply-judge.js.map +1 -1
  82. package/dist/src/gate/rule-scope.d.ts +30 -0
  83. package/dist/src/gate/rule-scope.d.ts.map +1 -0
  84. package/dist/src/gate/rule-scope.js +41 -0
  85. package/dist/src/gate/rule-scope.js.map +1 -0
  86. package/dist/src/gate/suppress-script-worker.d.ts +2 -0
  87. package/dist/src/gate/suppress-script-worker.d.ts.map +1 -0
  88. package/dist/src/gate/suppress-script-worker.js +103 -0
  89. package/dist/src/gate/suppress-script-worker.js.map +1 -0
  90. package/dist/src/gate/suppress-scripts.d.ts +105 -0
  91. package/dist/src/gate/suppress-scripts.d.ts.map +1 -0
  92. package/dist/src/gate/suppress-scripts.js +403 -0
  93. package/dist/src/gate/suppress-scripts.js.map +1 -0
  94. package/dist/src/gate/suppression-review.d.ts +143 -0
  95. package/dist/src/gate/suppression-review.d.ts.map +1 -0
  96. package/dist/src/gate/suppression-review.js +463 -0
  97. package/dist/src/gate/suppression-review.js.map +1 -0
  98. package/dist/src/gate/suppression-stats.d.ts +125 -0
  99. package/dist/src/gate/suppression-stats.d.ts.map +1 -0
  100. package/dist/src/gate/suppression-stats.js +214 -0
  101. package/dist/src/gate/suppression-stats.js.map +1 -0
  102. package/dist/src/gate/types.d.ts +142 -7
  103. package/dist/src/gate/types.d.ts.map +1 -1
  104. package/dist/src/gate/wake-onboarding.d.ts +119 -0
  105. package/dist/src/gate/wake-onboarding.d.ts.map +1 -0
  106. package/dist/src/gate/wake-onboarding.js +277 -0
  107. package/dist/src/gate/wake-onboarding.js.map +1 -0
  108. package/dist/src/heartbeat/heartbeat.js +1 -1
  109. package/dist/src/heartbeat/heartbeat.js.map +1 -1
  110. package/dist/src/held-writes.d.ts +31 -23
  111. package/dist/src/held-writes.d.ts.map +1 -1
  112. package/dist/src/held-writes.js +44 -59
  113. package/dist/src/held-writes.js.map +1 -1
  114. package/dist/src/index.d.ts +6 -2
  115. package/dist/src/index.d.ts.map +1 -1
  116. package/dist/src/index.js +4 -0
  117. package/dist/src/index.js.map +1 -1
  118. package/dist/src/inference-bounds.d.ts +2 -1
  119. package/dist/src/inference-bounds.d.ts.map +1 -1
  120. package/dist/src/inference-bounds.js +9 -6
  121. package/dist/src/inference-bounds.js.map +1 -1
  122. package/dist/src/jsonrpc-envelope.d.ts +69 -0
  123. package/dist/src/jsonrpc-envelope.d.ts.map +1 -0
  124. package/dist/src/jsonrpc-envelope.js +66 -0
  125. package/dist/src/jsonrpc-envelope.js.map +1 -0
  126. package/dist/src/mcpl/channel-registry.d.ts +188 -28
  127. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  128. package/dist/src/mcpl/channel-registry.js +426 -70
  129. package/dist/src/mcpl/channel-registry.js.map +1 -1
  130. package/dist/src/mcpl/checkpoint-manager.d.ts +2 -4
  131. package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
  132. package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
  133. package/dist/src/mcpl/feature-set-manager.d.ts +2 -4
  134. package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
  135. package/dist/src/mcpl/feature-set-manager.js.map +1 -1
  136. package/dist/src/mcpl/inbound-source.d.ts +2 -1
  137. package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
  138. package/dist/src/mcpl/inbound-source.js +2 -1
  139. package/dist/src/mcpl/inbound-source.js.map +1 -1
  140. package/dist/src/mcpl/inference-router.d.ts +6 -6
  141. package/dist/src/mcpl/inference-router.d.ts.map +1 -1
  142. package/dist/src/mcpl/inference-router.js.map +1 -1
  143. package/dist/src/mcpl/modern-connection.d.ts +109 -15
  144. package/dist/src/mcpl/modern-connection.d.ts.map +1 -1
  145. package/dist/src/mcpl/modern-connection.js +593 -86
  146. package/dist/src/mcpl/modern-connection.js.map +1 -1
  147. package/dist/src/mcpl/protocol-family.d.ts +3 -1
  148. package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
  149. package/dist/src/mcpl/protocol-family.js +15 -9
  150. package/dist/src/mcpl/protocol-family.js.map +1 -1
  151. package/dist/src/mcpl/push-coalescer.d.ts +132 -22
  152. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  153. package/dist/src/mcpl/push-coalescer.js +105 -15
  154. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  155. package/dist/src/mcpl/push-handler.d.ts +9 -7
  156. package/dist/src/mcpl/push-handler.d.ts.map +1 -1
  157. package/dist/src/mcpl/push-handler.js.map +1 -1
  158. package/dist/src/mcpl/server-connection.d.ts +50 -28
  159. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  160. package/dist/src/mcpl/server-connection.js +165 -72
  161. package/dist/src/mcpl/server-connection.js.map +1 -1
  162. package/dist/src/mcpl/tool-classes.d.ts.map +1 -1
  163. package/dist/src/mcpl/tool-classes.js +3 -0
  164. package/dist/src/mcpl/tool-classes.js.map +1 -1
  165. package/dist/src/mcpl/tool-presence.d.ts.map +1 -1
  166. package/dist/src/mcpl/tool-presence.js +10 -6
  167. package/dist/src/mcpl/tool-presence.js.map +1 -1
  168. package/dist/src/mcpl/toolset-host.d.ts.map +1 -1
  169. package/dist/src/mcpl/toolset-host.js +7 -6
  170. package/dist/src/mcpl/toolset-host.js.map +1 -1
  171. package/dist/src/mcpl/toolsets-module.d.ts.map +1 -1
  172. package/dist/src/mcpl/toolsets-module.js +2 -1
  173. package/dist/src/mcpl/toolsets-module.js.map +1 -1
  174. package/dist/src/mcpl/types.d.ts +33 -6
  175. package/dist/src/mcpl/types.d.ts.map +1 -1
  176. package/dist/src/mcpl/types.js.map +1 -1
  177. package/dist/src/module-registry.d.ts +24 -1
  178. package/dist/src/module-registry.d.ts.map +1 -1
  179. package/dist/src/module-registry.js +68 -18
  180. package/dist/src/module-registry.js.map +1 -1
  181. package/dist/src/modules/discord/index.d.ts +45 -8
  182. package/dist/src/modules/discord/index.d.ts.map +1 -1
  183. package/dist/src/modules/discord/index.js +238 -87
  184. package/dist/src/modules/discord/index.js.map +1 -1
  185. package/dist/src/modules/health/index.js +2 -2
  186. package/dist/src/modules/health/index.js.map +1 -1
  187. package/dist/src/modules/history/index.d.ts +59 -0
  188. package/dist/src/modules/history/index.d.ts.map +1 -1
  189. package/dist/src/modules/history/index.js +432 -67
  190. package/dist/src/modules/history/index.js.map +1 -1
  191. package/dist/src/modules/history/semantic.d.ts +6 -5
  192. package/dist/src/modules/history/semantic.d.ts.map +1 -1
  193. package/dist/src/modules/history/semantic.js +18 -25
  194. package/dist/src/modules/history/semantic.js.map +1 -1
  195. package/dist/src/modules/workspace/disk-agreement.d.ts +1 -1
  196. package/dist/src/modules/workspace/disk-agreement.js +1 -1
  197. package/dist/src/modules/workspace/index.d.ts +28 -7
  198. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  199. package/dist/src/modules/workspace/index.js +80 -25
  200. package/dist/src/modules/workspace/index.js.map +1 -1
  201. package/dist/src/modules/workspace/observe.d.ts.map +1 -1
  202. package/dist/src/modules/workspace/observe.js +2 -1
  203. package/dist/src/modules/workspace/observe.js.map +1 -1
  204. package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
  205. package/dist/src/modules/workspace/reconcile.js +3 -2
  206. package/dist/src/modules/workspace/reconcile.js.map +1 -1
  207. package/dist/src/notice-tags.d.ts +20 -9
  208. package/dist/src/notice-tags.d.ts.map +1 -1
  209. package/dist/src/notice-tags.js +20 -9
  210. package/dist/src/notice-tags.js.map +1 -1
  211. package/dist/src/operator-log.d.ts +36 -3
  212. package/dist/src/operator-log.d.ts.map +1 -1
  213. package/dist/src/operator-log.js +2 -2
  214. package/dist/src/operator-log.js.map +1 -1
  215. package/dist/src/presentation.d.ts +747 -0
  216. package/dist/src/presentation.d.ts.map +1 -0
  217. package/dist/src/presentation.js +1437 -0
  218. package/dist/src/presentation.js.map +1 -0
  219. package/dist/src/prose-drafts.d.ts +15 -11
  220. package/dist/src/prose-drafts.d.ts.map +1 -1
  221. package/dist/src/prose-drafts.js +16 -12
  222. package/dist/src/prose-drafts.js.map +1 -1
  223. package/dist/src/read-marks.d.ts +192 -0
  224. package/dist/src/read-marks.d.ts.map +1 -0
  225. package/dist/src/read-marks.js +242 -0
  226. package/dist/src/read-marks.js.map +1 -0
  227. package/dist/src/reasoning-loss.d.ts +5 -0
  228. package/dist/src/reasoning-loss.d.ts.map +1 -0
  229. package/dist/src/reasoning-loss.js +8 -0
  230. package/dist/src/reasoning-loss.js.map +1 -0
  231. package/dist/src/recovery/offline-branch.d.ts +91 -6
  232. package/dist/src/recovery/offline-branch.d.ts.map +1 -1
  233. package/dist/src/recovery/offline-branch.js +277 -32
  234. package/dist/src/recovery/offline-branch.js.map +1 -1
  235. package/dist/src/recovery/recover-cli.js +24 -4
  236. package/dist/src/recovery/recover-cli.js.map +1 -1
  237. package/dist/src/send-tools.d.ts +5 -9
  238. package/dist/src/send-tools.d.ts.map +1 -1
  239. package/dist/src/send-tools.js +40 -7
  240. package/dist/src/send-tools.js.map +1 -1
  241. package/dist/src/sent-rows.js +1 -1
  242. package/dist/src/stored-injections.d.ts +2 -2
  243. package/dist/src/stored-injections.js +2 -2
  244. package/dist/src/stored-removal.d.ts +17 -4
  245. package/dist/src/stored-removal.d.ts.map +1 -1
  246. package/dist/src/stored-removal.js +29 -5
  247. package/dist/src/stored-removal.js.map +1 -1
  248. package/dist/src/supplied-text.d.ts +1 -1
  249. package/dist/src/supplied-text.js +3 -3
  250. package/dist/src/supplied-text.js.map +1 -1
  251. package/dist/src/thinking-drops.d.ts +2 -0
  252. package/dist/src/thinking-drops.d.ts.map +1 -1
  253. package/dist/src/thinking-drops.js.map +1 -1
  254. package/dist/src/tool-presentation.d.ts.map +1 -1
  255. package/dist/src/tool-presentation.js +38 -9
  256. package/dist/src/tool-presentation.js.map +1 -1
  257. package/dist/src/tool-result-guard.d.ts +12 -1
  258. package/dist/src/tool-result-guard.d.ts.map +1 -1
  259. package/dist/src/tool-result-guard.js +42 -8
  260. package/dist/src/tool-result-guard.js.map +1 -1
  261. package/dist/src/tune-out/coordinator.d.ts +1170 -81
  262. package/dist/src/tune-out/coordinator.d.ts.map +1 -1
  263. package/dist/src/tune-out/coordinator.js +3732 -369
  264. package/dist/src/tune-out/coordinator.js.map +1 -1
  265. package/dist/src/tune-out/tools.d.ts +114 -17
  266. package/dist/src/tune-out/tools.d.ts.map +1 -1
  267. package/dist/src/tune-out/tools.js +89 -28
  268. package/dist/src/tune-out/tools.js.map +1 -1
  269. package/dist/src/tune-out/window-anchor.d.ts +143 -0
  270. package/dist/src/tune-out/window-anchor.d.ts.map +1 -0
  271. package/dist/src/tune-out/window-anchor.js +202 -0
  272. package/dist/src/tune-out/window-anchor.js.map +1 -0
  273. package/dist/src/types/agent.d.ts +121 -25
  274. package/dist/src/types/agent.d.ts.map +1 -1
  275. package/dist/src/types/events.d.ts +2 -0
  276. package/dist/src/types/events.d.ts.map +1 -1
  277. package/dist/src/types/framework.d.ts +72 -17
  278. package/dist/src/types/framework.d.ts.map +1 -1
  279. package/dist/src/types/inference-log.d.ts +1 -0
  280. package/dist/src/types/inference-log.d.ts.map +1 -1
  281. package/dist/src/types/module.d.ts +180 -69
  282. package/dist/src/types/module.d.ts.map +1 -1
  283. package/dist/src/types/trace.d.ts +573 -39
  284. package/dist/src/types/trace.d.ts.map +1 -1
  285. package/package.json +4 -4
  286. package/src/admission/admit.ts +32 -3
  287. package/src/agent.ts +392 -132
  288. package/src/api/mcp-server-core.ts +54 -17
  289. package/src/api/server.ts +4 -23
  290. package/src/append-all.ts +6 -0
  291. package/src/code-execution/isolate/scripts.ts +28 -3
  292. package/src/config-checks.ts +14 -0
  293. package/src/context-manager-errors.ts +37 -0
  294. package/src/context-options.ts +106 -0
  295. package/src/cut-off-round.ts +4 -4
  296. package/src/deferred-import.ts +239 -0
  297. package/src/dendrite/audience.ts +315 -0
  298. package/src/dendrite/index.ts +14 -2
  299. package/src/dendrite/presets.ts +18 -6
  300. package/src/dendrite/registry.ts +213 -14
  301. package/src/dendrite/types.ts +92 -8
  302. package/src/failure-text.ts +88 -0
  303. package/src/foreign-rounds.ts +199 -0
  304. package/src/framework.ts +8796 -3813
  305. package/src/gate/event-gate.ts +518 -91
  306. package/src/gate/index.ts +3 -0
  307. package/src/gate/reply-judge.ts +12 -3
  308. package/src/gate/rule-scope.ts +45 -0
  309. package/src/gate/suppress-script-worker.ts +89 -0
  310. package/src/gate/suppress-scripts.ts +414 -0
  311. package/src/gate/suppression-review.ts +517 -0
  312. package/src/gate/suppression-stats.ts +314 -0
  313. package/src/gate/types.ts +148 -7
  314. package/src/gate/wake-onboarding.ts +309 -0
  315. package/src/heartbeat/heartbeat.ts +1 -1
  316. package/src/held-writes.ts +49 -60
  317. package/src/index.ts +10 -2
  318. package/src/inference-bounds.ts +11 -6
  319. package/src/jsonrpc-envelope.ts +81 -0
  320. package/src/mcpl/channel-registry.ts +513 -116
  321. package/src/mcpl/checkpoint-manager.ts +3 -2
  322. package/src/mcpl/feature-set-manager.ts +2 -1
  323. package/src/mcpl/inbound-source.ts +2 -1
  324. package/src/mcpl/inference-router.ts +7 -4
  325. package/src/mcpl/modern-connection.ts +629 -91
  326. package/src/mcpl/protocol-family.ts +15 -9
  327. package/src/mcpl/push-coalescer.ts +193 -34
  328. package/src/mcpl/push-handler.ts +10 -5
  329. package/src/mcpl/server-connection.ts +169 -75
  330. package/src/mcpl/tool-classes.ts +3 -0
  331. package/src/mcpl/tool-presence.ts +10 -5
  332. package/src/mcpl/toolset-host.ts +7 -6
  333. package/src/mcpl/toolsets-module.ts +2 -1
  334. package/src/mcpl/types.ts +33 -6
  335. package/src/module-registry.ts +73 -17
  336. package/src/modules/discord/index.ts +230 -82
  337. package/src/modules/health/index.ts +2 -2
  338. package/src/modules/history/index.ts +439 -70
  339. package/src/modules/history/semantic.ts +18 -24
  340. package/src/modules/workspace/disk-agreement.ts +1 -1
  341. package/src/modules/workspace/index.ts +89 -26
  342. package/src/modules/workspace/observe.ts +2 -1
  343. package/src/modules/workspace/reconcile.ts +3 -2
  344. package/src/notice-tags.ts +21 -9
  345. package/src/operator-log.ts +36 -3
  346. package/src/presentation.ts +1678 -0
  347. package/src/prose-drafts.ts +16 -12
  348. package/src/read-marks.ts +328 -0
  349. package/src/reasoning-loss.ts +7 -0
  350. package/src/recovery/offline-branch.ts +350 -35
  351. package/src/recovery/recover-cli.ts +23 -4
  352. package/src/send-tools.ts +40 -7
  353. package/src/sent-rows.ts +1 -1
  354. package/src/stored-injections.ts +2 -2
  355. package/src/stored-removal.ts +31 -7
  356. package/src/supplied-text.ts +3 -3
  357. package/src/thinking-drops.ts +2 -0
  358. package/src/tool-presentation.ts +34 -9
  359. package/src/tool-result-guard.ts +41 -7
  360. package/src/tune-out/coordinator.ts +4121 -472
  361. package/src/tune-out/tools.ts +162 -44
  362. package/src/tune-out/window-anchor.ts +277 -0
  363. package/src/types/agent.ts +122 -25
  364. package/src/types/events.ts +2 -0
  365. package/src/types/framework.ts +73 -17
  366. package/src/types/inference-log.ts +1 -0
  367. package/src/types/module.ts +181 -68
  368. package/src/types/trace.ts +607 -43
@@ -6,7 +6,9 @@
6
6
  * the ordinary channel/push path the moment it is admitted, exactly as today;
7
7
  * the coalescer only remembers WHERE it landed. A later occurrence of the same
8
8
  * subject edits or removes that message in place while it is still unread
9
- * (above the agent's consumed watermark, not folded by compression), and
9
+ * (above the agent's consumed watermark, a position in the agent's window,
10
+ * #291: a row not in the window yet is unread wherever it is in the store;
11
+ * not folded by compression), and
10
12
  * appends once it has been read. Nothing is staged, journaled or capped: on
11
13
  * any uncertainty (restart, branch switch, eviction) the host behaves as an
12
14
  * append-only host would, which is what the RFC's principle 4 asks for.
@@ -55,10 +57,16 @@ export declare class EmptyContentError extends CoalesceError {
55
57
  /** Where an unread occurrence currently lives. */
56
58
  export interface CoalescingPlacement {
57
59
  agent: string;
58
- /** Stored message id in that agent's context manager. */
60
+ /** Stored message id in that agent's context manager. Absent for a write
61
+ * kept in memory (a surgery's hold, or the wait for its agent's
62
+ * recovery), which counts as read and can't be removed. */
59
63
  messageId?: string;
60
- /** Entry id in the framework's deferred-write queue (turn-alive deferral). */
61
- deferredId?: string;
64
+ /** Set on a placement that wasn't presented to `agent` at its write: a
65
+ * write kept in memory (no `messageId` yet), or one stored while a turn
66
+ * of the agent's was alive, or with a presentation at rest that failed
67
+ * (#291's presentation index). No request of the agent's reads it until
68
+ * it is presented. */
69
+ presented?: false;
62
70
  }
63
71
  export interface CoalescingScope {
64
72
  kind: 'featureSet' | 'channel';
@@ -94,6 +102,20 @@ export interface CoalescedOccurrence<E = unknown> {
94
102
  };
95
103
  /** The event the ordinary path would have queued — the host delivers it. */
96
104
  event: E;
105
+ /**
106
+ * The suppress rule that took this occurrence, or null when none did, once
107
+ * the host has decided (its wake, or its row, whichever came first). Decided
108
+ * once for the occurrence, since a rule's script answers once per event:
109
+ * its row and any later wake read this. Snapshots carry it.
110
+ */
111
+ suppressionDecision?: string | null;
112
+ /**
113
+ * Set on a batch's latest occurrence when the batch holds an occurrence
114
+ * addressed to the agent (`chat:addressed`), this one or an earlier one. An
115
+ * addressed event is never suppressed, so such a batch is shown, whatever its
116
+ * latest occurrence would be decided. Snapshots carry it.
117
+ */
118
+ batchAddressed?: true;
97
119
  /** Set by the coalescer: deliver into this agent only (§3.2 audience may
98
120
  * narrow, never widen — a replacement or notice follows the prior delivery). */
99
121
  deliverTo?: string;
@@ -135,8 +157,19 @@ interface DeferredBatch<E> {
135
157
  * acceptance receipt, which doesn't carry it, reads as not all ambient:
136
158
  * the side that keeps a wake. */
137
159
  allAmbient?: true;
138
- /** Set on a batch restored from a snapshot whose render may have started. */
160
+ /** Set on a batch restored from a snapshot whose render may have started,
161
+ * and on one whose render's delivery threw: its recovery delivers the
162
+ * fallback, without asking the server again. */
139
163
  noRender?: boolean;
164
+ /** Set, to the event id the delivery carried, on a batch whose render's
165
+ * delivery threw where the host can't tell whether it stored the
166
+ * occurrence (CoalescerHost.mayHaveStored). Its recovery's delivery of
167
+ * that event says so (DeliveryOptions.mayBeStored), so the host stores the
168
+ * fallback only where it doesn't find the occurrence stored. A later
169
+ * notice that joins the batch moves its latest event on, and the recovery
170
+ * then delivers that one as any fallback. In memory only: a restored
171
+ * batch that may have rendered is settled by wasPublished. */
172
+ mayBeStored?: string;
140
173
  /** The batch opened on the agent's first view of its subject: a fresh
141
174
  * `initial` birth, or a first-view occupant it displaced that nothing had
142
175
  * shown. Its first delivery is a first view too, while nothing of the
@@ -164,8 +197,8 @@ export interface AssemblyResult {
164
197
  * read: empty or blank render (§5.2), cancelled, revoked before the render
165
198
  * or at its response, a render-start that could not be made durable (the
166
199
  * batch then waits for its recovery wake), a batch whose audience doesn't
167
- * include the agent, a render placed in a deferred queue (another
168
- * agent's, or this agent's own behind a write held there), a render
200
+ * include the agent, a render placed where the turn doesn't read it
201
+ * (stored for another agent whose turn is alive, not presented to it), a render
169
202
  * another assembly froze (its compile may show it, as that request's), or
170
203
  * a cause whose batch was withdrawn, displaced or consumed by another
171
204
  * request. */
@@ -279,12 +312,62 @@ export interface CoalescingReceiptRecord {
279
312
  dropped: number;
280
313
  } | null;
281
314
  }
315
+ export type CoalescingAudit = {
316
+ subject: string;
317
+ eventId: string;
318
+ } & ({
319
+ kind: 'received';
320
+ retract: boolean;
321
+ deferred: boolean;
322
+ } | {
323
+ kind: 'removed';
324
+ } | {
325
+ kind: 'remove-failed';
326
+ } | {
327
+ kind: 'revoked';
328
+ } | {
329
+ kind: 'displaced';
330
+ batch?: true;
331
+ } | {
332
+ kind: 'render-cancelled';
333
+ reason?: 'suspend';
334
+ } | {
335
+ kind: 'recovery-wake';
336
+ attempt: number;
337
+ delayMs: number;
338
+ } | {
339
+ kind: 'rendered';
340
+ source: 'render' | 'fallback';
341
+ empty: boolean;
342
+ } | {
343
+ kind: 'render-failed';
344
+ serverId: string;
345
+ field?: string;
346
+ error: string;
347
+ }
348
+ /** The render's delivery threw, and its batch went to the recovery wake.
349
+ * `mayBeStored`: the host couldn't tell whether a row landed
350
+ * (CoalescerHost.mayHaveStored), so the recovery's delivery reads the
351
+ * store before it stores the fallback. */
352
+ | {
353
+ kind: 'deliver-failed';
354
+ error: string;
355
+ mayBeStored?: true;
356
+ } | {
357
+ kind: 'late-render';
358
+ discarded: true;
359
+ } | {
360
+ kind: 'persist-failed';
361
+ error: string;
362
+ } | {
363
+ kind: 'accepted-observer-failed';
364
+ error: string;
365
+ });
282
366
  export interface CoalescerHost<E> {
283
367
  /** True iff the placement still exists and, as far as the host can tell,
284
368
  * no model request has included it. */
285
369
  isUnread(placement: CoalescingPlacement): boolean;
286
- /** True iff nothing may have shown the placement to the agent: it is still
287
- * in the deferred queue and known not to be stored already, or it is
370
+ /** True iff nothing may have shown the placement to the agent: it is
288
371
  * stored where no committing compile has begun to assemble it and no tool
289
372
  * boundary has injected past it. Unlike
290
373
  * isUnread, a compile counts from its start: a doubt counts as shown. */
@@ -293,18 +376,36 @@ export interface CoalescerHost<E> {
293
376
  remove(placement: CoalescingPlacement): boolean;
294
377
  /** Ordinary delivery of the event; undefined when routing delivered nowhere.
295
378
  * A replacement is delivered as a fresh message after the unread prior was
296
- * removed: it lands where a fresh event lands (§4.1 allows either place). */
297
- deliver(occurrence: CoalescedOccurrence<E>, materialized?: McplContentBlock[], assemblingFor?: string): Promise<CoalescingPlacement | undefined>;
379
+ * removed: it lands where a fresh event lands (§4.1 allows either place).
380
+ * A render's delivery that throws keeps its batch for its recovery wake,
381
+ * which delivers the fallback. A throw is taken as a delivery that stored
382
+ * none of the occurrence, unless mayHaveStored says the host can't tell:
383
+ * so a delivery whose store threw after rows of the occurrence landed
384
+ * answers as stored by them, as the framework's does (context-manager's
385
+ * WriteLandedError). Where the host can't tell (the framework: context-
386
+ * manager's WriteOutcomeUnknownError), the recovery's delivery carries
387
+ * `options.mayBeStored`: the host looks for the occurrence's rows first,
388
+ * by the delivery identity they carry (subject and event id, as
389
+ * wasPublished), and answers the placement of those it finds, storing
390
+ * nothing. It stores the fallback where it finds none, and also where
391
+ * its store can't be read to tell, saying it may then be stored twice. */
392
+ deliver(occurrence: CoalescedOccurrence<E>, materialized?: McplContentBlock[], assemblingFor?: string, options?: DeliveryOptions): Promise<CoalescingPlacement | undefined>;
393
+ /** Whether a delivery's throw leaves the host unable to tell whether it
394
+ * stored the occurrence (the framework's: context-manager's
395
+ * WriteOutcomeUnknownError). Absent, or false, a throw stored none of it. */
396
+ mayHaveStored?(error: unknown): boolean;
298
397
  /** Queue a wake for a batch that has no model-visible content yet. */
299
398
  wakeForBatch(occurrence: CoalescedOccurrence<E>): Promise<void>;
300
- /** Queue an ordinary push wake for `agent`, under the batch's own wake
301
- * policy, to read a render of the batch placed in its deferred queue that
302
- * no request consumed, at `deferredId`. It carries no subject, so the
303
- * subject's other wakes, and later withdrawals of them, leave it.
304
- * `allAmbient`: every notice the render stands for was tagged
305
- * `chat:ambient` (DeferredBatch.allAmbient), so the wake is marked
399
+ /** Queue an ordinary push wake for the placement's agent, under the
400
+ * batch's own wake policy, to read a render of the batch that no request
401
+ * consumed, placed where the turn being assembled doesn't read it: stored
402
+ * and not presented to the agent (`placement`, which the host reads the
403
+ * wake's mark from). It carries
404
+ * no subject, so the subject's other wakes, and later withdrawals of
405
+ * them, leave it. `allAmbient`: every notice the render stands for was
406
+ * tagged `chat:ambient` (DeferredBatch.allAmbient), so the wake is marked
306
407
  * ambient. */
307
- wakeToRead(occurrence: CoalescedOccurrence<E>, agent: string, deferredId?: string, allAmbient?: boolean): Promise<void>;
408
+ wakeToRead(occurrence: CoalescedOccurrence<E>, placement: CoalescingPlacement, allAmbient?: boolean): Promise<void>;
308
409
  /** Withdraw unstarted wakes whose sole cause is this subject. */
309
410
  cancelWake(subject: string): void;
310
411
  /** The batch's audience still holds the authority it was admitted under. */
@@ -312,7 +413,7 @@ export interface CoalescerHost<E> {
312
413
  /** Agents that read this occurrence's delivery target (may spawn a fork). */
313
414
  audience(occurrence: CoalescedOccurrence<E>): Promise<string[]>;
314
415
  render(occurrence: CoalescedOccurrence<E>, params: PushRenderParams): Promise<PushRenderResult>;
315
- audit(record: Record<string, unknown>): void;
416
+ audit(record: CoalescingAudit): void;
316
417
  /** Persist (throttled by the host); the thunk builds the snapshot lazily. */
317
418
  save(snapshot: () => CoalescingSnapshot): void;
318
419
  /** Persist the snapshot NOW (a render is about to start: that boundary must
@@ -340,6 +441,14 @@ export interface CoalescerHost<E> {
340
441
  wasPublished?(subject: string, eventId: string): boolean;
341
442
  now?(): number;
342
443
  }
444
+ /** What the coalescer tells the host of a delivery (CoalescerHost.deliver). */
445
+ export interface DeliveryOptions {
446
+ /** A render's recovery, after a delivery of this event whose throw left the
447
+ * host unable to tell whether it stored the occurrence (mayHaveStored):
448
+ * the host looks for its rows first, and stores it where it finds none,
449
+ * or can't read its store to tell. */
450
+ mayBeStored?: true;
451
+ }
343
452
  export interface CoalescerOptions {
344
453
  retryWindowMs?: number;
345
454
  /** Base delay before re-waking a batch whose render-start commit failed
@@ -487,8 +596,9 @@ export declare class PushCoalescer<E = unknown> {
487
596
  /**
488
597
  * Remove the occupant and the run it builds on, newest first, auditing each
489
598
  * as `kind`. Every member is unread: refreshOccupant has just run, under the
490
- * lock. The host's removal may still refuse one, such as a held write the
491
- * host can't tell isn't already stored. A member the host
599
+ * lock. The host's removal may still refuse one, such as a row a reader
600
+ * fork was handed as framing, or any while a surgery holds the store. A
601
+ * member the host
492
602
  * can't remove may be read, so the walk stops there, leaving it and the
493
603
  * renders it builds on, and the history becomes `unknown`.
494
604
  * Returns false then. It doesn't touch `state.occupant`, which still names
@@ -546,7 +656,7 @@ export declare class PushCoalescer<E = unknown> {
546
656
  * A batch that opened while another render ran is rendered once that
547
657
  * render settles. Resolves whether it materialized.
548
658
  */
549
- materializeNow(agentName: string, subject: string): Promise<boolean>;
659
+ materializeNow(agentName: string, subject: string, onlyIfLatest?: string): Promise<boolean>;
550
660
  /**
551
661
  * Under the lock: decide whether `subject`'s batch renders for `agentName`,
552
662
  * freeze it, make the render-start durable, re-check authority, and start
@@ -1 +1 @@
1
- {"version":3,"file":"push-coalescer.d.ts","sourceRoot":"","sources":["../../../src/mcpl/push-coalescer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIpE,eAAO,MAAM,uBAAuB;aAClC,UAAU;aAAQ,gBAAgB;aAAQ,QAAQ;aAAQ,iBAAiB;aAC3E,aAAa,EAAE,OAAS;CAChB,CAAC;AAEX,eAAO,MAAM,iBAAiB,YAAI,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAC9G,MAAM,MAAM,eAAe,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAI/D,qBAAa,aAAc,SAAQ,KAAK;IAK1B,QAAQ,CAAC,KAAK,EAAE,MAAM;IAAmB,QAAQ,CAAC,IAAI;IAJlE;;8CAE0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,YAAqB,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAW,IAAI,SAAS,EAAE,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,IAAI,CAAA;KAAO,EAI7G;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,kBAAkB,CAEhG;AAED,2EAA2E;AAC3E,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,QAAQ,CAAC,MAAM,mBAAmB;IAClC,YAAY,KAAK,SAAoB,EAGpC;CACF;AAED,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8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ElD;IAED,OAAO,IAAI,IAAI,CAMd;IAED,OAAO,CAAC,OAAO;IAEf,OAAO,CAAC,KAAK;CAWd"}
@@ -434,8 +434,9 @@ export class PushCoalescer {
434
434
  /**
435
435
  * Remove the occupant and the run it builds on, newest first, auditing each
436
436
  * as `kind`. Every member is unread: refreshOccupant has just run, under the
437
- * lock. The host's removal may still refuse one, such as a held write the
438
- * host can't tell isn't already stored. A member the host
437
+ * lock. The host's removal may still refuse one, such as a row a reader
438
+ * fork was handed as framing, or any while a surgery holds the store. A
439
+ * member the host
439
440
  * can't remove may be read, so the walk stops there, leaving it and the
440
441
  * renders it builds on, and the history becomes `unknown`.
441
442
  * Returns false then. It doesn't touch `state.occupant`, which still names
@@ -653,6 +654,8 @@ export class PushCoalescer {
653
654
  // Later notices stay in the batch's audience.
654
655
  occurrence = { ...occurrence, deliverTo: state.batch.latest.deliverTo };
655
656
  }
657
+ if (occurrence.tags?.includes('chat:addressed') || state.batch?.latest.batchAddressed)
658
+ occurrence = { ...occurrence, batchAddressed: true };
656
659
  const notice = { eventId: occurrence.eventId, timestamp: occurrence.timestamp, ...(occurrence.data !== undefined ? { data: structuredClone(occurrence.data) } : {}) };
657
660
  if (state.batch) {
658
661
  state.batch.notices.push(notice);
@@ -724,11 +727,17 @@ export class PushCoalescer {
724
727
  * A batch that opened while another render ran is rendered once that
725
728
  * render settles. Resolves whether it materialized.
726
729
  */
727
- async materializeNow(agentName, subject) {
730
+ async materializeNow(agentName, subject, onlyIfLatest) {
728
731
  for (;;) {
729
732
  if (this.suspended)
730
733
  return false;
731
- const started = await this.locked(() => this.freeze(subject, agentName));
734
+ // `onlyIfLatest`: a newer occurrence took the batch over while this
735
+ // waited for the lock, and its own decision and wake are the batch's.
736
+ const started = await this.locked(() => {
737
+ if (onlyIfLatest !== undefined && this.subjects.get(subject)?.batch?.latest.eventId !== onlyIfLatest)
738
+ return Promise.resolve(undefined);
739
+ return this.freeze(subject, agentName);
740
+ });
732
741
  if (!started || started === 'declined')
733
742
  return false;
734
743
  await started.done;
@@ -820,7 +829,7 @@ export class PushCoalescer {
820
829
  this.scheduleRecovery(subject, state);
821
830
  return 'declined';
822
831
  }
823
- this.clearRecovery(subject);
832
+ this.disarmRecovery(subject);
824
833
  if (this.suspended) {
825
834
  state.rendering = undefined;
826
835
  state.batch = batch;
@@ -888,10 +897,14 @@ export class PushCoalescer {
888
897
  }
889
898
  // Settlement runs under the lock: between the RPC's return and the state
890
899
  // update no admission can withdraw or replace what is being published.
900
+ let failed = false;
901
+ let current = false;
902
+ let recover = false;
891
903
  await this.locked(async () => {
892
904
  try {
893
905
  if (rendering.cancelled || state.rendering !== rendering || this.suspended)
894
906
  return;
907
+ current = true;
895
908
  // Rule 4: authority is re-checked at response.
896
909
  if (!this.host.authorized(occurrence)) {
897
910
  this.host.audit({ kind: 'revoked', subject, eventId: occurrence.eventId });
@@ -910,15 +923,88 @@ export class PushCoalescer {
910
923
  // a run's oldest render can be one.
911
924
  const run = state.occupant?.rendered ? state.occupant : undefined;
912
925
  const firstView = batch.firstView === true && state.history === 'none' && !state.occupant;
913
- const placement = await this.deliver({ ...occurrence, timestamp, content, ...(firstView ? { firstView: true } : {}) }, content, assemblingFor);
914
- if (placement?.deferredId) {
915
- // Landed in a deferred queue: another agent's, whose turn is alive,
916
- // or the assembling agent's own, behind a write held there (the
917
- // host's bypassDeferralFor), or after its assembly ended, as any
918
- // write during its turn. Still unread
919
- // there, so it stays replaceable and withdrawable. The turn being
920
- // assembled doesn't read it, so it isn't materialized for that turn,
921
- // and no request has consumed it. The freeze withdrew the queue's
926
+ let placement;
927
+ try {
928
+ placement = await this.deliver({ ...occurrence, timestamp, content, ...(firstView ? { firstView: true } : {}) }, content, assemblingFor, batch.mayBeStored === occurrence.eventId ? { mayBeStored: true } : undefined);
929
+ }
930
+ catch (error) {
931
+ // A delivery that throws goes to its batch's recovery, which
932
+ // delivers the fallback (the host's deliver). A store that threw
933
+ // after the occurrence's rows landed (context-manager's own
934
+ // listener failing after its append, or a sharded append whose
935
+ // clean-up failed too) doesn't come here: context-manager names
936
+ // the rows (WriteLandedError), and the framework's delivery takes
937
+ // the occurrence as stored by them, placed, presented and woken
938
+ // for, so no fallback is stored beside them. Any other throw stored
939
+ // nothing, unless the host can't tell (mayHaveStored: the store
940
+ // couldn't be read to tell whether a row landed). Then nothing is
941
+ // stored at once: the recovery's delivery says the occurrence may
942
+ // be stored (mayBeStored), and the host, its store read again,
943
+ // places the rows it finds and stores no fallback, stores the
944
+ // fallback where it finds none, and where its store still can't
945
+ // be read, stores the fallback and logs that the agent may see the
946
+ // occurrence twice. A batch opened while this render ran (§5.4
947
+ // rule 1) has its own fallback delivered at the recovery, which
948
+ // isn't this occurrence and isn't looked for: this render, if it
949
+ // landed, stays where it is, unplaced. The mark stays on a batch
950
+ // whose recovery's delivery throws again, so the next one looks
951
+ // again.
952
+ failed = true;
953
+ const mayHaveStored = this.host.mayHaveStored?.(error) === true;
954
+ this.host.audit({ kind: 'deliver-failed', subject, eventId: occurrence.eventId, error: String(error), ...(mayHaveStored ? { mayBeStored: true } : {}) });
955
+ if (state.batch)
956
+ state.batch.noRender = true;
957
+ else {
958
+ batch.noRender = true;
959
+ if (mayHaveStored)
960
+ batch.mayBeStored = occurrence.eventId;
961
+ state.batch = batch;
962
+ }
963
+ // Saved now, not only once the assembly's other renders settle: a
964
+ // newer batch's last snapshot, its acceptance's, has it rendering
965
+ // as usual, and a restart before the next save would render it on
966
+ // top of the render the agent never got. Written at once and made
967
+ // durable, as the render-start boundary is (saveNow, then commit):
968
+ // the host's throttled save would leave that window open for its
969
+ // delay. Where either throws, the throttled save is asked for.
970
+ let written = false;
971
+ try {
972
+ if (this.host.saveNow) {
973
+ this.host.saveNow(this.snapshot());
974
+ written = true;
975
+ }
976
+ }
977
+ catch (saveError) {
978
+ this.host.audit({ kind: 'persist-failed', subject, eventId: occurrence.eventId, error: String(saveError) });
979
+ }
980
+ if (!written)
981
+ this.persist();
982
+ // Its recovery is armed once the render has settled (the finally
983
+ // below): a recovery that fires while a render is under way does
984
+ // nothing and isn't armed again, and the commit may outlast the
985
+ // backoff.
986
+ recover = true;
987
+ if (written) {
988
+ try {
989
+ await this.host.commit?.();
990
+ }
991
+ catch (commitError) {
992
+ this.host.audit({ kind: 'persist-failed', subject, eventId: occurrence.eventId, error: String(commitError) });
993
+ this.persist();
994
+ }
995
+ }
996
+ return;
997
+ }
998
+ if (placement?.presented === false) {
999
+ // Not presented to its agent: stored for another agent, whose
1000
+ // turn is alive, or for the assembling agent after its assembly
1001
+ // ended, as any write during its turn; or kept in memory (no id)
1002
+ // until its hold's release stores it, which the host counts as
1003
+ // read and can't remove, so of what follows only the wake applies
1004
+ // to it. A stored one is still unread there, so it stays
1005
+ // replaceable and withdrawable. The turn being assembled
1006
+ // doesn't read it, so it isn't materialized for that turn, and no
1007
+ // request has consumed it. The freeze withdrew the placement's
922
1008
  // agent's wake for this batch; give it an ordinary wake, as any
923
1009
  // delivery during its turn has, beside any wakes a newer batch has,
924
1010
  // so that its next turn reads the content (the wake starts no turn
@@ -941,7 +1027,7 @@ export class PushCoalescer {
941
1027
  await this.host.wakeForBatch(state.batch.latest);
942
1028
  }
943
1029
  state.audienceAgent = placement.agent;
944
- await this.host.wakeToRead(occurrence, placement.agent, placement.deferredId, batch.allAmbient === true);
1030
+ await this.host.wakeToRead(occurrence, placement, batch.allAmbient === true);
945
1031
  return;
946
1032
  }
947
1033
  // The materialized occurrence is consumed by the request being
@@ -956,6 +1042,10 @@ export class PushCoalescer {
956
1042
  finally {
957
1043
  if (state.rendering === rendering)
958
1044
  state.rendering = undefined;
1045
+ if (current && !failed)
1046
+ this.clearRecovery(subject);
1047
+ if (recover)
1048
+ this.scheduleRecovery(subject, state);
959
1049
  }
960
1050
  });
961
1051
  }