@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,672 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* stop() with work still in flight.
|
|
3
|
-
*
|
|
4
|
-
* stop() closes the process queue first and closes MCPL connections later,
|
|
5
|
-
* so for a while work started before stop() keeps completing, and servers
|
|
6
|
-
* keep sending. Two outcomes, one boundary (found through #256's aborted-
|
|
7
|
-
* stream test, where a robot--move outlived the framework; the race itself
|
|
8
|
-
* is older than #256):
|
|
9
|
-
* - a tool's result that arrives after stop() is logged and dropped: the
|
|
10
|
-
* queue that would carry it to its stream is closed, stop() is ending
|
|
11
|
-
* the streams, and the tool has already run. Before, its
|
|
12
|
-
* push threw "Queue is closed", the throw was misreported as the tool's
|
|
13
|
-
* failure, and that failure's push threw again, unhandled;
|
|
14
|
-
* - a server's push, incoming message or other request the host can't
|
|
15
|
-
* take any more is answered with a JSON-RPC error (-32000, "the host is
|
|
16
|
-
* stopping"), never "accepted", and never thrown out of the
|
|
17
|
-
* connection's listener; a handler's own fault is answered -32603.
|
|
18
|
-
* Any other event pushed to a stopped framework still throws to its caller.
|
|
19
|
-
* Each test waits on the event it needs (a log line, an answer), not on a
|
|
20
|
-
* fixed delay, and then one more turn, so a late rejection would be seen.
|
|
21
|
-
*/
|
|
22
|
-
import { describe, it, beforeEach, afterEach } from 'node:test';
|
|
23
|
-
import assert from 'node:assert/strict';
|
|
24
|
-
import { EventEmitter } from 'node:events';
|
|
25
|
-
import { mkdtempSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs';
|
|
26
|
-
import { tmpdir } from 'node:os';
|
|
27
|
-
import { join } from 'node:path';
|
|
28
|
-
import { fileURLToPath } from 'node:url';
|
|
29
|
-
import ts from 'typescript';
|
|
30
|
-
import { AgentFramework } from '../src/index.js';
|
|
31
|
-
import { MockMembrane, createMockResponse } from './helpers/mock-membrane.js';
|
|
32
|
-
/** Resolve once `cond` holds, polling each turn; fail, naming `what`, after `ms`. */
|
|
33
|
-
async function until(cond, what, ms = 5000) {
|
|
34
|
-
const deadline = Date.now() + ms;
|
|
35
|
-
while (!cond()) {
|
|
36
|
-
if (Date.now() > deadline)
|
|
37
|
-
throw new Error(`timed out waiting for ${what}`);
|
|
38
|
-
await new Promise((r) => setImmediate(r));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/** One more turn of the event loop: an unhandled rejection is reported by then. */
|
|
42
|
-
const turn = () => new Promise((r) => setImmediate(() => setImmediate(r)));
|
|
43
|
-
/** A tool that settles only when the test says so, so the test owns the work it started. */
|
|
44
|
-
class SlowModule {
|
|
45
|
-
name = 'slow';
|
|
46
|
-
settle = null;
|
|
47
|
-
started;
|
|
48
|
-
markStarted;
|
|
49
|
-
constructor() {
|
|
50
|
-
this.started = new Promise((r) => { this.markStarted = r; });
|
|
51
|
-
}
|
|
52
|
-
async start(_ctx) { }
|
|
53
|
-
async stop() { }
|
|
54
|
-
getTools() {
|
|
55
|
-
return [{ name: 'work', description: 'Slow work', inputSchema: { type: 'object', properties: {} } }];
|
|
56
|
-
}
|
|
57
|
-
handleToolCall(_call) {
|
|
58
|
-
return new Promise((resolve, reject) => {
|
|
59
|
-
this.settle = { resolve, reject };
|
|
60
|
-
this.markStarted();
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Settle the running call. The caller waits for what it expects to follow
|
|
65
|
-
* (the drop's log line); this returns at once.
|
|
66
|
-
* - success: { success: true }
|
|
67
|
-
* - failure: the module throws (the registry answers an error result)
|
|
68
|
-
* - isError: { success: true, isError: true }, a result that reports an error
|
|
69
|
-
* - bare-failure: { success: false } with no error text
|
|
70
|
-
* - long-failure: the module throws a 5,000-character error
|
|
71
|
-
*/
|
|
72
|
-
finish(outcome) {
|
|
73
|
-
if (outcome === 'success')
|
|
74
|
-
this.settle.resolve({ success: true, data: { done: true } });
|
|
75
|
-
else if (outcome === 'isError')
|
|
76
|
-
this.settle.resolve({ success: true, isError: true, data: { done: false } });
|
|
77
|
-
else if (outcome === 'bare-failure')
|
|
78
|
-
this.settle.resolve({ success: false });
|
|
79
|
-
else if (outcome === 'long-failure')
|
|
80
|
-
this.settle.reject(new Error('x'.repeat(5000)));
|
|
81
|
-
else
|
|
82
|
-
this.settle.reject(new Error('the work failed'));
|
|
83
|
-
}
|
|
84
|
-
async onProcess(event, _state) {
|
|
85
|
-
if (event.type === 'external-message') {
|
|
86
|
-
return {
|
|
87
|
-
addMessages: [{ participant: 'User', content: [{ type: 'text', text: String(event.content) }] }],
|
|
88
|
-
requestInference: true,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
return {};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
describe('stop() with work still in flight', () => {
|
|
95
|
-
let tempDir;
|
|
96
|
-
let rejections;
|
|
97
|
-
let logged;
|
|
98
|
-
const onRejection = (reason) => { rejections.push(reason); };
|
|
99
|
-
const consoleError = console.error;
|
|
100
|
-
beforeEach(() => {
|
|
101
|
-
tempDir = mkdtempSync(join(tmpdir(), 'af-stop-in-flight-'));
|
|
102
|
-
rejections = [];
|
|
103
|
-
logged = [];
|
|
104
|
-
process.on('unhandledRejection', onRejection);
|
|
105
|
-
console.error = (...args) => { logged.push(args.map(String).join(' ')); };
|
|
106
|
-
});
|
|
107
|
-
afterEach(() => {
|
|
108
|
-
console.error = consoleError;
|
|
109
|
-
process.off('unhandledRejection', onRejection);
|
|
110
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
111
|
-
});
|
|
112
|
-
const dropped = () => logged.filter((line) => line.includes('arrived after stop'));
|
|
113
|
-
async function frameworkWithRunningTool(opts = {}) {
|
|
114
|
-
const membrane = new MockMembrane();
|
|
115
|
-
membrane.pushResponse(createMockResponse([
|
|
116
|
-
{ type: 'text', text: 'Working on it.' },
|
|
117
|
-
{ type: 'tool_use', id: 'c1', name: 'slow--work', input: {} },
|
|
118
|
-
], 'tool_use'));
|
|
119
|
-
membrane.pushResponse(createMockResponse([{ type: 'text', text: 'Never written.' }]));
|
|
120
|
-
const module = new SlowModule();
|
|
121
|
-
const framework = await AgentFramework.create({
|
|
122
|
-
storePath: join(tempDir, 'store'),
|
|
123
|
-
membrane: membrane.asMembrane(),
|
|
124
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'test' }],
|
|
125
|
-
modules: [module],
|
|
126
|
-
});
|
|
127
|
-
const failed = [];
|
|
128
|
-
framework.onTrace((e) => {
|
|
129
|
-
if (e.type === 'tool:failed')
|
|
130
|
-
failed.push(String(e.tool));
|
|
131
|
-
});
|
|
132
|
-
if (opts.dispatch === 'rejects') {
|
|
133
|
-
// The module registry turns a module's throw into an error result; this
|
|
134
|
-
// is the dispatch itself rejecting (the host got no result at all).
|
|
135
|
-
const registry = framework.moduleRegistry;
|
|
136
|
-
const handle = registry.handleToolCall.bind(registry);
|
|
137
|
-
registry.handleToolCall = (call) => handle(call).then(() => { throw new Error('the dispatch was lost'); });
|
|
138
|
-
}
|
|
139
|
-
framework.start();
|
|
140
|
-
framework.pushEvent({ type: 'external-message', source: 'test', content: 'go', metadata: {} });
|
|
141
|
-
await module.started;
|
|
142
|
-
return { framework, module, failed };
|
|
143
|
-
}
|
|
144
|
-
/** Wait for the drop's log line, then a turn, so a late rejection would be seen. */
|
|
145
|
-
async function droppedLine() {
|
|
146
|
-
await until(() => dropped().length > 0, 'the drop log line');
|
|
147
|
-
await turn();
|
|
148
|
-
assert.equal(dropped().length, 1, logged.join('\n'));
|
|
149
|
-
return dropped()[0];
|
|
150
|
-
}
|
|
151
|
-
it('a tool that succeeds after stop() has its result dropped, not thrown or misreported as a failure', async () => {
|
|
152
|
-
const { framework, module, failed } = await frameworkWithRunningTool();
|
|
153
|
-
await framework.stop();
|
|
154
|
-
module.finish('success');
|
|
155
|
-
const line = await droppedLine();
|
|
156
|
-
assert.deepEqual(rejections, []);
|
|
157
|
-
assert.deepEqual(failed, [], 'the tool succeeded; nothing reports it as a failure');
|
|
158
|
-
// The drop names the tool and that it succeeded: what an operator needs
|
|
159
|
-
// to reconcile a result nothing could take.
|
|
160
|
-
assert.match(line, /tool call c1 \(slow--work, slow\)/, line);
|
|
161
|
-
assert.match(line, /the tool succeeded$/, line);
|
|
162
|
-
});
|
|
163
|
-
it('a tool that fails after stop() has its error result dropped, not thrown', async () => {
|
|
164
|
-
const { framework, module, failed } = await frameworkWithRunningTool();
|
|
165
|
-
await framework.stop();
|
|
166
|
-
module.finish('failure');
|
|
167
|
-
const line = await droppedLine();
|
|
168
|
-
assert.deepEqual(rejections, []);
|
|
169
|
-
assert.deepEqual(failed, [], 'the registry answers a module throw with an error result');
|
|
170
|
-
assert.match(line, /the tool failed: /, line);
|
|
171
|
-
});
|
|
172
|
-
it("a tool's long error is bounded in the drop's log line", async () => {
|
|
173
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
174
|
-
await framework.stop();
|
|
175
|
-
module.finish('long-failure');
|
|
176
|
-
const line = await droppedLine();
|
|
177
|
-
assert.ok(line.length < 800, `logged ${line.length} characters`);
|
|
178
|
-
assert.match(line, /the tool failed: x+… \(5000 characters\)$/, line);
|
|
179
|
-
assert.deepEqual(rejections, []);
|
|
180
|
-
});
|
|
181
|
-
it('a result that reports an error is dropped as failed, and a failure with no text says only that', async () => {
|
|
182
|
-
// { success: true, isError: true } is a failure: the drop must not call it a success.
|
|
183
|
-
{
|
|
184
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
185
|
-
await framework.stop();
|
|
186
|
-
module.finish('isError');
|
|
187
|
-
const line = await droppedLine();
|
|
188
|
-
assert.match(line, /the tool failed$/, line);
|
|
189
|
-
logged.length = 0;
|
|
190
|
-
}
|
|
191
|
-
{
|
|
192
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
193
|
-
await framework.stop();
|
|
194
|
-
module.finish('bare-failure');
|
|
195
|
-
const line = await droppedLine();
|
|
196
|
-
assert.match(line, /the tool failed$/, line);
|
|
197
|
-
}
|
|
198
|
-
assert.deepEqual(rejections, []);
|
|
199
|
-
});
|
|
200
|
-
it('a dispatch that rejects after stop() is reported as failed, and its failure result dropped, not thrown', async () => {
|
|
201
|
-
const { framework, module, failed } = await frameworkWithRunningTool({ dispatch: 'rejects' });
|
|
202
|
-
await framework.stop();
|
|
203
|
-
module.finish('success');
|
|
204
|
-
const line = await droppedLine();
|
|
205
|
-
assert.deepEqual(rejections, []);
|
|
206
|
-
assert.equal(failed.length, 1, 'the host got no result: a dispatch failure');
|
|
207
|
-
assert.match(line, /tool call c1 \(slow--work, slow\)/, line);
|
|
208
|
-
assert.match(line, /the tool failed: .*the dispatch was lost/, line);
|
|
209
|
-
});
|
|
210
|
-
it('any other event pushed to a stopped framework still throws to its caller', async () => {
|
|
211
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
212
|
-
await framework.stop();
|
|
213
|
-
assert.throws(() => framework.pushEvent({ type: 'external-message', source: 'test', content: 'too late', metadata: {} }), /Queue is closed/);
|
|
214
|
-
module.finish('success');
|
|
215
|
-
await droppedLine();
|
|
216
|
-
assert.deepEqual(rejections, []);
|
|
217
|
-
});
|
|
218
|
-
describe("tune-out's subconscious tools", () => {
|
|
219
|
-
/** A framework whose tune-out coordinator is a stand-in that settles when the test says. */
|
|
220
|
-
async function withTuneOut() {
|
|
221
|
-
const framework = await AgentFramework.create({
|
|
222
|
-
storePath: join(tempDir, 'store'),
|
|
223
|
-
membrane: new MockMembrane().asMembrane(),
|
|
224
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'test' }],
|
|
225
|
-
modules: [],
|
|
226
|
-
});
|
|
227
|
-
let settle;
|
|
228
|
-
const fw = framework;
|
|
229
|
-
fw.tuneOutCoordinator = {
|
|
230
|
-
handleSubconsciousTool: () => new Promise((resolve, reject) => { settle = { resolve, reject }; }),
|
|
231
|
-
stop: () => { },
|
|
232
|
-
};
|
|
233
|
-
fw.subconsciousAgentName = 'assistant';
|
|
234
|
-
const pushed = [];
|
|
235
|
-
const push = framework.pushEvent.bind(framework);
|
|
236
|
-
framework.pushEvent = (event) => { pushed.push(event); push(event); };
|
|
237
|
-
fw.dispatchToolCall('assistant', { id: 't1', name: 'deliver_summary', input: {} });
|
|
238
|
-
return { framework, settle: () => settle, pushed };
|
|
239
|
-
}
|
|
240
|
-
it('a result that arrives after stop() is dropped and logged with its tool, not thrown', async () => {
|
|
241
|
-
const { framework, settle } = await withTuneOut();
|
|
242
|
-
await framework.stop();
|
|
243
|
-
settle().resolve({ success: true, data: { delivered: true } });
|
|
244
|
-
const line = await droppedLine();
|
|
245
|
-
assert.match(line, /tool call t1 \(deliver_summary, tune-out\)/, line);
|
|
246
|
-
assert.match(line, /the tool succeeded$/, line);
|
|
247
|
-
assert.deepEqual(rejections, []);
|
|
248
|
-
});
|
|
249
|
-
it('a handler that rejects is answered with a failed result, never left unhandled', async () => {
|
|
250
|
-
const { framework, settle, pushed } = await withTuneOut();
|
|
251
|
-
try {
|
|
252
|
-
settle().reject(new Error('the summary failed'));
|
|
253
|
-
await until(() => pushed.length > 0, 'the failed result');
|
|
254
|
-
await turn();
|
|
255
|
-
const result = pushed[0].result;
|
|
256
|
-
assert.deepEqual(result, { success: false, error: 'the summary failed', isError: true });
|
|
257
|
-
assert.deepEqual(rejections, []);
|
|
258
|
-
}
|
|
259
|
-
finally {
|
|
260
|
-
await framework.stop();
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
it('every tool result the framework produces names its tool, and the call it answers', () => {
|
|
265
|
-
// The drop's log line names the tool from the event's toolName, so a
|
|
266
|
-
// producer that leaves it out logs a drop nobody can reconcile, and one
|
|
267
|
-
// that names another call's tool misleads whoever reconciles it. Every
|
|
268
|
-
// object literal in src whose `type` is the string 'tool-result' (in any
|
|
269
|
-
// quoting) carries toolName, and where its callId and toolName both read
|
|
270
|
-
// a call (`X.id`, `Y.name`), they read the same one. Read as TypeScript's
|
|
271
|
-
// syntax tree, not as text, so no spelling of the literal escapes the check.
|
|
272
|
-
const src = fileURLToPath(new URL('../../src/', import.meta.url));
|
|
273
|
-
const files = [];
|
|
274
|
-
const walk = (dir) => {
|
|
275
|
-
for (const name of readdirSync(dir)) {
|
|
276
|
-
const full = join(dir, name);
|
|
277
|
-
if (statSync(full).isDirectory())
|
|
278
|
-
walk(full);
|
|
279
|
-
else if (name.endsWith('.ts'))
|
|
280
|
-
files.push(full);
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
walk(src);
|
|
284
|
-
const nameOf = (n) => ts.isIdentifier(n) || ts.isStringLiteral(n) || ts.isNoSubstitutionTemplateLiteral(n) ? n.text : undefined;
|
|
285
|
-
const isToolResult = (e) => {
|
|
286
|
-
while (ts.isAsExpression(e) || ts.isSatisfiesExpression(e) || ts.isParenthesizedExpression(e))
|
|
287
|
-
e = e.expression;
|
|
288
|
-
return (ts.isStringLiteral(e) || ts.isNoSubstitutionTemplateLiteral(e)) && e.text === 'tool-result';
|
|
289
|
-
};
|
|
290
|
-
// The call an `X.id` or `X.name` reads, as source text (`call`, `tc`).
|
|
291
|
-
const callRead = (p, field) => {
|
|
292
|
-
if (!p || !ts.isPropertyAssignment(p))
|
|
293
|
-
return undefined;
|
|
294
|
-
const e = p.initializer;
|
|
295
|
-
return ts.isPropertyAccessExpression(e) && e.name.text === field ? e.expression.getText() : undefined;
|
|
296
|
-
};
|
|
297
|
-
const missing = [];
|
|
298
|
-
const mismatched = [];
|
|
299
|
-
let literals = 0;
|
|
300
|
-
let paired = 0;
|
|
301
|
-
for (const file of files) {
|
|
302
|
-
const sf = ts.createSourceFile(file, readFileSync(file, 'utf8'), ts.ScriptTarget.Latest, true);
|
|
303
|
-
const visit = (node) => {
|
|
304
|
-
if (ts.isObjectLiteralExpression(node)) {
|
|
305
|
-
const type = node.properties.find((p) => ts.isPropertyAssignment(p) && nameOf(p.name) === 'type');
|
|
306
|
-
if (type && ts.isPropertyAssignment(type) && isToolResult(type.initializer)) {
|
|
307
|
-
literals++;
|
|
308
|
-
const where = `${file.slice(src.length)}:${sf.getLineAndCharacterOfPosition(node.getStart()).line + 1}`;
|
|
309
|
-
const property = (name) => node.properties.find((p) => (ts.isPropertyAssignment(p) || ts.isShorthandPropertyAssignment(p)) && nameOf(p.name) === name);
|
|
310
|
-
const toolName = property('toolName');
|
|
311
|
-
if (!toolName)
|
|
312
|
-
missing.push(where);
|
|
313
|
-
const idOf = callRead(property('callId'), 'id');
|
|
314
|
-
const nameFrom = callRead(toolName, 'name');
|
|
315
|
-
if (idOf !== undefined && nameFrom !== undefined) {
|
|
316
|
-
paired++;
|
|
317
|
-
if (idOf !== nameFrom)
|
|
318
|
-
mismatched.push(`${where}: callId reads ${idOf}, toolName reads ${nameFrom}`);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
ts.forEachChild(node, visit);
|
|
323
|
-
};
|
|
324
|
-
visit(sf);
|
|
325
|
-
}
|
|
326
|
-
assert.ok(literals > 20, `found ${literals} tool-result literals; the scan has lost them`);
|
|
327
|
-
assert.deepEqual(missing, [], 'tool-result events without toolName');
|
|
328
|
-
assert.ok(paired > 20, `paired ${paired} callId/toolName reads; the pairing has lost them`);
|
|
329
|
-
assert.deepEqual(mismatched, [], "tool-result events naming another call's tool");
|
|
330
|
-
});
|
|
331
|
-
describe('a server sending while the host stops', () => {
|
|
332
|
-
async function wiredFramework() {
|
|
333
|
-
const framework = await AgentFramework.create({
|
|
334
|
-
storePath: join(tempDir, 'store'),
|
|
335
|
-
membrane: new MockMembrane().asMembrane(),
|
|
336
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'test' }],
|
|
337
|
-
modules: [],
|
|
338
|
-
});
|
|
339
|
-
const connection = Object.assign(new EventEmitter(), { id: 'srv' });
|
|
340
|
-
framework.wireMcplEvents(connection);
|
|
341
|
-
return { framework, connection };
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Put a stand-in in for every request listener's handler, each calling
|
|
345
|
-
* `handler` with what it was given: the push handler, the channel
|
|
346
|
-
* registry's three, the inference router and the host-command handler.
|
|
347
|
-
*/
|
|
348
|
-
function standIns(framework, handler) {
|
|
349
|
-
const fw = framework;
|
|
350
|
-
fw.pushHandler = { handlePushEvent: handler };
|
|
351
|
-
fw.channelRegistry = { handleIncoming: handler, handleRegister: handler, handleChanged: handler, stopAll: () => { } };
|
|
352
|
-
fw.inferenceRouter = { handleInferenceRequest: handler };
|
|
353
|
-
fw.handleHostCommand = handler;
|
|
354
|
-
}
|
|
355
|
-
/** Every request listener: its event, its method, and parameters it takes. */
|
|
356
|
-
const requests = [
|
|
357
|
-
['push-event', 'push/event', { featureSet: 'chat', eventId: 'e20', payload: { content: [{ type: 'text', text: 'x' }] } }],
|
|
358
|
-
['channels-incoming', 'channels/incoming', { messages: [{ channelId: 'c', messageId: 'm20', content: [] }] }],
|
|
359
|
-
['channels-register', 'channels/register', { channels: [] }],
|
|
360
|
-
['channels-changed', 'channels/changed', { added: [] }],
|
|
361
|
-
['inference-request', 'inference/request', { messages: [] }],
|
|
362
|
-
['host-command', 'host/command', { command: 'undo' }],
|
|
363
|
-
];
|
|
364
|
-
/**
|
|
365
|
-
* A server's responder, recording each answer.
|
|
366
|
-
* - throws: respondError records its answer, then throws (the connection is going).
|
|
367
|
-
* - serializes: respond serializes the result before it records it, as the
|
|
368
|
-
* connection's sendResponse does, so a result JSON can't hold throws.
|
|
369
|
-
*/
|
|
370
|
-
function responder(opts = {}) {
|
|
371
|
-
const answers = [];
|
|
372
|
-
return {
|
|
373
|
-
id: 7,
|
|
374
|
-
answers,
|
|
375
|
-
respond: (result) => {
|
|
376
|
-
if (opts.serializes)
|
|
377
|
-
JSON.stringify(result);
|
|
378
|
-
answers.push({ result });
|
|
379
|
-
},
|
|
380
|
-
respondError: (code, message) => {
|
|
381
|
-
answers.push({ error: { code, message } });
|
|
382
|
-
if (opts.throws)
|
|
383
|
-
throw new Error('the connection is gone');
|
|
384
|
-
},
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
/** Wait until each responder has its answer, then a turn. */
|
|
388
|
-
async function answered(...rs) {
|
|
389
|
-
await until(() => rs.every((r) => r.answers.length > 0), 'every answer');
|
|
390
|
-
await turn();
|
|
391
|
-
}
|
|
392
|
-
const stopping = { error: { code: -32000, message: 'the host is stopping' } };
|
|
393
|
-
it('a push, incoming message or other request after stop() is answered -32000, never handled or accepted', async () => {
|
|
394
|
-
const { framework, connection } = await wiredFramework();
|
|
395
|
-
await framework.stop();
|
|
396
|
-
// Stand-in handlers, put in after stop() (which stops the real registry): every arrival below comes later.
|
|
397
|
-
let handled = 0;
|
|
398
|
-
standIns(framework, async () => { handled++; return {}; });
|
|
399
|
-
const push = responder();
|
|
400
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e1', payload: { content: [{ type: 'text', text: 'late' }] } }, push);
|
|
401
|
-
const incoming = responder();
|
|
402
|
-
connection.emit('channels-incoming', { messages: [{ channelId: 'c', messageId: 'm', content: [] }] }, incoming);
|
|
403
|
-
const register = responder();
|
|
404
|
-
connection.emit('channels-register', { channels: [] }, register);
|
|
405
|
-
const changed = responder();
|
|
406
|
-
connection.emit('channels-changed', { added: [] }, changed);
|
|
407
|
-
const inference = responder();
|
|
408
|
-
connection.emit('inference-request', { messages: [] }, inference);
|
|
409
|
-
const command = responder();
|
|
410
|
-
connection.emit('host-command', { command: 'undo' }, command);
|
|
411
|
-
await answered(push, incoming, register, changed, inference, command);
|
|
412
|
-
assert.equal(handled, 0, 'never handed to a handler, which would record it as accepted or act on it');
|
|
413
|
-
for (const r of [push, incoming, register, changed, inference, command])
|
|
414
|
-
assert.deepEqual(r.answers, [stopping]);
|
|
415
|
-
assert.deepEqual(rejections, []);
|
|
416
|
-
});
|
|
417
|
-
for (const [event, method, params] of [
|
|
418
|
-
['push-event', 'push/event', { featureSet: 'chat', eventId: 'e2', payload: { content: [{ type: 'text', text: 'waiting' }] } }],
|
|
419
|
-
['channels-incoming', 'channels/incoming', { messages: [{ channelId: 'c', messageId: 'm2', content: [] }] }],
|
|
420
|
-
['inference-request', 'inference/request', { messages: [] }],
|
|
421
|
-
['host-command', 'host/command', { command: 'undo' }],
|
|
422
|
-
]) {
|
|
423
|
-
it(`a ${method} held at the awareness barrier while the host stops is refused once the barrier lifts`, async () => {
|
|
424
|
-
const { framework, connection } = await wiredFramework();
|
|
425
|
-
let lift;
|
|
426
|
-
framework.discordAwarenessBarrier = {
|
|
427
|
-
promise: new Promise((r) => { lift = r; }),
|
|
428
|
-
};
|
|
429
|
-
let handled = 0;
|
|
430
|
-
standIns(framework, async () => { handled++; return {}; });
|
|
431
|
-
const r = responder();
|
|
432
|
-
connection.emit(event, params, r);
|
|
433
|
-
await framework.stop();
|
|
434
|
-
lift();
|
|
435
|
-
await answered(r);
|
|
436
|
-
assert.equal(handled, 0);
|
|
437
|
-
assert.deepEqual(r.answers, [stopping]);
|
|
438
|
-
assert.ok(logged.some((line) => line.includes(`${method} from srv refused: the host is stopping`)), logged.join('\n'));
|
|
439
|
-
assert.deepEqual(rejections, []);
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
it('a handler running when the host stops, and then failing, is answered -32000 with its own message', async () => {
|
|
443
|
-
const { framework, connection } = await wiredFramework();
|
|
444
|
-
let release;
|
|
445
|
-
const gate = new Promise((r) => { release = r; });
|
|
446
|
-
framework.pushHandler = {
|
|
447
|
-
handlePushEvent: async () => { await gate; throw new Error('Queue is closed'); },
|
|
448
|
-
};
|
|
449
|
-
const push = responder();
|
|
450
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e6', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
451
|
-
await framework.stop();
|
|
452
|
-
release();
|
|
453
|
-
await answered(push);
|
|
454
|
-
const reason = 'the host stopped while handling this request (Queue is closed)';
|
|
455
|
-
assert.deepEqual(push.answers, [{ error: { code: -32000, message: reason } }]);
|
|
456
|
-
assert.ok(logged.some((line) => line.includes(`push/event from srv failed: ${reason} (part of it may already have been admitted)`)), logged.join('\n'));
|
|
457
|
-
assert.deepEqual(rejections, []);
|
|
458
|
-
});
|
|
459
|
-
it('a handler that throws is answered -32603 with its error, not rejected into the listener; a notification is only logged', async () => {
|
|
460
|
-
const { framework, connection } = await wiredFramework();
|
|
461
|
-
try {
|
|
462
|
-
framework.pushHandler = {
|
|
463
|
-
handlePushEvent: async (_s, params) => { throw new Error(`the handler broke on ${params.eventId}`); },
|
|
464
|
-
};
|
|
465
|
-
const push = responder();
|
|
466
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e3', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
467
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e4', payload: { content: [{ type: 'text', text: 'y' }] } });
|
|
468
|
-
await answered(push);
|
|
469
|
-
await until(() => logged.some((line) => line.includes('the handler broke on e4')), "the notification's log line");
|
|
470
|
-
assert.deepEqual(push.answers, [{ error: { code: -32603, message: 'the handler broke on e3' } }]);
|
|
471
|
-
assert.ok(logged.some((line) => line.includes('push/event from srv failed: the handler broke on e4 (part of it may already have been admitted)')), logged.join('\n'));
|
|
472
|
-
assert.deepEqual(rejections, []);
|
|
473
|
-
}
|
|
474
|
-
finally {
|
|
475
|
-
await framework.stop();
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
it('a handler that rejects with nothing, a string or an unprintable value is a failed request, not a stopping refusal', async () => {
|
|
479
|
-
const { framework, connection } = await wiredFramework();
|
|
480
|
-
try {
|
|
481
|
-
const fw = framework;
|
|
482
|
-
// A revoked Proxy throws on instanceof itself; an Error whose message is a number has no slice.
|
|
483
|
-
const revoked = Proxy.revocable({}, {});
|
|
484
|
-
revoked.revoke();
|
|
485
|
-
const numbered = new Error('placeholder');
|
|
486
|
-
Object.defineProperty(numbered, 'message', { value: 42 });
|
|
487
|
-
// An Error whose message getter throws: reading it is itself guarded.
|
|
488
|
-
const unreadable = new Error('placeholder');
|
|
489
|
-
Object.defineProperty(unreadable, 'message', { get() { throw new Error('the message getter broke'); } });
|
|
490
|
-
const thrown = {
|
|
491
|
-
e5: undefined, e7: 'a plain string', e8: Object.create(null), e12: revoked.proxy, e13: numbered, e14: unreadable,
|
|
492
|
-
};
|
|
493
|
-
fw.pushHandler = {
|
|
494
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
495
|
-
handlePushEvent: (_s, params) => Promise.reject(thrown[params.eventId]),
|
|
496
|
-
};
|
|
497
|
-
fw.channelRegistry = { handleIncoming: async () => { throw undefined; }, stopAll: () => { } };
|
|
498
|
-
const answersFor = (eventId) => {
|
|
499
|
-
const r = responder();
|
|
500
|
-
connection.emit('push-event', { featureSet: 'chat', eventId, payload: { content: [{ type: 'text', text: 'x' }] } }, r);
|
|
501
|
-
return r;
|
|
502
|
-
};
|
|
503
|
-
const e5 = answersFor('e5');
|
|
504
|
-
const e7 = answersFor('e7');
|
|
505
|
-
const e8 = answersFor('e8');
|
|
506
|
-
const e12 = answersFor('e12');
|
|
507
|
-
const e13 = answersFor('e13');
|
|
508
|
-
const e14 = answersFor('e14');
|
|
509
|
-
const incoming = responder();
|
|
510
|
-
connection.emit('channels-incoming', { messages: [{ channelId: 'c', messageId: 'm', content: [] }] }, incoming);
|
|
511
|
-
await answered(e5, e7, e8, e12, e13, e14, incoming);
|
|
512
|
-
assert.deepEqual(e5.answers, [{ error: { code: -32603, message: 'the handler failed' } }]);
|
|
513
|
-
assert.deepEqual(e7.answers, [{ error: { code: -32603, message: 'the handler failed: a plain string' } }]);
|
|
514
|
-
assert.deepEqual(e8.answers, [{ error: { code: -32603, message: 'the handler failed: (a value that could not be read)' } }]);
|
|
515
|
-
assert.deepEqual(e12.answers, [{ error: { code: -32603, message: 'the handler failed: (a value that could not be read)' } }]);
|
|
516
|
-
assert.deepEqual(e13.answers, [{ error: { code: -32603, message: '42' } }]);
|
|
517
|
-
assert.deepEqual(e14.answers, [{ error: { code: -32603, message: '(a value that could not be read)' } }]);
|
|
518
|
-
assert.deepEqual(incoming.answers, [{ error: { code: -32603, message: 'the handler failed' } }]);
|
|
519
|
-
assert.ok(!logged.some((line) => line.includes('refused')), 'a live host refuses nothing');
|
|
520
|
-
assert.deepEqual(rejections, []);
|
|
521
|
-
}
|
|
522
|
-
finally {
|
|
523
|
-
await framework.stop();
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
it('a long error is answered and logged bounded', async () => {
|
|
527
|
-
const { framework, connection } = await wiredFramework();
|
|
528
|
-
try {
|
|
529
|
-
framework.pushHandler = {
|
|
530
|
-
handlePushEvent: async () => { throw new Error('x'.repeat(5000)); },
|
|
531
|
-
};
|
|
532
|
-
const push = responder();
|
|
533
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e9', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
534
|
-
await answered(push);
|
|
535
|
-
const message = push.answers[0].error.message;
|
|
536
|
-
assert.ok(message.length < 600, `answered ${message.length} characters`);
|
|
537
|
-
assert.match(message, /… \(5000 characters\)$/);
|
|
538
|
-
}
|
|
539
|
-
finally {
|
|
540
|
-
await framework.stop();
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
it('a request the handler already answered is not answered again when the handler then throws', async () => {
|
|
544
|
-
const { framework, connection } = await wiredFramework();
|
|
545
|
-
try {
|
|
546
|
-
framework.pushHandler = {
|
|
547
|
-
handlePushEvent: async (_s, _p, r) => {
|
|
548
|
-
r.respond({ accepted: true });
|
|
549
|
-
throw new Error('the trace emit broke');
|
|
550
|
-
},
|
|
551
|
-
};
|
|
552
|
-
const push = responder();
|
|
553
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e10', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
554
|
-
await answered(push);
|
|
555
|
-
await until(() => logged.some((line) => line.includes('failed after it was answered')), 'the log line');
|
|
556
|
-
assert.deepEqual(push.answers, [{ result: { accepted: true } }]);
|
|
557
|
-
assert.ok(logged.some((line) => line.includes('push/event from srv failed after it was answered: the trace emit broke')), logged.join('\n'));
|
|
558
|
-
assert.deepEqual(rejections, []);
|
|
559
|
-
}
|
|
560
|
-
finally {
|
|
561
|
-
await framework.stop();
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
it("a handler's answer that throws, such as a result JSON can't hold, isn't counted, so the request still gets the listener's answer", async () => {
|
|
565
|
-
const { framework, connection } = await wiredFramework();
|
|
566
|
-
try {
|
|
567
|
-
standIns(framework, async (_s, _p, r) => {
|
|
568
|
-
r.respond({ accepted: true, sequence: 1n });
|
|
569
|
-
});
|
|
570
|
-
const push = responder({ serializes: true });
|
|
571
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e21', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
572
|
-
await answered(push);
|
|
573
|
-
assert.deepEqual(push.answers, [{ error: { code: -32603, message: 'Do not know how to serialize a BigInt' } }]);
|
|
574
|
-
assert.ok(!logged.some((line) => line.includes('failed after it was answered')), logged.join('\n'));
|
|
575
|
-
assert.deepEqual(rejections, []);
|
|
576
|
-
}
|
|
577
|
-
finally {
|
|
578
|
-
await framework.stop();
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
it('a handler that answers after its failure was answered is refused, so the server gets one response', async () => {
|
|
582
|
-
const { framework, connection } = await wiredFramework();
|
|
583
|
-
try {
|
|
584
|
-
standIns(framework, async (_s, _p, r) => {
|
|
585
|
-
setImmediate(() => r.respond({ accepted: true }));
|
|
586
|
-
throw new Error('the handler broke first');
|
|
587
|
-
});
|
|
588
|
-
const push = responder();
|
|
589
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e22', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
590
|
-
await answered(push);
|
|
591
|
-
await until(() => logged.some((line) => line.includes('a second answer (respond) was refused')), 'the refused second answer');
|
|
592
|
-
await turn();
|
|
593
|
-
assert.deepEqual(push.answers, [{ error: { code: -32603, message: 'the handler broke first' } }]);
|
|
594
|
-
assert.ok(logged.some((line) => line.includes('push/event from srv: a second answer (respond) was refused; the request was already answered')), logged.join('\n'));
|
|
595
|
-
assert.deepEqual(rejections, []);
|
|
596
|
-
}
|
|
597
|
-
finally {
|
|
598
|
-
await framework.stop();
|
|
599
|
-
}
|
|
600
|
-
});
|
|
601
|
-
it('a responder without respondError reaches the handler without one', async () => {
|
|
602
|
-
const { framework, connection } = await wiredFramework();
|
|
603
|
-
try {
|
|
604
|
-
let seen;
|
|
605
|
-
standIns(framework, async (_s, _p, r) => {
|
|
606
|
-
seen = typeof r.respondError;
|
|
607
|
-
r.respond({ results: [] });
|
|
608
|
-
});
|
|
609
|
-
const answers = [];
|
|
610
|
-
connection.emit('channels-incoming', { messages: [{ channelId: 'c', messageId: 'm23', content: [] }] }, {
|
|
611
|
-
id: 7, respond: (result) => { answers.push(result); },
|
|
612
|
-
});
|
|
613
|
-
await until(() => answers.length > 0, 'the answer');
|
|
614
|
-
await turn();
|
|
615
|
-
assert.equal(seen, 'undefined', "a handler checking for respondError takes its fallback");
|
|
616
|
-
assert.deepEqual(answers, [{ results: [] }]);
|
|
617
|
-
assert.deepEqual(rejections, []);
|
|
618
|
-
}
|
|
619
|
-
finally {
|
|
620
|
-
await framework.stop();
|
|
621
|
-
}
|
|
622
|
-
});
|
|
623
|
-
it("every request listener answers its handler's throw -32603 with its error, never rejecting into the listener", async () => {
|
|
624
|
-
const { framework, connection } = await wiredFramework();
|
|
625
|
-
try {
|
|
626
|
-
standIns(framework, async () => { throw new Error('the handler broke'); });
|
|
627
|
-
const answers = requests.map(([event, , params]) => {
|
|
628
|
-
const r = responder();
|
|
629
|
-
connection.emit(event, params, r);
|
|
630
|
-
return r;
|
|
631
|
-
});
|
|
632
|
-
await answered(...answers);
|
|
633
|
-
for (const [i, [, method]] of requests.entries()) {
|
|
634
|
-
assert.deepEqual(answers[i].answers, [{ error: { code: -32603, message: 'the handler broke' } }], method);
|
|
635
|
-
assert.ok(logged.some((line) => line.includes(`${method} from srv failed: the handler broke`)), `${method}:\n${logged.join('\n')}`);
|
|
636
|
-
}
|
|
637
|
-
assert.deepEqual(rejections, []);
|
|
638
|
-
}
|
|
639
|
-
finally {
|
|
640
|
-
await framework.stop();
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
it('an inference request during a render is refused -32600, and a throwing responder there is not rejected into the listener', async () => {
|
|
644
|
-
const { framework, connection } = await wiredFramework();
|
|
645
|
-
try {
|
|
646
|
-
const fw = framework;
|
|
647
|
-
const coalescer = fw.pushCoalescer;
|
|
648
|
-
fw.pushCoalescer = { isRendering: () => true, suspend: () => { }, flush: () => { } };
|
|
649
|
-
const inference = responder({ throws: true });
|
|
650
|
-
connection.emit('inference-request', { messages: [] }, inference);
|
|
651
|
-
await answered(inference);
|
|
652
|
-
assert.deepEqual(inference.answers, [{ error: { code: -32600, message: 'Cannot request inference while push/render is in progress' } }]);
|
|
653
|
-
assert.deepEqual(rejections, []);
|
|
654
|
-
fw.pushCoalescer = coalescer;
|
|
655
|
-
}
|
|
656
|
-
finally {
|
|
657
|
-
await framework.stop();
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
|
-
it('a responder that throws while answering is logged, never rejected into the listener', async () => {
|
|
661
|
-
const { framework, connection } = await wiredFramework();
|
|
662
|
-
await framework.stop();
|
|
663
|
-
const push = responder({ throws: true });
|
|
664
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e11', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
665
|
-
await answered(push);
|
|
666
|
-
assert.deepEqual(push.answers, [stopping]);
|
|
667
|
-
assert.ok(logged.some((line) => line.includes('push/event from srv refused: the host is stopping')), logged.join('\n'));
|
|
668
|
-
assert.deepEqual(rejections, []);
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
//# sourceMappingURL=stop-with-work-in-flight.test.js.map
|