@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
|
@@ -1,919 +0,0 @@
|
|
|
1
|
-
import { describe, it, beforeEach, afterEach } from 'node:test';
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import { existsSync, mkdirSync, writeFileSync, rmSync, readFileSync } from 'node:fs';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { EventGate } from '../src/gate/event-gate.js';
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
// Helpers
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
const TMP_DIR = join(import.meta.dirname, '../.test-tmp-gate');
|
|
10
|
-
function tmpPath(name) {
|
|
11
|
-
return join(TMP_DIR, name);
|
|
12
|
-
}
|
|
13
|
-
function writeConfig(name, config) {
|
|
14
|
-
const path = tmpPath(name);
|
|
15
|
-
mkdirSync(TMP_DIR, { recursive: true });
|
|
16
|
-
writeFileSync(path, JSON.stringify(config, null, 2));
|
|
17
|
-
return path;
|
|
18
|
-
}
|
|
19
|
-
function makeGate(configPath, opts) {
|
|
20
|
-
const traces = [];
|
|
21
|
-
const messages = [];
|
|
22
|
-
const inferenceRequests = [];
|
|
23
|
-
const gate = new EventGate({
|
|
24
|
-
configPath,
|
|
25
|
-
initialConfig: opts?.initialConfig,
|
|
26
|
-
...(opts?.resolveRouteChannel ? { resolveRouteChannel: opts.resolveRouteChannel } : {}),
|
|
27
|
-
emitTrace: (e) => traces.push(e),
|
|
28
|
-
addMessage: (p, c, m) => { messages.push({ participant: p, content: c, metadata: m }); return ''; },
|
|
29
|
-
requestInference: (a, r, s, p) => inferenceRequests.push({ agentName: a, reason: r, source: s, ...(p ?? {}) }),
|
|
30
|
-
getAgentNames: () => ['agent'],
|
|
31
|
-
});
|
|
32
|
-
return { gate, traces, messages, inferenceRequests };
|
|
33
|
-
}
|
|
34
|
-
function event(overrides) {
|
|
35
|
-
return {
|
|
36
|
-
content: 'test message',
|
|
37
|
-
eventType: 'mcpl:push-event',
|
|
38
|
-
serverId: '',
|
|
39
|
-
channelId: '',
|
|
40
|
-
...overrides,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// Setup / Teardown
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
beforeEach(() => {
|
|
47
|
-
mkdirSync(TMP_DIR, { recursive: true });
|
|
48
|
-
});
|
|
49
|
-
afterEach(() => {
|
|
50
|
-
if (existsSync(TMP_DIR)) {
|
|
51
|
-
rmSync(TMP_DIR, { recursive: true, force: true });
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
// Default behavior (no config file)
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
describe('default behavior', () => {
|
|
58
|
-
it('no config file + no initial config → all-pass', () => {
|
|
59
|
-
const { gate } = makeGate(tmpPath('nonexistent.json'));
|
|
60
|
-
const decision = gate.evaluate(event());
|
|
61
|
-
assert.strictEqual(decision.trigger, true);
|
|
62
|
-
assert.strictEqual(decision.policyName, null);
|
|
63
|
-
});
|
|
64
|
-
it('default: skip → all skipped', () => {
|
|
65
|
-
const path = writeConfig('skip-default.json', {
|
|
66
|
-
policies: [],
|
|
67
|
-
default: 'skip',
|
|
68
|
-
});
|
|
69
|
-
const { gate } = makeGate(path);
|
|
70
|
-
const decision = gate.evaluate(event());
|
|
71
|
-
assert.strictEqual(decision.trigger, false);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
// ---------------------------------------------------------------------------
|
|
75
|
-
// Policy matching
|
|
76
|
-
// ---------------------------------------------------------------------------
|
|
77
|
-
describe('policy matching', () => {
|
|
78
|
-
it('scope match — matching event type', () => {
|
|
79
|
-
const path = writeConfig('scope.json', {
|
|
80
|
-
policies: [
|
|
81
|
-
{ name: 'channels', match: { scope: ['mcpl:channel-incoming'] }, behavior: 'always' },
|
|
82
|
-
],
|
|
83
|
-
default: 'skip',
|
|
84
|
-
});
|
|
85
|
-
const { gate } = makeGate(path);
|
|
86
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'mcpl:channel-incoming' })).trigger, true);
|
|
87
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'mcpl:push-event' })).trigger, false);
|
|
88
|
-
});
|
|
89
|
-
it('source match — exact serverId', () => {
|
|
90
|
-
const path = writeConfig('source.json', {
|
|
91
|
-
policies: [
|
|
92
|
-
{ name: 'zulip', match: { source: 'zulip' }, behavior: 'always' },
|
|
93
|
-
],
|
|
94
|
-
default: 'skip',
|
|
95
|
-
});
|
|
96
|
-
const { gate } = makeGate(path);
|
|
97
|
-
assert.strictEqual(gate.evaluate(event({ serverId: 'zulip' })).trigger, true);
|
|
98
|
-
assert.strictEqual(gate.evaluate(event({ serverId: 'discord' })).trigger, false);
|
|
99
|
-
});
|
|
100
|
-
it('source match — glob pattern', () => {
|
|
101
|
-
const path = writeConfig('source-glob.json', {
|
|
102
|
-
policies: [
|
|
103
|
-
{ name: 'any-zulip', match: { source: 'zulip-*' }, behavior: 'always' },
|
|
104
|
-
],
|
|
105
|
-
default: 'skip',
|
|
106
|
-
});
|
|
107
|
-
const { gate } = makeGate(path);
|
|
108
|
-
assert.strictEqual(gate.evaluate(event({ serverId: 'zulip-prod' })).trigger, true);
|
|
109
|
-
assert.strictEqual(gate.evaluate(event({ serverId: 'zulip-staging' })).trigger, true);
|
|
110
|
-
assert.strictEqual(gate.evaluate(event({ serverId: 'discord' })).trigger, false);
|
|
111
|
-
});
|
|
112
|
-
it('channel match — glob pattern', () => {
|
|
113
|
-
const path = writeConfig('channel-glob.json', {
|
|
114
|
-
policies: [
|
|
115
|
-
{ name: 'dev-channels', match: { channel: 'dev-*' }, behavior: 'always' },
|
|
116
|
-
],
|
|
117
|
-
default: 'skip',
|
|
118
|
-
});
|
|
119
|
-
const { gate } = makeGate(path);
|
|
120
|
-
assert.strictEqual(gate.evaluate(event({ channelId: 'dev-backend' })).trigger, true);
|
|
121
|
-
assert.strictEqual(gate.evaluate(event({ channelId: 'prod-alerts' })).trigger, false);
|
|
122
|
-
});
|
|
123
|
-
it('mount match — exact name', () => {
|
|
124
|
-
const path = writeConfig('mount-exact.json', {
|
|
125
|
-
policies: [
|
|
126
|
-
{
|
|
127
|
-
name: 'tickets',
|
|
128
|
-
match: { scope: ['workspace:created'], mount: 'knowledge-requests' },
|
|
129
|
-
behavior: 'always',
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
default: 'skip',
|
|
133
|
-
});
|
|
134
|
-
const { gate } = makeGate(path);
|
|
135
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:created', mount: 'knowledge-requests', paths: ['knowledge-requests/t1.md'] })).trigger, true);
|
|
136
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:created', mount: 'library-mined', paths: ['library-mined/r1.md'] })).trigger, false);
|
|
137
|
-
// Event without a mount must not match a mount-scoped policy.
|
|
138
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:created' })).trigger, false);
|
|
139
|
-
});
|
|
140
|
-
it('pathGlob match — any path matches', () => {
|
|
141
|
-
const path = writeConfig('path-glob.json', {
|
|
142
|
-
policies: [
|
|
143
|
-
{
|
|
144
|
-
name: 'md-only',
|
|
145
|
-
match: { scope: ['workspace:modified'], pathGlob: '*.md' },
|
|
146
|
-
behavior: 'always',
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
default: 'skip',
|
|
150
|
-
});
|
|
151
|
-
const { gate } = makeGate(path);
|
|
152
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:modified', paths: ['tickets/a.md'] })).trigger, true);
|
|
153
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:modified', paths: ['logs/a.txt'] })).trigger, false);
|
|
154
|
-
// ANY-match: one matching path is enough.
|
|
155
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:modified', paths: ['logs/a.txt', 'tickets/b.md'] })).trigger, true);
|
|
156
|
-
// Empty paths can't match a pathGlob policy.
|
|
157
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:modified', paths: [] })).trigger, false);
|
|
158
|
-
});
|
|
159
|
-
it('content filter — text match (case insensitive)', () => {
|
|
160
|
-
const path = writeConfig('filter-text.json', {
|
|
161
|
-
policies: [
|
|
162
|
-
{ name: 'errors', match: { filter: { type: 'text', pattern: 'ERROR' } }, behavior: 'always' },
|
|
163
|
-
],
|
|
164
|
-
default: 'skip',
|
|
165
|
-
});
|
|
166
|
-
const { gate } = makeGate(path);
|
|
167
|
-
assert.strictEqual(gate.evaluate(event({ content: 'Something error happened' })).trigger, true);
|
|
168
|
-
assert.strictEqual(gate.evaluate(event({ content: 'All good' })).trigger, false);
|
|
169
|
-
});
|
|
170
|
-
it('content filter — regex match', () => {
|
|
171
|
-
const path = writeConfig('filter-regex.json', {
|
|
172
|
-
policies: [
|
|
173
|
-
{ name: 'deploys', match: { filter: { type: 'regex', pattern: 'deploy|rollback' } }, behavior: 'always' },
|
|
174
|
-
],
|
|
175
|
-
default: 'skip',
|
|
176
|
-
});
|
|
177
|
-
const { gate } = makeGate(path);
|
|
178
|
-
assert.strictEqual(gate.evaluate(event({ content: 'Starting deploy v2.3' })).trigger, true);
|
|
179
|
-
assert.strictEqual(gate.evaluate(event({ content: 'rollback initiated' })).trigger, true);
|
|
180
|
-
assert.strictEqual(gate.evaluate(event({ content: 'Rolling back' })).trigger, false);
|
|
181
|
-
});
|
|
182
|
-
it('combined match — scope + source + filter (AND logic)', () => {
|
|
183
|
-
const path = writeConfig('combined.json', {
|
|
184
|
-
policies: [
|
|
185
|
-
{
|
|
186
|
-
name: 'zulip-errors',
|
|
187
|
-
match: {
|
|
188
|
-
scope: ['mcpl:channel-incoming'],
|
|
189
|
-
source: 'zulip',
|
|
190
|
-
filter: { type: 'text', pattern: 'error' },
|
|
191
|
-
},
|
|
192
|
-
behavior: 'always',
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
default: 'skip',
|
|
196
|
-
});
|
|
197
|
-
const { gate } = makeGate(path);
|
|
198
|
-
// All conditions met
|
|
199
|
-
assert.strictEqual(gate.evaluate(event({
|
|
200
|
-
content: 'An error occurred',
|
|
201
|
-
eventType: 'mcpl:channel-incoming',
|
|
202
|
-
serverId: 'zulip',
|
|
203
|
-
})).trigger, true);
|
|
204
|
-
// Wrong scope
|
|
205
|
-
assert.strictEqual(gate.evaluate(event({
|
|
206
|
-
content: 'An error occurred',
|
|
207
|
-
eventType: 'mcpl:push-event',
|
|
208
|
-
serverId: 'zulip',
|
|
209
|
-
})).trigger, false);
|
|
210
|
-
// Wrong source
|
|
211
|
-
assert.strictEqual(gate.evaluate(event({
|
|
212
|
-
content: 'An error occurred',
|
|
213
|
-
eventType: 'mcpl:channel-incoming',
|
|
214
|
-
serverId: 'discord',
|
|
215
|
-
})).trigger, false);
|
|
216
|
-
// No error keyword
|
|
217
|
-
assert.strictEqual(gate.evaluate(event({
|
|
218
|
-
content: 'All good',
|
|
219
|
-
eventType: 'mcpl:channel-incoming',
|
|
220
|
-
serverId: 'zulip',
|
|
221
|
-
})).trigger, false);
|
|
222
|
-
});
|
|
223
|
-
it('first match wins — order matters', () => {
|
|
224
|
-
const path = writeConfig('order.json', {
|
|
225
|
-
policies: [
|
|
226
|
-
{ name: 'suppress-noise', match: { filter: { type: 'text', pattern: 'heartbeat' } }, behavior: 'skip' },
|
|
227
|
-
{ name: 'catch-all', match: {}, behavior: 'always' },
|
|
228
|
-
],
|
|
229
|
-
default: 'skip',
|
|
230
|
-
});
|
|
231
|
-
const { gate } = makeGate(path);
|
|
232
|
-
assert.strictEqual(gate.evaluate(event({ content: 'heartbeat ping' })).trigger, false);
|
|
233
|
-
assert.strictEqual(gate.evaluate(event({ content: 'real message' })).trigger, true);
|
|
234
|
-
});
|
|
235
|
-
it('empty match object matches everything', () => {
|
|
236
|
-
const path = writeConfig('empty-match.json', {
|
|
237
|
-
policies: [
|
|
238
|
-
{ name: 'catch-all', match: {}, behavior: 'always' },
|
|
239
|
-
],
|
|
240
|
-
default: 'skip',
|
|
241
|
-
});
|
|
242
|
-
const { gate } = makeGate(path);
|
|
243
|
-
assert.strictEqual(gate.evaluate(event({ serverId: 'any', channelId: 'any' })).trigger, true);
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
// ---------------------------------------------------------------------------
|
|
247
|
-
// Behaviors
|
|
248
|
-
// ---------------------------------------------------------------------------
|
|
249
|
-
describe('behaviors', () => {
|
|
250
|
-
it('always → trigger: true', () => {
|
|
251
|
-
const path = writeConfig('always.json', {
|
|
252
|
-
policies: [{ name: 'all', match: {}, behavior: 'always' }],
|
|
253
|
-
default: 'skip',
|
|
254
|
-
});
|
|
255
|
-
const { gate } = makeGate(path);
|
|
256
|
-
const d = gate.evaluate(event());
|
|
257
|
-
assert.strictEqual(d.trigger, true);
|
|
258
|
-
assert.strictEqual(d.behavior, 'always');
|
|
259
|
-
});
|
|
260
|
-
it('skip → trigger: false', () => {
|
|
261
|
-
const path = writeConfig('skip.json', {
|
|
262
|
-
policies: [{ name: 'quiet', match: {}, behavior: 'skip' }],
|
|
263
|
-
default: 'always',
|
|
264
|
-
});
|
|
265
|
-
const { gate } = makeGate(path);
|
|
266
|
-
const d = gate.evaluate(event());
|
|
267
|
-
assert.strictEqual(d.trigger, false);
|
|
268
|
-
assert.strictEqual(d.behavior, 'skip');
|
|
269
|
-
assert.strictEqual(d.policyName, 'quiet');
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
// ---------------------------------------------------------------------------
|
|
273
|
-
// Debounce
|
|
274
|
-
// ---------------------------------------------------------------------------
|
|
275
|
-
describe('debounce', () => {
|
|
276
|
-
it('returns false immediately', () => {
|
|
277
|
-
const path = writeConfig('debounce.json', {
|
|
278
|
-
policies: [
|
|
279
|
-
{ name: 'editor', match: { scope: ['mcpl:push-event'] }, behavior: { debounce: 100 } },
|
|
280
|
-
],
|
|
281
|
-
default: 'skip',
|
|
282
|
-
});
|
|
283
|
-
const { gate } = makeGate(path);
|
|
284
|
-
const d = gate.evaluate(event());
|
|
285
|
-
assert.strictEqual(d.trigger, false);
|
|
286
|
-
assert.deepStrictEqual(d.behavior, { debounce: 100 });
|
|
287
|
-
});
|
|
288
|
-
it('batches events and fires after delay', async () => {
|
|
289
|
-
const path = writeConfig('debounce-fire.json', {
|
|
290
|
-
policies: [
|
|
291
|
-
{ name: 'editor', match: { scope: ['mcpl:push-event'] }, behavior: { debounce: 150 } },
|
|
292
|
-
],
|
|
293
|
-
default: 'skip',
|
|
294
|
-
});
|
|
295
|
-
const { gate, messages, inferenceRequests } = makeGate(path);
|
|
296
|
-
gate.evaluate(event({ content: 'edit 1' }));
|
|
297
|
-
gate.evaluate(event({ content: 'edit 2' }));
|
|
298
|
-
gate.evaluate(event({ content: 'edit 3' }));
|
|
299
|
-
// Should not have delivered yet
|
|
300
|
-
assert.strictEqual(messages.length, 0);
|
|
301
|
-
// Wait for debounce to fire
|
|
302
|
-
await new Promise(r => setTimeout(r, 200));
|
|
303
|
-
assert.strictEqual(messages.length, 1);
|
|
304
|
-
const text = messages[0].content[0].text;
|
|
305
|
-
assert.ok(text.includes('3 event'));
|
|
306
|
-
// MCPL events (push-event / channel-incoming) are stored in the context
|
|
307
|
-
// window AT ARRIVAL by the framework, so the batched wake references them
|
|
308
|
-
// instead of re-quoting — a re-quote minutes later reads as fresh, stale
|
|
309
|
-
// duplicate input (observed live: Sol's "step was a bit too small" echo).
|
|
310
|
-
assert.ok(text.includes('already shown above'));
|
|
311
|
-
assert.ok(!text.includes('edit 1'), 'must not re-quote in-context event content');
|
|
312
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
313
|
-
assert.strictEqual(inferenceRequests[0].agentName, 'agent');
|
|
314
|
-
});
|
|
315
|
-
it('a batched wake carries the newest channel event\'s channel AND author together (provenance)', async () => {
|
|
316
|
-
const path = writeConfig('debounce-provenance.json', {
|
|
317
|
-
policies: [
|
|
318
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming'] }, behavior: { debounce: 100 } },
|
|
319
|
-
],
|
|
320
|
-
default: 'skip',
|
|
321
|
-
});
|
|
322
|
-
const { gate, inferenceRequests } = makeGate(path);
|
|
323
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:alice-room', content: 'a',
|
|
324
|
-
metadata: { author: { id: '111', name: 'alice' } } }));
|
|
325
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:bob-room', content: 'b',
|
|
326
|
-
metadata: { authorId: '222' } }));
|
|
327
|
-
await new Promise(r => setTimeout(r, 150));
|
|
328
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
329
|
-
assert.strictEqual(inferenceRequests[0].reason, 'gate:debounce');
|
|
330
|
-
assert.strictEqual(inferenceRequests[0].channelId, 'discord:g:bob-room', 'newest channel event wins when none is addressed');
|
|
331
|
-
assert.strictEqual(inferenceRequests[0].counterparty, 'discord:user:222', 'author comes from the SAME event as the channel');
|
|
332
|
-
assert.strictEqual(inferenceRequests[0].addressed, undefined);
|
|
333
|
-
});
|
|
334
|
-
it('an older ADDRESSED event outranks newer ambient chatter — channel, author and addressed stay together', async () => {
|
|
335
|
-
const path = writeConfig('debounce-addressed.json', {
|
|
336
|
-
policies: [
|
|
337
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming'] }, behavior: { debounce: 100 } },
|
|
338
|
-
],
|
|
339
|
-
default: 'skip',
|
|
340
|
-
});
|
|
341
|
-
const { gate, inferenceRequests } = makeGate(path);
|
|
342
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:alice-room', content: 'hey agent',
|
|
343
|
-
tags: ['chat:addressed'], metadata: { author: { id: '111' } } }));
|
|
344
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:bob-room', content: 'ambient',
|
|
345
|
-
metadata: { authorId: '222' } }));
|
|
346
|
-
await new Promise(r => setTimeout(r, 150));
|
|
347
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
348
|
-
assert.strictEqual(inferenceRequests[0].channelId, 'discord:g:alice-room');
|
|
349
|
-
assert.strictEqual(inferenceRequests[0].counterparty, 'discord:user:111');
|
|
350
|
-
assert.strictEqual(inferenceRequests[0].addressed, true);
|
|
351
|
-
});
|
|
352
|
-
it('the counterparty is namespaced by the event\'s server id, not the channel id\'s first segment', async () => {
|
|
353
|
-
const path = writeConfig('debounce-namespace.json', {
|
|
354
|
-
policies: [
|
|
355
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming'] }, behavior: { debounce: 100 } },
|
|
356
|
-
],
|
|
357
|
-
default: 'skip',
|
|
358
|
-
});
|
|
359
|
-
const { gate, inferenceRequests } = makeGate(path);
|
|
360
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'beta', channelId: 'shared', content: 'x',
|
|
361
|
-
metadata: { authorId: '42' } }));
|
|
362
|
-
await new Promise(r => setTimeout(r, 150));
|
|
363
|
-
assert.strictEqual(inferenceRequests[0].channelId, 'shared');
|
|
364
|
-
assert.strictEqual(inferenceRequests[0].counterparty, 'beta:user:42');
|
|
365
|
-
assert.ok(typeof inferenceRequests[0].at === 'number', 'provenance carries the chosen event\'s timestamp');
|
|
366
|
-
});
|
|
367
|
-
it('a push-event wake (raw adapter channel id) names its author but reports no channel', async () => {
|
|
368
|
-
const path = writeConfig('debounce-push-raw.json', {
|
|
369
|
-
policies: [
|
|
370
|
-
{ name: 'all', match: { scope: ['mcpl:push-event', 'mcpl:channel-incoming'] }, behavior: { debounce: 100 } },
|
|
371
|
-
],
|
|
372
|
-
default: 'skip',
|
|
373
|
-
});
|
|
374
|
-
const { gate, inferenceRequests } = makeGate(path);
|
|
375
|
-
// exactly what PushHandler builds for a discord-mcpl DM push event
|
|
376
|
-
gate.evaluate(event({ eventType: 'mcpl:push-event', serverId: 'discord', channelId: '123456789012345678', content: 'hi',
|
|
377
|
-
tags: ['chat:dm', 'chat:addressed', 'chat:private'], metadata: { authorId: '42', channelId: '123456789012345678' } }));
|
|
378
|
-
await new Promise(r => setTimeout(r, 150));
|
|
379
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
380
|
-
assert.strictEqual(inferenceRequests[0].channelId, undefined, 'a raw snowflake is not a composite channel id — not reported');
|
|
381
|
-
assert.strictEqual(inferenceRequests[0].counterparty, 'discord:user:42');
|
|
382
|
-
assert.strictEqual(inferenceRequests[0].addressed, true);
|
|
383
|
-
});
|
|
384
|
-
it('an addressed batch names its registered route channel; ambient-only batches name none', async () => {
|
|
385
|
-
const path = writeConfig('debounce-route.json', {
|
|
386
|
-
policies: [
|
|
387
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming', 'mcpl:push-event'] }, behavior: { debounce: 100 } },
|
|
388
|
-
],
|
|
389
|
-
default: 'skip',
|
|
390
|
-
});
|
|
391
|
-
// The host maps a push origin to its registered composite id.
|
|
392
|
-
const resolveRouteChannel = (info) => info.eventType === 'mcpl:push-event' ? `discord:dm:${String(info.metadata?.channelId)}` : info.channelId;
|
|
393
|
-
const { gate, inferenceRequests, messages } = makeGate(path, { resolveRouteChannel });
|
|
394
|
-
// DM (addressed, raw id) then newer ambient chatter elsewhere.
|
|
395
|
-
gate.evaluate(event({ eventType: 'mcpl:push-event', serverId: 'discord', channelId: '1548', content: 'dm',
|
|
396
|
-
tags: ['chat:dm', 'chat:addressed'], metadata: { authorId: '42', channelId: '1548' } }));
|
|
397
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:general', content: 'chatter',
|
|
398
|
-
metadata: { authorId: '7' } }));
|
|
399
|
-
await new Promise(r => setTimeout(r, 150));
|
|
400
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
401
|
-
assert.strictEqual(inferenceRequests[0].routeChannelId, 'discord:dm:1548', 'the addressed event names the route');
|
|
402
|
-
assert.strictEqual(inferenceRequests[0].counterparty, 'discord:user:42', 'route and author come from the same event');
|
|
403
|
-
assert.strictEqual(inferenceRequests[0].channelId, undefined, 'telemetry channel unchanged for push events');
|
|
404
|
-
// The batched-wake line names the registered id, not the raw snowflake.
|
|
405
|
-
const text = JSON.stringify(messages.at(-1)?.content);
|
|
406
|
-
assert.ok(text.includes('discord:dm:1548'), 'gate line shows the registered channel id');
|
|
407
|
-
// Ambient-only batch: telemetry provenance, no route.
|
|
408
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:room', content: 'x',
|
|
409
|
-
metadata: { authorId: '8' } }));
|
|
410
|
-
await new Promise(r => setTimeout(r, 150));
|
|
411
|
-
assert.strictEqual(inferenceRequests.length, 2);
|
|
412
|
-
assert.strictEqual(inferenceRequests[1].channelId, 'discord:g:room');
|
|
413
|
-
assert.strictEqual(inferenceRequests[1].routeChannelId, undefined, 'ambient chatter never sets a route');
|
|
414
|
-
});
|
|
415
|
-
it('the default resolver routes an addressed channel-incoming event; a push event needs the host resolver', async () => {
|
|
416
|
-
const path = writeConfig('debounce-route-default.json', {
|
|
417
|
-
policies: [
|
|
418
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming', 'mcpl:push-event'] }, behavior: { debounce: 100 } },
|
|
419
|
-
],
|
|
420
|
-
default: 'skip',
|
|
421
|
-
});
|
|
422
|
-
const { gate, inferenceRequests } = makeGate(path);
|
|
423
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:room', content: '@agent hi',
|
|
424
|
-
tags: ['chat:addressed'], metadata: { authorId: '1' } }));
|
|
425
|
-
await new Promise(r => setTimeout(r, 150));
|
|
426
|
-
assert.strictEqual(inferenceRequests[0].routeChannelId, 'discord:g:room');
|
|
427
|
-
gate.evaluate(event({ eventType: 'mcpl:push-event', serverId: 'discord', channelId: '1548', content: 'dm',
|
|
428
|
-
tags: ['chat:dm', 'chat:addressed'], metadata: { authorId: '42', channelId: '1548' } }));
|
|
429
|
-
await new Promise(r => setTimeout(r, 150));
|
|
430
|
-
assert.strictEqual(inferenceRequests[1].routeChannelId, undefined, 'a raw id is never used as a route');
|
|
431
|
-
});
|
|
432
|
-
it('the newest addressed event decides the route even when it has none (no guessing an older one)', async () => {
|
|
433
|
-
const path = writeConfig('debounce-route-newest.json', {
|
|
434
|
-
policies: [
|
|
435
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming', 'mcpl:push-event'] }, behavior: { debounce: 100 } },
|
|
436
|
-
],
|
|
437
|
-
default: 'skip',
|
|
438
|
-
});
|
|
439
|
-
const { gate, inferenceRequests } = makeGate(path); // default resolver: push → no route
|
|
440
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:room', content: '@agent first',
|
|
441
|
-
tags: ['chat:addressed'], metadata: { authorId: '1' } }));
|
|
442
|
-
gate.evaluate(event({ eventType: 'mcpl:push-event', serverId: 'discord', channelId: '1548', content: 'dm later',
|
|
443
|
-
tags: ['chat:dm', 'chat:addressed'], metadata: { authorId: '42', channelId: '1548' } }));
|
|
444
|
-
await new Promise(r => setTimeout(r, 150));
|
|
445
|
-
assert.strictEqual(inferenceRequests[0].counterparty, 'discord:user:42');
|
|
446
|
-
assert.strictEqual(inferenceRequests[0].routeChannelId, undefined, 'the DM is the newest addressed event; replying to the older mention would answer the wrong person');
|
|
447
|
-
});
|
|
448
|
-
it('an addressed push that names only its registered channel (no raw id, no author) still routes', async () => {
|
|
449
|
-
const path = writeConfig('debounce-route-only.json', {
|
|
450
|
-
policies: [
|
|
451
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming', 'mcpl:push-event'] }, behavior: { debounce: 100 } },
|
|
452
|
-
],
|
|
453
|
-
default: 'skip',
|
|
454
|
-
});
|
|
455
|
-
const resolveRouteChannel = (info) => typeof info.metadata?.mcplChannelId === 'string' ? info.metadata.mcplChannelId : undefined;
|
|
456
|
-
const { gate, inferenceRequests } = makeGate(path, { resolveRouteChannel });
|
|
457
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'surface', channelId: 'surface:room:general',
|
|
458
|
-
content: 'chatter', metadata: { authorId: '7' } }));
|
|
459
|
-
gate.evaluate(event({ eventType: 'mcpl:push-event', serverId: 'surface', content: 'dm',
|
|
460
|
-
tags: ['chat:dm', 'chat:addressed'], metadata: { mcplChannelId: 'surface:dm:42' } }));
|
|
461
|
-
await new Promise(r => setTimeout(r, 150));
|
|
462
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
463
|
-
assert.strictEqual(inferenceRequests[0].routeChannelId, 'surface:dm:42');
|
|
464
|
-
assert.strictEqual(inferenceRequests[0].addressed, true);
|
|
465
|
-
assert.strictEqual(inferenceRequests[0].counterparty, undefined, 'no author on the chosen event, none borrowed from the chatter');
|
|
466
|
-
});
|
|
467
|
-
it('a newer AMBIENT route-only push does not hide an earlier event\'s channel and author', async () => {
|
|
468
|
-
const path = writeConfig('debounce-route-only-ambient.json', {
|
|
469
|
-
policies: [
|
|
470
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming', 'mcpl:push-event'] }, behavior: { debounce: 100 } },
|
|
471
|
-
],
|
|
472
|
-
default: 'skip',
|
|
473
|
-
});
|
|
474
|
-
const resolveRouteChannel = (info) => typeof info.metadata?.mcplChannelId === 'string' ? info.metadata.mcplChannelId : info.channelId || undefined;
|
|
475
|
-
const { gate, inferenceRequests } = makeGate(path, { resolveRouteChannel });
|
|
476
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'surface', channelId: 'surface:room:general',
|
|
477
|
-
content: 'chatter', metadata: { authorId: '7' } }));
|
|
478
|
-
gate.evaluate(event({ eventType: 'mcpl:push-event', serverId: 'surface', content: 'status ping',
|
|
479
|
-
metadata: { mcplChannelId: 'surface:room:feed' } }));
|
|
480
|
-
await new Promise(r => setTimeout(r, 150));
|
|
481
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
482
|
-
assert.strictEqual(inferenceRequests[0].channelId, 'surface:room:general', 'telemetry keeps the attributable event');
|
|
483
|
-
assert.strictEqual(inferenceRequests[0].counterparty, 'surface:user:7');
|
|
484
|
-
assert.strictEqual(inferenceRequests[0].routeChannelId, undefined, 'ambient batches never route');
|
|
485
|
-
});
|
|
486
|
-
it('a throwing route resolver never breaks gating', async () => {
|
|
487
|
-
const path = writeConfig('debounce-route-throw.json', {
|
|
488
|
-
policies: [
|
|
489
|
-
{ name: 'chat', match: { scope: ['mcpl:channel-incoming'] }, behavior: { debounce: 100 } },
|
|
490
|
-
],
|
|
491
|
-
default: 'skip',
|
|
492
|
-
});
|
|
493
|
-
const { gate, inferenceRequests } = makeGate(path, { resolveRouteChannel: () => { throw new Error('boom'); } });
|
|
494
|
-
const decision = gate.evaluate(event({ eventType: 'mcpl:channel-incoming', serverId: 'discord', channelId: 'discord:g:room',
|
|
495
|
-
content: '@agent hi', tags: ['chat:addressed'] }));
|
|
496
|
-
assert.strictEqual(decision.policyName, 'chat');
|
|
497
|
-
await new Promise(r => setTimeout(r, 150));
|
|
498
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
499
|
-
assert.strictEqual(inferenceRequests[0].routeChannelId, undefined);
|
|
500
|
-
});
|
|
501
|
-
it('a batched wake with no channel-bearing event carries no provenance', async () => {
|
|
502
|
-
const path = writeConfig('debounce-noprov.json', {
|
|
503
|
-
policies: [
|
|
504
|
-
{ name: 'editor', match: { scope: ['mcpl:push-event'] }, behavior: { debounce: 100 } },
|
|
505
|
-
],
|
|
506
|
-
default: 'skip',
|
|
507
|
-
});
|
|
508
|
-
const { gate, inferenceRequests } = makeGate(path);
|
|
509
|
-
gate.evaluate(event({ content: 'edit' }));
|
|
510
|
-
await new Promise(r => setTimeout(r, 150));
|
|
511
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
512
|
-
assert.strictEqual(inferenceRequests[0].channelId, undefined);
|
|
513
|
-
assert.strictEqual(inferenceRequests[0].counterparty, undefined);
|
|
514
|
-
});
|
|
515
|
-
it('quotes content for non-MCPL events (no context entry of their own)', async () => {
|
|
516
|
-
const path = writeConfig('debounce-quote.json', {
|
|
517
|
-
policies: [
|
|
518
|
-
{ name: 'editor', match: { scope: ['module:custom'] }, behavior: { debounce: 150 } },
|
|
519
|
-
],
|
|
520
|
-
default: 'skip',
|
|
521
|
-
});
|
|
522
|
-
const { gate, messages } = makeGate(path);
|
|
523
|
-
gate.evaluate(event({ content: 'compile finished', eventType: 'module:custom' }));
|
|
524
|
-
await new Promise(r => setTimeout(r, 200));
|
|
525
|
-
assert.strictEqual(messages.length, 1);
|
|
526
|
-
const text = messages[0].content[0].text;
|
|
527
|
-
assert.ok(text.includes('[editor]'));
|
|
528
|
-
assert.ok(text.includes('compile finished'), 'non-MCPL events carry their content');
|
|
529
|
-
});
|
|
530
|
-
it('resets timer on new events', async () => {
|
|
531
|
-
const path = writeConfig('debounce-reset.json', {
|
|
532
|
-
policies: [
|
|
533
|
-
{ name: 'editor', match: {}, behavior: { debounce: 150 } },
|
|
534
|
-
],
|
|
535
|
-
default: 'skip',
|
|
536
|
-
});
|
|
537
|
-
const { gate, messages } = makeGate(path);
|
|
538
|
-
gate.evaluate(event({ content: 'edit 1' }));
|
|
539
|
-
await new Promise(r => setTimeout(r, 80));
|
|
540
|
-
// Timer hasn't fired yet, send another
|
|
541
|
-
gate.evaluate(event({ content: 'edit 2' }));
|
|
542
|
-
await new Promise(r => setTimeout(r, 80));
|
|
543
|
-
// Still within debounce window of second event
|
|
544
|
-
assert.strictEqual(messages.length, 0);
|
|
545
|
-
await new Promise(r => setTimeout(r, 100));
|
|
546
|
-
// Now it should have fired
|
|
547
|
-
assert.strictEqual(messages.length, 1);
|
|
548
|
-
});
|
|
549
|
-
});
|
|
550
|
-
// ---------------------------------------------------------------------------
|
|
551
|
-
// Debounce bounds validation
|
|
552
|
-
// ---------------------------------------------------------------------------
|
|
553
|
-
describe('debounce bounds', () => {
|
|
554
|
-
it('rejects debounce < 100ms', () => {
|
|
555
|
-
const path = tmpPath('low-debounce.json');
|
|
556
|
-
mkdirSync(TMP_DIR, { recursive: true });
|
|
557
|
-
writeFileSync(path, JSON.stringify({
|
|
558
|
-
policies: [{ name: 'fast', match: {}, behavior: { debounce: 50 } }],
|
|
559
|
-
default: 'always',
|
|
560
|
-
}));
|
|
561
|
-
const { gate, traces } = makeGate(path);
|
|
562
|
-
// Should fall back to default config, emit error trace
|
|
563
|
-
assert.strictEqual(gate.evaluate(event()).trigger, true);
|
|
564
|
-
assert.ok(traces.some(t => t.type === 'gate:config-error'));
|
|
565
|
-
});
|
|
566
|
-
it('rejects debounce > 300000ms', () => {
|
|
567
|
-
const path = tmpPath('high-debounce.json');
|
|
568
|
-
mkdirSync(TMP_DIR, { recursive: true });
|
|
569
|
-
writeFileSync(path, JSON.stringify({
|
|
570
|
-
policies: [{ name: 'slow', match: {}, behavior: { debounce: 500000 } }],
|
|
571
|
-
default: 'always',
|
|
572
|
-
}));
|
|
573
|
-
const { gate, traces } = makeGate(path);
|
|
574
|
-
assert.strictEqual(gate.evaluate(event()).trigger, true);
|
|
575
|
-
assert.ok(traces.some(t => t.type === 'gate:config-error'));
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
// ---------------------------------------------------------------------------
|
|
579
|
-
// Inference buffering
|
|
580
|
-
// ---------------------------------------------------------------------------
|
|
581
|
-
describe('inference buffering', () => {
|
|
582
|
-
it('inference buffer is capped at MAX_INFERENCE_BUFFER', async () => {
|
|
583
|
-
const path = writeConfig('infer-cap.json', {
|
|
584
|
-
policies: [
|
|
585
|
-
{ name: 'chat', match: {}, behavior: { debounce: 100 } },
|
|
586
|
-
],
|
|
587
|
-
default: 'skip',
|
|
588
|
-
});
|
|
589
|
-
const { gate, messages } = makeGate(path);
|
|
590
|
-
gate.onInferenceStarted('agent');
|
|
591
|
-
// Fire many debounce batches — each with 20 events, 6 batches = 120 events
|
|
592
|
-
for (let batch = 0; batch < 6; batch++) {
|
|
593
|
-
for (let i = 0; i < 20; i++) {
|
|
594
|
-
gate.evaluate(event({ content: `batch${batch}-msg${i}` }));
|
|
595
|
-
}
|
|
596
|
-
// Let debounce fire (into inference buffer since inferring)
|
|
597
|
-
await new Promise(r => setTimeout(r, 150));
|
|
598
|
-
}
|
|
599
|
-
// Buffer should be capped at 100 (oldest dropped)
|
|
600
|
-
const bufferLen = gate.inferenceBuffer.length;
|
|
601
|
-
assert.ok(bufferLen <= 100, `Expected buffer <= 100, got ${bufferLen}`);
|
|
602
|
-
assert.ok(bufferLen > 0, 'Expected buffer to have events');
|
|
603
|
-
// First event should NOT be from batch 0 (those were dropped)
|
|
604
|
-
const firstEvent = gate.inferenceBuffer[0];
|
|
605
|
-
assert.ok(!firstEvent.content.startsWith('batch0'), `Expected oldest events dropped, but first is ${firstEvent.content}`);
|
|
606
|
-
// End inference → flush
|
|
607
|
-
gate.onInferenceEnded('agent');
|
|
608
|
-
await new Promise(r => setTimeout(r, 10));
|
|
609
|
-
assert.strictEqual(messages.length, 1);
|
|
610
|
-
gate.dispose();
|
|
611
|
-
});
|
|
612
|
-
it('debounce during inference → buffer → flush on end', async () => {
|
|
613
|
-
const path = writeConfig('infer-debounce.json', {
|
|
614
|
-
policies: [
|
|
615
|
-
{ name: 'chat', match: {}, behavior: { debounce: 150 } },
|
|
616
|
-
],
|
|
617
|
-
default: 'skip',
|
|
618
|
-
});
|
|
619
|
-
const { gate, messages } = makeGate(path);
|
|
620
|
-
gate.evaluate(event({ content: 'msg 1' }));
|
|
621
|
-
gate.evaluate(event({ content: 'msg 2' }));
|
|
622
|
-
// Simulate inference started before debounce fires
|
|
623
|
-
gate.onInferenceStarted('agent');
|
|
624
|
-
// Wait for debounce timer to fire
|
|
625
|
-
await new Promise(r => setTimeout(r, 200));
|
|
626
|
-
// Should be buffered, not delivered (inference is active)
|
|
627
|
-
assert.strictEqual(messages.length, 0);
|
|
628
|
-
// End inference → flush
|
|
629
|
-
gate.onInferenceEnded('agent');
|
|
630
|
-
// queueMicrotask defers delivery
|
|
631
|
-
await new Promise(r => setTimeout(r, 10));
|
|
632
|
-
assert.strictEqual(messages.length, 1);
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
// ---------------------------------------------------------------------------
|
|
636
|
-
// Config hot-reload
|
|
637
|
-
// ---------------------------------------------------------------------------
|
|
638
|
-
describe('config hot-reload', () => {
|
|
639
|
-
it('reloads config when file changes', async () => {
|
|
640
|
-
const path = writeConfig('reload.json', {
|
|
641
|
-
policies: [{ name: 'all', match: {}, behavior: 'always' }],
|
|
642
|
-
default: 'skip',
|
|
643
|
-
});
|
|
644
|
-
const { gate } = makeGate(path);
|
|
645
|
-
assert.strictEqual(gate.evaluate(event()).trigger, true);
|
|
646
|
-
// Force throttle to expire
|
|
647
|
-
gate.lastReloadCheck = 0;
|
|
648
|
-
// Wait for mtime to differ
|
|
649
|
-
await new Promise(r => setTimeout(r, 50));
|
|
650
|
-
// Rewrite config — now skip everything
|
|
651
|
-
writeFileSync(path, JSON.stringify({ policies: [], default: 'skip' }));
|
|
652
|
-
assert.strictEqual(gate.evaluate(event()).trigger, false);
|
|
653
|
-
});
|
|
654
|
-
it('config error keeps previous valid config', async () => {
|
|
655
|
-
const path = writeConfig('error-reload.json', {
|
|
656
|
-
policies: [{ name: 'all', match: {}, behavior: 'always' }],
|
|
657
|
-
default: 'skip',
|
|
658
|
-
});
|
|
659
|
-
const { gate, traces } = makeGate(path);
|
|
660
|
-
assert.strictEqual(gate.evaluate(event()).trigger, true);
|
|
661
|
-
// Force throttle to expire
|
|
662
|
-
gate.lastReloadCheck = 0;
|
|
663
|
-
await new Promise(r => setTimeout(r, 50));
|
|
664
|
-
// Write invalid JSON
|
|
665
|
-
writeFileSync(path, 'not valid json{{{');
|
|
666
|
-
// Should still use previous config
|
|
667
|
-
assert.strictEqual(gate.evaluate(event()).trigger, true);
|
|
668
|
-
assert.ok(traces.some(t => t.type === 'gate:config-error'));
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
// ---------------------------------------------------------------------------
|
|
672
|
-
// Config seeding
|
|
673
|
-
// ---------------------------------------------------------------------------
|
|
674
|
-
describe('config seeding', () => {
|
|
675
|
-
it('seeds config file from initialConfig when file does not exist', () => {
|
|
676
|
-
const path = tmpPath('seeded.json');
|
|
677
|
-
const config = {
|
|
678
|
-
policies: [{ name: 'test', match: {}, behavior: 'always' }],
|
|
679
|
-
default: 'skip',
|
|
680
|
-
};
|
|
681
|
-
makeGate(path, { initialConfig: config });
|
|
682
|
-
assert.ok(existsSync(path));
|
|
683
|
-
const written = JSON.parse(readFileSync(path, 'utf-8'));
|
|
684
|
-
assert.strictEqual(written.policies[0].name, 'test');
|
|
685
|
-
});
|
|
686
|
-
it('does not overwrite existing file', () => {
|
|
687
|
-
const path = writeConfig('existing.json', {
|
|
688
|
-
policies: [{ name: 'original', match: {}, behavior: 'always' }],
|
|
689
|
-
default: 'always',
|
|
690
|
-
});
|
|
691
|
-
makeGate(path, {
|
|
692
|
-
initialConfig: {
|
|
693
|
-
policies: [{ name: 'new', match: {}, behavior: 'skip' }],
|
|
694
|
-
default: 'skip',
|
|
695
|
-
},
|
|
696
|
-
});
|
|
697
|
-
const written = JSON.parse(readFileSync(path, 'utf-8'));
|
|
698
|
-
assert.strictEqual(written.policies[0].name, 'original');
|
|
699
|
-
});
|
|
700
|
-
});
|
|
701
|
-
// ---------------------------------------------------------------------------
|
|
702
|
-
// gate:status tool
|
|
703
|
-
// ---------------------------------------------------------------------------
|
|
704
|
-
describe('gate:status tool', () => {
|
|
705
|
-
it('returns correct status structure', async () => {
|
|
706
|
-
const path = writeConfig('status.json', {
|
|
707
|
-
policies: [
|
|
708
|
-
{ name: 'always-policy', match: {}, behavior: 'always' },
|
|
709
|
-
{ name: 'debounce-policy', match: { scope: ['mcpl:push-event'] }, behavior: { debounce: 1000 } },
|
|
710
|
-
],
|
|
711
|
-
default: 'skip',
|
|
712
|
-
});
|
|
713
|
-
const { gate } = makeGate(path);
|
|
714
|
-
// Trigger some matches
|
|
715
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming' }));
|
|
716
|
-
gate.evaluate(event({ eventType: 'mcpl:channel-incoming' }));
|
|
717
|
-
const result = await gate.handleToolCall();
|
|
718
|
-
assert.strictEqual(result.success, true);
|
|
719
|
-
const status = result.data;
|
|
720
|
-
assert.strictEqual(status.configPath, path);
|
|
721
|
-
assert.strictEqual(status.configSource, 'file');
|
|
722
|
-
assert.strictEqual(status.default, 'skip');
|
|
723
|
-
assert.strictEqual(status.policies.length, 2);
|
|
724
|
-
assert.strictEqual(status.policies[0].name, 'always-policy');
|
|
725
|
-
assert.strictEqual(status.policies[0].matchCount, 2);
|
|
726
|
-
assert.strictEqual(status.errors.length, 0);
|
|
727
|
-
});
|
|
728
|
-
});
|
|
729
|
-
// ---------------------------------------------------------------------------
|
|
730
|
-
// asShouldTriggerCallback
|
|
731
|
-
// ---------------------------------------------------------------------------
|
|
732
|
-
describe('asShouldTriggerCallback', () => {
|
|
733
|
-
it('returns a function with the shouldTriggerInference signature', () => {
|
|
734
|
-
const path = writeConfig('callback.json', {
|
|
735
|
-
policies: [
|
|
736
|
-
{ name: 'allow-zulip', match: { source: 'zulip' }, behavior: 'always' },
|
|
737
|
-
],
|
|
738
|
-
default: 'skip',
|
|
739
|
-
});
|
|
740
|
-
const { gate } = makeGate(path);
|
|
741
|
-
const cb = gate.asShouldTriggerCallback();
|
|
742
|
-
assert.strictEqual(typeof cb, 'function');
|
|
743
|
-
assert.strictEqual(cb('hello', { eventType: 'mcpl:push-event', serverId: 'zulip' }), true);
|
|
744
|
-
assert.strictEqual(cb('hello', { eventType: 'mcpl:push-event', serverId: 'discord' }), false);
|
|
745
|
-
});
|
|
746
|
-
});
|
|
747
|
-
// ---------------------------------------------------------------------------
|
|
748
|
-
// Trace events
|
|
749
|
-
// ---------------------------------------------------------------------------
|
|
750
|
-
describe('trace events', () => {
|
|
751
|
-
it('emits gate:policy-matched on match', () => {
|
|
752
|
-
const path = writeConfig('trace-match.json', {
|
|
753
|
-
policies: [{ name: 'test', match: {}, behavior: 'always' }],
|
|
754
|
-
default: 'skip',
|
|
755
|
-
});
|
|
756
|
-
const { gate, traces } = makeGate(path);
|
|
757
|
-
gate.evaluate(event());
|
|
758
|
-
const matchTraces = traces.filter(t => t.type === 'gate:policy-matched');
|
|
759
|
-
assert.strictEqual(matchTraces.length, 1);
|
|
760
|
-
assert.strictEqual(matchTraces[0].policyName, 'test');
|
|
761
|
-
});
|
|
762
|
-
it('emits gate:config-reloaded on successful reload', async () => {
|
|
763
|
-
const path = writeConfig('trace-reload.json', {
|
|
764
|
-
policies: [],
|
|
765
|
-
default: 'always',
|
|
766
|
-
});
|
|
767
|
-
const { gate, traces } = makeGate(path);
|
|
768
|
-
gate.evaluate(event()); // initial eval
|
|
769
|
-
gate.lastReloadCheck = 0;
|
|
770
|
-
await new Promise(r => setTimeout(r, 50));
|
|
771
|
-
writeFileSync(path, JSON.stringify({ policies: [{ name: 'new', match: {}, behavior: 'skip' }], default: 'always' }));
|
|
772
|
-
gate.evaluate(event());
|
|
773
|
-
assert.ok(traces.some(t => t.type === 'gate:config-reloaded'));
|
|
774
|
-
});
|
|
775
|
-
});
|
|
776
|
-
// ---------------------------------------------------------------------------
|
|
777
|
-
// Cleanup
|
|
778
|
-
// ---------------------------------------------------------------------------
|
|
779
|
-
describe('dispose', () => {
|
|
780
|
-
it('clears debounce timers without delivering', () => {
|
|
781
|
-
const path = writeConfig('dispose.json', {
|
|
782
|
-
policies: [{ name: 'debounced', match: {}, behavior: { debounce: 10000 } }],
|
|
783
|
-
default: 'skip',
|
|
784
|
-
});
|
|
785
|
-
const { gate, messages } = makeGate(path);
|
|
786
|
-
gate.evaluate(event());
|
|
787
|
-
gate.dispose();
|
|
788
|
-
// No delivery should happen
|
|
789
|
-
assert.strictEqual(messages.length, 0);
|
|
790
|
-
});
|
|
791
|
-
});
|
|
792
|
-
// ---------------------------------------------------------------------------
|
|
793
|
-
// Policy reconciliation on restart (postmortem: clerk stuck on old policies)
|
|
794
|
-
// ---------------------------------------------------------------------------
|
|
795
|
-
describe('policy reconciliation', () => {
|
|
796
|
-
it('appends missing-by-name policies from initialConfig when gate.json already exists', () => {
|
|
797
|
-
// Simulate a prior session that seeded gate.json with 2 policies
|
|
798
|
-
const path = writeConfig('reconcile-add.json', {
|
|
799
|
-
default: 'skip',
|
|
800
|
-
policies: [
|
|
801
|
-
{ name: 'user-input', match: { scope: ['external-message'] }, behavior: 'always' },
|
|
802
|
-
{ name: 'subagent-completions', match: { scope: ['inference-request'] }, behavior: 'always' },
|
|
803
|
-
],
|
|
804
|
-
});
|
|
805
|
-
// New session starts with a recipe that added a third policy
|
|
806
|
-
const { gate, traces } = makeGate(path, {
|
|
807
|
-
initialConfig: {
|
|
808
|
-
default: 'skip',
|
|
809
|
-
policies: [
|
|
810
|
-
{ name: 'user-input', match: { scope: ['external-message'] }, behavior: 'always' },
|
|
811
|
-
{ name: 'subagent-completions', match: { scope: ['inference-request'] }, behavior: 'always' },
|
|
812
|
-
{ name: 'reviewed-responses', match: { scope: ['workspace:created'] }, behavior: 'always' },
|
|
813
|
-
],
|
|
814
|
-
},
|
|
815
|
-
});
|
|
816
|
-
// gate.json on disk should now contain all three policies
|
|
817
|
-
const onDisk = JSON.parse(readFileSync(path, 'utf-8'));
|
|
818
|
-
assert.strictEqual(onDisk.policies.length, 3);
|
|
819
|
-
assert.ok(onDisk.policies.some((p) => p.name === 'reviewed-responses'));
|
|
820
|
-
// Reconciliation trace emitted
|
|
821
|
-
assert.ok(traces.some(t => t.type === 'gate:config-reconciled'));
|
|
822
|
-
// Live gate honors the new policy
|
|
823
|
-
assert.strictEqual(gate.evaluate(event({ eventType: 'workspace:created' })).trigger, true);
|
|
824
|
-
});
|
|
825
|
-
it("leaves existing policies alone — user's workspace--edit survives recipe changes", () => {
|
|
826
|
-
const path = writeConfig('reconcile-preserve.json', {
|
|
827
|
-
default: 'skip',
|
|
828
|
-
policies: [
|
|
829
|
-
{
|
|
830
|
-
name: 'user-input',
|
|
831
|
-
// User edited this policy to also filter on content
|
|
832
|
-
match: { scope: ['external-message'], filter: { type: 'text', pattern: 'urgent' } },
|
|
833
|
-
behavior: 'always',
|
|
834
|
-
},
|
|
835
|
-
],
|
|
836
|
-
});
|
|
837
|
-
makeGate(path, {
|
|
838
|
-
initialConfig: {
|
|
839
|
-
default: 'skip',
|
|
840
|
-
policies: [
|
|
841
|
-
// Recipe declares it without the filter
|
|
842
|
-
{ name: 'user-input', match: { scope: ['external-message'] }, behavior: 'always' },
|
|
843
|
-
],
|
|
844
|
-
},
|
|
845
|
-
});
|
|
846
|
-
const onDisk = JSON.parse(readFileSync(path, 'utf-8'));
|
|
847
|
-
assert.strictEqual(onDisk.policies.length, 1);
|
|
848
|
-
assert.deepStrictEqual(onDisk.policies[0].match.filter, { type: 'text', pattern: 'urgent' });
|
|
849
|
-
});
|
|
850
|
-
});
|
|
851
|
-
// ---------------------------------------------------------------------------
|
|
852
|
-
// Observability: defaultDecisions counts help diagnose silent drops
|
|
853
|
-
// ---------------------------------------------------------------------------
|
|
854
|
-
describe('defaultDecisions counters', () => {
|
|
855
|
-
it('counts events that fell through to default (by eventType)', () => {
|
|
856
|
-
const path = writeConfig('default-counts.json', {
|
|
857
|
-
default: 'skip',
|
|
858
|
-
policies: [
|
|
859
|
-
{ name: 'user-input', match: { scope: ['external-message'] }, behavior: 'always' },
|
|
860
|
-
],
|
|
861
|
-
});
|
|
862
|
-
const { gate } = makeGate(path);
|
|
863
|
-
gate.evaluate(event({ eventType: 'external-message' })); // matches
|
|
864
|
-
gate.evaluate(event({ eventType: 'workspace:created' })); // default skip
|
|
865
|
-
gate.evaluate(event({ eventType: 'workspace:created' })); // default skip
|
|
866
|
-
gate.evaluate(event({ eventType: 'other' })); // default skip
|
|
867
|
-
const status = gate.getStatus();
|
|
868
|
-
assert.strictEqual(status.totalEvaluations, 4);
|
|
869
|
-
assert.strictEqual(status.defaultDecisions.skipped, 3);
|
|
870
|
-
assert.strictEqual(status.defaultDecisions.triggered, 0);
|
|
871
|
-
assert.strictEqual(status.defaultDecisions.byEventType['workspace:created'].skipped, 2);
|
|
872
|
-
assert.strictEqual(status.defaultDecisions.byEventType['other'].skipped, 1);
|
|
873
|
-
});
|
|
874
|
-
});
|
|
875
|
-
// ---------------------------------------------------------------------------
|
|
876
|
-
// Host quiesce suppression (issue #122)
|
|
877
|
-
// ---------------------------------------------------------------------------
|
|
878
|
-
describe('quiesce suppression', () => {
|
|
879
|
-
it('buffers debounce firings while quiesced and flushes on setQuiesced(false)', async () => {
|
|
880
|
-
const path = writeConfig('quiesce-debounce.json', {
|
|
881
|
-
policies: [
|
|
882
|
-
{ name: 'editor', match: { scope: ['mcpl:push-event'] }, behavior: { debounce: 120 } },
|
|
883
|
-
],
|
|
884
|
-
default: 'skip',
|
|
885
|
-
});
|
|
886
|
-
const { gate, messages, inferenceRequests } = makeGate(path);
|
|
887
|
-
gate.setQuiesced(true);
|
|
888
|
-
gate.evaluate(event({ content: 'edit 1' }));
|
|
889
|
-
gate.evaluate(event({ content: 'edit 2' }));
|
|
890
|
-
// Debounce fires while quiesced → buffered, no context write, no wake.
|
|
891
|
-
await new Promise(r => setTimeout(r, 250));
|
|
892
|
-
assert.strictEqual(messages.length, 0, 'no gate message mid-surgery');
|
|
893
|
-
assert.strictEqual(inferenceRequests.length, 0);
|
|
894
|
-
assert.strictEqual(gate.inferenceDiagnostics().bufferedEvents, 2);
|
|
895
|
-
gate.setQuiesced(false);
|
|
896
|
-
await new Promise(r => setTimeout(r, 20)); // flush is deferred a microtask
|
|
897
|
-
assert.strictEqual(messages.length, 1, 'buffered events compose one delivery');
|
|
898
|
-
assert.strictEqual(inferenceRequests.length, 1);
|
|
899
|
-
assert.strictEqual(gate.inferenceDiagnostics().bufferedEvents, 0);
|
|
900
|
-
});
|
|
901
|
-
it('a turn ending while quiesced does not flush the buffer', async () => {
|
|
902
|
-
const path = writeConfig('quiesce-turn-end.json', {
|
|
903
|
-
policies: [
|
|
904
|
-
{ name: 'editor', match: { scope: ['mcpl:push-event'] }, behavior: { debounce: 120 } },
|
|
905
|
-
],
|
|
906
|
-
default: 'skip',
|
|
907
|
-
});
|
|
908
|
-
const { gate, messages } = makeGate(path);
|
|
909
|
-
gate.setQuiesced(true);
|
|
910
|
-
gate.onInferenceStarted('agent');
|
|
911
|
-
gate.evaluate(event({ content: 'during drain' }));
|
|
912
|
-
await new Promise(r => setTimeout(r, 250));
|
|
913
|
-
gate.onInferenceEnded('agent'); // drain completes mid-quiesce
|
|
914
|
-
await new Promise(r => setTimeout(r, 20));
|
|
915
|
-
assert.strictEqual(messages.length, 0, 'buffer holds until resume, not turn end');
|
|
916
|
-
assert.strictEqual(gate.inferenceDiagnostics().bufferedEvents, 1);
|
|
917
|
-
});
|
|
918
|
-
});
|
|
919
|
-
//# sourceMappingURL=event-gate.test.js.map
|