@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
|
@@ -42,14 +42,16 @@ export class McplServerRegistry {
|
|
|
42
42
|
throw new Error(`MCPL server "${config.id}" is already registered`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const connection = config.reconnect
|
|
45
|
+
const connection = config.reconnect === true
|
|
46
46
|
? await McplServerConnection.connectWithReconnect(config, hostCapabilities)
|
|
47
47
|
: await McplServerConnection.connect(config, hostCapabilities);
|
|
48
48
|
this.servers.set(config.id, connection);
|
|
49
49
|
|
|
50
|
-
// Auto-remove on
|
|
50
|
+
// Auto-remove on close unless the connection will reconnect. That was
|
|
51
|
+
// decided once, from `reconnect === true` at connect, and a close() the
|
|
52
|
+
// host asks for disarms it first, so a server closed for good goes too.
|
|
51
53
|
connection.on('close', () => {
|
|
52
|
-
if (!
|
|
54
|
+
if (!connection.willReconnect) {
|
|
53
55
|
this.servers.delete(config.id);
|
|
54
56
|
}
|
|
55
57
|
});
|
|
@@ -146,7 +148,16 @@ export class McplServerRegistry {
|
|
|
146
148
|
})), timeoutMs);
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Close a server for good and drop its entry, if this connection is still
|
|
153
|
+
* the one registered under `id`. The entry goes when close() resolves,
|
|
154
|
+
* whatever the connection reports: close() emits no 'close' for a
|
|
155
|
+
* connection that's down between retries, such as a reconnect stub waiting
|
|
156
|
+
* for its next retry, so the 'close' listener alone would leave it
|
|
157
|
+
* registered. A close that fails keeps the entry and rejects; a close
|
|
158
|
+
* already under way is shared.
|
|
159
|
+
*/
|
|
160
|
+
closeServer(id: string, connection: McplServerConnection): Promise<void> {
|
|
150
161
|
const existing = this.closing.get(connection);
|
|
151
162
|
if (existing) return existing;
|
|
152
163
|
const attempt = Promise.resolve().then(() => connection.close()).then(() => {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How `skip_reply` reads its `wake_in_seconds`, for every site that acts on
|
|
3
|
+
* it: the framework arms the EventGate's timer or refuses the call, the turn's
|
|
4
|
+
* bookkeeping of a refused round asks whether it was refused, and the channel
|
|
5
|
+
* registry words the confirmation. One reading, so a value can't arm a timer
|
|
6
|
+
* at one site and read as no wake at another, and the confirmation names the
|
|
7
|
+
* seconds the timer is set for.
|
|
8
|
+
*/
|
|
9
|
+
import { safeSlice } from '../safe-slice.js';
|
|
10
|
+
|
|
11
|
+
/** The range the tool's schema offers, in seconds: a larger number waits the most. */
|
|
12
|
+
export const SKIP_REPLY_WAKE_MIN_SECONDS = 1;
|
|
13
|
+
export const SKIP_REPLY_WAKE_MAX_SECONDS = 3600;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* What a `skip_reply` call's `wake_in_seconds` asks for:
|
|
17
|
+
* - `none`: absent or `null`, an ordinary skip;
|
|
18
|
+
* - `wake`: a number of at least 1, or a string that `Number()` reads as one,
|
|
19
|
+
* in whole seconds and at most 3600, so 90.7 waits 90 s and anything over
|
|
20
|
+
* 3600, Infinity included, waits 3600 s;
|
|
21
|
+
* - `invalid`: anything else, which asks for no number of seconds the host can
|
|
22
|
+
* set: a number below 1, such as 0, a negative or 0.5, and "soon", "",
|
|
23
|
+
* `true`, an array or an object. Below 1 is refused rather than raised to 1:
|
|
24
|
+
* 0 is a value a model may write when it fills an optional number with a
|
|
25
|
+
* default, and as a 1 s wake it would wake the agent again a second after
|
|
26
|
+
* each turn, for as long as it kept skipping with 0.
|
|
27
|
+
*/
|
|
28
|
+
export type SkipReplyWake =
|
|
29
|
+
| { kind: 'none' }
|
|
30
|
+
| { kind: 'wake'; seconds: number }
|
|
31
|
+
| { kind: 'invalid'; value: unknown };
|
|
32
|
+
|
|
33
|
+
export function readSkipReplyWake(input: unknown): SkipReplyWake {
|
|
34
|
+
const value = input !== null && typeof input === 'object'
|
|
35
|
+
? (input as Record<string, unknown>).wake_in_seconds
|
|
36
|
+
: undefined;
|
|
37
|
+
if (value === undefined || value === null) return { kind: 'none' };
|
|
38
|
+
// A blank string reads as 0, so it's refused as a number below 1.
|
|
39
|
+
const seconds = typeof value === 'number' ? value
|
|
40
|
+
: typeof value === 'string' ? Number(value)
|
|
41
|
+
: Number.NaN;
|
|
42
|
+
if (Number.isNaN(seconds) || seconds < SKIP_REPLY_WAKE_MIN_SECONDS) return { kind: 'invalid', value };
|
|
43
|
+
return { kind: 'wake', seconds: Math.floor(Math.min(SKIP_REPLY_WAKE_MAX_SECONDS, seconds)) };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The refusal the model reads when its host has no EventGate to set a timer. */
|
|
47
|
+
export const SKIP_REPLY_WAKE_NO_GATE_REFUSAL =
|
|
48
|
+
"Your turn didn't end, and no wake was set: this host can't wake you on a timer, so skip_reply can't take wake_in_seconds here. To end the turn and wait for the next message, call skip_reply without it. Anything you meant to come back to, do now.";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Why a `skip_reply` call is refused, as the model will read it, or undefined
|
|
52
|
+
* when it isn't: without an EventGate, any `wake_in_seconds` but absent or
|
|
53
|
+
* `null`, since the host offers none; with one, a value that isn't a number of
|
|
54
|
+
* seconds. A refused call arms nothing and doesn't end the turn.
|
|
55
|
+
*/
|
|
56
|
+
export function skipReplyWakeRefusal(wake: SkipReplyWake, gatePresent: boolean): string | undefined {
|
|
57
|
+
if (wake.kind === 'none') return undefined;
|
|
58
|
+
if (!gatePresent) return SKIP_REPLY_WAKE_NO_GATE_REFUSAL;
|
|
59
|
+
if (wake.kind === 'wake') return undefined;
|
|
60
|
+
return `Your turn didn't end, and no wake was set: wake_in_seconds takes a number of seconds from ${SKIP_REPLY_WAKE_MIN_SECONDS} to ${SKIP_REPLY_WAKE_MAX_SECONDS}, and ${describeValue(wake.value)} isn't one. Call skip_reply with a number of seconds to come back on your own, or without wake_in_seconds to end the turn and wait for the next message.`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A value as the model wrote it, as JSON, cut to keep the refusal short,
|
|
65
|
+
* never between the halves of a surrogate pair. A tool call's input is parsed
|
|
66
|
+
* JSON, so it always has a JSON text, but JSON writes a number that isn't
|
|
67
|
+
* finite as `null`, and `-1e400` parses as -Infinity, so a number prints as
|
|
68
|
+
* `String()` of it.
|
|
69
|
+
*/
|
|
70
|
+
function describeValue(value: unknown): string {
|
|
71
|
+
const text = typeof value === 'number' ? String(value) : JSON.stringify(value);
|
|
72
|
+
return text.length > 80 ? `${safeSlice(text, 0, 80)}…` : text;
|
|
73
|
+
}
|
package/src/mcpl/transport.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { StringDecoder } from 'node:string_decoder';
|
|
|
23
23
|
import WebSocket from 'ws';
|
|
24
24
|
|
|
25
25
|
import type { McplServerConfig } from './types.js';
|
|
26
|
+
import { assertBooleanSetting } from '../config-checks.js';
|
|
27
|
+
import { logDetail } from './log-value.js';
|
|
26
28
|
|
|
27
29
|
/** Why/how a transport closed. `code`/`signal` are populated for stdio child
|
|
28
30
|
* exits; `reason` carries a WebSocket close reason or an error message. */
|
|
@@ -55,7 +57,10 @@ export abstract class McplTransport extends EventEmitter {
|
|
|
55
57
|
private lineBuffer: string[] = [];
|
|
56
58
|
private stderrBuffer: string[] = [];
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
/** The server's id from its config, so a line the transport logs names it.
|
|
61
|
+
* The stdio and WebSocket transports always give it; a test's stand-in
|
|
62
|
+
* transport may leave it out. */
|
|
63
|
+
protected constructor(protected readonly serverId?: string) {
|
|
59
64
|
super();
|
|
60
65
|
// Flush buffered inbound lines the moment a consumer subscribes.
|
|
61
66
|
this.on('newListener', (event) => {
|
|
@@ -85,6 +90,15 @@ export abstract class McplTransport extends EventEmitter {
|
|
|
85
90
|
return '';
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Resolves once the server's diagnostic stream has ended or closed, so that
|
|
95
|
+
* {@link stderrTail} holds what arrived on it, or once `ms` have passed while
|
|
96
|
+
* it hasn't. At once for a transport that has none.
|
|
97
|
+
*/
|
|
98
|
+
stderrEnded(_ms: number): Promise<void> {
|
|
99
|
+
return Promise.resolve();
|
|
100
|
+
}
|
|
101
|
+
|
|
88
102
|
/** Deliver an inbound line, buffering it if nobody is listening yet. */
|
|
89
103
|
protected pushLine(line: string): void {
|
|
90
104
|
if (this.listenerCount('line') > 0) this.emit('line', line);
|
|
@@ -97,6 +111,23 @@ export abstract class McplTransport extends EventEmitter {
|
|
|
97
111
|
else this.stderrBuffer.push(line);
|
|
98
112
|
}
|
|
99
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Report a transport error: to the 'error' listeners if there are any, else
|
|
116
|
+
* as a log line. EventEmitter throws an 'error' that nothing listens for,
|
|
117
|
+
* and a transport reports its errors from I/O callbacks, where nothing
|
|
118
|
+
* catches that throw, so it would end the process. A transport has no
|
|
119
|
+
* listener from its creation until the handshake attaches one, and a
|
|
120
|
+
* WebSocket server that sends a malformed frame with its upgrade response
|
|
121
|
+
* makes ws raise an 'error' in that window.
|
|
122
|
+
*/
|
|
123
|
+
protected reportError(err: Error): void {
|
|
124
|
+
if (this.listenerCount('error') > 0) this.emit('error', err);
|
|
125
|
+
else {
|
|
126
|
+
const server = this.serverId === undefined ? '' : `${this.serverId}: `;
|
|
127
|
+
console.error(`[mcpl] ${server}a ${this.kind} transport error, with nothing listening for it: ${logDetail(err.message)}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
100
131
|
/** Emit 'close' exactly once. */
|
|
101
132
|
protected markClosed(info: TransportCloseInfo): void {
|
|
102
133
|
if (this._closed) return;
|
|
@@ -141,15 +172,17 @@ export const CHILD_ENV_ALLOWLIST = [
|
|
|
141
172
|
|
|
142
173
|
/** Environment for a stdio child: allowlisted host vars (+ LC_*), then the
|
|
143
174
|
* server's declared `env` on top. Windows names merge case-insensitively;
|
|
144
|
-
* POSIX names remain case-sensitive. `inheritEnv: true` restores full inheritance
|
|
175
|
+
* POSIX names remain case-sensitive. `inheritEnv: true` restores full inheritance,
|
|
176
|
+
* and only `true` does: a direct caller can pass any value, unchecked. */
|
|
145
177
|
export function buildChildEnv(
|
|
146
178
|
config: Pick<McplServerConfig, 'env' | 'inheritEnv'>,
|
|
147
179
|
hostEnv: NodeJS.ProcessEnv = process.env,
|
|
148
180
|
platform: NodeJS.Platform = process.platform,
|
|
149
181
|
): NodeJS.ProcessEnv {
|
|
150
182
|
const win = platform === 'win32';
|
|
151
|
-
const
|
|
152
|
-
|
|
183
|
+
const inherit = config.inheritEnv === true;
|
|
184
|
+
const env: NodeJS.ProcessEnv = inherit ? { ...hostEnv } : {};
|
|
185
|
+
if (!inherit) {
|
|
153
186
|
for (const [key, value] of Object.entries(hostEnv)) {
|
|
154
187
|
if (value === undefined) continue;
|
|
155
188
|
// Windows commonly enumerates Path/SystemRoot rather than PATH/SYSTEMROOT.
|
|
@@ -184,22 +217,58 @@ export function buildChildEnv(
|
|
|
184
217
|
/** The most of a stdio child's stderr a transport keeps for {@link McplTransport.stderrTail}. */
|
|
185
218
|
export const STDERR_TAIL_CHARS = 2_048;
|
|
186
219
|
|
|
220
|
+
/**
|
|
221
|
+
* How long a refusal at a stdio child's exit waits for the child's stderr to
|
|
222
|
+
* end, so that its `stderrTail` holds what the child wrote. Node can emit a
|
|
223
|
+
* child's `exit` before it has read the last of the child's stderr. When the
|
|
224
|
+
* child held the stream alone, the stream ends with it, and the wait is short.
|
|
225
|
+
* The bound binds when another process still holds the stream, such as one the
|
|
226
|
+
* server started that inherited it, or when the host's loop stalls past it
|
|
227
|
+
* before reading an end that is waiting. The tail then holds what had arrived.
|
|
228
|
+
* A process that keeps the stream open, such as one the server started and
|
|
229
|
+
* left running, holds the refusal up by the bound, a fifth of the reconnect's
|
|
230
|
+
* default first interval.
|
|
231
|
+
*/
|
|
232
|
+
export const STDERR_END_WAIT_MS = 1_000;
|
|
233
|
+
|
|
187
234
|
export class StdioTransport extends McplTransport {
|
|
188
235
|
readonly kind = 'stdio' as const;
|
|
189
236
|
/** The first error on the child's stdin or stdout, named in the close reason. */
|
|
190
237
|
private pipeError: Error | undefined;
|
|
191
238
|
private stderrEnd = '';
|
|
192
239
|
private stderrCut = false;
|
|
240
|
+
/** True once the child's stderr has ended or closed. */
|
|
241
|
+
private stderrDone = false;
|
|
193
242
|
|
|
194
243
|
override get stderrTail(): string {
|
|
195
244
|
return (this.stderrCut ? '…' : '') + this.stderrEnd;
|
|
196
245
|
}
|
|
197
246
|
|
|
247
|
+
override stderrEnded(ms: number): Promise<void> {
|
|
248
|
+
const stderr = this.child.stderr;
|
|
249
|
+
if (!stderr || this.stderrDone) return Promise.resolve();
|
|
250
|
+
return new Promise((resolve) => {
|
|
251
|
+
let timer: NodeJS.Timeout | undefined;
|
|
252
|
+
const done = () => {
|
|
253
|
+
clearTimeout(timer);
|
|
254
|
+
stderr.off('end', done);
|
|
255
|
+
stderr.off('close', done);
|
|
256
|
+
resolve();
|
|
257
|
+
};
|
|
258
|
+
// Added after the constructor's listeners, so the tail already holds the
|
|
259
|
+
// stream's last characters when these run.
|
|
260
|
+
stderr.once('end', done);
|
|
261
|
+
stderr.once('close', done);
|
|
262
|
+
timer = setTimeout(done, ms);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
198
266
|
private constructor(
|
|
199
267
|
private readonly child: ChildProcess,
|
|
200
268
|
private readonly rl: ReadlineInterface,
|
|
269
|
+
serverId: string,
|
|
201
270
|
) {
|
|
202
|
-
super();
|
|
271
|
+
super(serverId);
|
|
203
272
|
|
|
204
273
|
this.rl.on('line', (line: string) => this.pushLine(line));
|
|
205
274
|
|
|
@@ -224,9 +293,12 @@ export class StdioTransport extends McplTransport {
|
|
|
224
293
|
this.child.stderr?.on('end', () => {
|
|
225
294
|
received(decoder.end());
|
|
226
295
|
if (carry.length > 0) this.pushStderr(carry);
|
|
296
|
+
this.stderrDone = true;
|
|
227
297
|
});
|
|
298
|
+
// A stream destroyed by an error closes without ending: nothing more comes.
|
|
299
|
+
this.child.stderr?.on('close', () => { this.stderrDone = true; });
|
|
228
300
|
|
|
229
|
-
this.child.on('error', (err) => this.
|
|
301
|
+
this.child.on('error', (err) => this.reportError(err));
|
|
230
302
|
// The child's stdin and stdout carry the protocol, so after an error on
|
|
231
303
|
// either, a write's EPIPE or a read error, this transport can't reach the
|
|
232
304
|
// child even if it's still running. The handler sends a running child
|
|
@@ -247,13 +319,11 @@ export class StdioTransport extends McplTransport {
|
|
|
247
319
|
// listener absorbs that copy.
|
|
248
320
|
this.child.stdout?.on('error', endOnPipeError);
|
|
249
321
|
this.rl.on('error', () => { /* readline's copy of a stdout error, handled above */ });
|
|
250
|
-
// stderr carries diagnostics only: a read error on it is reported
|
|
251
|
-
//
|
|
252
|
-
// is wired; during a handshake the listener is the
|
|
253
|
-
// fails it.
|
|
254
|
-
this.child.stderr?.on('error', (err) =>
|
|
255
|
-
if (this.listenerCount('error') > 0) this.emit('error', err);
|
|
256
|
-
});
|
|
322
|
+
// stderr carries diagnostics only: a read error on it is reported, to the
|
|
323
|
+
// listeners or else in the log, and never thrown. It ends nothing once
|
|
324
|
+
// the connection is wired; during a handshake the listener is the
|
|
325
|
+
// handshake's, which fails it.
|
|
326
|
+
this.child.stderr?.on('error', (err) => this.reportError(err));
|
|
257
327
|
this.child.on('exit', (code, signal) => this.markClosed({
|
|
258
328
|
code,
|
|
259
329
|
signal,
|
|
@@ -293,7 +363,7 @@ export class StdioTransport extends McplTransport {
|
|
|
293
363
|
});
|
|
294
364
|
});
|
|
295
365
|
const rl = createInterface({ input: child.stdout! });
|
|
296
|
-
return new StdioTransport(child, rl);
|
|
366
|
+
return new StdioTransport(child, rl, config.id);
|
|
297
367
|
}
|
|
298
368
|
|
|
299
369
|
writeLine(json: string): void {
|
|
@@ -332,8 +402,8 @@ const WS_OPEN_TIMEOUT_MS = 15_000;
|
|
|
332
402
|
export class WebSocketTransport extends McplTransport {
|
|
333
403
|
readonly kind = 'websocket' as const;
|
|
334
404
|
|
|
335
|
-
private constructor(private readonly ws: WebSocket) {
|
|
336
|
-
super();
|
|
405
|
+
private constructor(private readonly ws: WebSocket, serverId: string) {
|
|
406
|
+
super(serverId);
|
|
337
407
|
|
|
338
408
|
this.ws.on('message', (data: WebSocket.RawData, isBinary: boolean) => {
|
|
339
409
|
// MCPL frames are UTF-8 JSON text. A frame MAY contain multiple
|
|
@@ -345,7 +415,7 @@ export class WebSocketTransport extends McplTransport {
|
|
|
345
415
|
}
|
|
346
416
|
});
|
|
347
417
|
|
|
348
|
-
this.ws.on('error', (err: Error) => this.
|
|
418
|
+
this.ws.on('error', (err: Error) => this.reportError(err));
|
|
349
419
|
this.ws.on('close', (code: number, reason: Buffer) => {
|
|
350
420
|
const text = reason?.toString('utf8');
|
|
351
421
|
this.markClosed(text ? { code, reason: text, reasonFromPeer: true } : { code, reason: 'websocket closed' });
|
|
@@ -404,7 +474,7 @@ export class WebSocketTransport extends McplTransport {
|
|
|
404
474
|
settled = true;
|
|
405
475
|
clearTimeout(timer);
|
|
406
476
|
ws.removeAllListeners('error'); // the instance re-attaches its own handlers
|
|
407
|
-
resolve(new WebSocketTransport(ws));
|
|
477
|
+
resolve(new WebSocketTransport(ws, config.id));
|
|
408
478
|
});
|
|
409
479
|
|
|
410
480
|
ws.once('error', (err: Error) => {
|
|
@@ -481,6 +551,38 @@ export function isWebSocketTransport(config: McplServerConfig): boolean {
|
|
|
481
551
|
return Boolean(config.url) && !config.command;
|
|
482
552
|
}
|
|
483
553
|
|
|
554
|
+
/** The settings of McplServerConfig whose type is boolean. */
|
|
555
|
+
type BooleanSetting = {
|
|
556
|
+
[K in keyof McplServerConfig]-?: NonNullable<McplServerConfig[K]> extends boolean ? K : never;
|
|
557
|
+
}[keyof McplServerConfig];
|
|
558
|
+
|
|
559
|
+
/** What `true` does for each boolean setting, as its refusal says it. A
|
|
560
|
+
* boolean setting added to McplServerConfig doesn't compile until it has
|
|
561
|
+
* an entry here, so the check below covers it too. */
|
|
562
|
+
const SERVER_CONFIG_BOOLEANS: Record<BooleanSetting, string> = {
|
|
563
|
+
inheritEnv: 'true passes the server the host\'s whole environment, and false or leaving it out passes only the allowlisted and LC_* host variables',
|
|
564
|
+
reconnect: 'true retries in the background when the server can\'t be reached or its connection drops, and false or leaving it out doesn\'t',
|
|
565
|
+
allowHostCommands: 'true lets the server run the host\'s admin commands, such as undo, hide, unstick and quiesce, and false or leaving it out refuses them',
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Refuse a server config whose `inheritEnv`, `reconnect` or `allowHostCommands`
|
|
570
|
+
* holds anything but true or false. A config read from JSON can carry a quoted
|
|
571
|
+
* "false" where the type says boolean, and every reader of these settings takes
|
|
572
|
+
* only `true` as on, so the quotes would hide what the value does. null counts
|
|
573
|
+
* as not set, so a generated config that writes an unset setting as null
|
|
574
|
+
* keeps working. `inheritEnv` is checked only for a stdio server, since a
|
|
575
|
+
* WebSocket server never reads it. The error names the server, the setting
|
|
576
|
+
* and the value's kind, not the value, which could be a secret pasted into
|
|
577
|
+
* the wrong field.
|
|
578
|
+
*/
|
|
579
|
+
export function assertServerConfigBooleans(config: McplServerConfig): void {
|
|
580
|
+
for (const [setting, whatTrueDoes] of Object.entries(SERVER_CONFIG_BOOLEANS) as Array<[BooleanSetting, string]>) {
|
|
581
|
+
if (setting === 'inheritEnv' && isWebSocketTransport(config)) continue;
|
|
582
|
+
assertBooleanSetting(`MCPL server "${config.id}" ${setting}`, config[setting], whatTrueDoes);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
484
586
|
/**
|
|
485
587
|
* Open the transport selected by `config` (WebSocket when `transport` is
|
|
486
588
|
* 'websocket' or a bare `url` is given; stdio otherwise). The returned transport
|
package/src/mcpl/types.ts
CHANGED
|
@@ -238,7 +238,10 @@ export interface McplServerConfig {
|
|
|
238
238
|
/**
|
|
239
239
|
* Escape hatch: pass the host's entire environment (including secrets) to
|
|
240
240
|
* the stdio child, as older versions did. Only for servers that genuinely
|
|
241
|
-
* need it. Default false.
|
|
241
|
+
* need it. Default false. Only `true` turns it on, and null counts as not
|
|
242
|
+
* set. For a stdio server, `create()`, `connectMcplServer` and
|
|
243
|
+
* `restartMcplServer` refuse any other value, such as a quoted "false". A
|
|
244
|
+
* WebSocket server never reads it.
|
|
242
245
|
*/
|
|
243
246
|
inheritEnv?: boolean;
|
|
244
247
|
|
|
@@ -278,7 +281,9 @@ export interface McplServerConfig {
|
|
|
278
281
|
* unstick). DEFAULT FALSE: no §6.2 capability path exists for it, and the
|
|
279
282
|
* grant cannot confer it — only this config, decided by the operator, can
|
|
280
283
|
* (PR #79 review blocker 9). The one legitimate fleet user is
|
|
281
|
-
* discord-mcpl's slash-command relay.
|
|
284
|
+
* discord-mcpl's slash-command relay. Only `true` turns it on, and null
|
|
285
|
+
* counts as not set. `create()`, `connectMcplServer` and
|
|
286
|
+
* `restartMcplServer` refuse any other value, such as a quoted "true".
|
|
282
287
|
*/
|
|
283
288
|
allowHostCommands?: boolean;
|
|
284
289
|
|
|
@@ -351,6 +356,9 @@ export interface McplServerConfig {
|
|
|
351
356
|
* When true, connect() resolves immediately (with null capabilities) if the
|
|
352
357
|
* server is unavailable, and retries in the background.
|
|
353
358
|
* Adapted from Anarchid/agent-framework@mcpl-module-proto.
|
|
359
|
+
* Only `true` turns it on, and null counts as not set. `create()`,
|
|
360
|
+
* `connectMcplServer` and `restartMcplServer` refuse any other value, such
|
|
361
|
+
* as a quoted "false".
|
|
354
362
|
*/
|
|
355
363
|
reconnect?: boolean;
|
|
356
364
|
|
|
@@ -378,7 +386,10 @@ export interface McplServerConfig {
|
|
|
378
386
|
* stops reading its stdin without closing it: the host's writes are
|
|
379
387
|
* buffered, no error is raised, and the connection stays up. This is the
|
|
380
388
|
* timeout of every request that names none; the handshake's initialize has
|
|
381
|
-
* its own. Set 0 to disable
|
|
389
|
+
* its own. Set 0 to disable, except for channels/publish and the
|
|
390
|
+
* channels/open a delivery may send first, which keep the 60 s default: a
|
|
391
|
+
* publish's outcome is reported to the resident and recorded for its
|
|
392
|
+
* draft, so it must end. Default: 60000 (60 seconds).
|
|
382
393
|
*/
|
|
383
394
|
requestTimeoutMs?: number;
|
|
384
395
|
|
|
@@ -31,6 +31,33 @@ export function isVisiblyEmptyContent(content: readonly unknown[] | null | undef
|
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* What the converter (convertBlock, on every lane) shows for a text
|
|
36
|
+
* block whose text isn't a string, which only a nonconformant sender writes,
|
|
37
|
+
* so the agent learns that a block was there. It is the host's word, not the
|
|
38
|
+
* sender's, so it never makes content visible (isVisiblyEmptyConversion).
|
|
39
|
+
*/
|
|
40
|
+
export const NON_STRING_TEXT_PLACEHOLDER = "[Text not shown: the server's text block had no string text.]";
|
|
41
|
+
|
|
42
|
+
/** A wire text block whose text isn't a string, which the converter shows as
|
|
43
|
+
* NON_STRING_TEXT_PLACEHOLDER. */
|
|
44
|
+
function isNonStringTextBlock(block: unknown): boolean {
|
|
45
|
+
if (!block || typeof block !== 'object') return false;
|
|
46
|
+
const b = block as { type?: unknown; text?: unknown };
|
|
47
|
+
return b.type === 'text' && typeof b.text !== 'string';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* isVisiblyEmptyContent for content as a converter showed it, `wire` being
|
|
52
|
+
* the content as it arrived, block for block: a block shown as
|
|
53
|
+
* NON_STRING_TEXT_PLACEHOLDER counts as the nothing it held. So content that
|
|
54
|
+
* is only such blocks (or blank text) is still empty, and anything else is
|
|
55
|
+
* judged as the converted blocks show it, placeholders included.
|
|
56
|
+
*/
|
|
57
|
+
export function isVisiblyEmptyConversion(wire: readonly unknown[], converted: readonly unknown[]): boolean {
|
|
58
|
+
return isVisiblyEmptyContent(converted.filter((_, i) => !isNonStringTextBlock(wire[i])));
|
|
59
|
+
}
|
|
60
|
+
|
|
34
61
|
/** The server id and feature set the marker must carry. */
|
|
35
62
|
export const SILENT_HEARTBEAT_SERVER_ID = 'heartbeat';
|
|
36
63
|
export const SILENT_HEARTBEAT_FEATURE_SET = 'heartbeat';
|
package/src/module-registry.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsStore } from '@animalabs/chronicle';
|
|
1
|
+
import type { JsStateRegistration, JsStore } from '@animalabs/chronicle';
|
|
2
2
|
import type { ContentBlock } from '@animalabs/membrane';
|
|
3
3
|
import type {
|
|
4
4
|
MessageId,
|
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
} from './types/index.js';
|
|
26
26
|
import type { Agent } from './agent.js';
|
|
27
27
|
import { DEFAULT_SHUTDOWN_TIMEOUT_MS, validateShutdownTimeout, waitForShutdown } from './shutdown.js';
|
|
28
|
+
import { logValue } from './mcpl/log-value.js';
|
|
28
29
|
|
|
29
30
|
/** How the registry queues a module's event: its push names the module. A
|
|
30
31
|
* `ProcessQueue` serves too, ignoring the name. */
|
|
@@ -44,6 +45,25 @@ export function isStateExistsError(err: unknown): boolean {
|
|
|
44
45
|
return err instanceof Error && err.message.includes('State already exists');
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Register a state, treating "already exists" as done: a store reopened after
|
|
50
|
+
* a restart already holds it. Every other failure is thrown here, where it
|
|
51
|
+
* happened, naming the state, with the store's own error as its cause. Each
|
|
52
|
+
* state the framework registers goes through this.
|
|
53
|
+
*/
|
|
54
|
+
export function ensureStateRegistered(
|
|
55
|
+
store: Pick<JsStore, 'registerState'>,
|
|
56
|
+
registration: JsStateRegistration,
|
|
57
|
+
): void {
|
|
58
|
+
try {
|
|
59
|
+
store.registerState(registration);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (isStateExistsError(error)) return;
|
|
62
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
63
|
+
throw new Error(`Registering state '${registration.id}' failed: ${reason}`, { cause: error });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
47
67
|
/**
|
|
48
68
|
* Hard ceiling for a single module's gatherContext budget, regardless of the
|
|
49
69
|
* `contextTimeoutMs` it declares. gatherContext runs on the critical path of
|
|
@@ -81,6 +101,8 @@ export class ModuleRegistry {
|
|
|
81
101
|
|
|
82
102
|
private modules: Map<string, Module> = new Map();
|
|
83
103
|
private stopping = new Map<Module, Promise<void>>();
|
|
104
|
+
/** Module and namespace pairs already told that a system injection held a block that isn't text. */
|
|
105
|
+
private notShownWarned = new Set<string>();
|
|
84
106
|
private moduleContexts: Map<string, ModuleContextImpl> = new Map();
|
|
85
107
|
private speechHandlers: SpeechHandler[] = [];
|
|
86
108
|
private store: JsStore;
|
|
@@ -146,14 +168,7 @@ export class ModuleRegistry {
|
|
|
146
168
|
|
|
147
169
|
// Register module state in store
|
|
148
170
|
const stateId = this.getStateId(module.name);
|
|
149
|
-
|
|
150
|
-
this.store.registerState({
|
|
151
|
-
id: stateId,
|
|
152
|
-
strategy: 'snapshot',
|
|
153
|
-
});
|
|
154
|
-
} catch {
|
|
155
|
-
// State already registered (from previous run)
|
|
156
|
-
}
|
|
171
|
+
ensureStateRegistered(this.store, { id: stateId, strategy: 'snapshot' });
|
|
157
172
|
|
|
158
173
|
// Check if this is a restart (state exists)
|
|
159
174
|
const existingState = this.store.getStateJson(stateId);
|
|
@@ -318,12 +333,13 @@ export class ModuleRegistry {
|
|
|
318
333
|
};
|
|
319
334
|
}
|
|
320
335
|
|
|
321
|
-
// Create a call with the un-prefixed name (preserving caller identity)
|
|
336
|
+
// Create a call with the un-prefixed name (preserving caller identity and turn)
|
|
322
337
|
const moduleCall: ToolCall = {
|
|
323
338
|
id: call.id,
|
|
324
339
|
name: toolName,
|
|
325
340
|
input: call.input,
|
|
326
341
|
callerAgentName: call.callerAgentName,
|
|
342
|
+
...(call.callerTurnId !== undefined ? { callerTurnId: call.callerTurnId } : {}),
|
|
327
343
|
};
|
|
328
344
|
|
|
329
345
|
try {
|
|
@@ -425,7 +441,10 @@ export class ModuleRegistry {
|
|
|
425
441
|
);
|
|
426
442
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
427
443
|
const promise = Promise.race([
|
|
428
|
-
module.gatherContext(agentName).then(r =>
|
|
444
|
+
module.gatherContext(agentName).then(r => {
|
|
445
|
+
injections.push(...r);
|
|
446
|
+
this.noteBlocksNotShown(module.name, r);
|
|
447
|
+
}),
|
|
429
448
|
new Promise<void>((_, rej) => {
|
|
430
449
|
timer = setTimeout(
|
|
431
450
|
() => rej(new Error(`gatherContext timed out after ${budgetMs}ms`)),
|
|
@@ -443,6 +462,28 @@ export class ModuleRegistry {
|
|
|
443
462
|
return injections;
|
|
444
463
|
}
|
|
445
464
|
|
|
465
|
+
/**
|
|
466
|
+
* The system prompt is text, so an agent given a `system` injection reads
|
|
467
|
+
* a line in place of each of its blocks that isn't text (the agent's
|
|
468
|
+
* buildSystemPrompt), though `ContextInjection`'s content may be any
|
|
469
|
+
* block. The module meant those blocks for the model, so its operator is
|
|
470
|
+
* told, once per module and namespace, as the module's injections are
|
|
471
|
+
* gathered, whichever agents are given them.
|
|
472
|
+
*/
|
|
473
|
+
private noteBlocksNotShown(moduleName: string, injections: ContextInjection[]): void {
|
|
474
|
+
for (const injection of injections) {
|
|
475
|
+
if (injection.position !== 'system' || !injection.content.some((block) => block.type !== 'text')) continue;
|
|
476
|
+
const key = `${moduleName}\u0000${injection.namespace}`;
|
|
477
|
+
if (this.notShownWarned.has(key)) continue;
|
|
478
|
+
this.notShownWarned.add(key);
|
|
479
|
+
console.error(
|
|
480
|
+
`[${moduleName}] gatherContext: a system injection in namespace ${logValue(injection.namespace)} holds a block that ` +
|
|
481
|
+
"isn't text, which the system prompt can't carry, so an agent given the injection reads a line in place of each such block; " +
|
|
482
|
+
'this line prints once per module and namespace while the host runs',
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
446
487
|
/**
|
|
447
488
|
* Tell modules an agent's tool batch completed (see
|
|
448
489
|
* Module.onToolBatchComplete). Hooks run in parallel, each awaited up to
|
|
@@ -640,18 +681,12 @@ class ModuleContextImpl implements ModuleContext {
|
|
|
640
681
|
name: string,
|
|
641
682
|
opts?: { deltaSnapshotEvery?: number; fullSnapshotEvery?: number }
|
|
642
683
|
): void {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
fullSnapshotEvery: opts?.fullSnapshotEvery ?? 20,
|
|
650
|
-
});
|
|
651
|
-
} catch (err) {
|
|
652
|
-
if (!isStateExistsError(err)) throw err;
|
|
653
|
-
// Already registered (previous run) — idempotent path.
|
|
654
|
-
}
|
|
684
|
+
ensureStateRegistered(this.store, {
|
|
685
|
+
id: this.logStateId(name),
|
|
686
|
+
strategy: 'append_log',
|
|
687
|
+
deltaSnapshotEvery: opts?.deltaSnapshotEvery ?? 100,
|
|
688
|
+
fullSnapshotEvery: opts?.fullSnapshotEvery ?? 20,
|
|
689
|
+
});
|
|
655
690
|
this.registeredLogStates.add(name);
|
|
656
691
|
}
|
|
657
692
|
|
package/src/modules/api/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ export class ApiModule implements Module {
|
|
|
40
40
|
|
|
41
41
|
async handleToolCall(_call: ToolCall): Promise<ToolResult> {
|
|
42
42
|
// API module has no tools
|
|
43
|
-
return { success: false, error: 'Unknown tool' };
|
|
43
|
+
return { success: false, error: 'Unknown tool', isError: true };
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async onProcess(event: ProcessEvent, _state: ProcessState): Promise<EventResponse> {
|
|
@@ -29,6 +29,17 @@ export interface DiscordJsClientConfig {
|
|
|
29
29
|
channelIds?: string[];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/** An attachment as both a live message and history carry it. */
|
|
33
|
+
function toAttachment(a: Attachment): DiscordAttachment {
|
|
34
|
+
return {
|
|
35
|
+
id: a.id,
|
|
36
|
+
filename: a.name ?? 'unknown',
|
|
37
|
+
url: a.url,
|
|
38
|
+
contentType: a.contentType ?? undefined,
|
|
39
|
+
size: a.size,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
export class DiscordJsClient implements DiscordClientInterface {
|
|
33
44
|
private client: Client;
|
|
34
45
|
private token: string;
|
|
@@ -68,7 +79,11 @@ export class DiscordJsClient implements DiscordClientInterface {
|
|
|
68
79
|
});
|
|
69
80
|
|
|
70
81
|
this.client.on('messageUpdate', (_oldMessage, newMessage) => {
|
|
71
|
-
|
|
82
|
+
// content is null for a partial message, one discord.js hadn't cached
|
|
83
|
+
// and whose update carried no text, so there's no text to compare; a
|
|
84
|
+
// cached message keeps the text it had. An edit that leaves no text,
|
|
85
|
+
// beside an attachment, is '' and is still an edit.
|
|
86
|
+
if (typeof newMessage.content !== 'string' || !this.editHandler) return;
|
|
72
87
|
this.editHandler(newMessage.id, newMessage.content);
|
|
73
88
|
});
|
|
74
89
|
|
|
@@ -114,13 +129,7 @@ export class DiscordJsClient implements DiscordClientInterface {
|
|
|
114
129
|
}
|
|
115
130
|
|
|
116
131
|
private convertMessage(message: Message): DiscordMessageData {
|
|
117
|
-
const attachments
|
|
118
|
-
id: a.id,
|
|
119
|
-
filename: a.name ?? 'unknown',
|
|
120
|
-
url: a.url,
|
|
121
|
-
contentType: a.contentType ?? undefined,
|
|
122
|
-
size: a.size,
|
|
123
|
-
}));
|
|
132
|
+
const attachments = message.attachments.map(toAttachment);
|
|
124
133
|
|
|
125
134
|
// Extract mentioned user IDs
|
|
126
135
|
const mentionedUserIds = message.mentions.users.map((u: User) => u.id);
|
|
@@ -160,7 +169,7 @@ export class DiscordJsClient implements DiscordClientInterface {
|
|
|
160
169
|
channelId: string,
|
|
161
170
|
content: string,
|
|
162
171
|
options?: { replyTo?: string; createThread?: { name: string } }
|
|
163
|
-
): Promise<{ messageId: string }> {
|
|
172
|
+
): Promise<{ messageId: string; threadFailure?: string }> {
|
|
164
173
|
const channel = await this.client.channels.fetch(channelId);
|
|
165
174
|
if (!channel || !('send' in channel)) {
|
|
166
175
|
throw new Error(`Channel ${channelId} not found or not a text channel`);
|
|
@@ -173,7 +182,13 @@ export class DiscordJsClient implements DiscordClientInterface {
|
|
|
173
182
|
});
|
|
174
183
|
|
|
175
184
|
if (options?.createThread && 'threads' in textChannel) {
|
|
176
|
-
|
|
185
|
+
try {
|
|
186
|
+
await message.startThread({ name: options.createThread.name });
|
|
187
|
+
} catch (error) {
|
|
188
|
+
// The message is out, so the caller counts it as sent before it
|
|
189
|
+
// reports why its thread wasn't started.
|
|
190
|
+
return { messageId: message.id, threadFailure: error instanceof Error ? error.message : String(error) };
|
|
191
|
+
}
|
|
177
192
|
}
|
|
178
193
|
|
|
179
194
|
return { messageId: message.id };
|
|
@@ -341,6 +356,7 @@ export class DiscordJsClient implements DiscordClientInterface {
|
|
|
341
356
|
authorName: m.author.username,
|
|
342
357
|
isBot: m.author.bot,
|
|
343
358
|
content: m.content,
|
|
359
|
+
attachments: m.attachments.map(toAttachment),
|
|
344
360
|
timestamp: m.createdAt,
|
|
345
361
|
replyTo: m.reference
|
|
346
362
|
? {
|