@animalabs/agent-framework 0.23.3 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +212 -42
- package/dist/src/agent.d.ts +65 -9
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +98 -12
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +14 -12
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/clock-rows.d.ts +115 -0
- package/dist/src/clock-rows.d.ts.map +1 -0
- package/dist/src/clock-rows.js +222 -0
- package/dist/src/clock-rows.js.map +1 -0
- package/dist/src/code-execution/engine.d.ts +177 -0
- package/dist/src/code-execution/engine.d.ts.map +1 -0
- package/dist/src/code-execution/engine.js +494 -0
- package/dist/src/code-execution/engine.js.map +1 -0
- package/dist/src/code-execution/index.d.ts +5 -10
- package/dist/src/code-execution/index.d.ts.map +1 -1
- package/dist/src/code-execution/index.js +5 -9
- package/dist/src/code-execution/index.js.map +1 -1
- package/dist/src/code-execution/isolate/calls.d.ts +114 -0
- package/dist/src/code-execution/isolate/calls.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/calls.js +145 -0
- package/dist/src/code-execution/isolate/calls.js.map +1 -0
- package/dist/src/code-execution/isolate/child-entry.d.ts +2 -0
- package/dist/src/code-execution/isolate/child-entry.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/child-entry.js +5 -0
- package/dist/src/code-execution/isolate/child-entry.js.map +1 -0
- package/dist/src/code-execution/isolate/child-main.d.ts +26 -0
- package/dist/src/code-execution/isolate/child-main.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/child-main.js +132 -0
- package/dist/src/code-execution/isolate/child-main.js.map +1 -0
- package/dist/src/code-execution/isolate/child.d.ts +44 -0
- package/dist/src/code-execution/isolate/child.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/child.js +315 -0
- package/dist/src/code-execution/isolate/child.js.map +1 -0
- package/dist/src/code-execution/isolate/frames.d.ts +80 -0
- package/dist/src/code-execution/isolate/frames.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/frames.js +210 -0
- package/dist/src/code-execution/isolate/frames.js.map +1 -0
- package/dist/src/code-execution/isolate/output.d.ts +68 -0
- package/dist/src/code-execution/isolate/output.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/output.js +143 -0
- package/dist/src/code-execution/isolate/output.js.map +1 -0
- package/dist/src/code-execution/isolate/prelude.d.ts +109 -0
- package/dist/src/code-execution/isolate/prelude.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/prelude.js +401 -0
- package/dist/src/code-execution/isolate/prelude.js.map +1 -0
- package/dist/src/code-execution/isolate/protocol.d.ts +151 -0
- package/dist/src/code-execution/isolate/protocol.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/protocol.js +150 -0
- package/dist/src/code-execution/isolate/protocol.js.map +1 -0
- package/dist/src/code-execution/isolate/render.d.ts +57 -0
- package/dist/src/code-execution/isolate/render.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/render.js +214 -0
- package/dist/src/code-execution/isolate/render.js.map +1 -0
- package/dist/src/code-execution/isolate/runner.d.ts +250 -0
- package/dist/src/code-execution/isolate/runner.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/runner.js +854 -0
- package/dist/src/code-execution/isolate/runner.js.map +1 -0
- package/dist/src/code-execution/isolate/scripts.d.ts +175 -0
- package/dist/src/code-execution/isolate/scripts.d.ts.map +1 -0
- package/dist/src/code-execution/isolate/scripts.js +357 -0
- package/dist/src/code-execution/isolate/scripts.js.map +1 -0
- package/dist/src/code-execution/quickjs.wasm +0 -0
- package/dist/src/code-execution/tool-definition.d.ts +93 -43
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +176 -142
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/deadline-timer.d.ts +3 -0
- package/dist/src/deadline-timer.d.ts.map +1 -1
- package/dist/src/deadline-timer.js +1 -1
- package/dist/src/deadline-timer.js.map +1 -1
- package/dist/src/framework.d.ts +1120 -457
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +4635 -2505
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +28 -4
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +89 -13
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/held-writes.d.ts +16 -3
- package/dist/src/held-writes.d.ts.map +1 -1
- package/dist/src/held-writes.js +16 -3
- package/dist/src/held-writes.js.map +1 -1
- package/dist/src/index.d.ts +8 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +483 -115
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +1735 -425
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +19 -39
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +27 -59
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts.map +1 -1
- package/dist/src/mcpl/convert-block.js +9 -5
- package/dist/src/mcpl/convert-block.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +50 -0
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -1
- package/dist/src/mcpl/inbound-source.js +130 -0
- package/dist/src/mcpl/inbound-source.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +2 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +3 -2
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +6 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -1
- package/dist/src/mcpl/log-value.js +8 -0
- package/dist/src/mcpl/log-value.js.map +1 -1
- package/dist/src/mcpl/modern-connection.d.ts +15 -6
- package/dist/src/mcpl/modern-connection.d.ts.map +1 -1
- package/dist/src/mcpl/modern-connection.js +168 -53
- package/dist/src/mcpl/modern-connection.js.map +1 -1
- package/dist/src/mcpl/prose-grammar.d.ts +4 -5
- package/dist/src/mcpl/prose-grammar.d.ts.map +1 -1
- package/dist/src/mcpl/prose-grammar.js +4 -5
- package/dist/src/mcpl/prose-grammar.js.map +1 -1
- package/dist/src/mcpl/protocol-family.d.ts +97 -10
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -1
- package/dist/src/mcpl/protocol-family.js +174 -17
- package/dist/src/mcpl/protocol-family.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +132 -14
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +227 -50
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +9 -20
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +7 -49
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +2 -2
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +4 -4
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +50 -21
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +158 -74
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/tags.d.ts +24 -0
- package/dist/src/mcpl/tags.d.ts.map +1 -1
- package/dist/src/mcpl/tags.js +33 -0
- package/dist/src/mcpl/tags.js.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.d.ts +2 -1
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -1
- package/dist/src/mcpl/transport.d.ts +55 -7
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +163 -34
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +22 -6
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/module-registry.d.ts +4 -2
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +100 -13
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +8 -13
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +27 -4
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +15 -3
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +27 -5
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/index.d.ts +1 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js.map +1 -1
- package/dist/src/modules/unknown-tool.d.ts +4 -1
- package/dist/src/modules/unknown-tool.d.ts.map +1 -1
- package/dist/src/modules/unknown-tool.js +4 -1
- package/dist/src/modules/unknown-tool.js.map +1 -1
- package/dist/src/modules/workspace/branch-intent.d.ts +3 -1
- package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
- package/dist/src/modules/workspace/branch-intent.js +3 -1
- package/dist/src/modules/workspace/branch-intent.js.map +1 -1
- package/dist/src/modules/workspace/edit-plan.d.ts +265 -0
- package/dist/src/modules/workspace/edit-plan.d.ts.map +1 -0
- package/dist/src/modules/workspace/edit-plan.js +794 -0
- package/dist/src/modules/workspace/edit-plan.js.map +1 -0
- package/dist/src/modules/workspace/edit-text.d.ts +117 -0
- package/dist/src/modules/workspace/edit-text.d.ts.map +1 -0
- package/dist/src/modules/workspace/edit-text.js +584 -0
- package/dist/src/modules/workspace/edit-text.js.map +1 -0
- package/dist/src/modules/workspace/effects.d.ts +5 -4
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +78 -25
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +493 -62
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +2216 -652
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +213 -38
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +416 -36
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +15 -8
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/text.d.ts +32 -0
- package/dist/src/modules/workspace/text.d.ts.map +1 -0
- package/dist/src/modules/workspace/text.js +67 -0
- package/dist/src/modules/workspace/text.js.map +1 -0
- package/dist/src/modules/workspace/types.d.ts +210 -6
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/modules/workspace/watcher.d.ts +3 -2
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/operator-log.d.ts +52 -24
- package/dist/src/operator-log.d.ts.map +1 -1
- package/dist/src/operator-log.js.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.d.ts +496 -72
- package/dist/src/recovery/discord-awareness-outbox.d.ts.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.js +1196 -289
- package/dist/src/recovery/discord-awareness-outbox.js.map +1 -1
- package/dist/src/recovery/offline-branch.d.ts +26 -1
- package/dist/src/recovery/offline-branch.d.ts.map +1 -1
- package/dist/src/recovery/offline-branch.js +164 -39
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/recovery/recover-cli.js +23 -4
- package/dist/src/recovery/recover-cli.js.map +1 -1
- package/dist/src/send-tools.d.ts +11 -0
- package/dist/src/send-tools.d.ts.map +1 -0
- package/dist/src/send-tools.js +11 -0
- package/dist/src/send-tools.js.map +1 -0
- package/dist/src/timezone.d.ts +4 -2
- package/dist/src/timezone.d.ts.map +1 -1
- package/dist/src/timezone.js +4 -2
- package/dist/src/timezone.js.map +1 -1
- package/dist/src/tool-image-ledger.d.ts +46 -7
- package/dist/src/tool-image-ledger.d.ts.map +1 -1
- package/dist/src/tool-image-ledger.js +60 -7
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts +14 -11
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +17 -14
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +3 -2
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +3 -2
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +21 -0
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +142 -40
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/types/agent.d.ts +31 -6
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +66 -9
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +69 -62
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +40 -8
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +111 -10
- package/dist/src/types/trace.d.ts.map +1 -1
- package/dist/src/usage/types.d.ts +16 -0
- package/dist/src/usage/types.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.d.ts +14 -1
- package/dist/src/usage/usage-tracker.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.js +81 -41
- package/dist/src/usage/usage-tracker.js.map +1 -1
- package/package.json +6 -8
- package/src/agent.ts +99 -12
- package/src/api/server.ts +14 -12
- package/src/clock-rows.ts +302 -0
- package/src/code-execution/engine.ts +595 -0
- package/src/code-execution/index.ts +5 -17
- package/src/code-execution/isolate/calls.ts +199 -0
- package/src/code-execution/isolate/child-entry.ts +5 -0
- package/src/code-execution/isolate/child-main.ts +132 -0
- package/src/code-execution/isolate/child.ts +327 -0
- package/src/code-execution/isolate/frames.ts +209 -0
- package/src/code-execution/isolate/output.ts +161 -0
- package/src/code-execution/isolate/prelude.ts +409 -0
- package/src/code-execution/isolate/protocol.ts +240 -0
- package/src/code-execution/isolate/render.ts +230 -0
- package/src/code-execution/isolate/runner.ts +911 -0
- package/src/code-execution/isolate/scripts.ts +479 -0
- package/src/code-execution/quickjs.wasm +0 -0
- package/src/code-execution/quickjs.wasm.LICENSES +149 -0
- package/src/code-execution/tool-definition.ts +236 -167
- package/src/deadline-timer.ts +1 -1
- package/src/framework.ts +4978 -2671
- package/src/gate/event-gate.ts +79 -17
- package/src/held-writes.ts +17 -3
- package/src/index.ts +32 -22
- package/src/mcpl/channel-registry.ts +1892 -471
- package/src/mcpl/conversation-router.ts +26 -72
- package/src/mcpl/convert-block.ts +9 -5
- package/src/mcpl/inbound-source.ts +131 -0
- package/src/mcpl/index.ts +4 -2
- package/src/mcpl/log-value.ts +9 -0
- package/src/mcpl/modern-connection.ts +162 -53
- package/src/mcpl/prose-grammar.ts +4 -5
- package/src/mcpl/protocol-family.ts +200 -22
- package/src/mcpl/push-coalescer.ts +306 -62
- package/src/mcpl/push-handler.ts +12 -54
- package/src/mcpl/reference-fetcher.ts +4 -4
- package/src/mcpl/server-connection.ts +180 -79
- package/src/mcpl/tags.ts +36 -0
- package/src/mcpl/tool-result-normalize.ts +2 -1
- package/src/mcpl/transport.ts +162 -33
- package/src/mcpl/types.ts +23 -6
- package/src/module-registry.ts +92 -13
- package/src/modules/discord/index.ts +8 -13
- package/src/modules/history/index.ts +25 -3
- package/src/modules/history/semantic.ts +29 -6
- package/src/modules/index.ts +1 -0
- package/src/modules/unknown-tool.ts +4 -1
- package/src/modules/workspace/branch-intent.ts +3 -1
- package/src/modules/workspace/edit-plan.ts +954 -0
- package/src/modules/workspace/edit-text.ts +618 -0
- package/src/modules/workspace/effects.ts +70 -19
- package/src/modules/workspace/index.ts +2293 -650
- package/src/modules/workspace/observe.ts +465 -56
- package/src/modules/workspace/reconcile.ts +14 -7
- package/src/modules/workspace/text.ts +68 -0
- package/src/modules/workspace/types.ts +211 -6
- package/src/modules/workspace/watcher.ts +3 -2
- package/src/operator-log.ts +47 -19
- package/src/recovery/discord-awareness-outbox.ts +1500 -356
- package/src/recovery/offline-branch.ts +189 -55
- package/src/recovery/recover-cli.ts +25 -4
- package/src/send-tools.ts +11 -0
- package/src/timezone.ts +4 -2
- package/src/tool-image-ledger.ts +62 -8
- package/src/tool-result-guard.ts +18 -15
- package/src/tool-result-history.ts +3 -2
- package/src/tune-out/coordinator.ts +166 -45
- package/src/types/agent.ts +32 -6
- package/src/types/events.ts +66 -9
- package/src/types/framework.ts +69 -62
- package/src/types/module.ts +40 -8
- package/src/types/trace.ts +121 -15
- package/src/usage/types.ts +16 -0
- package/src/usage/usage-tracker.ts +86 -43
- package/dist/src/code-execution/py-runner.d.ts +0 -191
- package/dist/src/code-execution/py-runner.d.ts.map +0 -1
- package/dist/src/code-execution/py-runner.js +0 -655
- package/dist/src/code-execution/py-runner.js.map +0 -1
- package/dist/src/code-execution/runtime-py.d.ts +0 -50
- package/dist/src/code-execution/runtime-py.d.ts.map +0 -1
- package/dist/src/code-execution/runtime-py.js +0 -677
- package/dist/src/code-execution/runtime-py.js.map +0 -1
- package/dist/src/mcpl/prose-stream-router.d.ts +0 -88
- package/dist/src/mcpl/prose-stream-router.d.ts.map +0 -1
- package/dist/src/mcpl/prose-stream-router.js +0 -291
- package/dist/src/mcpl/prose-stream-router.js.map +0 -1
- package/src/code-execution/py-runner.ts +0 -791
- package/src/code-execution/runtime-py.ts +0 -677
- package/src/mcpl/prose-stream-router.ts +0 -268
|
@@ -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;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM;IAAmB,QAAQ,CAAC,IAAI;IAAlE,YAAqB,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAW,IAAI,SAAS,EAG1E;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,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAAG,IAAI,EAAE,YAAY,GAAG,SAAS,CAAC;IAAC,EAAE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AAO,EAAE,uBAAuB,EAAE,GAAG,IAAI,CA6CxD;IAED,QAAQ,IAAI,kBAAkB,CAgB7B;IAED,0FAA0F;IAC1F,uBAAuB,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAElD;IAED,OAAO,IAAI,IAAI,CAMd;IAED,OAAO,CAAC,OAAO;IAEf,OAAO,CAAC,KAAK;CAWd"}
|
|
@@ -36,6 +36,14 @@ export class EmptyContentError extends CoalesceError {
|
|
|
36
36
|
this.name = 'EmptyContentError';
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
/** The occupant holding a run's renders, given oldest first: the newest,
|
|
40
|
+
* carrying the rest as `before`. */
|
|
41
|
+
function runOf(members) {
|
|
42
|
+
if (members.length === 0)
|
|
43
|
+
return undefined;
|
|
44
|
+
const newest = members[members.length - 1];
|
|
45
|
+
return members.length > 1 ? { ...newest, before: members.slice(0, -1) } : newest;
|
|
46
|
+
}
|
|
39
47
|
export function coalescingSubjectKey(serverId, binding, scope, key) {
|
|
40
48
|
return JSON.stringify([serverId, binding, scope.kind, scope.id, key]);
|
|
41
49
|
}
|
|
@@ -120,7 +128,7 @@ function showsAsItself(b) {
|
|
|
120
128
|
return false;
|
|
121
129
|
if (isInlineContradiction(b))
|
|
122
130
|
return false;
|
|
123
|
-
if (isFilledString(b.uri) && b.disposition)
|
|
131
|
+
if (isFilledString(b.uri) && b.disposition !== undefined)
|
|
124
132
|
return classifyBlock(b).kind === 'reference';
|
|
125
133
|
if (isFilledString(b.data) && isFilledString(b.mimeType))
|
|
126
134
|
return true;
|
|
@@ -163,8 +171,17 @@ export class PushCoalescer {
|
|
|
163
171
|
subjects = new Map();
|
|
164
172
|
/** `committed`: the durability barrier succeeded after this receipt was
|
|
165
173
|
* written. An uncommitted receipt deduplicates effects but is not an
|
|
166
|
-
* acknowledgement until a commit succeeds.
|
|
174
|
+
* acknowledgement until a commit succeeds. `firstView`: the admission it
|
|
175
|
+
* records handed its occurrence to the host's delivery marked as the
|
|
176
|
+
* agent's first view (`firstView`), whether or not the host placed
|
|
177
|
+
* it, so a retry answered from it says so too. Kept in memory only: a
|
|
178
|
+
* receipt restored from a snapshot or the crash-window bridge reads as no
|
|
179
|
+
* first view. */
|
|
167
180
|
receipts = new Map();
|
|
181
|
+
/** Set by a delivery that carries `firstView`. admit() clears it before
|
|
182
|
+
* an admission's effects and reads it after them; every delivery runs
|
|
183
|
+
* under the lock, so between the two it is that admission's alone. */
|
|
184
|
+
deliveredFirstView = false;
|
|
168
185
|
retryWindowMs;
|
|
169
186
|
maxSubjects;
|
|
170
187
|
maxNotices;
|
|
@@ -216,10 +233,23 @@ export class PushCoalescer {
|
|
|
216
233
|
isRendering(serverId) {
|
|
217
234
|
return (this.rendersInFlight.get(serverId) ?? 0) > 0;
|
|
218
235
|
}
|
|
236
|
+
/** The host's delivery, noting one that carries `firstView` for the
|
|
237
|
+
* receipt of the admission it belongs to (deliveredFirstView). */
|
|
238
|
+
deliver(...args) {
|
|
239
|
+
if (args[0].firstView)
|
|
240
|
+
this.deliveredFirstView = true;
|
|
241
|
+
return this.host.deliver(...args);
|
|
242
|
+
}
|
|
219
243
|
receipt(serverId, binding, eventId) {
|
|
220
244
|
const entry = this.receiptEntry(coalescingReceiptKey(serverId, binding, eventId));
|
|
221
245
|
return entry && structuredClone(entry.result);
|
|
222
246
|
}
|
|
247
|
+
/** Whether the admission this receipt records delivered its occurrence as
|
|
248
|
+
* the agent's first view: for the host's own bookkeeping, such as the
|
|
249
|
+
* channel registry's reply anchor, and never part of the wire result. */
|
|
250
|
+
receiptFirstView(serverId, binding, eventId) {
|
|
251
|
+
return this.receiptEntry(coalescingReceiptKey(serverId, binding, eventId))?.firstView === true;
|
|
252
|
+
}
|
|
223
253
|
receiptEntry(key) {
|
|
224
254
|
const entry = this.receipts.get(key);
|
|
225
255
|
if (!entry)
|
|
@@ -276,9 +306,13 @@ export class PushCoalescer {
|
|
|
276
306
|
const born = this.subjects.has(subject) ? undefined : (occurrence.initial && !occurrence.retract ? 'none' : 'unknown');
|
|
277
307
|
const state = this.subjectFor(subject, occurrence);
|
|
278
308
|
const occupantUnread = this.refreshOccupant(state);
|
|
279
|
-
|
|
309
|
+
// A notice leaves an unread render in place (acceptDeferred): neither
|
|
310
|
+
// displaced nor found consumed, it isn't the prior (§3.3).
|
|
311
|
+
const occupantPrior = occurrence.deferred && state.occupant?.rendered ? undefined : state.occupant?.eventId;
|
|
312
|
+
const priorEventId = occupantPrior ?? state.batch?.latest.eventId ?? state.rendering?.batch.latest.eventId ?? state.consumedEventId;
|
|
280
313
|
this.host.audit({ kind: 'received', subject, eventId: occurrence.eventId, retract: occurrence.retract, deferred: occurrence.deferred });
|
|
281
314
|
let outcome;
|
|
315
|
+
this.deliveredFirstView = false;
|
|
282
316
|
if (occurrence.retract) {
|
|
283
317
|
outcome = await this.retract(subject, state, occurrence, occupantUnread);
|
|
284
318
|
}
|
|
@@ -294,10 +328,11 @@ export class PushCoalescer {
|
|
|
294
328
|
state.touchedAt = this.now();
|
|
295
329
|
const result = { accepted: true, coalesce: { outcome, ...(priorEventId ? { priorEventId } : {}) } };
|
|
296
330
|
const receiptKey = coalescingReceiptKey(occurrence.serverId, occurrence.binding, occurrence.eventId);
|
|
297
|
-
const entry = { result: structuredClone(result), at: this.now(), committed: false };
|
|
331
|
+
const entry = { result: structuredClone(result), at: this.now(), committed: false, ...(this.deliveredFirstView ? { firstView: true } : {}) };
|
|
298
332
|
try {
|
|
299
333
|
this.host.recordReceipt?.({
|
|
300
334
|
key: receiptKey, result: entry.result, at: entry.at, subject, ...(born ? { born } : {}),
|
|
335
|
+
...(state.firstViewEnded ? { firstViewEnded: true } : {}),
|
|
301
336
|
batch: state.batch ? structuredClone({ latest: state.batch.latest, notices: state.batch.notices, dropped: state.batch.dropped }) : null,
|
|
302
337
|
});
|
|
303
338
|
}
|
|
@@ -331,17 +366,81 @@ export class PushCoalescer {
|
|
|
331
366
|
}
|
|
332
367
|
return state;
|
|
333
368
|
}
|
|
334
|
-
/**
|
|
369
|
+
/**
|
|
370
|
+
* Re-check the occupant against the host, member by member: a member the
|
|
371
|
+
* host counts as read, or that is gone (isUnread is false either way),
|
|
372
|
+
* becomes history, and the run keeps the members still unread. Returns
|
|
373
|
+
* whether any are.
|
|
374
|
+
*/
|
|
335
375
|
refreshOccupant(state) {
|
|
336
|
-
|
|
376
|
+
const occupant = state.occupant;
|
|
377
|
+
if (!occupant)
|
|
337
378
|
return false;
|
|
338
|
-
|
|
379
|
+
const { before = [], ...newest } = occupant;
|
|
380
|
+
const members = [...before, newest];
|
|
381
|
+
const unread = members.filter((member) => this.host.isUnread(member.placement));
|
|
382
|
+
if (unread.length === members.length)
|
|
339
383
|
return true;
|
|
340
384
|
state.history = 'some';
|
|
341
|
-
state.consumedEventId =
|
|
342
|
-
state.occupant =
|
|
385
|
+
state.consumedEventId = members.filter((member) => !unread.includes(member)).at(-1).eventId;
|
|
386
|
+
state.occupant = runOf(unread);
|
|
387
|
+
return unread.length > 0;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Remove the occupant and the run it builds on, newest first, auditing each
|
|
391
|
+
* as `kind`. Every member is unread: refreshOccupant has just run, under the
|
|
392
|
+
* lock. The host's removal may still refuse one, such as a held write the
|
|
393
|
+
* host can't tell isn't already stored. A member the host
|
|
394
|
+
* can't remove may be read, so the walk stops there, leaving it and the
|
|
395
|
+
* renders it builds on, and the history becomes `unknown`.
|
|
396
|
+
* Returns false then. It doesn't touch `state.occupant`, which still names
|
|
397
|
+
* the members it removed: each caller clears it, so what the walk left is
|
|
398
|
+
* history from then on, as an occupant whose removal failed always was.
|
|
399
|
+
*/
|
|
400
|
+
removeOccupant(subject, state, kind) {
|
|
401
|
+
const occupant = state.occupant;
|
|
402
|
+
for (const member of [occupant, ...[...(occupant.before ?? [])].reverse()]) {
|
|
403
|
+
this.host.audit({ kind, subject, eventId: member.eventId });
|
|
404
|
+
if (!this.host.remove(member.placement)) {
|
|
405
|
+
// Still in context and possibly about to be read.
|
|
406
|
+
this.host.audit({ kind: 'remove-failed', subject, eventId: member.eventId });
|
|
407
|
+
state.history = 'unknown';
|
|
408
|
+
state.consumedEventId = member.eventId;
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* An unread occupant leaves the subject: a notice or a plain occurrence
|
|
416
|
+
* displaces it, or a retraction withdraws it, with any run of renders it
|
|
417
|
+
* carries. Returns whether it was a first view that nothing may have shown
|
|
418
|
+
* (isUnshown), which a replacement carries on: for a run, its oldest render
|
|
419
|
+
* carries the mark, and no render of it may have been shown. Nor may
|
|
420
|
+
* anything of the subject have been read: a member a request has read, or
|
|
421
|
+
* that is gone, leaves the run before this (refreshOccupant), and only the
|
|
422
|
+
* subject's history still says so. Any other occupant may have been seen,
|
|
423
|
+
* and this is the last point where the host can say so, since the removal
|
|
424
|
+
* takes its placements: the subject's first view ends here (endFirstView).
|
|
425
|
+
*/
|
|
426
|
+
occupantLeaves(state, occupant) {
|
|
427
|
+
const { before = [], ...newest } = occupant;
|
|
428
|
+
const members = [...before, newest];
|
|
429
|
+
if (state.history === 'none' && members[0].firstView === true && members.every((member) => this.host.isUnshown(member.placement)))
|
|
430
|
+
return true;
|
|
431
|
+
this.endFirstView(state);
|
|
343
432
|
return false;
|
|
344
433
|
}
|
|
434
|
+
/** The subject's first view ends: for a batch pending or rendering, whose
|
|
435
|
+
* first delivery would come after it, and for every later batch and
|
|
436
|
+
* birth (firstViewEnded). */
|
|
437
|
+
endFirstView(state) {
|
|
438
|
+
state.firstViewEnded = true;
|
|
439
|
+
if (state.batch)
|
|
440
|
+
delete state.batch.firstView;
|
|
441
|
+
if (state.rendering)
|
|
442
|
+
delete state.rendering.batch.firstView;
|
|
443
|
+
}
|
|
345
444
|
scheduleRecovery(subject, state) {
|
|
346
445
|
const prior = this.recovery.get(subject);
|
|
347
446
|
if (prior?.timer)
|
|
@@ -399,12 +498,10 @@ export class PushCoalescer {
|
|
|
399
498
|
}
|
|
400
499
|
async retract(subject, state, occurrence, occupantUnread) {
|
|
401
500
|
if (occupantUnread && state.occupant) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
state.history = 'unknown';
|
|
407
|
-
}
|
|
501
|
+
// Asked of the whole run before the walk takes its placements.
|
|
502
|
+
this.occupantLeaves(state, state.occupant);
|
|
503
|
+
// Whatever the walk leaves may be read, and the history it sets says so (§6).
|
|
504
|
+
this.removeOccupant(subject, state, 'removed');
|
|
408
505
|
}
|
|
409
506
|
state.occupant = undefined;
|
|
410
507
|
this.dropBatches(subject, state);
|
|
@@ -419,7 +516,7 @@ export class PushCoalescer {
|
|
|
419
516
|
// The notice is an ordinary occurrence: it rides the normal delivery path
|
|
420
517
|
// (tags → gate policy → wake) and is consumed like any message — in the
|
|
421
518
|
// context that read a version, never a new one (§3.2).
|
|
422
|
-
const placement = await this.
|
|
519
|
+
const placement = await this.deliver({ ...occurrence, deliverTo: state.audienceAgent });
|
|
423
520
|
if (placement) {
|
|
424
521
|
state.occupant = { eventId: occurrence.eventId, placement };
|
|
425
522
|
state.audienceAgent = placement.agent;
|
|
@@ -427,40 +524,67 @@ export class PushCoalescer {
|
|
|
427
524
|
return 'noted';
|
|
428
525
|
}
|
|
429
526
|
async acceptPlain(subject, state, occurrence, occupantUnread) {
|
|
527
|
+
// A batch this occurrence drops delivered nothing, so when it opened on
|
|
528
|
+
// the agent's first view, this occurrence takes that view.
|
|
529
|
+
const batchFirstView = (state.batch ?? state.rendering?.batch)?.firstView === true;
|
|
430
530
|
const hadBatch = this.dropBatches(subject, state);
|
|
431
531
|
if (occupantUnread && state.occupant) {
|
|
432
532
|
const prior = state.occupant;
|
|
433
|
-
|
|
434
|
-
|
|
533
|
+
// The replacement is the agent's first view only when the run it
|
|
534
|
+
// displaces held one and nothing may have shown any of it to the agent.
|
|
535
|
+
// Otherwise the subject's first view ends here (occupantLeaves).
|
|
536
|
+
const firstView = this.occupantLeaves(state, prior);
|
|
537
|
+
// A plain occurrence is a complete snapshot (rule 6): it displaces the run.
|
|
538
|
+
if (this.removeOccupant(subject, state, 'displaced')) {
|
|
435
539
|
this.host.cancelWake(subject);
|
|
436
540
|
// The replacement follows the prior delivery's audience (§3.2).
|
|
437
|
-
const placement = await this.
|
|
438
|
-
|
|
541
|
+
const placement = await this.deliver({
|
|
542
|
+
...occurrence, deliverTo: prior.placement.agent,
|
|
543
|
+
...(firstView ? { firstView: true } : {}),
|
|
544
|
+
});
|
|
545
|
+
state.occupant = placement ? { eventId: occurrence.eventId, placement, ...(firstView ? { firstView: true } : {}) } : undefined;
|
|
439
546
|
if (placement)
|
|
440
547
|
state.audienceAgent = placement.agent;
|
|
441
548
|
return 'replaced';
|
|
442
549
|
}
|
|
443
|
-
//
|
|
444
|
-
this.host.audit({ kind: 'remove-failed', subject, eventId: prior.eventId });
|
|
445
|
-
state.history = 'unknown';
|
|
446
|
-
state.consumedEventId = prior.eventId;
|
|
550
|
+
// The walk stopped: what it left may be read. Append, as for consumed.
|
|
447
551
|
state.occupant = undefined;
|
|
448
552
|
}
|
|
449
553
|
if (hadBatch)
|
|
450
554
|
this.host.cancelWake(subject);
|
|
451
|
-
const
|
|
452
|
-
|
|
555
|
+
const outcome = hadBatch ? 'replaced' : state.consumedEventId || state.history !== 'none' ? 'appended' : 'first';
|
|
556
|
+
// The subject's `initial` birth is the agent's first view of it unless
|
|
557
|
+
// that view has ended, and so is an occurrence that takes a first-view
|
|
558
|
+
// batch's place (a batch's own first view ends with the subject's).
|
|
559
|
+
const firstView = hadBatch ? batchFirstView && state.history === 'none' : outcome === 'first' && !state.firstViewEnded;
|
|
560
|
+
const placement = await this.deliver(hadBatch && firstView ? { ...occurrence, firstView: true } : occurrence);
|
|
561
|
+
state.occupant = placement ? { eventId: occurrence.eventId, placement, ...(firstView ? { firstView: true } : {}) } : undefined;
|
|
453
562
|
if (placement)
|
|
454
563
|
state.audienceAgent = placement.agent;
|
|
455
|
-
|
|
456
|
-
return 'replaced';
|
|
457
|
-
return state.consumedEventId || state.history !== 'none' ? 'appended' : 'first';
|
|
564
|
+
return outcome;
|
|
458
565
|
}
|
|
459
566
|
async acceptDeferred(subject, state, occurrence, occupantUnread) {
|
|
460
567
|
let outcome = 'first';
|
|
461
|
-
|
|
568
|
+
// Whether a batch this notice opens is the agent's first view of the
|
|
569
|
+
// subject: nothing of it read, its first view not ended, no run of
|
|
570
|
+
// renders placed (the run holds the first view, and the batch's render
|
|
571
|
+
// joins it), and a first-view occupant this notice displaces that nothing
|
|
572
|
+
// has shown (occupantLeaves, which otherwise ends the first view for the
|
|
573
|
+
// batches already open too). A render still under way is weighed when a
|
|
574
|
+
// batch's first delivery is.
|
|
575
|
+
let firstView = state.history === 'none' && !state.firstViewEnded;
|
|
576
|
+
if (occupantUnread && state.occupant?.rendered) {
|
|
577
|
+
// An unread render is a delta the next render builds on (§5.2), not a
|
|
578
|
+
// plain occurrence: it stays, and the batch follows its agent (§3.2), so
|
|
579
|
+
// the next render reaches the context that holds it (§3.3, vector 49).
|
|
580
|
+
occurrence = { ...occurrence, deliverTo: state.occupant.placement.agent };
|
|
581
|
+
firstView = false;
|
|
582
|
+
}
|
|
583
|
+
else if (occupantUnread && state.occupant) {
|
|
462
584
|
// §5.1: a notice displaces an unread plain occurrence and opens a batch
|
|
463
585
|
// — in the audience that held the plain occurrence (§3.2).
|
|
586
|
+
if (!this.occupantLeaves(state, state.occupant))
|
|
587
|
+
firstView = false;
|
|
464
588
|
this.host.audit({ kind: 'displaced', subject, eventId: state.occupant.eventId });
|
|
465
589
|
if (this.host.remove(state.occupant.placement)) {
|
|
466
590
|
outcome = 'replaced';
|
|
@@ -469,6 +593,7 @@ export class PushCoalescer {
|
|
|
469
593
|
else {
|
|
470
594
|
this.host.audit({ kind: 'remove-failed', subject, eventId: state.occupant.eventId });
|
|
471
595
|
state.history = 'unknown';
|
|
596
|
+
firstView = false;
|
|
472
597
|
}
|
|
473
598
|
this.host.cancelWake(subject);
|
|
474
599
|
state.occupant = undefined;
|
|
@@ -489,7 +614,7 @@ export class PushCoalescer {
|
|
|
489
614
|
}
|
|
490
615
|
else {
|
|
491
616
|
// Rule 1: a notice during a render opens a NEW batch ("first").
|
|
492
|
-
state.batch = { latest: occurrence, notices: [notice], dropped: 0 };
|
|
617
|
+
state.batch = { latest: occurrence, notices: [notice], dropped: 0, ...(firstView ? { firstView: true } : {}) };
|
|
493
618
|
}
|
|
494
619
|
await this.host.wakeForBatch(occurrence);
|
|
495
620
|
return outcome;
|
|
@@ -702,21 +827,49 @@ export class PushCoalescer {
|
|
|
702
827
|
this.host.audit({ kind: 'rendered', subject, eventId: occurrence.eventId, source, empty });
|
|
703
828
|
if (empty)
|
|
704
829
|
return; // §5.2: nothing happened (blank text included)
|
|
705
|
-
|
|
830
|
+
// A render describes what changed since the server's previous render
|
|
831
|
+
// (§5.2), so the renders before it stay where they are, and this one
|
|
832
|
+
// joins their run after them (§3.3, vector 49). Any a request has
|
|
833
|
+
// read by then, refreshOccupant drops at its next look. The batch's
|
|
834
|
+
// first delivery is the agent's first view while nothing of the
|
|
835
|
+
// subject has been read and no other version of it is placed, so only
|
|
836
|
+
// a run's oldest render can be one.
|
|
837
|
+
const run = state.occupant?.rendered ? state.occupant : undefined;
|
|
838
|
+
const firstView = batch.firstView === true && state.history === 'none' && !state.occupant;
|
|
839
|
+
const placement = await this.deliver({ ...occurrence, timestamp, content, ...(firstView ? { firstView: true } : {}) }, content, assemblingFor);
|
|
706
840
|
if (placement?.deferredId) {
|
|
707
|
-
// Landed in another agent's
|
|
708
|
-
//
|
|
709
|
-
//
|
|
710
|
-
//
|
|
711
|
-
//
|
|
712
|
-
//
|
|
713
|
-
// has
|
|
714
|
-
|
|
841
|
+
// Landed in a deferred queue: another agent's, whose turn is alive,
|
|
842
|
+
// or the assembling agent's own, behind a write held there (the
|
|
843
|
+
// host's bypassDeferralFor), or after its assembly ended, as any
|
|
844
|
+
// write during its turn. Still unread
|
|
845
|
+
// there, so it stays replaceable and withdrawable. The turn being
|
|
846
|
+
// assembled doesn't read it, so it isn't materialized for that turn,
|
|
847
|
+
// and no request has consumed it. The freeze withdrew the queue's
|
|
848
|
+
// agent's wake for this batch; give it an ordinary wake, as any
|
|
849
|
+
// delivery during its turn has, beside any wakes a newer batch has,
|
|
850
|
+
// so that its next turn reads the content (the wake starts no turn
|
|
851
|
+
// once the agent has read it, or it's removed).
|
|
852
|
+
// The run's renders keep their own records, whatever else an
|
|
853
|
+
// occupant carries, a first view's mark included.
|
|
854
|
+
let before;
|
|
855
|
+
if (run) {
|
|
856
|
+
const { before: earlier, ...member } = run;
|
|
857
|
+
before = [...(earlier ?? []), member];
|
|
858
|
+
}
|
|
859
|
+
state.occupant = { eventId: occurrence.eventId, placement, rendered: true, ...(firstView ? { firstView: true } : {}), ...(before ? { before } : {}) };
|
|
860
|
+
// A batch opened while this render was under way (§5.4 rule 1)
|
|
861
|
+
// follows the run's agent from here, wakes included, as a later
|
|
862
|
+
// notice's does (acceptDeferred), so the run stays in one context.
|
|
863
|
+
if (state.batch && !state.batch.latest.deliverTo) {
|
|
864
|
+
state.batch.latest = { ...state.batch.latest, deliverTo: placement.agent };
|
|
865
|
+
await this.host.wakeForBatch(state.batch.latest);
|
|
866
|
+
}
|
|
715
867
|
state.audienceAgent = placement.agent;
|
|
716
|
-
await this.host.wakeToRead(occurrence, placement.agent);
|
|
868
|
+
await this.host.wakeToRead(occurrence, placement.agent, placement.deferredId);
|
|
717
869
|
return;
|
|
718
870
|
}
|
|
719
|
-
// The materialized occurrence is consumed by the request being
|
|
871
|
+
// The materialized occurrence is consumed by the request being
|
|
872
|
+
// assembled, and becomes history with the run placed ahead of it.
|
|
720
873
|
rendering.materialized = true;
|
|
721
874
|
state.history = 'some';
|
|
722
875
|
state.consumedEventId = occurrence.eventId;
|
|
@@ -749,13 +902,17 @@ export class PushCoalescer {
|
|
|
749
902
|
consumedEventId: s.occupant?.eventId ?? s.consumedEventId,
|
|
750
903
|
identity: s.identity,
|
|
751
904
|
audienceAgent: s.audienceAgent ?? s.occupant?.placement.agent,
|
|
905
|
+
...(s.firstViewEnded ? { firstViewEnded: true } : {}),
|
|
752
906
|
touchedAt: now,
|
|
753
907
|
};
|
|
754
908
|
if (s.batch) {
|
|
755
909
|
// An interrupted render is not replayed (§3.2): a batch that was
|
|
756
910
|
// RENDERING keeps its fallback; a batch that was only pending renders
|
|
757
911
|
// normally at the next assembly.
|
|
758
|
-
state.batch = {
|
|
912
|
+
state.batch = {
|
|
913
|
+
latest: s.batch.latest, notices: s.batch.notices, dropped: s.batch.dropped,
|
|
914
|
+
...(s.batch.rendering ? { noRender: true } : s.batch.firstView ? { firstView: true } : {}),
|
|
915
|
+
};
|
|
759
916
|
}
|
|
760
917
|
this.subjects.set(s.subject, state);
|
|
761
918
|
}
|
|
@@ -785,11 +942,28 @@ export class PushCoalescer {
|
|
|
785
942
|
restoreReceipts(records) {
|
|
786
943
|
const now = this.now();
|
|
787
944
|
for (const r of records) {
|
|
788
|
-
|
|
945
|
+
const fresh = now - r.at <= this.retryWindowMs;
|
|
946
|
+
if (fresh) {
|
|
947
|
+
this.receipts.set(r.key, { result: r.result, at: r.at, committed: true });
|
|
948
|
+
if (r.born && !this.subjects.has(r.subject))
|
|
949
|
+
this.subjects.set(r.subject, { history: r.born, touchedAt: now });
|
|
950
|
+
}
|
|
951
|
+
// A first view's end is a fact about the subject, which holds while the
|
|
952
|
+
// coalescer keeps it, not about the receipt, whose retry window says
|
|
953
|
+
// nothing about it. So a record that carries it ends the subject's
|
|
954
|
+
// first view whatever its age, for a batch the snapshot brought back
|
|
955
|
+
// too. A subject this restore doesn't hold yet existed when the record
|
|
956
|
+
// was written and may have been shown, so it comes back with that end
|
|
957
|
+
// and an unknown history.
|
|
958
|
+
if (r.firstViewEnded) {
|
|
959
|
+
const ended = this.subjects.get(r.subject);
|
|
960
|
+
if (ended)
|
|
961
|
+
this.endFirstView(ended);
|
|
962
|
+
else
|
|
963
|
+
this.subjects.set(r.subject, { history: 'unknown', touchedAt: now, firstViewEnded: true });
|
|
964
|
+
}
|
|
965
|
+
if (!fresh)
|
|
789
966
|
continue;
|
|
790
|
-
this.receipts.set(r.key, { result: r.result, at: r.at, committed: true });
|
|
791
|
-
if (r.born && !this.subjects.has(r.subject))
|
|
792
|
-
this.subjects.set(r.subject, { history: r.born, touchedAt: now });
|
|
793
967
|
// A birth fact is not proof the subject is still unread: the plain
|
|
794
968
|
// occurrence this record acknowledged is in context (durable before the
|
|
795
969
|
// record) and counts as read from recovery on, like a snapshot occupant.
|
|
@@ -822,12 +996,15 @@ export class PushCoalescer {
|
|
|
822
996
|
snapshot() {
|
|
823
997
|
return {
|
|
824
998
|
version: 1,
|
|
825
|
-
receipts: [...this.receipts],
|
|
999
|
+
receipts: [...this.receipts].map(([key, { result, at }]) => [key, { result, at }]),
|
|
826
1000
|
subjects: [...this.subjects].map(([subject, s]) => ({
|
|
827
1001
|
subject, history: s.history, consumedEventId: s.consumedEventId, identity: s.identity,
|
|
828
1002
|
...(s.audienceAgent ? { audienceAgent: s.audienceAgent } : {}),
|
|
829
|
-
...(s.
|
|
830
|
-
|
|
1003
|
+
...(s.firstViewEnded ? { firstViewEnded: true } : {}),
|
|
1004
|
+
// restore() reads only these. After a restart nothing of the subject
|
|
1005
|
+
// is tracked as unread, a run included: its history counts as read.
|
|
1006
|
+
...(s.occupant ? { occupant: { eventId: s.occupant.eventId, placement: s.occupant.placement } } : {}),
|
|
1007
|
+
...(s.batch ? { batch: { latest: s.batch.latest, notices: s.batch.notices, dropped: s.batch.dropped, ...(s.batch.noRender ? { rendering: true } : s.batch.firstView ? { firstView: true } : {}) } }
|
|
831
1008
|
: s.rendering ? { batch: { latest: s.rendering.batch.latest, notices: s.rendering.batch.notices, dropped: s.rendering.batch.dropped, rendering: true } }
|
|
832
1009
|
: {}),
|
|
833
1010
|
})),
|