@animalabs/agent-framework 0.22.1 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/src/agent.d.ts +266 -28
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +539 -104
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/mcp-server-core.d.ts +41 -0
- package/dist/src/api/mcp-server-core.d.ts.map +1 -0
- package/dist/src/api/mcp-server-core.js +593 -0
- package/dist/src/api/mcp-server-core.js.map +1 -0
- package/dist/src/api/mcp-server.d.ts +2 -36
- package/dist/src/api/mcp-server.d.ts.map +1 -1
- package/dist/src/api/mcp-server.js +15 -595
- package/dist/src/api/mcp-server.js.map +1 -1
- package/dist/src/api/server.d.ts +9 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +55 -27
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/api/types.d.ts +10 -2
- package/dist/src/api/types.d.ts.map +1 -1
- package/dist/src/branch-names.d.ts +14 -0
- package/dist/src/branch-names.d.ts.map +1 -0
- package/dist/src/branch-names.js +22 -0
- package/dist/src/branch-names.js.map +1 -0
- package/dist/src/closest-names.d.ts +28 -0
- package/dist/src/closest-names.d.ts.map +1 -0
- package/dist/src/closest-names.js +98 -0
- package/dist/src/closest-names.js.map +1 -0
- package/dist/src/code-execution/py-runner.d.ts +16 -5
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +186 -74
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +49 -3
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/code-execution/tool-definition.d.ts +12 -1
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +21 -3
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/config-checks.d.ts +28 -0
- package/dist/src/config-checks.d.ts.map +1 -0
- package/dist/src/config-checks.js +52 -0
- package/dist/src/config-checks.js.map +1 -0
- package/dist/src/deadline-timer.d.ts +21 -0
- package/dist/src/deadline-timer.d.ts.map +1 -0
- package/dist/src/deadline-timer.js +43 -0
- package/dist/src/deadline-timer.js.map +1 -0
- package/dist/src/error-message.d.ts +30 -0
- package/dist/src/error-message.d.ts.map +1 -0
- package/dist/src/error-message.js +50 -0
- package/dist/src/error-message.js.map +1 -0
- package/dist/src/framework.d.ts +1212 -192
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +6686 -1835
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +8 -0
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +27 -3
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/gate/gate-script.d.ts.map +1 -1
- package/dist/src/gate/gate-script.js.map +1 -1
- package/dist/src/index.d.ts +5 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +170 -13
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +499 -258
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts +21 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.js +91 -30
- package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +19 -3
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +23 -8
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts +20 -0
- package/dist/src/mcpl/convert-block.d.ts.map +1 -0
- package/dist/src/mcpl/convert-block.js +89 -0
- package/dist/src/mcpl/convert-block.js.map +1 -0
- package/dist/src/mcpl/errors.d.ts +13 -0
- package/dist/src/mcpl/errors.d.ts.map +1 -1
- package/dist/src/mcpl/errors.js +28 -0
- package/dist/src/mcpl/errors.js.map +1 -1
- package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
- package/dist/src/mcpl/feature-set-manager.js +4 -3
- package/dist/src/mcpl/feature-set-manager.js.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts +23 -0
- package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.js +83 -72
- package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +114 -0
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -0
- package/dist/src/mcpl/inbound-source.js +83 -0
- package/dist/src/mcpl/inbound-source.js.map +1 -0
- package/dist/src/mcpl/index.d.ts +3 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +3 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +15 -11
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +153 -84
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +54 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -0
- package/dist/src/mcpl/log-value.js +109 -0
- package/dist/src/mcpl/log-value.js.map +1 -0
- package/dist/src/mcpl/prose-stream-router.d.ts +6 -6
- package/dist/src/mcpl/prose-stream-router.d.ts.map +1 -1
- package/dist/src/mcpl/prose-stream-router.js +4 -4
- package/dist/src/mcpl/prose-stream-router.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +64 -7
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +121 -24
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +38 -8
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +77 -78
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +14 -2
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +72 -30
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +49 -14
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +74 -21
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/refusal-lines.d.ts +37 -0
- package/dist/src/mcpl/refusal-lines.d.ts.map +1 -0
- package/dist/src/mcpl/refusal-lines.js +61 -0
- package/dist/src/mcpl/refusal-lines.js.map +1 -0
- package/dist/src/mcpl/scope-manager.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +107 -12
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +470 -139
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts +10 -1
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +14 -3
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/skip-reply-wake.d.ts +36 -0
- package/dist/src/mcpl/skip-reply-wake.d.ts.map +1 -0
- package/dist/src/mcpl/skip-reply-wake.js +55 -0
- package/dist/src/mcpl/skip-reply-wake.js.map +1 -0
- package/dist/src/mcpl/tool-classes.d.ts +1 -1
- package/dist/src/mcpl/tool-classes.d.ts.map +1 -1
- package/dist/src/mcpl/tool-classes.js +3 -2
- package/dist/src/mcpl/tool-classes.js.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
- package/dist/src/mcpl/transport.d.ts +74 -7
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +209 -22
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +43 -28
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +15 -0
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +25 -0
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +19 -1
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +54 -25
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/api/index.d.ts.map +1 -1
- package/dist/src/modules/api/index.js +1 -1
- package/dist/src/modules/api/index.js.map +1 -1
- package/dist/src/modules/discord/discord-js-client.d.ts +1 -0
- package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.js +25 -9
- package/dist/src/modules/discord/discord-js-client.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +29 -3
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +383 -145
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/discord/types.d.ts +14 -1
- package/dist/src/modules/discord/types.d.ts.map +1 -1
- package/dist/src/modules/health/index.d.ts.map +1 -1
- package/dist/src/modules/health/index.js +2 -1
- package/dist/src/modules/health/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +3 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +359 -127
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +28 -1
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +177 -32
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/unknown-tool.d.ts +10 -0
- package/dist/src/modules/unknown-tool.d.ts.map +1 -0
- package/dist/src/modules/unknown-tool.js +17 -0
- package/dist/src/modules/unknown-tool.js.map +1 -0
- package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
- package/dist/src/modules/workspace/branch-intent.js.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.d.ts +54 -6
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +93 -27
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +64 -6
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +291 -44
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +127 -27
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +821 -248
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +117 -15
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +436 -51
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts +75 -8
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +576 -68
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +42 -3
- 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 +7 -2
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js +28 -4
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/operator-log.d.ts.map +1 -1
- package/dist/src/operator-log.js.map +1 -1
- package/dist/src/prose-drafts.d.ts +240 -0
- package/dist/src/prose-drafts.d.ts.map +1 -0
- package/dist/src/prose-drafts.js +362 -0
- package/dist/src/prose-drafts.js.map +1 -0
- package/dist/src/prose-segments.d.ts +21 -2
- package/dist/src/prose-segments.d.ts.map +1 -1
- package/dist/src/prose-segments.js +46 -9
- package/dist/src/prose-segments.js.map +1 -1
- package/dist/src/provider-waits.d.ts.map +1 -1
- package/dist/src/provider-waits.js.map +1 -1
- package/dist/src/queue.d.ts.map +1 -1
- package/dist/src/record-journal.d.ts.map +1 -1
- package/dist/src/record-journal.js.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.d.ts.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.js.map +1 -1
- package/dist/src/recovery/offline-branch.d.ts +1 -0
- package/dist/src/recovery/offline-branch.d.ts.map +1 -1
- package/dist/src/recovery/offline-branch.js +32 -25
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/recovery/recover-cli.js.map +1 -1
- package/dist/src/runtime/liveness-watchdog.d.ts.map +1 -1
- package/dist/src/runtime/liveness-watchdog.js.map +1 -1
- package/dist/src/safe-slice.d.ts +5 -1
- package/dist/src/safe-slice.d.ts.map +1 -1
- package/dist/src/safe-slice.js +9 -1
- package/dist/src/safe-slice.js.map +1 -1
- package/dist/src/shutdown.d.ts.map +1 -1
- package/dist/src/shutdown.js.map +1 -1
- package/dist/src/stored-removal.d.ts +73 -0
- package/dist/src/stored-removal.d.ts.map +1 -0
- package/dist/src/stored-removal.js +100 -0
- package/dist/src/stored-removal.js.map +1 -0
- package/dist/src/thinking-token-stamp.js.map +1 -1
- package/dist/src/tool-image-ledger.d.ts +87 -19
- package/dist/src/tool-image-ledger.d.ts.map +1 -1
- package/dist/src/tool-image-ledger.js +135 -32
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-presentation.d.ts +9 -0
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +257 -60
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +7 -10
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +32 -3
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +106 -19
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +25 -1
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +260 -65
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/tune-out/tools.d.ts +1 -1
- package/dist/src/tune-out/tools.d.ts.map +1 -1
- package/dist/src/types/agent.d.ts +59 -11
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +17 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +31 -5
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/inference-log.d.ts +1 -1
- package/dist/src/types/inference-log.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +30 -7
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +151 -11
- package/dist/src/types/trace.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.d.ts +5 -0
- package/dist/src/usage/usage-tracker.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.js +35 -8
- package/dist/src/usage/usage-tracker.js.map +1 -1
- package/package.json +10 -9
- package/src/agent.ts +572 -105
- package/src/api/mcp-server-core.ts +681 -0
- package/src/api/mcp-server.ts +16 -685
- package/src/api/server.ts +55 -30
- package/src/api/types.ts +10 -2
- package/src/branch-names.ts +19 -0
- package/src/closest-names.ts +94 -0
- package/src/code-execution/py-runner.ts +200 -76
- package/src/code-execution/runtime-py.ts +49 -3
- package/src/code-execution/tool-definition.ts +28 -4
- package/src/config-checks.ts +48 -0
- package/src/deadline-timer.ts +44 -0
- package/src/error-message.ts +48 -0
- package/src/framework.ts +7158 -1936
- package/src/gate/event-gate.ts +28 -3
- package/src/index.ts +12 -3
- package/src/mcpl/channel-registry.ts +615 -289
- package/src/mcpl/checkpoint-manager.ts +104 -29
- package/src/mcpl/conversation-router.ts +28 -8
- package/src/mcpl/convert-block.ts +97 -0
- package/src/mcpl/errors.ts +28 -0
- package/src/mcpl/feature-set-manager.ts +4 -3
- package/src/mcpl/hook-orchestrator.ts +84 -77
- package/src/mcpl/inbound-source.ts +156 -0
- package/src/mcpl/index.ts +10 -1
- package/src/mcpl/inference-router.ts +174 -99
- package/src/mcpl/log-value.ts +116 -0
- package/src/mcpl/prose-stream-router.ts +6 -6
- package/src/mcpl/push-coalescer.ts +124 -24
- package/src/mcpl/push-handler.ts +86 -84
- package/src/mcpl/reference-fetcher.ts +71 -26
- package/src/mcpl/references.ts +81 -22
- package/src/mcpl/refusal-lines.ts +59 -0
- package/src/mcpl/server-connection.ts +496 -142
- package/src/mcpl/server-registry.ts +15 -4
- package/src/mcpl/skip-reply-wake.ts +73 -0
- package/src/mcpl/tool-classes.ts +3 -2
- package/src/mcpl/transport.ts +219 -26
- package/src/mcpl/types.ts +18 -3
- package/src/mcpl/visible-content.ts +27 -0
- package/src/module-registry.ts +58 -23
- package/src/modules/api/index.ts +1 -1
- package/src/modules/discord/discord-js-client.ts +26 -10
- package/src/modules/discord/index.ts +395 -160
- package/src/modules/discord/types.ts +15 -2
- package/src/modules/health/index.ts +2 -1
- package/src/modules/history/index.ts +410 -120
- package/src/modules/history/semantic.ts +189 -32
- package/src/modules/unknown-tool.ts +16 -0
- package/src/modules/workspace/disk-agreement.ts +125 -21
- package/src/modules/workspace/effects.ts +279 -35
- package/src/modules/workspace/index.ts +841 -261
- package/src/modules/workspace/observe.ts +456 -56
- package/src/modules/workspace/reconcile.ts +688 -76
- package/src/modules/workspace/types.ts +41 -2
- package/src/modules/workspace/watcher.ts +27 -4
- package/src/prose-drafts.ts +481 -0
- package/src/prose-segments.ts +51 -8
- package/src/recovery/offline-branch.ts +36 -29
- package/src/safe-slice.ts +9 -1
- package/src/stored-removal.ts +126 -0
- package/src/tool-image-ledger.ts +153 -34
- package/src/tool-presentation.ts +224 -40
- package/src/tool-result-guard.ts +7 -8
- package/src/tool-result-history.ts +124 -20
- package/src/tune-out/coordinator.ts +259 -65
- package/src/types/agent.ts +59 -13
- package/src/types/events.ts +17 -0
- package/src/types/framework.ts +31 -5
- package/src/types/inference-log.ts +1 -1
- package/src/types/module.ts +31 -7
- package/src/types/trace.ts +158 -12
- package/src/usage/usage-tracker.ts +32 -8
- package/dist/test/activation-request-sanitize.test.d.ts +0 -2
- package/dist/test/activation-request-sanitize.test.d.ts.map +0 -1
- package/dist/test/activation-request-sanitize.test.js +0 -89
- package/dist/test/activation-request-sanitize.test.js.map +0 -1
- package/dist/test/agent-cache-ttl.test.d.ts +0 -2
- package/dist/test/agent-cache-ttl.test.d.ts.map +0 -1
- package/dist/test/agent-cache-ttl.test.js +0 -41
- package/dist/test/agent-cache-ttl.test.js.map +0 -1
- package/dist/test/agent-runtime-settings.test.d.ts +0 -2
- package/dist/test/agent-runtime-settings.test.d.ts.map +0 -1
- package/dist/test/agent-runtime-settings.test.js +0 -462
- package/dist/test/agent-runtime-settings.test.js.map +0 -1
- package/dist/test/api-admin-gate.test.d.ts +0 -2
- package/dist/test/api-admin-gate.test.d.ts.map +0 -1
- package/dist/test/api-admin-gate.test.js +0 -116
- package/dist/test/api-admin-gate.test.js.map +0 -1
- package/dist/test/assistant-persist-refusal.test.d.ts +0 -2
- package/dist/test/assistant-persist-refusal.test.d.ts.map +0 -1
- package/dist/test/assistant-persist-refusal.test.js +0 -63
- package/dist/test/assistant-persist-refusal.test.js.map +0 -1
- package/dist/test/batched-wake-locus.test.d.ts +0 -2
- package/dist/test/batched-wake-locus.test.d.ts.map +0 -1
- package/dist/test/batched-wake-locus.test.js +0 -166
- package/dist/test/batched-wake-locus.test.js.map +0 -1
- package/dist/test/busy-agent-scheduler.test.d.ts +0 -2
- package/dist/test/busy-agent-scheduler.test.d.ts.map +0 -1
- package/dist/test/busy-agent-scheduler.test.js +0 -92
- package/dist/test/busy-agent-scheduler.test.js.map +0 -1
- package/dist/test/channel-incoming-targeting.test.d.ts +0 -2
- package/dist/test/channel-incoming-targeting.test.d.ts.map +0 -1
- package/dist/test/channel-incoming-targeting.test.js +0 -81
- package/dist/test/channel-incoming-targeting.test.js.map +0 -1
- package/dist/test/channel-label-history.test.d.ts +0 -2
- package/dist/test/channel-label-history.test.d.ts.map +0 -1
- package/dist/test/channel-label-history.test.js +0 -424
- package/dist/test/channel-label-history.test.js.map +0 -1
- package/dist/test/channel-lifecycle-provenance.test.d.ts +0 -2
- package/dist/test/channel-lifecycle-provenance.test.d.ts.map +0 -1
- package/dist/test/channel-lifecycle-provenance.test.js +0 -47
- package/dist/test/channel-lifecycle-provenance.test.js.map +0 -1
- package/dist/test/channel-registry-routing.test.d.ts +0 -2
- package/dist/test/channel-registry-routing.test.d.ts.map +0 -1
- package/dist/test/channel-registry-routing.test.js +0 -446
- package/dist/test/channel-registry-routing.test.js.map +0 -1
- package/dist/test/channel-registry-typing.test.d.ts +0 -2
- package/dist/test/channel-registry-typing.test.d.ts.map +0 -1
- package/dist/test/channel-registry-typing.test.js +0 -91
- package/dist/test/channel-registry-typing.test.js.map +0 -1
- package/dist/test/channels-changed-respond-first.test.d.ts +0 -2
- package/dist/test/channels-changed-respond-first.test.d.ts.map +0 -1
- package/dist/test/channels-changed-respond-first.test.js +0 -74
- package/dist/test/channels-changed-respond-first.test.js.map +0 -1
- package/dist/test/checkpoint-attribution.test.d.ts +0 -2
- package/dist/test/checkpoint-attribution.test.d.ts.map +0 -1
- package/dist/test/checkpoint-attribution.test.js +0 -200
- package/dist/test/checkpoint-attribution.test.js.map +0 -1
- package/dist/test/code-execution.test.d.ts +0 -11
- package/dist/test/code-execution.test.d.ts.map +0 -1
- package/dist/test/code-execution.test.js +0 -1272
- package/dist/test/code-execution.test.js.map +0 -1
- package/dist/test/component-defaults.test.d.ts +0 -2
- package/dist/test/component-defaults.test.d.ts.map +0 -1
- package/dist/test/component-defaults.test.js +0 -54
- package/dist/test/component-defaults.test.js.map +0 -1
- package/dist/test/conversation-fork-injection-scoping.test.d.ts +0 -2
- package/dist/test/conversation-fork-injection-scoping.test.d.ts.map +0 -1
- package/dist/test/conversation-fork-injection-scoping.test.js +0 -200
- package/dist/test/conversation-fork-injection-scoping.test.js.map +0 -1
- package/dist/test/conversation-router.test.d.ts +0 -2
- package/dist/test/conversation-router.test.d.ts.map +0 -1
- package/dist/test/conversation-router.test.js +0 -174
- package/dist/test/conversation-router.test.js.map +0 -1
- package/dist/test/conversation-routing.test.d.ts +0 -7
- package/dist/test/conversation-routing.test.d.ts.map +0 -1
- package/dist/test/conversation-routing.test.js +0 -387
- package/dist/test/conversation-routing.test.js.map +0 -1
- package/dist/test/deferred-wake-integrity.test.d.ts +0 -29
- package/dist/test/deferred-wake-integrity.test.d.ts.map +0 -1
- package/dist/test/deferred-wake-integrity.test.js +0 -320
- package/dist/test/deferred-wake-integrity.test.js.map +0 -1
- package/dist/test/discord-awareness-outbox.test.d.ts +0 -2
- package/dist/test/discord-awareness-outbox.test.d.ts.map +0 -1
- package/dist/test/discord-awareness-outbox.test.js +0 -267
- package/dist/test/discord-awareness-outbox.test.js.map +0 -1
- package/dist/test/discord-history-delete-window.test.d.ts +0 -2
- package/dist/test/discord-history-delete-window.test.d.ts.map +0 -1
- package/dist/test/discord-history-delete-window.test.js +0 -81
- package/dist/test/discord-history-delete-window.test.js.map +0 -1
- package/dist/test/discord-history-sync.test.d.ts +0 -2
- package/dist/test/discord-history-sync.test.d.ts.map +0 -1
- package/dist/test/discord-history-sync.test.js +0 -56
- package/dist/test/discord-history-sync.test.js.map +0 -1
- package/dist/test/ephemeral-settle.test.d.ts +0 -2
- package/dist/test/ephemeral-settle.test.d.ts.map +0 -1
- package/dist/test/ephemeral-settle.test.js +0 -354
- package/dist/test/ephemeral-settle.test.js.map +0 -1
- package/dist/test/event-gate-passthrough.test.d.ts +0 -15
- package/dist/test/event-gate-passthrough.test.d.ts.map +0 -1
- package/dist/test/event-gate-passthrough.test.js +0 -289
- package/dist/test/event-gate-passthrough.test.js.map +0 -1
- package/dist/test/event-gate-policy-mutation.test.d.ts +0 -2
- package/dist/test/event-gate-policy-mutation.test.d.ts.map +0 -1
- package/dist/test/event-gate-policy-mutation.test.js +0 -137
- package/dist/test/event-gate-policy-mutation.test.js.map +0 -1
- package/dist/test/event-gate-rate-limit.test.d.ts +0 -2
- package/dist/test/event-gate-rate-limit.test.d.ts.map +0 -1
- package/dist/test/event-gate-rate-limit.test.js +0 -627
- package/dist/test/event-gate-rate-limit.test.js.map +0 -1
- package/dist/test/event-gate-script.test.d.ts +0 -2
- package/dist/test/event-gate-script.test.d.ts.map +0 -1
- package/dist/test/event-gate-script.test.js +0 -95
- package/dist/test/event-gate-script.test.js.map +0 -1
- package/dist/test/event-gate-selfwake.test.d.ts +0 -15
- package/dist/test/event-gate-selfwake.test.d.ts.map +0 -1
- package/dist/test/event-gate-selfwake.test.js +0 -125
- package/dist/test/event-gate-selfwake.test.js.map +0 -1
- package/dist/test/event-gate-tags.test.d.ts +0 -2
- package/dist/test/event-gate-tags.test.d.ts.map +0 -1
- package/dist/test/event-gate-tags.test.js +0 -76
- package/dist/test/event-gate-tags.test.js.map +0 -1
- package/dist/test/event-gate.test.d.ts +0 -2
- package/dist/test/event-gate.test.d.ts.map +0 -1
- package/dist/test/event-gate.test.js +0 -919
- package/dist/test/event-gate.test.js.map +0 -1
- package/dist/test/explicit-prose-routing.test.d.ts +0 -11
- package/dist/test/explicit-prose-routing.test.d.ts.map +0 -1
- package/dist/test/explicit-prose-routing.test.js +0 -1394
- package/dist/test/explicit-prose-routing.test.js.map +0 -1
- package/dist/test/framework.test.d.ts +0 -5
- package/dist/test/framework.test.d.ts.map +0 -1
- package/dist/test/framework.test.js +0 -1048
- package/dist/test/framework.test.js.map +0 -1
- package/dist/test/gather-context-timeout.test.d.ts +0 -2
- package/dist/test/gather-context-timeout.test.d.ts.map +0 -1
- package/dist/test/gather-context-timeout.test.js +0 -120
- package/dist/test/gather-context-timeout.test.js.map +0 -1
- package/dist/test/health-snapshot.test.d.ts +0 -2
- package/dist/test/health-snapshot.test.d.ts.map +0 -1
- package/dist/test/health-snapshot.test.js +0 -74
- package/dist/test/health-snapshot.test.js.map +0 -1
- package/dist/test/helpers/coalescing-fixture.d.ts +0 -72
- package/dist/test/helpers/coalescing-fixture.d.ts.map +0 -1
- package/dist/test/helpers/coalescing-fixture.js +0 -146
- package/dist/test/helpers/coalescing-fixture.js.map +0 -1
- package/dist/test/helpers/coalescing-kill-child.d.ts +0 -2
- package/dist/test/helpers/coalescing-kill-child.d.ts.map +0 -1
- package/dist/test/helpers/coalescing-kill-child.js +0 -24
- package/dist/test/helpers/coalescing-kill-child.js.map +0 -1
- package/dist/test/helpers/mock-membrane.d.ts +0 -53
- package/dist/test/helpers/mock-membrane.d.ts.map +0 -1
- package/dist/test/helpers/mock-membrane.js +0 -168
- package/dist/test/helpers/mock-membrane.js.map +0 -1
- package/dist/test/helpers/pytc-stop-rows.d.ts +0 -11
- package/dist/test/helpers/pytc-stop-rows.d.ts.map +0 -1
- package/dist/test/helpers/pytc-stop-rows.js +0 -143
- package/dist/test/helpers/pytc-stop-rows.js.map +0 -1
- package/dist/test/helpers/quiesce-crash-child.d.ts +0 -2
- package/dist/test/helpers/quiesce-crash-child.d.ts.map +0 -1
- package/dist/test/helpers/quiesce-crash-child.js +0 -156
- package/dist/test/helpers/quiesce-crash-child.js.map +0 -1
- package/dist/test/history-module-overview.test.d.ts +0 -2
- package/dist/test/history-module-overview.test.d.ts.map +0 -1
- package/dist/test/history-module-overview.test.js +0 -711
- package/dist/test/history-module-overview.test.js.map +0 -1
- package/dist/test/history-module-realstore.test.d.ts +0 -2
- package/dist/test/history-module-realstore.test.d.ts.map +0 -1
- package/dist/test/history-module-realstore.test.js +0 -363
- package/dist/test/history-module-realstore.test.js.map +0 -1
- package/dist/test/history-module-semantic.test.d.ts +0 -2
- package/dist/test/history-module-semantic.test.d.ts.map +0 -1
- package/dist/test/history-module-semantic.test.js +0 -213
- package/dist/test/history-module-semantic.test.js.map +0 -1
- package/dist/test/history-module-ux.test.d.ts +0 -2
- package/dist/test/history-module-ux.test.d.ts.map +0 -1
- package/dist/test/history-module-ux.test.js +0 -304
- package/dist/test/history-module-ux.test.js.map +0 -1
- package/dist/test/history-module.test.d.ts +0 -2
- package/dist/test/history-module.test.d.ts.map +0 -1
- package/dist/test/history-module.test.js +0 -619
- package/dist/test/history-module.test.js.map +0 -1
- package/dist/test/history-semantic-review-findings.test.d.ts +0 -2
- package/dist/test/history-semantic-review-findings.test.d.ts.map +0 -1
- package/dist/test/history-semantic-review-findings.test.js +0 -338
- package/dist/test/history-semantic-review-findings.test.js.map +0 -1
- package/dist/test/history-semantic-sync-converges.test.d.ts +0 -2
- package/dist/test/history-semantic-sync-converges.test.d.ts.map +0 -1
- package/dist/test/history-semantic-sync-converges.test.js +0 -109
- package/dist/test/history-semantic-sync-converges.test.js.map +0 -1
- package/dist/test/host-quiesce.test.d.ts +0 -2
- package/dist/test/host-quiesce.test.d.ts.map +0 -1
- package/dist/test/host-quiesce.test.js +0 -863
- package/dist/test/host-quiesce.test.js.map +0 -1
- package/dist/test/inference-exhaustion-rewind.test.d.ts +0 -2
- package/dist/test/inference-exhaustion-rewind.test.d.ts.map +0 -1
- package/dist/test/inference-exhaustion-rewind.test.js +0 -309
- package/dist/test/inference-exhaustion-rewind.test.js.map +0 -1
- package/dist/test/inference-failure-bounds.test.d.ts +0 -2
- package/dist/test/inference-failure-bounds.test.d.ts.map +0 -1
- package/dist/test/inference-failure-bounds.test.js +0 -1201
- package/dist/test/inference-failure-bounds.test.js.map +0 -1
- package/dist/test/inference-failure-observability.test.d.ts +0 -2
- package/dist/test/inference-failure-observability.test.d.ts.map +0 -1
- package/dist/test/inference-failure-observability.test.js +0 -84
- package/dist/test/inference-failure-observability.test.js.map +0 -1
- package/dist/test/journal-tool.test.d.ts +0 -2
- package/dist/test/journal-tool.test.d.ts.map +0 -1
- package/dist/test/journal-tool.test.js +0 -33
- package/dist/test/journal-tool.test.js.map +0 -1
- package/dist/test/kv-unified-open-flight-retry.test.d.ts +0 -2
- package/dist/test/kv-unified-open-flight-retry.test.d.ts.map +0 -1
- package/dist/test/kv-unified-open-flight-retry.test.js +0 -189
- package/dist/test/kv-unified-open-flight-retry.test.js.map +0 -1
- package/dist/test/kv-unified-wiring.test.d.ts +0 -2
- package/dist/test/kv-unified-wiring.test.d.ts.map +0 -1
- package/dist/test/kv-unified-wiring.test.js +0 -95
- package/dist/test/kv-unified-wiring.test.js.map +0 -1
- package/dist/test/late-events-after-stop.test.d.ts +0 -2
- package/dist/test/late-events-after-stop.test.d.ts.map +0 -1
- package/dist/test/late-events-after-stop.test.js +0 -122
- package/dist/test/late-events-after-stop.test.js.map +0 -1
- package/dist/test/liveness-watchdog.test.d.ts +0 -2
- package/dist/test/liveness-watchdog.test.d.ts.map +0 -1
- package/dist/test/liveness-watchdog.test.js +0 -94
- package/dist/test/liveness-watchdog.test.js.map +0 -1
- package/dist/test/machine-close-provenance.test.d.ts +0 -2
- package/dist/test/machine-close-provenance.test.d.ts.map +0 -1
- package/dist/test/machine-close-provenance.test.js +0 -116
- package/dist/test/machine-close-provenance.test.js.map +0 -1
- package/dist/test/maintenance-timer.test.d.ts +0 -2
- package/dist/test/maintenance-timer.test.d.ts.map +0 -1
- package/dist/test/maintenance-timer.test.js +0 -265
- package/dist/test/maintenance-timer.test.js.map +0 -1
- package/dist/test/mcpl-access-provider.test.d.ts +0 -2
- package/dist/test/mcpl-access-provider.test.d.ts.map +0 -1
- package/dist/test/mcpl-access-provider.test.js +0 -20
- package/dist/test/mcpl-access-provider.test.js.map +0 -1
- package/dist/test/mcpl-awareness-barrier.test.d.ts +0 -2
- package/dist/test/mcpl-awareness-barrier.test.d.ts.map +0 -1
- package/dist/test/mcpl-awareness-barrier.test.js +0 -769
- package/dist/test/mcpl-awareness-barrier.test.js.map +0 -1
- package/dist/test/mcpl-capability-grant.test.d.ts +0 -10
- package/dist/test/mcpl-capability-grant.test.d.ts.map +0 -1
- package/dist/test/mcpl-capability-grant.test.js +0 -111
- package/dist/test/mcpl-capability-grant.test.js.map +0 -1
- package/dist/test/mcpl-capability-scoping.test.d.ts +0 -2
- package/dist/test/mcpl-capability-scoping.test.d.ts.map +0 -1
- package/dist/test/mcpl-capability-scoping.test.js +0 -266
- package/dist/test/mcpl-capability-scoping.test.js.map +0 -1
- package/dist/test/mcpl-child-env.test.d.ts +0 -2
- package/dist/test/mcpl-child-env.test.d.ts.map +0 -1
- package/dist/test/mcpl-child-env.test.js +0 -158
- package/dist/test/mcpl-child-env.test.js.map +0 -1
- package/dist/test/mcpl-coalescing.test.d.ts +0 -2
- package/dist/test/mcpl-coalescing.test.d.ts.map +0 -1
- package/dist/test/mcpl-coalescing.test.js +0 -1125
- package/dist/test/mcpl-coalescing.test.js.map +0 -1
- package/dist/test/mcpl-config-diagnostics.test.d.ts +0 -2
- package/dist/test/mcpl-config-diagnostics.test.d.ts.map +0 -1
- package/dist/test/mcpl-config-diagnostics.test.js +0 -452
- package/dist/test/mcpl-config-diagnostics.test.js.map +0 -1
- package/dist/test/mcpl-empty-content.test.d.ts +0 -2
- package/dist/test/mcpl-empty-content.test.d.ts.map +0 -1
- package/dist/test/mcpl-empty-content.test.js +0 -368
- package/dist/test/mcpl-empty-content.test.js.map +0 -1
- package/dist/test/mcpl-gate-roundtrip.test.d.ts +0 -2
- package/dist/test/mcpl-gate-roundtrip.test.d.ts.map +0 -1
- package/dist/test/mcpl-gate-roundtrip.test.js +0 -285
- package/dist/test/mcpl-gate-roundtrip.test.js.map +0 -1
- package/dist/test/mcpl-list-status.test.d.ts +0 -2
- package/dist/test/mcpl-list-status.test.d.ts.map +0 -1
- package/dist/test/mcpl-list-status.test.js +0 -82
- package/dist/test/mcpl-list-status.test.js.map +0 -1
- package/dist/test/mcpl-manifest-changed.test.d.ts +0 -2
- package/dist/test/mcpl-manifest-changed.test.d.ts.map +0 -1
- package/dist/test/mcpl-manifest-changed.test.js +0 -178
- package/dist/test/mcpl-manifest-changed.test.js.map +0 -1
- package/dist/test/mcpl-push-convert.test.d.ts +0 -2
- package/dist/test/mcpl-push-convert.test.d.ts.map +0 -1
- package/dist/test/mcpl-push-convert.test.js +0 -42
- package/dist/test/mcpl-push-convert.test.js.map +0 -1
- package/dist/test/mcpl-reconnect-events.test.d.ts +0 -2
- package/dist/test/mcpl-reconnect-events.test.d.ts.map +0 -1
- package/dist/test/mcpl-reconnect-events.test.js +0 -144
- package/dist/test/mcpl-reconnect-events.test.js.map +0 -1
- package/dist/test/mcpl-reconnect-reregistration.test.d.ts +0 -2
- package/dist/test/mcpl-reconnect-reregistration.test.d.ts.map +0 -1
- package/dist/test/mcpl-reconnect-reregistration.test.js +0 -236
- package/dist/test/mcpl-reconnect-reregistration.test.js.map +0 -1
- package/dist/test/mcpl-reference-fetcher.test.d.ts +0 -2
- package/dist/test/mcpl-reference-fetcher.test.d.ts.map +0 -1
- package/dist/test/mcpl-reference-fetcher.test.js +0 -427
- package/dist/test/mcpl-reference-fetcher.test.js.map +0 -1
- package/dist/test/mcpl-reference-fields.test.d.ts +0 -2
- package/dist/test/mcpl-reference-fields.test.d.ts.map +0 -1
- package/dist/test/mcpl-reference-fields.test.js +0 -149
- package/dist/test/mcpl-reference-fields.test.js.map +0 -1
- package/dist/test/mcpl-request-timeout.test.d.ts +0 -2
- package/dist/test/mcpl-request-timeout.test.d.ts.map +0 -1
- package/dist/test/mcpl-request-timeout.test.js +0 -138
- package/dist/test/mcpl-request-timeout.test.js.map +0 -1
- package/dist/test/mcpl-runtime-lifecycle.test.d.ts +0 -7
- package/dist/test/mcpl-runtime-lifecycle.test.d.ts.map +0 -1
- package/dist/test/mcpl-runtime-lifecycle.test.js +0 -142
- package/dist/test/mcpl-runtime-lifecycle.test.js.map +0 -1
- package/dist/test/mcpl-tool-class-listing.test.d.ts +0 -2
- package/dist/test/mcpl-tool-class-listing.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-class-listing.test.js +0 -147
- package/dist/test/mcpl-tool-class-listing.test.js.map +0 -1
- package/dist/test/mcpl-tool-classes.test.d.ts +0 -7
- package/dist/test/mcpl-tool-classes.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-classes.test.js +0 -80
- package/dist/test/mcpl-tool-classes.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts +0 -2
- package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-e2e.test.js +0 -237
- package/dist/test/mcpl-tool-lifecycle-e2e.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts +0 -11
- package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-emitter.test.js +0 -412
- package/dist/test/mcpl-tool-lifecycle-emitter.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-script.test.d.ts +0 -2
- package/dist/test/mcpl-tool-lifecycle-script.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-script.test.js +0 -288
- package/dist/test/mcpl-tool-lifecycle-script.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle.test.d.ts +0 -11
- package/dist/test/mcpl-tool-lifecycle.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle.test.js +0 -270
- package/dist/test/mcpl-tool-lifecycle.test.js.map +0 -1
- package/dist/test/mcpl-ws-transport.test.d.ts +0 -2
- package/dist/test/mcpl-ws-transport.test.d.ts.map +0 -1
- package/dist/test/mcpl-ws-transport.test.js +0 -258
- package/dist/test/mcpl-ws-transport.test.js.map +0 -1
- package/dist/test/module-context-integration.test.d.ts +0 -18
- package/dist/test/module-context-integration.test.d.ts.map +0 -1
- package/dist/test/module-context-integration.test.js +0 -181
- package/dist/test/module-context-integration.test.js.map +0 -1
- package/dist/test/offline-recovery-branch.test.d.ts +0 -2
- package/dist/test/offline-recovery-branch.test.d.ts.map +0 -1
- package/dist/test/offline-recovery-branch.test.js +0 -226
- package/dist/test/offline-recovery-branch.test.js.map +0 -1
- package/dist/test/operator-surgery.test.d.ts +0 -2
- package/dist/test/operator-surgery.test.d.ts.map +0 -1
- package/dist/test/operator-surgery.test.js +0 -398
- package/dist/test/operator-surgery.test.js.map +0 -1
- package/dist/test/ops-alert.test.d.ts +0 -2
- package/dist/test/ops-alert.test.d.ts.map +0 -1
- package/dist/test/ops-alert.test.js +0 -153
- package/dist/test/ops-alert.test.js.map +0 -1
- package/dist/test/overbudget-drain-breaker.test.d.ts +0 -2
- package/dist/test/overbudget-drain-breaker.test.d.ts.map +0 -1
- package/dist/test/overbudget-drain-breaker.test.js +0 -197
- package/dist/test/overbudget-drain-breaker.test.js.map +0 -1
- package/dist/test/per-agent-delivery.test.d.ts +0 -2
- package/dist/test/per-agent-delivery.test.d.ts.map +0 -1
- package/dist/test/per-agent-delivery.test.js +0 -108
- package/dist/test/per-agent-delivery.test.js.map +0 -1
- package/dist/test/physical-window-restart.test.d.ts +0 -14
- package/dist/test/physical-window-restart.test.d.ts.map +0 -1
- package/dist/test/physical-window-restart.test.js +0 -222
- package/dist/test/physical-window-restart.test.js.map +0 -1
- package/dist/test/placed-reaction-baseline.test.d.ts +0 -2
- package/dist/test/placed-reaction-baseline.test.d.ts.map +0 -1
- package/dist/test/placed-reaction-baseline.test.js +0 -312
- package/dist/test/placed-reaction-baseline.test.js.map +0 -1
- package/dist/test/present-while-acting.test.d.ts +0 -19
- package/dist/test/present-while-acting.test.d.ts.map +0 -1
- package/dist/test/present-while-acting.test.js +0 -706
- package/dist/test/present-while-acting.test.js.map +0 -1
- package/dist/test/prose-segments.test.d.ts +0 -2
- package/dist/test/prose-segments.test.d.ts.map +0 -1
- package/dist/test/prose-segments.test.js +0 -52
- package/dist/test/prose-segments.test.js.map +0 -1
- package/dist/test/prose-stream-router.test.d.ts +0 -2
- package/dist/test/prose-stream-router.test.d.ts.map +0 -1
- package/dist/test/prose-stream-router.test.js +0 -171
- package/dist/test/prose-stream-router.test.js.map +0 -1
- package/dist/test/provider-acceleration-cooldown.test.d.ts +0 -2
- package/dist/test/provider-acceleration-cooldown.test.d.ts.map +0 -1
- package/dist/test/provider-acceleration-cooldown.test.js +0 -435
- package/dist/test/provider-acceleration-cooldown.test.js.map +0 -1
- package/dist/test/provider-waits.test.d.ts +0 -2
- package/dist/test/provider-waits.test.d.ts.map +0 -1
- package/dist/test/provider-waits.test.js +0 -2196
- package/dist/test/provider-waits.test.js.map +0 -1
- package/dist/test/puppet-tool-call.test.d.ts +0 -2
- package/dist/test/puppet-tool-call.test.d.ts.map +0 -1
- package/dist/test/puppet-tool-call.test.js +0 -224
- package/dist/test/puppet-tool-call.test.js.map +0 -1
- package/dist/test/puppet-turn-reservation.test.d.ts +0 -2
- package/dist/test/puppet-turn-reservation.test.d.ts.map +0 -1
- package/dist/test/puppet-turn-reservation.test.js +0 -139
- package/dist/test/puppet-turn-reservation.test.js.map +0 -1
- package/dist/test/reaction-baseline-platform.test.d.ts +0 -2
- package/dist/test/reaction-baseline-platform.test.d.ts.map +0 -1
- package/dist/test/reaction-baseline-platform.test.js +0 -124
- package/dist/test/reaction-baseline-platform.test.js.map +0 -1
- package/dist/test/record-journal.test.d.ts +0 -6
- package/dist/test/record-journal.test.d.ts.map +0 -1
- package/dist/test/record-journal.test.js +0 -269
- package/dist/test/record-journal.test.js.map +0 -1
- package/dist/test/refusal-reaction-baseline.test.d.ts +0 -2
- package/dist/test/refusal-reaction-baseline.test.d.ts.map +0 -1
- package/dist/test/refusal-reaction-baseline.test.js +0 -81
- package/dist/test/refusal-reaction-baseline.test.js.map +0 -1
- package/dist/test/refusal-rewind.test.d.ts +0 -2
- package/dist/test/refusal-rewind.test.d.ts.map +0 -1
- package/dist/test/refusal-rewind.test.js +0 -108
- package/dist/test/refusal-rewind.test.js.map +0 -1
- package/dist/test/refusal-single-call.test.d.ts +0 -2
- package/dist/test/refusal-single-call.test.d.ts.map +0 -1
- package/dist/test/refusal-single-call.test.js +0 -177
- package/dist/test/refusal-single-call.test.js.map +0 -1
- package/dist/test/release-changelog.test.d.ts +0 -2
- package/dist/test/release-changelog.test.d.ts.map +0 -1
- package/dist/test/release-changelog.test.js +0 -159
- package/dist/test/release-changelog.test.js.map +0 -1
- package/dist/test/same-round-think-policy.test.d.ts +0 -2
- package/dist/test/same-round-think-policy.test.d.ts.map +0 -1
- package/dist/test/same-round-think-policy.test.js +0 -853
- package/dist/test/same-round-think-policy.test.js.map +0 -1
- package/dist/test/save-recent-image.test.d.ts +0 -26
- package/dist/test/save-recent-image.test.d.ts.map +0 -1
- package/dist/test/save-recent-image.test.js +0 -974
- package/dist/test/save-recent-image.test.js.map +0 -1
- package/dist/test/shutdown-errors.test.d.ts +0 -2
- package/dist/test/shutdown-errors.test.d.ts.map +0 -1
- package/dist/test/shutdown-errors.test.js +0 -662
- package/dist/test/shutdown-errors.test.js.map +0 -1
- package/dist/test/silent-heartbeat-rows.test.d.ts +0 -2
- package/dist/test/silent-heartbeat-rows.test.d.ts.map +0 -1
- package/dist/test/silent-heartbeat-rows.test.js +0 -451
- package/dist/test/silent-heartbeat-rows.test.js.map +0 -1
- package/dist/test/silent-heartbeat.test.d.ts +0 -2
- package/dist/test/silent-heartbeat.test.d.ts.map +0 -1
- package/dist/test/silent-heartbeat.test.js +0 -165
- package/dist/test/silent-heartbeat.test.js.map +0 -1
- package/dist/test/state-scaling-e2e.test.d.ts +0 -22
- package/dist/test/state-scaling-e2e.test.d.ts.map +0 -1
- package/dist/test/state-scaling-e2e.test.js +0 -206
- package/dist/test/state-scaling-e2e.test.js.map +0 -1
- package/dist/test/state-scaling.test.d.ts +0 -12
- package/dist/test/state-scaling.test.d.ts.map +0 -1
- package/dist/test/state-scaling.test.js +0 -251
- package/dist/test/state-scaling.test.js.map +0 -1
- package/dist/test/stop-with-work-in-flight.test.d.ts +0 -23
- package/dist/test/stop-with-work-in-flight.test.d.ts.map +0 -1
- package/dist/test/stop-with-work-in-flight.test.js +0 -672
- package/dist/test/stop-with-work-in-flight.test.js.map +0 -1
- package/dist/test/surgery-marks-receipt.test.d.ts +0 -2
- package/dist/test/surgery-marks-receipt.test.d.ts.map +0 -1
- package/dist/test/surgery-marks-receipt.test.js +0 -540
- package/dist/test/surgery-marks-receipt.test.js.map +0 -1
- package/dist/test/thinking-token-stamp.test.d.ts +0 -12
- package/dist/test/thinking-token-stamp.test.d.ts.map +0 -1
- package/dist/test/thinking-token-stamp.test.js +0 -129
- package/dist/test/thinking-token-stamp.test.js.map +0 -1
- package/dist/test/timezone.test.d.ts +0 -2
- package/dist/test/timezone.test.d.ts.map +0 -1
- package/dist/test/timezone.test.js +0 -18
- package/dist/test/timezone.test.js.map +0 -1
- package/dist/test/tool-batch-hook.test.d.ts +0 -8
- package/dist/test/tool-batch-hook.test.d.ts.map +0 -1
- package/dist/test/tool-batch-hook.test.js +0 -275
- package/dist/test/tool-batch-hook.test.js.map +0 -1
- package/dist/test/tool-policy.test.d.ts +0 -2
- package/dist/test/tool-policy.test.d.ts.map +0 -1
- package/dist/test/tool-policy.test.js +0 -51
- package/dist/test/tool-policy.test.js.map +0 -1
- package/dist/test/tool-presentation.test.d.ts +0 -2
- package/dist/test/tool-presentation.test.d.ts.map +0 -1
- package/dist/test/tool-presentation.test.js +0 -268
- package/dist/test/tool-presentation.test.js.map +0 -1
- package/dist/test/tool-result-content.test.d.ts +0 -2
- package/dist/test/tool-result-content.test.d.ts.map +0 -1
- package/dist/test/tool-result-content.test.js +0 -37
- package/dist/test/tool-result-content.test.js.map +0 -1
- package/dist/test/tool-result-guard.test.d.ts +0 -2
- package/dist/test/tool-result-guard.test.d.ts.map +0 -1
- package/dist/test/tool-result-guard.test.js +0 -3607
- package/dist/test/tool-result-guard.test.js.map +0 -1
- package/dist/test/tool-result-history.test.d.ts +0 -7
- package/dist/test/tool-result-history.test.d.ts.map +0 -1
- package/dist/test/tool-result-history.test.js +0 -156
- package/dist/test/tool-result-history.test.js.map +0 -1
- package/dist/test/tool-result-spill.test.d.ts +0 -13
- package/dist/test/tool-result-spill.test.d.ts.map +0 -1
- package/dist/test/tool-result-spill.test.js +0 -586
- package/dist/test/tool-result-spill.test.js.map +0 -1
- package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts +0 -2
- package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts.map +0 -1
- package/dist/test/tool-wrapper-prose-guard-integration.test.js +0 -485
- package/dist/test/tool-wrapper-prose-guard-integration.test.js.map +0 -1
- package/dist/test/tool-wrapper-prose-guard.test.d.ts +0 -2
- package/dist/test/tool-wrapper-prose-guard.test.d.ts.map +0 -1
- package/dist/test/tool-wrapper-prose-guard.test.js +0 -34
- package/dist/test/tool-wrapper-prose-guard.test.js.map +0 -1
- package/dist/test/tools-observe-parser-conformance.test.d.ts +0 -2
- package/dist/test/tools-observe-parser-conformance.test.d.ts.map +0 -1
- package/dist/test/tools-observe-parser-conformance.test.js +0 -129
- package/dist/test/tools-observe-parser-conformance.test.js.map +0 -1
- package/dist/test/trunk-channel-routing.test.d.ts +0 -19
- package/dist/test/trunk-channel-routing.test.d.ts.map +0 -1
- package/dist/test/trunk-channel-routing.test.js +0 -329
- package/dist/test/trunk-channel-routing.test.js.map +0 -1
- package/dist/test/tune-out-e2e.test.d.ts +0 -2
- package/dist/test/tune-out-e2e.test.d.ts.map +0 -1
- package/dist/test/tune-out-e2e.test.js +0 -142
- package/dist/test/tune-out-e2e.test.js.map +0 -1
- package/dist/test/tune-out-gate-composition.test.d.ts +0 -2
- package/dist/test/tune-out-gate-composition.test.d.ts.map +0 -1
- package/dist/test/tune-out-gate-composition.test.js +0 -221
- package/dist/test/tune-out-gate-composition.test.js.map +0 -1
- package/dist/test/tune-out-lifecycle.test.d.ts +0 -2
- package/dist/test/tune-out-lifecycle.test.d.ts.map +0 -1
- package/dist/test/tune-out-lifecycle.test.js +0 -121
- package/dist/test/tune-out-lifecycle.test.js.map +0 -1
- package/dist/test/turn-trigger-provenance.test.d.ts +0 -2
- package/dist/test/turn-trigger-provenance.test.d.ts.map +0 -1
- package/dist/test/turn-trigger-provenance.test.js +0 -137
- package/dist/test/turn-trigger-provenance.test.js.map +0 -1
- package/dist/test/unconvertible-tool-result.test.d.ts +0 -2
- package/dist/test/unconvertible-tool-result.test.d.ts.map +0 -1
- package/dist/test/unconvertible-tool-result.test.js +0 -358
- package/dist/test/unconvertible-tool-result.test.js.map +0 -1
- package/dist/test/usage-accounting.test.d.ts +0 -2
- package/dist/test/usage-accounting.test.d.ts.map +0 -1
- package/dist/test/usage-accounting.test.js +0 -13
- package/dist/test/usage-accounting.test.js.map +0 -1
- package/dist/test/usage-tracker.test.d.ts +0 -2
- package/dist/test/usage-tracker.test.d.ts.map +0 -1
- package/dist/test/usage-tracker.test.js +0 -129
- package/dist/test/usage-tracker.test.js.map +0 -1
- package/dist/test/utils-surface.test.d.ts +0 -2
- package/dist/test/utils-surface.test.d.ts.map +0 -1
- package/dist/test/utils-surface.test.js +0 -145
- package/dist/test/utils-surface.test.js.map +0 -1
- package/dist/test/workspace-branch-continuation.test.d.ts +0 -15
- package/dist/test/workspace-branch-continuation.test.d.ts.map +0 -1
- package/dist/test/workspace-branch-continuation.test.js +0 -183
- package/dist/test/workspace-branch-continuation.test.js.map +0 -1
- package/dist/test/workspace-materialize-freshness.test.d.ts +0 -16
- package/dist/test/workspace-materialize-freshness.test.d.ts.map +0 -1
- package/dist/test/workspace-materialize-freshness.test.js +0 -252
- package/dist/test/workspace-materialize-freshness.test.js.map +0 -1
- package/dist/test/workspace-path-containment.test.d.ts +0 -19
- package/dist/test/workspace-path-containment.test.d.ts.map +0 -1
- package/dist/test/workspace-path-containment.test.js +0 -91
- package/dist/test/workspace-path-containment.test.js.map +0 -1
- package/dist/test/workspace-read-file-from-disk.test.d.ts +0 -17
- package/dist/test/workspace-read-file-from-disk.test.d.ts.map +0 -1
- package/dist/test/workspace-read-file-from-disk.test.js +0 -174
- package/dist/test/workspace-read-file-from-disk.test.js.map +0 -1
- package/dist/test/workspace-read-image.test.d.ts +0 -2
- package/dist/test/workspace-read-image.test.d.ts.map +0 -1
- package/dist/test/workspace-read-image.test.js +0 -597
- package/dist/test/workspace-read-image.test.js.map +0 -1
- package/dist/test/workspace-read-text.test.d.ts +0 -2
- package/dist/test/workspace-read-text.test.d.ts.map +0 -1
- package/dist/test/workspace-read-text.test.js +0 -101
- package/dist/test/workspace-read-text.test.js.map +0 -1
- package/dist/test/workspace-restore-order.test.d.ts +0 -16
- package/dist/test/workspace-restore-order.test.d.ts.map +0 -1
- package/dist/test/workspace-restore-order.test.js +0 -140
- package/dist/test/workspace-restore-order.test.js.map +0 -1
- package/dist/test/workspace-three-way.test.d.ts +0 -12
- package/dist/test/workspace-three-way.test.d.ts.map +0 -1
- package/dist/test/workspace-three-way.test.js +0 -3194
- package/dist/test/workspace-three-way.test.js.map +0 -1
- package/dist/test/workspace-watcher.test.d.ts +0 -2
- package/dist/test/workspace-watcher.test.d.ts.map +0 -1
- package/dist/test/workspace-watcher.test.js +0 -281
- package/dist/test/workspace-watcher.test.js.map +0 -1
- package/dist/test/xml-round-persist.test.d.ts +0 -19
- package/dist/test/xml-round-persist.test.d.ts.map +0 -1
- package/dist/test/xml-round-persist.test.js +0 -235
- package/dist/test/xml-round-persist.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -22,7 +22,9 @@ export interface MountConfig {
|
|
|
22
22
|
* - 'on-agent-action': after each completed agent tool batch, the mount is
|
|
23
23
|
* scanned, and the agent's next inference waits for that scan up to
|
|
24
24
|
* `agentActionScanDeadlineMs`; a scan that takes longer finishes while
|
|
25
|
-
* the round goes on
|
|
25
|
+
* the round goes on. Each scan walks from the mount's start, so on a
|
|
26
|
+
* mount over its `walkCap` it covers the first `walkCap` entries every
|
|
27
|
+
* time, and files past them come in as `walkCap` describes
|
|
26
28
|
* - 'never': no background reads; listings and lazy reads still observe
|
|
27
29
|
* the paths they show
|
|
28
30
|
*/
|
|
@@ -36,12 +38,44 @@ export interface MountConfig {
|
|
|
36
38
|
* - Exact name match: ".git", "node_modules"
|
|
37
39
|
* - Directory glob: "node_modules/**" (anything under node_modules)
|
|
38
40
|
* - Extension glob: "*.pyc" (any file ending in .pyc)
|
|
41
|
+
* A sync without a path and the watcher pass over what the list covers,
|
|
42
|
+
* and over entries with an editor's swap or backup file name whatever it
|
|
43
|
+
* says, a directory with what lies beneath it: `.name.swp` and `.name.swx`
|
|
44
|
+
* (the whole name), and names ending in `~` or in `.subl…tmp`, matched by
|
|
45
|
+
* `^\..+\.sw[px]$`, `~$` and `\.subl.*\.tmp$`.
|
|
39
46
|
*/
|
|
40
47
|
ignore?: string[];
|
|
41
48
|
/** Whether to follow symlinks (default: false) */
|
|
42
49
|
followSymlinks?: boolean;
|
|
43
50
|
/** Maximum file size in bytes (default: 5MB) */
|
|
44
51
|
maxFileSize?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The most entries one walk of this mount takes (default: 5000), a
|
|
54
|
+
* positive integer no larger than Number.MAX_SAFE_INTEGER: files, and
|
|
55
|
+
* links or other entries that aren't
|
|
56
|
+
* directories, each of which the pass observes. A sync that reaches it
|
|
57
|
+
* reports the rest as incomplete, and the next sync of the same scope
|
|
58
|
+
* resumes after the last entry it took, wrapping to the start, so repeated
|
|
59
|
+
* syncs cover a larger mount. A watched mount's catch-up scan (at start,
|
|
60
|
+
* and when its watcher reattaches) takes its turn in the same rotation as
|
|
61
|
+
* the mount's bare syncs, so on a mount over the cap, a change made while
|
|
62
|
+
* the process was down waits for the rotation to reach it. The place is
|
|
63
|
+
* kept with the mount's disk evidence, so a restart resumes there, unless
|
|
64
|
+
* the machine went down before the store made the latest place durable.
|
|
65
|
+
* An agent-action scan (`watch: 'on-agent-action'`) and a listing (`ls`,
|
|
66
|
+
* `glob`, `grep`) take up to it from their scope's start every time:
|
|
67
|
+
* `glob`'s is the directory its pattern's segments before the first
|
|
68
|
+
* wildcard name beneath its `path`, and `grep`'s the deeper of its `path`
|
|
69
|
+
* and its `glob` filter's directory, as far as disk lists each segment
|
|
70
|
+
* with that spelling as a directory, not a link. Each directory's listing
|
|
71
|
+
* is read whole, so a deletion is seen wherever the walk lists, whatever
|
|
72
|
+
* it took.
|
|
73
|
+
*
|
|
74
|
+
* It bounds what a walk observes, not the walk's own work: directories
|
|
75
|
+
* don't count against it, and each one the walk visits is read whole, so
|
|
76
|
+
* a tree of many directories that hold nothing is walked in full.
|
|
77
|
+
*/
|
|
78
|
+
walkCap?: number;
|
|
45
79
|
/**
|
|
46
80
|
* If set, filesystem changes on this mount request inference.
|
|
47
81
|
* - `true` — wake on any op (created | modified | deleted)
|
|
@@ -49,6 +83,8 @@ export interface MountConfig {
|
|
|
49
83
|
*
|
|
50
84
|
* Self-writes through the module's own tools are already suppressed by the
|
|
51
85
|
* watcher, so a mount shared between agents only wakes on external writes.
|
|
86
|
+
* A change of a file's mode alone is recorded, and makes no event: it
|
|
87
|
+
* brings nothing new to read.
|
|
52
88
|
* The EventGate still has final say — use gate policies for path-glob
|
|
53
89
|
* filtering or to disable wake temporarily via hot-reload.
|
|
54
90
|
*/
|
|
@@ -111,7 +147,10 @@ export interface MountState {
|
|
|
111
147
|
lastMaterializedSeq: number;
|
|
112
148
|
/** Paths currently suppressed from watcher (recently materialized) */
|
|
113
149
|
suppressedPaths: Set<string>;
|
|
114
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* Whether a pass over the whole mount has run this session. On a mount
|
|
152
|
+
* over its walkCap, that pass took the first walkCap entries.
|
|
153
|
+
*/
|
|
115
154
|
initialSyncDone: boolean;
|
|
116
155
|
/** Branch ID that was active when this mount last materialized */
|
|
117
156
|
lastMaterializedBranchId: string | null;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { watch, type FSWatcher } from 'chokidar';
|
|
9
9
|
import { mkdirSync, statSync } from 'node:fs';
|
|
10
10
|
import { basename, sep } from 'node:path';
|
|
11
|
+
import { passedOverAt } from './observe.js';
|
|
11
12
|
import { type MountConfig } from './types.js';
|
|
12
13
|
|
|
13
14
|
export type FsOp = 'created' | 'modified' | 'deleted';
|
|
@@ -27,7 +28,8 @@ export interface WatcherEvents {
|
|
|
27
28
|
* identical to an empty directory in the recorded state.
|
|
28
29
|
*/
|
|
29
30
|
export interface WatcherLifecycle {
|
|
30
|
-
/** Fires
|
|
31
|
+
/** Fires when chokidar completes its initial scan: once for each attach, so
|
|
32
|
+
* again after a re-attach. */
|
|
31
33
|
onReady?: () => void;
|
|
32
34
|
/** Fires on any chokidar-reported error (ENOENT, EACCES, platform faults). */
|
|
33
35
|
onError?: (err: Error) => void;
|
|
@@ -48,7 +50,8 @@ interface RootIdentity {
|
|
|
48
50
|
export class MountWatcher {
|
|
49
51
|
private watcher: FSWatcher | null = null;
|
|
50
52
|
// Most recent op seen per path within the current debounce window.
|
|
51
|
-
// create -> modify collapses to 'created' (single batch);
|
|
53
|
+
// create -> modify collapses to 'created' (single batch); a trailing delete
|
|
54
|
+
// wins, and delete -> create reads as 'modified' (see mergeOp).
|
|
52
55
|
private pendingChanges = new Map<string, FsOp>();
|
|
53
56
|
private debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
54
57
|
private rootPollTimer: ReturnType<typeof setInterval> | null = null;
|
|
@@ -67,6 +70,8 @@ export class MountWatcher {
|
|
|
67
70
|
config: MountConfig,
|
|
68
71
|
onChange: (changes: FsChange[]) => void,
|
|
69
72
|
lifecycle: WatcherLifecycle = {},
|
|
73
|
+
/** Other mounts' directories nested in this one, mount-relative: passed over as a walk passes over them. */
|
|
74
|
+
private readonly others: readonly string[] = [],
|
|
70
75
|
) {
|
|
71
76
|
this.config = config;
|
|
72
77
|
this.debounceMs = config.watchDebounceMs ?? 300;
|
|
@@ -101,10 +106,28 @@ export class MountWatcher {
|
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
108
|
|
|
104
|
-
const
|
|
109
|
+
const ignore = this.config.ignore ?? [];
|
|
105
110
|
|
|
106
111
|
this.watcher = watch(this.config.path, {
|
|
107
|
-
|
|
112
|
+
// What a walk passes over by design, by the path relative to the mount:
|
|
113
|
+
// another mount's directory, the mount's ignore list and editors' swap
|
|
114
|
+
// and backup files. chokidar 4
|
|
115
|
+
// compares a string given here with the whole absolute path, so the
|
|
116
|
+
// list itself would match nothing.
|
|
117
|
+
ignored: (path: string) => {
|
|
118
|
+
const relative = this.toRelative(path);
|
|
119
|
+
return relative !== null && passedOverAt(relative, ignore, this.others) !== undefined;
|
|
120
|
+
},
|
|
121
|
+
// Its filter for editors' files tested the whole path, so a directory
|
|
122
|
+
// with a dot in its name hid every `*.swp` beneath it, and the walk
|
|
123
|
+
// didn't agree. An editor's save by rename then arrives as an unlink at
|
|
124
|
+
// once, and an add once `awaitWriteFinish` finds the new copy settled.
|
|
125
|
+
// A pass reads disk, not the ops, after the debounce's quiet spell
|
|
126
|
+
// following the last event: a copy on disk by then is taken in as a
|
|
127
|
+
// change, one still being written is read as it stands and taken in
|
|
128
|
+
// again when its add comes, and a re-add after a longer spell is a
|
|
129
|
+
// deletion and then a creation.
|
|
130
|
+
atomic: false,
|
|
108
131
|
persistent: true,
|
|
109
132
|
ignoreInitial: true,
|
|
110
133
|
followSymlinks: this.config.followSymlinks ?? false,
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Held prose drafts: a resident's plain speech that was not sent.
|
|
3
|
+
*
|
|
4
|
+
* Plain speech is held back for reasons that are right in themselves: an
|
|
5
|
+
* explicit send in the same round suppresses the round's prose (so a "sent
|
|
6
|
+
* it" postscript is not posted twice), a turn may have no destination, and a
|
|
7
|
+
* malformed or unresolvable routing prefix bounces. Before drafts, the held words were
|
|
8
|
+
* kept only as a count (or, in explicit mode, as one in-memory latest-wins
|
|
9
|
+
* clipboard): the law was right, and the penalty was amnesia. A draft keeps
|
|
10
|
+
* the exact words until the resident resends or dismisses them, or the
|
|
11
|
+
* retention below lets it go.
|
|
12
|
+
*
|
|
13
|
+
* The boundary is publication and agency, not visibility: a draft is never
|
|
14
|
+
* published except by its resident's explicit resend (or `{{unsent}}`), and
|
|
15
|
+
* only that resident can list or act on it. Its notices go into the
|
|
16
|
+
* resident's own history — which residents that share one message slot
|
|
17
|
+
* (#197) share, as they already share the assistant turn the words came
|
|
18
|
+
* from.
|
|
19
|
+
*
|
|
20
|
+
* Durability is outside the conversation. Drafts live in a RecordJournal of
|
|
21
|
+
* typed Chronicle records, which do not follow branch switches: undo,
|
|
22
|
+
* rollback, suppression and branch moves never touch them. A draft written
|
|
23
|
+
* in a turn that is later undone stays usable (the words were genuinely
|
|
24
|
+
* written and held back), and a delivered draft stays delivered. The
|
|
25
|
+
* notices that name a draft are conversation, so they do follow the branch: a draft counts as
|
|
26
|
+
* named while a message naming it is on the current branch, and one a
|
|
27
|
+
* rollback or branch move has left unnamed is named again.
|
|
28
|
+
*
|
|
29
|
+
* Drafts are kept, not hoarded. Each resident's KEEP_NEWEST newest drafts
|
|
30
|
+
* are always kept; an older one, in any state, is let go at the journal's
|
|
31
|
+
* next checkpoint once nothing has happened to it (held, named, attempted,
|
|
32
|
+
* answered, dismissed) for KEEP_IDLE_MS. The journal checkpoints what it
|
|
33
|
+
* keeps every CHECKPOINT_EVERY entries, so opening it replays only what came
|
|
34
|
+
* after, and a resident whose drafts change rarely keeps its older ones
|
|
35
|
+
* until then. The words stay in the resident's history either way.
|
|
36
|
+
*
|
|
37
|
+
* A delivery attempt is journaled durably BEFORE its request leaves the
|
|
38
|
+
* host, and its outcome after: an attempt with no recorded outcome (a crash
|
|
39
|
+
* mid-send) reads as unknown, never as unsent. A delivered draft carries a
|
|
40
|
+
* historical receipt — confirmed at a time, to a destination, with the
|
|
41
|
+
* connector's message id when it names one — not a claim that the message
|
|
42
|
+
* still exists. A draft is sent only by its resident's explicit resend or
|
|
43
|
+
* an envelope's {{unsent}}; nothing replays at boot or on a branch move.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
import { randomInt } from 'node:crypto';
|
|
47
|
+
import type { JsStore } from '@animalabs/chronicle';
|
|
48
|
+
import { RecordJournal } from './record-journal.js';
|
|
49
|
+
import type { PublishDestination, PublishOutcome } from './mcpl/channel-registry.js';
|
|
50
|
+
|
|
51
|
+
/** Chronicle record type of the drafts journal. */
|
|
52
|
+
export const PROSE_DRAFT_RECORD_TYPE = 'framework/prose-draft';
|
|
53
|
+
|
|
54
|
+
/** Why words were held instead of sent. */
|
|
55
|
+
export type DraftReason =
|
|
56
|
+
/** An explicit send in the same round suppressed the round's plain speech. */
|
|
57
|
+
| 'explicit-send'
|
|
58
|
+
/** The speech had no destination (no route this turn, or a failed envelope). */
|
|
59
|
+
| 'no-destination'
|
|
60
|
+
/** An explicit/hybrid routing prefix was missing, malformed or unresolvable. */
|
|
61
|
+
| 'bounced';
|
|
62
|
+
|
|
63
|
+
export interface DraftAttemptOutcome {
|
|
64
|
+
status: PublishOutcome['status'];
|
|
65
|
+
at: number;
|
|
66
|
+
messageId?: string;
|
|
67
|
+
reason?: string;
|
|
68
|
+
detail?: unknown;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface DraftAttempt {
|
|
72
|
+
attemptId: string;
|
|
73
|
+
at: number;
|
|
74
|
+
destination: PublishDestination;
|
|
75
|
+
/** How the words went out: the drafts tool, or a `{{unsent}}` envelope (explicit or hybrid). */
|
|
76
|
+
via: 'resend' | 'unsent-token';
|
|
77
|
+
/** The resident resent knowing an earlier attempt may have been posted. */
|
|
78
|
+
confirmedDuplicate?: true;
|
|
79
|
+
/** Absent until recorded; an attempt without one reads as unknown. */
|
|
80
|
+
outcome?: DraftAttemptOutcome;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A draft held with words copied from another draft that may already have
|
|
85
|
+
* been posted (`{{unsent}}` re-bounced while that draft was unconfirmed or in
|
|
86
|
+
* flight). The new draft keeps the whole authored text and carries the same
|
|
87
|
+
* duplication risk: it reads `unconfirmed` until a confirmed delivery.
|
|
88
|
+
*/
|
|
89
|
+
export interface InheritedRisk {
|
|
90
|
+
/** The draft whose words were copied in. */
|
|
91
|
+
draftId: string;
|
|
92
|
+
/** The draft whose attempt is the uncertain one, when the copied draft
|
|
93
|
+
* itself carried inherited risk (a chain of re-bounces): the evidence is
|
|
94
|
+
* that original attempt's, never re-invented. */
|
|
95
|
+
sourceDraftId?: string;
|
|
96
|
+
/** That uncertain attempt, when there was one (absent: it was in flight). */
|
|
97
|
+
destination?: PublishDestination;
|
|
98
|
+
at?: number;
|
|
99
|
+
reason: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface Draft {
|
|
103
|
+
id: string;
|
|
104
|
+
agent: string;
|
|
105
|
+
/** The held words, byte for byte as a resend publishes them: a run an
|
|
106
|
+
* explicit send suppressed exactly as written; a bounce or a hold with no
|
|
107
|
+
* destination, its envelope as routing read it (surrounding whitespace
|
|
108
|
+
* trimmed). */
|
|
109
|
+
text: string;
|
|
110
|
+
reason: DraftReason;
|
|
111
|
+
/** Words copied in from a draft that may already have been posted. */
|
|
112
|
+
inheritedRisk?: InheritedRisk;
|
|
113
|
+
/** Short context for the resident: the bounce reason, or the competing conversations. */
|
|
114
|
+
note?: string;
|
|
115
|
+
heldAt: number;
|
|
116
|
+
attempts: DraftAttempt[];
|
|
117
|
+
dismissedAt?: number;
|
|
118
|
+
/** The messages whose notices named this draft, by id. It counts as named
|
|
119
|
+
* while one of them is on the current branch. */
|
|
120
|
+
noticedIn?: string[];
|
|
121
|
+
/** When a notice last named it. */
|
|
122
|
+
noticedAt?: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* - `held`: no inherited risk, and never attempted or every attempt
|
|
127
|
+
* definitely failed — resend freely;
|
|
128
|
+
* - `unconfirmed`: no attempt was confirmed and the draft is not dismissed;
|
|
129
|
+
* either an attempt's outcome is unknown (or was never recorded), or the
|
|
130
|
+
* words carry inherited risk regardless of their own attempts. A resend
|
|
131
|
+
* needs explicit confirmation. A later attempt that fails does not resolve
|
|
132
|
+
* an earlier one that may have landed — the uncertainty stays;
|
|
133
|
+
* - `delivered`: an attempt was confirmed — its receipt is historical;
|
|
134
|
+
* - `dismissed`: the resident set it aside.
|
|
135
|
+
*/
|
|
136
|
+
export type DraftState = 'held' | 'unconfirmed' | 'delivered' | 'dismissed';
|
|
137
|
+
|
|
138
|
+
export function draftState(draft: Draft): DraftState {
|
|
139
|
+
if (draft.attempts.some((a) => a.outcome?.status === 'delivered')) return 'delivered';
|
|
140
|
+
if (draft.dismissedAt !== undefined) return 'dismissed';
|
|
141
|
+
return uncertainAttempt(draft) || draft.inheritedRisk ? 'unconfirmed' : 'held';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** The most recent attempt that may have been posted (unknown or unrecorded
|
|
145
|
+
* outcome), when no attempt was confirmed. */
|
|
146
|
+
export function uncertainAttempt(draft: Draft): DraftAttempt | undefined {
|
|
147
|
+
if (draft.attempts.some((a) => a.outcome?.status === 'delivered')) return undefined;
|
|
148
|
+
for (let i = draft.attempts.length - 1; i >= 0; i--) {
|
|
149
|
+
const attempt = draft.attempts[i]!;
|
|
150
|
+
if (!attempt.outcome || attempt.outcome.status === 'unknown') return attempt;
|
|
151
|
+
}
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
type DraftEntry =
|
|
156
|
+
| { op: 'held'; draft: Omit<Draft, 'attempts' | 'dismissedAt' | 'noticedIn' | 'noticedAt'> }
|
|
157
|
+
| { op: 'attempt'; agent: string; id: string; attemptId: string; at: number; destination: PublishDestination; via: DraftAttempt['via']; confirmedDuplicate?: true }
|
|
158
|
+
| { op: 'outcome'; agent: string; id: string; attemptId: string; outcome: DraftAttemptOutcome }
|
|
159
|
+
| { op: 'dismissed'; agent: string; id: string; at: number }
|
|
160
|
+
/** A notice naming these drafts is in the history as message `messageId`.
|
|
161
|
+
* (A record without one names nowhere the drafts can be found again, so
|
|
162
|
+
* they are named once more.) */
|
|
163
|
+
| { op: 'noticed'; agent: string; ids: string[]; at: number; messageId?: string };
|
|
164
|
+
|
|
165
|
+
/** What a checkpoint keeps: every kept draft, in hold order, and each
|
|
166
|
+
* resident's latest bounce, which `{{unsent}}` means whatever became of it. */
|
|
167
|
+
interface DraftSnapshot {
|
|
168
|
+
v: 1;
|
|
169
|
+
drafts: Draft[];
|
|
170
|
+
latestBounces: Record<string, string>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Unambiguous lowercase alphabet for short ids (no i/l/o/0/1). */
|
|
174
|
+
const ID_ALPHABET = 'abcdefghjkmnpqrstuvwxyz23456789';
|
|
175
|
+
/**
|
|
176
|
+
* Characters after `d-` in a draft's id: 31^7, about 2.75 × 10^10 ids, so a
|
|
177
|
+
* mistyped id almost never names a real draft, and an id retention let go is
|
|
178
|
+
* given again only rarely (see newId).
|
|
179
|
+
*/
|
|
180
|
+
const ID_LENGTH = 7;
|
|
181
|
+
|
|
182
|
+
/** Each resident's newest drafts, by hold order, that are always kept. */
|
|
183
|
+
export const KEEP_NEWEST = 100;
|
|
184
|
+
/** How long an older draft is kept after the last thing that happened to it. */
|
|
185
|
+
export const KEEP_IDLE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
186
|
+
/** Entries the journal takes between checkpoints. */
|
|
187
|
+
export const CHECKPOINT_EVERY = 500;
|
|
188
|
+
|
|
189
|
+
/** The store's retention, KEEP_NEWEST, KEEP_IDLE_MS and CHECKPOINT_EVERY
|
|
190
|
+
* unless given (tests give smaller ones). */
|
|
191
|
+
export interface DraftRetention {
|
|
192
|
+
keepNewest: number;
|
|
193
|
+
keepIdleMs: number;
|
|
194
|
+
checkpointEvery: number;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** The last time anything happened to a draft: held, named, attempted,
|
|
198
|
+
* answered or dismissed. */
|
|
199
|
+
function lastActivity(draft: Draft): number {
|
|
200
|
+
let last = Math.max(draft.heldAt, draft.noticedAt ?? 0, draft.dismissedAt ?? 0);
|
|
201
|
+
for (const attempt of draft.attempts) last = Math.max(last, attempt.at, attempt.outcome?.at ?? 0);
|
|
202
|
+
return last;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export class ProseDraftStore {
|
|
206
|
+
private readonly journal: RecordJournal<DraftEntry, DraftSnapshot>;
|
|
207
|
+
/** agent → draft id → draft, in journal (hold) order. */
|
|
208
|
+
private drafts = new Map<string, Map<string, Draft>>();
|
|
209
|
+
/** agent → the id of its latest bounce, kept or not. */
|
|
210
|
+
private latestBounces = new Map<string, string>();
|
|
211
|
+
private readonly retention: DraftRetention;
|
|
212
|
+
|
|
213
|
+
constructor(store: JsStore, retention: Partial<DraftRetention> = {}) {
|
|
214
|
+
this.journal = new RecordJournal<DraftEntry, DraftSnapshot>(store, { type: PROSE_DRAFT_RECORD_TYPE });
|
|
215
|
+
this.retention = {
|
|
216
|
+
keepNewest: retention.keepNewest ?? KEEP_NEWEST,
|
|
217
|
+
keepIdleMs: retention.keepIdleMs ?? KEEP_IDLE_MS,
|
|
218
|
+
checkpointEvery: retention.checkpointEvery ?? CHECKPOINT_EVERY,
|
|
219
|
+
};
|
|
220
|
+
this.reload();
|
|
221
|
+
this.checkpointIfDue();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Rebuild the projection from the journal (at open, and to reconcile):
|
|
225
|
+
* the latest checkpoint's drafts, then the entries after it. */
|
|
226
|
+
reload(): void {
|
|
227
|
+
const { snapshot, entries } = this.journal.load();
|
|
228
|
+
this.drafts = new Map();
|
|
229
|
+
this.latestBounces = new Map(Object.entries(snapshot?.latestBounces ?? {}));
|
|
230
|
+
for (const draft of snapshot?.drafts ?? []) this.agentDrafts(draft.agent).set(draft.id, draft);
|
|
231
|
+
for (const { entry } of entries) this.reduce(entry);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Write a checkpoint once CHECKPOINT_EVERY entries have been appended since
|
|
236
|
+
* the last one, letting go of the drafts that aren't kept (see the module
|
|
237
|
+
* header). The projection drops them only once the checkpoint is written,
|
|
238
|
+
* so a failed one changes nothing, and the next write tries again.
|
|
239
|
+
*/
|
|
240
|
+
private checkpointIfDue(): void {
|
|
241
|
+
const { keepNewest, keepIdleMs, checkpointEvery } = this.retention;
|
|
242
|
+
if (this.journal.entriesSinceCheckpoint < checkpointEvery) return;
|
|
243
|
+
const now = Date.now();
|
|
244
|
+
const kept = new Map<string, Map<string, Draft>>();
|
|
245
|
+
for (const [agent, drafts] of this.drafts) {
|
|
246
|
+
const all = [...drafts.values()];
|
|
247
|
+
const keep = new Map<string, Draft>();
|
|
248
|
+
all.forEach((draft, i) => {
|
|
249
|
+
if (i >= all.length - keepNewest || now - lastActivity(draft) < keepIdleMs) keep.set(draft.id, draft);
|
|
250
|
+
});
|
|
251
|
+
if (keep.size > 0) kept.set(agent, keep);
|
|
252
|
+
}
|
|
253
|
+
const snapshot: DraftSnapshot = {
|
|
254
|
+
v: 1,
|
|
255
|
+
drafts: [...kept.values()].flatMap((m) => [...m.values()]),
|
|
256
|
+
latestBounces: Object.fromEntries(this.latestBounces),
|
|
257
|
+
};
|
|
258
|
+
try {
|
|
259
|
+
this.journal.checkpoint(snapshot);
|
|
260
|
+
} catch (err) {
|
|
261
|
+
console.error('[drafts] checkpoint failed; the next write tries again:', err);
|
|
262
|
+
if (this.journal.needsReconcile) this.reload();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
this.drafts = kept;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
private reduce(entry: DraftEntry): void {
|
|
269
|
+
if (entry.op === 'held') {
|
|
270
|
+
this.agentDrafts(entry.draft.agent).set(entry.draft.id, { ...entry.draft, attempts: [] });
|
|
271
|
+
if (entry.draft.reason === 'bounced') this.latestBounces.set(entry.draft.agent, entry.draft.id);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (entry.op === 'noticed') {
|
|
275
|
+
if (entry.messageId === undefined) return;
|
|
276
|
+
for (const id of entry.ids) {
|
|
277
|
+
const draft = this.drafts.get(entry.agent)?.get(id);
|
|
278
|
+
if (!draft) continue;
|
|
279
|
+
draft.noticedIn ??= [];
|
|
280
|
+
if (!draft.noticedIn.includes(entry.messageId)) draft.noticedIn.push(entry.messageId);
|
|
281
|
+
draft.noticedAt = Math.max(draft.noticedAt ?? 0, entry.at);
|
|
282
|
+
}
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const draft = this.drafts.get(entry.agent)?.get(entry.id);
|
|
286
|
+
if (!draft) return;
|
|
287
|
+
if (entry.op === 'dismissed') {
|
|
288
|
+
draft.dismissedAt ??= entry.at;
|
|
289
|
+
} else if (entry.op === 'attempt') {
|
|
290
|
+
draft.attempts.push({
|
|
291
|
+
attemptId: entry.attemptId,
|
|
292
|
+
at: entry.at,
|
|
293
|
+
destination: entry.destination,
|
|
294
|
+
via: entry.via,
|
|
295
|
+
...(entry.confirmedDuplicate ? { confirmedDuplicate: true as const } : {}),
|
|
296
|
+
});
|
|
297
|
+
} else if (entry.op === 'outcome') {
|
|
298
|
+
const attempt = draft.attempts.find((a) => a.attemptId === entry.attemptId);
|
|
299
|
+
if (attempt) attempt.outcome = entry.outcome;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Journal and apply one entry. A write that fails after the store's append
|
|
305
|
+
* returned leaves the journal unreconciled: rebuild from it before
|
|
306
|
+
* rethrowing, so the projection never disagrees with what the journal
|
|
307
|
+
* holds. An append that fails inside the store can't be read back until
|
|
308
|
+
* the store is reopened: the journal then refuses every write until the
|
|
309
|
+
* next start, which replays that entry, so until then each write throws,
|
|
310
|
+
* no new draft is kept, and the projection lacks that entry.
|
|
311
|
+
*/
|
|
312
|
+
private write(entry: DraftEntry, durable: boolean, afterCommittedState = false): void {
|
|
313
|
+
try {
|
|
314
|
+
this.journal.append(entry, { durable, afterCommittedState });
|
|
315
|
+
} catch (err) {
|
|
316
|
+
if (this.journal.needsReconcile) this.reload();
|
|
317
|
+
throw err;
|
|
318
|
+
}
|
|
319
|
+
this.reduce(entry);
|
|
320
|
+
this.checkpointIfDue();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
private agentDrafts(agent: string): Map<string, Draft> {
|
|
324
|
+
let map = this.drafts.get(agent);
|
|
325
|
+
if (!map) {
|
|
326
|
+
map = new Map();
|
|
327
|
+
this.drafts.set(agent, map);
|
|
328
|
+
}
|
|
329
|
+
return map;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** A new id, unique among the resident's kept drafts and never its latest
|
|
333
|
+
* bounce's. One that retention let go can be given again: after N more
|
|
334
|
+
* of its resident's drafts, a given let-go id has come back with a
|
|
335
|
+
* probability of about N in 2.75 × 10^10 (ID_LENGTH), and a request naming
|
|
336
|
+
* it then reaches the newer draft rather than being refused. */
|
|
337
|
+
private newId(agent: string): string {
|
|
338
|
+
const existing = this.agentDrafts(agent);
|
|
339
|
+
const latestBounce = this.latestBounces.get(agent);
|
|
340
|
+
for (;;) {
|
|
341
|
+
let id = 'd-';
|
|
342
|
+
for (let i = 0; i < ID_LENGTH; i++) id += ID_ALPHABET[randomInt(ID_ALPHABET.length)];
|
|
343
|
+
if (!existing.has(id) && id !== latestBounce) return id;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Hold words as drafts, in order, each journaled durably before this
|
|
349
|
+
* returns. If the journal refuses a write (after reconciling), the drafts
|
|
350
|
+
* already written stand and the rest are reported as not held: their words
|
|
351
|
+
* remain in the resident's history only. A draft whose record reached the
|
|
352
|
+
* store before its write failed (its sync did) is in the reconciled
|
|
353
|
+
* journal, so it is held, and counted so. When the store's append itself
|
|
354
|
+
* threw, the record may still be in its log: the draft is reported as not
|
|
355
|
+
* held, and the journal refuses further writes until a reload, which
|
|
356
|
+
* replays it as held if it is there.
|
|
357
|
+
*/
|
|
358
|
+
hold(
|
|
359
|
+
agent: string,
|
|
360
|
+
segments: Array<{ text: string; note?: string; inheritedRisk?: InheritedRisk }>,
|
|
361
|
+
reason: DraftReason,
|
|
362
|
+
note?: string,
|
|
363
|
+
): { held: Draft[]; notHeld?: { count: number; error: string } } {
|
|
364
|
+
const held: Draft[] = [];
|
|
365
|
+
for (let i = 0; i < segments.length; i++) {
|
|
366
|
+
const segment = segments[i]!;
|
|
367
|
+
const segmentNote = segment.note ?? note;
|
|
368
|
+
const draft = {
|
|
369
|
+
id: this.newId(agent),
|
|
370
|
+
agent,
|
|
371
|
+
text: segment.text,
|
|
372
|
+
reason,
|
|
373
|
+
...(segmentNote ? { note: segmentNote } : {}),
|
|
374
|
+
...(segment.inheritedRisk ? { inheritedRisk: segment.inheritedRisk } : {}),
|
|
375
|
+
heldAt: Date.now(),
|
|
376
|
+
};
|
|
377
|
+
try {
|
|
378
|
+
this.write({ op: 'held', draft }, true);
|
|
379
|
+
} catch (err) {
|
|
380
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
381
|
+
const landed = this.get(agent, draft.id);
|
|
382
|
+
if (landed) {
|
|
383
|
+
console.error(`[drafts] ${agent}: ${landed.id} reached the journal, but its write then failed (${error}); it is held`);
|
|
384
|
+
held.push(landed);
|
|
385
|
+
}
|
|
386
|
+
const count = segments.length - i - (landed ? 1 : 0);
|
|
387
|
+
return { held, ...(count > 0 ? { notHeld: { count, error } } : {}) };
|
|
388
|
+
}
|
|
389
|
+
held.push(this.get(agent, draft.id)!);
|
|
390
|
+
}
|
|
391
|
+
return { held };
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
get(agent: string, id: string): Draft | undefined {
|
|
395
|
+
return this.drafts.get(agent)?.get(id);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** Held and unconfirmed drafts, newest first (journal order, which is
|
|
399
|
+
* exact even for segments held in the same millisecond). */
|
|
400
|
+
open(agent: string): Draft[] {
|
|
401
|
+
return [...(this.drafts.get(agent)?.values() ?? [])]
|
|
402
|
+
.filter((d) => { const s = draftState(d); return s === 'held' || s === 'unconfirmed'; })
|
|
403
|
+
.reverse();
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Open drafts, newest first, that no notice on the current branch names:
|
|
408
|
+
* none was recorded (a crash before the notice), or a rollback or branch
|
|
409
|
+
* move took away every message that named them. `onBranch` says whether a
|
|
410
|
+
* message, by id, is on the current branch.
|
|
411
|
+
*/
|
|
412
|
+
unnoticed(agent: string, onBranch: (messageId: string) => boolean): Draft[] {
|
|
413
|
+
return this.open(agent).filter((d) => !d.noticedIn?.some(onBranch));
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Record that message `messageId`, a notice naming these drafts, is in the
|
|
418
|
+
* resident's history. The notice is conversation state, buffered until the
|
|
419
|
+
* store syncs, while this record reaches the OS at once: so the store is
|
|
420
|
+
* synced FIRST (afterCommittedState), and a notice that never became
|
|
421
|
+
* durable can't leave a record that suppresses the crash catch-up.
|
|
422
|
+
*/
|
|
423
|
+
markNoticed(agent: string, ids: string[], messageId: string): void {
|
|
424
|
+
if (ids.length === 0) return;
|
|
425
|
+
this.write({ op: 'noticed', agent, ids, at: Date.now(), messageId }, true, true);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
dismiss(agent: string, id: string): void {
|
|
429
|
+
this.write({ op: 'dismissed', agent, id, at: Date.now() }, true);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Journal a delivery attempt durably, BEFORE the request leaves the host.
|
|
434
|
+
* Throws (having reconciled) when it cannot be made durable: the caller
|
|
435
|
+
* must then not send.
|
|
436
|
+
*/
|
|
437
|
+
beginAttempt(
|
|
438
|
+
agent: string,
|
|
439
|
+
id: string,
|
|
440
|
+
destination: PublishDestination,
|
|
441
|
+
via: DraftAttempt['via'],
|
|
442
|
+
confirmedDuplicate: boolean,
|
|
443
|
+
): string {
|
|
444
|
+
const attemptId = `a-${Date.now().toString(36)}-${randomInt(36 ** 4).toString(36)}`;
|
|
445
|
+
this.write({
|
|
446
|
+
op: 'attempt', agent, id, attemptId, at: Date.now(), destination, via,
|
|
447
|
+
...(confirmedDuplicate ? { confirmedDuplicate: true as const } : {}),
|
|
448
|
+
}, true);
|
|
449
|
+
return attemptId;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** Journal what an attempt established. */
|
|
453
|
+
recordOutcome(agent: string, id: string, attemptId: string, outcome: PublishOutcome): void {
|
|
454
|
+
this.write({
|
|
455
|
+
op: 'outcome', agent, id, attemptId,
|
|
456
|
+
outcome: {
|
|
457
|
+
status: outcome.status,
|
|
458
|
+
at: outcome.at,
|
|
459
|
+
...(outcome.messageId ? { messageId: outcome.messageId } : {}),
|
|
460
|
+
...(outcome.reason ? { reason: outcome.reason } : {}),
|
|
461
|
+
...(outcome.detail !== undefined ? { detail: outcome.detail } : {}),
|
|
462
|
+
},
|
|
463
|
+
}, true);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Explicit and hybrid mode's `{{unsent}}`: the most recent bounce, while
|
|
468
|
+
* that draft is still open (held or unconfirmed — the caller must not
|
|
469
|
+
* resend an unconfirmed one without the resident's confirmation).
|
|
470
|
+
* Latest-wins, like the clipboard it replaces: once the latest bounce is
|
|
471
|
+
* delivered, dismissed or let go there is nothing to substitute, even if
|
|
472
|
+
* older bounces are still held (they stay in the collection, by id).
|
|
473
|
+
*/
|
|
474
|
+
latestBounce(agent: string): Draft | undefined {
|
|
475
|
+
const id = this.latestBounces.get(agent);
|
|
476
|
+
const latest = id === undefined ? undefined : this.get(agent, id);
|
|
477
|
+
if (!latest) return undefined;
|
|
478
|
+
const state = draftState(latest);
|
|
479
|
+
return state === 'held' || state === 'unconfirmed' ? latest : undefined;
|
|
480
|
+
}
|
|
481
|
+
}
|