@animalabs/agent-framework 0.22.2 → 0.22.4
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 +3 -1
- package/dist/src/agent.d.ts +77 -12
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +143 -41
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/mcp-server-core.js +1 -1
- package/dist/src/api/mcp-server-core.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +5 -1
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/api/types.d.ts +1 -1
- 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 +828 -88
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +5011 -1326
- 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/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +144 -6
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +424 -263
- 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/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/push-coalescer.d.ts +33 -11
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +52 -20
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +16 -9
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +18 -83
- 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 +47 -12
- 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/server-connection.d.ts +89 -10
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +405 -129
- 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/transport.d.ts +51 -2
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +114 -20
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +14 -3
- 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.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 +379 -143
- 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/disk-agreement.d.ts +32 -2
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +30 -2
- 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 +119 -23
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +793 -247
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +75 -8
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +174 -14
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts +58 -7
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +521 -56
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +18 -4
- 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/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/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 +3 -1
- package/dist/src/recovery/offline-branch.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/thinking-token-stamp.d.ts +12 -0
- package/dist/src/thinking-token-stamp.d.ts.map +1 -1
- package/dist/src/thinking-token-stamp.js +34 -3
- 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/types/agent.d.ts +17 -5
- 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 +21 -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 +23 -4
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +95 -6
- 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 +6 -4
- package/src/agent.ts +169 -41
- package/src/api/mcp-server-core.ts +1 -1
- package/src/api/server.ts +4 -1
- package/src/api/types.ts +1 -1
- 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 +5352 -1388
- package/src/gate/event-gate.ts +28 -3
- package/src/index.ts +11 -2
- package/src/mcpl/channel-registry.ts +517 -286
- 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/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/push-coalescer.ts +60 -24
- package/src/mcpl/push-handler.ts +20 -90
- package/src/mcpl/reference-fetcher.ts +71 -26
- package/src/mcpl/references.ts +81 -22
- package/src/mcpl/server-connection.ts +427 -132
- package/src/mcpl/server-registry.ts +15 -4
- package/src/mcpl/skip-reply-wake.ts +73 -0
- package/src/mcpl/transport.ts +120 -18
- package/src/mcpl/types.ts +14 -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 +391 -158
- 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 +51 -3
- package/src/modules/workspace/effects.ts +279 -35
- package/src/modules/workspace/index.ts +810 -260
- package/src/modules/workspace/observe.ts +194 -20
- package/src/modules/workspace/reconcile.ts +619 -64
- package/src/modules/workspace/types.ts +18 -4
- 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 +4 -1
- package/src/safe-slice.ts +9 -1
- package/src/thinking-token-stamp.ts +34 -3
- 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 +17 -7
- package/src/types/events.ts +17 -0
- package/src/types/framework.ts +21 -5
- package/src/types/inference-log.ts +1 -1
- package/src/types/module.ts +24 -4
- package/src/types/trace.ts +101 -6
- 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 -1598
- 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 -621
- 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 -371
- 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/discord-typing-keepalive.test.d.ts +0 -2
- package/dist/test/discord-typing-keepalive.test.d.ts.map +0 -1
- package/dist/test/discord-typing-keepalive.test.js +0 -77
- package/dist/test/discord-typing-keepalive.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 -1715
- 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 -74
- package/dist/test/helpers/coalescing-fixture.d.ts.map +0 -1
- package/dist/test/helpers/coalescing-fixture.js +0 -152
- 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/hide-then-turn.test.d.ts +0 -2
- package/dist/test/hide-then-turn.test.d.ts.map +0 -1
- package/dist/test/hide-then-turn.test.js +0 -101
- package/dist/test/hide-then-turn.test.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 -988
- 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 -387
- 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 -1202
- 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 -1827
- package/dist/test/maintenance-timer.test.js.map +0 -1
- package/dist/test/mcp-server-bin.test.d.ts +0 -2
- package/dist/test/mcp-server-bin.test.d.ts.map +0 -1
- package/dist/test/mcp-server-bin.test.js +0 -142
- package/dist/test/mcp-server-bin.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-coalesced-content-parity.test.d.ts +0 -2
- package/dist/test/mcpl-coalesced-content-parity.test.d.ts.map +0 -1
- package/dist/test/mcpl-coalesced-content-parity.test.js +0 -532
- package/dist/test/mcpl-coalesced-content-parity.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 -238
- 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-rejection-log-lines.test.d.ts +0 -2
- package/dist/test/mcpl-rejection-log-lines.test.d.ts.map +0 -1
- package/dist/test/mcpl-rejection-log-lines.test.js +0 -349
- package/dist/test/mcpl-rejection-log-lines.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-stderr-tail.test.d.ts +0 -2
- package/dist/test/mcpl-stderr-tail.test.d.ts.map +0 -1
- package/dist/test/mcpl-stderr-tail.test.js +0 -210
- package/dist/test/mcpl-stderr-tail.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-transport-close.test.d.ts +0 -2
- package/dist/test/mcpl-transport-close.test.d.ts.map +0 -1
- package/dist/test/mcpl-transport-close.test.js +0 -373
- package/dist/test/mcpl-transport-close.test.js.map +0 -1
- package/dist/test/mcpl-transport-spawn.test.d.ts +0 -2
- package/dist/test/mcpl-transport-spawn.test.d.ts.map +0 -1
- package/dist/test/mcpl-transport-spawn.test.js +0 -58
- package/dist/test/mcpl-transport-spawn.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 -259
- 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 -570
- 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 -595
- 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 -198
- package/dist/test/overbudget-drain-breaker.test.js.map +0 -1
- package/dist/test/pack-installs-alone.test.d.ts +0 -2
- package/dist/test/pack-installs-alone.test.d.ts.map +0 -1
- package/dist/test/pack-installs-alone.test.js +0 -284
- package/dist/test/pack-installs-alone.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 -16
- package/dist/test/physical-window-restart.test.d.ts.map +0 -1
- package/dist/test/physical-window-restart.test.js +0 -487
- 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 -1649
- 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 -2259
- 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 -226
- 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 -117
- 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-bump.test.d.ts +0 -2
- package/dist/test/release-bump.test.d.ts.map +0 -1
- package/dist/test/release-bump.test.js +0 -248
- package/dist/test/release-bump.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/release-holds.test.d.ts +0 -2
- package/dist/test/release-holds.test.d.ts.map +0 -1
- package/dist/test/release-holds.test.js +0 -456
- package/dist/test/release-holds.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-host-operations.test.d.ts +0 -20
- package/dist/test/stop-with-host-operations.test.d.ts.map +0 -1
- package/dist/test/stop-with-host-operations.test.js +0 -1174
- package/dist/test/stop-with-host-operations.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 -784
- 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 -3729
- 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 -652
- 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/unsent-compiles.test.d.ts +0 -2
- package/dist/test/unsent-compiles.test.d.ts.map +0 -1
- package/dist/test/unsent-compiles.test.js +0 -139
- package/dist/test/unsent-compiles.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 -4094
- 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,784 +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 { parse } from '@babel/parser';
|
|
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
|
-
/**
|
|
44
|
-
* The tool-result scan: in each source, every object literal whose `type`
|
|
45
|
-
* property is the string 'tool-result', read as a syntax tree (Babel's
|
|
46
|
-
* TypeScript parser) rather than as text, wherever the literal sits.
|
|
47
|
-
* - A property is read when it's written `key: value` or as a shorthand.
|
|
48
|
-
* Its key is an identifier, or a string in any quoting, computed or not; a
|
|
49
|
-
* computed key that isn't a string, a getter or a method, and a spread
|
|
50
|
-
* aren't read.
|
|
51
|
-
* - A value is read through `as`, `satisfies`, `<T>`, `!` and parentheses,
|
|
52
|
-
* and a string in any quoting, escapes included. A string built at run
|
|
53
|
-
* time, by a template with substitutions or by `+`, or held in a const,
|
|
54
|
-
* isn't read.
|
|
55
|
-
* Each literal must carry toolName. Where its callId reads a call's `id`
|
|
56
|
-
* and its toolName that call's `name`, as `X.id`, `X?.id` or `X['id']`
|
|
57
|
-
* through the same wrappers, they must read the same X, compared as source
|
|
58
|
-
* text. Any other callId or toolName (a string, a variable, a fallback with
|
|
59
|
-
* `??`) isn't compared.
|
|
60
|
-
*/
|
|
61
|
-
function scanToolResults(sources) {
|
|
62
|
-
const isNode = (v) => typeof v === 'object' && v !== null && typeof v.type === 'string';
|
|
63
|
-
const child = (n, field) => (n && isNode(n[field]) ? n[field] : undefined);
|
|
64
|
-
const unwrap = (e) => {
|
|
65
|
-
while (e && ['TSAsExpression', 'TSSatisfiesExpression', 'TSTypeAssertion', 'TSNonNullExpression'].includes(e.type)) {
|
|
66
|
-
e = child(e, 'expression');
|
|
67
|
-
}
|
|
68
|
-
return e;
|
|
69
|
-
};
|
|
70
|
-
// A string's text, in any quoting: '…', "…" or a template with no substitutions.
|
|
71
|
-
const stringOf = (e) => {
|
|
72
|
-
e = unwrap(e);
|
|
73
|
-
if (e?.type === 'StringLiteral')
|
|
74
|
-
return e.value;
|
|
75
|
-
if (e?.type === 'TemplateLiteral' && e.expressions.length === 0) {
|
|
76
|
-
return e.quasis[0].value.cooked;
|
|
77
|
-
}
|
|
78
|
-
return undefined;
|
|
79
|
-
};
|
|
80
|
-
// A property's name, however its key is written; a computed key that isn't a string has none.
|
|
81
|
-
const nameOf = (p) => {
|
|
82
|
-
const key = child(p, 'key');
|
|
83
|
-
return !p.computed && key?.type === 'Identifier' ? key.name : stringOf(key);
|
|
84
|
-
};
|
|
85
|
-
const literals = [];
|
|
86
|
-
const missing = [];
|
|
87
|
-
const mismatched = [];
|
|
88
|
-
let paired = 0;
|
|
89
|
-
for (const { name, text } of sources) {
|
|
90
|
-
let program;
|
|
91
|
-
try {
|
|
92
|
-
// Babel keeps no node for parentheses, so `(x)` reads as `x`.
|
|
93
|
-
program = parse(text, { sourceType: 'module', plugins: ['typescript'] }).program;
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
throw new Error(`${name}: ${error.message}`);
|
|
97
|
-
}
|
|
98
|
-
// The call an `X.id` or `X.name` reads, as X's source text (`call`, `tc`).
|
|
99
|
-
const callRead = (p, field) => {
|
|
100
|
-
const e = unwrap(child(p, 'value'));
|
|
101
|
-
if (e?.type !== 'MemberExpression' && e?.type !== 'OptionalMemberExpression')
|
|
102
|
-
return undefined;
|
|
103
|
-
const property = child(e, 'property');
|
|
104
|
-
const read = e.computed ? stringOf(property) : property?.type === 'Identifier' ? property.name : undefined;
|
|
105
|
-
const object = unwrap(child(e, 'object'));
|
|
106
|
-
return read === field && object ? text.slice(object.start, object.end) : undefined;
|
|
107
|
-
};
|
|
108
|
-
const visit = (node) => {
|
|
109
|
-
if (node.type === 'ObjectExpression') {
|
|
110
|
-
const properties = node.properties.filter((p) => p.type === 'ObjectProperty');
|
|
111
|
-
const type = properties.find((p) => nameOf(p) === 'type');
|
|
112
|
-
if (type && stringOf(child(type, 'value')) === 'tool-result') {
|
|
113
|
-
const where = `${name}:${node.loc.start.line}`;
|
|
114
|
-
literals.push(where);
|
|
115
|
-
const property = (field) => properties.find((p) => nameOf(p) === field);
|
|
116
|
-
const toolName = property('toolName');
|
|
117
|
-
if (!toolName)
|
|
118
|
-
missing.push(where);
|
|
119
|
-
const idOf = callRead(property('callId'), 'id');
|
|
120
|
-
const nameFrom = callRead(toolName, 'name');
|
|
121
|
-
if (idOf !== undefined && nameFrom !== undefined) {
|
|
122
|
-
paired++;
|
|
123
|
-
if (idOf !== nameFrom)
|
|
124
|
-
mismatched.push(`${where}: callId reads ${idOf}, toolName reads ${nameFrom}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
for (const value of Object.values(node)) {
|
|
129
|
-
if (Array.isArray(value)) {
|
|
130
|
-
for (const v of value)
|
|
131
|
-
if (isNode(v))
|
|
132
|
-
visit(v);
|
|
133
|
-
}
|
|
134
|
-
else if (isNode(value))
|
|
135
|
-
visit(value);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
visit(program);
|
|
139
|
-
}
|
|
140
|
-
return { literals, paired, missing, mismatched };
|
|
141
|
-
}
|
|
142
|
-
/** A tool that settles only when the test says so, so the test owns the work it started. */
|
|
143
|
-
class SlowModule {
|
|
144
|
-
name = 'slow';
|
|
145
|
-
settle = null;
|
|
146
|
-
started;
|
|
147
|
-
markStarted;
|
|
148
|
-
constructor() {
|
|
149
|
-
this.started = new Promise((r) => { this.markStarted = r; });
|
|
150
|
-
}
|
|
151
|
-
async start(_ctx) { }
|
|
152
|
-
async stop() { }
|
|
153
|
-
getTools() {
|
|
154
|
-
return [{ name: 'work', description: 'Slow work', inputSchema: { type: 'object', properties: {} } }];
|
|
155
|
-
}
|
|
156
|
-
handleToolCall(_call) {
|
|
157
|
-
return new Promise((resolve, reject) => {
|
|
158
|
-
this.settle = { resolve, reject };
|
|
159
|
-
this.markStarted();
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Settle the running call. The caller waits for what it expects to follow
|
|
164
|
-
* (the drop's log line); this returns at once.
|
|
165
|
-
* - success: { success: true }
|
|
166
|
-
* - failure: the module throws (the registry answers an error result)
|
|
167
|
-
* - isError: { success: true, isError: true }, a result that reports an error
|
|
168
|
-
* - bare-failure: { success: false } with no error text
|
|
169
|
-
* - long-failure: the module throws a 5,000-character error
|
|
170
|
-
*/
|
|
171
|
-
finish(outcome) {
|
|
172
|
-
if (outcome === 'success')
|
|
173
|
-
this.settle.resolve({ success: true, data: { done: true } });
|
|
174
|
-
else if (outcome === 'isError')
|
|
175
|
-
this.settle.resolve({ success: true, isError: true, data: { done: false } });
|
|
176
|
-
else if (outcome === 'bare-failure')
|
|
177
|
-
this.settle.resolve({ success: false });
|
|
178
|
-
else if (outcome === 'long-failure')
|
|
179
|
-
this.settle.reject(new Error('x'.repeat(5000)));
|
|
180
|
-
else
|
|
181
|
-
this.settle.reject(new Error('the work failed'));
|
|
182
|
-
}
|
|
183
|
-
async onProcess(event, _state) {
|
|
184
|
-
if (event.type === 'external-message') {
|
|
185
|
-
return {
|
|
186
|
-
addMessages: [{ participant: 'User', content: [{ type: 'text', text: String(event.content) }] }],
|
|
187
|
-
requestInference: true,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
return {};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
describe('stop() with work still in flight', () => {
|
|
194
|
-
let tempDir;
|
|
195
|
-
let rejections;
|
|
196
|
-
let logged;
|
|
197
|
-
const onRejection = (reason) => { rejections.push(reason); };
|
|
198
|
-
const consoleError = console.error;
|
|
199
|
-
beforeEach(() => {
|
|
200
|
-
tempDir = mkdtempSync(join(tmpdir(), 'af-stop-in-flight-'));
|
|
201
|
-
rejections = [];
|
|
202
|
-
logged = [];
|
|
203
|
-
process.on('unhandledRejection', onRejection);
|
|
204
|
-
console.error = (...args) => { logged.push(args.map(String).join(' ')); };
|
|
205
|
-
});
|
|
206
|
-
afterEach(() => {
|
|
207
|
-
console.error = consoleError;
|
|
208
|
-
process.off('unhandledRejection', onRejection);
|
|
209
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
210
|
-
});
|
|
211
|
-
const dropped = () => logged.filter((line) => line.includes('arrived after stop'));
|
|
212
|
-
async function frameworkWithRunningTool(opts = {}) {
|
|
213
|
-
const membrane = new MockMembrane();
|
|
214
|
-
membrane.pushResponse(createMockResponse([
|
|
215
|
-
{ type: 'text', text: 'Working on it.' },
|
|
216
|
-
{ type: 'tool_use', id: 'c1', name: 'slow--work', input: {} },
|
|
217
|
-
], 'tool_use'));
|
|
218
|
-
membrane.pushResponse(createMockResponse([{ type: 'text', text: 'Never written.' }]));
|
|
219
|
-
const module = new SlowModule();
|
|
220
|
-
const framework = await AgentFramework.create({
|
|
221
|
-
storePath: join(tempDir, 'store'),
|
|
222
|
-
membrane: membrane.asMembrane(),
|
|
223
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'test' }],
|
|
224
|
-
modules: [module],
|
|
225
|
-
});
|
|
226
|
-
const failed = [];
|
|
227
|
-
framework.onTrace((e) => {
|
|
228
|
-
if (e.type === 'tool:failed')
|
|
229
|
-
failed.push(String(e.tool));
|
|
230
|
-
});
|
|
231
|
-
if (opts.dispatch === 'rejects') {
|
|
232
|
-
// The module registry turns a module's throw into an error result; this
|
|
233
|
-
// is the dispatch itself rejecting (the host got no result at all).
|
|
234
|
-
const registry = framework.moduleRegistry;
|
|
235
|
-
const handle = registry.handleToolCall.bind(registry);
|
|
236
|
-
registry.handleToolCall = (call) => handle(call).then(() => { throw new Error('the dispatch was lost'); });
|
|
237
|
-
}
|
|
238
|
-
framework.start();
|
|
239
|
-
framework.pushEvent({ type: 'external-message', source: 'test', content: 'go', metadata: {} });
|
|
240
|
-
await module.started;
|
|
241
|
-
return { framework, module, failed };
|
|
242
|
-
}
|
|
243
|
-
/** Wait for the drop's log line, then a turn, so a late rejection would be seen. */
|
|
244
|
-
async function droppedLine() {
|
|
245
|
-
await until(() => dropped().length > 0, 'the drop log line');
|
|
246
|
-
await turn();
|
|
247
|
-
assert.equal(dropped().length, 1, logged.join('\n'));
|
|
248
|
-
return dropped()[0];
|
|
249
|
-
}
|
|
250
|
-
it('a tool that succeeds after stop() has its result dropped, not thrown or misreported as a failure', async () => {
|
|
251
|
-
const { framework, module, failed } = await frameworkWithRunningTool();
|
|
252
|
-
await framework.stop();
|
|
253
|
-
module.finish('success');
|
|
254
|
-
const line = await droppedLine();
|
|
255
|
-
assert.deepEqual(rejections, []);
|
|
256
|
-
assert.deepEqual(failed, [], 'the tool succeeded; nothing reports it as a failure');
|
|
257
|
-
// The drop names the tool and that it succeeded: what an operator needs
|
|
258
|
-
// to reconcile a result nothing could take.
|
|
259
|
-
assert.match(line, /tool call c1 \(slow--work, slow\)/, line);
|
|
260
|
-
assert.match(line, /the tool succeeded$/, line);
|
|
261
|
-
});
|
|
262
|
-
it('a tool that fails after stop() has its error result dropped, not thrown', async () => {
|
|
263
|
-
const { framework, module, failed } = await frameworkWithRunningTool();
|
|
264
|
-
await framework.stop();
|
|
265
|
-
module.finish('failure');
|
|
266
|
-
const line = await droppedLine();
|
|
267
|
-
assert.deepEqual(rejections, []);
|
|
268
|
-
assert.deepEqual(failed, [], 'the registry answers a module throw with an error result');
|
|
269
|
-
assert.match(line, /the tool failed: /, line);
|
|
270
|
-
});
|
|
271
|
-
it("a tool's long error is bounded in the drop's log line", async () => {
|
|
272
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
273
|
-
await framework.stop();
|
|
274
|
-
module.finish('long-failure');
|
|
275
|
-
const line = await droppedLine();
|
|
276
|
-
assert.ok(line.length < 800, `logged ${line.length} characters`);
|
|
277
|
-
assert.match(line, /the tool failed: x+… \(5000 characters\)$/, line);
|
|
278
|
-
assert.deepEqual(rejections, []);
|
|
279
|
-
});
|
|
280
|
-
it('a result that reports an error is dropped as failed, and a failure with no text says only that', async () => {
|
|
281
|
-
// { success: true, isError: true } is a failure: the drop must not call it a success.
|
|
282
|
-
{
|
|
283
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
284
|
-
await framework.stop();
|
|
285
|
-
module.finish('isError');
|
|
286
|
-
const line = await droppedLine();
|
|
287
|
-
assert.match(line, /the tool failed$/, line);
|
|
288
|
-
logged.length = 0;
|
|
289
|
-
}
|
|
290
|
-
{
|
|
291
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
292
|
-
await framework.stop();
|
|
293
|
-
module.finish('bare-failure');
|
|
294
|
-
const line = await droppedLine();
|
|
295
|
-
assert.match(line, /the tool failed$/, line);
|
|
296
|
-
}
|
|
297
|
-
assert.deepEqual(rejections, []);
|
|
298
|
-
});
|
|
299
|
-
it('a dispatch that rejects after stop() is reported as failed, and its failure result dropped, not thrown', async () => {
|
|
300
|
-
const { framework, module, failed } = await frameworkWithRunningTool({ dispatch: 'rejects' });
|
|
301
|
-
await framework.stop();
|
|
302
|
-
module.finish('success');
|
|
303
|
-
const line = await droppedLine();
|
|
304
|
-
assert.deepEqual(rejections, []);
|
|
305
|
-
assert.equal(failed.length, 1, 'the host got no result: a dispatch failure');
|
|
306
|
-
assert.match(line, /tool call c1 \(slow--work, slow\)/, line);
|
|
307
|
-
assert.match(line, /the tool failed: .*the dispatch was lost/, line);
|
|
308
|
-
});
|
|
309
|
-
it('any other event pushed to a stopped framework still throws to its caller', async () => {
|
|
310
|
-
const { framework, module } = await frameworkWithRunningTool();
|
|
311
|
-
await framework.stop();
|
|
312
|
-
assert.throws(() => framework.pushEvent({ type: 'external-message', source: 'test', content: 'too late', metadata: {} }), /Queue is closed/);
|
|
313
|
-
module.finish('success');
|
|
314
|
-
await droppedLine();
|
|
315
|
-
assert.deepEqual(rejections, []);
|
|
316
|
-
});
|
|
317
|
-
describe("tune-out's subconscious tools", () => {
|
|
318
|
-
/** A framework whose tune-out coordinator is a stand-in that settles when the test says. */
|
|
319
|
-
async function withTuneOut() {
|
|
320
|
-
const framework = await AgentFramework.create({
|
|
321
|
-
storePath: join(tempDir, 'store'),
|
|
322
|
-
membrane: new MockMembrane().asMembrane(),
|
|
323
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'test' }],
|
|
324
|
-
modules: [],
|
|
325
|
-
});
|
|
326
|
-
let settle;
|
|
327
|
-
const fw = framework;
|
|
328
|
-
fw.tuneOutCoordinator = {
|
|
329
|
-
handleSubconsciousTool: () => new Promise((resolve, reject) => { settle = { resolve, reject }; }),
|
|
330
|
-
stop: () => { },
|
|
331
|
-
};
|
|
332
|
-
fw.subconsciousAgentName = 'assistant';
|
|
333
|
-
const pushed = [];
|
|
334
|
-
const push = framework.pushEvent.bind(framework);
|
|
335
|
-
framework.pushEvent = (event) => { pushed.push(event); push(event); };
|
|
336
|
-
fw.dispatchToolCall('assistant', { id: 't1', name: 'deliver_summary', input: {} });
|
|
337
|
-
return { framework, settle: () => settle, pushed };
|
|
338
|
-
}
|
|
339
|
-
it('a result that arrives after stop() is dropped and logged with its tool, not thrown', async () => {
|
|
340
|
-
const { framework, settle } = await withTuneOut();
|
|
341
|
-
await framework.stop();
|
|
342
|
-
settle().resolve({ success: true, data: { delivered: true } });
|
|
343
|
-
const line = await droppedLine();
|
|
344
|
-
assert.match(line, /tool call t1 \(deliver_summary, tune-out\)/, line);
|
|
345
|
-
assert.match(line, /the tool succeeded$/, line);
|
|
346
|
-
assert.deepEqual(rejections, []);
|
|
347
|
-
});
|
|
348
|
-
it('a handler that rejects is answered with a failed result, never left unhandled', async () => {
|
|
349
|
-
const { framework, settle, pushed } = await withTuneOut();
|
|
350
|
-
try {
|
|
351
|
-
settle().reject(new Error('the summary failed'));
|
|
352
|
-
await until(() => pushed.length > 0, 'the failed result');
|
|
353
|
-
await turn();
|
|
354
|
-
const result = pushed[0].result;
|
|
355
|
-
assert.deepEqual(result, { success: false, error: 'the summary failed', isError: true });
|
|
356
|
-
assert.deepEqual(rejections, []);
|
|
357
|
-
}
|
|
358
|
-
finally {
|
|
359
|
-
await framework.stop();
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
it('every tool result the framework produces names its tool, and the call it answers', () => {
|
|
364
|
-
// The drop's log line names the tool from the event's toolName, so a
|
|
365
|
-
// producer that leaves it out logs a drop nobody can reconcile, and one
|
|
366
|
-
// that names another call's tool misleads whoever reconciles it. Every
|
|
367
|
-
// tool-result object literal in src carries toolName, and where its
|
|
368
|
-
// callId and toolName both read a call, they read the same one
|
|
369
|
-
// (scanToolResults, which the next test checks).
|
|
370
|
-
const src = fileURLToPath(new URL('../../src/', import.meta.url));
|
|
371
|
-
const sources = [];
|
|
372
|
-
const walk = (dir) => {
|
|
373
|
-
for (const name of readdirSync(dir)) {
|
|
374
|
-
const full = join(dir, name);
|
|
375
|
-
if (statSync(full).isDirectory())
|
|
376
|
-
walk(full);
|
|
377
|
-
else if (name.endsWith('.ts'))
|
|
378
|
-
sources.push({ name: full.slice(src.length), text: readFileSync(full, 'utf8') });
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
walk(src);
|
|
382
|
-
assert.ok(sources.some((s) => s.name.includes('/')), 'the walk reaches src\'s subdirectories');
|
|
383
|
-
const { literals, paired, missing, mismatched } = scanToolResults(sources);
|
|
384
|
-
assert.ok(literals.length > 20, `found ${literals.length} tool-result literals; the scan has lost them`);
|
|
385
|
-
assert.deepEqual(missing, [], 'tool-result events without toolName');
|
|
386
|
-
assert.ok(paired > 20, `paired ${paired} callId/toolName reads; the pairing has lost them`);
|
|
387
|
-
assert.deepEqual(mismatched, [], "tool-result events naming another call's tool");
|
|
388
|
-
});
|
|
389
|
-
it('the tool-result scan reads every way the literal can be written, and reports what it should', () => {
|
|
390
|
-
const a = [
|
|
391
|
-
'declare const call: { id: string; name: string };',
|
|
392
|
-
'declare const other: { id: string; name: string };',
|
|
393
|
-
'declare const maybe: { id: string; name: string } | undefined;',
|
|
394
|
-
'export const events = [',
|
|
395
|
-
" { type: 'tool-result', callId: call.id, toolName: call.name },",
|
|
396
|
-
' { type: "tool-result", callId: call.id, toolName: call.name },',
|
|
397
|
-
' { type: `tool-result`, callId: call.id, toolName: call.name },',
|
|
398
|
-
" { type: 'tool\\x2dresult', callId: call.id, toolName: call.name },",
|
|
399
|
-
" { 'type': 'tool-result' as const, callId: call.id, toolName: call.name },",
|
|
400
|
-
" { type: ('tool-result') satisfies string, callId: call.id, toolName: call.name },",
|
|
401
|
-
" { ['type']: <const>'tool-result', callId: call.id, toolName: call.name },",
|
|
402
|
-
" { type: 'tool-result'!, callId: (call as typeof call).id as string, toolName: call!.name! },",
|
|
403
|
-
" { type: 'tool-result', callId: maybe?.id, toolName: maybe?.name },",
|
|
404
|
-
" { type: 'tool-result', callId: call['id'], toolName: call[`name`] },",
|
|
405
|
-
" { type: 'tool-result', callId: ev.call.id, toolName: ev.call.name },",
|
|
406
|
-
" { type: 'tool-result', callId: call.id },",
|
|
407
|
-
" { type: 'tool-result', callId: call.id, toolName: other.name },",
|
|
408
|
-
" { type: 'tool-result', callId: (call).id, toolName: (other as typeof other).name },",
|
|
409
|
-
" { type: 'tool-result', callId: 'c1', toolName: 'read' },",
|
|
410
|
-
" { type: 'tool-result', callId: call.id, toolName: call.id },",
|
|
411
|
-
" { type: 'tool-result', callId: call[id], toolName: call.name },",
|
|
412
|
-
" { type: 'tool-result', callId: call.id, toolName: other.name ?? 'read' },",
|
|
413
|
-
" { type: 'tool-result', callId: call.id, [toolName]: call.name },",
|
|
414
|
-
" { type: 'tool-result', callId: call.id, get toolName() { return call.name; } },",
|
|
415
|
-
" { ...base, type: 'tool-result', callId: call.id },",
|
|
416
|
-
" { [type]: 'tool-result', callId: call.id },",
|
|
417
|
-
' { type: `tool-result${suffix}`, callId: call.id },',
|
|
418
|
-
" { type: 'tool-results', callId: call.id },",
|
|
419
|
-
" { kind: 'tool-result', callId: call.id },",
|
|
420
|
-
'];',
|
|
421
|
-
].join('\n');
|
|
422
|
-
const b = [
|
|
423
|
-
'export function emit(wrap: (e: unknown) => void, call: { id: string; name: string }) {',
|
|
424
|
-
" wrap({ inner: { type: 'tool-result', callId: call.id, toolName: call.name } });",
|
|
425
|
-
" wrap({ type: 'tool-result', callId: call.id });",
|
|
426
|
-
'}',
|
|
427
|
-
].join('\n');
|
|
428
|
-
const result = scanToolResults([{ name: 'a.ts', text: a }, { name: 'b.ts', text: b }]);
|
|
429
|
-
const at = (name, ...ns) => ns.map((n) => `${name}:${n}`);
|
|
430
|
-
assert.deepEqual(result.literals, [...at('a.ts', 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), ...at('b.ts', 2, 3)], 'each spelling of the literal, wherever it sits, and nothing else');
|
|
431
|
-
// A computed variable key, a getter and a spread aren't read, so their toolName is missing.
|
|
432
|
-
assert.deepEqual(result.missing, [...at('a.ts', 16, 23, 24, 25), ...at('b.ts', 3)]);
|
|
433
|
-
// Through wrappers, optional and computed string members, and a member chain;
|
|
434
|
-
// not a wrong field, a variable index, a string or a fallback.
|
|
435
|
-
assert.equal(result.paired, 14, 'the call reads paired');
|
|
436
|
-
assert.deepEqual(result.mismatched, [
|
|
437
|
-
'a.ts:17: callId reads call, toolName reads other',
|
|
438
|
-
'a.ts:18: callId reads call, toolName reads other',
|
|
439
|
-
]);
|
|
440
|
-
// A source Babel can't parse fails the scan by name.
|
|
441
|
-
assert.throws(() => scanToolResults([{ name: 'broken.ts', text: 'const = ;' }]), /^Error: broken\.ts: /);
|
|
442
|
-
});
|
|
443
|
-
describe('a server sending while the host stops', () => {
|
|
444
|
-
async function wiredFramework() {
|
|
445
|
-
const framework = await AgentFramework.create({
|
|
446
|
-
storePath: join(tempDir, 'store'),
|
|
447
|
-
membrane: new MockMembrane().asMembrane(),
|
|
448
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'test' }],
|
|
449
|
-
modules: [],
|
|
450
|
-
});
|
|
451
|
-
const connection = Object.assign(new EventEmitter(), { id: 'srv' });
|
|
452
|
-
framework.wireMcplEvents(connection);
|
|
453
|
-
return { framework, connection };
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Put a stand-in in for every request listener's handler, each calling
|
|
457
|
-
* `handler` with what it was given: the push handler, the channel
|
|
458
|
-
* registry's three, the inference router and the host-command handler.
|
|
459
|
-
*/
|
|
460
|
-
function standIns(framework, handler) {
|
|
461
|
-
const fw = framework;
|
|
462
|
-
fw.pushHandler = { handlePushEvent: handler };
|
|
463
|
-
fw.channelRegistry = { handleIncoming: handler, handleRegister: handler, handleChanged: handler, stopAll: () => { } };
|
|
464
|
-
fw.inferenceRouter = { handleInferenceRequest: handler };
|
|
465
|
-
fw.handleHostCommand = handler;
|
|
466
|
-
}
|
|
467
|
-
/** Every request listener: its event, its method, and parameters it takes. */
|
|
468
|
-
const requests = [
|
|
469
|
-
['push-event', 'push/event', { featureSet: 'chat', eventId: 'e20', payload: { content: [{ type: 'text', text: 'x' }] } }],
|
|
470
|
-
['channels-incoming', 'channels/incoming', { messages: [{ channelId: 'c', messageId: 'm20', content: [] }] }],
|
|
471
|
-
['channels-register', 'channels/register', { channels: [] }],
|
|
472
|
-
['channels-changed', 'channels/changed', { added: [] }],
|
|
473
|
-
['inference-request', 'inference/request', { messages: [] }],
|
|
474
|
-
['host-command', 'host/command', { command: 'undo' }],
|
|
475
|
-
];
|
|
476
|
-
/**
|
|
477
|
-
* A server's responder, recording each answer.
|
|
478
|
-
* - throws: respondError records its answer, then throws (the connection is going).
|
|
479
|
-
* - serializes: respond serializes the result before it records it, as the
|
|
480
|
-
* connection's sendResponse does, so a result JSON can't hold throws.
|
|
481
|
-
*/
|
|
482
|
-
function responder(opts = {}) {
|
|
483
|
-
const answers = [];
|
|
484
|
-
return {
|
|
485
|
-
id: 7,
|
|
486
|
-
answers,
|
|
487
|
-
respond: (result) => {
|
|
488
|
-
if (opts.serializes)
|
|
489
|
-
JSON.stringify(result);
|
|
490
|
-
answers.push({ result });
|
|
491
|
-
},
|
|
492
|
-
respondError: (code, message) => {
|
|
493
|
-
answers.push({ error: { code, message } });
|
|
494
|
-
if (opts.throws)
|
|
495
|
-
throw new Error('the connection is gone');
|
|
496
|
-
},
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
/** Wait until each responder has its answer, then a turn. */
|
|
500
|
-
async function answered(...rs) {
|
|
501
|
-
await until(() => rs.every((r) => r.answers.length > 0), 'every answer');
|
|
502
|
-
await turn();
|
|
503
|
-
}
|
|
504
|
-
const stopping = { error: { code: -32000, message: 'the host is stopping' } };
|
|
505
|
-
it('a push, incoming message or other request after stop() is answered -32000, never handled or accepted', async () => {
|
|
506
|
-
const { framework, connection } = await wiredFramework();
|
|
507
|
-
await framework.stop();
|
|
508
|
-
// Stand-in handlers, put in after stop() (which stops the real registry): every arrival below comes later.
|
|
509
|
-
let handled = 0;
|
|
510
|
-
standIns(framework, async () => { handled++; return {}; });
|
|
511
|
-
const push = responder();
|
|
512
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e1', payload: { content: [{ type: 'text', text: 'late' }] } }, push);
|
|
513
|
-
const incoming = responder();
|
|
514
|
-
connection.emit('channels-incoming', { messages: [{ channelId: 'c', messageId: 'm', content: [] }] }, incoming);
|
|
515
|
-
const register = responder();
|
|
516
|
-
connection.emit('channels-register', { channels: [] }, register);
|
|
517
|
-
const changed = responder();
|
|
518
|
-
connection.emit('channels-changed', { added: [] }, changed);
|
|
519
|
-
const inference = responder();
|
|
520
|
-
connection.emit('inference-request', { messages: [] }, inference);
|
|
521
|
-
const command = responder();
|
|
522
|
-
connection.emit('host-command', { command: 'undo' }, command);
|
|
523
|
-
await answered(push, incoming, register, changed, inference, command);
|
|
524
|
-
assert.equal(handled, 0, 'never handed to a handler, which would record it as accepted or act on it');
|
|
525
|
-
for (const r of [push, incoming, register, changed, inference, command])
|
|
526
|
-
assert.deepEqual(r.answers, [stopping]);
|
|
527
|
-
assert.deepEqual(rejections, []);
|
|
528
|
-
});
|
|
529
|
-
for (const [event, method, params] of [
|
|
530
|
-
['push-event', 'push/event', { featureSet: 'chat', eventId: 'e2', payload: { content: [{ type: 'text', text: 'waiting' }] } }],
|
|
531
|
-
['channels-incoming', 'channels/incoming', { messages: [{ channelId: 'c', messageId: 'm2', content: [] }] }],
|
|
532
|
-
['inference-request', 'inference/request', { messages: [] }],
|
|
533
|
-
['host-command', 'host/command', { command: 'undo' }],
|
|
534
|
-
]) {
|
|
535
|
-
it(`a ${method} held at the awareness barrier while the host stops is refused once the barrier lifts`, async () => {
|
|
536
|
-
const { framework, connection } = await wiredFramework();
|
|
537
|
-
let lift;
|
|
538
|
-
framework.discordAwarenessBarrier = {
|
|
539
|
-
promise: new Promise((r) => { lift = r; }),
|
|
540
|
-
};
|
|
541
|
-
let handled = 0;
|
|
542
|
-
standIns(framework, async () => { handled++; return {}; });
|
|
543
|
-
const r = responder();
|
|
544
|
-
connection.emit(event, params, r);
|
|
545
|
-
await framework.stop();
|
|
546
|
-
lift();
|
|
547
|
-
await answered(r);
|
|
548
|
-
assert.equal(handled, 0);
|
|
549
|
-
assert.deepEqual(r.answers, [stopping]);
|
|
550
|
-
assert.ok(logged.some((line) => line.includes(`${method} from srv refused: the host is stopping`)), logged.join('\n'));
|
|
551
|
-
assert.deepEqual(rejections, []);
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
it('a handler running when the host stops, and then failing, is answered -32000 with its own message', async () => {
|
|
555
|
-
const { framework, connection } = await wiredFramework();
|
|
556
|
-
let release;
|
|
557
|
-
const gate = new Promise((r) => { release = r; });
|
|
558
|
-
framework.pushHandler = {
|
|
559
|
-
handlePushEvent: async () => { await gate; throw new Error('Queue is closed'); },
|
|
560
|
-
};
|
|
561
|
-
const push = responder();
|
|
562
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e6', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
563
|
-
await framework.stop();
|
|
564
|
-
release();
|
|
565
|
-
await answered(push);
|
|
566
|
-
const reason = 'the host stopped while handling this request (Queue is closed)';
|
|
567
|
-
assert.deepEqual(push.answers, [{ error: { code: -32000, message: reason } }]);
|
|
568
|
-
assert.ok(logged.some((line) => line.includes(`push/event from srv failed: ${reason} (part of it may already have been admitted)`)), logged.join('\n'));
|
|
569
|
-
assert.deepEqual(rejections, []);
|
|
570
|
-
});
|
|
571
|
-
it('a handler that throws is answered -32603 with its error, not rejected into the listener; a notification is only logged', async () => {
|
|
572
|
-
const { framework, connection } = await wiredFramework();
|
|
573
|
-
try {
|
|
574
|
-
framework.pushHandler = {
|
|
575
|
-
handlePushEvent: async (_s, params) => { throw new Error(`the handler broke on ${params.eventId}`); },
|
|
576
|
-
};
|
|
577
|
-
const push = responder();
|
|
578
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e3', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
579
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e4', payload: { content: [{ type: 'text', text: 'y' }] } });
|
|
580
|
-
await answered(push);
|
|
581
|
-
await until(() => logged.some((line) => line.includes('the handler broke on e4')), "the notification's log line");
|
|
582
|
-
assert.deepEqual(push.answers, [{ error: { code: -32603, message: 'the handler broke on e3' } }]);
|
|
583
|
-
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'));
|
|
584
|
-
assert.deepEqual(rejections, []);
|
|
585
|
-
}
|
|
586
|
-
finally {
|
|
587
|
-
await framework.stop();
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
it('a handler that rejects with nothing, a string or an unprintable value is a failed request, not a stopping refusal', async () => {
|
|
591
|
-
const { framework, connection } = await wiredFramework();
|
|
592
|
-
try {
|
|
593
|
-
const fw = framework;
|
|
594
|
-
// A revoked Proxy throws on instanceof itself; an Error whose message is a number has no slice.
|
|
595
|
-
const revoked = Proxy.revocable({}, {});
|
|
596
|
-
revoked.revoke();
|
|
597
|
-
const numbered = new Error('placeholder');
|
|
598
|
-
Object.defineProperty(numbered, 'message', { value: 42 });
|
|
599
|
-
// An Error whose message getter throws: reading it is itself guarded.
|
|
600
|
-
const unreadable = new Error('placeholder');
|
|
601
|
-
Object.defineProperty(unreadable, 'message', { get() { throw new Error('the message getter broke'); } });
|
|
602
|
-
const thrown = {
|
|
603
|
-
e5: undefined, e7: 'a plain string', e8: Object.create(null), e12: revoked.proxy, e13: numbered, e14: unreadable,
|
|
604
|
-
};
|
|
605
|
-
fw.pushHandler = {
|
|
606
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
607
|
-
handlePushEvent: (_s, params) => Promise.reject(thrown[params.eventId]),
|
|
608
|
-
};
|
|
609
|
-
fw.channelRegistry = { handleIncoming: async () => { throw undefined; }, stopAll: () => { } };
|
|
610
|
-
const answersFor = (eventId) => {
|
|
611
|
-
const r = responder();
|
|
612
|
-
connection.emit('push-event', { featureSet: 'chat', eventId, payload: { content: [{ type: 'text', text: 'x' }] } }, r);
|
|
613
|
-
return r;
|
|
614
|
-
};
|
|
615
|
-
const e5 = answersFor('e5');
|
|
616
|
-
const e7 = answersFor('e7');
|
|
617
|
-
const e8 = answersFor('e8');
|
|
618
|
-
const e12 = answersFor('e12');
|
|
619
|
-
const e13 = answersFor('e13');
|
|
620
|
-
const e14 = answersFor('e14');
|
|
621
|
-
const incoming = responder();
|
|
622
|
-
connection.emit('channels-incoming', { messages: [{ channelId: 'c', messageId: 'm', content: [] }] }, incoming);
|
|
623
|
-
await answered(e5, e7, e8, e12, e13, e14, incoming);
|
|
624
|
-
assert.deepEqual(e5.answers, [{ error: { code: -32603, message: 'the handler failed' } }]);
|
|
625
|
-
assert.deepEqual(e7.answers, [{ error: { code: -32603, message: 'the handler failed: a plain string' } }]);
|
|
626
|
-
assert.deepEqual(e8.answers, [{ error: { code: -32603, message: 'the handler failed: (a value that could not be read)' } }]);
|
|
627
|
-
assert.deepEqual(e12.answers, [{ error: { code: -32603, message: 'the handler failed: (a value that could not be read)' } }]);
|
|
628
|
-
assert.deepEqual(e13.answers, [{ error: { code: -32603, message: '42' } }]);
|
|
629
|
-
assert.deepEqual(e14.answers, [{ error: { code: -32603, message: '(a value that could not be read)' } }]);
|
|
630
|
-
assert.deepEqual(incoming.answers, [{ error: { code: -32603, message: 'the handler failed' } }]);
|
|
631
|
-
assert.ok(!logged.some((line) => line.includes('refused')), 'a live host refuses nothing');
|
|
632
|
-
assert.deepEqual(rejections, []);
|
|
633
|
-
}
|
|
634
|
-
finally {
|
|
635
|
-
await framework.stop();
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
it('a long error is answered and logged bounded', async () => {
|
|
639
|
-
const { framework, connection } = await wiredFramework();
|
|
640
|
-
try {
|
|
641
|
-
framework.pushHandler = {
|
|
642
|
-
handlePushEvent: async () => { throw new Error('x'.repeat(5000)); },
|
|
643
|
-
};
|
|
644
|
-
const push = responder();
|
|
645
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e9', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
646
|
-
await answered(push);
|
|
647
|
-
const message = push.answers[0].error.message;
|
|
648
|
-
assert.ok(message.length < 600, `answered ${message.length} characters`);
|
|
649
|
-
assert.match(message, /… \(5000 characters\)$/);
|
|
650
|
-
}
|
|
651
|
-
finally {
|
|
652
|
-
await framework.stop();
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
it('a request the handler already answered is not answered again when the handler then throws', async () => {
|
|
656
|
-
const { framework, connection } = await wiredFramework();
|
|
657
|
-
try {
|
|
658
|
-
framework.pushHandler = {
|
|
659
|
-
handlePushEvent: async (_s, _p, r) => {
|
|
660
|
-
r.respond({ accepted: true });
|
|
661
|
-
throw new Error('the trace emit broke');
|
|
662
|
-
},
|
|
663
|
-
};
|
|
664
|
-
const push = responder();
|
|
665
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e10', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
666
|
-
await answered(push);
|
|
667
|
-
await until(() => logged.some((line) => line.includes('failed after it was answered')), 'the log line');
|
|
668
|
-
assert.deepEqual(push.answers, [{ result: { accepted: true } }]);
|
|
669
|
-
assert.ok(logged.some((line) => line.includes('push/event from srv failed after it was answered: the trace emit broke')), logged.join('\n'));
|
|
670
|
-
assert.deepEqual(rejections, []);
|
|
671
|
-
}
|
|
672
|
-
finally {
|
|
673
|
-
await framework.stop();
|
|
674
|
-
}
|
|
675
|
-
});
|
|
676
|
-
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 () => {
|
|
677
|
-
const { framework, connection } = await wiredFramework();
|
|
678
|
-
try {
|
|
679
|
-
standIns(framework, async (_s, _p, r) => {
|
|
680
|
-
r.respond({ accepted: true, sequence: 1n });
|
|
681
|
-
});
|
|
682
|
-
const push = responder({ serializes: true });
|
|
683
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e21', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
684
|
-
await answered(push);
|
|
685
|
-
assert.deepEqual(push.answers, [{ error: { code: -32603, message: 'Do not know how to serialize a BigInt' } }]);
|
|
686
|
-
assert.ok(!logged.some((line) => line.includes('failed after it was answered')), logged.join('\n'));
|
|
687
|
-
assert.deepEqual(rejections, []);
|
|
688
|
-
}
|
|
689
|
-
finally {
|
|
690
|
-
await framework.stop();
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
it('a handler that answers after its failure was answered is refused, so the server gets one response', async () => {
|
|
694
|
-
const { framework, connection } = await wiredFramework();
|
|
695
|
-
try {
|
|
696
|
-
standIns(framework, async (_s, _p, r) => {
|
|
697
|
-
setImmediate(() => r.respond({ accepted: true }));
|
|
698
|
-
throw new Error('the handler broke first');
|
|
699
|
-
});
|
|
700
|
-
const push = responder();
|
|
701
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e22', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
702
|
-
await answered(push);
|
|
703
|
-
await until(() => logged.some((line) => line.includes('a second answer (respond) was refused')), 'the refused second answer');
|
|
704
|
-
await turn();
|
|
705
|
-
assert.deepEqual(push.answers, [{ error: { code: -32603, message: 'the handler broke first' } }]);
|
|
706
|
-
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'));
|
|
707
|
-
assert.deepEqual(rejections, []);
|
|
708
|
-
}
|
|
709
|
-
finally {
|
|
710
|
-
await framework.stop();
|
|
711
|
-
}
|
|
712
|
-
});
|
|
713
|
-
it('a responder without respondError reaches the handler without one', async () => {
|
|
714
|
-
const { framework, connection } = await wiredFramework();
|
|
715
|
-
try {
|
|
716
|
-
let seen;
|
|
717
|
-
standIns(framework, async (_s, _p, r) => {
|
|
718
|
-
seen = typeof r.respondError;
|
|
719
|
-
r.respond({ results: [] });
|
|
720
|
-
});
|
|
721
|
-
const answers = [];
|
|
722
|
-
connection.emit('channels-incoming', { messages: [{ channelId: 'c', messageId: 'm23', content: [] }] }, {
|
|
723
|
-
id: 7, respond: (result) => { answers.push(result); },
|
|
724
|
-
});
|
|
725
|
-
await until(() => answers.length > 0, 'the answer');
|
|
726
|
-
await turn();
|
|
727
|
-
assert.equal(seen, 'undefined', "a handler checking for respondError takes its fallback");
|
|
728
|
-
assert.deepEqual(answers, [{ results: [] }]);
|
|
729
|
-
assert.deepEqual(rejections, []);
|
|
730
|
-
}
|
|
731
|
-
finally {
|
|
732
|
-
await framework.stop();
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
it("every request listener answers its handler's throw -32603 with its error, never rejecting into the listener", async () => {
|
|
736
|
-
const { framework, connection } = await wiredFramework();
|
|
737
|
-
try {
|
|
738
|
-
standIns(framework, async () => { throw new Error('the handler broke'); });
|
|
739
|
-
const answers = requests.map(([event, , params]) => {
|
|
740
|
-
const r = responder();
|
|
741
|
-
connection.emit(event, params, r);
|
|
742
|
-
return r;
|
|
743
|
-
});
|
|
744
|
-
await answered(...answers);
|
|
745
|
-
for (const [i, [, method]] of requests.entries()) {
|
|
746
|
-
assert.deepEqual(answers[i].answers, [{ error: { code: -32603, message: 'the handler broke' } }], method);
|
|
747
|
-
assert.ok(logged.some((line) => line.includes(`${method} from srv failed: the handler broke`)), `${method}:\n${logged.join('\n')}`);
|
|
748
|
-
}
|
|
749
|
-
assert.deepEqual(rejections, []);
|
|
750
|
-
}
|
|
751
|
-
finally {
|
|
752
|
-
await framework.stop();
|
|
753
|
-
}
|
|
754
|
-
});
|
|
755
|
-
it('an inference request during a render is refused -32600, and a throwing responder there is not rejected into the listener', async () => {
|
|
756
|
-
const { framework, connection } = await wiredFramework();
|
|
757
|
-
try {
|
|
758
|
-
const fw = framework;
|
|
759
|
-
const coalescer = fw.pushCoalescer;
|
|
760
|
-
fw.pushCoalescer = { isRendering: () => true, suspend: () => { }, flush: () => { } };
|
|
761
|
-
const inference = responder({ throws: true });
|
|
762
|
-
connection.emit('inference-request', { messages: [] }, inference);
|
|
763
|
-
await answered(inference);
|
|
764
|
-
assert.deepEqual(inference.answers, [{ error: { code: -32600, message: 'Cannot request inference while push/render is in progress' } }]);
|
|
765
|
-
assert.deepEqual(rejections, []);
|
|
766
|
-
fw.pushCoalescer = coalescer;
|
|
767
|
-
}
|
|
768
|
-
finally {
|
|
769
|
-
await framework.stop();
|
|
770
|
-
}
|
|
771
|
-
});
|
|
772
|
-
it('a responder that throws while answering is logged, never rejected into the listener', async () => {
|
|
773
|
-
const { framework, connection } = await wiredFramework();
|
|
774
|
-
await framework.stop();
|
|
775
|
-
const push = responder({ throws: true });
|
|
776
|
-
connection.emit('push-event', { featureSet: 'chat', eventId: 'e11', payload: { content: [{ type: 'text', text: 'x' }] } }, push);
|
|
777
|
-
await answered(push);
|
|
778
|
-
assert.deepEqual(push.answers, [stopping]);
|
|
779
|
-
assert.ok(logged.some((line) => line.includes('push/event from srv refused: the host is stopping')), logged.join('\n'));
|
|
780
|
-
assert.deepEqual(rejections, []);
|
|
781
|
-
});
|
|
782
|
-
});
|
|
783
|
-
});
|
|
784
|
-
//# sourceMappingURL=stop-with-work-in-flight.test.js.map
|