@animalabs/agent-framework 0.23.2 → 0.24.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 (338) hide show
  1. package/README.md +212 -42
  2. package/dist/src/agent.d.ts +60 -9
  3. package/dist/src/agent.d.ts.map +1 -1
  4. package/dist/src/agent.js +92 -12
  5. package/dist/src/agent.js.map +1 -1
  6. package/dist/src/api/server.d.ts.map +1 -1
  7. package/dist/src/api/server.js +14 -12
  8. package/dist/src/api/server.js.map +1 -1
  9. package/dist/src/code-execution/engine.d.ts +177 -0
  10. package/dist/src/code-execution/engine.d.ts.map +1 -0
  11. package/dist/src/code-execution/engine.js +494 -0
  12. package/dist/src/code-execution/engine.js.map +1 -0
  13. package/dist/src/code-execution/index.d.ts +5 -10
  14. package/dist/src/code-execution/index.d.ts.map +1 -1
  15. package/dist/src/code-execution/index.js +5 -9
  16. package/dist/src/code-execution/index.js.map +1 -1
  17. package/dist/src/code-execution/isolate/calls.d.ts +114 -0
  18. package/dist/src/code-execution/isolate/calls.d.ts.map +1 -0
  19. package/dist/src/code-execution/isolate/calls.js +145 -0
  20. package/dist/src/code-execution/isolate/calls.js.map +1 -0
  21. package/dist/src/code-execution/isolate/child-entry.d.ts +2 -0
  22. package/dist/src/code-execution/isolate/child-entry.d.ts.map +1 -0
  23. package/dist/src/code-execution/isolate/child-entry.js +5 -0
  24. package/dist/src/code-execution/isolate/child-entry.js.map +1 -0
  25. package/dist/src/code-execution/isolate/child-main.d.ts +26 -0
  26. package/dist/src/code-execution/isolate/child-main.d.ts.map +1 -0
  27. package/dist/src/code-execution/isolate/child-main.js +132 -0
  28. package/dist/src/code-execution/isolate/child-main.js.map +1 -0
  29. package/dist/src/code-execution/isolate/child.d.ts +44 -0
  30. package/dist/src/code-execution/isolate/child.d.ts.map +1 -0
  31. package/dist/src/code-execution/isolate/child.js +315 -0
  32. package/dist/src/code-execution/isolate/child.js.map +1 -0
  33. package/dist/src/code-execution/isolate/frames.d.ts +80 -0
  34. package/dist/src/code-execution/isolate/frames.d.ts.map +1 -0
  35. package/dist/src/code-execution/isolate/frames.js +210 -0
  36. package/dist/src/code-execution/isolate/frames.js.map +1 -0
  37. package/dist/src/code-execution/isolate/output.d.ts +68 -0
  38. package/dist/src/code-execution/isolate/output.d.ts.map +1 -0
  39. package/dist/src/code-execution/isolate/output.js +143 -0
  40. package/dist/src/code-execution/isolate/output.js.map +1 -0
  41. package/dist/src/code-execution/isolate/prelude.d.ts +109 -0
  42. package/dist/src/code-execution/isolate/prelude.d.ts.map +1 -0
  43. package/dist/src/code-execution/isolate/prelude.js +401 -0
  44. package/dist/src/code-execution/isolate/prelude.js.map +1 -0
  45. package/dist/src/code-execution/isolate/protocol.d.ts +151 -0
  46. package/dist/src/code-execution/isolate/protocol.d.ts.map +1 -0
  47. package/dist/src/code-execution/isolate/protocol.js +150 -0
  48. package/dist/src/code-execution/isolate/protocol.js.map +1 -0
  49. package/dist/src/code-execution/isolate/render.d.ts +57 -0
  50. package/dist/src/code-execution/isolate/render.d.ts.map +1 -0
  51. package/dist/src/code-execution/isolate/render.js +214 -0
  52. package/dist/src/code-execution/isolate/render.js.map +1 -0
  53. package/dist/src/code-execution/isolate/runner.d.ts +250 -0
  54. package/dist/src/code-execution/isolate/runner.d.ts.map +1 -0
  55. package/dist/src/code-execution/isolate/runner.js +854 -0
  56. package/dist/src/code-execution/isolate/runner.js.map +1 -0
  57. package/dist/src/code-execution/isolate/scripts.d.ts +175 -0
  58. package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -0
  59. package/dist/src/code-execution/isolate/scripts.js +357 -0
  60. package/dist/src/code-execution/isolate/scripts.js.map +1 -0
  61. package/dist/src/code-execution/quickjs.wasm +0 -0
  62. package/dist/src/code-execution/tool-definition.d.ts +93 -43
  63. package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
  64. package/dist/src/code-execution/tool-definition.js +176 -142
  65. package/dist/src/code-execution/tool-definition.js.map +1 -1
  66. package/dist/src/deadline-timer.d.ts +3 -0
  67. package/dist/src/deadline-timer.d.ts.map +1 -1
  68. package/dist/src/deadline-timer.js +1 -1
  69. package/dist/src/deadline-timer.js.map +1 -1
  70. package/dist/src/framework.d.ts +1027 -440
  71. package/dist/src/framework.d.ts.map +1 -1
  72. package/dist/src/framework.js +4093 -2238
  73. package/dist/src/framework.js.map +1 -1
  74. package/dist/src/gate/event-gate.d.ts +28 -1
  75. package/dist/src/gate/event-gate.d.ts.map +1 -1
  76. package/dist/src/gate/event-gate.js +88 -10
  77. package/dist/src/gate/event-gate.js.map +1 -1
  78. package/dist/src/held-writes.d.ts +16 -3
  79. package/dist/src/held-writes.d.ts.map +1 -1
  80. package/dist/src/held-writes.js +16 -3
  81. package/dist/src/held-writes.js.map +1 -1
  82. package/dist/src/index.d.ts +6 -6
  83. package/dist/src/index.d.ts.map +1 -1
  84. package/dist/src/index.js +9 -8
  85. package/dist/src/index.js.map +1 -1
  86. package/dist/src/mcpl/channel-registry.d.ts +471 -75
  87. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  88. package/dist/src/mcpl/channel-registry.js +1673 -337
  89. package/dist/src/mcpl/channel-registry.js.map +1 -1
  90. package/dist/src/mcpl/conversation-router.d.ts +12 -7
  91. package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
  92. package/dist/src/mcpl/conversation-router.js +12 -7
  93. package/dist/src/mcpl/conversation-router.js.map +1 -1
  94. package/dist/src/mcpl/convert-block.d.ts.map +1 -1
  95. package/dist/src/mcpl/convert-block.js +9 -5
  96. package/dist/src/mcpl/convert-block.js.map +1 -1
  97. package/dist/src/mcpl/inbound-source.d.ts +50 -0
  98. package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
  99. package/dist/src/mcpl/inbound-source.js +130 -0
  100. package/dist/src/mcpl/inbound-source.js.map +1 -1
  101. package/dist/src/mcpl/index.d.ts +2 -1
  102. package/dist/src/mcpl/index.d.ts.map +1 -1
  103. package/dist/src/mcpl/index.js +3 -2
  104. package/dist/src/mcpl/index.js.map +1 -1
  105. package/dist/src/mcpl/log-value.d.ts +6 -0
  106. package/dist/src/mcpl/log-value.d.ts.map +1 -1
  107. package/dist/src/mcpl/log-value.js +8 -0
  108. package/dist/src/mcpl/log-value.js.map +1 -1
  109. package/dist/src/mcpl/modern-connection.d.ts +15 -6
  110. package/dist/src/mcpl/modern-connection.d.ts.map +1 -1
  111. package/dist/src/mcpl/modern-connection.js +168 -53
  112. package/dist/src/mcpl/modern-connection.js.map +1 -1
  113. package/dist/src/mcpl/prose-grammar.d.ts +4 -5
  114. package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
  115. package/dist/src/mcpl/prose-grammar.js +4 -5
  116. package/dist/src/mcpl/prose-grammar.js.map +1 -1
  117. package/dist/src/mcpl/protocol-family.d.ts +97 -10
  118. package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
  119. package/dist/src/mcpl/protocol-family.js +173 -16
  120. package/dist/src/mcpl/protocol-family.js.map +1 -1
  121. package/dist/src/mcpl/push-coalescer.d.ts +132 -14
  122. package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
  123. package/dist/src/mcpl/push-coalescer.js +227 -50
  124. package/dist/src/mcpl/push-coalescer.js.map +1 -1
  125. package/dist/src/mcpl/push-handler.d.ts +6 -1
  126. package/dist/src/mcpl/push-handler.d.ts.map +1 -1
  127. package/dist/src/mcpl/push-handler.js +4 -1
  128. package/dist/src/mcpl/push-handler.js.map +1 -1
  129. package/dist/src/mcpl/reference-fetcher.d.ts +2 -2
  130. package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
  131. package/dist/src/mcpl/reference-fetcher.js +4 -4
  132. package/dist/src/mcpl/reference-fetcher.js.map +1 -1
  133. package/dist/src/mcpl/server-connection.d.ts +50 -21
  134. package/dist/src/mcpl/server-connection.d.ts.map +1 -1
  135. package/dist/src/mcpl/server-connection.js +158 -74
  136. package/dist/src/mcpl/server-connection.js.map +1 -1
  137. package/dist/src/mcpl/tags.d.ts +24 -0
  138. package/dist/src/mcpl/tags.d.ts.map +1 -1
  139. package/dist/src/mcpl/tags.js +33 -0
  140. package/dist/src/mcpl/tags.js.map +1 -1
  141. package/dist/src/mcpl/tool-result-normalize.d.ts +2 -1
  142. package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -1
  143. package/dist/src/mcpl/tool-result-normalize.js.map +1 -1
  144. package/dist/src/mcpl/transport.d.ts +55 -7
  145. package/dist/src/mcpl/transport.d.ts.map +1 -1
  146. package/dist/src/mcpl/transport.js +163 -34
  147. package/dist/src/mcpl/transport.js.map +1 -1
  148. package/dist/src/mcpl/types.d.ts +22 -6
  149. package/dist/src/mcpl/types.d.ts.map +1 -1
  150. package/dist/src/mcpl/types.js.map +1 -1
  151. package/dist/src/module-registry.d.ts +4 -2
  152. package/dist/src/module-registry.d.ts.map +1 -1
  153. package/dist/src/module-registry.js +100 -13
  154. package/dist/src/module-registry.js.map +1 -1
  155. package/dist/src/modules/discord/index.d.ts.map +1 -1
  156. package/dist/src/modules/discord/index.js +8 -13
  157. package/dist/src/modules/discord/index.js.map +1 -1
  158. package/dist/src/modules/history/index.d.ts.map +1 -1
  159. package/dist/src/modules/history/index.js +27 -4
  160. package/dist/src/modules/history/index.js.map +1 -1
  161. package/dist/src/modules/history/semantic.d.ts +15 -3
  162. package/dist/src/modules/history/semantic.d.ts.map +1 -1
  163. package/dist/src/modules/history/semantic.js +27 -5
  164. package/dist/src/modules/history/semantic.js.map +1 -1
  165. package/dist/src/modules/index.d.ts +1 -1
  166. package/dist/src/modules/index.d.ts.map +1 -1
  167. package/dist/src/modules/index.js.map +1 -1
  168. package/dist/src/modules/unknown-tool.d.ts +4 -1
  169. package/dist/src/modules/unknown-tool.d.ts.map +1 -1
  170. package/dist/src/modules/unknown-tool.js +4 -1
  171. package/dist/src/modules/unknown-tool.js.map +1 -1
  172. package/dist/src/modules/workspace/branch-intent.d.ts +3 -1
  173. package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
  174. package/dist/src/modules/workspace/branch-intent.js +3 -1
  175. package/dist/src/modules/workspace/branch-intent.js.map +1 -1
  176. package/dist/src/modules/workspace/edit-plan.d.ts +265 -0
  177. package/dist/src/modules/workspace/edit-plan.d.ts.map +1 -0
  178. package/dist/src/modules/workspace/edit-plan.js +794 -0
  179. package/dist/src/modules/workspace/edit-plan.js.map +1 -0
  180. package/dist/src/modules/workspace/edit-text.d.ts +117 -0
  181. package/dist/src/modules/workspace/edit-text.d.ts.map +1 -0
  182. package/dist/src/modules/workspace/edit-text.js +584 -0
  183. package/dist/src/modules/workspace/edit-text.js.map +1 -0
  184. package/dist/src/modules/workspace/effects.d.ts +5 -4
  185. package/dist/src/modules/workspace/effects.d.ts.map +1 -1
  186. package/dist/src/modules/workspace/effects.js +78 -25
  187. package/dist/src/modules/workspace/effects.js.map +1 -1
  188. package/dist/src/modules/workspace/index.d.ts +484 -61
  189. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  190. package/dist/src/modules/workspace/index.js +2173 -645
  191. package/dist/src/modules/workspace/index.js.map +1 -1
  192. package/dist/src/modules/workspace/observe.d.ts +213 -38
  193. package/dist/src/modules/workspace/observe.d.ts.map +1 -1
  194. package/dist/src/modules/workspace/observe.js +416 -36
  195. package/dist/src/modules/workspace/observe.js.map +1 -1
  196. package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
  197. package/dist/src/modules/workspace/reconcile.js +15 -8
  198. package/dist/src/modules/workspace/reconcile.js.map +1 -1
  199. package/dist/src/modules/workspace/text.d.ts +32 -0
  200. package/dist/src/modules/workspace/text.d.ts.map +1 -0
  201. package/dist/src/modules/workspace/text.js +67 -0
  202. package/dist/src/modules/workspace/text.js.map +1 -0
  203. package/dist/src/modules/workspace/types.d.ts +210 -6
  204. package/dist/src/modules/workspace/types.d.ts.map +1 -1
  205. package/dist/src/modules/workspace/types.js.map +1 -1
  206. package/dist/src/modules/workspace/watcher.d.ts +3 -2
  207. package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
  208. package/dist/src/modules/workspace/watcher.js.map +1 -1
  209. package/dist/src/operator-log.d.ts +52 -24
  210. package/dist/src/operator-log.d.ts.map +1 -1
  211. package/dist/src/operator-log.js.map +1 -1
  212. package/dist/src/recovery/discord-awareness-outbox.d.ts +496 -72
  213. package/dist/src/recovery/discord-awareness-outbox.d.ts.map +1 -1
  214. package/dist/src/recovery/discord-awareness-outbox.js +1196 -289
  215. package/dist/src/recovery/discord-awareness-outbox.js.map +1 -1
  216. package/dist/src/recovery/offline-branch.d.ts +26 -1
  217. package/dist/src/recovery/offline-branch.d.ts.map +1 -1
  218. package/dist/src/recovery/offline-branch.js +164 -39
  219. package/dist/src/recovery/offline-branch.js.map +1 -1
  220. package/dist/src/recovery/recover-cli.js +23 -4
  221. package/dist/src/recovery/recover-cli.js.map +1 -1
  222. package/dist/src/send-tools.d.ts +11 -0
  223. package/dist/src/send-tools.d.ts.map +1 -0
  224. package/dist/src/send-tools.js +11 -0
  225. package/dist/src/send-tools.js.map +1 -0
  226. package/dist/src/tool-result-guard.d.ts +4 -3
  227. package/dist/src/tool-result-guard.d.ts.map +1 -1
  228. package/dist/src/tool-result-guard.js +5 -4
  229. package/dist/src/tool-result-guard.js.map +1 -1
  230. package/dist/src/tool-result-history.d.ts +1 -1
  231. package/dist/src/tool-result-history.js +1 -1
  232. package/dist/src/tune-out/coordinator.d.ts +21 -0
  233. package/dist/src/tune-out/coordinator.d.ts.map +1 -1
  234. package/dist/src/tune-out/coordinator.js +139 -37
  235. package/dist/src/tune-out/coordinator.js.map +1 -1
  236. package/dist/src/types/agent.d.ts +4 -0
  237. package/dist/src/types/agent.d.ts.map +1 -1
  238. package/dist/src/types/events.d.ts +62 -9
  239. package/dist/src/types/events.d.ts.map +1 -1
  240. package/dist/src/types/framework.d.ts +62 -58
  241. package/dist/src/types/framework.d.ts.map +1 -1
  242. package/dist/src/types/module.d.ts +40 -8
  243. package/dist/src/types/module.d.ts.map +1 -1
  244. package/dist/src/types/trace.d.ts +111 -10
  245. package/dist/src/types/trace.d.ts.map +1 -1
  246. package/dist/src/usage/types.d.ts +16 -0
  247. package/dist/src/usage/types.d.ts.map +1 -1
  248. package/dist/src/usage/usage-tracker.d.ts +14 -1
  249. package/dist/src/usage/usage-tracker.d.ts.map +1 -1
  250. package/dist/src/usage/usage-tracker.js +81 -41
  251. package/dist/src/usage/usage-tracker.js.map +1 -1
  252. package/package.json +6 -5
  253. package/src/agent.ts +93 -12
  254. package/src/api/server.ts +14 -12
  255. package/src/code-execution/engine.ts +595 -0
  256. package/src/code-execution/index.ts +5 -17
  257. package/src/code-execution/isolate/calls.ts +199 -0
  258. package/src/code-execution/isolate/child-entry.ts +5 -0
  259. package/src/code-execution/isolate/child-main.ts +132 -0
  260. package/src/code-execution/isolate/child.ts +327 -0
  261. package/src/code-execution/isolate/frames.ts +209 -0
  262. package/src/code-execution/isolate/output.ts +161 -0
  263. package/src/code-execution/isolate/prelude.ts +409 -0
  264. package/src/code-execution/isolate/protocol.ts +240 -0
  265. package/src/code-execution/isolate/render.ts +230 -0
  266. package/src/code-execution/isolate/runner.ts +911 -0
  267. package/src/code-execution/isolate/scripts.ts +479 -0
  268. package/src/code-execution/quickjs.wasm +0 -0
  269. package/src/code-execution/quickjs.wasm.LICENSES +149 -0
  270. package/src/code-execution/tool-definition.ts +236 -167
  271. package/src/deadline-timer.ts +1 -1
  272. package/src/framework.ts +4468 -2418
  273. package/src/gate/event-gate.ts +78 -11
  274. package/src/held-writes.ts +17 -3
  275. package/src/index.ts +30 -22
  276. package/src/mcpl/channel-registry.ts +1825 -368
  277. package/src/mcpl/conversation-router.ts +12 -7
  278. package/src/mcpl/convert-block.ts +9 -5
  279. package/src/mcpl/inbound-source.ts +131 -0
  280. package/src/mcpl/index.ts +4 -2
  281. package/src/mcpl/log-value.ts +9 -0
  282. package/src/mcpl/modern-connection.ts +162 -53
  283. package/src/mcpl/prose-grammar.ts +4 -5
  284. package/src/mcpl/protocol-family.ts +199 -21
  285. package/src/mcpl/push-coalescer.ts +306 -62
  286. package/src/mcpl/push-handler.ts +10 -2
  287. package/src/mcpl/reference-fetcher.ts +4 -4
  288. package/src/mcpl/server-connection.ts +180 -79
  289. package/src/mcpl/tags.ts +36 -0
  290. package/src/mcpl/tool-result-normalize.ts +2 -1
  291. package/src/mcpl/transport.ts +162 -33
  292. package/src/mcpl/types.ts +23 -6
  293. package/src/module-registry.ts +92 -13
  294. package/src/modules/discord/index.ts +8 -13
  295. package/src/modules/history/index.ts +25 -3
  296. package/src/modules/history/semantic.ts +29 -6
  297. package/src/modules/index.ts +1 -0
  298. package/src/modules/unknown-tool.ts +4 -1
  299. package/src/modules/workspace/branch-intent.ts +3 -1
  300. package/src/modules/workspace/edit-plan.ts +954 -0
  301. package/src/modules/workspace/edit-text.ts +618 -0
  302. package/src/modules/workspace/effects.ts +70 -19
  303. package/src/modules/workspace/index.ts +2247 -642
  304. package/src/modules/workspace/observe.ts +465 -56
  305. package/src/modules/workspace/reconcile.ts +14 -7
  306. package/src/modules/workspace/text.ts +68 -0
  307. package/src/modules/workspace/types.ts +211 -6
  308. package/src/modules/workspace/watcher.ts +3 -2
  309. package/src/operator-log.ts +47 -19
  310. package/src/recovery/discord-awareness-outbox.ts +1500 -356
  311. package/src/recovery/offline-branch.ts +189 -55
  312. package/src/recovery/recover-cli.ts +25 -4
  313. package/src/send-tools.ts +11 -0
  314. package/src/tool-result-guard.ts +6 -5
  315. package/src/tool-result-history.ts +1 -1
  316. package/src/tune-out/coordinator.ts +163 -42
  317. package/src/types/agent.ts +4 -0
  318. package/src/types/events.ts +62 -9
  319. package/src/types/framework.ts +62 -58
  320. package/src/types/module.ts +40 -8
  321. package/src/types/trace.ts +121 -15
  322. package/src/usage/types.ts +16 -0
  323. package/src/usage/usage-tracker.ts +86 -43
  324. package/dist/src/code-execution/py-runner.d.ts +0 -191
  325. package/dist/src/code-execution/py-runner.d.ts.map +0 -1
  326. package/dist/src/code-execution/py-runner.js +0 -655
  327. package/dist/src/code-execution/py-runner.js.map +0 -1
  328. package/dist/src/code-execution/runtime-py.d.ts +0 -50
  329. package/dist/src/code-execution/runtime-py.d.ts.map +0 -1
  330. package/dist/src/code-execution/runtime-py.js +0 -677
  331. package/dist/src/code-execution/runtime-py.js.map +0 -1
  332. package/dist/src/mcpl/prose-stream-router.d.ts +0 -88
  333. package/dist/src/mcpl/prose-stream-router.d.ts.map +0 -1
  334. package/dist/src/mcpl/prose-stream-router.js +0 -291
  335. package/dist/src/mcpl/prose-stream-router.js.map +0 -1
  336. package/src/code-execution/py-runner.ts +0 -791
  337. package/src/code-execution/runtime-py.ts +0 -677
  338. package/src/mcpl/prose-stream-router.ts +0 -268
@@ -1,109 +1,533 @@
1
+ import type { JsStore } from '@animalabs/chronicle';
2
+ /**
3
+ * Discord awareness marks: a reaction (💤 by default) that an operator may
4
+ * choose to place on Discord messages a surgery removed from a resident's
5
+ * context, so the people who wrote them can see the resident no longer has
6
+ * them in view.
7
+ *
8
+ * Marks are an explicit publication choice, separate from the surgery itself
9
+ * (`DiscordAwarenessMarks`, default `none`). Once requested, they are
10
+ * one-shot: branch moves and restarts never derive new requests from branch
11
+ * state, and a restart never activates a surgery's marks. A batch a crash
12
+ * left prepared is retired at startup, unsent, and the operator redoes the
13
+ * surgery from its source to choose marks again (see recoverAtStartup).
14
+ * Requests an activated batch owes go out with any delivery pass, a start's
15
+ * included. What a restart does finish is an interrupted suppression's body,
16
+ * on its own branch. An operator retracts or cancels explicitly. A version 2
17
+ * ledger's batches are kept as history when it is rewritten as version 3,
18
+ * and the work it had still to do is dropped, none of it sent, since nobody
19
+ * chose it (see migrateLedger).
20
+ *
21
+ * The ledger is a table with one entry per reaction, keyed by (MCPL server
22
+ * id, channel, message, emoji): what the acts that still stand want of it,
23
+ * whether Discord is owed a request for that, and what Discord last
24
+ * answered. It is never a model of what is on Discord: an answer is kept as
25
+ * an answer, and a request never answered is kept as one that may land,
26
+ * which nothing takes back. The server id is the configured route to a bot,
27
+ * not the bot's identity: if the route is re-pointed at another bot, owed
28
+ * requests act as that bot, and nothing here can detect it.
29
+ *
30
+ * Acts are ordered by the ledger's own counter (`moment`), never the clock:
31
+ * a surgery's marks choice (its prepare), its activation and each retract
32
+ * take the next moment. Between opposite wishes for one reaction the later
33
+ * act wins, and an activation never revives a reaction that a retract made
34
+ * after the surgery's choice decided against, even once that retract is
35
+ * cancelled.
36
+ *
37
+ * One instance is the file's only writer: the running framework, or the
38
+ * offline recovery while the host is stopped. It keeps the document in
39
+ * memory, reads the file when it first needs it and again after a write
40
+ * fails, and answers views from memory. Acts run one at a time, each written
41
+ * before the next starts: compact JSON to a temporary file, synced, renamed
42
+ * over the ledger, then the ledger's directory and its parent synced, by the
43
+ * rule the framework's own recovery files follow (writeRecoveryFile). A
44
+ * write that activates, completes or retires a batch syncs the store first,
45
+ * so the ledger never outlives the branch state it relies on. A write that
46
+ * throws has left the file as it was, and the act's change is dropped with
47
+ * it; a directory that can't be synced after the rename is reported
48
+ * (onUnsyncedWrite), and the write stands.
49
+ */
1
50
  export declare const DEFAULT_DISCORD_AWARENESS_EMOJI = "\uD83D\uDCA4";
51
+ /**
52
+ * Bound text that came from elsewhere (a Discord error body, a filesystem
53
+ * error) before it is written to the ledger, logged or returned in a
54
+ * receipt: the ledger keeps its entries for the store's life, and a server's
55
+ * error text has no length limit of its own. Head and tail are kept, with
56
+ * the omitted length stated; a cut never splits a surrogate pair.
57
+ */
58
+ export declare function boundDiscordAwarenessText(text: string, max?: number): string;
59
+ /**
60
+ * A Discord answer that the reaction can never succeed: the message or
61
+ * channel is gone or inaccessible, the emoji can't be used, or the message
62
+ * takes no more reactions (or blocks this one). Retrying cannot help.
63
+ */
64
+ export declare function isPermanentDiscordReactionFailure(message: string): boolean;
65
+ /**
66
+ * An operator's request the ledger won't carry out: an unknown batch or
67
+ * retract request. Nothing was written. Any other error from an operator
68
+ * control is a failure to read or write the ledger.
69
+ */
70
+ export declare class DiscordAwarenessRefusal extends Error {
71
+ constructor(message: string);
72
+ }
73
+ /** Where a store's awareness ledger lives: the path every release used. */
2
74
  export declare function defaultDiscordAwarenessOutboxPath(storePath: string): string;
3
75
  export interface DiscordAwarenessRef {
4
76
  serverId: string;
5
77
  channelId: string;
6
78
  messageId: string;
7
79
  }
80
+ /** Which removed messages a publication choice covers. */
81
+ export type DiscordAwarenessScope = 'addressed' | 'all';
82
+ /**
83
+ * An operator's publication choice for one surgery. `none`, the default,
84
+ * keeps the surgery local. With `refs`, the choice authorizes exactly those
85
+ * refs (as a preview showed them): the surgery marks only the ones it
86
+ * actually removes, and never widens the set. Without `refs`, the scope is
87
+ * evaluated when the surgery applies; that form is for an immediate act whose
88
+ * choice and application are the same moment.
89
+ */
90
+ export type DiscordAwarenessMarks = 'none' | {
91
+ scope: DiscordAwarenessScope;
92
+ refs?: DiscordAwarenessRef[];
93
+ };
8
94
  export type DiscordAwarenessAction = 'add' | 'remove';
9
- export type DiscordAwarenessDeliveryStatus = 'pending' | 'applied' | 'permanent-failure';
10
- export interface DiscordAwarenessEntry extends DiscordAwarenessRef {
11
- desired: boolean;
12
- markerPresent: boolean;
13
- deliveryStatus: DiscordAwarenessDeliveryStatus;
14
- attempts: number;
15
- lastAction?: DiscordAwarenessAction;
16
- lastAttemptAt?: number;
17
- lastError?: string;
95
+ export interface DiscordSuppressionInterval {
96
+ fromId: string;
97
+ toId: string;
18
98
  }
99
+ /**
100
+ * Where a batch is in its life:
101
+ * - `prepared`: recorded before its surgery's body change, which settles it.
102
+ * One a crash leaves is retired at startup, never activated (see
103
+ * recoverAtStartup), except a suppression whose body a start on its branch
104
+ * finishes first. One an operator cancelled stays prepared, with
105
+ * `cancelled` set, and is never activated;
106
+ * - `active`: activated by its surgery, or kept so from a version 2 ledger;
107
+ * - `retired`: none of its marks will be sent: its surgery never happened or
108
+ * couldn't record its activation, a start found it left prepared, or a
109
+ * version 2 ledger never activated it.
110
+ */
111
+ export type DiscordAwarenessBatchStatus = 'prepared' | 'active' | 'retired';
112
+ /** One surgery's marks choice, and a suppression's body to resume. */
19
113
  export interface DiscordAwarenessBatch {
20
114
  id: string;
21
- status: 'prepared' | 'active';
115
+ status: DiscordAwarenessBatchStatus;
22
116
  agentName: string;
23
117
  sourceBranch: string;
24
118
  targetBranch: string;
25
119
  emoji: string;
120
+ /** The clock when it was prepared: shown, never compared. */
26
121
  createdAt: number;
27
- refs: DiscordAwarenessEntry[];
122
+ /** The ledger moment of the surgery's marks choice (its prepare). */
123
+ chosen: number;
124
+ /** `none` for a suppression's batch with no marks; `legacy` for a version 2 ledger's. */
125
+ scope: 'none' | DiscordAwarenessScope | 'legacy';
126
+ /** The refs this batch requests marks on (authorized ∩ removed). */
127
+ refs: DiscordAwarenessRef[];
128
+ /** Removed addressable messages this batch leaves unmarked. */
129
+ unmarked?: number;
130
+ /** Authorized refs the surgery did not remove. */
131
+ notRemoved?: number;
28
132
  /**
29
- * `target-branch` may be promoted when its target branch (or a descendant)
30
- * is active. `explicit` requires activate() after a second mutation.
133
+ * A suppression's removals, by message ids, which a start on its target
134
+ * branch applies again while the batch is prepared: that branch being
135
+ * active doesn't prove the redactions finished. The ids make each one
136
+ * idempotent.
31
137
  */
32
- activationPolicy?: 'target-branch' | 'explicit';
33
- /** Idempotent interval operations used to resume an interrupted suppression. */
34
138
  suppressionIntervals?: DiscordSuppressionInterval[];
139
+ cancelled?: {
140
+ at: number;
141
+ by?: string;
142
+ };
143
+ /**
144
+ * A version 2 ledger's batch: how many of its refs agent-framework 0.22.x's
145
+ * last attempt saw added (an add it recorded no error for), set when the
146
+ * ledger was rewritten as version 3. It is history, never a claim about
147
+ * what is on Discord now.
148
+ */
149
+ legacyAdded?: number;
35
150
  }
36
- export interface DiscordSuppressionInterval {
37
- fromId: string;
38
- toId: string;
151
+ /** A surgery's request, as it prepares a batch. */
152
+ export interface DiscordAwarenessPrepareInput {
153
+ agentName: string;
154
+ sourceBranch: string;
155
+ targetBranch: string;
156
+ refs: DiscordAwarenessRef[];
157
+ scope: 'none' | DiscordAwarenessScope;
158
+ emoji?: string;
159
+ suppressionIntervals?: DiscordSuppressionInterval[];
160
+ unmarked?: number;
161
+ notRemoved?: number;
39
162
  }
40
- export interface DiscordAwarenessOperation {
41
- batchId: string;
163
+ /**
164
+ * What the ledger will do with a batch whose body change has landed:
165
+ * - `queued`: it is active, its requests owed;
166
+ * - `not-scheduled`: none of its marks will be sent. It was retired, or it
167
+ * couldn't be, and stays prepared for the next start to retire, or it was
168
+ * never recorded; `error` says which, and why its activation failed.
169
+ */
170
+ export type DiscordAwarenessSettlement = {
171
+ status: 'queued';
172
+ queued: number;
173
+ } | {
174
+ status: 'not-scheduled';
175
+ error: string;
176
+ };
177
+ export type DiscordAwarenessOutcome = 'confirmed' | 'failed' | 'not-sent' | 'unknown';
178
+ /** A request Discord is owed for one reaction, or one claimed to send. */
179
+ export interface DiscordAwarenessRequest extends DiscordAwarenessRef {
42
180
  emoji: string;
43
181
  action: DiscordAwarenessAction;
44
- ref: DiscordAwarenessEntry;
182
+ /** The moment of the act that owes it. */
183
+ due: number;
184
+ }
185
+ /**
186
+ * A reaction's state, as views and receipts count it:
187
+ * - `queued`: a request is owed and not yet sent;
188
+ * - `sending`: a request is on the wire;
189
+ * - `present`, `absent`: nothing is owed, and that was Discord's last answer;
190
+ * - `unknown`: nothing is owed, and the last request went unanswered;
191
+ * - `failed`: what was owed ended unconfirmed: Discord refused it for good,
192
+ * or three attempts went unconfirmed;
193
+ * - `untouched`: no request was ever answered or owed.
194
+ */
195
+ export type DiscordAwarenessReactionState = 'queued' | 'sending' | 'present' | 'absent' | 'unknown' | 'failed' | 'untouched';
196
+ /** Receipt for cancel(). Nothing is ever removed from Discord by a cancel. */
197
+ export interface DiscordAwarenessCancelReceipt {
198
+ /** The batch id or retract request id that was cancelled. */
199
+ target: string;
200
+ kind: 'batch' | 'retract';
201
+ /** Reactions this call left with nothing owed before any request for what
202
+ * the act wanted went out: for a batch not yet activated, every mark it
203
+ * would have requested. A repeated cancel stops none. */
204
+ cancelled: number;
205
+ /** The act's reactions whose last answer from Discord is what the act
206
+ * wanted (cancel undoes none of them). */
207
+ confirmed: number;
208
+ /** The act's reactions with a request on the wire or one never answered:
209
+ * any may land. */
210
+ mayStillLand: number;
211
+ }
212
+ /** Receipt for retract(). */
213
+ export interface DiscordAwarenessRetractReceipt {
214
+ requestId: string;
215
+ /** Removals queued: one per selected reaction, whatever was answered before. */
216
+ removalsQueued: number;
217
+ /** Reactions whose owed add this removal replaced. An add on the wire
218
+ * still settles before the removal is sent, and may land
219
+ * (keysWithUnresolvedAdds). */
220
+ addsSuperseded: number;
221
+ /** Reactions with an add on the wire or one never answered: such an add
222
+ * may land after this removal. */
223
+ keysWithUnresolvedAdds: number;
224
+ }
225
+ /** A version 2 ledger's batch whose undelivered work its rewrite as version
226
+ * 3 dropped, none of it sent (see migrateLedger). */
227
+ export interface DiscordAwarenessImportedUnsent {
228
+ batchId: string;
229
+ agentName: string;
230
+ sourceBranch: string;
231
+ targetBranch: string;
232
+ /** Marks agent-framework 0.22.x had still to add, and to remove. */
233
+ adds: number;
234
+ removals: number;
235
+ }
236
+ /** A batch startup retired (see recoverAtStartup), with what the operator
237
+ * needs to redo its surgery. */
238
+ export interface DiscordAwarenessRetirement {
239
+ batchId: string;
240
+ agentName: string;
241
+ sourceBranch: string;
242
+ targetBranch: string;
243
+ /** The marks it would have requested, none of them sent: 0 for a batch
244
+ * with none, one an operator cancelled, or a version 2 ledger's, whose
245
+ * undelivered work its rewrite dropped and reported. */
246
+ marks: number;
247
+ /** Whether it is a suppression (it names removal intervals). */
248
+ suppression: boolean;
249
+ /** A version 2 ledger's batch: its marks stay as that ledger left them. */
250
+ imported?: boolean;
251
+ }
252
+ /** Per-batch view for operators: what was asked and what is known. */
253
+ export interface DiscordAwarenessBatchView {
254
+ kind: 'batch';
255
+ id: string;
256
+ status: DiscordAwarenessBatchStatus;
257
+ scope: DiscordAwarenessBatch['scope'];
258
+ agentName: string;
259
+ sourceBranch: string;
260
+ targetBranch: string;
261
+ emoji: string;
262
+ createdAt: number;
263
+ refs: number;
264
+ unmarked?: number;
265
+ notRemoved?: number;
266
+ cancelled?: {
267
+ at: number;
268
+ by?: string;
269
+ };
270
+ /** Its refs' reactions, by state. */
271
+ reactions: Record<DiscordAwarenessReactionState, number>;
272
+ /** Its refs' reactions with a request on the wire or one never answered. */
273
+ mayStillLand: number;
274
+ /** A version 2 ledger's batch: refs 0.22.x's last attempt saw added
275
+ * (DiscordAwarenessBatch.legacyAdded). */
276
+ legacyAdded?: number;
45
277
  }
46
- interface BranchDescriptor {
278
+ /** One retract request: the removals it queued and what became of them. */
279
+ export interface DiscordAwarenessRetractView {
280
+ kind: 'retract';
281
+ /** The retract's request id (what cancel takes). */
47
282
  id: string;
48
- name: string;
49
- parentId?: string;
283
+ /** The batch it retracted, or `all`. */
284
+ target: string;
285
+ at: number;
286
+ by?: string;
287
+ cancelled?: {
288
+ at: number;
289
+ by?: string;
290
+ };
291
+ /** Removals it queued. */
292
+ keys: number;
293
+ /** The reactions it still wants absent, by state. */
294
+ reactions: Record<DiscordAwarenessReactionState, number>;
295
+ /** Of those, the ones with a request on the wire or one never answered. */
296
+ mayStillLand: number;
50
297
  }
298
+ export type DiscordAwarenessView = DiscordAwarenessBatchView | DiscordAwarenessRetractView;
299
+ /** Extract Discord addressing metadata without reading message content. */
51
300
  export interface DiscordMessageMetadataCarrier {
52
301
  metadata?: Record<string, unknown>;
53
302
  }
54
- /** Extract Discord addressing metadata without reading message content. */
55
303
  export declare function extractDiscordAwarenessRefs(messages: DiscordMessageMetadataCarrier[], forcedServerId?: string): DiscordAwarenessRef[];
56
304
  /**
57
- * A branch-independent, durable operation ledger for Discord awareness marks.
58
- *
59
- * Completed entries are retained. Reconciliation derives whether their emoji
60
- * should currently exist from Chronicle branch ancestry, queuing `remove`
61
- * after switching away from a recovery branch and `add` when returning to it.
305
+ * A surgery's marks choice as a caller passes it at runtime: `none` (or left
306
+ * out), or `{ scope: 'addressed' | 'all', refs? }` with each ref a Discord
307
+ * address. Anything else is refused, never guessed: a bare scope string (the
308
+ * host/command vocabulary) or a misspelled scope would otherwise skip the
309
+ * scope filter and mark every addressable message. Each entry point that
310
+ * takes a choice in this form checks it with this before it plans or
311
+ * changes anything: the framework's rollback and suppression, and the
312
+ * offline recovery. host/command's undo by messages takes the bare scope
313
+ * words instead and refuses any other, and the recovery CLI parses its --marks.
314
+ */
315
+ export declare function checkedDiscordAwarenessMarks(marks: unknown): DiscordAwarenessMarks;
316
+ /**
317
+ * Select the refs a publication choice covers among removed messages.
318
+ * `addressed` means the message carried the MCPL `chat:addressed` tag (a
319
+ * mention, a reply to the bot, or a DM, as the server classified it); the
320
+ * same signal the framework uses for loci and wakes. With `marks.refs`, only
321
+ * those refs are eligible as well.
322
+ */
323
+ export declare function selectDiscordAwarenessRefs(messages: DiscordMessageMetadataCarrier[], marks: DiscordAwarenessMarks, forcedServerId?: string): {
324
+ refs: DiscordAwarenessRef[];
325
+ addressable: number;
326
+ unmarked: number;
327
+ notRemoved: number;
328
+ };
329
+ /**
330
+ * The durable awareness-mark ledger (see the module comment). Writing calls
331
+ * are async and resolve once their write is on disk; each runs alone. Views
332
+ * are synchronous, from memory: one made while a write is in progress sees
333
+ * the act that write records.
62
334
  */
63
335
  export declare class DiscordAwarenessOutbox {
64
336
  readonly path: string;
65
- constructor(path: string);
66
- prepare(input: {
67
- agentName: string;
68
- sourceBranch: string;
69
- targetBranch: string;
70
- refs: DiscordAwarenessRef[];
71
- emoji?: string;
72
- activationPolicy?: 'target-branch' | 'explicit';
73
- suppressionIntervals?: DiscordSuppressionInterval[];
74
- }): DiscordAwarenessBatch | null;
75
- /** Activate after Chronicle has safely switched to the target branch. */
76
- activate(batchId: string): void;
77
- /**
78
- * Retire a batch that was prepared but whose operation did not complete
79
- * (fork failed, a removal threw and the source branch was restored). A
80
- * prepared batch is armed: it re-fires at boot or on branch switch through
81
- * `activatePreparedForBranch` / `preparedSuppressionsForBranch`, and an
82
- * un-completable suppression there aborts framework start. Only prepared
83
- * batches can be discarded — an active batch owns delivered markers and
84
- * must be reconciled, not dropped. Returns false when nothing was removed.
85
- */
86
- discard(batchId: string): boolean;
87
- /**
88
- * Reconcile every retained ledger entry against the active branch. A marker
89
- * is desired when any active batch for the same ref+emoji has a target branch
90
- * in the active branch's ancestry.
91
- */
92
- reconcileForBranch(branchName: string, branches?: BranchDescriptor[]): {
93
- activated: number;
94
- queued: number;
95
- };
96
- /** Backward-compatible startup helper. */
97
- activatePreparedForBranch(branchName: string, branches?: BranchDescriptor[]): number;
98
- pending(serverId?: string): DiscordAwarenessOperation[];
99
- recordSuccess(batchId: string, ref: DiscordAwarenessRef, action: DiscordAwarenessAction): void;
100
- recordFailure(batchId: string, ref: DiscordAwarenessRef, action: DiscordAwarenessAction, error: string, permanent: boolean): void;
101
- /** Compatibility alias for older callers that only acknowledged adds. */
102
- acknowledge(batchId: string, ref: DiscordAwarenessRef): void;
337
+ private readonly store?;
338
+ /** Told what a version 2 ledger's rewrite drops, before it is written. */
339
+ private readonly announceImport?;
340
+ /** Told of a directory that couldn't be synced after a write's rename. */
341
+ private readonly onUnsyncedWrite;
342
+ /** The document, or null until it is read, and after a failed write
343
+ * whose file couldn't be read back: the next read tries again. */
344
+ private state;
345
+ /** The tail of the acts queued so far: each act starts after it. */
346
+ private queue;
347
+ /**
348
+ * @param path the ledger file (defaultDiscordAwarenessOutboxPath under a store).
349
+ * @param opts.store the store whose branch state activations, completions
350
+ * and retirements rely on, synced before each is written.
351
+ * @param opts.announceImport told, before a version 2 ledger is rewritten
352
+ * as version 3, which batches' undelivered work that drops, none of it sent.
353
+ * @param opts.onUnsyncedWrite told of a directory that couldn't be synced
354
+ * after a write's rename: the write stands, though an operating system
355
+ * crash could lose it. Logged to stderr when not given.
356
+ */
357
+ constructor(path: string, opts?: {
358
+ store?: JsStore;
359
+ announceImport?: (unsent: DiscordAwarenessImportedUnsent[]) => void;
360
+ onUnsyncedWrite?: (directory: string, error: unknown) => void;
361
+ });
362
+ /**
363
+ * Record a surgery's choice before its body change. Returns null when it
364
+ * carries neither marks nor a suppression's removals. A prepared batch
365
+ * never delivers: only its surgery's activate() does. If its write fails it
366
+ * throws, saying what the ledger may hold (failedPrepare), and the surgery
367
+ * doesn't run.
368
+ */
369
+ prepare(input: DiscordAwarenessPrepareInput): Promise<DiscordAwarenessBatch | null>;
370
+ /**
371
+ * Activate a prepared batch after its body change landed: each of its
372
+ * refs is wanted present, and a request is owed for it, on disk before
373
+ * this returns. Activation completes the surgery's earlier choice; it is
374
+ * not a new one, so a reaction a retract reached after that choice, even
375
+ * one cancelled since, keeps what the retract decided. Returns how many
376
+ * requests it made owed.
377
+ */
378
+ activate(batchId: string): Promise<number>;
379
+ private activateIn;
380
+ /**
381
+ * Activate a batch after its body change landed, and if that cannot be
382
+ * recorded, retire it instead, so that what the caller reports is what
383
+ * the ledger will do: `queued`, or `not-scheduled`. A batch that can be
384
+ * neither activated nor retired stays prepared in the file, since a write
385
+ * that fails leaves it as it was, and a start retires it, none of its
386
+ * marks sent: the next start, or for a suppression the first start on its
387
+ * branch, once it finds the removals applied. Never throws.
388
+ */
389
+ settleActivation(batchId: string): Promise<DiscordAwarenessSettlement>;
390
+ /**
391
+ * Retire a batch whose surgery did not complete. Only a prepared batch can
392
+ * be retired; returns false when nothing was.
393
+ */
394
+ discard(batchId: string): Promise<boolean>;
395
+ private retireIn;
396
+ /**
397
+ * The suppressions whose body a start on `branch` finishes: prepared
398
+ * batches that name removal intervals, cancelled or not, whose target is
399
+ * exactly that branch: a surgery's leftovers, or a version 2 ledger's that
400
+ * agent-framework 0.22.x never activated. Branch ancestry is never
401
+ * consulted. Throws when the ledger can't be read.
402
+ */
403
+ pendingSuppressionsFor(branch: string): DiscordAwarenessBatch[];
404
+ /**
405
+ * Retire a suppression's batch once a start on its branch has finished
406
+ * its removals, none of its marks sent: a restart never activates a
407
+ * surgery's marks. `announceRetirement` is told before that is written,
408
+ * for the reason recoverAtStartup's `announce` is. Nothing is written for
409
+ * a batch that isn't prepared.
410
+ */
411
+ completeSuppression(batchId: string, announceRetirement?: () => void): Promise<void>;
412
+ /**
413
+ * Startup reconciliation, run once before any delivery. It derives nothing
414
+ * from branch ancestry, and it activates nothing:
415
+ * - a request a previous process left on the wire is recorded unanswered
416
+ * (recordUnanswered): it may have reached Discord. It counts toward the
417
+ * bound like any unanswered attempt, and `givenUp` is how many reactions
418
+ * that brought there, which nothing more is sent for;
419
+ * - a prepared batch, which an interrupted surgery left, or a failed one
420
+ * that couldn't retire it, is retired, none of its marks sent: the
421
+ * operator redoes the surgery from its source to choose marks again. A
422
+ * suppression whose body is pending is kept instead: a start on its
423
+ * branch finishes its removals and then retires it (completeSuppression).
424
+ * Each retirement is reported in `retired`, and the store is synced before
425
+ * any is written. `announce` is told what it retires and records
426
+ * unanswered before that is written: each is written once, so a notice
427
+ * given after the write would be lost for good if the process ended
428
+ * between the two. If the write doesn't land, the next start says it
429
+ * again.
430
+ */
431
+ recoverAtStartup(announce?: (planned: {
432
+ retired: DiscordAwarenessRetirement[];
433
+ unknownAttempts: number;
434
+ givenUp: number;
435
+ }) => void): Promise<{
436
+ retired: DiscordAwarenessRetirement[];
437
+ unknownAttempts: number;
438
+ givenUp: number;
439
+ }>;
440
+ /**
441
+ * Stop a batch's marks, or a retract's removals (by its request id), from
442
+ * being sent or sent again: the act is taken out of each reaction it
443
+ * wants, and a reaction no act wants any more is owed nothing. A request
444
+ * on the wire still has its answer recorded, before anything else goes for
445
+ * that reaction. Nothing is ever removed from Discord by a cancel: the
446
+ * receipt reports what may already have landed, and retract removes it.
447
+ */
448
+ cancel(target: string, by?: string): Promise<DiscordAwarenessCancelReceipt>;
449
+ /**
450
+ * Remove this bot's mark (through the configured route) from a batch's
451
+ * refs, or (`all`) from every ref of every batch not retired, whether
452
+ * prepared or active, and every reaction the ledger holds. That covers
453
+ * every mark a version 2 ledger recorded: one of its batches that
454
+ * agent-framework 0.22.x activated stays active, and 0.22.x attempted only
455
+ * an active batch's refs. A reaction is one per (route, message, emoji),
456
+ * whichever batches asked for it, so this acts across batches. A removal
457
+ * is owed for every selected reaction, whatever was answered before: an
458
+ * answer can't establish what is on Discord now, and removing an absent
459
+ * reaction does nothing. It is the latest act on those reactions: an add
460
+ * owed there is replaced, and a batch whose choice came before it, once
461
+ * activated, leaves them as this decides. The receipt reports the adds
462
+ * that may still land.
463
+ */
464
+ retract(target: string | 'all', by?: string): Promise<DiscordAwarenessRetractReceipt>;
465
+ /**
466
+ * The requests owed and not on the wire, oldest act first, for one server
467
+ * or every one. Throws when the ledger can't be read.
468
+ */
469
+ due(serverId?: string): DiscordAwarenessRequest[];
470
+ /**
471
+ * Choose a server's next owed request and write it ahead, in one act:
472
+ * what is owed is read as the ledger holds it now, so a cancel or retract
473
+ * made while an earlier request was on the wire is never overridden by an
474
+ * older list. A reaction with a request on the wire is never chosen again
475
+ * until its answer is written. `skip` excludes requests already tried in
476
+ * this pass. Resolves once the write-ahead is on disk, with the request to
477
+ * send, or null when nothing is owed.
478
+ *
479
+ * A delivery pass claims only once its last request's answer is written,
480
+ * so a request of this server still marked on the wire here is one whose
481
+ * answer couldn't be written. It is recorded as unanswered first, as a
482
+ * start records one an earlier process left: it may land, and what it
483
+ * served is owed again.
484
+ */
485
+ claim(serverId: string, skip?: (request: DiscordAwarenessRequest) => boolean): Promise<DiscordAwarenessRequest | null>;
486
+ /**
487
+ * Record a claimed request's answer. An answer ends what is owed only if
488
+ * it is for the act its request served: one for an older act updates what
489
+ * Discord last answered, and what may land, alone, so an act made while a
490
+ * request was out still gets its own request. Resolves to whether this
491
+ * ended what is owed without a confirmation (refused for good, or at the
492
+ * third unconfirmed attempt), so nothing more is sent for it.
493
+ */
494
+ recordOutcome(request: DiscordAwarenessRequest, outcome: DiscordAwarenessOutcome, detail?: {
495
+ permanent?: boolean;
496
+ }): Promise<boolean>;
103
497
  batches(): DiscordAwarenessBatch[];
104
- preparedSuppressionsForBranch(branchName: string, branches?: BranchDescriptor[]): DiscordAwarenessBatch[];
105
- private read;
106
- private write;
498
+ view(): DiscordAwarenessView[];
499
+ /**
500
+ * Run one act after every act queued before it, on the document as it is
501
+ * then (read first if it isn't held). A version 2 ledger is rewritten as
502
+ * version 3 by the first act, before the act's own change.
503
+ */
504
+ private act;
505
+ /** Drop the document held in memory and read the file back; if it can't
506
+ * be read, the next read tries again. */
507
+ private forget;
508
+ /**
509
+ * Read the ledger for an act. A version 2 ledger is rewritten as version
510
+ * 3 (migrateLedger), the work it drops announced before the write; the
511
+ * rewritten document is held only once its write is on disk.
512
+ */
513
+ private open;
514
+ /**
515
+ * The document for a view: as held, or read now. A version 2 ledger is
516
+ * refused here: only an act rewrites it.
517
+ */
518
+ private loaded;
519
+ /**
520
+ * Write the document. A write that throws has left the file as it was, so
521
+ * the act's change, already made in memory, is dropped: the document is
522
+ * read back from the file, and if it can't be read, the next read tries
523
+ * again. `afterCommittedState` syncs the store first.
524
+ */
525
+ private persist;
107
526
  }
108
- export {};
527
+ /** The report of a directory that couldn't be synced, in the words of the
528
+ * framework's recovery-sync alert. */
529
+ export declare function unsyncedWriteText(directory: string, path: string, error: unknown): string;
530
+ /** The Discord channel id a ref's channel names: its last part, when it's
531
+ * spelled `discord:<guild>:<channel>`. Delivery sends it, and keys use it. */
532
+ export declare function discordChannelOf(channelId: string): string;
109
533
  //# sourceMappingURL=discord-awareness-outbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"discord-awareness-outbox.d.ts","sourceRoot":"","sources":["../../../src/recovery/discord-awareness-outbox.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,+BAA+B,iBAAO,CAAC;AAEpD,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,CAAC;AACtD,MAAM,MAAM,8BAA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