@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
package/dist/src/framework.d.ts
CHANGED
|
@@ -83,9 +83,15 @@ export interface HostModeStatus {
|
|
|
83
83
|
/** Context writes (module events, api message.send) withheld because the
|
|
84
84
|
* host is quiesced. Persisted while quiesced and flushed by resume(). */
|
|
85
85
|
deferredWrites: number;
|
|
86
|
-
/** Agents whose turn `abandon`
|
|
87
|
-
* no stream
|
|
88
|
-
*
|
|
86
|
+
/** Agents whose turn `abandon` had not ended when its grace ran out: a
|
|
87
|
+
* turn token held with no stream to cancel and no check ahead to stop it
|
|
88
|
+
* at (a puppet tool turn, a store surgery's reservation, a turn finishing
|
|
89
|
+
* its last delivery), or a turn with no stream that hasn't reached its
|
|
90
|
+
* next check, such as one in a hook that hasn't returned. A turn whose
|
|
91
|
+
* stream the abandon cancelled isn't listed, even one still running when
|
|
92
|
+
* the grace runs out, as one whose tool-result guard waits on its speech
|
|
93
|
+
* may be. Present only after an abandon that left such turns behind, while
|
|
94
|
+
* the host stays quiesced. */
|
|
89
95
|
unabandonable?: string[];
|
|
90
96
|
}
|
|
91
97
|
/**
|
|
@@ -104,6 +110,19 @@ export declare class ResumeBlockedError extends Error {
|
|
|
104
110
|
preview: RuntimeSettingsPreview;
|
|
105
111
|
}>);
|
|
106
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Thrown by `quiesce()` without `abandon` when the queue of deferred context
|
|
115
|
+
* writes can't reach disk: it's over its cap, so its record can't hold it, or
|
|
116
|
+
* its write failed, and that error is the `cause`. So the queue as it
|
|
117
|
+
* stands isn't on disk. The host's mode is as it was, and the
|
|
118
|
+
* message names the ways out, among them quiescing with `abandon: true`,
|
|
119
|
+
* which goes on with the queue in memory.
|
|
120
|
+
*/
|
|
121
|
+
export declare class QuiesceBlockedError extends Error {
|
|
122
|
+
constructor(message: string, options?: {
|
|
123
|
+
cause?: unknown;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
107
126
|
/**
|
|
108
127
|
* How `runEphemeralToCompletion` rejects when a retryable provider failure
|
|
109
128
|
* states a wait the run won't sleep: one longer than an ephemeral run sleeps
|
|
@@ -190,10 +209,26 @@ export declare class AgentFramework {
|
|
|
190
209
|
private stopPromise;
|
|
191
210
|
private stopCompleted;
|
|
192
211
|
private ownedStoreClosed;
|
|
212
|
+
/** Whether the latest stop() got through its teardown with nothing failed:
|
|
213
|
+
* every step and every wait up to and including the one on awareness
|
|
214
|
+
* drains, whatever failed after that, in the storage work that finishes
|
|
215
|
+
* the stop. A step that threw may have left part of its work running, as
|
|
216
|
+
* a wait that ran out does. create()'s release reads it to say whether part
|
|
217
|
+
* of what a failed create() started may still be running. */
|
|
218
|
+
private stopFinishedTeardown;
|
|
193
219
|
/** An operator's operations in flight, and the config materializations they
|
|
194
220
|
* start. stop() waits until this set is empty before it tears down, unless
|
|
195
221
|
* its wait budget runs out. */
|
|
196
222
|
private readonly operatorOperations;
|
|
223
|
+
/** What a wait of stop()'s left running when its budget ran out, by its
|
|
224
|
+
* promise: a stream it cancelled or an event loop still in a call; and a
|
|
225
|
+
* stream whose cancel threw, which stop() doesn't wait for. A later
|
|
226
|
+
* stop() waits for each again, beside what it finds, whatever has happened
|
|
227
|
+
* since to the entry it was found under (a run's end removes its stream's,
|
|
228
|
+
* a start() replaces the loop), so neither a budget nor a cancel that
|
|
229
|
+
* threw lets the store close under work still running. Each leaves once it
|
|
230
|
+
* settles. */
|
|
231
|
+
private readonly leftRunning;
|
|
197
232
|
private membrane;
|
|
198
233
|
private queue;
|
|
199
234
|
private agents;
|
|
@@ -212,6 +247,16 @@ export declare class AgentFramework {
|
|
|
212
247
|
* running; only new turns (wake gate in processInferenceRequests) and MCPL
|
|
213
248
|
* data planes are held. */
|
|
214
249
|
private quiesced;
|
|
250
|
+
/** Whether the host-mode record may say quiesced, as this process last read
|
|
251
|
+
* or wrote it. quiesce() writes the record before it sets `quiesced`, and
|
|
252
|
+
* resume() clears `quiesced` before the record, so after a resume whose
|
|
253
|
+
* clear failed, or a quiesce whose write failed partway, memory can say
|
|
254
|
+
* serving while the record says quiesced, until a resume() clears it. */
|
|
255
|
+
private hostModeRecordMayBeQuiesced;
|
|
256
|
+
/** Whether a resume() is between serving and clearing the record: it has
|
|
257
|
+
* cleared `quiesced` and is flushing the deferred writes, then clearing the
|
|
258
|
+
* record. A resume() on the serving host leaves the record to it. */
|
|
259
|
+
private resumeInFlight;
|
|
215
260
|
private quiesceReason?;
|
|
216
261
|
private quiescedAt?;
|
|
217
262
|
private traceListeners;
|
|
@@ -250,8 +295,12 @@ export declare class AgentFramework {
|
|
|
250
295
|
/** Per-agent last inference activity (epoch ms), for /healthz + doctor tooling. */
|
|
251
296
|
private lastInferenceAt;
|
|
252
297
|
private processLoggingPersist;
|
|
253
|
-
private processLoggingBroadcast;
|
|
254
298
|
private activeStreams;
|
|
299
|
+
/** Told once per inbound acceptance (mcpl/inbound-source.ts). An internal
|
|
300
|
+
* seam, unset here: the receipt work (shelf-354) assigns it inside the
|
|
301
|
+
* framework, and tests set it by cast. */
|
|
302
|
+
private inboundAcceptanceObserver?;
|
|
303
|
+
private streamBoundaryEnds;
|
|
255
304
|
/** A tool boundary injected fresh CONVERSATIONAL input (a real message —
|
|
256
305
|
* not a reaction or a system marker) into the live stream. Tells
|
|
257
306
|
* driveStream to clear sticky explicit-send suppression before handling
|
|
@@ -262,8 +311,11 @@ export declare class AgentFramework {
|
|
|
262
311
|
* (KV-safe, no per-turn chatter). In-memory — after a process restart the
|
|
263
312
|
* first turn's locus is announced once to re-establish the baseline. */
|
|
264
313
|
private lastAnnouncedLocus;
|
|
265
|
-
/**
|
|
266
|
-
|
|
314
|
+
/** Every resident's held drafts: plain speech that was suppressed, bounced
|
|
315
|
+
* or left without a destination, never published except by their
|
|
316
|
+
* resident's resend, kept until resent or dismissed. A logical turn's own
|
|
317
|
+
* drafts, for its receipt, are its TurnRouting's. */
|
|
318
|
+
private proseDrafts;
|
|
267
319
|
/**
|
|
268
320
|
* Each agent's routing state for its current logical turn (TurnRouting):
|
|
269
321
|
* its trigger channel, locus and engaged channels, the sticky destination,
|
|
@@ -321,15 +373,20 @@ export declare class AgentFramework {
|
|
|
321
373
|
private ephemeralRuns;
|
|
322
374
|
/** Ephemeral namespaces/names are single-generation for this framework
|
|
323
375
|
* lifetime. Reusing one while an old stream drains would let name-keyed
|
|
324
|
-
* liveness/settlement state cross generations.
|
|
376
|
+
* liveness/settlement state cross generations. Each name records what
|
|
377
|
+
* reserved it: an ephemeral run (createEphemeralAgent), which takes no
|
|
378
|
+
* global fallback even after its release, or a conversation fork. */
|
|
325
379
|
private usedEphemeralAgentNames;
|
|
326
380
|
/** One-shot generation tickets minted by createEphemeralAgent. */
|
|
327
381
|
private ephemeralCandidates;
|
|
382
|
+
/** Warn only once per Agent instance after utilities are registered. */
|
|
383
|
+
private emptyUtilityPermissionWarnings;
|
|
328
384
|
/** Physical ephemeral frames deliberately disposed by their run watchdog/caller.
|
|
329
385
|
* The name is single-generation, so these frames still own their terminal
|
|
330
386
|
* typing/outgoing close even after runEphemeralToCompletion deregisters them. */
|
|
331
387
|
private disposedEphemeralFrames;
|
|
332
|
-
/** Per-agent count of consecutive exhausted inferences
|
|
388
|
+
/** Per-agent count of consecutive exhausted inferences, reset when a turn
|
|
389
|
+
* completes (inference:completed), not when a call answers mid-turn.
|
|
333
390
|
* Drives hard-down escalation — see noteInferenceExhausted. */
|
|
334
391
|
private consecutiveInferenceFailures;
|
|
335
392
|
/** N consecutive failed inferences ⇒ the agent is treated as hard-down and
|
|
@@ -350,10 +407,11 @@ export declare class AgentFramework {
|
|
|
350
407
|
private refusalStreak;
|
|
351
408
|
/** Per-agent count of consecutive refusal-driven rewinds in the current turn
|
|
352
409
|
* chain (reset when a turn completes without a refusal). Bounds the auto
|
|
353
|
-
* rewind loop — see refusalHandling +
|
|
410
|
+
* rewind loop — see refusalHandling + shedNewestTurn. */
|
|
354
411
|
private refusalRewinds;
|
|
355
412
|
/** Per-agent count of poison-history rewinds performed by the hard-down
|
|
356
|
-
* breaker (noteInferenceExhausted). Reset
|
|
413
|
+
* breaker (noteInferenceExhausted). Reset when a turn completes
|
|
414
|
+
* (inference:completed).
|
|
357
415
|
* Bounds the automatic quarantine loop the same way refusalRewinds bounds
|
|
358
416
|
* the refusal loop, so the breaker can never shed the whole history. */
|
|
359
417
|
private exhaustionRewinds;
|
|
@@ -387,9 +445,20 @@ export declare class AgentFramework {
|
|
|
387
445
|
/** Agents an abandon could not cancel (token held, no stream) — surfaced
|
|
388
446
|
* in HostModeStatus until the next quiesce/resume. */
|
|
389
447
|
private lastUnabandonable;
|
|
390
|
-
/** True while the deferred-write queue
|
|
448
|
+
/** True while the deferred-write queue is mirrored to its record, so each
|
|
449
|
+
* change of it writes it: from a write of it that reached or may reach
|
|
450
|
+
* the record, one that failed or met the cap unless quiesce() rejected
|
|
451
|
+
* for it (deferredWritesFellBehind), or a boot that restored it, until a
|
|
452
|
+
* write clears the record once the queue drains. */
|
|
391
453
|
private deferredWritesPersisted;
|
|
392
|
-
|
|
454
|
+
/** True from a write of the queue that failed or met the cap, unless
|
|
455
|
+
* quiesce() rejected for it, until one succeeds: a run of failures
|
|
456
|
+
* (deferredWritesFellBehind). A quiesce({ abandon: true }) over the cap
|
|
457
|
+
* goes on rather than rejecting, so its write begins a run too. */
|
|
458
|
+
private deferredWritesBehind;
|
|
459
|
+
/** True once the cap has been met in the current run, so its line is
|
|
460
|
+
* logged once a run, whatever began the run. */
|
|
461
|
+
private deferredWritesCapLogged;
|
|
393
462
|
/** Branch-independent recovery files (see FrameworkConfig.hostModePath /
|
|
394
463
|
* deferredWritesPath). Undefined → branch-local slot fallback. */
|
|
395
464
|
private hostModePath;
|
|
@@ -405,7 +474,9 @@ export declare class AgentFramework {
|
|
|
405
474
|
private unackedDeferredWrites;
|
|
406
475
|
/** Monotonic order stamp for deferred writes: the durable queue is always
|
|
407
476
|
* written, restored, drained and flushed in `seq` order, whatever the
|
|
408
|
-
* pending/un-acked split — a re-deferred entry keeps its place.
|
|
477
|
+
* pending/un-acked split — a re-deferred entry keeps its place. Boot
|
|
478
|
+
* recovery numbers the restored queue 1..N in that order, and the stamp
|
|
479
|
+
* goes on from N (restorePersistedDeferredWrites). */
|
|
409
480
|
private deferredSeq;
|
|
410
481
|
/**
|
|
411
482
|
* Per target agent: the store's message count when the OLDEST currently
|
|
@@ -424,8 +495,38 @@ export declare class AgentFramework {
|
|
|
424
495
|
* guessing from the newest message in the window.
|
|
425
496
|
*/
|
|
426
497
|
private activeTurnTriggers;
|
|
498
|
+
/**
|
|
499
|
+
* The `[Continue]` prompt the current round of each turn follows, keyed by
|
|
500
|
+
* the turn's trigger. Each stream start sets it from what the Agent read in
|
|
501
|
+
* its request (`StartStreamResult.continuePrompt`), and a tool boundary
|
|
502
|
+
* that hands the live stream messages after the results clears it, since
|
|
503
|
+
* the next round follows those messages. `silentTurnRowMetadata` stamps the
|
|
504
|
+
* round's rows with it.
|
|
505
|
+
*/
|
|
506
|
+
private readonly turnPrompts;
|
|
427
507
|
/** The trigger of `agentName`'s turn in progress, if a turn is running. */
|
|
428
508
|
getActiveTurnTrigger(agentName: string): InferenceRequest | undefined;
|
|
509
|
+
/**
|
|
510
|
+
* The window of the frame that holds an agent's turn with no stream to
|
|
511
|
+
* carry a stop and one of its checks ahead: a start, from its entry until
|
|
512
|
+
* it hands its turn to a stream or ends (its checks after the hooks, after
|
|
513
|
+
* the compile, at a failure and after a wait to retry its compile),
|
|
514
|
+
* driveStream's wait to retry a failed inference (its check after the
|
|
515
|
+
* wait), and the tool-result guard's wait for the agent's speech (its
|
|
516
|
+
* check after the wait, which the window lets the abandon reach once a
|
|
517
|
+
* caller's cancelStream() has left the agent holding no stream). Each
|
|
518
|
+
* frame opens a window of its own and closes it only while it
|
|
519
|
+
* is still the agent's, so a start that ends after a later frame opened
|
|
520
|
+
* one, such as its retry's stream waiting to retry, leaves that one open.
|
|
521
|
+
* An operator's abandon marks the window, and the frame's check collects
|
|
522
|
+
* the mark, which goes with the window. abortInference() and the abandon
|
|
523
|
+
* count a turn with no stream only here; a stop made anywhere else, as
|
|
524
|
+
* while an agent is idle, a turn finishes its last delivery or a provider
|
|
525
|
+
* hold has parked it, has no check to end it, and the next start drops
|
|
526
|
+
* it. Keyed by the Agent, so a replacement agent under the same name
|
|
527
|
+
* never shares one.
|
|
528
|
+
*/
|
|
529
|
+
private checkAhead;
|
|
429
530
|
/** Structured calls executed in the current logical turn. Unlike the
|
|
430
531
|
* per-stream local this survives framework retries and budget restarts. */
|
|
431
532
|
private logicalTurnToolCalls;
|
|
@@ -434,6 +535,11 @@ export declare class AgentFramework {
|
|
|
434
535
|
private redoStacks;
|
|
435
536
|
/** Liveness watchdog (fail hard on a wedged main thread). Null unless enabled. */
|
|
436
537
|
private livenessWatchdog;
|
|
538
|
+
/** The frameworks a SIGUSR2 dumps (joinDiagnostics): each joins in create()
|
|
539
|
+
* where the liveness watchdog starts, or would if it isn't enabled, and
|
|
540
|
+
* leaves in stop() where the watchdog stops. */
|
|
541
|
+
private static readonly diagnosed;
|
|
542
|
+
private static diagnosticsListenerInstalled;
|
|
437
543
|
private mcplServerRegistry;
|
|
438
544
|
private featureSetManager;
|
|
439
545
|
private hookOrchestrator;
|
|
@@ -462,7 +568,10 @@ export declare class AgentFramework {
|
|
|
462
568
|
* ephemeral agents have isolated slots and are their own only readers.
|
|
463
569
|
*/
|
|
464
570
|
private readonly sharedSlotAgents;
|
|
465
|
-
/**
|
|
571
|
+
/** The windows of forks and runs deregistered while the host was quiesced,
|
|
572
|
+
* by agent name; resume() releases them (releaseWindowNowOrAfterResume). */
|
|
573
|
+
private readonly releasesAfterResume;
|
|
574
|
+
/** The coalescing commit in flight, if any (see commitCoalescingDurable). */
|
|
466
575
|
private coalescingCommit;
|
|
467
576
|
private inferenceRouter;
|
|
468
577
|
private channelRegistry;
|
|
@@ -477,6 +586,9 @@ export declare class AgentFramework {
|
|
|
477
586
|
* turn still lands in the right channel.
|
|
478
587
|
*/
|
|
479
588
|
private conversationAgentHomes;
|
|
589
|
+
/** Forks being spawned, by channel id, each until its spawn settles (see
|
|
590
|
+
* routeConversation). The promise never rejects. */
|
|
591
|
+
private readonly conversationSpawns;
|
|
480
592
|
/** Last idle-TTL sweep timestamp. */
|
|
481
593
|
private lastConversationSweep;
|
|
482
594
|
/** Forks whose TTL closure turn has been queued — disposed (removed from
|
|
@@ -489,7 +601,8 @@ export declare class AgentFramework {
|
|
|
489
601
|
* result marks the script that made the call, and is applied to that
|
|
490
602
|
* script's code_execution result instead of cancelling the stream
|
|
491
603
|
* mid-script (which would wedge the turn). A stopped script's late result
|
|
492
|
-
* marks only that script, never the agent's next one.
|
|
604
|
+
* marks only that script, never the agent's next one. Its `turnId` is the
|
|
605
|
+
* turn of the code_execution call running it, which its calls carry. */
|
|
493
606
|
private scriptDeferredEndTurn;
|
|
494
607
|
/** RFC-007: per agent, the origin of the foreground script its runner is
|
|
495
608
|
* executing, handed to that script's inner calls (scripts run one at a
|
|
@@ -522,11 +635,20 @@ export declare class AgentFramework {
|
|
|
522
635
|
private mcplToolRefreshPending;
|
|
523
636
|
/** Maps tool prefix → serverId for dispatch routing. */
|
|
524
637
|
private mcplPrefixMap;
|
|
525
|
-
/** Namespaced tool name → the server whose tools/list produced it
|
|
526
|
-
*
|
|
638
|
+
/** Namespaced tool name → the server whose tools/list produced it, from
|
|
639
|
+
* its first listing of the name. resolveMcplTool reads it first. */
|
|
527
640
|
private mcplToolServers;
|
|
528
641
|
/** Servers whose tools/list answered in the latest refresh. */
|
|
529
642
|
private mcplListedServers;
|
|
643
|
+
/** refreshMcplTools' starts, and the start whose result was published
|
|
644
|
+
* last: a refresh that a later-started one has overtaken publishes
|
|
645
|
+
* nothing, since that one listed every server after it. */
|
|
646
|
+
private mcplToolsRefreshStarted;
|
|
647
|
+
private mcplToolsRefreshPublished;
|
|
648
|
+
/** How many times each server's connection has closed. A listing that
|
|
649
|
+
* began before its server's latest close is of a session that's over,
|
|
650
|
+
* and refreshMcplTools publishes none of it. */
|
|
651
|
+
private mcplServerCloses;
|
|
530
652
|
/** Zero-match tool-pattern diagnostics (checkToolPatterns): set at the end
|
|
531
653
|
* of create(), when the tool universe is first complete. */
|
|
532
654
|
private toolPatternChecksArmed;
|
|
@@ -537,6 +659,27 @@ export declare class AgentFramework {
|
|
|
537
659
|
private toolPatternKnownPrefixes;
|
|
538
660
|
/** Maps serverId → McplServerConfig for prefix lookup. */
|
|
539
661
|
private mcplServerConfigs;
|
|
662
|
+
/** Modern-MCP (2026-07-28) servers, by id; read through modernServers().
|
|
663
|
+
* They are kept apart from the MCPL registry on purpose: they have no
|
|
664
|
+
* grant, planes or server→host traffic, so the MCPL machinery (quiesce's
|
|
665
|
+
* plane pauses, awareness gates, policy) never sees them. They take part
|
|
666
|
+
* only through the tool paths, and their list changes reach agents
|
|
667
|
+
* through ordinary admission. */
|
|
668
|
+
private modernMcpConnections;
|
|
669
|
+
/** Connects and disconnects in flight, by server id (holdMcpServerId);
|
|
670
|
+
* created on first use, like modernMcpConnections. */
|
|
671
|
+
private mcpServerOps;
|
|
672
|
+
/** Each legacy connect in flight's own abort (connectHeldMcplServer):
|
|
673
|
+
* stop() and a disconnect of its id end it at once, its launch reaped,
|
|
674
|
+
* rather than waiting out its handshake. Created on first use, as the
|
|
675
|
+
* restart claims are (legacyConnectAborts()). */
|
|
676
|
+
private legacyConnectAbortMap;
|
|
677
|
+
/** The ids and tool prefixes restarts hold, each with the claim of the
|
|
678
|
+
* restart holding it, from the restart's checks through its connect
|
|
679
|
+
* (restartMcplServer): no other connect or restart takes them while the
|
|
680
|
+
* old server is torn down. Created on first use (restartClaims), like
|
|
681
|
+
* mcpServerOps. */
|
|
682
|
+
private mcpRestartClaims;
|
|
540
683
|
/** Host capabilities advertised during the MCP handshake — stored so servers
|
|
541
684
|
* can be connected at runtime (connectMcplServer) after initialization. */
|
|
542
685
|
private mcplHostCapabilities;
|
|
@@ -565,32 +708,120 @@ export declare class AgentFramework {
|
|
|
565
708
|
private discordAwarenessBarrierGeneration;
|
|
566
709
|
private eventGate;
|
|
567
710
|
private usageTracker;
|
|
568
|
-
/** Explicit-send suppression carried into a tool-result-guard retry. */
|
|
711
|
+
/** Explicit-send or private suppression carried into a tool-result-guard retry. */
|
|
569
712
|
private guardRetryTurnSilenced;
|
|
570
713
|
/** Presentation-only wall-clock zone; persistence remains UTC/epoch. */
|
|
571
714
|
private readonly timeZone;
|
|
572
715
|
private constructor();
|
|
573
716
|
/**
|
|
574
|
-
* Create and start the framework.
|
|
717
|
+
* Create and start the framework. A create() that fails releases what it
|
|
718
|
+
* had acquired before its error reaches the caller, so that the caller can
|
|
719
|
+
* try again in the same process: the framework it had begun is stopped, as
|
|
720
|
+
* stop() stops one, but giving up after 30 s on each of stop()'s cleanup
|
|
721
|
+
* waits, for an operator's operations already running, then for its
|
|
722
|
+
* modules and MCPL servers, and then for awareness drains a failed startup
|
|
723
|
+
* barrier left running, and a store it opened is closed. A store the
|
|
724
|
+
* caller passed in is left open.
|
|
575
725
|
*/
|
|
576
726
|
static create(config: FrameworkConfig): Promise<AgentFramework>;
|
|
577
727
|
/**
|
|
578
|
-
*
|
|
728
|
+
* The error a failed create() rejects with, once what it acquired is
|
|
729
|
+
* released: the framework it had begun is stopped, with
|
|
730
|
+
* FAILED_CREATE_TEARDOWN_TIMEOUT_MS as stop()'s teardownTimeoutMs, and a
|
|
731
|
+
* store create() opened is closed even when that stop failed or timed out.
|
|
732
|
+
* stop() keeps an owned store open when any of its waits fails or times
|
|
733
|
+
* out, so that it can be called again, but no one can call it on a
|
|
734
|
+
* framework that create() never returned. When the release doesn't finish
|
|
735
|
+
* cleanly, the rejection carries create()'s error and then the release's,
|
|
736
|
+
* and its message says what didn't finish.
|
|
737
|
+
*/
|
|
738
|
+
private static releaseFailedCreate;
|
|
739
|
+
/** create()'s work once it holds its store. The framework is named in
|
|
740
|
+
* `building` as soon as it exists, so that create() can stop it if a later
|
|
741
|
+
* step fails. */
|
|
742
|
+
private static createOn;
|
|
743
|
+
/**
|
|
744
|
+
* Diagnostics: `kill -USR2 <pid>` dumps live wake/inference state to stderr
|
|
745
|
+
* (journal) without a restart — for catching the wake-wedge on the running
|
|
746
|
+
* process. Each framework prints its own line: the gate's `inferring` set
|
|
747
|
+
* and buffered-event count (the wedge signature), active streams, and
|
|
748
|
+
* pending inference requests. A framework joins partway through create(),
|
|
749
|
+
* once its agents, modules and event gate are built, where the liveness
|
|
750
|
+
* watchdog starts (or would, when it isn't enabled). It leaves in stop()
|
|
751
|
+
* where the watchdog stops: after stop() has waited on its streams,
|
|
752
|
+
* maintenance, event loop and operator operations, so a dump shows what
|
|
753
|
+
* those waits are on, and before its modules and MCPL servers stop, so a
|
|
754
|
+
* stop() whose teardown hangs, fails or times out doesn't keep it listed.
|
|
755
|
+
* With none in the set, one line says no framework is running. A framework
|
|
756
|
+
* started again after a completed stop() doesn't rejoin; whether that
|
|
757
|
+
* lifecycle is supported is #315.
|
|
758
|
+
*
|
|
759
|
+
* One listener serves the process, installed by the first create() to
|
|
760
|
+
* reach the join and kept: once a process's last SIGUSR2 listener is
|
|
761
|
+
* removed, the signal's default action ends the process, and a dump can
|
|
762
|
+
* arrive between one framework's stop() and the next one's create(), as on
|
|
763
|
+
* a host's session switch. Until a create() first reaches the join, the
|
|
764
|
+
* process has no listener, and the default action applies.
|
|
765
|
+
*/
|
|
766
|
+
private static joinDiagnostics;
|
|
767
|
+
private printDiagnostics;
|
|
768
|
+
/**
|
|
769
|
+
* Start the event loop. A start() on a running framework does nothing.
|
|
770
|
+
* Refused, with an error, from a stop() call until that stop() settles,
|
|
771
|
+
* since that stop would wait on the lifecycle a start() begins, or tear it
|
|
772
|
+
* down under it. What a start() after a settled stop() should do is #315's
|
|
773
|
+
* question.
|
|
579
774
|
*/
|
|
580
775
|
start(): void;
|
|
581
776
|
/**
|
|
582
|
-
* Stop the event loop.
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
777
|
+
* Stop the event loop. Until it settles, start() and addModule() are
|
|
778
|
+
* refused. Each step of the teardown runs whatever an earlier one did: one
|
|
779
|
+
* that throws, such as a host stream's cancel(), fails the stop() once the
|
|
780
|
+
* rest has run. When a step or a wait up to and including
|
|
781
|
+
* the wait on awareness drains fails or times out, storage stays open and
|
|
782
|
+
* stop() can be called again; one that fails after it, in the storage work
|
|
783
|
+
* that finishes the stop, fails the stop() without keeping storage open.
|
|
784
|
+
* A timed-out wait lets teardown go on while what it waited for may still
|
|
785
|
+
* act on what is being torn down.
|
|
786
|
+
* @param teardownTimeoutMs Optional budget for each of stop()'s waits, in
|
|
787
|
+
* turn: on the streams it cancels, on maintenance in flight (a pass or an
|
|
788
|
+
* over-budget drain kick), on the event loop, on an operator's operations
|
|
789
|
+
* already running, on modules and MCPL together, then on Discord awareness
|
|
790
|
+
* drains, which send nothing once stop() has begun, recording the call the
|
|
791
|
+
* close ended. With a budget, a stop() can take up to six of them, besides
|
|
792
|
+
* the withheld-spill deadline of a guard's write still under way. Omit to
|
|
793
|
+
* wait until each settles, as required by existing module/child contracts.
|
|
794
|
+
* A wait whose budget runs out fails the stop() with a ShutdownTimeoutError
|
|
795
|
+
* naming what it waited for; with more than one, or beside another failure,
|
|
796
|
+
* stop() fails with an AggregateError of them all. A stream whose cancel
|
|
797
|
+
* threw is treated as one whose wait ran out, whatever the budget, and the
|
|
798
|
+
* stop() fails with the cancel's error: that stop() doesn't wait for it,
|
|
799
|
+
* even with no budget, and a later stop() waits for it as for anything an
|
|
800
|
+
* earlier one left running (the last point below). After either:
|
|
801
|
+
* - an agent still registered whose stream is still running keeps its
|
|
802
|
+
* deferred writes queued, since the stream may still write. The stream's
|
|
803
|
+
* own turn-end flush takes them when it settles, if the process lives on,
|
|
804
|
+
* and a later stop() takes what that leaves; a memory-only queue loses
|
|
805
|
+
* them if the process exits first.
|
|
806
|
+
* - every ephemeral run still registered is ended, as after any stop(), and
|
|
807
|
+
* its end stores what is queued for it, as at any run's end, whatever its
|
|
808
|
+
* stream is doing: once a run has left, its stream's late events are
|
|
809
|
+
* dropped, though a write the stream already had under way can still
|
|
810
|
+
* land in the run's namespace after them.
|
|
811
|
+
* - an event loop still in a call, such as a module's onProcess, finishes
|
|
812
|
+
* that call and the rest of its iteration, and then exits. A start()
|
|
813
|
+
* made once that stop() has failed runs its own loop beside that last
|
|
814
|
+
* iteration.
|
|
815
|
+
* - a later stop() waits again, within its own budget, for any stream or
|
|
816
|
+
* loop this one left running, so the store never closes under it.
|
|
592
817
|
*/
|
|
593
818
|
stop(teardownTimeoutMs?: number | undefined): Promise<void>;
|
|
819
|
+
/** What start() and addModule() pass before either begins work of a
|
|
820
|
+
* lifecycle. A stop() still running refuses both, from the moment it
|
|
821
|
+
* claims its attempt until that attempt settles. A failed stop() has
|
|
822
|
+
* cleared its attempt, unless it closed an owned store, which is refused
|
|
823
|
+
* first. A completed stop() is cleared, and the call goes on as before;
|
|
824
|
+
* whether a lifecycle should begin after a stop() is #315's question. */
|
|
594
825
|
private resetCompletedStop;
|
|
595
826
|
/** Register before invoking the body, so the set holds the operation for
|
|
596
827
|
* its whole life: its synchronous trace callbacks can reenter stop(), and
|
|
@@ -603,6 +834,22 @@ export declare class AgentFramework {
|
|
|
603
834
|
* queue (after a failed or completed stop()). The admission rule for every
|
|
604
835
|
* operator entry point, the host/command listener included. */
|
|
605
836
|
private stopHasBegun;
|
|
837
|
+
/** stop()'s first step for each connect still in flight, in either engine:
|
|
838
|
+
* end it, so it fails at once and its operation ends, its launch reaped,
|
|
839
|
+
* rather than holding stop()'s wait until its handshake's deadline. A
|
|
840
|
+
* modern connect's connection is registered before it starts and is
|
|
841
|
+
* closed; a legacy one's handshake, and the access provider a WebSocket
|
|
842
|
+
* dial waits for, are aborted (legacyConnectAborts). A modern close's
|
|
843
|
+
* outcome is the teardown's to report (closeModernMcpConnections). */
|
|
844
|
+
private endConnectsInFlight;
|
|
845
|
+
/** Wakers for the waits a connect makes that a stop() ends: see
|
|
846
|
+
* untilStopBegins. Made on first use. */
|
|
847
|
+
private stopWaiters;
|
|
848
|
+
/** `work`, or undefined once stop() has begun, whichever comes first: a
|
|
849
|
+
* connect's last step (its tool listing, which asks every server) needn't
|
|
850
|
+
* hold stop()'s wait for operator operations on a server that doesn't
|
|
851
|
+
* answer. The work goes on; the teardown's close ends what it waits for. */
|
|
852
|
+
private untilStopBegins;
|
|
606
853
|
private refuseOperatorAfterStop;
|
|
607
854
|
/** Wait in rounds until the set is empty: admitted work can still start work
|
|
608
855
|
* of its own. All rounds share the caller's deadline rather than renewing
|
|
@@ -707,7 +954,9 @@ export declare class AgentFramework {
|
|
|
707
954
|
* Wait an error policy's retry delay, all of it: the delay can be a
|
|
708
955
|
* provider's retry-after, and a single timer past 2^31-1 ms fires almost at
|
|
709
956
|
* once. Steps through longer waits; stop() wakes it so a shutting-down
|
|
710
|
-
* framework is never left with a wait parked for days.
|
|
957
|
+
* framework is never left with a wait parked for days. The frame's window
|
|
958
|
+
* (checkWindow) carries a waker that ends the whole wait: a stop
|
|
959
|
+
* abortInference() records, or an operator's abandon, wakes it.
|
|
711
960
|
*/
|
|
712
961
|
private waitForRetry;
|
|
713
962
|
/**
|
|
@@ -791,23 +1040,12 @@ export declare class AgentFramework {
|
|
|
791
1040
|
/** The strategy's progress snapshot, for diagnostics: one it can't give reads as none. */
|
|
792
1041
|
private contextProgress;
|
|
793
1042
|
/**
|
|
794
|
-
* A server's request
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
* -
|
|
800
|
-
* host is stopping, and none of it was taken. Answered -32000, "the host
|
|
801
|
-
* is stopping", the code the push coalescer already gives a stopping
|
|
802
|
-
* host: the server can send it again to the host's next run.
|
|
803
|
-
* - `failed`: the handler threw, whatever it threw, `undefined` included.
|
|
804
|
-
* While the host stops (its queue closed), that's answered -32000 too,
|
|
805
|
-
* with the handler's own message after the stop wording; on a live host
|
|
806
|
-
* it's a fault, answered -32603 with the handler's message. The handler
|
|
807
|
-
* may have admitted part of the request first (an earlier message of a
|
|
808
|
-
* batch), so nothing here claims that none of it was taken.
|
|
809
|
-
* A request the handler already answered before it threw isn't answered
|
|
810
|
-
* again: the failure is logged.
|
|
1043
|
+
* A server's request turned away before its handler ran, because the host
|
|
1044
|
+
* is stopping and none of it was taken: answered -32000, "the host is
|
|
1045
|
+
* stopping", the code the push coalescer already gives a stopping host, so
|
|
1046
|
+
* the server can send it again to the host's next run, and logged. A
|
|
1047
|
+
* handler's own failure is answered by containedInboundHandler, with
|
|
1048
|
+
* -32000 and the stop wording alone once the host is stopping.
|
|
811
1049
|
*/
|
|
812
1050
|
private refuseServerItem;
|
|
813
1051
|
/**
|
|
@@ -849,7 +1087,10 @@ export declare class AgentFramework {
|
|
|
849
1087
|
offTrace(listener: TraceEventListener): void;
|
|
850
1088
|
private removeTraceRegistration;
|
|
851
1089
|
/**
|
|
852
|
-
* Add a module at runtime.
|
|
1090
|
+
* Add a module at runtime. Refused, with a rejection, while a stop() is
|
|
1091
|
+
* still running: a module added then would either be stopped by that stop
|
|
1092
|
+
* or, once the stop has taken its list of modules to stop, stay started
|
|
1093
|
+
* past it.
|
|
853
1094
|
*/
|
|
854
1095
|
addModule(module: Module): Promise<void>;
|
|
855
1096
|
/**
|
|
@@ -870,13 +1111,53 @@ export declare class AgentFramework {
|
|
|
870
1111
|
*/
|
|
871
1112
|
getConversationRouter(): ConversationRouter | null;
|
|
872
1113
|
/**
|
|
873
|
-
* Abort an in-flight inference for an agent.
|
|
1114
|
+
* Abort an in-flight inference for an agent. True when there was one to
|
|
1115
|
+
* stop: a stream, or a turn with no stream and one of its checks ahead (its
|
|
1116
|
+
* hooks or compile, a wait to retry, the tool-result guard's wait), which
|
|
1117
|
+
* ends at that check, before it sends anything more.
|
|
874
1118
|
*/
|
|
875
1119
|
abortInference(agentName: string, reason?: string): boolean;
|
|
1120
|
+
/**
|
|
1121
|
+
* Terminal for a deliberate cancellation of a live stream: the host's Stop
|
|
1122
|
+
* button, an admin abort, a subagent reclaim — anything that went through
|
|
1123
|
+
* Agent.cancelStream(reason) / abortInference(reason). Both of a stream's
|
|
1124
|
+
* cancel twins land here (`aborted` with wire reason 'user', or `error`
|
|
1125
|
+
* for implementations that report cancel() that way — see
|
|
1126
|
+
* host-quiesce.test.ts), so the two cannot drift: settle the turn, ONE
|
|
1127
|
+
* inference:aborted carrying the caller's reason, the neutral
|
|
1128
|
+
* [turn-interrupted] marker, an attributable inference-log terminal, gate
|
|
1129
|
+
* release. Deliberately none of the failure accounting: inference:failed /
|
|
1130
|
+
* inference:exhausted feed the consecutive-failure streak, hard-down ops
|
|
1131
|
+
* alerts, the poison-history breaker and the "[inference-failed]" marker —
|
|
1132
|
+
* all of which told a resident, in the user's voice, that its turn failed
|
|
1133
|
+
* and advised remediation for a failure that never happened — and
|
|
1134
|
+
* errorPolicy would relaunch the very inference someone just stopped.
|
|
1135
|
+
*
|
|
1136
|
+
* Only called while `agent` still owns stream `myStreamId`.
|
|
1137
|
+
*/
|
|
1138
|
+
private settleDeliberateCancel;
|
|
1139
|
+
/**
|
|
1140
|
+
* Terminal for a stop the framework itself made: stop()'s shutdown and an
|
|
1141
|
+
* operator's quiesce abandon, each recorded in frameworkCancelledStreams
|
|
1142
|
+
* before the cancel. A stream may report that cancel as `aborted`, as
|
|
1143
|
+
* `error`, by just closing, or by throwing, and each of those ends here
|
|
1144
|
+
* (through endFrameworkCancel()), so the four cannot drift: settle the
|
|
1145
|
+
* turn (an ephemeral run rejects with the stop's own text), an
|
|
1146
|
+
* attributable inference-log terminal, ONE inference:aborted
|
|
1147
|
+
* carrying the framework's reason, gate release. No [turn-interrupted]
|
|
1148
|
+
* marker, since nobody stopped the agent, and none of the failure
|
|
1149
|
+
* accounting that inference:failed / inference:exhausted drive.
|
|
1150
|
+
*
|
|
1151
|
+
* The script abort, reset and settle happen only while `agent` still owns
|
|
1152
|
+
* stream `myStreamId`; the log line and the trace are written either way.
|
|
1153
|
+
*/
|
|
1154
|
+
private settleFrameworkCancel;
|
|
876
1155
|
/**
|
|
877
1156
|
* Get all registered modules.
|
|
878
1157
|
*/
|
|
879
1158
|
getAllModules(): Module[];
|
|
1159
|
+
/** Read the namespaced utility catalogue without adding first-class model tools. */
|
|
1160
|
+
getAllUtilities(): import('./types/index.js').ToolDefinition[];
|
|
880
1161
|
/**
|
|
881
1162
|
* Get all available tools from all modules and MCPL servers.
|
|
882
1163
|
*/
|
|
@@ -887,11 +1168,22 @@ export declare class AgentFramework {
|
|
|
887
1168
|
* a writable workspace mount for storage). */
|
|
888
1169
|
private referenceFetcherInstance?;
|
|
889
1170
|
private getReferenceFetcher;
|
|
890
|
-
/** Register every RFC-005 reference in
|
|
891
|
-
* its server, then
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
1171
|
+
/** Register every RFC-005 reference in an MCPL peer's tool-result content
|
|
1172
|
+
* against its server, then fetch by `mode`:
|
|
1173
|
+
* - `register`: nothing. An in-process caller (executeMcplToolCall) may
|
|
1174
|
+
* never show the result to an agent, and an eager fetch would spend the
|
|
1175
|
+
* server's fetch budget, which the agent's own fetch_reference needs, on
|
|
1176
|
+
* bytes nobody asked for. A stub later made of a registered reference is
|
|
1177
|
+
* bound, so fetch_reference can fetch it.
|
|
1178
|
+
* - `model`: eagerly fetch the ones inside the autofetch envelope (below
|
|
1179
|
+
* the eager ceiling, connection origin — never worse than the server
|
|
1180
|
+
* having inlined the bytes). Failures are non-fatal: the stub then says
|
|
1181
|
+
* fetch_reference instead of a path.
|
|
1182
|
+
* - `script`: as `model`, then fetch every reference ("eagerly lazy"): a
|
|
1183
|
+
* script receiving a result is the strongest available signal that the
|
|
1184
|
+
* bytes are wanted (scripts process, they do not browse), so the stub it
|
|
1185
|
+
* receives carries a workspace path it can open directly.
|
|
1186
|
+
* A uri the result calls expired is fetched in no mode. */
|
|
895
1187
|
private autoFetchReferences;
|
|
896
1188
|
/** Core agent_settings keys — extension keys must not collide with these. */
|
|
897
1189
|
private static readonly AGENT_SETTINGS_CORE_KEYS;
|
|
@@ -931,18 +1223,24 @@ export declare class AgentFramework {
|
|
|
931
1223
|
* is open again for an instance kept with a store it doesn't own and that
|
|
932
1224
|
* is still open (start() doesn't restore stopped modules or MCPL
|
|
933
1225
|
* connections, and refuses an owned store that stop() closed). A start()
|
|
934
|
-
* made while a stop() is still
|
|
1226
|
+
* made while a stop() is still running is refused. */
|
|
935
1227
|
private guardSpillsClosedFor;
|
|
936
1228
|
/** A new agent's guard: its persisted setting, the tool-results spill its
|
|
937
1229
|
* withheld originals are written to, and the set stop() waits on
|
|
938
|
-
* (agent-framework #277).
|
|
1230
|
+
* (agent-framework #277). The setting is read from framework/state's
|
|
1231
|
+
* toolResultGuards by the agent's own name. A read that fails, or a
|
|
1232
|
+
* toolResultGuards that isn't an object, throws, naming the state: taken
|
|
1233
|
+
* as no setting, the agent would take its recipe's guard, and the next
|
|
1234
|
+
* guard change would store over a toolResultGuards that isn't an object. */
|
|
939
1235
|
private adoptToolResultGuard;
|
|
940
1236
|
/** Each guard that may have queued storage work, once, by agent name: the
|
|
941
1237
|
* live agents' and every other that isn't idle. */
|
|
942
1238
|
private guardsWithStorageWork;
|
|
1239
|
+
/** `think` for one agent: its same-round policy, and `skip_reply` named only where the agent may call it. */
|
|
943
1240
|
private buildThinkTool;
|
|
944
1241
|
/** agent_settings tool definition with module extension fields merged in. */
|
|
945
1242
|
private buildAgentSettingsTool;
|
|
1243
|
+
private warnEmptyUtilityPermissions;
|
|
946
1244
|
private getToolsForAgent;
|
|
947
1245
|
/** Available is independent of presentation visibility; execution callers keep this surface. */
|
|
948
1246
|
private availableToolsForPresentation;
|
|
@@ -1014,9 +1312,15 @@ export declare class AgentFramework {
|
|
|
1014
1312
|
static readonly QUIESCE_TIMEOUT_MAX_MS = 600000;
|
|
1015
1313
|
static readonly QUIESCE_TIMEOUT_DEFAULT_MS = 120000;
|
|
1016
1314
|
/**
|
|
1017
|
-
* Enter quiesce mode:
|
|
1018
|
-
* MCPL data planes, and wait for
|
|
1019
|
-
* `activeTurnTokens`, which spans
|
|
1315
|
+
* Enter quiesce mode: write the deferred-write queue, persist the flag,
|
|
1316
|
+
* suppress gate deliveries, pause all MCPL data planes, and wait for
|
|
1317
|
+
* in-flight turns to settle (turn-alive is `activeTurnTokens`, which spans
|
|
1318
|
+
* dequeue → settled teardown). Idempotent, but for the queue's write, which
|
|
1319
|
+
* every call makes first: when the queue can't reach disk, because its
|
|
1320
|
+
* write fails or it's over the cap, the call rejects with a
|
|
1321
|
+
* QuiesceBlockedError and the host's mode as it was, unless it has
|
|
1322
|
+
* `abandon`, which goes on with the queue in memory and an alert
|
|
1323
|
+
* (writeDeferredWritesForQuiesce).
|
|
1020
1324
|
*
|
|
1021
1325
|
* On drain timeout the host STAYS quiesced (`drained: false` in the
|
|
1022
1326
|
* result); with `abandon: true` the undrained streams are cancelled via a
|
|
@@ -1046,12 +1350,18 @@ export declare class AgentFramework {
|
|
|
1046
1350
|
}): Promise<HostModeStatus>;
|
|
1047
1351
|
private runResume;
|
|
1048
1352
|
/**
|
|
1049
|
-
* Land every deferred write whose target has no turn alive, one
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1353
|
+
* Land every deferred write whose target has no turn alive, as one batch
|
|
1354
|
+
* acknowledged once: the chronicle is synced, then the persisted queue is
|
|
1355
|
+
* rewritten without the batch (ackDeferredWrites). Until then the batch
|
|
1356
|
+
* stays in the durable queue, so a crash mid-flush replays it at the next
|
|
1357
|
+
* boot, which skips each entry that already landed, by its deferredWriteId
|
|
1358
|
+
* — no loss, no duplicates. The batch is stored in queue order, whatever
|
|
1359
|
+
* its targets (writeDrainedInOrder). A write the store rejects stays
|
|
1360
|
+
* queued, logged, with what is queued behind it for its target, so the
|
|
1361
|
+
* flush never stores that target's later entries ahead of it, and other
|
|
1362
|
+
* targets' entries go on. (A write that isn't deferred can still land
|
|
1363
|
+
* ahead of it, such as one for an idle agent once the host has resumed.)
|
|
1364
|
+
* A boot that meets it again logs it and goes on.
|
|
1055
1365
|
*
|
|
1056
1366
|
* Per-target: an agent whose turn is still alive keeps ITS messages
|
|
1057
1367
|
* deferred for its own turn boundary; everyone else's flush now.
|
|
@@ -1078,12 +1388,38 @@ export declare class AgentFramework {
|
|
|
1078
1388
|
* Which of `ids` already exist in some agent's store as a landed deferred
|
|
1079
1389
|
* write (`metadata.deferredWriteId`). Scans each context manager's recent
|
|
1080
1390
|
* tail blob-free — an interrupted flush is always within the last few
|
|
1081
|
-
* hundred slots — and tolerates facades without windowed reads.
|
|
1391
|
+
* hundred slots — and tolerates facades without windowed reads. A context
|
|
1392
|
+
* that can't be read throws, naming its agent: counted as holding none, a
|
|
1393
|
+
* write that landed there before its ack would land a second time.
|
|
1082
1394
|
*/
|
|
1083
1395
|
private landedDeferredWriteIds;
|
|
1084
|
-
/** Atomic JSON write for the recovery files
|
|
1085
|
-
*
|
|
1396
|
+
/** Atomic, durable JSON write for the recovery files. The document goes to
|
|
1397
|
+
* a temp file at 0600, which is synced and renamed over the record, so
|
|
1398
|
+
* the new record's data is asked to reach the disk before the rename
|
|
1399
|
+
* publishes it. Then the directory is synced, for the record's entry in
|
|
1400
|
+
* it, and its parent, for the directory's own entry, which is new when a
|
|
1401
|
+
* write, this one or an earlier one, had to make the directory; levels
|
|
1402
|
+
* above are left to the filesystem. Directories aren't synced on win32,
|
|
1403
|
+
* which syncs the file alone, or where the filesystem can't sync one
|
|
1404
|
+
* (syncRecoveryDirectory). A failure before the rename removes the temp
|
|
1405
|
+
* file, if it was made, and throws an error saying the record was left as
|
|
1406
|
+
* it was, with the original as its cause and its code kept. A directory
|
|
1407
|
+
* sync that fails, other than where the filesystem can't sync one, is
|
|
1408
|
+
* raised as an ops alert, not thrown: the new record is in place, and the
|
|
1409
|
+
* callers go on to record it as written. */
|
|
1086
1410
|
private writeRecoveryFile;
|
|
1411
|
+
/** Syncs the directory a recovery file is in, or that directory's parent,
|
|
1412
|
+
* so its entries reach the disk. win32 is left out. So is a sync refused
|
|
1413
|
+
* with EINVAL or EBADF, the answer where the filesystem or system can't
|
|
1414
|
+
* sync a directory: that refusal would come again on every write, and
|
|
1415
|
+
* PostgreSQL's fsync_fname_ext lets the same two go. Any other failure is
|
|
1416
|
+
* raised as an ops alert naming the record. */
|
|
1417
|
+
private syncRecoveryDirectory;
|
|
1418
|
+
/** A recovery file's document, or undefined when there's no file. Only a
|
|
1419
|
+
* missing file means none was written: any other failure to read it
|
|
1420
|
+
* (EACCES, ENOTDIR, EIO, which existsSync would answer false for)
|
|
1421
|
+
* throws, and text that isn't JSON throws a StoredFormError carrying
|
|
1422
|
+
* the parser's reason, since reading it again won't change it. */
|
|
1087
1423
|
private readRecoveryFile;
|
|
1088
1424
|
private warnRecoveryFallbackOnce;
|
|
1089
1425
|
/**
|
|
@@ -1094,9 +1430,86 @@ export declare class AgentFramework {
|
|
|
1094
1430
|
* window is operator-length, not turn-length. Lives in the
|
|
1095
1431
|
* branch-independent recovery file so a rollback cannot orphan it.
|
|
1096
1432
|
* Deferrals outside a quiesce window (turn-alive, mid-tool-cycle) are
|
|
1097
|
-
*
|
|
1433
|
+
* mirrored only while such a queue is still persisted; otherwise they are
|
|
1434
|
+
* memory-only: they land within the turn, at a tool boundary or at its
|
|
1435
|
+
* end, and a crash before then loses them. That window runs to the turn's
|
|
1436
|
+
* end for a message held there and what is queued behind it, and, on a
|
|
1437
|
+
* stream that can't carry injected messages, for every message deferred
|
|
1438
|
+
* during the turn.
|
|
1439
|
+
*
|
|
1440
|
+
* A write that fails, or a queue over the cap, which writes nothing,
|
|
1441
|
+
* leaves the record as it last held it, except that store only, a write
|
|
1442
|
+
* whose sync failed is in the store, where a later sync can still put it
|
|
1443
|
+
* on disk (writeDeferredWritesSlot). The queue stays in memory and
|
|
1444
|
+
* mirrored, so its next change writes it again. Until a write succeeds, a
|
|
1445
|
+
* restart restores what the record holds, or doesn't start if it can't
|
|
1446
|
+
* read the record: it loses writes queued since, and brings back an entry
|
|
1447
|
+
* withdrawn since (removePlacement, RFC-006's removal of an unread
|
|
1448
|
+
* deferred write) that it still lists. The callers go on: a
|
|
1449
|
+
* deferral's caller has already answered its source, so failing it would
|
|
1450
|
+
* lose a write that can still land at resume. The first such write after
|
|
1451
|
+
* one that succeeded raises an ops alert, and a line says when a write
|
|
1452
|
+
* succeeds again (deferredWritesFellBehind). quiesce() writes the queue
|
|
1453
|
+
* itself before it changes the host's mode, and refuses instead, unless
|
|
1454
|
+
* the call has `abandon` (writeDeferredWritesForQuiesce).
|
|
1098
1455
|
*/
|
|
1099
1456
|
private persistDeferredWrites;
|
|
1457
|
+
/**
|
|
1458
|
+
* Write the queue to its record as it stands, when the host is quiesced
|
|
1459
|
+
* (`quiesced`, which quiesce() passes before it sets the flag) or the
|
|
1460
|
+
* queue is mirrored: the queue when it holds anything, and an empty one
|
|
1461
|
+
* over a record that held one. What the write throws is thrown. A queue
|
|
1462
|
+
* whose JSON is longer than the cap writes nothing.
|
|
1463
|
+
*/
|
|
1464
|
+
private writeDeferredWrites;
|
|
1465
|
+
/** Store only, the slot is the record, and a write isn't on disk until the
|
|
1466
|
+
* store syncs, so a sync that fails is the write's failure, as in
|
|
1467
|
+
* persistHostMode. The slot is set by then, and a later sync can still
|
|
1468
|
+
* put it on disk, so writeDeferredWrites marks the queue mirrored before
|
|
1469
|
+
* it writes; a boot that restores such a queue skips each entry that
|
|
1470
|
+
* already landed. */
|
|
1471
|
+
private writeDeferredWritesSlot;
|
|
1472
|
+
/** The durable queue: every deferred write not yet acked, pending and
|
|
1473
|
+
* un-acked, in deferral order. */
|
|
1474
|
+
private durableDeferredWrites;
|
|
1475
|
+
/** Where the queue is recorded, as an operator would look for it. */
|
|
1476
|
+
private deferredWritesRecord;
|
|
1477
|
+
/**
|
|
1478
|
+
* quiesce()'s write of the queue, before it changes the host's mode, as a
|
|
1479
|
+
* quiesced host keeps it: a write held only in memory, such as one
|
|
1480
|
+
* deferred behind a turn still alive, is on disk before quiesce() goes on,
|
|
1481
|
+
* as its record is. When the queue can't reach disk, because its write
|
|
1482
|
+
* fails or it's over the cap, which writes nothing, a call with `abandon`
|
|
1483
|
+
* goes on with the queue in memory and the failure's or the cap's alert.
|
|
1484
|
+
* Any other throws a QuiesceBlockedError naming the ways out, so quiesce()
|
|
1485
|
+
* rejects with the host's mode as it was (store only, the slot set before
|
|
1486
|
+
* a sync that failed leaves the queue mirrored: writeDeferredWritesSlot).
|
|
1487
|
+
* Writes a flush landed stay in the queue until a store sync acks them, so
|
|
1488
|
+
* it first retries an ack whose sync failed: once a sync succeeds they're
|
|
1489
|
+
* on disk, and they leave the queue rather than count against the cap.
|
|
1490
|
+
*/
|
|
1491
|
+
private writeDeferredWritesForQuiesce;
|
|
1492
|
+
/**
|
|
1493
|
+
* A write of the queue failed, or met the cap, and quiesce() didn't reject
|
|
1494
|
+
* for it. The queue stays mirrored, so its next change writes it again.
|
|
1495
|
+
* The first such write since one that succeeded raises an ops alert naming
|
|
1496
|
+
* the record, and the rest of the run raises none. A failed write's own
|
|
1497
|
+
* line is logged each time (persistDeferredWrites), and the cap's line the
|
|
1498
|
+
* first time the cap is met in a run, whatever began it. On a host that is
|
|
1499
|
+
* or is about to be quiesced, both say to resume before any restart, since
|
|
1500
|
+
* a quiesced host lands its deferred writes only at a resume.
|
|
1501
|
+
*/
|
|
1502
|
+
private deferredWritesFellBehind;
|
|
1503
|
+
/** A write of the queue succeeded after a run of failures: say that the
|
|
1504
|
+
* record has caught up. */
|
|
1505
|
+
private deferredWritesCaughtUp;
|
|
1506
|
+
/**
|
|
1507
|
+
* Restore the deferred-write queue a crash or a stop left durable. Nothing
|
|
1508
|
+
* stored is an empty queue. A queue that can't be read, or that reads as
|
|
1509
|
+
* anything but a queue, throws, since taken as empty the next deferral
|
|
1510
|
+
* would replace the stored one; so does a context that can't be checked
|
|
1511
|
+
* for writes that already landed (see landedDeferredWriteIds).
|
|
1512
|
+
*/
|
|
1100
1513
|
private restorePersistedDeferredWrites;
|
|
1101
1514
|
/**
|
|
1102
1515
|
* Operator-driven maintenance: run (or join) one bounded compression pass —
|
|
@@ -1200,11 +1613,12 @@ export declare class AgentFramework {
|
|
|
1200
1613
|
/** previewAgentRuntimeSettings for an agent in hand: boot restore previews one not yet registered. */
|
|
1201
1614
|
private previewRuntimeSettingsFor;
|
|
1202
1615
|
/**
|
|
1203
|
-
*
|
|
1616
|
+
* Whether process events and their responses are written to Chronicle
|
|
1617
|
+
* (`processLogging.persist`). `process:completed` trace events are emitted
|
|
1618
|
+
* either way.
|
|
1204
1619
|
*/
|
|
1205
1620
|
isProcessLoggingEnabled(): {
|
|
1206
1621
|
persist: boolean;
|
|
1207
|
-
broadcast: boolean;
|
|
1208
1622
|
};
|
|
1209
1623
|
/**
|
|
1210
1624
|
* Get the underlying store.
|
|
@@ -1241,13 +1655,26 @@ export declare class AgentFramework {
|
|
|
1241
1655
|
*/
|
|
1242
1656
|
getMembrane(): Membrane;
|
|
1243
1657
|
getSessionUsage(): SessionUsageSnapshot;
|
|
1658
|
+
/** Restore the usage totals a prior session stored. None stored starts
|
|
1659
|
+
* fresh (the constructor's tracker). Totals that can't be read, or that
|
|
1660
|
+
* read as anything but totals, throw: taken as none, the next inference's
|
|
1661
|
+
* persistUsageState would store fresh totals over them.
|
|
1662
|
+
*
|
|
1663
|
+
* This is create()'s first read of framework/state, so it also refuses a
|
|
1664
|
+
* framework/state that isn't an object: every reader of that state would
|
|
1665
|
+
* take it as holding nothing, and its first write would replace it. */
|
|
1244
1666
|
private restoreUsageState;
|
|
1245
1667
|
private persistUsageState;
|
|
1246
|
-
/** An agent's persisted record, or null when it has none
|
|
1668
|
+
/** An agent's persisted record, or null when it has none. Throws the
|
|
1669
|
+
* store's error when it can't be read, and a StoredFormError when what's
|
|
1670
|
+
* stored for the agent, or the map that holds every agent's, isn't a record. */
|
|
1247
1671
|
private readAgentRuntimeSettings;
|
|
1248
1672
|
private validatePersistedAgentRuntimeSettings;
|
|
1249
1673
|
/** Load resident-set inline caps from framework state, dropping (loudly)
|
|
1250
|
-
* anything that fails the same validation the live update enforces.
|
|
1674
|
+
* anything that fails the same validation the live update enforces. A
|
|
1675
|
+
* failed read is logged and boot goes on without them: nothing is lost,
|
|
1676
|
+
* since persistToolResultInlineCap reads the stored caps again before it
|
|
1677
|
+
* writes one. */
|
|
1251
1678
|
private readPersistedToolResultInlineCaps;
|
|
1252
1679
|
/** Write (cap) or clear (null) one agent's resident-set inline cap. */
|
|
1253
1680
|
private persistToolResultInlineCap;
|
|
@@ -1303,20 +1730,27 @@ export declare class AgentFramework {
|
|
|
1303
1730
|
*/
|
|
1304
1731
|
private recordCompiledContextBudget;
|
|
1305
1732
|
private persistAgentRuntimeSettings;
|
|
1306
|
-
/** Persist (or clear, with null) the host quiesce mode
|
|
1307
|
-
*
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1733
|
+
/** Persist (or clear, with null) the host quiesce mode: in the recovery file
|
|
1734
|
+
* when there's a path for one, and in framework/state's hostMode otherwise.
|
|
1735
|
+
* (A boot with a path reads that legacy hostMode only while no file exists.)
|
|
1736
|
+
* Quiesce survives a restart BY DESIGN — a crash mid-surgery must come back
|
|
1737
|
+
* up NOT serving against a half-repaired store. Resume is always reachable
|
|
1738
|
+
* (public method, WS/HTTP, control-plane host/command), and every quiesced
|
|
1739
|
+
* boot logs a loud banner. */
|
|
1311
1740
|
private persistHostMode;
|
|
1312
1741
|
/** The recovery file wins whenever it exists; the branch-local slot is
|
|
1313
|
-
* read only for stores that predate it (or store-only configs).
|
|
1742
|
+
* read only for stores that predate it (or store-only configs). No record
|
|
1743
|
+
* is a host that was never quiesced. A record that can't be read, or that
|
|
1744
|
+
* reads as anything but a host-mode record, throws: taken as "not
|
|
1745
|
+
* quiesced", a host that stopped mid-maintenance would boot serving. */
|
|
1314
1746
|
private readHostMode;
|
|
1315
1747
|
/**
|
|
1316
1748
|
* Create an ephemeral agent that is NOT registered in the main event loop.
|
|
1317
1749
|
*
|
|
1318
|
-
* Used by SubagentModule (and similar) to
|
|
1319
|
-
*
|
|
1750
|
+
* Used by SubagentModule (and similar) to prepare short-lived agents.
|
|
1751
|
+
* Call runEphemeralToCompletion(agent, contextManager) to register and run
|
|
1752
|
+
* the returned agent. Framework-created identities have tool authority only
|
|
1753
|
+
* while registered; public tool calls before a run or after retirement fail.
|
|
1320
1754
|
* The returned agent has its own ContextManager on a namespaced state
|
|
1321
1755
|
* within the framework's shared Chronicle store — messages go to
|
|
1322
1756
|
* `{namespace}/messages`, context log to `{namespace}/context`.
|
|
@@ -1395,6 +1829,15 @@ export declare class AgentFramework {
|
|
|
1395
1829
|
/** Discoverability for event tags (MCPL RFC-001): the reserved chat:* core,
|
|
1396
1830
|
* each connected server's declared tag ontology, and gate.js status. */
|
|
1397
1831
|
private static readonly EVENT_TAGS_TOOL;
|
|
1832
|
+
/** How long, in days, a draft beyond a resident's newest is kept (KEEP_IDLE_MS). */
|
|
1833
|
+
private static readonly DRAFT_KEEP_DAYS;
|
|
1834
|
+
/** Synthesized drafts tool — present whenever MCPL channels are
|
|
1835
|
+
* configured. A resident's held drafts (src/prose-drafts.ts): plain speech
|
|
1836
|
+
* that was not sent, never published except by its resident's resend, and
|
|
1837
|
+
* kept as that module's retention says. Nullable
|
|
1838
|
+
* fields, cast like save_recent_image's: a caller whose provider presents
|
|
1839
|
+
* every property as required can still say "not in use". */
|
|
1840
|
+
private static readonly DRAFTS_TOOL;
|
|
1398
1841
|
/** Synthesized save_image tool — present when a workspace module is
|
|
1399
1842
|
* registered. Lets the agent persist an image it has already seen in its
|
|
1400
1843
|
* own context (Discord attachments arrive inlined as base64 and are
|
|
@@ -1414,23 +1857,24 @@ export declare class AgentFramework {
|
|
|
1414
1857
|
private static readonly CHAT_CORE_TAGS;
|
|
1415
1858
|
/**
|
|
1416
1859
|
* Mark an inference refusal visibly: react on the message that holds the
|
|
1417
|
-
* conversational locus (the most recent incoming channel
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1860
|
+
* refused agent's conversational locus (the most recent incoming channel
|
|
1861
|
+
* message; an ephemeral run has none, so a subagent's refusal marks no
|
|
1862
|
+
* message) with a category-specific emoji. Best-effort — failures are
|
|
1863
|
+
* logged, never thrown, and non-Discord loci are silently skipped.
|
|
1420
1864
|
*/
|
|
1421
1865
|
private reactToRefusal;
|
|
1422
1866
|
/**
|
|
1423
|
-
*
|
|
1424
|
-
* message
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1867
|
+
* Shed the newest turn: remove the newest message that isn't a system
|
|
1868
|
+
* message, whoever wrote it, with the rest of its exchange (the tool_use
|
|
1869
|
+
* turn paired with a tool result, and the whole of a body stored in
|
|
1870
|
+
* shards). It adds no marker; the caller keeps one consolidated marker for
|
|
1871
|
+
* the episode (updateRewindMarker). The returned record's descriptor says
|
|
1872
|
+
* what was removed and its size, never the content, while the raw record
|
|
1873
|
+
* survives in the chronicle log for forensics. Returns null when only
|
|
1874
|
+
* system messages remain.
|
|
1431
1875
|
*
|
|
1432
|
-
* Shared by the
|
|
1433
|
-
*
|
|
1876
|
+
* Shared by the refusal rewind, automatic or forced by `/unstick`, and by
|
|
1877
|
+
* the shed after inference exhaustion (quarantinePoisonedHistory).
|
|
1434
1878
|
*/
|
|
1435
1879
|
private shedNewestTurn;
|
|
1436
1880
|
/**
|
|
@@ -1443,11 +1887,12 @@ export declare class AgentFramework {
|
|
|
1443
1887
|
*/
|
|
1444
1888
|
private updateRewindMarker;
|
|
1445
1889
|
/**
|
|
1446
|
-
*
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1890
|
+
* A turn that ended WITHOUT a refusal (a natural completion that wasn't
|
|
1891
|
+
* one, or a tool-ended turn) ends the rewind episode: the model responded.
|
|
1892
|
+
* Leave the consolidated marker in place as the durable record; just
|
|
1893
|
+
* clear the per-episode counters, and report a forced `/unstick` done.
|
|
1449
1894
|
*/
|
|
1450
|
-
private
|
|
1895
|
+
private endRefusalEpisode;
|
|
1451
1896
|
/**
|
|
1452
1897
|
* Conclude an active `/unstick` session: post the outcome (what was shed and
|
|
1453
1898
|
* whether the model stopped refusing) to the channel the command came from,
|
|
@@ -1601,6 +2046,14 @@ export declare class AgentFramework {
|
|
|
1601
2046
|
}): OperatorLogEntry[];
|
|
1602
2047
|
/** Where the operator log is written, or undefined when disabled. */
|
|
1603
2048
|
getOperatorLogPath(): string | undefined;
|
|
2049
|
+
/**
|
|
2050
|
+
* A default name for an operator branch: `base`, the timestamped name the
|
|
2051
|
+
* caller passes, when the store doesn't hold it, else the first of `base-2`,
|
|
2052
|
+
* `base-3`, … that it doesn't hold (firstFreeBranchName). Two changes of one
|
|
2053
|
+
* kind made one after the other in a millisecond then get a branch each,
|
|
2054
|
+
* where the second used to be refused under the first one's name.
|
|
2055
|
+
*/
|
|
2056
|
+
private newOperatorBranchName;
|
|
1604
2057
|
/**
|
|
1605
2058
|
* The surgery gate — STORE-wide, not per agent. A branch switch moves the
|
|
1606
2059
|
* active chronicle branch for every context manager sharing this store,
|
|
@@ -1645,7 +2098,7 @@ export declare class AgentFramework {
|
|
|
1645
2098
|
messageId: string;
|
|
1646
2099
|
requester?: OperatorRequester;
|
|
1647
2100
|
note?: string;
|
|
1648
|
-
/** Branch name for the fork (default `rollback/<agent>/<ts
|
|
2101
|
+
/** Branch name for the fork (default `rollback/<agent>/<ts>`, or with `-2`, `-3`, … appended when the store already holds that name). */
|
|
1649
2102
|
branchName?: string;
|
|
1650
2103
|
}): Promise<{
|
|
1651
2104
|
agentName: string;
|
|
@@ -1671,7 +2124,8 @@ export declare class AgentFramework {
|
|
|
1671
2124
|
}>;
|
|
1672
2125
|
/**
|
|
1673
2126
|
* Suppress specific messages from the live context without touching the
|
|
1674
|
-
* source branch: fork at the current head (`suppress/<agent>/<ts
|
|
2127
|
+
* source branch: fork at the current head (by default `suppress/<agent>/<ts>`,
|
|
2128
|
+
* numbered `-2`, `-3`, … when the store already holds that name), redact
|
|
1675
2129
|
* the messages on the fork, switch to it. Shards of a body group are always
|
|
1676
2130
|
* removed together. Discord originals get awareness markers via the outbox;
|
|
1677
2131
|
* the batch is `explicit`-activated only after every removal succeeded, and
|
|
@@ -1688,7 +2142,7 @@ export declare class AgentFramework {
|
|
|
1688
2142
|
messageIds: string[];
|
|
1689
2143
|
requester?: OperatorRequester;
|
|
1690
2144
|
note?: string;
|
|
1691
|
-
/** Branch name for the fork (default `suppress/<agent>/<ts
|
|
2145
|
+
/** Branch name for the fork (default `suppress/<agent>/<ts>`, or with `-2`, `-3`, … appended when the store already holds that name). */
|
|
1692
2146
|
branchName?: string;
|
|
1693
2147
|
}): Promise<{
|
|
1694
2148
|
agentName: string;
|
|
@@ -1755,13 +2209,13 @@ export declare class AgentFramework {
|
|
|
1755
2209
|
* reconnect or start delivers what is still pending.
|
|
1756
2210
|
*
|
|
1757
2211
|
* Like a server's drain, the delivery runs apart from the operation that
|
|
1758
|
-
* started it: it isn't an operator's operation
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1761
|
-
* durable outbox. Once stop()
|
|
1762
|
-
*
|
|
1763
|
-
* marks stay pending, and the next
|
|
1764
|
-
* with the branch and delivers them.
|
|
2212
|
+
* started it: it isn't an operator's operation. A drain already running
|
|
2213
|
+
* when stop() begins sends nothing more, and stop() waits for it to record
|
|
2214
|
+
* the call it had in flight, which closing the connections ends; what it
|
|
2215
|
+
* hasn't sent stays pending in the durable outbox, unrecorded. Once stop()
|
|
2216
|
+
* has begun, none is started, since there's no point opening a drain that
|
|
2217
|
+
* the teardown is about to cut off: the marks stay pending, and the next
|
|
2218
|
+
* start's barrier reconciles the outbox with the branch and delivers them.
|
|
1765
2219
|
*
|
|
1766
2220
|
* @param after What moved the branch, for the log and the alert
|
|
1767
2221
|
* ("rollback", "branch switch", "undo" …).
|
|
@@ -1808,6 +2262,14 @@ export declare class AgentFramework {
|
|
|
1808
2262
|
* Drop a departed agent's checkpoint tree key and turn/redo bookkeeping.
|
|
1809
2263
|
* Without this, spawn-and-dispose agents leave a key (and in-memory map
|
|
1810
2264
|
* entries) behind for the life of the store/session.
|
|
2265
|
+
*
|
|
2266
|
+
* Its callers are tearing an agent down: a conversation fork's disposal and
|
|
2267
|
+
* an ephemeral run's end. A throw from the store here would stop that
|
|
2268
|
+
* teardown partway, reject a finished ephemeral run in place of its result,
|
|
2269
|
+
* and at a closure turn's end reject a stream promise that nothing holds.
|
|
2270
|
+
* So a failed removal is logged and goes no further, and the agent's
|
|
2271
|
+
* checkpoints stay in the store under its name, as a crash before its
|
|
2272
|
+
* teardown leaves them.
|
|
1811
2273
|
*/
|
|
1812
2274
|
private evictTurnCheckpoints;
|
|
1813
2275
|
/**
|
|
@@ -1859,8 +2321,53 @@ export declare class AgentFramework {
|
|
|
1859
2321
|
* primary.
|
|
1860
2322
|
*/
|
|
1861
2323
|
private createConversationAgent;
|
|
1862
|
-
/**
|
|
1863
|
-
|
|
2324
|
+
/**
|
|
2325
|
+
* The router's decision for a message or batch on `facts.channelId`, made
|
|
2326
|
+
* once no spawn is in flight for that channel, with a spawn it decides on
|
|
2327
|
+
* already started. A routing that finds its channel's fork being spawned
|
|
2328
|
+
* waits for that spawn to settle and decides then, whatever it would have
|
|
2329
|
+
* decided meanwhile: once the fork is bound, the decision is the fork, and
|
|
2330
|
+
* if the spawn failed, it decides as a message arriving next would, which
|
|
2331
|
+
* proposes the spawn again if the message qualifies. The check, the
|
|
2332
|
+
* decision and the spawn's start are one synchronous step, so at most one
|
|
2333
|
+
* spawn per channel is in flight. Without the wait, a second spawn of the
|
|
2334
|
+
* fork's name failed ("already registered or reserved"), and a message
|
|
2335
|
+
* that didn't qualify on its own was dropped as unrouted; either way its
|
|
2336
|
+
* message was lost. Each path that delivers messages handles them one at
|
|
2337
|
+
* a time, but the event queue and the coalescer run beside each other, and
|
|
2338
|
+
* a spawn can wait, as on its template's annotations
|
|
2339
|
+
* (createConversationAgent); the waiting routing holds its own path for as
|
|
2340
|
+
* long, which none of the spawn's awaits needs.
|
|
2341
|
+
*/
|
|
2342
|
+
private routeConversation;
|
|
2343
|
+
/**
|
|
2344
|
+
* Store the router's counters with the spawn's generation, create the fork
|
|
2345
|
+
* the decision names and bind its channel to it, registered in
|
|
2346
|
+
* conversationSpawns under the channel until it settles. The store runs
|
|
2347
|
+
* inside the spawn's promise, still in routeConversation's synchronous
|
|
2348
|
+
* step, so a store that throws rejects the spawn, which each caller reports
|
|
2349
|
+
* as a failed spawn, rather than throwing out of routeConversation before
|
|
2350
|
+
* the caller's try. routeConversation registers a spawn only when none is
|
|
2351
|
+
* in flight for the channel, and only this spawn's settlement removes it,
|
|
2352
|
+
* so the entry it removes is its own. It's removed before anyone waiting
|
|
2353
|
+
* on it resumes, so a waiter that decides again doesn't find it.
|
|
2354
|
+
*/
|
|
2355
|
+
private spawnConversationAgent;
|
|
2356
|
+
/**
|
|
2357
|
+
* Store the router's generation counters with a spawn's generation, before
|
|
2358
|
+
* the spawn it names (see hydration in create()). A fork whose counter isn't
|
|
2359
|
+
* stored would have its name reused at the next restart, reopening its
|
|
2360
|
+
* namespace, so a failed read or write throws and the caller refuses the
|
|
2361
|
+
* spawn. The stored counters, the router's own and this spawn's are
|
|
2362
|
+
* merged, each at its highest, in one synchronous step: another channel's
|
|
2363
|
+
* spawn still in flight has stored its counter but not bound it yet, so
|
|
2364
|
+
* the router's map alone would write that counter back down, and the
|
|
2365
|
+
* router's own counters keep the stored ones from going back down when
|
|
2366
|
+
* they read lower, as on a branch with older counters. The merge is a Map,
|
|
2367
|
+
* so a channel id such as "constructor" is a key like any other. The
|
|
2368
|
+
* callers name the channel; the errors name the state and what failed.
|
|
2369
|
+
*/
|
|
2370
|
+
private storeConversationGeneration;
|
|
1864
2371
|
/**
|
|
1865
2372
|
* Remove a closed conversation fork from the framework: its closure turn
|
|
1866
2373
|
* has finished, so the home mapping has served its purpose and keeping the
|
|
@@ -1906,11 +2413,26 @@ export declare class AgentFramework {
|
|
|
1906
2413
|
* replies to the agent) DO still arrive, and nothing warned that answering
|
|
1907
2414
|
* via option 1 leaves the human's natural un-@'d follow-up invisible (Sol
|
|
1908
2415
|
* answered four #architecture mentions over four days while the follow-ups
|
|
1909
|
-
* to her own replies were silently dropped).
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
2416
|
+
* to her own replies were silently dropped). That pass stated discord-mcpl's
|
|
2417
|
+
* delivery model here.
|
|
2418
|
+
*
|
|
2419
|
+
* #406: what reaches the agent from a channel, open or closed, is its
|
|
2420
|
+
* server's delivery, which MCPL leaves to each server. discord-mcpl
|
|
2421
|
+
* subscribes a channel on channels/open and unsubscribes it on
|
|
2422
|
+
* channels/close. slack-mcpl keeps its own subscription, which decides
|
|
2423
|
+
* whether a conversation's ordinary messages arrive, open or closed; open
|
|
2424
|
+
* state only picks channels/incoming or push/event. So the invitation says
|
|
2425
|
+
* only that messages addressing the agent reach it whether or not it opens
|
|
2426
|
+
* the channel: it is shown only when one has arrived from a closed channel,
|
|
2427
|
+
* and both servers deliver them either way. What else arrives is for the
|
|
2428
|
+
* server to say on its push. Option 1 says a reply opens the channel,
|
|
2429
|
+
* because routeSpeech opens a closed channel before delivering into it. Its
|
|
2430
|
+
* old follow-up warning assumed the channel stays closed after the reply,
|
|
2431
|
+
* which that open makes false (and on discord-mcpl, channels/open also
|
|
2432
|
+
* subscribes). When the surface tracks a missed-ambient tally
|
|
2433
|
+
* (discord-mcpl sends `missedMessages`/`missedCharacters` in push origin),
|
|
2434
|
+
* the invitation shows the count — the cost of staying out, as a number, at
|
|
2435
|
+
* decision time.
|
|
1914
2436
|
*/
|
|
1915
2437
|
private buildClosedChannelInvitation;
|
|
1916
2438
|
/**
|
|
@@ -1919,13 +2441,55 @@ export declare class AgentFramework {
|
|
|
1919
2441
|
* id is reassigned to another endpoint (restartMcplServer with a new config).
|
|
1920
2442
|
*/
|
|
1921
2443
|
private coalescingBinding;
|
|
1922
|
-
|
|
2444
|
+
/**
|
|
2445
|
+
* Report one inbound acceptance to the observer, if one is installed
|
|
2446
|
+
* (InboundAcceptanceObserver). Called where an envelope is first created —
|
|
2447
|
+
* never for a delivery that reuses a frozen one. A failing observer is
|
|
2448
|
+
* reported loudly (stderr + trace) and never affects delivery.
|
|
2449
|
+
*/
|
|
2450
|
+
private noteInboundAccepted;
|
|
2451
|
+
/**
|
|
2452
|
+
* The inbound source envelope (mcpl/inbound-source.ts) of an item that
|
|
2453
|
+
* belongs to a registered channel. The one place the framework decides
|
|
2454
|
+
* which conversation an inbound item came from; every lane calls it at the
|
|
2455
|
+
* point the host accepted the item, or reuses the envelope frozen then.
|
|
2456
|
+
* `acceptedAt` falls back to now only for an event no admission path
|
|
2457
|
+
* stamped (a direct framework caller), which is the closest observation.
|
|
2458
|
+
*/
|
|
2459
|
+
private channelSource;
|
|
2460
|
+
/** Source envelope of a channels/incoming event (lane facts as given). */
|
|
2461
|
+
private channelEventSource;
|
|
2462
|
+
/** Source envelope of a push event: its derived channel, else unscoped. */
|
|
2463
|
+
private pushSource;
|
|
2464
|
+
/**
|
|
2465
|
+
* Source envelope for conversational input from a non-channel surface: a
|
|
2466
|
+
* module's messages in response to an `external-message` (console, TUI) or
|
|
2467
|
+
* `api:message` event. An event whose metadata names a channel is not a
|
|
2468
|
+
* surface conversation and gets none (never a guessed identity).
|
|
2469
|
+
*/
|
|
2470
|
+
private surfaceSourceFor;
|
|
2471
|
+
/**
|
|
2472
|
+
* The push coalescer, built and restored from its stored receipts and
|
|
2473
|
+
* batches. initializeMcpl calls this before it builds anything else, so a
|
|
2474
|
+
* refusal here leaves the MCPL subsystem as it was. Nothing stored is a
|
|
2475
|
+
* coalescer with no history. What can't be read, reads as anything but
|
|
2476
|
+
* this version's snapshot and receipts, or can't be restored, throws, and
|
|
2477
|
+
* so does an agent's context that can't be checked for an occurrence
|
|
2478
|
+
* already delivered (wasPublished): taken as no history, the next
|
|
2479
|
+
* acceptance's receipt and the next flush would replace what's stored, and
|
|
2480
|
+
* taken as undelivered, an occurrence would be delivered again.
|
|
2481
|
+
*/
|
|
2482
|
+
private restorePushCoalescer;
|
|
2483
|
+
/** Install a coalescer restorePushCoalescer built: none of this can fail. */
|
|
2484
|
+
private installPushCoalescer;
|
|
1923
2485
|
/**
|
|
1924
2486
|
* Durability barrier for coalescing (RFC-006 §3.1/§3.2): everything
|
|
1925
|
-
* written so far is fsynced before the caller proceeds.
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
2487
|
+
* written so far is fsynced before the caller proceeds. Commits asked for
|
|
2488
|
+
* in the same event-loop turn would share one `store.sync()`, but the
|
|
2489
|
+
* coalescer asks for every commit under its lock and holds the lock until
|
|
2490
|
+
* the commit resolves, so no two share one. Each acceptance makes an fsync
|
|
2491
|
+
* of its own, and so does each coalesced message a channels/incoming
|
|
2492
|
+
* request newly admits, one at a time.
|
|
1929
2493
|
*/
|
|
1930
2494
|
private commitCoalescingDurable;
|
|
1931
2495
|
private scheduleCoalescingSnapshot;
|
|
@@ -1941,6 +2505,11 @@ export declare class AgentFramework {
|
|
|
1941
2505
|
/** Deliver through the lane's ordinary path; report where it landed. */
|
|
1942
2506
|
private deliverCoalesced;
|
|
1943
2507
|
private wakeForCoalescedBatch;
|
|
2508
|
+
/** Queue a wake for each agent of the batch's audience, when its latest
|
|
2509
|
+
* occurrence triggers inference. `plain`: an ordinary push wake, without
|
|
2510
|
+
* the subject a withdrawal of the batch's wakes goes by, for a render
|
|
2511
|
+
* placed in its agent's deferred queue (wakeToRead). */
|
|
2512
|
+
private queueCoalescedWakes;
|
|
1944
2513
|
/** Withdraw unstarted wakes whose sole cause is this subject (§4.2). */
|
|
1945
2514
|
private cancelCoalescedWakes;
|
|
1946
2515
|
/**
|
|
@@ -1987,17 +2556,134 @@ export declare class AgentFramework {
|
|
|
1987
2556
|
private derivePushEventChannel;
|
|
1988
2557
|
private processInferenceRequests;
|
|
1989
2558
|
/**
|
|
1990
|
-
*
|
|
1991
|
-
*
|
|
1992
|
-
*
|
|
1993
|
-
*
|
|
1994
|
-
*
|
|
1995
|
-
*
|
|
1996
|
-
*
|
|
2559
|
+
* Stamps for the rows the agent's reply stores in its current turn: its
|
|
2560
|
+
* assistant responses, its tool_result rows (through `storeResults`), and
|
|
2561
|
+
* the contained-wrapper row that stands in for a response. The turn's other
|
|
2562
|
+
* stores (a delivery receipt, a routing notice, a deferred flush) aren't the
|
|
2563
|
+
* reply's, and carry none.
|
|
2564
|
+
* - A silent heartbeat tick stamps each of them for the whole turn, with the
|
|
2565
|
+
* separator text its request rendered. The stamps keep every row of the
|
|
2566
|
+
* tick identifiable after the turn, for a later retention policy to find
|
|
2567
|
+
* or collapse. The stamp names the agent: residents share one message
|
|
2568
|
+
* slot, and a broadcast tick reaches each of them with the same eventId.
|
|
2569
|
+
* - A `[Continue]` prompt stamps the rows of each round that follows it
|
|
2570
|
+
* (`turnPrompts`).
|
|
2571
|
+
* Request builds render each turn before the first surviving assistant row
|
|
2572
|
+
* that carries its stamp and that they can recognise: one with a tool call,
|
|
2573
|
+
* or with signed or redacted thinking (see silent-heartbeat.ts). The
|
|
2574
|
+
* tool_result rows and the wrapper row are stored as `user`, so their
|
|
2575
|
+
* stamps place nothing: they mark each row as the reply's.
|
|
2576
|
+
* Undefined for ordinary turns, whose rows are stored exactly as before.
|
|
2577
|
+
* (Named for its first use, the silent tick.)
|
|
1997
2578
|
*/
|
|
1998
2579
|
private silentTurnRowMetadata;
|
|
1999
|
-
/** Record plain-prose segments this turn suppressed. */
|
|
2580
|
+
/** Record plain-prose segments this turn suppressed without drafts (proseRouting=disabled). */
|
|
2000
2581
|
private recordProseSuppression;
|
|
2582
|
+
/**
|
|
2583
|
+
* Silenced plain speech: an explicit send holds it as resendable drafts; a
|
|
2584
|
+
* deliberate silence (skip_reply, a silent turn, or a private think in
|
|
2585
|
+
* the same native round, where that policy applies: an XML-mode round has
|
|
2586
|
+
* no verbatim content to route live, so its prose is routed at the turn's
|
|
2587
|
+
* end as ordinary speech) keeps it private —
|
|
2588
|
+
* counted for the receipt, never drafted. `segments` are the runs exactly
|
|
2589
|
+
* as written (splitProseRuns), so a draft keeps the resident's words byte
|
|
2590
|
+
* for byte. What it holds, keeps or moves is the round's turn's
|
|
2591
|
+
* (round.routing), whenever the hold runs.
|
|
2592
|
+
*/
|
|
2593
|
+
private holdSilencedProse;
|
|
2594
|
+
/**
|
|
2595
|
+
* Hold plain speech as drafts (src/prose-drafts.ts) instead of
|
|
2596
|
+
* letting it vanish: journaled durably and recorded for the receipt of the
|
|
2597
|
+
* turn whose round it came from (opts.routing). `notice: 'now'` also
|
|
2598
|
+
* queues a private notice naming them, which
|
|
2599
|
+
* the resident hears at its next tool boundary — only when the live stream
|
|
2600
|
+
* presents mid-turn injections. Otherwise the turn-end receipt names them
|
|
2601
|
+
* (or, after a crash, the next turn's catch-up). Drafts the journal cannot
|
|
2602
|
+
* hold are reported in the receipt: their words remain in history only.
|
|
2603
|
+
*/
|
|
2604
|
+
private holdProseDrafts;
|
|
2605
|
+
private static readonly DRAFT_REASON_TEXT;
|
|
2606
|
+
private static readonly DRAFT_REASON_SHORT;
|
|
2607
|
+
private draftsHeldNotice;
|
|
2608
|
+
/** Compact local time for draft listings. */
|
|
2609
|
+
private draftTime;
|
|
2610
|
+
/** A draft's opening words, for the drafts tool's listing only. */
|
|
2611
|
+
private static draftPreview;
|
|
2612
|
+
private static destinationText;
|
|
2613
|
+
/** One line per draft: id, state, when, why, size, preview. */
|
|
2614
|
+
private draftLine;
|
|
2615
|
+
/** A draft's state in words that claim only what is known. */
|
|
2616
|
+
private draftStateText;
|
|
2617
|
+
/** Why an unconfirmed draft may already have been posted, in full. */
|
|
2618
|
+
private riskText;
|
|
2619
|
+
/** Whether an attempt with no outcome is still out: its draft's latest,
|
|
2620
|
+
* while that draft is being sent. Otherwise it never got one (a crash). */
|
|
2621
|
+
private attemptIsOut;
|
|
2622
|
+
/** Why an attempt has no outcome, in a risk's words. */
|
|
2623
|
+
private noOutcomeText;
|
|
2624
|
+
/** A delivered draft's historical receipt. */
|
|
2625
|
+
private draftReceipt;
|
|
2626
|
+
/**
|
|
2627
|
+
* Turn start (or after a crash): name, privately and before the turn's
|
|
2628
|
+
* compile, any open drafts no notice on the current branch names: none
|
|
2629
|
+
* reached the history (a crash, an aborted turn), or a rollback or branch
|
|
2630
|
+
* move took the notices away. Every draft it marks is named by id, newest
|
|
2631
|
+
* first: the newest eight with their state and why each was held, the rest
|
|
2632
|
+
* by id. Like every notice, it quotes none of their words; the drafts tool
|
|
2633
|
+
* shows them. A draft a recent message already names is recorded as
|
|
2634
|
+
* noticed rather than named again: its notice landed after its turn ended,
|
|
2635
|
+
* as a bounce does when a delivery runs after a tool ends an explicit turn.
|
|
2636
|
+
* It reads only the recent history (draftsNamedInHistory), so its notice
|
|
2637
|
+
* claims no more than that. Left out are the open logical turn's own
|
|
2638
|
+
* drafts, which its receipt names and its settlement records
|
|
2639
|
+
* (settleTurnDrafts), and drafts a notice still waiting in the deferred
|
|
2640
|
+
* queue names.
|
|
2641
|
+
*/
|
|
2642
|
+
private noticeUnnoticedDrafts;
|
|
2643
|
+
/**
|
|
2644
|
+
* Logical turn end, after the turn's deferred notices are flushed: record
|
|
2645
|
+
* as noticed exactly the drafts a stored message names (the receipt, a
|
|
2646
|
+
* held-draft notice, a bounce notice), each with the message that names
|
|
2647
|
+
* it. One whose notice never reached the history stays unnoticed, for the
|
|
2648
|
+
* next turn's catch-up. The turn's draft tallies are spent here.
|
|
2649
|
+
*/
|
|
2650
|
+
private settleTurnDrafts;
|
|
2651
|
+
/** Record each named draft as noticed, with the message that names it
|
|
2652
|
+
* (draftsNamedInHistory). */
|
|
2653
|
+
private recordDraftNotices;
|
|
2654
|
+
/** How far back draftsNamedInHistory looks: this turn's notices are near
|
|
2655
|
+
* the end. One beyond it leaves its draft for the next turn's catch-up. */
|
|
2656
|
+
private static readonly DRAFT_NOTICE_SCAN;
|
|
2657
|
+
/** Which of these drafts a stored notice or receipt OF THIS RESIDENT names
|
|
2658
|
+
* (draft ids are unique only per resident, and residents can share one
|
|
2659
|
+
* history), each with the newest message that names it, reading only the
|
|
2660
|
+
* recent history, where this turn's notices are. */
|
|
2661
|
+
private draftsNamedInHistory;
|
|
2662
|
+
/** Page size for drafts(action: "list"). */
|
|
2663
|
+
private static readonly DRAFTS_PAGE;
|
|
2664
|
+
/** Drafts with a delivery attempt in flight, `${agent}\u0000${id}`: a
|
|
2665
|
+
* parallel resend (or `{{unsent}}`) of the same draft is refused. */
|
|
2666
|
+
private draftsInFlight;
|
|
2667
|
+
/** The drafts in draftsInFlight whose attempt is out right now (journaled,
|
|
2668
|
+
* its publish awaited). A dismissal of one is refused, and the resident
|
|
2669
|
+
* told to wait for that result, since a dismissal can't call back words
|
|
2670
|
+
* already on their way. A draft only queued in a resend batch can still
|
|
2671
|
+
* be dismissed: the batch honours that when it reaches the draft. */
|
|
2672
|
+
private draftsSending;
|
|
2673
|
+
/** The drafts tool's answer to a resident's call, from the model's own
|
|
2674
|
+
* dispatch or an agent-origin call through executeToolCall (a puppet's):
|
|
2675
|
+
* a failure the handler throws is answered as one. */
|
|
2676
|
+
private draftsToolResult;
|
|
2677
|
+
/**
|
|
2678
|
+
* The resident's `drafts` tool: list, read, resend and dismiss its own held
|
|
2679
|
+
* drafts. Private to the calling resident. `resend` is an explicit send:
|
|
2680
|
+
* each draft is published verbatim, in order, through the normal publish
|
|
2681
|
+
* executor, its attempt journaled durably before the request leaves.
|
|
2682
|
+
*/
|
|
2683
|
+
private handleDraftsTool;
|
|
2684
|
+
/** Why a draft can't be resent now (dismissed, or possibly already posted
|
|
2685
|
+
* without the resident's confirmation), or undefined when it can. */
|
|
2686
|
+
private resendRefusal;
|
|
2001
2687
|
/** Record a successful plain-prose delivery for this turn's receipt. */
|
|
2002
2688
|
private recordProseDelivery;
|
|
2003
2689
|
/**
|
|
@@ -2079,12 +2765,15 @@ export declare class AgentFramework {
|
|
|
2079
2765
|
*/
|
|
2080
2766
|
private repinTurnLocus;
|
|
2081
2767
|
/**
|
|
2082
|
-
* Durable window notice for a channel the agent did not ask to open
|
|
2083
|
-
* subscription-policy admission,
|
|
2084
|
-
*
|
|
2085
|
-
*
|
|
2086
|
-
*
|
|
2087
|
-
*
|
|
2768
|
+
* Durable window notice for a channel the agent did not ask to open: a
|
|
2769
|
+
* subscription-policy admission, announced as the decision before its
|
|
2770
|
+
* transport RPC (a failed open keeps the decision, and channel_list shows
|
|
2771
|
+
* transport state), or an open that the agent's own delivery or reply
|
|
2772
|
+
* caused (`opened-by-delivery`, `opened-by-reply`), once its transport is
|
|
2773
|
+
* confirmed. Either way it names `channel_close` as the opt-out (their
|
|
2774
|
+
* decision outranks policy). What an open channel delivers is its server's
|
|
2775
|
+
* to say (#406), so the notice doesn't promise its traffic. System message:
|
|
2776
|
+
* never triggers inference, never conversational, never locus-eligible.
|
|
2088
2777
|
*/
|
|
2089
2778
|
private recordChannelAutoOpenNotice;
|
|
2090
2779
|
/**
|
|
@@ -2103,7 +2792,7 @@ export declare class AgentFramework {
|
|
|
2103
2792
|
* Explicit-prose-routing delivery gateway (docs/explicit-prose-routing.md).
|
|
2104
2793
|
* Every prose segment of an `explicit`-mode agent flows through here:
|
|
2105
2794
|
* parse the `>>` prefix, resolve the target, deliver — or bounce to the
|
|
2106
|
-
*
|
|
2795
|
+
* held bounce draft with a resend notice. Misdelivery is structurally impossible:
|
|
2107
2796
|
* nothing is ever sent to a destination the model did not name (directly
|
|
2108
2797
|
* or via the turn's sticky target).
|
|
2109
2798
|
*/
|
|
@@ -2116,6 +2805,27 @@ export declare class AgentFramework {
|
|
|
2116
2805
|
*/
|
|
2117
2806
|
private admitProse;
|
|
2118
2807
|
private deliverAdmittedProse;
|
|
2808
|
+
/**
|
|
2809
|
+
* `{{unsent}}` in an envelope body: the latest bounce draft's words. One
|
|
2810
|
+
* that is out (being sent, or queued in a resend) or unconfirmed (its last
|
|
2811
|
+
* attempt may have been posted) is never substituted — nothing is sent,
|
|
2812
|
+
* and the resident gets the facts and the explicit route (drafts resend
|
|
2813
|
+
* with confirmDuplicate) instead. The envelope's own words are held, as a
|
|
2814
|
+
* bounced envelope's would be (unsentWords): one bounce draft with the
|
|
2815
|
+
* whole text, `{{unsent}}` written out and its risk carried, so nothing
|
|
2816
|
+
* the resident wrote has to be typed again. A bare `{{unsent}}` holds
|
|
2817
|
+
* nothing new: its words already are that draft.
|
|
2818
|
+
*/
|
|
2819
|
+
private takeUnsent;
|
|
2820
|
+
/**
|
|
2821
|
+
* Deliver an envelope that substituted `{{unsent}}`: the substituted
|
|
2822
|
+
* draft's attempt is journaled durably before the request leaves, and its
|
|
2823
|
+
* outcome after, exactly as a drafts resend would.
|
|
2824
|
+
*/
|
|
2825
|
+
private deliverWithUnsent;
|
|
2826
|
+
/** A draft's state as the journal reads it now: after a write that failed
|
|
2827
|
+
* and was reconciled, whatever reached the journal counts. */
|
|
2828
|
+
private draftStateNow;
|
|
2119
2829
|
/**
|
|
2120
2830
|
* Where a delivered round leaves its turn's sticky destination, as the
|
|
2121
2831
|
* explicit gateway sets it once the round's envelopes run: each `>>`
|
|
@@ -2125,9 +2835,35 @@ export declare class AgentFramework {
|
|
|
2125
2835
|
private roundDestination;
|
|
2126
2836
|
/** Locus-preserving explicit publication. Source remains byte-identical in Chronicle. */
|
|
2127
2837
|
private deliverHybridProse;
|
|
2838
|
+
/** `>>skip_reply {{unsent}}` and its hybrid form: set the latest bounce
|
|
2839
|
+
* draft aside — unless it is being sent right now, which a dismissal
|
|
2840
|
+
* can't call back: the resident is told instead. So are a dismissal whose
|
|
2841
|
+
* recording fails (with the state the draft reads as after it, and whether
|
|
2842
|
+
* `{{unsent}}` still names it) and one whose draft may already have been
|
|
2843
|
+
* posted. */
|
|
2844
|
+
private dismissLatestBounce;
|
|
2128
2845
|
private deliverProseEnvelope;
|
|
2129
2846
|
/** Cap on consecutive bounce-triggered wakes (notices still append after). */
|
|
2130
2847
|
private static readonly PROSE_BOUNCE_WAKE_CAP;
|
|
2848
|
+
/**
|
|
2849
|
+
* Words about to be held that may use `{{unsent}}` (a bounce, or an
|
|
2850
|
+
* envelope an explicit send suppressed), under the one re-bounce rule. A
|
|
2851
|
+
* bare `{{unsent}}` is the latest bounce itself, which stays the one draft
|
|
2852
|
+
* of those words rather than being copied. Otherwise the whole authored
|
|
2853
|
+
* text is kept, the token expanded to the latest bounce's words, nothing
|
|
2854
|
+
* stripped or substituted. When that draft may already have been posted
|
|
2855
|
+
* (unconfirmed, or in flight) the words carry its duplication risk: they
|
|
2856
|
+
* can be resent only with confirmDuplicate, like the draft they copy. The
|
|
2857
|
+
* evidence is the risk's own: the copied draft's uncertain attempt, else
|
|
2858
|
+
* the risk that draft itself inherited, else (truly) that it was in flight
|
|
2859
|
+
* when copied.
|
|
2860
|
+
*/
|
|
2861
|
+
private unsentWords;
|
|
2862
|
+
/**
|
|
2863
|
+
* A routing envelope that could not be delivered: its words are held as a
|
|
2864
|
+
* draft (the `{{unsent}}` source) and the resident is told, privately.
|
|
2865
|
+
* `{{unsent}}` in it follows the re-bounce rule (unsentWords).
|
|
2866
|
+
*/
|
|
2131
2867
|
private bounceProse;
|
|
2132
2868
|
/**
|
|
2133
2869
|
* One-time mode primer (docs/explicit-prose-routing.md): when an agent's
|
|
@@ -2149,6 +2885,27 @@ export declare class AgentFramework {
|
|
|
2149
2885
|
* newer turn instead.
|
|
2150
2886
|
*/
|
|
2151
2887
|
private abortDroppedTurn;
|
|
2888
|
+
/**
|
|
2889
|
+
* The stop no stream will carry, collected at a check of the frame whose
|
|
2890
|
+
* window it is (a start's checks before it sends anything, and the checks
|
|
2891
|
+
* at a failure and after a wait to retry): an operator's quiesce abandon of
|
|
2892
|
+
* the turn (the window's mark), else a caller's cancelStream() or
|
|
2893
|
+
* abortInference() made while the agent held no stream, since the start
|
|
2894
|
+
* that dropped an older one at its entry. When both are there, the
|
|
2895
|
+
* framework's own stop is the one that ends the turn, as at a stream's
|
|
2896
|
+
* terminal, and the caller's goes with it.
|
|
2897
|
+
*/
|
|
2898
|
+
private takeStartStop;
|
|
2899
|
+
/**
|
|
2900
|
+
* End a start that a stop reached before it sent anything, through the
|
|
2901
|
+
* terminal the same stop gets on a live stream: a caller's stop as
|
|
2902
|
+
* settleDeliberateCancel ends a cancelled stream, with the note saying the
|
|
2903
|
+
* turn was stopped before it sent anything (or, for a start that continues
|
|
2904
|
+
* a turn, before it finished), and a quiesce abandon as
|
|
2905
|
+
* settleFrameworkCancel ends one. Each settles the turn, an ephemeral run
|
|
2906
|
+
* included, and emits the one inference:aborted.
|
|
2907
|
+
*/
|
|
2908
|
+
private endStoppedStart;
|
|
2152
2909
|
/**
|
|
2153
2910
|
* Body of startAgentStream, split out so the caller's try/finally owns the
|
|
2154
2911
|
* turn token unconditionally. Returns true iff the token was handed off to
|
|
@@ -2166,8 +2923,12 @@ export declare class AgentFramework {
|
|
|
2166
2923
|
* call entered through — a public method shared with model callers can
|
|
2167
2924
|
* never confer module trust, whatever the input claims. Module origin
|
|
2168
2925
|
* exists only through the private closure handed to ModuleRegistry
|
|
2169
|
-
* (ctx.callTool → executeToolCallFrom with {kind:'module'})
|
|
2170
|
-
*
|
|
2926
|
+
* (ctx.callTool → executeToolCallFrom with {kind:'module'}), which is exempt
|
|
2927
|
+
* from agent allowlists. Registered agents' allowedTools is enforced at
|
|
2928
|
+
* dispatch, including namespaced utility names; utils only grants the
|
|
2929
|
+
* list/describe/run slot. Genuinely unidentified public callers (including
|
|
2930
|
+
* unknown legacy names) remain unrestricted. Framework-created identities
|
|
2931
|
+
* are refused while unregistered, even if their configured list allows it.
|
|
2171
2932
|
*/
|
|
2172
2933
|
executeToolCall(call: ToolCall): Promise<ToolResult>;
|
|
2173
2934
|
/**
|
|
@@ -2213,6 +2974,7 @@ export declare class AgentFramework {
|
|
|
2213
2974
|
/** puppetToolCall's work, run where stop() can wait for it. */
|
|
2214
2975
|
private runPuppetToolCall;
|
|
2215
2976
|
private executeToolCallFrom;
|
|
2977
|
+
/** A programmatic call of an MCPL tool: `serverId` and `prefix` as resolveMcplTool matched them. */
|
|
2216
2978
|
private executeMcplToolCall;
|
|
2217
2979
|
/** Event-pushing wrapper for the model-driven dispatch path. */
|
|
2218
2980
|
private dispatchCodeExecutionToolCall;
|
|
@@ -2227,6 +2989,12 @@ export declare class AgentFramework {
|
|
|
2227
2989
|
* results reach the running script and never the model context.
|
|
2228
2990
|
*/
|
|
2229
2991
|
private runCodeExecution;
|
|
2992
|
+
/** Background scripts are the primary agent's, or any agent's when no primary agent is named. */
|
|
2993
|
+
private runsBackgroundScripts;
|
|
2994
|
+
/** How many background scripts an agent may have running at once. */
|
|
2995
|
+
private maxBackgroundScripts;
|
|
2996
|
+
/** How many of this agent's background scripts are running now. */
|
|
2997
|
+
private runningBackgroundScripts;
|
|
2230
2998
|
/**
|
|
2231
2999
|
* Start a background script: dedicated interpreter, output journaled to a
|
|
2232
3000
|
* workspace file, wake_agent() available in-script. The tool result
|
|
@@ -2275,6 +3043,22 @@ export declare class AgentFramework {
|
|
|
2275
3043
|
* live wire copy can reuse the identical strings.
|
|
2276
3044
|
*/
|
|
2277
3045
|
private buildStoredToolResultContent;
|
|
3046
|
+
/**
|
|
3047
|
+
* A tool result's text as its stored copy is written before any cut, and
|
|
3048
|
+
* what its live copy showed beside that text (see cutStoredToolResult). An
|
|
3049
|
+
* error result is its error text. Any other is serialized by
|
|
3050
|
+
* nonErrorResultText, which retains each inline image BEFORE its
|
|
3051
|
+
* placeholder is written (issue #104): the placeholder embeds the ref, so
|
|
3052
|
+
* the image stays reachable by provenance after the bytes leave the wire.
|
|
3053
|
+
*
|
|
3054
|
+
* The live copy is the stored text itself unless the result is a content
|
|
3055
|
+
* array carrying an inline image, which tryNativeToolResultContent sends
|
|
3056
|
+
* as native blocks. It takes the same arrays the serializer takes block by
|
|
3057
|
+
* block, and shows each image and each reference block's stub whole and
|
|
3058
|
+
* each text block up to where it cuts that block at the cap (`maxChars`,
|
|
3059
|
+
* toolResultCutAt), so those are the ranges of the text it showed.
|
|
3060
|
+
*/
|
|
3061
|
+
private storedToolResultText;
|
|
2278
3062
|
/** Where a tool result labelled `label` is written: `<first writable
|
|
2279
3063
|
* mount>/tool-results/<label>.txt`, or null when there is no writable
|
|
2280
3064
|
* workspace. */
|
|
@@ -2303,14 +3087,45 @@ export declare class AgentFramework {
|
|
|
2303
3087
|
private getOrCreateScriptRunner;
|
|
2304
3088
|
/**
|
|
2305
3089
|
* Resolve one script-inner tool call to the string the script's tool
|
|
2306
|
-
* function returns
|
|
2307
|
-
*
|
|
3090
|
+
* function returns, and whether that result is an error (the script's
|
|
3091
|
+
* `.is_error`). Never rejects: a failure without structured content becomes
|
|
3092
|
+
* an "Error: ..." string, matching the managed PTC runtime ("Claude's code
|
|
3093
|
+
* receives this error"), and a structured one its JSON object.
|
|
2308
3094
|
*
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
3095
|
+
* A result without structured content is serialized with the HISTORY
|
|
3096
|
+
* serializer: images become placeholders, since a script variable holding
|
|
3097
|
+
* megabytes of base64 helps nobody. A result with structured content is
|
|
3098
|
+
* one JSON object holding both of the server's views
|
|
3099
|
+
* (scriptStructuredResult), so its content blocks reach the script as the
|
|
3100
|
+
* dispatch gave them, images and payloads included. A module's result that
|
|
3101
|
+
* can't be stored or sent, such as a cyclic object or a BigInt, is already
|
|
3102
|
+
* an error naming the tool when the dispatch returns it (storableToolResult),
|
|
3103
|
+
* so a script reads that error's text.
|
|
2312
3104
|
*/
|
|
2313
3105
|
private handleScriptToolCall;
|
|
3106
|
+
/** The 5MB protocol safety cap on what a script receives. */
|
|
3107
|
+
private static readonly SCRIPT_RESULT_MAX_CHARS;
|
|
3108
|
+
/**
|
|
3109
|
+
* A structured MCP result as a script receives it: one JSON object holding
|
|
3110
|
+
* both of the server's views, `{ content, structuredContent, isError }`,
|
|
3111
|
+
* plus `error` (the text) on a tool error. `content` is the content array
|
|
3112
|
+
* the dispatch gave this call (the direct reading): the server's blocks as
|
|
3113
|
+
* sent, so payloads and images survive, except that an MCPL peer's blocks
|
|
3114
|
+
* get the treatment RFC-005 gives them on every lane the model reads
|
|
3115
|
+
* (referenceBlockForScript). `structuredContent` is the tool's own JSON, as
|
|
3116
|
+
* sent. Past the size cap the result stays valid JSON: the whole object is
|
|
3117
|
+
* saved to the workspace, and the script gets
|
|
3118
|
+
* `{ isError, oversized: { chars, savedTo } }`. If it can't be saved, the
|
|
3119
|
+
* script gets a failure to materialize the result, saying the tool may
|
|
3120
|
+
* already have completed, never a success missing its result. A result
|
|
3121
|
+
* that can't be converted to JSON (a cyclic object, a BigInt), which the
|
|
3122
|
+
* dispatch's own check makes unlikely here, gets the same object empty,
|
|
3123
|
+
* `{ content: [], structuredContent: null, isError: true, error }`, the
|
|
3124
|
+
* error naming the tool. In every form, the script's `.is_error` is the
|
|
3125
|
+
* `isError` of the object its string holds, and its `.structured` is read
|
|
3126
|
+
* from that string.
|
|
3127
|
+
*/
|
|
3128
|
+
private scriptStructuredResult;
|
|
2314
3129
|
/**
|
|
2315
3130
|
* Dispatch a script-inner tool call through the NORMAL dispatch path and
|
|
2316
3131
|
* resolve with its result. The waiter intercept in handleProcessEvent
|
|
@@ -2320,9 +3135,10 @@ export declare class AgentFramework {
|
|
|
2320
3135
|
* RFC-007: with an `origin`, observers see the call as they see a model
|
|
2321
3136
|
* call (register, dispatch with its refusal sites, open; the terminal at
|
|
2322
3137
|
* the waiter intercept), under the inner tool's own name and class.
|
|
3138
|
+
* `turnId` is the turn the call was made in (dispatchToolCall).
|
|
2323
3139
|
*/
|
|
2324
3140
|
private dispatchScriptToolCall;
|
|
2325
|
-
/** Abort
|
|
3141
|
+
/** Abort the agent's script, running or still starting, when the turn it belongs to ends or is reset to run again. */
|
|
2326
3142
|
private abortAgentScript;
|
|
2327
3143
|
private toMembraneToolResult;
|
|
2328
3144
|
/**
|
|
@@ -2330,7 +3146,9 @@ export declare class AgentFramework {
|
|
|
2330
3146
|
* convert to Membrane's native ToolResultContentBlock[]. Returns null when
|
|
2331
3147
|
* the array is text-only (let JSON path handle it; saves a code path).
|
|
2332
3148
|
* `maxChars`, when provided, caps each accompanying text block so an image
|
|
2333
|
-
* inlined alongside an enormous text payload can't blow the context.
|
|
3149
|
+
* inlined alongside an enormous text payload can't blow the context. A
|
|
3150
|
+
* block is cut as the stored copy is (toolResultCutAt), never inside a
|
|
3151
|
+
* slot, so the stored copy can keep exactly the slots this showed (#403).
|
|
2334
3152
|
*/
|
|
2335
3153
|
private tryNativeToolResultContent;
|
|
2336
3154
|
private toolImageLedgerFor;
|
|
@@ -2349,8 +3167,15 @@ export declare class AgentFramework {
|
|
|
2349
3167
|
private resolveToolResultInlineCap;
|
|
2350
3168
|
private approximateDecodedBase64Bytes;
|
|
2351
3169
|
private sanitizeProcessLogValue;
|
|
3170
|
+
/** Writes one inference-log entry. A stream's entries go through its
|
|
3171
|
+
* driveStream's `logStream`, which gives the stream's usage to one entry
|
|
3172
|
+
* only; an end that calls this directly for a stream writes a second
|
|
3173
|
+
* entry for it, and its usage can be counted twice in the log. */
|
|
2352
3174
|
private logInference;
|
|
2353
3175
|
private logProcessEvent;
|
|
3176
|
+
/** Count one server's close (see mcplServerCloses). Partially-constructed
|
|
3177
|
+
* frameworks (tests build them with Object.create) have no map yet. */
|
|
3178
|
+
private noteMcplServerClosed;
|
|
2354
3179
|
/** Forget one server's RFC-008 class declarations (see the close handler). */
|
|
2355
3180
|
private dropMcplToolClasses;
|
|
2356
3181
|
/**
|
|
@@ -2386,21 +3211,283 @@ export declare class AgentFramework {
|
|
|
2386
3211
|
}>;
|
|
2387
3212
|
/**
|
|
2388
3213
|
* Find the MCPL server for a tool: [serverId, prefix], or null.
|
|
2389
|
-
*
|
|
2390
|
-
*
|
|
2391
|
-
*
|
|
2392
|
-
*
|
|
3214
|
+
* The tool listing decides: the server whose tools/list offered the
|
|
3215
|
+
* name, after its tool policy, as of the last tool refresh (a server that
|
|
3216
|
+
* closed since keeps its names until the next one). A name the listing
|
|
3217
|
+
* doesn't hold (invented by the model, or no longer listed) goes to the
|
|
3218
|
+
* longest matching prefix. Prefixes that meet, such as `foo` and
|
|
3219
|
+
* `foo--bar`, are refused at configuration (prefixesMeet, #265), so a name
|
|
3220
|
+
* fits at most one configured server's prefix; this rule doesn't rely on
|
|
3221
|
+
* that. Never prefix-map insertion order.
|
|
2393
3222
|
*/
|
|
2394
3223
|
private resolveMcplTool;
|
|
3224
|
+
/** Registered policy; framework-created identities have no dispatch authority
|
|
3225
|
+
* while unregistered. Genuine legacy caller names retain their surface. */
|
|
3226
|
+
private canAgentUseTool;
|
|
3227
|
+
private agentToolPermissionFailure;
|
|
3228
|
+
/**
|
|
3229
|
+
* Why this host refuses a skip_reply call, as the model will read it, or
|
|
3230
|
+
* undefined when it doesn't (skipReplyWakeRefusal): without an EventGate,
|
|
3231
|
+
* any wake_in_seconds; with one, a wake_in_seconds that isn't a number of
|
|
3232
|
+
* seconds. Only when the channel registry handles skip_reply. The dispatch
|
|
3233
|
+
* that refuses the call reads it here, and so does the turn's bookkeeping of
|
|
3234
|
+
* a refused round, for the model's own calls: the silence before it, which
|
|
3235
|
+
* comes back after its round, and in XML mode which round's prose stays
|
|
3236
|
+
* private. A skip_reply round's own prose stays private by the tool's name,
|
|
3237
|
+
* refused or not.
|
|
3238
|
+
*/
|
|
3239
|
+
private skipReplyRefusal;
|
|
3240
|
+
private refusesSelfWake;
|
|
3241
|
+
/**
|
|
3242
|
+
* Dispatch a call the agent made. `turnId` is the turn it was made in
|
|
3243
|
+
* (TurnRouting.turnId), as its caller knows it: a model's call, the turn
|
|
3244
|
+
* whose stream made it; a foreground script's inner call, the turn of the
|
|
3245
|
+
* code_execution call whose script is running when the call arrives. A
|
|
3246
|
+
* background script's call has none.
|
|
3247
|
+
*/
|
|
2395
3248
|
private dispatchToolCall;
|
|
2396
3249
|
private dispatchToolCallEvent;
|
|
2397
3250
|
private addMessage;
|
|
3251
|
+
/** Where addMessage delivers: the named agent, else the primary, else the
|
|
3252
|
+
* first registered agent. Undefined when there is no such agent. */
|
|
3253
|
+
private deliveryAgent;
|
|
3254
|
+
/** The notes addMessage takes for a message it stored: an arrival for the
|
|
3255
|
+
* agent when none of its turns is alive or the message was assembled for
|
|
3256
|
+
* the start now beginning (no tool boundary will weigh it), and one for
|
|
3257
|
+
* every other resident's open turn. */
|
|
3258
|
+
private noteStored;
|
|
2398
3259
|
/**
|
|
2399
3260
|
* Splice out the deferred messages addressed to `agentName` (explicitly
|
|
2400
3261
|
* via forAgent, or implicitly when it is the primary), leaving other
|
|
2401
|
-
* targets' messages queued for their own boundaries.
|
|
3262
|
+
* targets' messages queued for their own boundaries. With `stopAt`, the
|
|
3263
|
+
* drain ends at the first of them (in queue order) that it matches: that
|
|
3264
|
+
* message and every later one stay queued, so what is drained is always a
|
|
3265
|
+
* prefix of the agent's queue.
|
|
2402
3266
|
*/
|
|
2403
3267
|
private drainDeferredFor;
|
|
3268
|
+
/**
|
|
3269
|
+
* Put drained entries back into the queue under their ids and seq: out of
|
|
3270
|
+
* the un-acked set, and persisted when the queue is. A memory-only queue
|
|
3271
|
+
* keeps them while the framework runs.
|
|
3272
|
+
*/
|
|
3273
|
+
private requeueDrained;
|
|
3274
|
+
/**
|
|
3275
|
+
* Write drained entries in queue (seq) order, whatever their targets:
|
|
3276
|
+
* residents share one message slot, so the order entries arrived in is the
|
|
3277
|
+
* order they're stored. Each target is cut at its own first entry that
|
|
3278
|
+
* can't be stored: that entry and every later one for the same target go
|
|
3279
|
+
* back into the queue under their ids and seq (requeueDrained) before
|
|
3280
|
+
* anything is logged, and other targets' entries go on. Left in the
|
|
3281
|
+
* un-acked set, the next ack would drop them from the durable queue.
|
|
3282
|
+
*
|
|
3283
|
+
* So none of a target's entries lands ahead of an earlier one, and a queued
|
|
3284
|
+
* tool_use that can't be stored keeps the tool_result queued behind it from
|
|
3285
|
+
* being stored alone. (A tool_use that is stored, followed by a tool_result
|
|
3286
|
+
* that can't be, stays stored without it until the tool_result lands at a
|
|
3287
|
+
* later flush. The only queued pair is puppetToolCall's defensive one,
|
|
3288
|
+
* which no path reaches today.) An entry that keeps failing is logged by
|
|
3289
|
+
* id at each flush, and holds its target's later queued writes rather than
|
|
3290
|
+
* letting them land out of order.
|
|
3291
|
+
*
|
|
3292
|
+
* The hold is the queue's alone. A write that isn't deferred is stored at
|
|
3293
|
+
* once and can land ahead of a held entry: a fresh tool_result, whatever
|
|
3294
|
+
* its agent's state, and any write while its agent's turn, stream and tool
|
|
3295
|
+
* cycle are all idle and the host isn't quiesced. So an entry that keeps
|
|
3296
|
+
* failing holds only what is deferred behind it.
|
|
3297
|
+
*
|
|
3298
|
+
* A write can throw after its message is stored: a store listener, the
|
|
3299
|
+
* strategy's handling of the add, or a later shard of a sharded body can
|
|
3300
|
+
* throw once a record is written. Before an entry that threw is put back,
|
|
3301
|
+
* its target's store is read from where it stood before the write, for
|
|
3302
|
+
* messages carrying the entry's `deferredWriteId`. What it finds counts as
|
|
3303
|
+
* written, at most once: the entry isn't requeued and stored a second
|
|
3304
|
+
* time, and what landed, as later compiles render it (asCompiled), is what
|
|
3305
|
+
* it returns as the entry's content. For a sharded body, that can be its
|
|
3306
|
+
* first shards alone, since the append loop stops at the throw; the rest
|
|
3307
|
+
* of the body isn't stored. (Requeued, the
|
|
3308
|
+
* landed shards would be stored twice, and only the rest could not be
|
|
3309
|
+
* appended later without splitting the body.) Boot's scan for landed
|
|
3310
|
+
* writes counts a landed shard the same way. When the store can't be read
|
|
3311
|
+
* back (storedCopiesOf logs it), nothing is found, and the entry is put
|
|
3312
|
+
* back as one that couldn't be stored: if it had landed, a later flush
|
|
3313
|
+
* stores it again.
|
|
3314
|
+
*
|
|
3315
|
+
* Returns what was written (stored, or deferred again by addMessage, whose
|
|
3316
|
+
* id is then empty), in queue order: for one target, a prefix of its
|
|
3317
|
+
* entries. Each comes with its content: as given, unless the store took it
|
|
3318
|
+
* as more than one message (a sharded body) and can be read back, when its
|
|
3319
|
+
* copies are returned joined, as later compiles render them (asCompiled),
|
|
3320
|
+
* or its write threw after storing it (above). `onLanded` hears an entry
|
|
3321
|
+
* whose write threw after storing it, with the id it landed under, as soon
|
|
3322
|
+
* as it's found: before the writes after it, so whatever it records keeps
|
|
3323
|
+
* their order.
|
|
3324
|
+
*/
|
|
3325
|
+
private writeDrainedInOrder;
|
|
3326
|
+
/** How many messages the agent's store holds: undefined when its store
|
|
3327
|
+
* can't say. */
|
|
3328
|
+
private storedCountOf;
|
|
3329
|
+
/** The messages carrying `deferredWriteId` among those the agent's store
|
|
3330
|
+
* gained from position `from` on, in store order, with their blobs
|
|
3331
|
+
* resolved, as a request carries them. A sharded body's carry its
|
|
3332
|
+
* `bodyGroupId`. */
|
|
3333
|
+
private storedCopiesOf;
|
|
3334
|
+
/** The line naming a drained write that threw: one that couldn't be stored,
|
|
3335
|
+
* which is already back in the queue, or, with `landed`, one stored before
|
|
3336
|
+
* the throw (for a sharded body, how many of its shards). Logging mustn't
|
|
3337
|
+
* fail the flush that met it, so a thrown value that has no text is named
|
|
3338
|
+
* as such. */
|
|
3339
|
+
private logDeferredWriteError;
|
|
3340
|
+
/** Re-add drained entries through addMessage, which stores each or defers
|
|
3341
|
+
* it again, in queue order and cut per target (writeDrainedInOrder). With
|
|
3342
|
+
* `bypassDeferral`, each is stored past its target's deferral (stop()). A
|
|
3343
|
+
* write that threw after storing missed the notes addMessage takes after a
|
|
3344
|
+
* store, so they're taken for what landed as soon as it's found, before
|
|
3345
|
+
* the writes after it: an open turn's arrivals keep the order the writes
|
|
3346
|
+
* landed in, and its newest stays the newest (remainingArrival). */
|
|
3347
|
+
private readdDrained;
|
|
3348
|
+
/**
|
|
3349
|
+
* Where a notice about an agent's own action belongs: its failed reply, its
|
|
3350
|
+
* bounced prose (beside its `{{unsent}}` clipboard), its background script's
|
|
3351
|
+
* wake, the notices about its drafts. Every registered agent's notice is
|
|
3352
|
+
* addressed to that agent, so it lands in the window that agent reads and
|
|
3353
|
+
* waits on that agent's own turn, stream and tool cycle: a conversation
|
|
3354
|
+
* fork or an ephemeral run reads only its isolated slot, and a resident's
|
|
3355
|
+
* notice would otherwise wait on the primary's turn rather than its own.
|
|
3356
|
+
* Residents share one message slot, so a resident's notice can land there
|
|
3357
|
+
* while another resident's turn is alive; agent-framework #291 covers that.
|
|
3358
|
+
*
|
|
3359
|
+
* null when the agent is no longer registered (a fork or a run already
|
|
3360
|
+
* released): there is no window to write, so the caller writes nothing,
|
|
3361
|
+
* traces nothing and requests no wake. The drop is logged here, once. A
|
|
3362
|
+
* failed reply is passed on by name instead (passFailedReplyToPrimary). The
|
|
3363
|
+
* notice of a channel an agent's own send opened follows the same rule in
|
|
3364
|
+
* recordChannelAutoOpenNotice, which passes it on by name too.
|
|
3365
|
+
*/
|
|
3366
|
+
private noticeTargetFor;
|
|
3367
|
+
/**
|
|
3368
|
+
* A conversation fork or an ephemeral run has been deregistered. A release
|
|
3369
|
+
* never runs while the host is quiesced: it waits for resume()
|
|
3370
|
+
* (releaseWindowNowOrAfterResume), since a write could land mid-surgery.
|
|
3371
|
+
*
|
|
3372
|
+
* The agent never reads its window again, so every failed-reply notice it
|
|
3373
|
+
* never read is passed to the primary, by name, once: each one stored in
|
|
3374
|
+
* its window above its consumed watermark (flushed there at its turn's end,
|
|
3375
|
+
* or stored while it was idle) and not heard at a tool boundary, and each
|
|
3376
|
+
* one still queued for it. Writes still
|
|
3377
|
+
* queued would wait for a boundary it never reaches, and the flush that
|
|
3378
|
+
* finds it gone would drop them, so they land in its own window now, which
|
|
3379
|
+
* Chronicle keeps for investigation. Its stream is over or cancelled, so it
|
|
3380
|
+
* compiles nothing more. One path still stores after these writes: a
|
|
3381
|
+
* `complete` that arrived while the agent still waited for tools awaits
|
|
3382
|
+
* the spill of its last tool results, and stores them once that resolves,
|
|
3383
|
+
* even if a watchdog has ended the run meanwhile. A tool boundary stores
|
|
3384
|
+
* nothing for a round whose turn was stopped while its results were
|
|
3385
|
+
* prepared.
|
|
3386
|
+
*/
|
|
3387
|
+
private releaseWindow;
|
|
3388
|
+
/**
|
|
3389
|
+
* The failed-reply notices stored in `agent`'s window that it never read:
|
|
3390
|
+
* those above the lower of its consumed watermark and the point where the
|
|
3391
|
+
* watermark's branch and the current one part (branchesPartAt), or every
|
|
3392
|
+
* one, when it never compiled. The watermark moves at a compile, and at a
|
|
3393
|
+
* tool boundary whose
|
|
3394
|
+
* stream declares it carries the messages injected there
|
|
3395
|
+
* (markContextConsumed), so a notice the live stream heard is under it, and
|
|
3396
|
+
* one a boundary stored without sending (a turn a tool ended, a budget
|
|
3397
|
+
* restart, a stream that may drop injections) is above it.
|
|
3398
|
+
*/
|
|
3399
|
+
private unreadFailedReplies;
|
|
3400
|
+
/**
|
|
3401
|
+
* The last sequence two branches' histories share: Infinity for one branch,
|
|
3402
|
+
* and for two, the point where they part. A branch's records are numbered
|
|
3403
|
+
* on from its branch point (Chronicle gives each record its branch's head
|
|
3404
|
+
* plus one), so up to that point both hold the same records under the same
|
|
3405
|
+
* numbers, and past it each branch's numbers are its own. -Infinity when
|
|
3406
|
+
* the store knows no shared history for them, as for an empty branch.
|
|
3407
|
+
*/
|
|
3408
|
+
private branchesPartAt;
|
|
3409
|
+
/**
|
|
3410
|
+
* Release a deregistered fork's or run's window (releaseWindow) now, or,
|
|
3411
|
+
* while the host is quiesced, when it resumes. A release lands the agent's
|
|
3412
|
+
* queued writes in its window, and while quiesced a write could land
|
|
3413
|
+
* mid-surgery; dropping them instead would lose them from both the window
|
|
3414
|
+
* and the recovery queue. Only the window waits: the agent is already
|
|
3415
|
+
* deregistered, so its stream can't dispatch anything more and resume
|
|
3416
|
+
* doesn't weigh its context, and a write addressed to it meanwhile is
|
|
3417
|
+
* treated as for any agent no longer registered (dropped, or passed to the
|
|
3418
|
+
* primary if it's a failed reply).
|
|
3419
|
+
*/
|
|
3420
|
+
private releaseWindowNowOrAfterResume;
|
|
3421
|
+
/** resume(): the windows whose release the quiesce window postponed, each on its own. */
|
|
3422
|
+
private runReleasesAfterResume;
|
|
3423
|
+
/**
|
|
3424
|
+
* A fork or an ephemeral run ended before reading that its reply's delivery
|
|
3425
|
+
* to a channel failed: it was released with the notice stored in its window
|
|
3426
|
+
* unread, or its delivery failed after release. (A notice still queued for
|
|
3427
|
+
* it, at release or restored at boot, goes on as the queue entry itself:
|
|
3428
|
+
* queuedFailedReplyForPrimary.) Tell the primary instead, naming the
|
|
3429
|
+
* speaker, so an agent who can still act learns of it and can tell the
|
|
3430
|
+
* human. It gives the reply's length, not its words, which stay in the
|
|
3431
|
+
* speaker's window. Its wording follows the speaker's own notice
|
|
3432
|
+
* (onRouteFailure): a delivery that wasn't confirmed may have been posted,
|
|
3433
|
+
* and neither text says no one saw the reply, since only this channel's
|
|
3434
|
+
* routing failed. Only for a delivery to a channel; a reply that had no
|
|
3435
|
+
* channel to go to (no locus) had no human waiting for it. Never throws:
|
|
3436
|
+
* it runs inside a release, which must complete whatever this write meets.
|
|
3437
|
+
*/
|
|
3438
|
+
private passFailedReplyToPrimary;
|
|
3439
|
+
/**
|
|
3440
|
+
* A queued failed-reply entry for `speaker`, who is gone, as the primary's
|
|
3441
|
+
* by-name notice (passFailedReplyToPrimary's words): the same entry, under
|
|
3442
|
+
* its own id and seq, now addressed to the primary. Written through the
|
|
3443
|
+
* drain, it lands stamped with that id, or waits in the queue under it, so
|
|
3444
|
+
* boot's exactly-once holds for it: a crash before the original's ack
|
|
3445
|
+
* replays one entry, never the original and a separate notice. null when no
|
|
3446
|
+
* one is told (logged): a reply that had no channel to reach, or no primary.
|
|
3447
|
+
*/
|
|
3448
|
+
private queuedFailedReplyForPrimary;
|
|
3449
|
+
/** The primary's by-name notice of `speaker`'s failed reply, or null when no
|
|
3450
|
+
* one is told, which is logged here (see passFailedReplyToPrimary). */
|
|
3451
|
+
private failedReplyNoticeForPrimary;
|
|
3452
|
+
/**
|
|
3453
|
+
* A channel as a notice names it: the label when the registry has one, since
|
|
3454
|
+
* a bare snowflake is unresolvable for the agent (the 2026-07-21 incident
|
|
3455
|
+
* read as "a stale artifact", not a live failure).
|
|
3456
|
+
*/
|
|
3457
|
+
private channelForNotice;
|
|
3458
|
+
/**
|
|
3459
|
+
* A module's write through its context: addMessage's, except that a write
|
|
3460
|
+
* the framework holds is answered by its handle (heldHandle) rather than
|
|
3461
|
+
* '', so the module can find, read, edit and remove what it wrote before
|
|
3462
|
+
* the write lands. The framework's own callers keep the '' they've always
|
|
3463
|
+
* had, which their traces and checks take as a write not stored yet.
|
|
3464
|
+
*/
|
|
3465
|
+
private addModuleMessage;
|
|
3466
|
+
/**
|
|
3467
|
+
* The writes the framework holds for the store `reader` reads, in queue
|
|
3468
|
+
* order: those addressed to it and, when it's an ordinary resident, those
|
|
3469
|
+
* addressed to any ordinary resident, since residents share one message
|
|
3470
|
+
* slot (sharedSlotAgents). A write whose target is gone isn't among them:
|
|
3471
|
+
* no module reads that agent's store, and the write waits for its window's
|
|
3472
|
+
* release (drainDeferredFor) or, at its flush, is dropped (addMessage), a
|
|
3473
|
+
* failed reply passing to the primary as its notice
|
|
3474
|
+
* (queuedFailedReplyForPrimary).
|
|
3475
|
+
*/
|
|
3476
|
+
private heldWritesFor;
|
|
3477
|
+
/**
|
|
3478
|
+
* The writes held for `reader`'s store (heldWritesFor) as the rows a
|
|
3479
|
+
* module's context reads: each under its handle, marked `held`, with the
|
|
3480
|
+
* participant, content and metadata it was written with, the time it was
|
|
3481
|
+
* first held as its timestamp, and a sequence after every row the store
|
|
3482
|
+
* holds, in queue order. The sequence and timestamp are provisional: the
|
|
3483
|
+
* stored row has the store's own.
|
|
3484
|
+
*/
|
|
3485
|
+
private heldRows;
|
|
3486
|
+
/** The row a held write landed as, found by the id it's stored with
|
|
3487
|
+
* (`metadata.deferredWriteId`): the first, for a body stored in shards,
|
|
3488
|
+
* as addMessage answers a stored write. Null when it hasn't landed, or is
|
|
3489
|
+
* no longer in the store. */
|
|
3490
|
+
private landedRow;
|
|
2404
3491
|
private editMessage;
|
|
2405
3492
|
private removeMessage;
|
|
2406
3493
|
private getMessage;
|
|
@@ -2509,7 +3596,7 @@ export declare class AgentFramework {
|
|
|
2509
3596
|
* push event to wake the agent onto the same context.
|
|
2510
3597
|
*
|
|
2511
3598
|
* Bounded: at most `refusalHandling.maxRewinds` (default 3, hard cap 10)
|
|
2512
|
-
* sheds per failure episode; the budget resets
|
|
3599
|
+
* sheds per failure episode; the budget resets when a turn completes.
|
|
2513
3600
|
* At the cap (or with nothing left to shed) it stops — the agent stays up
|
|
2514
3601
|
* and hard-down logging continues, but no further history is consumed.
|
|
2515
3602
|
*/
|
|
@@ -2519,6 +3606,44 @@ export declare class AgentFramework {
|
|
|
2519
3606
|
* Fail-open: individual server connection failures don't prevent framework startup.
|
|
2520
3607
|
*/
|
|
2521
3608
|
private initializeMcpl;
|
|
3609
|
+
/** The modern connections, created on first use, so a framework assembled
|
|
3610
|
+
* field by field (as unit tests do) needs no setup for them. */
|
|
3611
|
+
private modernServers;
|
|
3612
|
+
/** The restarts' claims (mcpRestartClaims), created on first use, as the
|
|
3613
|
+
* modern connections are. */
|
|
3614
|
+
private restartClaims;
|
|
3615
|
+
private legacyConnectAborts;
|
|
3616
|
+
/**
|
|
3617
|
+
* Hold a server id for one connect or disconnect, until `release()`.
|
|
3618
|
+
* Together with the live connections (the MCPL registry and the modern
|
|
3619
|
+
* map) this is what holds an id: from a connect's admission until its
|
|
3620
|
+
* teardown is done, one owner at a time. So a connect is refused while
|
|
3621
|
+
* anything holds its id, and a teardown never removes what a later
|
|
3622
|
+
* connection registered. A disconnect takes the hold over, and waits for
|
|
3623
|
+
* the operation it displaced (`previous`); a connect that finds itself
|
|
3624
|
+
* `displaced` ends rather than setting up a server being removed. Each
|
|
3625
|
+
* release frees only its own hold.
|
|
3626
|
+
*/
|
|
3627
|
+
private holdMcpServerId;
|
|
3628
|
+
/** Whether a server's connection still serves it, or is reconnecting to
|
|
3629
|
+
* it. One the host is closing or has closed doesn't, and neither does one
|
|
3630
|
+
* lost for good, whose reconnecting has stopped. */
|
|
3631
|
+
private static mcpConnectionServes;
|
|
3632
|
+
/**
|
|
3633
|
+
* A connect whose failed launch couldn't be confirmed exited. Its
|
|
3634
|
+
* connection stays registered, closed, and holds the id, so nothing
|
|
3635
|
+
* launches beside a child that may still be running; a disconnect retries
|
|
3636
|
+
* the reap, and completes once the exit is confirmed. Once stop() has
|
|
3637
|
+
* begun it refuses a disconnect, and retries the reap itself, so no
|
|
3638
|
+
* disconnect is offered then.
|
|
3639
|
+
*/
|
|
3640
|
+
private unreapedConnectFailure;
|
|
3641
|
+
/** Close every modern-MCP connection, including any connect still in
|
|
3642
|
+
* flight, so none outlives a failed startup or stop(). One whose close
|
|
3643
|
+
* fails or is still pending stays registered, holding its id, as a failed
|
|
3644
|
+
* connect's does, and every failure is thrown, as the MCPL registry's
|
|
3645
|
+
* closeAll does. `timeoutMs` bounds the wait without cancelling cleanup. */
|
|
3646
|
+
private closeModernMcpConnections;
|
|
2522
3647
|
/**
|
|
2523
3648
|
* Reconcile the durable ledger with Chronicle, then deliver every server's
|
|
2524
3649
|
* work. A drain still running is waited for and then followed by a fresh
|
|
@@ -2537,6 +3662,10 @@ export declare class AgentFramework {
|
|
|
2537
3662
|
* Deliver every due ref independently. Permanent Discord failures are kept
|
|
2538
3663
|
* in the ledger for audit but do not block later operations; retryable
|
|
2539
3664
|
* failures remain pending for the next reconnect/list-change attempt.
|
|
3665
|
+
* Once stop() has begun, a drain sends nothing more and records nothing
|
|
3666
|
+
* for what it hasn't sent: that stays pending, as it was, for the next
|
|
3667
|
+
* start's barrier. stop() closes the connections and then waits for each
|
|
3668
|
+
* drain still running to record the call it had in flight.
|
|
2540
3669
|
*/
|
|
2541
3670
|
private drainDiscordAwarenessOutbox;
|
|
2542
3671
|
private readDiscordAwarenessPending;
|
|
@@ -2552,7 +3681,9 @@ export declare class AgentFramework {
|
|
|
2552
3681
|
* its last read of the ledger, missing a batch activated since. So a
|
|
2553
3682
|
* generation that finds a drain running waits for it, then drains again
|
|
2554
3683
|
* with a fresh pass that reads the ledger anew. Two generations waiting on
|
|
2555
|
-
* the same drain share the fresh pass that follows it.
|
|
3684
|
+
* the same drain share the fresh pass that follows it. Once stop() has
|
|
3685
|
+
* begun, a drain sends nothing more, so a gate armed then completes with
|
|
3686
|
+
* what it found pending left for the next start.
|
|
2556
3687
|
*/
|
|
2557
3688
|
private drainForGeneration;
|
|
2558
3689
|
/**
|
|
@@ -2563,10 +3694,57 @@ export declare class AgentFramework {
|
|
|
2563
3694
|
* meanwhile. Rejects as the generation it waited for rejects.
|
|
2564
3695
|
*/
|
|
2565
3696
|
private awaitDiscordAwarenessBarriers;
|
|
3697
|
+
/**
|
|
3698
|
+
* Per connection, the transport epoch whose §5.3 policy exchange is in
|
|
3699
|
+
* flight: a connect's, from when the registry hands the connection back,
|
|
3700
|
+
* or a reconnect's, from its 'reconnect' event. Until the exchange settles,
|
|
3701
|
+
* that transport's traffic must wait for its grant, so a gate that opens
|
|
3702
|
+
* every connection's planes meanwhile (another server's list change, a
|
|
3703
|
+
* resume, an awareness sync, startup's staged open) passes it by
|
|
3704
|
+
* (mcplPlanesMayOpen), and the exchange's own caller opens them once it
|
|
3705
|
+
* settles (openMcplPlanesAfterExchange).
|
|
3706
|
+
*/
|
|
3707
|
+
private readonly mcplPolicyExchanges;
|
|
3708
|
+
/** Whether a gate may open this connection's planes: no policy exchange is
|
|
3709
|
+
* in flight on its current transport (see mcplPolicyExchanges). */
|
|
3710
|
+
private mcplPlanesMayOpen;
|
|
3711
|
+
/**
|
|
3712
|
+
* Run a connection's §5.3 policy exchange with its planes held: it is
|
|
3713
|
+
* marked in flight for the transport it runs on, so no gate releases that
|
|
3714
|
+
* transport's traffic before its grant exists. With `epoch`, it runs only
|
|
3715
|
+
* on that transport: a runtime connect passes the one it registered, and
|
|
3716
|
+
* if that transport is gone, the exchange isn't run, since a reconnect
|
|
3717
|
+
* that adopts a next transport, if one comes, runs that one's. With
|
|
3718
|
+
* `closeOnFailure`, as for a runtime connect or restart, an exchange that
|
|
3719
|
+
* throws closes the connection for good, through the registry, before it
|
|
3720
|
+
* lifts the marker: left live, the connection would be half registered,
|
|
3721
|
+
* and unmarked before its close, a gate completing in between would let
|
|
3722
|
+
* out what it held with no grant. A close that fails keeps the connection
|
|
3723
|
+
* registered, but closed for good, it readies nothing but its own reports.
|
|
3724
|
+
* Without `closeOnFailure`, as for a reconnect or a staged startup connect,
|
|
3725
|
+
* an exchange that throws leaves the connection live with the grant it
|
|
3726
|
+
* reached, empty if the policy step itself threw, and the marker lifts.
|
|
3727
|
+
*/
|
|
3728
|
+
private settlePolicyExchange;
|
|
3729
|
+
/**
|
|
3730
|
+
* Open a connection's planes once its exchange has settled, when the gate
|
|
3731
|
+
* its connect or reconnect installed was replaced during the exchange: the
|
|
3732
|
+
* newer gate passed the connection by, and if it has completed, nothing
|
|
3733
|
+
* else would open it. A connection whose transport dropped meanwhile is
|
|
3734
|
+
* readied as any gate readies one between transports, so its own reports
|
|
3735
|
+
* go on. How far follows what is held now: while a gate is up, only the
|
|
3736
|
+
* control plane opens, since a gate holds data planes alone, and its
|
|
3737
|
+
* completion, which no longer passes this connection by, opens the data
|
|
3738
|
+
* plane; a quiesced host (issue #122) likewise opens only control planes;
|
|
3739
|
+
* otherwise both open.
|
|
3740
|
+
*/
|
|
3741
|
+
private openMcplPlanesAfterExchange;
|
|
2566
3742
|
/**
|
|
2567
3743
|
* Install one framework-global Discord-awareness generation before releasing
|
|
2568
3744
|
* any inference-bearing event. With pending work or a drain still running,
|
|
2569
|
-
* every MCPL data plane is paused while
|
|
3745
|
+
* every MCPL data plane is paused while the control planes remain live,
|
|
3746
|
+
* but for a connection whose policy exchange is in flight, which neither
|
|
3747
|
+
* the release nor the completion opens (mcplPlanesMayOpen).
|
|
2570
3748
|
* With neither, ready() runs synchronously so request responders preserve
|
|
2571
3749
|
* their historical same-stack behavior.
|
|
2572
3750
|
*/
|
|
@@ -2574,6 +3752,21 @@ export declare class AgentFramework {
|
|
|
2574
3752
|
private releaseMcplDataPlaneGate;
|
|
2575
3753
|
private completeMcplDataPlaneGate;
|
|
2576
3754
|
private failMcplDataPlaneGate;
|
|
3755
|
+
/**
|
|
3756
|
+
* Close a legacy connection for good through the registry. A close that
|
|
3757
|
+
* can't confirm its child exited keeps the connection registered, holding
|
|
3758
|
+
* its id, and emits no 'close', so no close listener takes its tools off
|
|
3759
|
+
* the agents' list: this does, then rethrows the failure for the caller to
|
|
3760
|
+
* report. A server the host has given up on leaves the list either way.
|
|
3761
|
+
*/
|
|
3762
|
+
private closeMcplServerForGood;
|
|
3763
|
+
/**
|
|
3764
|
+
* Close a runtime connect's new connection for good, through the registry,
|
|
3765
|
+
* after a step of that connect failed. A close that fails keeps the entry,
|
|
3766
|
+
* so a later disconnect, restart or shutdown can close it again, and is
|
|
3767
|
+
* logged here rather than replacing the failure the connect reports.
|
|
3768
|
+
*/
|
|
3769
|
+
private closeFailedRuntimeConnect;
|
|
2577
3770
|
/**
|
|
2578
3771
|
* Connect a single MCPL server: register routing entries, open the
|
|
2579
3772
|
* connection, wire events, and initialize feature sets / scopes /
|
|
@@ -2581,11 +3774,23 @@ export declare class AgentFramework {
|
|
|
2581
3774
|
* lifecycle API (connectMcplServer). Throws on connection failure.
|
|
2582
3775
|
*/
|
|
2583
3776
|
private connectMcplServerInternal;
|
|
2584
|
-
/**
|
|
2585
|
-
*
|
|
2586
|
-
*
|
|
2587
|
-
*
|
|
2588
|
-
|
|
3777
|
+
/** The part of a connect that runs holding its id, handing back the
|
|
3778
|
+
* connection it registered. `displaced`: whether a disconnect has taken
|
|
3779
|
+
* the id over and is waiting for this connect, which a legacy connect asks
|
|
3780
|
+
* once its handshake is done. */
|
|
3781
|
+
private connectHeldMcplServer;
|
|
3782
|
+
/** Per-connection §17.8 fetch limiter, keyed by the connection, so one
|
|
3783
|
+
* that replaces a removed server under its id starts its own: at most one
|
|
3784
|
+
* fetch in flight; announcements during it coalesce into one refresh run
|
|
3785
|
+
* after it, and announcements within the floor after a fetch into one run
|
|
3786
|
+
* once the floor has passed — the host bounds the rate; it never depends
|
|
3787
|
+
* on server coalescing. A queued refresh runs only on the transport of
|
|
3788
|
+
* the latest announcement it holds (`queuedEpoch`), and its receipt
|
|
3789
|
+
* reports the domains of the announcements coalesced into it there
|
|
3790
|
+
* (`queuedDomains`), since its fetch answers them all. The next
|
|
3791
|
+
* transport's initialize and policy exchange start afresh, and its own
|
|
3792
|
+
* announcements queue their own, so an earlier transport's hints are
|
|
3793
|
+
* dropped. */
|
|
2589
3794
|
private manifestRefreshState;
|
|
2590
3795
|
private static readonly MANIFEST_FETCH_FLOOR_MS;
|
|
2591
3796
|
/**
|
|
@@ -2602,6 +3807,14 @@ export declare class AgentFramework {
|
|
|
2602
3807
|
* tell→receipt→activate), emit ONE change receipt (§17.6).
|
|
2603
3808
|
*/
|
|
2604
3809
|
private handleManifestChanged;
|
|
3810
|
+
/** A refresh handleManifestChanged schedules for itself, after the fetch
|
|
3811
|
+
* floor or behind a fetch in flight. Its announcement is the domains of
|
|
3812
|
+
* the announcements it coalesced (`{ domains }`), the one field
|
|
3813
|
+
* handleManifestChanged reads of one. It's contained as the announcement's
|
|
3814
|
+
* own run is. Its fetch's own failure is logged by the fetch's catch, as
|
|
3815
|
+
* in 0.22.x; any other failure emits mcpl:request-handler-error and a
|
|
3816
|
+
* stderr line through the containment. */
|
|
3817
|
+
private rerunManifestRefresh;
|
|
2605
3818
|
/**
|
|
2606
3819
|
* (Re-)establish a server's host-side MCPL registration: feature-set state
|
|
2607
3820
|
* (plus the featureSets/update sent to the server), scope patterns, and
|
|
@@ -2659,16 +3872,30 @@ export declare class AgentFramework {
|
|
|
2659
3872
|
* Connect a new MCPL server at runtime. Refreshes the tool list and
|
|
2660
3873
|
* notifies the agent of newly available tools. Throws if the MCPL
|
|
2661
3874
|
* subsystem is not initialized, the id is already connected, or the
|
|
2662
|
-
* connection/handshake fails.
|
|
3875
|
+
* connection/handshake fails. A config whose `inheritEnv` (on a stdio
|
|
3876
|
+
* server), `reconnect` or `allowHostCommands` holds anything but true,
|
|
3877
|
+
* false or null is refused, as `create()` refuses one.
|
|
2663
3878
|
*/
|
|
2664
3879
|
connectMcplServer(config: import('./mcpl/types.js').McplServerConfig): Promise<void>;
|
|
3880
|
+
/** connectMcplServer's work, for a restart's connect too: the id and tool
|
|
3881
|
+
* prefix its `claim` holds are free to it, and refused to everyone else. */
|
|
2665
3882
|
private runConnectMcplServer;
|
|
2666
3883
|
/**
|
|
2667
|
-
* Disconnect an MCPL server at runtime:
|
|
2668
|
-
*
|
|
2669
|
-
*
|
|
2670
|
-
*
|
|
3884
|
+
* Disconnect an MCPL server at runtime: remove its channels from the
|
|
3885
|
+
* registry (first, cancelling their queued lifecycle work), close the
|
|
3886
|
+
* connection, destroy its feature-set and checkpoint state (permanent
|
|
3887
|
+
* removal — unlike a transient transport close, which preserves checkpoints
|
|
3888
|
+
* for the reconnect), drop routing entries, and refresh tools.
|
|
2671
3889
|
* No-op-ish if the server is not connected (still clears routing state).
|
|
3890
|
+
*
|
|
3891
|
+
* It holds the id throughout (holdMcpServerId): a connect for it is
|
|
3892
|
+
* refused meanwhile, and a connect already in flight is ended (closed, or
|
|
3893
|
+
* displaced when its legacy handshake finishes) and settles before
|
|
3894
|
+
* anything but the channel entries the disconnect found when it began is
|
|
3895
|
+
* removed. A close that can't confirm a child exited fails the disconnect
|
|
3896
|
+
* before anything but those entries is removed: the server stays
|
|
3897
|
+
* registered, closed, so nothing launches beside a child that may still be
|
|
3898
|
+
* running, and disconnecting again retries the reap.
|
|
2672
3899
|
*/
|
|
2673
3900
|
disconnectMcplServer(id: string): Promise<void>;
|
|
2674
3901
|
private runDisconnectMcplServer;
|
|
@@ -2677,9 +3904,63 @@ export declare class AgentFramework {
|
|
|
2677
3904
|
* same (or an updated) config. This actually respawns a stdio child —
|
|
2678
3905
|
* unlike `reconnect: true`, which only retries after transport-level
|
|
2679
3906
|
* failures. Throws if the server has no stored config and none is given.
|
|
3907
|
+
* What its connect would refuse is refused before the running server is
|
|
3908
|
+
* torn down. Until the connect, a connect or a restart started meanwhile
|
|
3909
|
+
* is refused the id and the tool prefix the restart moves the server to,
|
|
3910
|
+
* and a module added meanwhile is refused that tool prefix. The id and
|
|
3911
|
+
* prefix it moves the server from are free once its disconnect is done, as
|
|
3912
|
+
* after any disconnect.
|
|
3913
|
+
*
|
|
3914
|
+
* A disconnect of the id the restart moves the server to (its own id, for
|
|
3915
|
+
* a restart under the same id), or a `stop()`, that begins during the
|
|
3916
|
+
* restart ends it, as a disconnect ends a connect in flight: the restart
|
|
3917
|
+
* rejects, saying the server is down, and its holds are released, and the
|
|
3918
|
+
* server isn't left configured, as after any disconnect. A restart whose
|
|
3919
|
+
* connect fails on its own leaves the server down, configured under the
|
|
3920
|
+
* new configuration and its id, and holding its tool prefix, as any failed
|
|
3921
|
+
* connect does: `listMcplServers()` lists it as not connected, and a
|
|
3922
|
+
* restart or a disconnect under that id tries it again or removes it.
|
|
3923
|
+
*
|
|
3924
|
+
* Treat a submitted configuration and its nested values as immutable for
|
|
3925
|
+
* as long as the server uses them. Apply changed settings with
|
|
3926
|
+
* `restartMcplServer(id, newConfig)`; use `accessProvider` for a network
|
|
3927
|
+
* server's rotating credentials (a stdio server's changed `env` goes
|
|
3928
|
+
* through a restart with the new configuration).
|
|
2680
3929
|
*/
|
|
2681
3930
|
restartMcplServer(id: string, newConfig?: import('./mcpl/types.js').McplServerConfig): Promise<void>;
|
|
2682
3931
|
private runRestartMcplServer;
|
|
3932
|
+
/**
|
|
3933
|
+
* A redactor for text that may come from any configured server, with every
|
|
3934
|
+
* server's credentials replaced: those of the configurations present when
|
|
3935
|
+
* it's made, then those present when it's used. An operation makes it
|
|
3936
|
+
* before it waits, so a server removed meanwhile, and one connected
|
|
3937
|
+
* meanwhile, both have their credentials replaced. When one of them can't
|
|
3938
|
+
* be read, the text is withheld, as redactServerText withholds it.
|
|
3939
|
+
*/
|
|
3940
|
+
private everyServerRedactor;
|
|
3941
|
+
/** Why a connect for this id is refused, or null when the id is free. One
|
|
3942
|
+
* owner per id, across both engines (holdMcpServerId): a connect or
|
|
3943
|
+
* disconnect in flight holds it, and so does a registered connection,
|
|
3944
|
+
* including one kept because its launch couldn't be confirmed exited, and
|
|
3945
|
+
* a restart moving its server to the id (mcpRestartClaims), except to
|
|
3946
|
+
* that restart's own connect (`claim`). That connect is still refused
|
|
3947
|
+
* while a disconnect of the id is in flight: the restart's own disconnect
|
|
3948
|
+
* has finished by then, so that one began during the restart, and it ends
|
|
3949
|
+
* the restart. `restarting` words the refusal for a restart of that
|
|
3950
|
+
* server checking the id it would move to. */
|
|
3951
|
+
private mcpServerIdTaken;
|
|
3952
|
+
/** The collision rules create() enforces at startup, as a runtime connect
|
|
3953
|
+
* (or a restart, before its disconnect) meets them, in either engine: the
|
|
3954
|
+
* tool prefix must not shadow a module name or another server's prefix,
|
|
3955
|
+
* or meet another server's (prefixesMeet, #265), and must neither be nor
|
|
3956
|
+
* meet one a restart is moving its server to (mcpRestartClaims). The
|
|
3957
|
+
* server's own prefix is free to keep, so is that of the server a restart
|
|
3958
|
+
* is about to disconnect (`leaving`), and so is the prefix a restart's own
|
|
3959
|
+
* connect holds (`claim`). */
|
|
3960
|
+
private mcplPrefixCollision;
|
|
3961
|
+
/** The protocol family a configuration resolves to, or a refusal naming
|
|
3962
|
+
* every problem with it, before anything is spawned, dialed or torn down. */
|
|
3963
|
+
private static usableConfigFamily;
|
|
2683
3964
|
/**
|
|
2684
3965
|
* List configured MCPL servers with live connection status and the number
|
|
2685
3966
|
* of tools each currently contributes.
|
|
@@ -2688,10 +3969,22 @@ export declare class AgentFramework {
|
|
|
2688
3969
|
id: string;
|
|
2689
3970
|
connected: boolean;
|
|
2690
3971
|
retrying: boolean;
|
|
3972
|
+
/** Which engine serves it: `legacy` (MCP 2024-11-05 + MCPL) or `modern`
|
|
3973
|
+
* (MCP 2026-07-28), as its configuration selects; null when the
|
|
3974
|
+
* configuration names no usable transport (see `refused`). */
|
|
3975
|
+
family: 'legacy' | 'modern' | null;
|
|
3976
|
+
/** The MCP revision its last handshake established; null until one has. */
|
|
3977
|
+
protocolVersion: string | null;
|
|
3978
|
+
/** How it is reached; null when the configuration names no usable transport. */
|
|
3979
|
+
transport: 'stdio' | 'websocket' | 'http' | null;
|
|
3980
|
+
/** Why connecting refuses this configuration, before anything is spawned
|
|
3981
|
+
* or dialed; null when it is usable. */
|
|
3982
|
+
refused: string | null;
|
|
2691
3983
|
toolPrefix: string;
|
|
2692
3984
|
toolCount: number;
|
|
2693
|
-
/** True only after the §5.3 policy receipt activated the grant.
|
|
2694
|
-
|
|
3985
|
+
/** True only after the §5.3 policy receipt activated the grant. Null for
|
|
3986
|
+
* a modern server, which has no MCPL policy. */
|
|
3987
|
+
policyEstablished: boolean | null;
|
|
2695
3988
|
/** Sole normative authorization allowlist for the connection (§5.4). */
|
|
2696
3989
|
effectiveGrant: string[];
|
|
2697
3990
|
/** Advertised paths removed by host enabled/disabled capability config. */
|
|
@@ -2730,16 +4023,51 @@ export declare class AgentFramework {
|
|
|
2730
4023
|
lastNegotiatedAt: number | null;
|
|
2731
4024
|
};
|
|
2732
4025
|
command?: string;
|
|
4026
|
+
/** The url as {@link redactUrl} shows it, since a credential may ride in
|
|
4027
|
+
* it: no userinfo, each query parameter's value replaced, and any path
|
|
4028
|
+
* segment or query parameter name that looks like a credential
|
|
4029
|
+
* replaced. */
|
|
2733
4030
|
url?: string;
|
|
2734
4031
|
}>;
|
|
4032
|
+
/**
|
|
4033
|
+
* An inbound MCPL handler, contained: EventEmitter doesn't consume the
|
|
4034
|
+
* promise a listener returns, so this keeps each handler's throw or
|
|
4035
|
+
* rejection at this boundary, including failures after channels/register or
|
|
4036
|
+
* channels/changed has acknowledged the request. It's invoked at once, so
|
|
4037
|
+
* control-plane replies keep their acknowledge-before-reconcile order.
|
|
4038
|
+
* Each text a failure records, in its trace and its log line, goes through
|
|
4039
|
+
* `recorded`, the server's redactor where the caller has one, since a
|
|
4040
|
+
* handler's error can quote what the server sent.
|
|
4041
|
+
*/
|
|
4042
|
+
private containedInboundHandler;
|
|
2735
4043
|
/**
|
|
2736
4044
|
* Wire event listeners on an MCPL server connection.
|
|
2737
4045
|
* Push events and inference requests are deferred to Steps 6/7.
|
|
2738
4046
|
*/
|
|
2739
4047
|
private wireMcplEvents;
|
|
4048
|
+
/**
|
|
4049
|
+
* Wire a modern-MCP connection's events. There's less here than for MCPL
|
|
4050
|
+
* on purpose: no push, inference, channels or policy exist on this family.
|
|
4051
|
+
* A list change, including the relist after a reconnect, takes the legacy
|
|
4052
|
+
* engine's refresh path (`handleToolsListChanged`), so any wake it causes
|
|
4053
|
+
* goes through ordinary admission: it parks under quiesce or a hold like
|
|
4054
|
+
* every other wake. It installs no awareness gate, since that gate orders
|
|
4055
|
+
* MCPL data-plane traffic, which this family doesn't carry.
|
|
4056
|
+
*/
|
|
4057
|
+
private wireModernEvents;
|
|
4058
|
+
/** An MCP tool call's trace: a result the server marked an error (or one
|
|
4059
|
+
* the reading couldn't complete) is tool:failed, as on the other tool
|
|
4060
|
+
* paths; anything else is tool:completed. */
|
|
4061
|
+
private traceMcpToolOutcome;
|
|
2740
4062
|
/**
|
|
2741
4063
|
* Discover tools from all connected MCPL servers and cache them.
|
|
2742
4064
|
* Tools are namespaced as `{toolPrefix}--{toolName}` per server config.
|
|
4065
|
+
* No two servers' prefixes meet (prefixesMeet, refused at create(), a
|
|
4066
|
+
* runtime connect and a restart), so no two servers give one name. A
|
|
4067
|
+
* server that lists one name more than once keeps its first listing, and
|
|
4068
|
+
* an ops alert at each refresh that finds it says so (#265): a tool list
|
|
4069
|
+
* holding one name twice is refused by membrane's native formatter and by
|
|
4070
|
+
* Anthropic's API.
|
|
2743
4071
|
*/
|
|
2744
4072
|
private refreshMcplTools;
|
|
2745
4073
|
/**
|
|
@@ -2769,11 +4097,47 @@ export declare class AgentFramework {
|
|
|
2769
4097
|
* Emit a trace event and push an external-message listing newly added tools.
|
|
2770
4098
|
*/
|
|
2771
4099
|
private emitMcplToolDiff;
|
|
4100
|
+
/** The refusal of a tool call whose server isn't one to call yet, for the
|
|
4101
|
+
* model's call, a script's and an in-process one alike: none registered,
|
|
4102
|
+
* or a modern connection whose connect is still under way
|
|
4103
|
+
* (modernStillConnecting). It says "connecting" while a connect of its id
|
|
4104
|
+
* is in flight (mcpServerOps) or a restart holds the id, and "gone"
|
|
4105
|
+
* otherwise. */
|
|
4106
|
+
private mcplServerAbsentText;
|
|
4107
|
+
/** A modern connection a connect still under way registered: it registers
|
|
4108
|
+
* before it starts, so until its first session is up it's no server to
|
|
4109
|
+
* call, and a call reads the "connecting" text, as one during a legacy
|
|
4110
|
+
* connect's handshake does. Once that session is up, a call goes to it,
|
|
4111
|
+
* even while the connect lists its tools. */
|
|
4112
|
+
private modernStillConnecting;
|
|
2772
4113
|
/**
|
|
2773
4114
|
* Dispatch a tool call to an MCPL server.
|
|
2774
4115
|
* Strips the configured toolPrefix and routes to the server.
|
|
2775
4116
|
*/
|
|
2776
4117
|
private dispatchMcplToolCall;
|
|
4118
|
+
/**
|
|
4119
|
+
* The direct path's reading of an MCP tool result (executeToolCall,
|
|
4120
|
+
* ModuleContext.callTool). `data` stays the raw content array, as module
|
|
4121
|
+
* callers have always received it. Two things change: a tool error
|
|
4122
|
+
* (`isError: true`) is now a failure, where every answer used to count as
|
|
4123
|
+
* success, and `structured` is added by presence.
|
|
4124
|
+
*/
|
|
4125
|
+
private static directToolResult;
|
|
4126
|
+
/**
|
|
4127
|
+
* The framework's ToolResult for an MCP tool result on the model path
|
|
4128
|
+
* (model dispatch, and scripts, which ride it). A standard peer, meaning an MCP-only legacy
|
|
4129
|
+
* server or any modern server, gets the standard reading
|
|
4130
|
+
* (tool-result-normalize.ts): typed content blocks, workspace-saved
|
|
4131
|
+
* payloads, and `structured` kept by presence. An MCPL peer keeps the
|
|
4132
|
+
* RFC-005 reading. Its content array passes through when it holds
|
|
4133
|
+
* non-text blocks, so references and images render natively. It gets
|
|
4134
|
+
* `structured` too, with the JSON view when its content is empty. The
|
|
4135
|
+
* direct path (a module's callTool, a channel's tool call) doesn't come
|
|
4136
|
+
* here: it returns the server's result itself (directToolResult), for
|
|
4137
|
+
* either engine, as does a script's call whose result is structured, with
|
|
4138
|
+
* an MCPL peer's blocks given RFC-005's treatment (referenceBlockForScript).
|
|
4139
|
+
*/
|
|
4140
|
+
private mcpToolResult;
|
|
2777
4141
|
/**
|
|
2778
4142
|
* Build BeforeInferenceParams from agent state and trigger context.
|
|
2779
4143
|
*/
|