@animalabs/agent-framework 0.22.1 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/src/agent.d.ts +266 -28
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +539 -104
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/mcp-server-core.d.ts +41 -0
- package/dist/src/api/mcp-server-core.d.ts.map +1 -0
- package/dist/src/api/mcp-server-core.js +593 -0
- package/dist/src/api/mcp-server-core.js.map +1 -0
- package/dist/src/api/mcp-server.d.ts +2 -36
- package/dist/src/api/mcp-server.d.ts.map +1 -1
- package/dist/src/api/mcp-server.js +15 -595
- package/dist/src/api/mcp-server.js.map +1 -1
- package/dist/src/api/server.d.ts +9 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +55 -27
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/api/types.d.ts +10 -2
- package/dist/src/api/types.d.ts.map +1 -1
- package/dist/src/branch-names.d.ts +14 -0
- package/dist/src/branch-names.d.ts.map +1 -0
- package/dist/src/branch-names.js +22 -0
- package/dist/src/branch-names.js.map +1 -0
- package/dist/src/closest-names.d.ts +28 -0
- package/dist/src/closest-names.d.ts.map +1 -0
- package/dist/src/closest-names.js +98 -0
- package/dist/src/closest-names.js.map +1 -0
- package/dist/src/code-execution/py-runner.d.ts +16 -5
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +186 -74
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +49 -3
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/code-execution/tool-definition.d.ts +12 -1
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +21 -3
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/config-checks.d.ts +28 -0
- package/dist/src/config-checks.d.ts.map +1 -0
- package/dist/src/config-checks.js +52 -0
- package/dist/src/config-checks.js.map +1 -0
- package/dist/src/deadline-timer.d.ts +21 -0
- package/dist/src/deadline-timer.d.ts.map +1 -0
- package/dist/src/deadline-timer.js +43 -0
- package/dist/src/deadline-timer.js.map +1 -0
- package/dist/src/error-message.d.ts +30 -0
- package/dist/src/error-message.d.ts.map +1 -0
- package/dist/src/error-message.js +50 -0
- package/dist/src/error-message.js.map +1 -0
- package/dist/src/framework.d.ts +1212 -192
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +6686 -1835
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +8 -0
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +27 -3
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/gate/gate-script.d.ts.map +1 -1
- package/dist/src/gate/gate-script.js.map +1 -1
- package/dist/src/index.d.ts +5 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +170 -13
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +499 -258
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts +21 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.js +91 -30
- package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +19 -3
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +23 -8
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts +20 -0
- package/dist/src/mcpl/convert-block.d.ts.map +1 -0
- package/dist/src/mcpl/convert-block.js +89 -0
- package/dist/src/mcpl/convert-block.js.map +1 -0
- package/dist/src/mcpl/errors.d.ts +13 -0
- package/dist/src/mcpl/errors.d.ts.map +1 -1
- package/dist/src/mcpl/errors.js +28 -0
- package/dist/src/mcpl/errors.js.map +1 -1
- package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
- package/dist/src/mcpl/feature-set-manager.js +4 -3
- package/dist/src/mcpl/feature-set-manager.js.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts +23 -0
- package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.js +83 -72
- package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +114 -0
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -0
- package/dist/src/mcpl/inbound-source.js +83 -0
- package/dist/src/mcpl/inbound-source.js.map +1 -0
- package/dist/src/mcpl/index.d.ts +3 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +3 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +15 -11
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +153 -84
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +54 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -0
- package/dist/src/mcpl/log-value.js +109 -0
- package/dist/src/mcpl/log-value.js.map +1 -0
- package/dist/src/mcpl/prose-stream-router.d.ts +6 -6
- package/dist/src/mcpl/prose-stream-router.d.ts.map +1 -1
- package/dist/src/mcpl/prose-stream-router.js +4 -4
- package/dist/src/mcpl/prose-stream-router.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +64 -7
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +121 -24
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +38 -8
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +77 -78
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +14 -2
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +72 -30
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +49 -14
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +74 -21
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/refusal-lines.d.ts +37 -0
- package/dist/src/mcpl/refusal-lines.d.ts.map +1 -0
- package/dist/src/mcpl/refusal-lines.js +61 -0
- package/dist/src/mcpl/refusal-lines.js.map +1 -0
- package/dist/src/mcpl/scope-manager.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +107 -12
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +470 -139
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts +10 -1
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +14 -3
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/skip-reply-wake.d.ts +36 -0
- package/dist/src/mcpl/skip-reply-wake.d.ts.map +1 -0
- package/dist/src/mcpl/skip-reply-wake.js +55 -0
- package/dist/src/mcpl/skip-reply-wake.js.map +1 -0
- package/dist/src/mcpl/tool-classes.d.ts +1 -1
- package/dist/src/mcpl/tool-classes.d.ts.map +1 -1
- package/dist/src/mcpl/tool-classes.js +3 -2
- package/dist/src/mcpl/tool-classes.js.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
- package/dist/src/mcpl/transport.d.ts +74 -7
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +209 -22
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +43 -28
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +15 -0
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +25 -0
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +19 -1
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +54 -25
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/api/index.d.ts.map +1 -1
- package/dist/src/modules/api/index.js +1 -1
- package/dist/src/modules/api/index.js.map +1 -1
- package/dist/src/modules/discord/discord-js-client.d.ts +1 -0
- package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.js +25 -9
- package/dist/src/modules/discord/discord-js-client.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +29 -3
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +383 -145
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/discord/types.d.ts +14 -1
- package/dist/src/modules/discord/types.d.ts.map +1 -1
- package/dist/src/modules/health/index.d.ts.map +1 -1
- package/dist/src/modules/health/index.js +2 -1
- package/dist/src/modules/health/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +3 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +359 -127
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +28 -1
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +177 -32
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/unknown-tool.d.ts +10 -0
- package/dist/src/modules/unknown-tool.d.ts.map +1 -0
- package/dist/src/modules/unknown-tool.js +17 -0
- package/dist/src/modules/unknown-tool.js.map +1 -0
- package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -1
- package/dist/src/modules/workspace/branch-intent.js.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.d.ts +54 -6
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +93 -27
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +64 -6
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +291 -44
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +127 -27
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +821 -248
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +117 -15
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +436 -51
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts +75 -8
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +576 -68
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +42 -3
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/modules/workspace/watcher.d.ts +7 -2
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js +28 -4
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/operator-log.d.ts.map +1 -1
- package/dist/src/operator-log.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/provider-waits.d.ts.map +1 -1
- package/dist/src/provider-waits.js.map +1 -1
- package/dist/src/queue.d.ts.map +1 -1
- package/dist/src/record-journal.d.ts.map +1 -1
- package/dist/src/record-journal.js.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.d.ts.map +1 -1
- package/dist/src/recovery/discord-awareness-outbox.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 +32 -25
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/recovery/recover-cli.js.map +1 -1
- package/dist/src/runtime/liveness-watchdog.d.ts.map +1 -1
- package/dist/src/runtime/liveness-watchdog.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/shutdown.d.ts.map +1 -1
- package/dist/src/shutdown.js.map +1 -1
- package/dist/src/stored-removal.d.ts +73 -0
- package/dist/src/stored-removal.d.ts.map +1 -0
- package/dist/src/stored-removal.js +100 -0
- package/dist/src/stored-removal.js.map +1 -0
- package/dist/src/thinking-token-stamp.js.map +1 -1
- package/dist/src/tool-image-ledger.d.ts +87 -19
- package/dist/src/tool-image-ledger.d.ts.map +1 -1
- package/dist/src/tool-image-ledger.js +135 -32
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-presentation.d.ts +9 -0
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +257 -60
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +7 -10
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +32 -3
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +106 -19
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +25 -1
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +260 -65
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/tune-out/tools.d.ts +1 -1
- package/dist/src/tune-out/tools.d.ts.map +1 -1
- package/dist/src/types/agent.d.ts +59 -11
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +17 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +31 -5
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/inference-log.d.ts +1 -1
- package/dist/src/types/inference-log.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +30 -7
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +151 -11
- 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 +10 -9
- package/src/agent.ts +572 -105
- package/src/api/mcp-server-core.ts +681 -0
- package/src/api/mcp-server.ts +16 -685
- package/src/api/server.ts +55 -30
- package/src/api/types.ts +10 -2
- package/src/branch-names.ts +19 -0
- package/src/closest-names.ts +94 -0
- package/src/code-execution/py-runner.ts +200 -76
- package/src/code-execution/runtime-py.ts +49 -3
- package/src/code-execution/tool-definition.ts +28 -4
- package/src/config-checks.ts +48 -0
- package/src/deadline-timer.ts +44 -0
- package/src/error-message.ts +48 -0
- package/src/framework.ts +7158 -1936
- package/src/gate/event-gate.ts +28 -3
- package/src/index.ts +12 -3
- package/src/mcpl/channel-registry.ts +615 -289
- package/src/mcpl/checkpoint-manager.ts +104 -29
- package/src/mcpl/conversation-router.ts +28 -8
- package/src/mcpl/convert-block.ts +97 -0
- package/src/mcpl/errors.ts +28 -0
- package/src/mcpl/feature-set-manager.ts +4 -3
- package/src/mcpl/hook-orchestrator.ts +84 -77
- package/src/mcpl/inbound-source.ts +156 -0
- package/src/mcpl/index.ts +10 -1
- package/src/mcpl/inference-router.ts +174 -99
- package/src/mcpl/log-value.ts +116 -0
- package/src/mcpl/prose-stream-router.ts +6 -6
- package/src/mcpl/push-coalescer.ts +124 -24
- package/src/mcpl/push-handler.ts +86 -84
- package/src/mcpl/reference-fetcher.ts +71 -26
- package/src/mcpl/references.ts +81 -22
- package/src/mcpl/refusal-lines.ts +59 -0
- package/src/mcpl/server-connection.ts +496 -142
- package/src/mcpl/server-registry.ts +15 -4
- package/src/mcpl/skip-reply-wake.ts +73 -0
- package/src/mcpl/tool-classes.ts +3 -2
- package/src/mcpl/transport.ts +219 -26
- package/src/mcpl/types.ts +18 -3
- package/src/mcpl/visible-content.ts +27 -0
- package/src/module-registry.ts +58 -23
- package/src/modules/api/index.ts +1 -1
- package/src/modules/discord/discord-js-client.ts +26 -10
- package/src/modules/discord/index.ts +395 -160
- package/src/modules/discord/types.ts +15 -2
- package/src/modules/health/index.ts +2 -1
- package/src/modules/history/index.ts +410 -120
- package/src/modules/history/semantic.ts +189 -32
- package/src/modules/unknown-tool.ts +16 -0
- package/src/modules/workspace/disk-agreement.ts +125 -21
- package/src/modules/workspace/effects.ts +279 -35
- package/src/modules/workspace/index.ts +841 -261
- package/src/modules/workspace/observe.ts +456 -56
- package/src/modules/workspace/reconcile.ts +688 -76
- package/src/modules/workspace/types.ts +41 -2
- package/src/modules/workspace/watcher.ts +27 -4
- package/src/prose-drafts.ts +481 -0
- package/src/prose-segments.ts +51 -8
- package/src/recovery/offline-branch.ts +36 -29
- package/src/safe-slice.ts +9 -1
- package/src/stored-removal.ts +126 -0
- package/src/tool-image-ledger.ts +153 -34
- package/src/tool-presentation.ts +224 -40
- package/src/tool-result-guard.ts +7 -8
- package/src/tool-result-history.ts +124 -20
- package/src/tune-out/coordinator.ts +259 -65
- package/src/types/agent.ts +59 -13
- package/src/types/events.ts +17 -0
- package/src/types/framework.ts +31 -5
- package/src/types/inference-log.ts +1 -1
- package/src/types/module.ts +31 -7
- package/src/types/trace.ts +158 -12
- 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 -462
- 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 -387
- 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 -267
- 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/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 -1394
- 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 -72
- package/dist/test/helpers/coalescing-fixture.d.ts.map +0 -1
- package/dist/test/helpers/coalescing-fixture.js +0 -146
- 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/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 -863
- 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 -309
- 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 -1201
- 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 -265
- package/dist/test/maintenance-timer.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-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 -236
- 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-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-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-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 -258
- 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 -226
- 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 -398
- 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 -197
- package/dist/test/overbudget-drain-breaker.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 -14
- package/dist/test/physical-window-restart.test.d.ts.map +0 -1
- package/dist/test/physical-window-restart.test.js +0 -222
- 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 -706
- 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 -2196
- 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 -224
- 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 -108
- 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-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/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-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 -672
- 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 -3607
- 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 -329
- 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/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 -3194
- 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/agent.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isAbortedResponse } from '@animalabs/membrane';
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { ToolResultGuard } from './tool-result-guard.js';
|
|
4
|
+
import { assertBooleanSetting, holdsSettings } from './config-checks.js';
|
|
4
5
|
import { indexSilentTickRows, separateSilentHeartbeatTicks, silentHeartbeatSeparatorTurn, } from './silent-heartbeat.js';
|
|
5
6
|
import { nonErrorResultText, truncateForHistory, DEFAULT_TOOL_RESULT_INLINE_MAX_CHARS, } from './tool-result-history.js';
|
|
6
7
|
function stableHash(value) {
|
|
@@ -18,6 +19,32 @@ function stableHash(value) {
|
|
|
18
19
|
const DEFAULT_CONTEXT_BUDGET_TOKENS = 100_000;
|
|
19
20
|
const DEFAULT_TRANSITION_PACE_TOKENS = 16_000;
|
|
20
21
|
const DEFAULT_SAME_ROUND_THINK_TEXT_POLICY = 'public';
|
|
22
|
+
/**
|
|
23
|
+
* Refuse an agent config whose `promptCaching`, `toolResultGuard`,
|
|
24
|
+
* `toolWrapperProseGuard`, `thinking.enabled` or `refusalHandling.autoRewind`
|
|
25
|
+
* holds anything but true or false (assertBooleanSetting), or whose `thinking`
|
|
26
|
+
* or `refusalHandling` is anything but an object, null or false
|
|
27
|
+
* (holdsSettings). The constructor runs it first, so the rule holds wherever
|
|
28
|
+
* an Agent is built. `create()` also runs it for each of its agents before
|
|
29
|
+
* anything opens, and `createEphemeralAgent` before it reserves the name, so a
|
|
30
|
+
* refusal there leaves nothing behind. Membrane reads `thinking.enabled`, and
|
|
31
|
+
* the refusal is here because the setting is AgentConfig's.
|
|
32
|
+
*/
|
|
33
|
+
export function assertAgentSwitches(config) {
|
|
34
|
+
const agent = `Agent "${config.name}"`;
|
|
35
|
+
assertBooleanSetting(`${agent} promptCaching`, config.promptCaching, 'true or leaving it out marks requests for prompt caching, and false leaves the markers off, for transports that refuse them');
|
|
36
|
+
if (holdsSettings(`${agent} thinking`, config.thinking, '{ enabled: true }')) {
|
|
37
|
+
assertBooleanSetting(`${agent} thinking.enabled`, config.thinking.enabled, 'true asks the provider for extended thinking, and false or leaving it out doesn\'t');
|
|
38
|
+
}
|
|
39
|
+
if (holdsSettings(`${agent} refusalHandling`, config.refusalHandling, '{ autoRewind: true }')) {
|
|
40
|
+
assertBooleanSetting(`${agent} refusalHandling.autoRewind`, config.refusalHandling.autoRewind, 'true redacts the turn that tripped a refusal and runs again, up to maxRewinds times, ' +
|
|
41
|
+
'and false or leaving it out doesn\'t');
|
|
42
|
+
}
|
|
43
|
+
assertBooleanSetting(`${agent} toolResultGuard`, config.toolResultGuard, 'true turns on tool-output admission, with one guarded retry after a provider refusal, ' +
|
|
44
|
+
'and false or leaving it out doesn\'t');
|
|
45
|
+
assertBooleanSetting(`${agent} toolWrapperProseGuard`, config.toolWrapperProseGuard, 'true keeps a response whose whole prose is a tool-call-shaped wrapper from running or entering the agent\'s history, ' +
|
|
46
|
+
'and false or leaving it out doesn\'t');
|
|
47
|
+
}
|
|
21
48
|
/**
|
|
22
49
|
* An agent wraps a context manager and manages inference state.
|
|
23
50
|
*/
|
|
@@ -65,15 +92,38 @@ export class Agent {
|
|
|
65
92
|
* closure) so the next activation can close whatever its predecessor left
|
|
66
93
|
* open — see failOpenKvSubmissions. */
|
|
67
94
|
kvOpenQueue = null;
|
|
95
|
+
/** The current stream's fresh input so far, as membrane's usage event
|
|
96
|
+
* reports it (cumulative across the tool loop): what the maxStreamTokens
|
|
97
|
+
* budget checks. */
|
|
68
98
|
lastStreamInputTokens = 0;
|
|
69
|
-
/** Real
|
|
70
|
-
*
|
|
71
|
-
*
|
|
99
|
+
/** Real prompt size of the stream's latest provider call that reported a
|
|
100
|
+
* prompt, which is what the provider billed it: fresh + cache creation +
|
|
101
|
+
* cache read. A call that reports none leaves it as it was (see
|
|
102
|
+
* lastStreamUnreportedTokens). Membrane's usage events are cumulative, so
|
|
103
|
+
* this is the call's share of its event (cumulativeDelta): the whole event
|
|
104
|
+
* for a stream's first call, and the event's own value where a counter
|
|
105
|
+
* went back. THE window-shaped number — `lastStreamInputTokens` alone
|
|
106
|
+
* omits cached tokens, which are most of a warm stream's window. 0 until a
|
|
107
|
+
* call on this stream reports a prompt, and the physical-window
|
|
108
|
+
* projection runs only once one has. */
|
|
72
109
|
lastStreamRealInputTokens = 0;
|
|
73
|
-
/** Output tokens of the
|
|
74
|
-
*
|
|
75
|
-
*
|
|
110
|
+
/** Output tokens of the same call as lastStreamRealInputTokens, or
|
|
111
|
+
* maxTokens, the bound on them, when it reported none (a call that ends at
|
|
112
|
+
* a tool boundary wrote a tool_use, so a 0 is a count left unreported) —
|
|
113
|
+
* the prior round's generated thinking/text/tool_use, which becomes part
|
|
114
|
+
* of the NEXT round's input and so belongs in the physical-window
|
|
115
|
+
* projection. */
|
|
76
116
|
lastStreamOutputTokens = 0;
|
|
117
|
+
/** What the stream has grown by since the call lastStreamRealInputTokens
|
|
118
|
+
* describes, for the physical-window projection: the blocks appended at
|
|
119
|
+
* each boundary the stream continued past (counted only for an agent with
|
|
120
|
+
* physicalWindowTokens, whose projection is this field's one reader), and
|
|
121
|
+
* the output of each call that reported no prompt (its reported output,
|
|
122
|
+
* or maxTokens, the bound on it, when it reported none either). After
|
|
123
|
+
* calls that report no prompt, the next request holds the prompt and
|
|
124
|
+
* output of the call lastStreamRealInputTokens describes, plus this. 0 at
|
|
125
|
+
* stream start and whenever a call reports a prompt. */
|
|
126
|
+
lastStreamUnreportedTokens = 0;
|
|
77
127
|
maxStreamTokens;
|
|
78
128
|
/** Provider hard context cap (see AgentConfig.physicalWindowTokens). */
|
|
79
129
|
physicalWindowTokens;
|
|
@@ -87,9 +137,55 @@ export class Agent {
|
|
|
87
137
|
configuredSameRoundThinkTextPolicy;
|
|
88
138
|
contextBudgetTargetTokens;
|
|
89
139
|
runtimeSettingsOverrides = {};
|
|
140
|
+
/**
|
|
141
|
+
* Counts changes of the live budget (an update, a reset, a restore, a
|
|
142
|
+
* settle). A compile speaks for the budget it planned at only if the live
|
|
143
|
+
* budget didn't change while it ran, and what it showed stands only until
|
|
144
|
+
* the next change.
|
|
145
|
+
*/
|
|
146
|
+
liveBudgetEpoch = 0;
|
|
147
|
+
/**
|
|
148
|
+
* Counts changes of the descent (each arm of one, the same target included,
|
|
149
|
+
* a reset, a cancel, a settle). A settle proves its target only to a
|
|
150
|
+
* compile that began under that same descent.
|
|
151
|
+
*/
|
|
152
|
+
descentEpoch = 0;
|
|
153
|
+
/** The live budget the last compile planned at, whether it fit, and the live budget's epoch then. */
|
|
154
|
+
lastCompiledBudget;
|
|
155
|
+
/** Counts compiles at the live budget as they start. */
|
|
156
|
+
compilesStarted = 0;
|
|
157
|
+
/** The start numbers of the compiles at the live budget still running. */
|
|
158
|
+
compilesRunning = new Set();
|
|
159
|
+
/**
|
|
160
|
+
* For each budget, the start of the latest-started compile that has ended
|
|
161
|
+
* there with a fit or a refusal, whether or not what it showed was
|
|
162
|
+
* credited. Of two compiles at one budget, the later-started one planned
|
|
163
|
+
* at the newer store, so an earlier-started one that ends after it is
|
|
164
|
+
* ignored. That rests on the context manager selecting at the start of
|
|
165
|
+
* `compile`, before anything it awaits, so start order is selection order;
|
|
166
|
+
* a context manager that awaits before its select breaks it. (Injections
|
|
167
|
+
* are added after the select, so compiles with and without them plan
|
|
168
|
+
* alike.) An entry is
|
|
169
|
+
* kept only while a compile that started before it is still running, the
|
|
170
|
+
* only kind it can turn away, so the map is empty whenever no compile
|
|
171
|
+
* runs.
|
|
172
|
+
*/
|
|
173
|
+
latestEndedStart = new Map();
|
|
174
|
+
/** The last outcome the listener recorded; a failed record is told again, and so is any after a change. */
|
|
175
|
+
recordedCompiledBudget;
|
|
176
|
+
/**
|
|
177
|
+
* A boot restore applied a proven budget below the live one at once. Until
|
|
178
|
+
* the budget is next written (an update that carries one, or a reset of
|
|
179
|
+
* it) or a compile at it fits, a refusal of a compile at it restores it
|
|
180
|
+
* paced instead.
|
|
181
|
+
*/
|
|
182
|
+
restoredAtOnce = false;
|
|
183
|
+
/** Told when that changes (the framework records it beside the persisted budget). */
|
|
184
|
+
compiledBudgetListener;
|
|
90
185
|
contextManager;
|
|
91
186
|
membrane;
|
|
92
187
|
constructor(config, contextManager, membrane) {
|
|
188
|
+
assertAgentSwitches(config);
|
|
93
189
|
this.name = config.name;
|
|
94
190
|
this.model = config.model;
|
|
95
191
|
this.systemPrompt = config.systemPrompt;
|
|
@@ -99,11 +195,11 @@ export class Agent {
|
|
|
99
195
|
this.temperature = config.temperature;
|
|
100
196
|
this.thinking = config.thinking;
|
|
101
197
|
this.refusalHandling = config.refusalHandling;
|
|
102
|
-
this.toolResultGuard = new ToolResultGuard(config.name, contextManager, config.toolResultGuard);
|
|
198
|
+
this.toolResultGuard = new ToolResultGuard(config.name, contextManager, config.toolResultGuard === true);
|
|
103
199
|
this.proseRouting = config.proseRouting ?? 'locus';
|
|
104
|
-
this.toolWrapperProseGuard = config.toolWrapperProseGuard
|
|
200
|
+
this.toolWrapperProseGuard = config.toolWrapperProseGuard === true;
|
|
105
201
|
this.cacheTtl = config.cacheTtl ?? '1h';
|
|
106
|
-
this.promptCaching = config.promptCaching
|
|
202
|
+
this.promptCaching = config.promptCaching !== false;
|
|
107
203
|
this.prefillUserMessage = config.prefillUserMessage;
|
|
108
204
|
this.providerParams = config.providerParams;
|
|
109
205
|
this.sameRoundThinkTextPolicy = config.sameRoundThinkTextPolicy;
|
|
@@ -208,9 +304,15 @@ export class Agent {
|
|
|
208
304
|
getRuntimeSettings() {
|
|
209
305
|
const hot = this.getHotContextSettings();
|
|
210
306
|
return {
|
|
211
|
-
|
|
307
|
+
// The budget it's set to: the override, where there is one. That is
|
|
308
|
+
// the target of a descent toward it, or else the live budget, except
|
|
309
|
+
// while it's kept unapplied: at boot (keepRuntimeSettings), or after a
|
|
310
|
+
// refused at-once budget couldn't be restored paced (compileAtLiveBudget).
|
|
311
|
+
contextBudgetTokens: this.runtimeSettingsOverrides.contextBudgetTokens ??
|
|
312
|
+
this.contextBudgetTargetTokens ??
|
|
212
313
|
this.contextBudgetTokens ??
|
|
213
314
|
DEFAULT_CONTEXT_BUDGET_TOKENS,
|
|
315
|
+
effectiveContextBudgetTokens: this.contextBudgetTokens ?? DEFAULT_CONTEXT_BUDGET_TOKENS,
|
|
214
316
|
...(hot ? { tailTokens: hot.tailTokens } : {}),
|
|
215
317
|
...(hot?.transitionPaceTokens !== undefined
|
|
216
318
|
? { transitionPaceTokens: hot.transitionPaceTokens }
|
|
@@ -232,6 +334,179 @@ export class Agent {
|
|
|
232
334
|
getRuntimeSettingsOverrides() {
|
|
233
335
|
return { ...this.runtimeSettingsOverrides };
|
|
234
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* Set (or clear) the one listener told when a compile at the live budget
|
|
339
|
+
* comes out differently from the last: it fit at a budget the last one
|
|
340
|
+
* didn't plan at (after a settle, the target), or the context manager
|
|
341
|
+
* refused a budget the last one fit at.
|
|
342
|
+
*/
|
|
343
|
+
onContextBudgetCompiled(listener) {
|
|
344
|
+
this.compiledBudgetListener = listener;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The live budget the last compile planned at and fit, if it fit and the
|
|
348
|
+
* live budget hasn't changed since.
|
|
349
|
+
*/
|
|
350
|
+
getProvenContextBudgetTokens() {
|
|
351
|
+
const last = this.lastCompiledBudget;
|
|
352
|
+
return last?.fit && last.epoch === this.liveBudgetEpoch ? last.budget : undefined;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Set the live budget and the descent target, counting a change of each.
|
|
356
|
+
* `armed` counts a descent armed here as a change even when its target is
|
|
357
|
+
* the one already set: a compile that began under the earlier arm isn't
|
|
358
|
+
* credited with this one's settle.
|
|
359
|
+
*/
|
|
360
|
+
setContextBudget(budget, target, armed = false) {
|
|
361
|
+
if (budget !== this.contextBudgetTokens)
|
|
362
|
+
this.liveBudgetEpoch++;
|
|
363
|
+
if (armed || target !== this.contextBudgetTargetTokens)
|
|
364
|
+
this.descentEpoch++;
|
|
365
|
+
this.contextBudgetTokens = budget;
|
|
366
|
+
this.contextBudgetTargetTokens = target;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Claim the place of the latest compile to end at `budget` for the one that
|
|
370
|
+
* started as the `started`th, and say whether it got it: a compile that
|
|
371
|
+
* started before one that has already ended there is ignored, whichever
|
|
372
|
+
* finishes last.
|
|
373
|
+
*/
|
|
374
|
+
claimLatestAt(budget, started) {
|
|
375
|
+
if (started < (this.latestEndedStart.get(budget) ?? 0))
|
|
376
|
+
return false;
|
|
377
|
+
this.latestEndedStart.set(budget, started);
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Note what a compile at `budget`, planned at the live budget's `epoch`,
|
|
382
|
+
* showed. It speaks for the live budget only if that hasn't changed since;
|
|
383
|
+
* the listener is told either way, so a refusal withdraws the record's
|
|
384
|
+
* marker for the budget it planned at whatever changed meanwhile.
|
|
385
|
+
*/
|
|
386
|
+
noteCompiledBudget(budget, fit, epoch) {
|
|
387
|
+
if (epoch === this.liveBudgetEpoch)
|
|
388
|
+
this.lastCompiledBudget = { budget, fit, epoch };
|
|
389
|
+
const recorded = this.recordedCompiledBudget;
|
|
390
|
+
if (recorded?.budget === budget && recorded.fit === fit && recorded.epoch === epoch)
|
|
391
|
+
return;
|
|
392
|
+
// A listener that couldn't record it returns false: nothing is assumed
|
|
393
|
+
// recorded then, so the next compile tells it again whatever it shows.
|
|
394
|
+
this.recordedCompiledBudget = this.compiledBudgetListener?.(budget, fit) !== false ? { budget, fit, epoch } : undefined;
|
|
395
|
+
}
|
|
396
|
+
/** Compile at the live budget (no explicit one), noting whether it fit. */
|
|
397
|
+
async compileAtLiveBudget(compile) {
|
|
398
|
+
const started = ++this.compilesStarted;
|
|
399
|
+
this.compilesRunning.add(started);
|
|
400
|
+
try {
|
|
401
|
+
return await this.compileAtLiveBudgetNoting(compile, started);
|
|
402
|
+
}
|
|
403
|
+
finally {
|
|
404
|
+
this.compilesRunning.delete(started);
|
|
405
|
+
const earliest = Math.min(...this.compilesRunning);
|
|
406
|
+
for (const [budget, start] of this.latestEndedStart) {
|
|
407
|
+
if (start < earliest)
|
|
408
|
+
this.latestEndedStart.delete(budget);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/** The compile at the live budget that started as the `started`th, and what it showed. */
|
|
413
|
+
async compileAtLiveBudgetNoting(compile, started) {
|
|
414
|
+
// The budget this compile plans at, and the descent under way when it
|
|
415
|
+
// started: a change of either while it runs is no part of what it shows.
|
|
416
|
+
const live = this.contextBudgetTokens ?? DEFAULT_CONTEXT_BUDGET_TOKENS;
|
|
417
|
+
const epoch = this.liveBudgetEpoch;
|
|
418
|
+
const descent = this.descentEpoch;
|
|
419
|
+
let result;
|
|
420
|
+
try {
|
|
421
|
+
result = await compile();
|
|
422
|
+
}
|
|
423
|
+
catch (error) {
|
|
424
|
+
if (error?.name !== 'OverBudgetError')
|
|
425
|
+
throw error;
|
|
426
|
+
// A refusal shows the budget it planned at doesn't fit, whatever
|
|
427
|
+
// changed while it ran: the record's marker for it is withdrawn, and
|
|
428
|
+
// nothing is credited, unless a compile that started later has already
|
|
429
|
+
// ended at that budget.
|
|
430
|
+
if (this.claimLatestAt(live, started))
|
|
431
|
+
this.noteCompiledBudget(live, false, epoch);
|
|
432
|
+
// A budget a boot restore applied at once, refused at its first test,
|
|
433
|
+
// before anything wrote the budget: restore it paced instead, as the
|
|
434
|
+
// boot would have without its proof, and compile again from the
|
|
435
|
+
// recipe's budget. (While restoredAtOnce holds, the live budget is the
|
|
436
|
+
// one the boot applied: every write of the budget clears it, and no
|
|
437
|
+
// compile runs before the boot's restore.)
|
|
438
|
+
if (!this.restoredAtOnce)
|
|
439
|
+
throw error;
|
|
440
|
+
this.restoredAtOnce = false;
|
|
441
|
+
// The persisted budget stays in the overrides, so if it can't be
|
|
442
|
+
// restored paced, no later write erases it.
|
|
443
|
+
this.setContextBudget(this.configuredContextBudgetTokens, undefined);
|
|
444
|
+
let outcome;
|
|
445
|
+
try {
|
|
446
|
+
this.updateRuntimeSettings({ contextBudgetTokens: live });
|
|
447
|
+
outcome = 'restored it as a paced descent from the recipe\'s budget';
|
|
448
|
+
}
|
|
449
|
+
catch (fallback) {
|
|
450
|
+
outcome = `couldn't restore it paced (${fallback instanceof Error ? fallback.message : String(fallback)}), ` +
|
|
451
|
+
`so it compiles at the recipe's budget, with contextBudgetTokens=${live} kept set`;
|
|
452
|
+
}
|
|
453
|
+
console.error(`[agent-settings] ${this.name}: the context manager refused contextBudgetTokens=${live}, which the boot ` +
|
|
454
|
+
`applied at once; ${outcome}`);
|
|
455
|
+
return this.compileAtLiveBudget(compile);
|
|
456
|
+
}
|
|
457
|
+
this.restoredAtOnce = false;
|
|
458
|
+
// A settle, here, of the descent this compile began under proves its
|
|
459
|
+
// target: the frontier fits the window prepared for it. Without a settle,
|
|
460
|
+
// the compile proves the budget it planned at. Either only if the live
|
|
461
|
+
// budget didn't change while it ran; a settle of a descent armed while it
|
|
462
|
+
// ran proves nothing (the next compile at the target does).
|
|
463
|
+
// A compile that ends here with a fit takes its place in the start order
|
|
464
|
+
// at the budget it planned at, credited or not; a settle credits its
|
|
465
|
+
// target only from the latest compile to end there.
|
|
466
|
+
const latest = this.claimLatestAt(live, started);
|
|
467
|
+
const sameLive = this.liveBudgetEpoch === epoch;
|
|
468
|
+
const sameDescent = this.descentEpoch === descent;
|
|
469
|
+
const settled = this.settleRuntimeSettingsTransition();
|
|
470
|
+
if (latest && sameLive && settled && sameDescent && this.claimLatestAt(this.contextBudgetTokens, started)) {
|
|
471
|
+
this.noteCompiledBudget(this.contextBudgetTokens, true, this.liveBudgetEpoch);
|
|
472
|
+
}
|
|
473
|
+
else if (latest && sameLive && !settled)
|
|
474
|
+
this.noteCompiledBudget(live, true, epoch);
|
|
475
|
+
return result;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* The budget compiles plan at, the path a patch's budget takes from it, and
|
|
479
|
+
* whether a descent is in flight, from the agent's own state alone: what a
|
|
480
|
+
* runtime-settings preview can still say while the context manager refuses
|
|
481
|
+
* its queries.
|
|
482
|
+
* @internal For the framework's runtime-settings preview; not a host API.
|
|
483
|
+
*/
|
|
484
|
+
runtimeBudgetPath(patch) {
|
|
485
|
+
const live = this.contextBudgetTokens ?? DEFAULT_CONTEXT_BUDGET_TOKENS;
|
|
486
|
+
const budget = patch?.contextBudgetTokens;
|
|
487
|
+
return {
|
|
488
|
+
liveBudgetTokens: live,
|
|
489
|
+
path: budget === undefined ? 'none' : budget >= live || patch?.immediate ? 'immediate' : 'paced',
|
|
490
|
+
transition: this.contextBudgetTargetTokens === undefined ? 'stable' : 'converging',
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Whether the context manager answers its queries, as its readiness says.
|
|
495
|
+
* It refuses them while its strategy's initialization is pending or has
|
|
496
|
+
* failed, until a switchBranch or setStrategy succeeds, and a strategy can
|
|
497
|
+
* refuse its readiness on its own, as the autobiographical one does for a
|
|
498
|
+
* branch it hasn't reloaded.
|
|
499
|
+
* @internal For the framework's runtime-settings preview; not a host API.
|
|
500
|
+
*/
|
|
501
|
+
contextManagerAnswers() {
|
|
502
|
+
try {
|
|
503
|
+
this.contextManager.isReady();
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
catch {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
235
510
|
/**
|
|
236
511
|
* Read-only mirror of `updateRuntimeSettings`' budget semantics: derive what
|
|
237
512
|
* the next compile would actually plan at if `patch` were applied, WITHOUT
|
|
@@ -248,41 +523,48 @@ export class Agent {
|
|
|
248
523
|
* - `path: 'none'` — patch absent or budget untouched.
|
|
249
524
|
*
|
|
250
525
|
* `overrides` uses strategy-config names (`recentWindowTokens`,
|
|
251
|
-
* `kvStableReachTokens`) suitable for `previewContext`.
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
526
|
+
* `kvStableReachTokens`) suitable for `previewContext`. The reach is the one
|
|
527
|
+
* the next compile plans at (context-manager's kv-stable picker): a
|
|
528
|
+
* descent's pace while a window is prepared for it, one this patch arms (a
|
|
529
|
+
* paced decrease) or one in flight that it leaves alone (a patch without a
|
|
530
|
+
* budget), and the configured reach otherwise. Config is a preview's only
|
|
531
|
+
* lever: `preparedWindowTokens` and the live runtime pace are strategy
|
|
532
|
+
* instance state, which a preview can't set. So a preview taken during a
|
|
533
|
+
* descent plans under that descent's prepared window, and at its live pace
|
|
534
|
+
* whenever the strategy carries one, which the picker reads before the
|
|
535
|
+
* configured reach. A boot restore's preflight never meets this: a new
|
|
536
|
+
* strategy has no window.
|
|
256
537
|
*/
|
|
257
538
|
planRuntimeSettings(patch) {
|
|
258
539
|
if (patch && Object.keys(patch).length > 0) {
|
|
259
540
|
this.validateRuntimeSettingsPatch(patch);
|
|
260
541
|
}
|
|
261
542
|
const hot = this.getHotContextSettings();
|
|
262
|
-
const live = this.
|
|
543
|
+
const { liveBudgetTokens: live, path } = this.runtimeBudgetPath(patch);
|
|
544
|
+
const budget = patch?.contextBudgetTokens;
|
|
263
545
|
const overrides = {};
|
|
264
546
|
if (patch?.tailTokens !== undefined) {
|
|
265
547
|
overrides.recentWindowTokens = patch.tailTokens;
|
|
266
548
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
549
|
+
// A window is prepared at the next compile when this patch arms a
|
|
550
|
+
// descent, or leaves one in flight alone; an immediate change clears it.
|
|
551
|
+
const prepared = hot !== null && (path === 'paced' || (path === 'none' && hot.preparedWindowTokens !== undefined));
|
|
552
|
+
const reach = prepared
|
|
553
|
+
? patch?.transitionPaceTokens ?? hot.transitionPaceTokens ?? DEFAULT_TRANSITION_PACE_TOKENS
|
|
554
|
+
: this.configuredTransitionPaceTokens;
|
|
555
|
+
if (reach !== undefined && reach !== this.configuredTransitionPaceTokens) {
|
|
556
|
+
overrides.kvStableReachTokens = reach;
|
|
270
557
|
}
|
|
271
|
-
if (
|
|
558
|
+
if (budget === undefined) {
|
|
272
559
|
return { effectiveBudgetTokens: live, liveBudgetTokens: live, path: 'none', overrides };
|
|
273
560
|
}
|
|
274
|
-
if (
|
|
275
|
-
return {
|
|
276
|
-
effectiveBudgetTokens: patch.contextBudgetTokens,
|
|
277
|
-
liveBudgetTokens: live,
|
|
278
|
-
path: 'immediate',
|
|
279
|
-
overrides,
|
|
280
|
-
};
|
|
561
|
+
if (path === 'immediate') {
|
|
562
|
+
return { effectiveBudgetTokens: budget, liveBudgetTokens: live, path, overrides };
|
|
281
563
|
}
|
|
282
564
|
return {
|
|
283
565
|
effectiveBudgetTokens: live,
|
|
284
566
|
liveBudgetTokens: live,
|
|
285
|
-
advisoryTargetTokens:
|
|
567
|
+
advisoryTargetTokens: budget,
|
|
286
568
|
path: 'paced',
|
|
287
569
|
overrides,
|
|
288
570
|
};
|
|
@@ -306,6 +588,8 @@ export class Agent {
|
|
|
306
588
|
let nextContextBudget = this.contextBudgetTokens;
|
|
307
589
|
let nextContextTarget = this.contextBudgetTargetTokens;
|
|
308
590
|
let appliedDefaultPace = false;
|
|
591
|
+
// A paced decrease arms a descent, even to the target already set.
|
|
592
|
+
let armed = false;
|
|
309
593
|
const hotPatch = {};
|
|
310
594
|
if (patch.tailTokens !== undefined)
|
|
311
595
|
hotPatch.tailTokens = patch.tailTokens;
|
|
@@ -335,23 +619,25 @@ export class Agent {
|
|
|
335
619
|
}
|
|
336
620
|
hotPatch.preparedWindowTokens = patch.contextBudgetTokens - this.maxTokens;
|
|
337
621
|
nextContextTarget = patch.contextBudgetTokens;
|
|
622
|
+
armed = true;
|
|
338
623
|
}
|
|
339
624
|
}
|
|
340
625
|
if (Object.keys(hotPatch).length > 0) {
|
|
341
626
|
this.updateHotContextSettings(hotPatch);
|
|
342
627
|
}
|
|
343
|
-
this.
|
|
344
|
-
|
|
628
|
+
this.setContextBudget(nextContextBudget, nextContextTarget, armed);
|
|
629
|
+
// A budget written here is a decision about it, whatever its value: the
|
|
630
|
+
// boot's at-once fallback (restoredAtOnce) no longer speaks for it.
|
|
631
|
+
if (patch.contextBudgetTokens !== undefined)
|
|
632
|
+
this.restoredAtOnce = false;
|
|
345
633
|
if (appliedDefaultPace) {
|
|
346
634
|
this.runtimeSettingsOverrides.transitionPaceTokens = DEFAULT_TRANSITION_PACE_TOKENS;
|
|
347
635
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (key
|
|
352
|
-
|
|
353
|
-
if (value !== undefined)
|
|
354
|
-
this.runtimeSettingsOverrides[key] = value;
|
|
636
|
+
// Only settings reach the override map: `immediate` is a mode for this
|
|
637
|
+
// apply, and nothing else a caller passes is a setting.
|
|
638
|
+
for (const key of ['contextBudgetTokens', 'tailTokens', 'transitionPaceTokens']) {
|
|
639
|
+
if (patch[key] !== undefined)
|
|
640
|
+
this.runtimeSettingsOverrides[key] = patch[key];
|
|
355
641
|
}
|
|
356
642
|
if (patch.sameRoundThinkTextPolicy !== undefined) {
|
|
357
643
|
this.runtimeSettingsOverrides.sameRoundThinkTextPolicy = patch.sameRoundThinkTextPolicy;
|
|
@@ -362,6 +648,8 @@ export class Agent {
|
|
|
362
648
|
const reset = new Set(keys ?? ['contextBudgetTokens', 'tailTokens', 'transitionPaceTokens', 'sameRoundThinkTextPolicy']);
|
|
363
649
|
let nextContextBudget = this.contextBudgetTokens;
|
|
364
650
|
let nextContextTarget = this.contextBudgetTargetTokens;
|
|
651
|
+
// A reset to a recipe budget below the live one arms a descent to it.
|
|
652
|
+
let armed = false;
|
|
365
653
|
const hotPatch = {};
|
|
366
654
|
if (reset.has('contextBudgetTokens')) {
|
|
367
655
|
const configured = this.configuredContextBudgetTokens ?? DEFAULT_CONTEXT_BUDGET_TOKENS;
|
|
@@ -375,6 +663,7 @@ export class Agent {
|
|
|
375
663
|
hotPatch.transitionPaceTokens = DEFAULT_TRANSITION_PACE_TOKENS;
|
|
376
664
|
}
|
|
377
665
|
nextContextTarget = configured;
|
|
666
|
+
armed = true;
|
|
378
667
|
}
|
|
379
668
|
else {
|
|
380
669
|
nextContextBudget = this.configuredContextBudgetTokens;
|
|
@@ -395,10 +684,11 @@ export class Agent {
|
|
|
395
684
|
}
|
|
396
685
|
if (Object.keys(hotPatch).length > 0)
|
|
397
686
|
this.updateHotContextSettings(hotPatch);
|
|
398
|
-
this.
|
|
399
|
-
|
|
400
|
-
if (reset.has('contextBudgetTokens'))
|
|
687
|
+
this.setContextBudget(nextContextBudget, nextContextTarget, armed);
|
|
688
|
+
if (reset.has('contextBudgetTokens')) {
|
|
401
689
|
delete this.runtimeSettingsOverrides.contextBudgetTokens;
|
|
690
|
+
this.restoredAtOnce = false;
|
|
691
|
+
}
|
|
402
692
|
if (reset.has('tailTokens'))
|
|
403
693
|
delete this.runtimeSettingsOverrides.tailTokens;
|
|
404
694
|
if (reset.has('transitionPaceTokens')) {
|
|
@@ -412,7 +702,7 @@ export class Agent {
|
|
|
412
702
|
cancelRuntimeSettingsTransition() {
|
|
413
703
|
if (this.contextBudgetTargetTokens !== undefined) {
|
|
414
704
|
this.updateHotContextSettings({ preparedWindowTokens: null });
|
|
415
|
-
this.
|
|
705
|
+
this.setContextBudget(this.contextBudgetTokens, undefined);
|
|
416
706
|
const live = this.contextBudgetTokens ?? DEFAULT_CONTEXT_BUDGET_TOKENS;
|
|
417
707
|
if (live === (this.configuredContextBudgetTokens ?? DEFAULT_CONTEXT_BUDGET_TOKENS)) {
|
|
418
708
|
delete this.runtimeSettingsOverrides.contextBudgetTokens;
|
|
@@ -423,10 +713,52 @@ export class Agent {
|
|
|
423
713
|
}
|
|
424
714
|
return this.getRuntimeSettings();
|
|
425
715
|
}
|
|
426
|
-
|
|
427
|
-
|
|
716
|
+
/**
|
|
717
|
+
* Apply persisted settings at construction. `provenBudget` is a budget the
|
|
718
|
+
* caller has shown fits (the framework, from the record and a preflight),
|
|
719
|
+
* applied at once: it stands as the last compile's until a compile here
|
|
720
|
+
* says otherwise. When it's below the live budget, where the proof is what
|
|
721
|
+
* took the restore off the paced path, a refusal of a compile at it
|
|
722
|
+
* restores it paced instead, until the budget is next written or a compile
|
|
723
|
+
* at it fits. At or above the live budget, the restore is at once either
|
|
724
|
+
* way, and a refusal has nothing to fall back to.
|
|
725
|
+
*/
|
|
726
|
+
restoreRuntimeSettings(settings, opts) {
|
|
727
|
+
if (Object.keys(settings).length === 0)
|
|
728
|
+
return this.getRuntimeSettings();
|
|
729
|
+
const live = this.contextBudgetTokens ?? DEFAULT_CONTEXT_BUDGET_TOKENS;
|
|
730
|
+
const snapshot = this.updateRuntimeSettings(settings);
|
|
731
|
+
if (opts?.provenBudget !== undefined) {
|
|
732
|
+
this.lastCompiledBudget = { budget: opts.provenBudget, fit: true, epoch: this.liveBudgetEpoch };
|
|
733
|
+
this.restoredAtOnce = opts.provenBudget < live;
|
|
734
|
+
}
|
|
735
|
+
return snapshot;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Keep a persisted budget, tail or pace that couldn't be applied at
|
|
739
|
+
* construction: it stays in the override map, unapplied, so a later
|
|
740
|
+
* persisting write keeps it in the record. A budget is reported as the one
|
|
741
|
+
* set (`contextBudgetTokens`) beside the one compiles plan at
|
|
742
|
+
* (`effectiveContextBudgetTokens`); a tail or pace stays the strategy's.
|
|
743
|
+
*/
|
|
744
|
+
keepRuntimeSettings(settings) {
|
|
745
|
+
for (const key of ['contextBudgetTokens', 'tailTokens', 'transitionPaceTokens']) {
|
|
746
|
+
if (settings[key] !== undefined)
|
|
747
|
+
this.runtimeSettingsOverrides[key] = settings[key];
|
|
748
|
+
}
|
|
428
749
|
}
|
|
429
750
|
validateRuntimeSettingsPatch(patch) {
|
|
751
|
+
this.checkRuntimeSettingsPatch(patch);
|
|
752
|
+
if ((patch.tailTokens !== undefined || patch.transitionPaceTokens !== undefined) &&
|
|
753
|
+
!this.getHotContextSettings()) {
|
|
754
|
+
throw new Error('The active context strategy does not support live tail/transition settings');
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* The checks of a runtime-settings patch that need nothing from the context manager.
|
|
759
|
+
* @internal For the framework's runtime-settings preview; not a host API.
|
|
760
|
+
*/
|
|
761
|
+
checkRuntimeSettingsPatch(patch) {
|
|
430
762
|
if (Object.keys(patch).length === 0)
|
|
431
763
|
throw new Error('At least one setting is required');
|
|
432
764
|
if (patch.contextBudgetTokens !== undefined) {
|
|
@@ -447,35 +779,54 @@ export class Agent {
|
|
|
447
779
|
patch.sameRoundThinkTextPolicy !== 'private') {
|
|
448
780
|
throw new Error("sameRoundThinkTextPolicy must be 'public' or 'private'");
|
|
449
781
|
}
|
|
450
|
-
if ((patch.tailTokens !== undefined || patch.transitionPaceTokens !== undefined) &&
|
|
451
|
-
!this.getHotContextSettings()) {
|
|
452
|
-
throw new Error('The active context strategy does not support live tail/transition settings');
|
|
453
|
-
}
|
|
454
782
|
}
|
|
783
|
+
/** Settle a converging budget once the window is prepared; true if it settled. */
|
|
455
784
|
settleRuntimeSettingsTransition() {
|
|
456
785
|
if (this.contextBudgetTargetTokens === undefined)
|
|
457
|
-
return;
|
|
786
|
+
return false;
|
|
458
787
|
const hot = this.getHotContextSettings();
|
|
459
788
|
if (!hot?.prepared)
|
|
460
|
-
return;
|
|
461
|
-
this.
|
|
462
|
-
this.contextBudgetTargetTokens = undefined;
|
|
789
|
+
return false;
|
|
790
|
+
this.setContextBudget(this.contextBudgetTargetTokens, undefined);
|
|
463
791
|
this.updateHotContextSettings({ preparedWindowTokens: null });
|
|
792
|
+
return true;
|
|
464
793
|
}
|
|
465
794
|
/**
|
|
466
795
|
* RFC-006 consumed watermark: the newest stored message at the last compile
|
|
467
|
-
* of a model request,
|
|
796
|
+
* of a model request, or at the last tool boundary that injected messages
|
|
797
|
+
* into a live one, per branch. Everything above it has never been in a
|
|
468
798
|
* request and may still be replaced or withdrawn in place by its sender.
|
|
469
799
|
*/
|
|
470
800
|
consumedWatermark = null;
|
|
801
|
+
/** Counts marks: a compile writes its watermark back only if no mark was
|
|
802
|
+
* made while it ran (a tool boundary's, or another compile's). */
|
|
803
|
+
watermarkMarks = 0;
|
|
471
804
|
getConsumedWatermark() {
|
|
472
805
|
return this.consumedWatermark;
|
|
473
806
|
}
|
|
474
|
-
/** Mark everything currently stored as consumed (
|
|
807
|
+
/** Mark everything currently stored as consumed (the agent's creation, at
|
|
808
|
+
* boot or later, and a tool boundary that injected messages into the live
|
|
809
|
+
* stream). */
|
|
475
810
|
markContextConsumed() {
|
|
476
811
|
// Tolerates partial context-manager doubles (tests build Agents over
|
|
477
812
|
// stubs): without a watermark nothing is ever treated as unread.
|
|
478
813
|
this.consumedWatermark = this.pendingWatermark();
|
|
814
|
+
this.watermarkMarks++;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* A finished compile's watermark, taken before it awaited. Within a branch
|
|
818
|
+
* the watermark only advances: if a mark was made while the compile ran,
|
|
819
|
+
* the compile's (older) one is applied only where it is later on that
|
|
820
|
+
* mark's branch, so a boundary's mark is never rolled back by a compile
|
|
821
|
+
* that started before it (a preview during a live turn).
|
|
822
|
+
*/
|
|
823
|
+
applyCompileWatermark(watermark, marksBefore) {
|
|
824
|
+
const current = this.consumedWatermark;
|
|
825
|
+
if (this.watermarkMarks !== marksBefore && current
|
|
826
|
+
&& (current.branch !== watermark.branch || current.sequence >= watermark.sequence))
|
|
827
|
+
return;
|
|
828
|
+
this.consumedWatermark = watermark;
|
|
829
|
+
this.watermarkMarks++;
|
|
479
830
|
}
|
|
480
831
|
/** The watermark a successful compile will establish (taken before, applied after). */
|
|
481
832
|
pendingWatermark() {
|
|
@@ -498,29 +849,58 @@ export class Agent {
|
|
|
498
849
|
return null;
|
|
499
850
|
}
|
|
500
851
|
}
|
|
852
|
+
/** A committing compile, as for a request that is sent: the context
|
|
853
|
+
* manager commits what it commits for one, the consumed watermark moves,
|
|
854
|
+
* and a prepared budget change settles. To inspect what the agent would
|
|
855
|
+
* see, use the framework's `previewActivation`, which compiles as a dry
|
|
856
|
+
* run. */
|
|
501
857
|
async compileContext(budget) {
|
|
502
858
|
// RFC-006 §3.3: consumption is determined at assembly — a compile that
|
|
503
859
|
// fails assembled nothing, so the watermark moves only on success.
|
|
504
860
|
const watermark = this.pendingWatermark();
|
|
505
|
-
const
|
|
861
|
+
const marksBefore = this.watermarkMarks;
|
|
862
|
+
const compile = () => this.contextManager.compile(this.compileBudget(budget));
|
|
863
|
+
const result = budget ? await compile() : await this.compileAtLiveBudget(compile);
|
|
506
864
|
if (watermark)
|
|
507
|
-
this.
|
|
508
|
-
if (!budget)
|
|
509
|
-
this.settleRuntimeSettingsTransition();
|
|
865
|
+
this.applyCompileWatermark(watermark, marksBefore);
|
|
510
866
|
return result;
|
|
511
867
|
}
|
|
512
868
|
/**
|
|
513
|
-
* Compile the context with injections.
|
|
514
|
-
*
|
|
515
|
-
*
|
|
869
|
+
* Compile the context with injections (e.g. from MCPL servers), which the
|
|
870
|
+
* context manager merges into the compiled messages. Without
|
|
871
|
+
* `opts.dryRun` it commits as `compileContext` does: the consumed
|
|
872
|
+
* watermark moves, and a compile at the live window settles a prepared
|
|
873
|
+
* budget change. With `opts.dryRun`, for a compile that will never be
|
|
874
|
+
* sent, it does neither (see below).
|
|
516
875
|
*/
|
|
517
876
|
async compileWithInjections(budget, injections, opts) {
|
|
518
|
-
|
|
519
|
-
|
|
877
|
+
// A dry run is a compile that will never be sent. The context manager
|
|
878
|
+
// persists no fold resolutions for it and queues none of the compression
|
|
879
|
+
// or merge work its fold plan calls for. Its thinking binding
|
|
880
|
+
// (context-manager#160, not yet released) will commit stamps and add a
|
|
881
|
+
// compile awaiting acceptance for a committing compile only. Here nothing
|
|
882
|
+
// moves either: the agent never read what a dry run assembled, so the
|
|
883
|
+
// consumed watermark stays. A dry run proves nothing about the budget
|
|
884
|
+
// either, so it goes straight to the compile, around
|
|
885
|
+
// compileAtLiveBudget: it settles no descent (a prepared budget change
|
|
886
|
+
// waits for the compile that is sent), notes no compiled budget, and
|
|
887
|
+
// restores nothing the boot applied at once, whether it fits or is
|
|
888
|
+
// refused.
|
|
889
|
+
//
|
|
890
|
+
// Context-manager 0.14 leaves what a select leaves behind as the last
|
|
891
|
+
// committing compile left it, on every path out of a dry run, throws
|
|
892
|
+
// included: no chunk record and no compression queued for a chunk the
|
|
893
|
+
// dry run closes, no calibration, and none of the bookkeeping the next
|
|
894
|
+
// compile or an observer reads (its `SelectOptions.dryRun` gives the
|
|
895
|
+
// contract). The one thing a dry run can still leave is the release of a
|
|
896
|
+
// compression hold whose deadline has passed, which `compile` does for
|
|
897
|
+
// any compile before it selects.
|
|
898
|
+
const watermark = opts?.dryRun ? null : this.pendingWatermark();
|
|
899
|
+
const marksBefore = this.watermarkMarks;
|
|
900
|
+
const compile = () => this.contextManager.compile(this.compileBudget(budget), injections, opts);
|
|
901
|
+
const result = budget || opts?.dryRun ? await compile() : await this.compileAtLiveBudget(compile);
|
|
520
902
|
if (watermark)
|
|
521
|
-
this.
|
|
522
|
-
if (!budget)
|
|
523
|
-
this.settleRuntimeSettingsTransition();
|
|
903
|
+
this.applyCompileWatermark(watermark, marksBefore);
|
|
524
904
|
return result;
|
|
525
905
|
}
|
|
526
906
|
// ==========================================================================
|
|
@@ -577,15 +957,8 @@ export class Agent {
|
|
|
577
957
|
return {
|
|
578
958
|
messages: this.toolResultGuard.prepareRequest(messages, true),
|
|
579
959
|
system: this.buildSystemPrompt(systemInjections),
|
|
580
|
-
config: {
|
|
581
|
-
model: this.model,
|
|
582
|
-
maxTokens: this.maxTokens,
|
|
583
|
-
...(this.temperature !== undefined && { temperature: this.temperature }),
|
|
584
|
-
...(this.thinking !== undefined && { thinking: this.thinking }),
|
|
585
|
-
},
|
|
586
960
|
tools: tools.length > 0 ? tools : undefined,
|
|
587
|
-
...
|
|
588
|
-
assistantParticipant: this.name,
|
|
961
|
+
...this.requestSettings(),
|
|
589
962
|
};
|
|
590
963
|
};
|
|
591
964
|
const request = await assemble();
|
|
@@ -657,7 +1030,12 @@ export class Agent {
|
|
|
657
1030
|
this._state.completed.push(completed);
|
|
658
1031
|
// If all tools done, transition to ready
|
|
659
1032
|
if (this._state.pending.size === 0) {
|
|
660
|
-
this._state = {
|
|
1033
|
+
this._state = {
|
|
1034
|
+
status: 'ready',
|
|
1035
|
+
toolResults: this._state.completed,
|
|
1036
|
+
stream: this._state.stream,
|
|
1037
|
+
supportsInjectedMessages: this._state.supportsInjectedMessages,
|
|
1038
|
+
};
|
|
661
1039
|
}
|
|
662
1040
|
}
|
|
663
1041
|
/**
|
|
@@ -671,12 +1049,18 @@ export class Agent {
|
|
|
671
1049
|
* Build the membrane-normalized request that WOULD be emitted for this
|
|
672
1050
|
* agent's next activation, given the supplied tools and injections.
|
|
673
1051
|
*
|
|
674
|
-
* This is the single source of truth for
|
|
675
|
-
* real activation path (`startStreamWithInjections`) and
|
|
676
|
-
* tooling (`Framework.previewActivation`). It
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
1052
|
+
* This is the single source of truth for a framework turn's request,
|
|
1053
|
+
* shared by the real activation path (`startStreamWithInjections`) and
|
|
1054
|
+
* debug/preview tooling (`Framework.previewActivation`). It does not call
|
|
1055
|
+
* the membrane. The direct API (`runInferenceWithInjections`) assembles its
|
|
1056
|
+
* own messages, system prompt and tools, and both take the agent's
|
|
1057
|
+
* settings from `requestSettings()`.
|
|
1058
|
+
* A compile that is sent commits what the context manager commits for it
|
|
1059
|
+
* (fold resolutions, the compression its fold plan calls for, the consumed
|
|
1060
|
+
* watermark); a preview passes `options.dryRun`, so its compile commits
|
|
1061
|
+
* none of that (see `compileWithInjections` for what a dry run still
|
|
1062
|
+
* leaves). Either way the context manager is handed the compression tool
|
|
1063
|
+
* definitions. Safe to call regardless of the agent's current status.
|
|
680
1064
|
* It doesn't wait for the tool-result guard's annotations, so a preview
|
|
681
1065
|
* never waits on a workspace write (rollback, undo and redo report one), and
|
|
682
1066
|
* may show a withheld stub before its place is added; the activation waits
|
|
@@ -704,7 +1088,12 @@ export class Agent {
|
|
|
704
1088
|
system: this.buildSystemPrompt(prospectiveSystemInjections),
|
|
705
1089
|
})
|
|
706
1090
|
: undefined;
|
|
707
|
-
let { messages, systemInjections } = await this.compileWithInjections(budget, injections, immutablePrefixHash
|
|
1091
|
+
let { messages, systemInjections } = await this.compileWithInjections(budget, injections, immutablePrefixHash || options.dryRun
|
|
1092
|
+
? {
|
|
1093
|
+
...(immutablePrefixHash ? { kvUnifiedImmutablePrefixHash: immutablePrefixHash } : {}),
|
|
1094
|
+
...(options.dryRun ? { dryRun: true } : {}),
|
|
1095
|
+
}
|
|
1096
|
+
: undefined);
|
|
708
1097
|
// Sanitize: strip empty/whitespace text blocks and drop messages left with
|
|
709
1098
|
// no content. The Anthropic API rejects empty text blocks with 400
|
|
710
1099
|
// "messages: text content blocks must be non-empty"; when such a block
|
|
@@ -751,15 +1140,28 @@ export class Agent {
|
|
|
751
1140
|
return {
|
|
752
1141
|
messages: this.toolResultGuard.prepareRequest(messages),
|
|
753
1142
|
system: this.buildSystemPrompt(systemInjections),
|
|
1143
|
+
tools: availableTools.length > 0 ? availableTools : undefined,
|
|
1144
|
+
...this.requestSettings(),
|
|
1145
|
+
...(kvUnified ? { cacheMarkers: 'cm-owned' } : {}),
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* The request fields that come from this agent's own settings: its model
|
|
1150
|
+
* config, prompt caching and cache TTL, prefill message, provider
|
|
1151
|
+
* parameters and participant name. Every request the agent sends takes
|
|
1152
|
+
* them from here, a framework turn's (buildActivationRequest) and the
|
|
1153
|
+
* direct API's (runInferenceWithInjections), so a setting reaches both or
|
|
1154
|
+
* neither.
|
|
1155
|
+
*/
|
|
1156
|
+
requestSettings() {
|
|
1157
|
+
return {
|
|
754
1158
|
config: {
|
|
755
1159
|
model: this.model,
|
|
756
1160
|
maxTokens: this.maxTokens,
|
|
757
1161
|
...(this.temperature !== undefined && { temperature: this.temperature }),
|
|
758
1162
|
...(this.thinking !== undefined && { thinking: this.thinking }),
|
|
759
1163
|
},
|
|
760
|
-
tools: availableTools.length > 0 ? availableTools : undefined,
|
|
761
1164
|
promptCaching: this.promptCaching,
|
|
762
|
-
...(kvUnified ? { cacheMarkers: 'cm-owned' } : {}),
|
|
763
1165
|
cacheTtl: this.cacheTtl,
|
|
764
1166
|
...(this.prefillUserMessage && { prefillUserMessage: this.prefillUserMessage }),
|
|
765
1167
|
...(this.providerParams && { providerParams: this.providerParams }),
|
|
@@ -811,16 +1213,28 @@ export class Agent {
|
|
|
811
1213
|
// flight" (devops agent, 2026-09-16 07:33Z, no provider error logged).
|
|
812
1214
|
this.failOpenKvSubmissions();
|
|
813
1215
|
this._streamId++;
|
|
1216
|
+
// A pending cancel belongs to the stream that was live when cancelStream()
|
|
1217
|
+
// ran. The stream driver collects it on that stream's terminal event, or
|
|
1218
|
+
// at the loop's end when the iterator closed without one, while the
|
|
1219
|
+
// stream still owns the agent. This clear is for the records no driver
|
|
1220
|
+
// collects: a dropped turn's, whose stream no driver iterates; one whose
|
|
1221
|
+
// stream's terminal came after another stream took the agent; or a
|
|
1222
|
+
// cancel after the stream's complete event. A fresh stream must not
|
|
1223
|
+
// inherit one and read its own later error as a deliberate stop.
|
|
1224
|
+
this._pendingCancel = undefined;
|
|
814
1225
|
this._inferenceStartedAt = Date.now();
|
|
815
1226
|
this.lastStreamInputTokens = 0;
|
|
816
1227
|
// Reset the cache-inclusive counters too: a new stream must not inherit
|
|
817
1228
|
// the prior stream's window size — on the physical-window restart path
|
|
818
1229
|
// that inherited value IS the oversized number that caused the restart,
|
|
819
1230
|
// and projecting on it before this stream's first usage event would
|
|
820
|
-
// restart again (loop). The `> 0` guard downstream means "no
|
|
821
|
-
//
|
|
1231
|
+
// restart again (loop). The `> 0` guard downstream means "no call on
|
|
1232
|
+
// THIS stream has reported a prompt yet" only because of this reset (a
|
|
1233
|
+
// call that reports none leaves these as they were, and adds to
|
|
1234
|
+
// lastStreamUnreportedTokens instead).
|
|
822
1235
|
this.lastStreamRealInputTokens = 0;
|
|
823
1236
|
this.lastStreamOutputTokens = 0;
|
|
1237
|
+
this.lastStreamUnreportedTokens = 0;
|
|
824
1238
|
// Compiled only once each withheld stub's annotation has finished,
|
|
825
1239
|
// including one that began during the compile, and after a stub edit that
|
|
826
1240
|
// failed has been retried (see afterAnnotations).
|
|
@@ -898,9 +1312,10 @@ export class Agent {
|
|
|
898
1312
|
}
|
|
899
1313
|
/**
|
|
900
1314
|
* Transition to waiting_for_tools when stream yields tool calls.
|
|
901
|
-
* Called by framework's driveStream
|
|
1315
|
+
* Called by framework's driveStream, with what the stream declared about
|
|
1316
|
+
* carrying injected messages with this round's results (see AgentState).
|
|
902
1317
|
*/
|
|
903
|
-
enterWaitingForTools(calls, stream) {
|
|
1318
|
+
enterWaitingForTools(calls, stream, supportsInjectedMessages) {
|
|
904
1319
|
const pending = new Map();
|
|
905
1320
|
for (const call of calls) {
|
|
906
1321
|
pending.set(call.id, {
|
|
@@ -910,7 +1325,7 @@ export class Agent {
|
|
|
910
1325
|
startedAt: Date.now(),
|
|
911
1326
|
});
|
|
912
1327
|
}
|
|
913
|
-
this._state = { status: 'waiting_for_tools', pending, completed: [], stream };
|
|
1328
|
+
this._state = { status: 'waiting_for_tools', pending, completed: [], stream, supportsInjectedMessages };
|
|
914
1329
|
}
|
|
915
1330
|
/**
|
|
916
1331
|
* Add an assistant response to context.
|
|
@@ -946,18 +1361,39 @@ export class Agent {
|
|
|
946
1361
|
setStreaming(stream) {
|
|
947
1362
|
this._state = { status: 'streaming', stream };
|
|
948
1363
|
}
|
|
1364
|
+
/** The most recent cancelStream() of a live stream, until the stream
|
|
1365
|
+
* driver collects it on that stream's terminal event. Its presence is
|
|
1366
|
+
* the signal (a reasonless Stop is still a deliberate stop); its reason
|
|
1367
|
+
* is the caller's own word. Membrane reports every cancel() as reason
|
|
1368
|
+
* 'user' — the call, not the actor — and a stream implementation may
|
|
1369
|
+
* report the cancel as `error` with no reason at all, so this record is
|
|
1370
|
+
* the only provenance a host-side cancel has. */
|
|
1371
|
+
_pendingCancel;
|
|
949
1372
|
/**
|
|
950
|
-
* Cancel
|
|
1373
|
+
* Cancel the stream this agent's state holds (streaming, waiting on its
|
|
1374
|
+
* tools, or ready at a tool boundary with every result in), and reset to
|
|
1375
|
+
* idle. `reason` is provenance for the framework's inference:aborted trace
|
|
1376
|
+
* and marker metadata (e.g. 'zombie_reclaim', 'subagent_cancel'); it never
|
|
1377
|
+
* reaches the provider.
|
|
951
1378
|
*/
|
|
952
|
-
cancelStream() {
|
|
953
|
-
if (this._state
|
|
954
|
-
this.
|
|
955
|
-
}
|
|
956
|
-
else if (this._state.status === 'waiting_for_tools' && this._state.stream) {
|
|
1379
|
+
cancelStream(reason) {
|
|
1380
|
+
if ('stream' in this._state && this._state.stream) {
|
|
1381
|
+
this._pendingCancel = { reason };
|
|
957
1382
|
this._state.stream.cancel();
|
|
958
1383
|
}
|
|
959
1384
|
this._state = { status: 'idle' };
|
|
960
1385
|
}
|
|
1386
|
+
/** Collect (and clear) the cancel that ended the current stream, if this
|
|
1387
|
+
* side issued one. The stream driver calls it once, while the stream
|
|
1388
|
+
* still owns the agent, at the stream's terminal event (`aborted`
|
|
1389
|
+
* normally, `error` for implementations that report cancel() that way)
|
|
1390
|
+
* or at the loop's end when the stream closed without one. A record no
|
|
1391
|
+
* driver collects is cleared when the agent's next stream starts. */
|
|
1392
|
+
takeCancel() {
|
|
1393
|
+
const c = this._pendingCancel;
|
|
1394
|
+
this._pendingCancel = undefined;
|
|
1395
|
+
return c;
|
|
1396
|
+
}
|
|
961
1397
|
/**
|
|
962
1398
|
* Check if agent has pending tool calls.
|
|
963
1399
|
*/
|
|
@@ -986,18 +1422,18 @@ export class Agent {
|
|
|
986
1422
|
return this.contextManager;
|
|
987
1423
|
}
|
|
988
1424
|
/**
|
|
989
|
-
* Build the effective system prompt, appending any system-position
|
|
1425
|
+
* Build the effective system prompt, appending any system-position
|
|
1426
|
+
* injections, their blocks joined by line breaks. The system prompt is
|
|
1427
|
+
* text, so a block of another type, such as an image a server or module
|
|
1428
|
+
* injected there, can't go in it: a line in its place says so. The hook
|
|
1429
|
+
* orchestrator tells a server's operator once per server and namespace,
|
|
1430
|
+
* and the module registry tells a module's once per module and namespace.
|
|
990
1431
|
*/
|
|
991
1432
|
buildSystemPrompt(systemInjections) {
|
|
992
1433
|
if (systemInjections.length === 0) {
|
|
993
1434
|
return this.systemPrompt;
|
|
994
1435
|
}
|
|
995
|
-
const injectedText = systemInjections
|
|
996
|
-
.filter((block) => block.type === 'text')
|
|
997
|
-
.map((block) => block.text);
|
|
998
|
-
if (injectedText.length === 0) {
|
|
999
|
-
return this.systemPrompt;
|
|
1000
|
-
}
|
|
1436
|
+
const injectedText = systemInjections.map((block) => block.type === 'text' ? block.text : `[${block.type} block not shown: the system prompt carries text only.]`);
|
|
1001
1437
|
return this.systemPrompt + '\n' + injectedText.join('\n');
|
|
1002
1438
|
}
|
|
1003
1439
|
abortInference(reason) {
|
|
@@ -1006,10 +1442,9 @@ export class Agent {
|
|
|
1006
1442
|
this._state.abortController.abort(reason);
|
|
1007
1443
|
return { aborted: true, durationMs };
|
|
1008
1444
|
}
|
|
1009
|
-
if (this._state
|
|
1010
|
-
(this._state.status === 'waiting_for_tools' && this._state.stream)) {
|
|
1445
|
+
if ('stream' in this._state && this._state.stream) {
|
|
1011
1446
|
const durationMs = Date.now() - this._inferenceStartedAt;
|
|
1012
|
-
this.cancelStream();
|
|
1447
|
+
this.cancelStream(reason);
|
|
1013
1448
|
return { aborted: true, durationMs };
|
|
1014
1449
|
}
|
|
1015
1450
|
return false;
|