@animalabs/agent-framework 0.22.2 → 0.23.0
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 +108 -4
- package/dist/src/agent.d.ts +108 -17
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +207 -67
- 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/index.d.ts +1 -1
- package/dist/src/code-execution/index.d.ts.map +1 -1
- package/dist/src/code-execution/index.js.map +1 -1
- package/dist/src/code-execution/py-runner.d.ts +50 -7
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +258 -90
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts +3 -2
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +94 -8
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/code-execution/tool-definition.d.ts +17 -1
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +72 -6
- 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 +56 -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 +1529 -165
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +8264 -1939
- 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 +36 -5
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/held-writes.d.ts +16 -0
- package/dist/src/held-writes.d.ts.map +1 -0
- package/dist/src/held-writes.js +56 -0
- package/dist/src/held-writes.js.map +1 -0
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-grant.d.ts +4 -0
- package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
- package/dist/src/mcpl/capability-grant.js +1 -1
- package/dist/src/mcpl/capability-grant.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +233 -18
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +975 -386
- 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 +88 -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 +7 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +5 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +19 -13
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +155 -87
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +7 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -1
- package/dist/src/mcpl/log-value.js +9 -0
- package/dist/src/mcpl/log-value.js.map +1 -1
- package/dist/src/mcpl/modern-connection.d.ts +227 -0
- package/dist/src/mcpl/modern-connection.d.ts.map +1 -0
- package/dist/src/mcpl/modern-connection.js +1088 -0
- package/dist/src/mcpl/modern-connection.js.map +1 -0
- package/dist/src/mcpl/prefix-rule.d.ts +18 -0
- package/dist/src/mcpl/prefix-rule.d.ts.map +1 -0
- package/dist/src/mcpl/prefix-rule.js +25 -0
- package/dist/src/mcpl/prefix-rule.js.map +1 -0
- package/dist/src/mcpl/protocol-family.d.ts +179 -0
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -0
- package/dist/src/mcpl/protocol-family.js +697 -0
- package/dist/src/mcpl/protocol-family.js.map +1 -0
- package/dist/src/mcpl/push-coalescer.d.ts +58 -17
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +93 -32
- 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 +76 -13
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +275 -66
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +98 -18
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +170 -32
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +406 -31
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +1331 -272
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts +35 -6
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +63 -13
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/skip-reply-wake.d.ts +36 -0
- package/dist/src/mcpl/skip-reply-wake.d.ts.map +1 -0
- package/dist/src/mcpl/skip-reply-wake.js +55 -0
- package/dist/src/mcpl/skip-reply-wake.js.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts +54 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.js +232 -0
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +104 -12
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +315 -85
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +76 -19
- 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 +16 -0
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +26 -0
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +34 -6
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +119 -31
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/api/index.d.ts +1 -1
- package/dist/src/modules/api/index.d.ts.map +1 -1
- package/dist/src/modules/api/index.js +3 -2
- package/dist/src/modules/api/index.js.map +1 -1
- package/dist/src/modules/discord/discord-js-client.d.ts +43 -2
- package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.js +286 -67
- package/dist/src/modules/discord/discord-js-client.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +53 -5
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +712 -186
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/discord/refusal.d.ts +14 -0
- package/dist/src/modules/discord/refusal.d.ts.map +1 -0
- package/dist/src/modules/discord/refusal.js +14 -0
- package/dist/src/modules/discord/refusal.js.map +1 -0
- package/dist/src/modules/discord/types.d.ts +27 -4
- 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 +8 -3
- 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/index.d.ts +1 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -1
- package/dist/src/modules/index.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 +57 -4
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +75 -7
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +66 -7
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +303 -46
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +313 -45
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +1404 -304
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +315 -16
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +727 -37
- 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 +28 -5
- 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 +49 -2
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js +158 -29
- 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/silent-heartbeat.d.ts +112 -39
- package/dist/src/silent-heartbeat.d.ts.map +1 -1
- package/dist/src/silent-heartbeat.js +100 -29
- package/dist/src/silent-heartbeat.js.map +1 -1
- package/dist/src/tool-args.d.ts +40 -0
- package/dist/src/tool-args.d.ts.map +1 -0
- package/dist/src/tool-args.js +207 -0
- package/dist/src/tool-args.js.map +1 -0
- 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 +266 -62
- 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 +44 -22
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +25 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +38 -7
- 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 +77 -14
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +97 -8
- 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 +5 -4
- package/src/agent.ts +257 -72
- 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/index.ts +1 -0
- package/src/code-execution/py-runner.ts +304 -93
- package/src/code-execution/runtime-py.ts +94 -8
- package/src/code-execution/tool-definition.ts +85 -7
- package/src/config-checks.ts +50 -0
- package/src/deadline-timer.ts +44 -0
- package/src/error-message.ts +48 -0
- package/src/framework.ts +8625 -1984
- package/src/gate/event-gate.ts +38 -5
- package/src/held-writes.ts +59 -0
- package/src/index.ts +29 -5
- package/src/mcpl/capability-grant.ts +1 -1
- package/src/mcpl/channel-registry.ts +1095 -411
- package/src/mcpl/checkpoint-manager.ts +104 -29
- package/src/mcpl/conversation-router.ts +28 -8
- package/src/mcpl/convert-block.ts +105 -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 +23 -1
- package/src/mcpl/inference-router.ts +179 -103
- package/src/mcpl/log-value.ts +10 -0
- package/src/mcpl/modern-connection.ts +1182 -0
- package/src/mcpl/prefix-rule.ts +32 -0
- package/src/mcpl/protocol-family.ts +691 -0
- package/src/mcpl/push-coalescer.ts +110 -36
- package/src/mcpl/push-handler.ts +20 -90
- package/src/mcpl/reference-fetcher.ts +318 -67
- package/src/mcpl/references.ts +183 -34
- package/src/mcpl/server-connection.ts +1404 -280
- package/src/mcpl/server-registry.ts +63 -14
- package/src/mcpl/skip-reply-wake.ts +73 -0
- package/src/mcpl/tool-result-normalize.ts +294 -0
- package/src/mcpl/transport.ts +320 -76
- package/src/mcpl/types.ts +77 -19
- package/src/mcpl/visible-content.ts +28 -0
- package/src/module-registry.ts +126 -36
- package/src/modules/api/index.ts +3 -2
- package/src/modules/discord/discord-js-client.ts +306 -74
- package/src/modules/discord/index.ts +737 -201
- package/src/modules/discord/refusal.ts +13 -0
- package/src/modules/discord/types.ts +27 -6
- package/src/modules/health/index.ts +8 -3
- package/src/modules/history/index.ts +410 -120
- package/src/modules/history/semantic.ts +189 -32
- package/src/modules/index.ts +1 -1
- package/src/modules/unknown-tool.ts +16 -0
- package/src/modules/workspace/disk-agreement.ts +97 -8
- package/src/modules/workspace/effects.ts +291 -36
- package/src/modules/workspace/index.ts +1469 -321
- package/src/modules/workspace/observe.ts +784 -41
- package/src/modules/workspace/reconcile.ts +619 -64
- package/src/modules/workspace/types.ts +28 -5
- package/src/modules/workspace/watcher.ts +154 -30
- 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/silent-heartbeat.ts +184 -59
- package/src/tool-args.ts +213 -0
- package/src/tool-image-ledger.ts +153 -34
- package/src/tool-presentation.ts +233 -42
- 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 +44 -24
- package/src/types/events.ts +25 -0
- package/src/types/framework.ts +38 -7
- package/src/types/inference-log.ts +1 -1
- package/src/types/module.ts +79 -14
- package/src/types/trace.ts +103 -8
- 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
|
@@ -32,6 +32,93 @@ function wildcardMatch(pattern, name) {
|
|
|
32
32
|
return true;
|
|
33
33
|
}
|
|
34
34
|
// ============================================================================
|
|
35
|
+
// Results
|
|
36
|
+
// ============================================================================
|
|
37
|
+
/**
|
|
38
|
+
* The inference/request result for a completed inference, the same for both
|
|
39
|
+
* modes: the response's text, the model that served it, why it stopped, and
|
|
40
|
+
* its usage.
|
|
41
|
+
*
|
|
42
|
+
* A response MCPL can't report as a completion throws, and is answered with
|
|
43
|
+
* the error: one the provider ended with an error, one where the model wrote a
|
|
44
|
+
* tool call, since inference/request offers the model none, and one with a
|
|
45
|
+
* stop reason FinishReason has no value for (see finishReasonFor).
|
|
46
|
+
*/
|
|
47
|
+
function resultFrom(response, routedModel) {
|
|
48
|
+
// A provider can end an inference with finish_reason 'error' and no error
|
|
49
|
+
// object. membrane 0.5.87's OpenAI-style adapters fail a stream on a frame
|
|
50
|
+
// that carries one, as OpenRouter's mid-stream error does, but pass the token
|
|
51
|
+
// alone through, and membrane, having no stop reason for it, normalizes it
|
|
52
|
+
// to end_turn and keeps it as providerReason.
|
|
53
|
+
if (response.details.stop.providerReason === 'error') {
|
|
54
|
+
throw new Error("The provider ended the inference with an error (finish_reason 'error')");
|
|
55
|
+
}
|
|
56
|
+
// membrane's yielding stream lists a native tool call in toolCalls only
|
|
57
|
+
// when the stop was tool_use, so a tool_use block cut off by another stop is
|
|
58
|
+
// only in the content. membrane's complete() lists every tool_use block in
|
|
59
|
+
// toolCalls, whatever the stop.
|
|
60
|
+
const toolUses = response.content.filter((b) => b.type === 'tool_use');
|
|
61
|
+
if (response.toolCalls.length > 0 || toolUses.length > 0) {
|
|
62
|
+
throw toolCallError(response.toolCalls.length > 0 ? response.toolCalls : toolUses);
|
|
63
|
+
}
|
|
64
|
+
// In XML tool mode membrane reads tool calls out of the text. Markup it
|
|
65
|
+
// reads no call from still shows in how the output ended: with a tool-call
|
|
66
|
+
// block still open (a call cut off at max_tokens, or an opening tag written
|
|
67
|
+
// in prose), or at `</function_calls>`, the stop sequence XML tool mode adds
|
|
68
|
+
// so that it can run calls (inference/request asks for no stop sequence of
|
|
69
|
+
// its own). Either way the markup is in the text.
|
|
70
|
+
if (response.details.stop.unclosedToolBlock) {
|
|
71
|
+
throw new Error("The model's output ended with a tool-call block still open, and inference/request offers no tools");
|
|
72
|
+
}
|
|
73
|
+
if (response.details.stop.triggeredSequence === '</function_calls>') {
|
|
74
|
+
throw new Error('The model wrote tool-call markup, and inference/request offers no tools');
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
content: response.content
|
|
78
|
+
.filter((b) => b.type === 'text')
|
|
79
|
+
.map((b) => b.text)
|
|
80
|
+
.join(''),
|
|
81
|
+
// Spec §11.3: the actual model used, which can differ from the routed one
|
|
82
|
+
// where routing or fallback applies. When membrane names none, the routed
|
|
83
|
+
// model is the only one there is to report.
|
|
84
|
+
model: actualModelOf(response) ?? routedModel,
|
|
85
|
+
finishReason: finishReasonFor(response.stopReason),
|
|
86
|
+
usage: {
|
|
87
|
+
inputTokens: response.usage.inputTokens,
|
|
88
|
+
outputTokens: response.usage.outputTokens,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The model membrane says served the response, or undefined when it names
|
|
94
|
+
* none. membrane's type says it always names one, but some of its adapters
|
|
95
|
+
* pass the provider's own value through as it is, which can be empty.
|
|
96
|
+
*/
|
|
97
|
+
function actualModelOf(response) {
|
|
98
|
+
return response.details.model.actual || undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* MCPL's finishReason for membrane's stop reason. Spec §11.3 closes
|
|
102
|
+
* FinishReason at these three, so any other stop throws: `end_turn` for a
|
|
103
|
+
* refusal, or for a turn membrane's resumption guard ended (`no_progress`,
|
|
104
|
+
* `round_limit`), would tell the server the model had finished.
|
|
105
|
+
*/
|
|
106
|
+
function finishReasonFor(stopReason) {
|
|
107
|
+
switch (stopReason) {
|
|
108
|
+
case 'end_turn':
|
|
109
|
+
case 'max_tokens':
|
|
110
|
+
case 'stop_sequence':
|
|
111
|
+
return stopReason;
|
|
112
|
+
default:
|
|
113
|
+
throw new Error(`The inference ended with stop reason '${stopReason}', for which inference/request has no finishReason`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** The error for a model that called a tool, which inference/request doesn't offer. */
|
|
117
|
+
function toolCallError(calls) {
|
|
118
|
+
const names = calls.map((call) => call.name).join(', ');
|
|
119
|
+
return new Error(`The model called a tool (${names}), and inference/request offers none`);
|
|
120
|
+
}
|
|
121
|
+
// ============================================================================
|
|
35
122
|
// Constants
|
|
36
123
|
// ============================================================================
|
|
37
124
|
/** Default max tokens when not specified in preferences. */
|
|
@@ -45,14 +132,12 @@ export class InferenceRouter {
|
|
|
45
132
|
featureSetManager;
|
|
46
133
|
routingPolicy;
|
|
47
134
|
emitTraceFn;
|
|
48
|
-
|
|
49
|
-
constructor(membrane, hookOrchestrator, featureSetManager, routingPolicy, emitTraceFn, sendChunkFn) {
|
|
135
|
+
constructor(membrane, hookOrchestrator, featureSetManager, routingPolicy, emitTraceFn) {
|
|
50
136
|
this.membrane = membrane;
|
|
51
137
|
this.hookOrchestrator = hookOrchestrator;
|
|
52
138
|
this.featureSetManager = featureSetManager;
|
|
53
139
|
this.routingPolicy = routingPolicy;
|
|
54
140
|
this.emitTraceFn = emitTraceFn;
|
|
55
|
-
this.sendChunkFn = sendChunkFn;
|
|
56
141
|
}
|
|
57
142
|
/**
|
|
58
143
|
* Handle an inference/request from an MCPL server.
|
|
@@ -60,9 +145,10 @@ export class InferenceRouter {
|
|
|
60
145
|
* 1. Validate feature set
|
|
61
146
|
* 2. Check loop prevention (reject if inside a hook)
|
|
62
147
|
* 3. Resolve model from routing policy
|
|
63
|
-
* 4. Build membrane request
|
|
64
|
-
* 5.
|
|
65
|
-
* 6.
|
|
148
|
+
* 4. Build membrane request
|
|
149
|
+
* 5. Run inference, streaming its visible text as chunks when asked
|
|
150
|
+
* 6. Answer with the result, or with the error for any ending that isn't
|
|
151
|
+
* a completion
|
|
66
152
|
*/
|
|
67
153
|
async handleInferenceRequest(serverId, params, responder) {
|
|
68
154
|
// 1. Validate feature set
|
|
@@ -105,47 +191,44 @@ export class InferenceRouter {
|
|
|
105
191
|
temperature: params.preferences?.temperature,
|
|
106
192
|
},
|
|
107
193
|
};
|
|
194
|
+
// Streaming needs a way to send chunks and an id to tag them with;
|
|
195
|
+
// without either, the request is answered whole.
|
|
196
|
+
const sendChunk = params.stream ? responder.sendChunk?.bind(responder) : undefined;
|
|
197
|
+
const chunkRequestId = sendChunk ? responder.requestId : undefined;
|
|
198
|
+
const streamed = chunkRequestId != null;
|
|
108
199
|
try {
|
|
109
|
-
// 5. Run inference
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
await this.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
// Emit trace: inference complete
|
|
132
|
-
this.emitTraceFn({
|
|
133
|
-
type: 'mcpl:inference_complete',
|
|
134
|
-
serverId,
|
|
135
|
-
model,
|
|
136
|
-
inputTokens: result.usage.inputTokens,
|
|
137
|
-
outputTokens: result.usage.outputTokens,
|
|
138
|
-
});
|
|
139
|
-
responder.respond(result);
|
|
140
|
-
}
|
|
200
|
+
// 5. Run inference. Both modes end in membrane's response, and one
|
|
201
|
+
// builder makes the result from it.
|
|
202
|
+
const response = chunkRequestId != null
|
|
203
|
+
? await this.streamResponse(request, chunkRequestId, sendChunk)
|
|
204
|
+
: await this.membrane.complete(request);
|
|
205
|
+
// 6. Answer
|
|
206
|
+
const result = resultFrom(response, model);
|
|
207
|
+
const actualModel = actualModelOf(response);
|
|
208
|
+
this.emitTraceFn({
|
|
209
|
+
type: 'mcpl:inference_complete',
|
|
210
|
+
serverId,
|
|
211
|
+
// The routed model, as inference_start has it. actualModel is the one
|
|
212
|
+
// the result reports, left out when membrane named none.
|
|
213
|
+
model,
|
|
214
|
+
...(actualModel !== undefined ? { actualModel } : {}),
|
|
215
|
+
inputTokens: result.usage.inputTokens,
|
|
216
|
+
outputTokens: result.usage.outputTokens,
|
|
217
|
+
streamed,
|
|
218
|
+
});
|
|
219
|
+
responder.respond(result);
|
|
141
220
|
}
|
|
142
221
|
catch (err) {
|
|
143
|
-
//
|
|
222
|
+
// Every ending that isn't a completion lands here, in either mode:
|
|
223
|
+
// membrane's error, a stream that stopped early, a tool call, or a
|
|
224
|
+
// stop FinishReason can't name. The answer is the JSON-RPC error, never
|
|
225
|
+
// a result carrying what arrived.
|
|
144
226
|
this.emitTraceFn({
|
|
145
227
|
type: 'mcpl:inference_fail',
|
|
146
228
|
serverId,
|
|
147
229
|
model,
|
|
148
230
|
error: err instanceof Error ? err.message : String(err),
|
|
231
|
+
streamed,
|
|
149
232
|
});
|
|
150
233
|
responder.respondError(-32603, err instanceof Error ? err.message : 'Inference failed');
|
|
151
234
|
}
|
|
@@ -190,60 +273,45 @@ export class InferenceRouter {
|
|
|
190
273
|
// Private: Streaming
|
|
191
274
|
// ==========================================================================
|
|
192
275
|
/**
|
|
193
|
-
*
|
|
276
|
+
* Run the inference as a stream, sending each visible text delta to the
|
|
277
|
+
* server as an inference/chunk, and return membrane's response once the
|
|
278
|
+
* stream completes.
|
|
194
279
|
*
|
|
195
|
-
*
|
|
196
|
-
* membrane
|
|
280
|
+
* Every other ending throws, so the request is answered with the error
|
|
281
|
+
* rather than with the text that arrived: membrane's `error`, an `aborted`
|
|
282
|
+
* stream, a stream that ends with no terminal event, and `tool-calls`. A
|
|
283
|
+
* stream that has yielded tool calls waits for their results until it is
|
|
284
|
+
* cancelled, and inference/request offers the model no tools. Leaving the
|
|
285
|
+
* loop by return or throw calls the stream's return(), which cancels it,
|
|
286
|
+
* so nothing keeps running once the request is answered.
|
|
197
287
|
*/
|
|
198
|
-
async
|
|
199
|
-
const requestId = responder.requestId;
|
|
200
|
-
// Check if streamYielding is available on the membrane instance.
|
|
201
|
-
// We use streamYielding to iterate events and forward text deltas as chunks.
|
|
288
|
+
async streamResponse(request, requestId, sendChunk) {
|
|
202
289
|
const stream = this.membrane.streamYielding(request);
|
|
203
|
-
let
|
|
204
|
-
let fullContent = '';
|
|
290
|
+
let index = 0;
|
|
205
291
|
for await (const event of stream) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
292
|
+
switch (event.type) {
|
|
293
|
+
case 'tokens':
|
|
294
|
+
// Only text membrane marks visible is sent, which leaves out
|
|
295
|
+
// thinking and tool-call markup. The result's content is the
|
|
296
|
+
// response's text blocks, which membrane parses on its own, so in
|
|
297
|
+
// XML tool mode the chunks can miss text the content holds: prose
|
|
298
|
+
// naming a tag the stream parser opens a block for, or a thinking
|
|
299
|
+
// block cut off before its close tag.
|
|
300
|
+
if (event.meta.visible) {
|
|
301
|
+
sendChunk({ requestId, index: index++, delta: event.content });
|
|
302
|
+
}
|
|
303
|
+
break;
|
|
304
|
+
case 'tool-calls':
|
|
305
|
+
throw toolCallError(event.calls);
|
|
306
|
+
case 'complete':
|
|
307
|
+
return event.response;
|
|
308
|
+
case 'error':
|
|
309
|
+
throw event.error;
|
|
310
|
+
case 'aborted':
|
|
311
|
+
throw new Error(`The inference stopped before it finished (${event.reason})`);
|
|
214
312
|
}
|
|
215
313
|
}
|
|
216
|
-
|
|
217
|
-
const result = {
|
|
218
|
-
content: fullContent,
|
|
219
|
-
model,
|
|
220
|
-
finishReason: 'end_turn',
|
|
221
|
-
usage: { inputTokens: 0, outputTokens: 0 },
|
|
222
|
-
};
|
|
223
|
-
this.emitTraceFn({
|
|
224
|
-
type: 'mcpl:inference_complete',
|
|
225
|
-
serverId,
|
|
226
|
-
model,
|
|
227
|
-
streamed: true,
|
|
228
|
-
});
|
|
229
|
-
responder.respond(result);
|
|
230
|
-
}
|
|
231
|
-
// ==========================================================================
|
|
232
|
-
// Private: Helpers
|
|
233
|
-
// ==========================================================================
|
|
234
|
-
/**
|
|
235
|
-
* Map membrane's stopReason string to MCPL's finishReason enum.
|
|
236
|
-
*/
|
|
237
|
-
mapStopReason(stopReason) {
|
|
238
|
-
switch (stopReason) {
|
|
239
|
-
case 'max_tokens':
|
|
240
|
-
return 'max_tokens';
|
|
241
|
-
case 'stop_sequence':
|
|
242
|
-
return 'stop_sequence';
|
|
243
|
-
case 'end_turn':
|
|
244
|
-
default:
|
|
245
|
-
return 'end_turn';
|
|
246
|
-
}
|
|
314
|
+
throw new Error('The inference stream ended without a result');
|
|
247
315
|
}
|
|
248
316
|
}
|
|
249
317
|
//# sourceMappingURL=inference-router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference-router.js","sourceRoot":"","sources":["../../../src/mcpl/inference-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"inference-router.js","sourceRoot":"","sources":["../../../src/mcpl/inference-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkBH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAkB/D,+EAA+E;AAC/E,wDAAwD;AACxD,+EAA+E;AAE/E;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe,EAAE,IAAY;IAClD,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC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CAAC,aAAa,CAAC,OAAO,CAAC;IACpC,CAAC;IAED,6EAA6E;IAC7E,qBAAqB;IACrB,6EAA6E;IAE7E;;;;;;;;;;;;OAYG;IACK,KAAK,CAAC,cAAc,CAC1B,OAA0B,EAC1B,SAA0B,EAC1B,SAAiD;QAEjD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;gBACnB,KAAK,QAAQ;oBACX,6DAA6D;oBAC7D,6DAA6D;oBAC7D,kEAAkE;oBAClE,kEAAkE;oBAClE,kEAAkE;oBAClE,sCAAsC;oBACtC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;wBACvB,SAAS,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACjE,CAAC;oBACD,MAAM;gBACR,KAAK,YAAY;oBACf,MAAM,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACnC,KAAK,UAAU;oBACb,OAAO,KAAK,CAAC,QAAQ,CAAC;gBACxB,KAAK,OAAO;oBACV,MAAM,KAAK,CAAC,KAAK,CAAC;gBACpB,KAAK,SAAS;oBACZ,MAAM,IAAI,KAAK,CAAC,6CAA6C,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;CACF"}
|
|
@@ -42,6 +42,13 @@
|
|
|
42
42
|
* of those can read (a revoked Proxy) as `[unprintable]`.
|
|
43
43
|
*/
|
|
44
44
|
export declare function logValue(value: unknown): string;
|
|
45
|
+
/**
|
|
46
|
+
* `logValue` of a value a server chose whose text may hold a credential:
|
|
47
|
+
* its text, as logValue reads it (a JSON value as its JSON text), with
|
|
48
|
+
* `redact` applied, then printed as logValue prints a field. A value whose
|
|
49
|
+
* text holds nothing `redact` replaces prints exactly as logValue prints it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function logValueRedacted(value: unknown, redact: (text: string) => string): string;
|
|
45
52
|
/**
|
|
46
53
|
* The host's own message, as the free text that ends a log line after its
|
|
47
54
|
* fields: `reason=coalesce-invalid field=payload.content: "content must be an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-value.d.ts","sourceRoot":"","sources":["../../../src/mcpl/log-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD"}
|
|
1
|
+
{"version":3,"file":"log-value.d.ts","sourceRoot":"","sources":["../../../src/mcpl/log-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAEzF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD"}
|
|
@@ -44,6 +44,15 @@
|
|
|
44
44
|
export function logValue(value) {
|
|
45
45
|
return printed(textOf(value), FIELD);
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* `logValue` of a value a server chose whose text may hold a credential:
|
|
49
|
+
* its text, as logValue reads it (a JSON value as its JSON text), with
|
|
50
|
+
* `redact` applied, then printed as logValue prints a field. A value whose
|
|
51
|
+
* text holds nothing `redact` replaces prints exactly as logValue prints it.
|
|
52
|
+
*/
|
|
53
|
+
export function logValueRedacted(value, redact) {
|
|
54
|
+
return printed(redact(textOf(value)), FIELD);
|
|
55
|
+
}
|
|
47
56
|
/**
|
|
48
57
|
* The host's own message, as the free text that ends a log line after its
|
|
49
58
|
* fields: `reason=coalesce-invalid field=payload.content: "content must be an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-value.js","sourceRoot":"","sources":["../../../src/mcpl/log-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAQD,MAAM,KAAK,GAAS;IAClB,KAAK,EAAE,6DAA6D;IACpE,OAAO,EAAE,uDAAuD;CACjE,CAAC;AAEF,MAAM,MAAM,GAAS;IACnB,KAAK,EAAE,4DAA4D;IACnE,OAAO,EAAE,2DAA2D;CACrE,CAAC;AAEF,iEAAiE;AACjE,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,SAAS,OAAO,CAAC,IAAY,EAAE,IAAU;IACvC,IAAI,IAAI,CAAC,MAAM,IAAI,WAAW;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACzF,IAAI,GAAG,GAAG,WAAW,CAAC;I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,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,IAAI,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IACxG,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { type CallToolResult } from '@modelcontextprotocol/client';
|
|
3
|
+
import type { McplServerConfig, McpToolDefinition } from './types.js';
|
|
4
|
+
/** A modern tool result as the framework consumes it. `structuredContent` is
|
|
5
|
+
* kept by presence: `false`, `0` and `null` are values, not absence. */
|
|
6
|
+
export interface ModernToolCallResult {
|
|
7
|
+
content: CallToolResult['content'];
|
|
8
|
+
isError?: boolean;
|
|
9
|
+
structuredContent?: unknown;
|
|
10
|
+
_meta?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The diagnostic for a line that is JSON but not a JSON-RPC message: the
|
|
14
|
+
* line's first 200 characters, after the configuration's credentials are
|
|
15
|
+
* replaced, so a credential across the cut can't leave its first part.
|
|
16
|
+
*/
|
|
17
|
+
export declare function malformedLineDiagnostic(config: McplServerConfig, text: string, error: unknown, recorded?: (text: unknown) => string): string;
|
|
18
|
+
export declare class ModernMcpConnection extends EventEmitter {
|
|
19
|
+
private readonly config;
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly family: 'modern';
|
|
22
|
+
readonly transportKind: 'stdio' | 'http';
|
|
23
|
+
/** The pinned revision, once a connect has established it; null before. */
|
|
24
|
+
protocolVersion: string | null;
|
|
25
|
+
private session;
|
|
26
|
+
/** A connect in flight, owned so `close()` can end it. */
|
|
27
|
+
private opening;
|
|
28
|
+
private generation;
|
|
29
|
+
private closedByHost;
|
|
30
|
+
private reconnectEnabled;
|
|
31
|
+
private readonly reconnectIntervalMs;
|
|
32
|
+
private readonly reconnectMaxIntervalMs;
|
|
33
|
+
private reconnectTimer;
|
|
34
|
+
private reconnectAttempts;
|
|
35
|
+
/** At most one pending reopen, and only ever for the current generation. */
|
|
36
|
+
private relisten;
|
|
37
|
+
private relistenAttempts;
|
|
38
|
+
/**
|
|
39
|
+
* Generations whose cleanup could not confirm their child exited. While any
|
|
40
|
+
* is held, no replacement is started: launching another would orphan the
|
|
41
|
+
* first. close() retries them and reports what still fails.
|
|
42
|
+
*/
|
|
43
|
+
private unreaped;
|
|
44
|
+
/** A lost session's reap in flight: the reconnect follows it, and
|
|
45
|
+
* close() waits for it. */
|
|
46
|
+
private losing;
|
|
47
|
+
/** Child stderr from before anyone listens (the caller attaches only once
|
|
48
|
+
* connect() returns), delivered to the first listener. Bounded: the
|
|
49
|
+
* newest lines are kept. */
|
|
50
|
+
private stderrBacklog;
|
|
51
|
+
private constructor();
|
|
52
|
+
private deliverStderr;
|
|
53
|
+
/** The per-call deadline: `requestTimeoutMs`, validated positive. */
|
|
54
|
+
get requestTimeoutMs(): number;
|
|
55
|
+
get isConnected(): boolean;
|
|
56
|
+
/** Whether a lost connection will be re-established in the background. */
|
|
57
|
+
get willReconnect(): boolean;
|
|
58
|
+
/** Whether close() has been called: closed for good, or closing. A
|
|
59
|
+
* connection lost on its own is not closed in this sense. */
|
|
60
|
+
get isClosed(): boolean;
|
|
61
|
+
/** Whether a child this connection launched couldn't be confirmed exited.
|
|
62
|
+
* While it's true the connection owns that child, so whatever registered
|
|
63
|
+
* it keeps its id held; close() retries the reap. It's settled only once
|
|
64
|
+
* a reap has finished: while a lost session's reap or a close runs, it
|
|
65
|
+
* reads false, so read it once lossReaped() or close() has settled. */
|
|
66
|
+
get holdsUnreapedChild(): boolean;
|
|
67
|
+
/** The reap of a session lost on its own, settled once it's done, whether
|
|
68
|
+
* or not it confirmed the child exited (holdsUnreapedChild says which);
|
|
69
|
+
* settled at once when no such reap is running. */
|
|
70
|
+
lossReaped(): Promise<void>;
|
|
71
|
+
/** A failed generation's cleanup couldn't reap its child: keep owning it,
|
|
72
|
+
* and halt reconnecting until close() settles it. */
|
|
73
|
+
private holdUnreaped;
|
|
74
|
+
/** The halt, as a permanent failure for the reconnect events. */
|
|
75
|
+
private unreapedFailure;
|
|
76
|
+
/**
|
|
77
|
+
* A connection that hasn't started: configuration is validated (and
|
|
78
|
+
* throws), nothing is launched or dialed. An owner can register it, and
|
|
79
|
+
* wire its events, before {@link start}, so a connect in flight is
|
|
80
|
+
* already the owner's to close.
|
|
81
|
+
*/
|
|
82
|
+
static create(config: McplServerConfig): ModernMcpConnection;
|
|
83
|
+
/** The first connect, shared by every call to start(). */
|
|
84
|
+
private starting;
|
|
85
|
+
/**
|
|
86
|
+
* The first connect. Without `reconnect` a failure throws. With it, the
|
|
87
|
+
* connection keeps retrying in the background, as the legacy engine's
|
|
88
|
+
* stub does, and reports `connect-failed`, unless the failed launch
|
|
89
|
+
* couldn't be reaped: no retry can come then, so it throws too. A
|
|
90
|
+
* connection closed before or during its first connect resolves
|
|
91
|
+
* unconnected. A connection starts once:
|
|
92
|
+
* later calls return the first call's promise, so a second session never
|
|
93
|
+
* opens beside the first.
|
|
94
|
+
*/
|
|
95
|
+
start(): Promise<void>;
|
|
96
|
+
private firstConnect;
|
|
97
|
+
/**
|
|
98
|
+
* {@link create} and {@link start} in one step. A first connect that fails
|
|
99
|
+
* and whose cleanup couldn't confirm its child exited throws
|
|
100
|
+
* {@link McplUnreapedLaunchError}, whose connection owns that launch, as
|
|
101
|
+
* the legacy engine's connect does: its close() retries the reap.
|
|
102
|
+
*/
|
|
103
|
+
static connect(config: McplServerConfig): Promise<ModernMcpConnection>;
|
|
104
|
+
private isCurrent;
|
|
105
|
+
/** One connect generation: a fresh client over a fresh transport. */
|
|
106
|
+
private open;
|
|
107
|
+
/** Connect one generation's client, and adopt it if it's still current. */
|
|
108
|
+
private establish;
|
|
109
|
+
/**
|
|
110
|
+
* The server refused the pinned revision (no common one in its
|
|
111
|
+
* `server/discover` answer, or an unsupported-version error): a
|
|
112
|
+
* configuration verdict, as for the legacy engine, in the same type, so
|
|
113
|
+
* every reader treats both engines alike. Retrying can't change it.
|
|
114
|
+
*/
|
|
115
|
+
private versionVerdict;
|
|
116
|
+
/**
|
|
117
|
+
* Keep list-change awareness while this generation lives. The SDK opens the
|
|
118
|
+
* subscription at connect when the server advertises tool list changes. If
|
|
119
|
+
* that open failed (the SDK reports it through `onerror` and connects
|
|
120
|
+
* anyway), or the subscription later ends without our asking, it is
|
|
121
|
+
* reopened with backoff. Once it's back the inventory is refreshed, since
|
|
122
|
+
* changes may have been missed. A lost transport is the reconnect path's
|
|
123
|
+
* job, not this one's.
|
|
124
|
+
*/
|
|
125
|
+
private keepListening;
|
|
126
|
+
private cancelRelisten;
|
|
127
|
+
private scheduleRelisten;
|
|
128
|
+
private reopenSubscription;
|
|
129
|
+
/** The transport went away (child exit, or a closed HTTP client). */
|
|
130
|
+
private handleLost;
|
|
131
|
+
/** The legacy engine's backoff: doubling from the base interval, capped,
|
|
132
|
+
* with ±25% jitter, and never past the timer limit (a longer delay would
|
|
133
|
+
* fire at once, turning the backoff into a tight loop). */
|
|
134
|
+
private backoffDelay;
|
|
135
|
+
private scheduleReconnect;
|
|
136
|
+
private attemptReconnect;
|
|
137
|
+
/**
|
|
138
|
+
* The server's complete tool inventory. The SDK follows every page; one
|
|
139
|
+
* budget, {@link LIST_TIMEOUT_MS}, bounds the whole walk, not each page.
|
|
140
|
+
* Its failures use the request-outcome contract with `tools/list` as the
|
|
141
|
+
* observed method. A relist the SDK makes inside a tool call is auxiliary
|
|
142
|
+
* to that call, and leaves the call's evidence alone.
|
|
143
|
+
*/
|
|
144
|
+
listTools(): Promise<McpToolDefinition[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Call a tool within the configured deadline. One budget covers the whole
|
|
147
|
+
* logical call: the SDK's per-leg timer and its `maxTotalTimeout` across
|
|
148
|
+
* continuation rounds, and an abort signal around any retry the SDK makes
|
|
149
|
+
* before dispatch (an auth refresh, or a header-mismatch relist).
|
|
150
|
+
*/
|
|
151
|
+
callTool(name: string, args: Record<string, unknown>): Promise<ModernToolCallResult>;
|
|
152
|
+
/** Run one logical request in a wire scope, and classify its failure by
|
|
153
|
+
* what that scope saw. `what` names the request in the host's log: its
|
|
154
|
+
* method, and a tool call's tool as a log field. */
|
|
155
|
+
private request;
|
|
156
|
+
/**
|
|
157
|
+
* Close one generation: the transport first (during discovery the SDK
|
|
158
|
+
* hasn't attached it yet, so only closing it ends the probe), then the
|
|
159
|
+
* client. The transport's close is the reaping verdict, and its failure is
|
|
160
|
+
* returned, never swallowed. It never rejects, which lossReaped() and the
|
|
161
|
+
* framework's unguarded wait on it rely on.
|
|
162
|
+
*/
|
|
163
|
+
private static closeSession;
|
|
164
|
+
/** The close in flight, which later calls wait behind. */
|
|
165
|
+
private closing;
|
|
166
|
+
/** Set when the host closes a live session; cleared, with the one
|
|
167
|
+
* 'close', by the close that confirms its teardown. */
|
|
168
|
+
private closeIncomplete;
|
|
169
|
+
/**
|
|
170
|
+
* Close for good: no reconnect, no reopened subscription, no connect left
|
|
171
|
+
* in flight. Awaits the in-flight connect's end, and rejects while a child
|
|
172
|
+
* can't be confirmed exited: with that failure itself, the transport's
|
|
173
|
+
* own error, or an AggregateError when there are several, as the MCPL
|
|
174
|
+
* engine does. Calls queue behind the one in flight, so none resolves
|
|
175
|
+
* while teardown is still pending. A call after a failed close re-checks
|
|
176
|
+
* what wasn't reaped. 'close' is emitted once, when the teardown of a
|
|
177
|
+
* session the host closed while live completes, not on a failed close.
|
|
178
|
+
*/
|
|
179
|
+
close(): Promise<void>;
|
|
180
|
+
private closeStep;
|
|
181
|
+
/** What works from here after a request that didn't run, by whether this
|
|
182
|
+
* host is reconnecting to the server, in the legacy engine's words. */
|
|
183
|
+
private retryText;
|
|
184
|
+
/**
|
|
185
|
+
* Map a failure onto the request-outcome contract by what crossed the
|
|
186
|
+
* transport boundary for this request, claiming no more than that shows.
|
|
187
|
+
* The rules apply in this order. The call's answer is the server's final
|
|
188
|
+
* one: an error or a `complete` result.
|
|
189
|
+
* - nothing handed to the transport: `not-sent`, whatever was raised (a
|
|
190
|
+
* pre-dispatch validation, a signal already aborted, no transport, a send
|
|
191
|
+
* Connectome's stdio line refused before writing, an HTTP refusal before
|
|
192
|
+
* any request went out);
|
|
193
|
+
* - the most recent leg answered with a JSON-RPC error: `error-response`
|
|
194
|
+
* with that error's data;
|
|
195
|
+
* - the most recent leg answered with a complete result: the server
|
|
196
|
+
* finished, but what it returned can't be used (output validation).
|
|
197
|
+
* That's a plain error, not a request outcome;
|
|
198
|
+
* - the most recent leg answered without finishing the call: `no-response`,
|
|
199
|
+
* since the server may have acted on what it received. An
|
|
200
|
+
* `input_required` answer asks for another round, and the call can end
|
|
201
|
+
* before that round is sent: at the deadline, when the connection is
|
|
202
|
+
* gone, or when this client can't go on (input it can't supply, the
|
|
203
|
+
* rounds cap). Nothing is in flight then, so nothing is cancelled. A
|
|
204
|
+
* result of a type this client doesn't recognize ends the call where it
|
|
205
|
+
* is;
|
|
206
|
+
* - an HTTP 401/403 refusal of the current leg: `error-response`, the
|
|
207
|
+
* status in `data.httpStatus` (the server answered at the HTTP layer,
|
|
208
|
+
* outside the JSON-RPC code space). After an earlier leg
|
|
209
|
+
* asked for another round it is `no-response` instead: the server may
|
|
210
|
+
* already have acted on the call;
|
|
211
|
+
* - handed off and unanswered: `no-response`. At the deadline, cancellation
|
|
212
|
+
* was requested and the outcome is unknown.
|
|
213
|
+
*
|
|
214
|
+
* The message is the agent's, in the legacy engine's words where it has
|
|
215
|
+
* words for the same outcome (#506), and in their shape where it hasn't:
|
|
216
|
+
* what happened, whether anything took effect, and what works from there.
|
|
217
|
+
* A request this host's close cut off, and one whose connection closed
|
|
218
|
+
* under it (`lost`), read as the legacy engine's do. The method, the tool,
|
|
219
|
+
* the JSON-RPC code, the HTTP status, the deadline in milliseconds and the
|
|
220
|
+
* SDK's or transport's words are the operator's, so they go to one log
|
|
221
|
+
* line, the server's text redacted. Where the effect is in doubt, a tool
|
|
222
|
+
* call's message says to check it before trying again, and a listing's that
|
|
223
|
+
* listing changes nothing on the server, so trying again is safe.
|
|
224
|
+
*/
|
|
225
|
+
private requestFailure;
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=modern-connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modern-connection.d.ts","sourceRoot":"","sources":["../../../src/mcpl/modern-connection.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,KAAK,cAAc,EAMpB,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAatE;yEACyE;AACzE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAoJD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,QAAQ,GAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAmC,GAC/D,MAAM,CAKR;AA8HD,qBAAa,mBAAoB,SAAQ,YAAY;IAkC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAjC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAC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