@animalabs/agent-framework 0.22.2 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/src/agent.d.ts +77 -12
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +136 -40
- 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/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 +3 -4
- package/src/agent.ts +162 -40
- 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/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,1048 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent framework integration tests
|
|
3
|
-
*/
|
|
4
|
-
import { describe, it, beforeEach, afterEach } from 'node:test';
|
|
5
|
-
import assert from 'node:assert';
|
|
6
|
-
import { tmpdir } from 'node:os';
|
|
7
|
-
import { mkdtempSync, rmSync } from 'node:fs';
|
|
8
|
-
import { join } from 'node:path';
|
|
9
|
-
import { AgentFramework, ProcessQueueImpl } from '../src/index.js';
|
|
10
|
-
/**
|
|
11
|
-
* Mock yielding stream for testing the streaming inference path.
|
|
12
|
-
* Takes a sequence of responses: first response starts the stream,
|
|
13
|
-
* subsequent responses resume after each tool round.
|
|
14
|
-
*/
|
|
15
|
-
class MockYieldingStream {
|
|
16
|
-
responses;
|
|
17
|
-
events = [];
|
|
18
|
-
_done = false;
|
|
19
|
-
_isWaitingForTools = false;
|
|
20
|
-
_pendingToolCallIds = [];
|
|
21
|
-
_toolDepth = 0;
|
|
22
|
-
pendingResolve = null;
|
|
23
|
-
receivedToolResults = [];
|
|
24
|
-
constructor(responses) {
|
|
25
|
-
this.responses = responses;
|
|
26
|
-
this.processResponse(0);
|
|
27
|
-
}
|
|
28
|
-
processResponse(index) {
|
|
29
|
-
const response = this.responses[index];
|
|
30
|
-
if (!response) {
|
|
31
|
-
this._done = true;
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
// Emit block lifecycle + tokens. Mirroring the membrane's native yielding
|
|
35
|
-
// path (block_start → tokens → block_complete) so tests exercise the
|
|
36
|
-
// framework's 'block' case-arm + the blockType/blockIndex tagging on
|
|
37
|
-
// tokens. Real membrane emits 'block' on every block transition; we emit
|
|
38
|
-
// one text block per response, which is enough to cover the trace plumbing.
|
|
39
|
-
const text = response.rawAssistantText;
|
|
40
|
-
if (text) {
|
|
41
|
-
this.events.push({
|
|
42
|
-
type: 'block',
|
|
43
|
-
event: { event: 'block_start', index: 0, block: { type: 'text' } },
|
|
44
|
-
});
|
|
45
|
-
this.events.push({
|
|
46
|
-
type: 'tokens',
|
|
47
|
-
content: text,
|
|
48
|
-
meta: { type: 'text', visible: true, blockIndex: 0 },
|
|
49
|
-
});
|
|
50
|
-
this.events.push({
|
|
51
|
-
type: 'block',
|
|
52
|
-
event: { event: 'block_complete', index: 0, block: { type: 'text', content: text } },
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
// Emit usage
|
|
56
|
-
if (response.usage) {
|
|
57
|
-
this.events.push({ type: 'usage', usage: response.usage });
|
|
58
|
-
}
|
|
59
|
-
// Tool calls or complete
|
|
60
|
-
if (response.toolCalls.length > 0) {
|
|
61
|
-
this._isWaitingForTools = true;
|
|
62
|
-
this._pendingToolCallIds = response.toolCalls.map((c) => c.id);
|
|
63
|
-
this.events.push({
|
|
64
|
-
type: 'tool-calls',
|
|
65
|
-
calls: response.toolCalls.map((tc) => ({
|
|
66
|
-
id: tc.id,
|
|
67
|
-
name: tc.name,
|
|
68
|
-
input: tc.input,
|
|
69
|
-
})),
|
|
70
|
-
context: {
|
|
71
|
-
rawText: '',
|
|
72
|
-
preamble: '',
|
|
73
|
-
depth: this._toolDepth,
|
|
74
|
-
previousResults: [],
|
|
75
|
-
accumulated: '',
|
|
76
|
-
// membrane ≥0.5.64: verbatim blocks of the current round, in
|
|
77
|
-
// provider order (thinking with signatures before tool_use)
|
|
78
|
-
roundContent: response.content,
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this.events.push({ type: 'complete', response });
|
|
84
|
-
this._done = true;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
provideToolResults(results) {
|
|
88
|
-
if (!this._isWaitingForTools)
|
|
89
|
-
throw new Error('Not waiting for tools');
|
|
90
|
-
this.receivedToolResults.push(results);
|
|
91
|
-
this._isWaitingForTools = false;
|
|
92
|
-
this._pendingToolCallIds = [];
|
|
93
|
-
this._toolDepth++;
|
|
94
|
-
this.processResponse(this._toolDepth);
|
|
95
|
-
// Wake up the iterator
|
|
96
|
-
if (this.pendingResolve) {
|
|
97
|
-
const resolve = this.pendingResolve;
|
|
98
|
-
this.pendingResolve = null;
|
|
99
|
-
resolve();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
cancel() {
|
|
103
|
-
this._done = true;
|
|
104
|
-
this.events.push({ type: 'aborted', reason: 'user' });
|
|
105
|
-
if (this.pendingResolve) {
|
|
106
|
-
const resolve = this.pendingResolve;
|
|
107
|
-
this.pendingResolve = null;
|
|
108
|
-
resolve();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
get isWaitingForTools() { return this._isWaitingForTools; }
|
|
112
|
-
get pendingToolCallIds() { return [...this._pendingToolCallIds]; }
|
|
113
|
-
get toolDepth() { return this._toolDepth; }
|
|
114
|
-
async *[Symbol.asyncIterator]() {
|
|
115
|
-
while (true) {
|
|
116
|
-
while (this.events.length > 0) {
|
|
117
|
-
const event = this.events.shift();
|
|
118
|
-
yield event;
|
|
119
|
-
if (event.type === 'complete' || event.type === 'error' || event.type === 'aborted') {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (this._done)
|
|
124
|
-
return;
|
|
125
|
-
await new Promise((resolve) => { this.pendingResolve = resolve; });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function createMockResponse(content, stopReason = 'end_turn') {
|
|
130
|
-
const rawText = content
|
|
131
|
-
.filter((b) => b.type === 'text')
|
|
132
|
-
.map((b) => b.text)
|
|
133
|
-
.join('');
|
|
134
|
-
const toolCalls = content
|
|
135
|
-
.filter((b) => b.type === 'tool_use')
|
|
136
|
-
.map((b) => ({ id: b.id, name: b.name, input: b.input }));
|
|
137
|
-
return {
|
|
138
|
-
content,
|
|
139
|
-
stopReason,
|
|
140
|
-
rawAssistantText: rawText,
|
|
141
|
-
toolCalls,
|
|
142
|
-
toolResults: [],
|
|
143
|
-
usage: { inputTokens: 10, outputTokens: 5 },
|
|
144
|
-
details: {
|
|
145
|
-
stop: { reason: stopReason, wasTruncated: false },
|
|
146
|
-
usage: { inputTokens: 10, outputTokens: 5 },
|
|
147
|
-
timing: { totalDurationMs: 100, attempts: 1 },
|
|
148
|
-
model: { requested: 'test', actual: 'test', provider: 'mock' },
|
|
149
|
-
cache: { markersInRequest: 0, tokensCreated: 0, tokensRead: 0, hitRatio: 0 },
|
|
150
|
-
},
|
|
151
|
-
raw: { request: {}, response: {} },
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
class MockMembrane {
|
|
155
|
-
responses = [];
|
|
156
|
-
calls = [];
|
|
157
|
-
lastStream = null;
|
|
158
|
-
responseIndex = 0;
|
|
159
|
-
pushResponse(response) {
|
|
160
|
-
this.responses.push(response);
|
|
161
|
-
}
|
|
162
|
-
async complete(request) {
|
|
163
|
-
this.calls.push(request);
|
|
164
|
-
if (this.responseIndex >= this.responses.length) {
|
|
165
|
-
// Default response
|
|
166
|
-
return createMockResponse([{ type: 'text', text: 'Default response' }]);
|
|
167
|
-
}
|
|
168
|
-
return this.responses[this.responseIndex++];
|
|
169
|
-
}
|
|
170
|
-
streamYielding(request, _options) {
|
|
171
|
-
this.calls.push(request);
|
|
172
|
-
// All remaining queued responses feed the stream
|
|
173
|
-
const remaining = this.responses.slice(this.responseIndex);
|
|
174
|
-
this.responseIndex = this.responses.length;
|
|
175
|
-
const stream = new MockYieldingStream(remaining);
|
|
176
|
-
this.lastStream = stream;
|
|
177
|
-
return stream;
|
|
178
|
-
}
|
|
179
|
-
// Cast helper - use this when passing to framework
|
|
180
|
-
asMembrane() {
|
|
181
|
-
return this;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
// ============================================================================
|
|
185
|
-
// Mock Module
|
|
186
|
-
// ============================================================================
|
|
187
|
-
class TestModule {
|
|
188
|
-
name = 'test';
|
|
189
|
-
ctx = null;
|
|
190
|
-
events = [];
|
|
191
|
-
toolCalls = [];
|
|
192
|
-
async start(ctx) {
|
|
193
|
-
this.ctx = ctx;
|
|
194
|
-
}
|
|
195
|
-
async stop() {
|
|
196
|
-
this.ctx = null;
|
|
197
|
-
}
|
|
198
|
-
getTools() {
|
|
199
|
-
return [
|
|
200
|
-
{
|
|
201
|
-
name: 'echo',
|
|
202
|
-
description: 'Echoes the input',
|
|
203
|
-
inputSchema: {
|
|
204
|
-
type: 'object',
|
|
205
|
-
properties: {
|
|
206
|
-
message: { type: 'string', description: 'Message to echo' },
|
|
207
|
-
},
|
|
208
|
-
required: ['message'],
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
];
|
|
212
|
-
}
|
|
213
|
-
async handleToolCall(call) {
|
|
214
|
-
this.toolCalls.push(call);
|
|
215
|
-
if (call.name === 'echo') {
|
|
216
|
-
const input = call.input;
|
|
217
|
-
return { success: true, data: { echoed: input.message } };
|
|
218
|
-
}
|
|
219
|
-
return { success: false, error: 'Unknown tool', isError: true };
|
|
220
|
-
}
|
|
221
|
-
async onProcess(event, _state) {
|
|
222
|
-
this.events.push(event);
|
|
223
|
-
// Handle external message by requesting inference
|
|
224
|
-
if (event.type === 'external-message') {
|
|
225
|
-
return {
|
|
226
|
-
addMessages: [
|
|
227
|
-
{
|
|
228
|
-
participant: 'User',
|
|
229
|
-
content: [{ type: 'text', text: String(event.content) }],
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
requestInference: true,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
return {};
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
// ============================================================================
|
|
239
|
-
// Tests
|
|
240
|
-
// ============================================================================
|
|
241
|
-
describe('ProcessQueueImpl', () => {
|
|
242
|
-
it('should push and pop events', () => {
|
|
243
|
-
const queue = new ProcessQueueImpl();
|
|
244
|
-
const event = {
|
|
245
|
-
type: 'timer-fired',
|
|
246
|
-
timerId: 'test',
|
|
247
|
-
reason: 'test',
|
|
248
|
-
};
|
|
249
|
-
queue.push(event);
|
|
250
|
-
assert.strictEqual(queue.depth, 1);
|
|
251
|
-
assert.strictEqual(queue.isEmpty, false);
|
|
252
|
-
const popped = queue.tryPop();
|
|
253
|
-
assert.deepStrictEqual(popped, event);
|
|
254
|
-
assert.strictEqual(queue.depth, 0);
|
|
255
|
-
assert.strictEqual(queue.isEmpty, true);
|
|
256
|
-
});
|
|
257
|
-
it('prioritizes external messages without reversing their arrival order', () => {
|
|
258
|
-
const queue = new ProcessQueueImpl();
|
|
259
|
-
const firstMessage = {
|
|
260
|
-
type: 'external-message',
|
|
261
|
-
source: 'test',
|
|
262
|
-
content: 'first',
|
|
263
|
-
metadata: {},
|
|
264
|
-
};
|
|
265
|
-
const secondMessage = {
|
|
266
|
-
type: 'external-message',
|
|
267
|
-
source: 'test',
|
|
268
|
-
content: 'second',
|
|
269
|
-
metadata: {},
|
|
270
|
-
};
|
|
271
|
-
const firstInternal = {
|
|
272
|
-
type: 'timer-fired',
|
|
273
|
-
timerId: 'first-internal',
|
|
274
|
-
reason: 'test',
|
|
275
|
-
};
|
|
276
|
-
const secondInternal = {
|
|
277
|
-
type: 'timer-fired',
|
|
278
|
-
timerId: 'second-internal',
|
|
279
|
-
reason: 'test',
|
|
280
|
-
};
|
|
281
|
-
queue.push(firstInternal);
|
|
282
|
-
queue.push(firstMessage);
|
|
283
|
-
queue.push(secondMessage);
|
|
284
|
-
queue.push(secondInternal);
|
|
285
|
-
assert.deepStrictEqual(queue.tryPop(), firstMessage);
|
|
286
|
-
assert.deepStrictEqual(queue.tryPop(), secondMessage);
|
|
287
|
-
assert.deepStrictEqual(queue.tryPop(), firstInternal);
|
|
288
|
-
assert.deepStrictEqual(queue.tryPop(), secondInternal);
|
|
289
|
-
});
|
|
290
|
-
it('should return null when queue is empty', () => {
|
|
291
|
-
const queue = new ProcessQueueImpl();
|
|
292
|
-
assert.strictEqual(queue.tryPop(), null);
|
|
293
|
-
});
|
|
294
|
-
it('should peek without removing', () => {
|
|
295
|
-
const queue = new ProcessQueueImpl();
|
|
296
|
-
const event = {
|
|
297
|
-
type: 'timer-fired',
|
|
298
|
-
timerId: 'test',
|
|
299
|
-
reason: 'test',
|
|
300
|
-
};
|
|
301
|
-
queue.push(event);
|
|
302
|
-
assert.deepStrictEqual(queue.peek(), event);
|
|
303
|
-
assert.strictEqual(queue.depth, 1);
|
|
304
|
-
});
|
|
305
|
-
it('should clear all events', () => {
|
|
306
|
-
const queue = new ProcessQueueImpl();
|
|
307
|
-
queue.push({ type: 'timer-fired', timerId: '1', reason: 'test' });
|
|
308
|
-
queue.push({ type: 'timer-fired', timerId: '2', reason: 'test' });
|
|
309
|
-
queue.clear();
|
|
310
|
-
assert.strictEqual(queue.isEmpty, true);
|
|
311
|
-
});
|
|
312
|
-
it('should close and prevent further pushes', () => {
|
|
313
|
-
const queue = new ProcessQueueImpl();
|
|
314
|
-
queue.close();
|
|
315
|
-
assert.throws(() => {
|
|
316
|
-
queue.push({ type: 'timer-fired', timerId: 'test', reason: 'test' });
|
|
317
|
-
}, /Queue is closed/);
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
describe('AgentFramework', () => {
|
|
321
|
-
let tempDir;
|
|
322
|
-
let membrane;
|
|
323
|
-
beforeEach(() => {
|
|
324
|
-
tempDir = mkdtempSync(join(tmpdir(), 'agent-framework-test-'));
|
|
325
|
-
membrane = new MockMembrane();
|
|
326
|
-
});
|
|
327
|
-
it('should create framework with agents and modules', async () => {
|
|
328
|
-
const testModule = new TestModule();
|
|
329
|
-
const framework = await AgentFramework.create({
|
|
330
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
331
|
-
membrane: membrane.asMembrane(),
|
|
332
|
-
agents: [
|
|
333
|
-
{
|
|
334
|
-
name: 'assistant',
|
|
335
|
-
model: 'test-model',
|
|
336
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
337
|
-
},
|
|
338
|
-
],
|
|
339
|
-
modules: [testModule],
|
|
340
|
-
});
|
|
341
|
-
assert.notStrictEqual(framework.getAgent('assistant'), null);
|
|
342
|
-
assert.deepStrictEqual(framework.getAllAgents().map((a) => a.name), ['assistant']);
|
|
343
|
-
assert.notStrictEqual(testModule.ctx, null);
|
|
344
|
-
await framework.stop();
|
|
345
|
-
rmSync(tempDir, { recursive: true });
|
|
346
|
-
});
|
|
347
|
-
it('should route external messages and trigger inference', async () => {
|
|
348
|
-
const testModule = new TestModule();
|
|
349
|
-
// Set up response
|
|
350
|
-
membrane.pushResponse(createMockResponse([{ type: 'text', text: 'Hello! How can I help?' }]));
|
|
351
|
-
const framework = await AgentFramework.create({
|
|
352
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
353
|
-
membrane: membrane.asMembrane(),
|
|
354
|
-
agents: [
|
|
355
|
-
{
|
|
356
|
-
name: 'assistant',
|
|
357
|
-
model: 'test-model',
|
|
358
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
359
|
-
},
|
|
360
|
-
],
|
|
361
|
-
modules: [testModule],
|
|
362
|
-
});
|
|
363
|
-
// Push an external message event
|
|
364
|
-
framework.pushEvent({
|
|
365
|
-
type: 'external-message',
|
|
366
|
-
source: 'test',
|
|
367
|
-
content: 'Hello!',
|
|
368
|
-
metadata: {},
|
|
369
|
-
});
|
|
370
|
-
// Run until idle
|
|
371
|
-
await framework.runUntilIdle();
|
|
372
|
-
// Check that module received the event
|
|
373
|
-
assert.strictEqual(testModule.events.length, 1);
|
|
374
|
-
assert.strictEqual(testModule.events[0].type, 'external-message');
|
|
375
|
-
// Check that membrane was called
|
|
376
|
-
assert.strictEqual(membrane.calls.length, 1);
|
|
377
|
-
assert.strictEqual(membrane.calls[0].system, 'You are a helpful assistant.');
|
|
378
|
-
await framework.stop();
|
|
379
|
-
rmSync(tempDir, { recursive: true });
|
|
380
|
-
});
|
|
381
|
-
it('should handle tool calls', async () => {
|
|
382
|
-
const testModule = new TestModule();
|
|
383
|
-
// First response with tool call
|
|
384
|
-
membrane.pushResponse(createMockResponse([
|
|
385
|
-
{ type: 'text', text: 'Let me echo that for you.' },
|
|
386
|
-
{
|
|
387
|
-
type: 'tool_use',
|
|
388
|
-
id: 'call_1',
|
|
389
|
-
name: 'test--echo',
|
|
390
|
-
input: { message: 'test message' },
|
|
391
|
-
},
|
|
392
|
-
], 'tool_use'));
|
|
393
|
-
// Second response after tool result
|
|
394
|
-
membrane.pushResponse(createMockResponse([
|
|
395
|
-
{ type: 'text', text: 'The echoed message is: test message' },
|
|
396
|
-
]));
|
|
397
|
-
const framework = await AgentFramework.create({
|
|
398
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
399
|
-
membrane: membrane.asMembrane(),
|
|
400
|
-
agents: [
|
|
401
|
-
{
|
|
402
|
-
name: 'assistant',
|
|
403
|
-
model: 'test-model',
|
|
404
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
405
|
-
},
|
|
406
|
-
],
|
|
407
|
-
modules: [testModule],
|
|
408
|
-
});
|
|
409
|
-
// Push message and run
|
|
410
|
-
framework.pushEvent({
|
|
411
|
-
type: 'external-message',
|
|
412
|
-
source: 'test',
|
|
413
|
-
content: 'Echo this!',
|
|
414
|
-
metadata: {},
|
|
415
|
-
});
|
|
416
|
-
await framework.runUntilIdle();
|
|
417
|
-
// Check tool was called
|
|
418
|
-
assert.strictEqual(testModule.toolCalls.length, 1);
|
|
419
|
-
assert.strictEqual(testModule.toolCalls[0].name, 'echo');
|
|
420
|
-
assert.deepStrictEqual(testModule.toolCalls[0].input, { message: 'test message' });
|
|
421
|
-
// With streaming, membrane is called once (streamYielding handles tool rounds internally)
|
|
422
|
-
assert.strictEqual(membrane.calls.length, 1);
|
|
423
|
-
await framework.stop();
|
|
424
|
-
rmSync(tempDir, { recursive: true });
|
|
425
|
-
});
|
|
426
|
-
it('preserves signed thinking blocks in tool-call turns (round-trip ordering)', async () => {
|
|
427
|
-
const testModule = new TestModule();
|
|
428
|
-
// Round 1: signed thinking BEFORE the tool_use — the API requires this
|
|
429
|
-
// ordering to survive verbatim into the stored assistant turn.
|
|
430
|
-
membrane.pushResponse(createMockResponse([
|
|
431
|
-
{ type: 'thinking', thinking: 'I should echo this', signature: 'sig_round1' },
|
|
432
|
-
{ type: 'text', text: 'Let me echo that.' },
|
|
433
|
-
{
|
|
434
|
-
type: 'tool_use',
|
|
435
|
-
id: 'call_1',
|
|
436
|
-
name: 'test--echo',
|
|
437
|
-
input: { message: 'hi' },
|
|
438
|
-
},
|
|
439
|
-
], 'tool_use'));
|
|
440
|
-
// Round 2 (final): signature-only thinking (display:'omitted') + answer
|
|
441
|
-
membrane.pushResponse(createMockResponse([
|
|
442
|
-
{ type: 'thinking', thinking: '', signature: 'sig_round2' },
|
|
443
|
-
{ type: 'text', text: 'Done: hi' },
|
|
444
|
-
]));
|
|
445
|
-
const framework = await AgentFramework.create({
|
|
446
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
447
|
-
membrane: membrane.asMembrane(),
|
|
448
|
-
agents: [
|
|
449
|
-
{
|
|
450
|
-
name: 'assistant',
|
|
451
|
-
model: 'test-model',
|
|
452
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
453
|
-
},
|
|
454
|
-
],
|
|
455
|
-
modules: [testModule],
|
|
456
|
-
});
|
|
457
|
-
framework.pushEvent({
|
|
458
|
-
type: 'external-message',
|
|
459
|
-
source: 'test',
|
|
460
|
-
content: 'Echo this!',
|
|
461
|
-
metadata: {},
|
|
462
|
-
});
|
|
463
|
-
await framework.runUntilIdle();
|
|
464
|
-
const agent = framework.getAgent('assistant');
|
|
465
|
-
assert.ok(agent);
|
|
466
|
-
const compiled = await agent.compileContext();
|
|
467
|
-
// The assistant turn that carries the tool_use must contain the signed
|
|
468
|
-
// thinking block BEFORE the tool_use, signature intact.
|
|
469
|
-
const assistantWithTool = compiled.messages.find((m) => Array.isArray(m.content) && m.content.some((b) => b.type === 'tool_use'));
|
|
470
|
-
assert.ok(assistantWithTool, 'assistant turn with tool_use should be stored');
|
|
471
|
-
const blocks = assistantWithTool.content;
|
|
472
|
-
const thinkIdx = blocks.findIndex((b) => b.type === 'thinking');
|
|
473
|
-
const toolIdx = blocks.findIndex((b) => b.type === 'tool_use');
|
|
474
|
-
assert.ok(thinkIdx >= 0, 'thinking block should be stored in the tool_use turn');
|
|
475
|
-
assert.ok(thinkIdx < toolIdx, 'thinking must precede tool_use in the same turn');
|
|
476
|
-
assert.strictEqual(blocks[thinkIdx].signature, 'sig_round1', 'signature must survive verbatim');
|
|
477
|
-
// The final assistant turn keeps its signature-only thinking block.
|
|
478
|
-
const finalSigBlock = compiled.messages
|
|
479
|
-
.flatMap((m) => (Array.isArray(m.content) ? m.content : []))
|
|
480
|
-
.find((b) => b.type === 'thinking' && b.signature === 'sig_round2');
|
|
481
|
-
assert.ok(finalSigBlock, 'signature-only thinking block must survive in the final turn');
|
|
482
|
-
// No double-storing: the round-1 preamble text must appear exactly once
|
|
483
|
-
// across all stored assistant content.
|
|
484
|
-
const preambleCount = compiled.messages
|
|
485
|
-
.flatMap((m) => (Array.isArray(m.content) ? m.content : []))
|
|
486
|
-
.filter((b) => b.type === 'text' && b.text.includes('Let me echo that.'))
|
|
487
|
-
.length;
|
|
488
|
-
assert.strictEqual(preambleCount, 1, 'preamble text must not be double-stored');
|
|
489
|
-
await framework.stop();
|
|
490
|
-
rmSync(tempDir, { recursive: true });
|
|
491
|
-
});
|
|
492
|
-
it('should emit framework events', async () => {
|
|
493
|
-
const testModule = new TestModule();
|
|
494
|
-
const events = [];
|
|
495
|
-
membrane.pushResponse(createMockResponse([{ type: 'text', text: 'Hello!' }]));
|
|
496
|
-
const framework = await AgentFramework.create({
|
|
497
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
498
|
-
membrane: membrane.asMembrane(),
|
|
499
|
-
agents: [
|
|
500
|
-
{
|
|
501
|
-
name: 'assistant',
|
|
502
|
-
model: 'test-model',
|
|
503
|
-
systemPrompt: 'Test',
|
|
504
|
-
},
|
|
505
|
-
],
|
|
506
|
-
modules: [testModule],
|
|
507
|
-
});
|
|
508
|
-
framework.onTrace((event) => {
|
|
509
|
-
events.push(event.type);
|
|
510
|
-
});
|
|
511
|
-
framework.pushEvent({
|
|
512
|
-
type: 'external-message',
|
|
513
|
-
source: 'test',
|
|
514
|
-
content: 'Hello',
|
|
515
|
-
metadata: {},
|
|
516
|
-
});
|
|
517
|
-
await framework.runUntilIdle();
|
|
518
|
-
assert.ok(events.includes('process:received'), 'Should emit process:received');
|
|
519
|
-
assert.ok(events.includes('inference:started'), 'Should emit inference:started');
|
|
520
|
-
assert.ok(events.includes('inference:completed'), 'Should emit inference:completed');
|
|
521
|
-
assert.ok(events.includes('message:added'), 'Should emit message:added');
|
|
522
|
-
await framework.stop();
|
|
523
|
-
rmSync(tempDir, { recursive: true });
|
|
524
|
-
});
|
|
525
|
-
it('should filter tools by agent allowedTools', async () => {
|
|
526
|
-
const testModule = new TestModule();
|
|
527
|
-
membrane.pushResponse(createMockResponse([
|
|
528
|
-
{ type: 'text', text: 'No tools available' },
|
|
529
|
-
]));
|
|
530
|
-
const framework = await AgentFramework.create({
|
|
531
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
532
|
-
membrane: membrane.asMembrane(),
|
|
533
|
-
agents: [
|
|
534
|
-
{
|
|
535
|
-
name: 'assistant',
|
|
536
|
-
model: 'test-model',
|
|
537
|
-
systemPrompt: 'Test',
|
|
538
|
-
allowedTools: ['nonexistent--tool'], // Won't match test--echo
|
|
539
|
-
},
|
|
540
|
-
],
|
|
541
|
-
modules: [testModule],
|
|
542
|
-
});
|
|
543
|
-
framework.pushEvent({
|
|
544
|
-
type: 'external-message',
|
|
545
|
-
source: 'test',
|
|
546
|
-
content: 'Hello',
|
|
547
|
-
metadata: {},
|
|
548
|
-
});
|
|
549
|
-
await framework.runUntilIdle();
|
|
550
|
-
// Should have no tools in the request
|
|
551
|
-
assert.strictEqual(membrane.calls[0].tools, undefined);
|
|
552
|
-
await framework.stop();
|
|
553
|
-
rmSync(tempDir, { recursive: true });
|
|
554
|
-
});
|
|
555
|
-
it('should support adding and removing modules at runtime', async () => {
|
|
556
|
-
const framework = await AgentFramework.create({
|
|
557
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
558
|
-
membrane: membrane.asMembrane(),
|
|
559
|
-
agents: [
|
|
560
|
-
{
|
|
561
|
-
name: 'assistant',
|
|
562
|
-
model: 'test-model',
|
|
563
|
-
systemPrompt: 'Test',
|
|
564
|
-
},
|
|
565
|
-
],
|
|
566
|
-
modules: [],
|
|
567
|
-
});
|
|
568
|
-
const testModule = new TestModule();
|
|
569
|
-
await framework.addModule(testModule);
|
|
570
|
-
assert.notStrictEqual(testModule.ctx, null);
|
|
571
|
-
await framework.removeModule('test');
|
|
572
|
-
assert.strictEqual(testModule.ctx, null);
|
|
573
|
-
await framework.stop();
|
|
574
|
-
rmSync(tempDir, { recursive: true });
|
|
575
|
-
});
|
|
576
|
-
it('should share store when provided', async () => {
|
|
577
|
-
// This test verifies that app-owned stores work
|
|
578
|
-
const { JsStore } = await import('@animalabs/chronicle');
|
|
579
|
-
const store = JsStore.openOrCreate({ path: join(tempDir, 'shared.chronicle') });
|
|
580
|
-
const framework = await AgentFramework.create({
|
|
581
|
-
store,
|
|
582
|
-
membrane: membrane.asMembrane(),
|
|
583
|
-
agents: [
|
|
584
|
-
{
|
|
585
|
-
name: 'assistant',
|
|
586
|
-
model: 'test-model',
|
|
587
|
-
systemPrompt: 'Test',
|
|
588
|
-
},
|
|
589
|
-
],
|
|
590
|
-
modules: [],
|
|
591
|
-
});
|
|
592
|
-
// Framework should work
|
|
593
|
-
assert.notStrictEqual(framework.getStore(), null);
|
|
594
|
-
assert.strictEqual(framework.getStore(), store);
|
|
595
|
-
await framework.stop();
|
|
596
|
-
// Store should still be open (framework doesn't own it)
|
|
597
|
-
// We can close it ourselves
|
|
598
|
-
store.close();
|
|
599
|
-
rmSync(tempDir, { recursive: true });
|
|
600
|
-
});
|
|
601
|
-
});
|
|
602
|
-
describe('Streaming lifecycle', () => {
|
|
603
|
-
let tempDir;
|
|
604
|
-
let membrane;
|
|
605
|
-
beforeEach(() => {
|
|
606
|
-
tempDir = mkdtempSync(join(tmpdir(), 'agent-framework-stream-'));
|
|
607
|
-
membrane = new MockMembrane();
|
|
608
|
-
});
|
|
609
|
-
it('should complete a simple stream without tool calls', async () => {
|
|
610
|
-
const testModule = new TestModule();
|
|
611
|
-
const events = [];
|
|
612
|
-
membrane.pushResponse(createMockResponse([{ type: 'text', text: 'Hello from stream' }]));
|
|
613
|
-
const framework = await AgentFramework.create({
|
|
614
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
615
|
-
membrane: membrane.asMembrane(),
|
|
616
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
617
|
-
modules: [testModule],
|
|
618
|
-
});
|
|
619
|
-
framework.onTrace((event) => events.push(event.type));
|
|
620
|
-
framework.pushEvent({
|
|
621
|
-
type: 'external-message',
|
|
622
|
-
source: 'test',
|
|
623
|
-
content: 'Hello',
|
|
624
|
-
metadata: {},
|
|
625
|
-
});
|
|
626
|
-
await framework.runUntilIdle();
|
|
627
|
-
assert.ok(events.includes('inference:started'));
|
|
628
|
-
assert.ok(events.includes('inference:tokens'));
|
|
629
|
-
assert.ok(events.includes('inference:completed'));
|
|
630
|
-
// Agent should be idle after completion
|
|
631
|
-
const agent = framework.getAgent('assistant');
|
|
632
|
-
assert.strictEqual(agent.state.status, 'idle');
|
|
633
|
-
await framework.stop();
|
|
634
|
-
rmSync(tempDir, { recursive: true });
|
|
635
|
-
});
|
|
636
|
-
it('should tag inference:tokens with block metadata and emit content_block boundaries', async () => {
|
|
637
|
-
const testModule = new TestModule();
|
|
638
|
-
const captured = [];
|
|
639
|
-
membrane.pushResponse(createMockResponse([{ type: 'text', text: 'thinking ⊕ text' }]));
|
|
640
|
-
const framework = await AgentFramework.create({
|
|
641
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
642
|
-
membrane: membrane.asMembrane(),
|
|
643
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
644
|
-
modules: [testModule],
|
|
645
|
-
});
|
|
646
|
-
framework.onTrace((e) => captured.push(e));
|
|
647
|
-
framework.pushEvent({
|
|
648
|
-
type: 'external-message',
|
|
649
|
-
source: 'test',
|
|
650
|
-
content: 'Hi',
|
|
651
|
-
metadata: {},
|
|
652
|
-
});
|
|
653
|
-
await framework.runUntilIdle();
|
|
654
|
-
const tokenEvents = captured.filter((e) => e.type === 'inference:tokens');
|
|
655
|
-
assert.ok(tokenEvents.length > 0, 'expected at least one inference:tokens event');
|
|
656
|
-
for (const t of tokenEvents) {
|
|
657
|
-
assert.strictEqual(t.blockType, 'text', 'tokens carry blockType from ChunkMeta');
|
|
658
|
-
assert.strictEqual(t.blockIndex, 0, 'tokens carry blockIndex from ChunkMeta');
|
|
659
|
-
}
|
|
660
|
-
const blockEvents = captured.filter((e) => e.type === 'inference:content_block');
|
|
661
|
-
const phases = blockEvents.map((e) => e.phase);
|
|
662
|
-
assert.deepStrictEqual(phases, ['block_start', 'block_complete'], 'content_block boundary events fire in lifecycle order');
|
|
663
|
-
for (const b of blockEvents) {
|
|
664
|
-
assert.strictEqual(b.blockType, 'text');
|
|
665
|
-
assert.strictEqual(b.blockIndex, 0);
|
|
666
|
-
}
|
|
667
|
-
await framework.stop();
|
|
668
|
-
rmSync(tempDir, { recursive: true });
|
|
669
|
-
});
|
|
670
|
-
it('should handle multi-round tool calls in a single stream', async () => {
|
|
671
|
-
const testModule = new TestModule();
|
|
672
|
-
// Round 1: tool call
|
|
673
|
-
membrane.pushResponse(createMockResponse([
|
|
674
|
-
{ type: 'text', text: 'First echo.' },
|
|
675
|
-
{ type: 'tool_use', id: 'call_1', name: 'test--echo', input: { message: 'round1' } },
|
|
676
|
-
], 'tool_use'));
|
|
677
|
-
// Round 2: another tool call
|
|
678
|
-
membrane.pushResponse(createMockResponse([
|
|
679
|
-
{ type: 'text', text: 'Second echo.' },
|
|
680
|
-
{ type: 'tool_use', id: 'call_2', name: 'test--echo', input: { message: 'round2' } },
|
|
681
|
-
], 'tool_use'));
|
|
682
|
-
// Round 3: final response
|
|
683
|
-
membrane.pushResponse(createMockResponse([
|
|
684
|
-
{ type: 'text', text: 'Done with both echoes.' },
|
|
685
|
-
]));
|
|
686
|
-
const framework = await AgentFramework.create({
|
|
687
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
688
|
-
membrane: membrane.asMembrane(),
|
|
689
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
690
|
-
modules: [testModule],
|
|
691
|
-
});
|
|
692
|
-
framework.pushEvent({
|
|
693
|
-
type: 'external-message',
|
|
694
|
-
source: 'test',
|
|
695
|
-
content: 'Do two echoes',
|
|
696
|
-
metadata: {},
|
|
697
|
-
});
|
|
698
|
-
await framework.runUntilIdle();
|
|
699
|
-
// Both tools were called
|
|
700
|
-
assert.strictEqual(testModule.toolCalls.length, 2);
|
|
701
|
-
assert.deepStrictEqual(testModule.toolCalls[0].input, { message: 'round1' });
|
|
702
|
-
assert.deepStrictEqual(testModule.toolCalls[1].input, { message: 'round2' });
|
|
703
|
-
// Still only one membrane call (one stream)
|
|
704
|
-
assert.strictEqual(membrane.calls.length, 1);
|
|
705
|
-
// Agent is idle
|
|
706
|
-
assert.strictEqual(framework.getAgent('assistant').state.status, 'idle');
|
|
707
|
-
await framework.stop();
|
|
708
|
-
rmSync(tempDir, { recursive: true });
|
|
709
|
-
});
|
|
710
|
-
it('should cancel active streams on stop', async () => {
|
|
711
|
-
const testModule = new TestModule();
|
|
712
|
-
// Response with a tool call but no follow-up (stream will wait forever)
|
|
713
|
-
membrane.pushResponse(createMockResponse([
|
|
714
|
-
{ type: 'tool_use', id: 'call_hang', name: 'test--echo', input: { message: 'hang' } },
|
|
715
|
-
], 'tool_use'));
|
|
716
|
-
const framework = await AgentFramework.create({
|
|
717
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
718
|
-
membrane: membrane.asMembrane(),
|
|
719
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
720
|
-
modules: [testModule],
|
|
721
|
-
});
|
|
722
|
-
framework.pushEvent({
|
|
723
|
-
type: 'external-message',
|
|
724
|
-
source: 'test',
|
|
725
|
-
content: 'Hang',
|
|
726
|
-
metadata: {},
|
|
727
|
-
});
|
|
728
|
-
// Process the event and start streaming (but don't wait for idle — it won't happen)
|
|
729
|
-
// Let the stream start and dispatch the tool call
|
|
730
|
-
for (let i = 0; i < 10; i++) {
|
|
731
|
-
await new Promise((resolve) => setTimeout(resolve, 5));
|
|
732
|
-
}
|
|
733
|
-
// stop() should cancel active streams and not hang
|
|
734
|
-
await framework.stop();
|
|
735
|
-
// Agent should be idle after cancellation
|
|
736
|
-
assert.strictEqual(framework.getAgent('assistant').state.status, 'idle');
|
|
737
|
-
rmSync(tempDir, { recursive: true });
|
|
738
|
-
});
|
|
739
|
-
it('should emit tool_calls_yielded and stream_resumed traces', async () => {
|
|
740
|
-
const testModule = new TestModule();
|
|
741
|
-
const events = [];
|
|
742
|
-
membrane.pushResponse(createMockResponse([
|
|
743
|
-
{ type: 'tool_use', id: 'call_t', name: 'test--echo', input: { message: 'trace' } },
|
|
744
|
-
], 'tool_use'));
|
|
745
|
-
membrane.pushResponse(createMockResponse([
|
|
746
|
-
{ type: 'text', text: 'Done' },
|
|
747
|
-
]));
|
|
748
|
-
const framework = await AgentFramework.create({
|
|
749
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
750
|
-
membrane: membrane.asMembrane(),
|
|
751
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
752
|
-
modules: [testModule],
|
|
753
|
-
});
|
|
754
|
-
framework.onTrace((event) => events.push(event.type));
|
|
755
|
-
framework.pushEvent({
|
|
756
|
-
type: 'external-message',
|
|
757
|
-
source: 'test',
|
|
758
|
-
content: 'Trace test',
|
|
759
|
-
metadata: {},
|
|
760
|
-
});
|
|
761
|
-
await framework.runUntilIdle();
|
|
762
|
-
assert.ok(events.includes('inference:tool_calls_yielded'), 'Should emit tool_calls_yielded');
|
|
763
|
-
assert.ok(events.includes('inference:stream_resumed'), 'Should emit stream_resumed');
|
|
764
|
-
assert.ok(events.includes('inference:completed'), 'Should emit completed');
|
|
765
|
-
await framework.stop();
|
|
766
|
-
rmSync(tempDir, { recursive: true });
|
|
767
|
-
});
|
|
768
|
-
it('should convert AF tool results to Membrane format when resuming stream', async () => {
|
|
769
|
-
const testModule = new TestModule();
|
|
770
|
-
membrane.pushResponse(createMockResponse([
|
|
771
|
-
{ type: 'tool_use', id: 'call_conv', name: 'test--echo', input: { message: 'convert' } },
|
|
772
|
-
], 'tool_use'));
|
|
773
|
-
membrane.pushResponse(createMockResponse([
|
|
774
|
-
{ type: 'text', text: 'Converted' },
|
|
775
|
-
]));
|
|
776
|
-
const framework = await AgentFramework.create({
|
|
777
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
778
|
-
membrane: membrane.asMembrane(),
|
|
779
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
780
|
-
modules: [testModule],
|
|
781
|
-
});
|
|
782
|
-
framework.pushEvent({
|
|
783
|
-
type: 'external-message',
|
|
784
|
-
source: 'test',
|
|
785
|
-
content: 'Convert test',
|
|
786
|
-
metadata: {},
|
|
787
|
-
});
|
|
788
|
-
await framework.runUntilIdle();
|
|
789
|
-
// Verify the mock stream received correctly converted tool results
|
|
790
|
-
const stream = membrane.lastStream;
|
|
791
|
-
assert.strictEqual(stream.receivedToolResults.length, 1);
|
|
792
|
-
const results = stream.receivedToolResults[0];
|
|
793
|
-
assert.strictEqual(results.length, 1);
|
|
794
|
-
assert.strictEqual(results[0].toolUseId, 'call_conv');
|
|
795
|
-
assert.strictEqual(results[0].content, JSON.stringify({ echoed: 'convert' }));
|
|
796
|
-
// Non-error results are now explicitly `isError: false` (the error path
|
|
797
|
-
// returns early, so the previous `isError: afResult.isError` was always
|
|
798
|
-
// falsy and misleading to read).
|
|
799
|
-
assert.strictEqual(results[0].isError, false);
|
|
800
|
-
await framework.stop();
|
|
801
|
-
rmSync(tempDir, { recursive: true });
|
|
802
|
-
});
|
|
803
|
-
});
|
|
804
|
-
describe('Module state persistence', () => {
|
|
805
|
-
let tempDir;
|
|
806
|
-
let membrane;
|
|
807
|
-
beforeEach(() => {
|
|
808
|
-
tempDir = mkdtempSync(join(tmpdir(), 'agent-framework-test-'));
|
|
809
|
-
membrane = new MockMembrane();
|
|
810
|
-
});
|
|
811
|
-
it('should persist and restore module state', async () => {
|
|
812
|
-
class StatefulModule {
|
|
813
|
-
name = 'stateful';
|
|
814
|
-
ctx = null;
|
|
815
|
-
async start(ctx) {
|
|
816
|
-
this.ctx = ctx;
|
|
817
|
-
// Set initial state
|
|
818
|
-
const existing = ctx.getState();
|
|
819
|
-
if (!existing) {
|
|
820
|
-
ctx.setState({ count: 1 });
|
|
821
|
-
}
|
|
822
|
-
else {
|
|
823
|
-
ctx.setState({ count: existing.count + 1 });
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
async stop() { }
|
|
827
|
-
getTools() { return []; }
|
|
828
|
-
async handleToolCall() {
|
|
829
|
-
return { success: false, error: 'No tools', isError: true };
|
|
830
|
-
}
|
|
831
|
-
async onProcess() { return {}; }
|
|
832
|
-
}
|
|
833
|
-
const storePath = join(tempDir, 'state.chronicle');
|
|
834
|
-
// First run
|
|
835
|
-
const module1 = new StatefulModule();
|
|
836
|
-
const framework1 = await AgentFramework.create({
|
|
837
|
-
storePath,
|
|
838
|
-
membrane: membrane.asMembrane(),
|
|
839
|
-
agents: [{ name: 'a', model: 'm', systemPrompt: 's' }],
|
|
840
|
-
modules: [module1],
|
|
841
|
-
});
|
|
842
|
-
assert.deepStrictEqual(module1.ctx?.getState()?.count, 1);
|
|
843
|
-
await framework1.stop();
|
|
844
|
-
// Second run - state should be restored
|
|
845
|
-
const module2 = new StatefulModule();
|
|
846
|
-
const framework2 = await AgentFramework.create({
|
|
847
|
-
storePath,
|
|
848
|
-
membrane: membrane.asMembrane(),
|
|
849
|
-
agents: [{ name: 'a', model: 'm', systemPrompt: 's' }],
|
|
850
|
-
modules: [module2],
|
|
851
|
-
});
|
|
852
|
-
assert.deepStrictEqual(module2.ctx?.getState()?.count, 2);
|
|
853
|
-
await framework2.stop();
|
|
854
|
-
rmSync(tempDir, { recursive: true });
|
|
855
|
-
});
|
|
856
|
-
it('should track external IDs', async () => {
|
|
857
|
-
class IdTrackingModule {
|
|
858
|
-
name = 'idtracker';
|
|
859
|
-
ctx = null;
|
|
860
|
-
async start(ctx) {
|
|
861
|
-
this.ctx = ctx;
|
|
862
|
-
}
|
|
863
|
-
async stop() { }
|
|
864
|
-
getTools() { return []; }
|
|
865
|
-
async handleToolCall() {
|
|
866
|
-
return { success: false, error: 'No tools', isError: true };
|
|
867
|
-
}
|
|
868
|
-
async onProcess() { return {}; }
|
|
869
|
-
}
|
|
870
|
-
const module = new IdTrackingModule();
|
|
871
|
-
const framework = await AgentFramework.create({
|
|
872
|
-
storePath: join(tempDir, 'ids.chronicle'),
|
|
873
|
-
membrane: membrane.asMembrane(),
|
|
874
|
-
agents: [{ name: 'a', model: 'm', systemPrompt: 's' }],
|
|
875
|
-
modules: [module],
|
|
876
|
-
});
|
|
877
|
-
// Add a message with external ID
|
|
878
|
-
const msgId = module.ctx.addMessage('User', [{ type: 'text', text: 'Hello from Discord' }], { external: { source: 'discord', id: 'msg123' } });
|
|
879
|
-
// Should be able to look it up
|
|
880
|
-
const found = module.ctx.findMessageByExternalId('discord', 'msg123');
|
|
881
|
-
assert.strictEqual(found, msgId);
|
|
882
|
-
// Unknown ID should return null
|
|
883
|
-
const notFound = module.ctx.findMessageByExternalId('discord', 'unknown');
|
|
884
|
-
assert.strictEqual(notFound, null);
|
|
885
|
-
await framework.stop();
|
|
886
|
-
rmSync(tempDir, { recursive: true });
|
|
887
|
-
});
|
|
888
|
-
});
|
|
889
|
-
describe('Trace listeners', () => {
|
|
890
|
-
let tempDir;
|
|
891
|
-
let framework;
|
|
892
|
-
beforeEach(async () => {
|
|
893
|
-
tempDir = mkdtempSync(join(tmpdir(), 'agent-framework-test-'));
|
|
894
|
-
framework = await AgentFramework.create({
|
|
895
|
-
storePath: join(tempDir, 'test.chronicle'),
|
|
896
|
-
membrane: new MockMembrane().asMembrane(),
|
|
897
|
-
agents: [{ name: 'assistant', model: 'test-model', systemPrompt: 'Test' }],
|
|
898
|
-
modules: [new TestModule()],
|
|
899
|
-
});
|
|
900
|
-
});
|
|
901
|
-
afterEach(async () => {
|
|
902
|
-
await framework.stop();
|
|
903
|
-
rmSync(tempDir, { recursive: true });
|
|
904
|
-
});
|
|
905
|
-
/** One trace event, process:received, emitted before pushEvent returns.
|
|
906
|
-
* Nothing processes the queue, so no other event follows it. */
|
|
907
|
-
function emit(name) {
|
|
908
|
-
framework.pushEvent({ type: 'external-message', source: 'test', content: name, metadata: {} });
|
|
909
|
-
}
|
|
910
|
-
/** A listener recording the events emit() names, in order. */
|
|
911
|
-
function recorder(heard) {
|
|
912
|
-
return (event) => {
|
|
913
|
-
if (event.type === 'process:received' && event.processEvent.type === 'external-message') {
|
|
914
|
-
heard.push(String(event.processEvent.content));
|
|
915
|
-
}
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
/** A listener recording the events emit() names, each tagged with whose it is. */
|
|
919
|
-
function tagged(order, tag) {
|
|
920
|
-
return (event) => {
|
|
921
|
-
if (event.type === 'process:received' && event.processEvent.type === 'external-message') {
|
|
922
|
-
order.push(`${tag}:${String(event.processEvent.content)}`);
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
it('a listener that unsubscribes itself during an event does not hide it from the next listener', () => {
|
|
927
|
-
const heard = [];
|
|
928
|
-
let selfCalls = 0;
|
|
929
|
-
const unsubscribe = framework.onTrace(() => {
|
|
930
|
-
selfCalls++;
|
|
931
|
-
unsubscribe();
|
|
932
|
-
});
|
|
933
|
-
framework.onTrace(recorder(heard));
|
|
934
|
-
emit('first');
|
|
935
|
-
emit('second');
|
|
936
|
-
assert.strictEqual(selfCalls, 1, 'the first listener hears the first event, then is gone');
|
|
937
|
-
assert.deepStrictEqual(heard, ['first', 'second']);
|
|
938
|
-
});
|
|
939
|
-
it('a listener that unsubscribes an earlier one during an event does not hide it from the next listener', () => {
|
|
940
|
-
const heard = [];
|
|
941
|
-
let earlierCalls = 0;
|
|
942
|
-
const earlier = () => { earlierCalls++; };
|
|
943
|
-
framework.onTrace(earlier);
|
|
944
|
-
framework.onTrace(() => framework.offTrace(earlier));
|
|
945
|
-
framework.onTrace(recorder(heard));
|
|
946
|
-
emit('first');
|
|
947
|
-
emit('second');
|
|
948
|
-
assert.strictEqual(earlierCalls, 1, 'the earlier listener hears the first event, then is gone');
|
|
949
|
-
assert.deepStrictEqual(heard, ['first', 'second']);
|
|
950
|
-
});
|
|
951
|
-
it('a listener unsubscribed before its turn hears neither that event nor any after it', () => {
|
|
952
|
-
const heard = [];
|
|
953
|
-
const after = [];
|
|
954
|
-
let unsubscribeRecorder = () => { };
|
|
955
|
-
framework.onTrace(() => unsubscribeRecorder());
|
|
956
|
-
unsubscribeRecorder = framework.onTrace(recorder(heard));
|
|
957
|
-
framework.onTrace(recorder(after));
|
|
958
|
-
emit('first');
|
|
959
|
-
emit('second');
|
|
960
|
-
assert.deepStrictEqual(heard, []);
|
|
961
|
-
assert.deepStrictEqual(after, ['first', 'second']);
|
|
962
|
-
});
|
|
963
|
-
it('a listener added during an event hears the next event, not that one', () => {
|
|
964
|
-
const heard = [];
|
|
965
|
-
let added = false;
|
|
966
|
-
framework.onTrace(() => {
|
|
967
|
-
if (added)
|
|
968
|
-
return;
|
|
969
|
-
added = true;
|
|
970
|
-
framework.onTrace(recorder(heard));
|
|
971
|
-
});
|
|
972
|
-
emit('first');
|
|
973
|
-
emit('second');
|
|
974
|
-
assert.deepStrictEqual(heard, ['second']);
|
|
975
|
-
});
|
|
976
|
-
it('a listener unsubscribed and subscribed again during an event hears the next event, not that one', () => {
|
|
977
|
-
const heard = [];
|
|
978
|
-
const listener = recorder(heard);
|
|
979
|
-
let resubscribed = false;
|
|
980
|
-
framework.onTrace(() => {
|
|
981
|
-
if (resubscribed)
|
|
982
|
-
return;
|
|
983
|
-
resubscribed = true;
|
|
984
|
-
framework.offTrace(listener);
|
|
985
|
-
framework.onTrace(listener);
|
|
986
|
-
});
|
|
987
|
-
framework.onTrace(listener);
|
|
988
|
-
emit('first');
|
|
989
|
-
emit('second');
|
|
990
|
-
assert.deepStrictEqual(heard, ['second']);
|
|
991
|
-
});
|
|
992
|
-
it('a listener is called as a plain function, not as a method of its subscription', () => {
|
|
993
|
-
const receivers = [];
|
|
994
|
-
framework.onTrace(function () {
|
|
995
|
-
receivers.push(this);
|
|
996
|
-
});
|
|
997
|
-
emit('first');
|
|
998
|
-
assert.deepStrictEqual(receivers, [undefined]);
|
|
999
|
-
});
|
|
1000
|
-
it('an unsubscribe removes its own subscription, however often it is called', () => {
|
|
1001
|
-
const order = [];
|
|
1002
|
-
const listener = tagged(order, 'L');
|
|
1003
|
-
framework.onTrace(listener);
|
|
1004
|
-
framework.onTrace(tagged(order, 'X'));
|
|
1005
|
-
const unsubscribeSecond = framework.onTrace(listener);
|
|
1006
|
-
unsubscribeSecond();
|
|
1007
|
-
unsubscribeSecond();
|
|
1008
|
-
emit('first');
|
|
1009
|
-
assert.deepStrictEqual(order, ['L:first', 'X:first']);
|
|
1010
|
-
});
|
|
1011
|
-
it('offTrace removes the first subscription its listener still has, and does nothing once none is left', () => {
|
|
1012
|
-
const order = [];
|
|
1013
|
-
const listener = tagged(order, 'L');
|
|
1014
|
-
framework.onTrace(listener);
|
|
1015
|
-
framework.onTrace(tagged(order, 'X'));
|
|
1016
|
-
framework.onTrace(listener);
|
|
1017
|
-
framework.offTrace(listener);
|
|
1018
|
-
emit('first');
|
|
1019
|
-
framework.offTrace(listener);
|
|
1020
|
-
emit('second');
|
|
1021
|
-
assert.doesNotThrow(() => framework.offTrace(listener));
|
|
1022
|
-
assert.deepStrictEqual(order, ['X:first', 'L:first', 'X:second']);
|
|
1023
|
-
});
|
|
1024
|
-
it('a listener that emits during delivery does not cut the outer delivery short, and an unsubscribe in the nested delivery holds for it', () => {
|
|
1025
|
-
const heard = [];
|
|
1026
|
-
const later = [];
|
|
1027
|
-
let nested = false;
|
|
1028
|
-
framework.onTrace(() => {
|
|
1029
|
-
if (nested)
|
|
1030
|
-
return;
|
|
1031
|
-
nested = true;
|
|
1032
|
-
emit('inner');
|
|
1033
|
-
});
|
|
1034
|
-
framework.onTrace(recorder(heard));
|
|
1035
|
-
let unsubscribeLater = () => { };
|
|
1036
|
-
framework.onTrace((event) => {
|
|
1037
|
-
if (event.type === 'process:received' && event.processEvent.type === 'external-message'
|
|
1038
|
-
&& event.processEvent.content === 'inner') {
|
|
1039
|
-
unsubscribeLater();
|
|
1040
|
-
}
|
|
1041
|
-
});
|
|
1042
|
-
unsubscribeLater = framework.onTrace(recorder(later));
|
|
1043
|
-
emit('outer');
|
|
1044
|
-
assert.deepStrictEqual(heard, ['inner', 'outer']);
|
|
1045
|
-
assert.deepStrictEqual(later, []);
|
|
1046
|
-
});
|
|
1047
|
-
});
|
|
1048
|
-
//# sourceMappingURL=framework.test.js.map
|