@animalabs/agent-framework 0.22.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -4
- package/dist/src/agent.d.ts +108 -17
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +207 -67
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/mcp-server-core.js +1 -1
- package/dist/src/api/mcp-server-core.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +5 -1
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/api/types.d.ts +1 -1
- package/dist/src/api/types.d.ts.map +1 -1
- package/dist/src/branch-names.d.ts +14 -0
- package/dist/src/branch-names.d.ts.map +1 -0
- package/dist/src/branch-names.js +22 -0
- package/dist/src/branch-names.js.map +1 -0
- package/dist/src/closest-names.d.ts +28 -0
- package/dist/src/closest-names.d.ts.map +1 -0
- package/dist/src/closest-names.js +98 -0
- package/dist/src/closest-names.js.map +1 -0
- package/dist/src/code-execution/index.d.ts +1 -1
- package/dist/src/code-execution/index.d.ts.map +1 -1
- package/dist/src/code-execution/index.js.map +1 -1
- package/dist/src/code-execution/py-runner.d.ts +50 -7
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +258 -90
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts +3 -2
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +94 -8
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/code-execution/tool-definition.d.ts +17 -1
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +72 -6
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/config-checks.d.ts +28 -0
- package/dist/src/config-checks.d.ts.map +1 -0
- package/dist/src/config-checks.js +56 -0
- package/dist/src/config-checks.js.map +1 -0
- package/dist/src/deadline-timer.d.ts +21 -0
- package/dist/src/deadline-timer.d.ts.map +1 -0
- package/dist/src/deadline-timer.js +43 -0
- package/dist/src/deadline-timer.js.map +1 -0
- package/dist/src/error-message.d.ts +30 -0
- package/dist/src/error-message.d.ts.map +1 -0
- package/dist/src/error-message.js +50 -0
- package/dist/src/error-message.js.map +1 -0
- package/dist/src/framework.d.ts +1529 -165
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +8264 -1939
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +8 -0
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +36 -5
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/held-writes.d.ts +16 -0
- package/dist/src/held-writes.d.ts.map +1 -0
- package/dist/src/held-writes.js +56 -0
- package/dist/src/held-writes.js.map +1 -0
- package/dist/src/index.d.ts +10 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-grant.d.ts +4 -0
- package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
- package/dist/src/mcpl/capability-grant.js +1 -1
- package/dist/src/mcpl/capability-grant.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +233 -18
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +975 -386
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts +21 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.js +91 -30
- package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +19 -3
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +23 -8
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts +20 -0
- package/dist/src/mcpl/convert-block.d.ts.map +1 -0
- package/dist/src/mcpl/convert-block.js +88 -0
- package/dist/src/mcpl/convert-block.js.map +1 -0
- package/dist/src/mcpl/errors.d.ts +13 -0
- package/dist/src/mcpl/errors.d.ts.map +1 -1
- package/dist/src/mcpl/errors.js +28 -0
- package/dist/src/mcpl/errors.js.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.d.ts +23 -0
- package/dist/src/mcpl/hook-orchestrator.d.ts.map +1 -1
- package/dist/src/mcpl/hook-orchestrator.js +83 -72
- package/dist/src/mcpl/hook-orchestrator.js.map +1 -1
- package/dist/src/mcpl/inbound-source.d.ts +114 -0
- package/dist/src/mcpl/inbound-source.d.ts.map +1 -0
- package/dist/src/mcpl/inbound-source.js +83 -0
- package/dist/src/mcpl/inbound-source.js.map +1 -0
- package/dist/src/mcpl/index.d.ts +7 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +5 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +19 -13
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +155 -87
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +7 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -1
- package/dist/src/mcpl/log-value.js +9 -0
- package/dist/src/mcpl/log-value.js.map +1 -1
- package/dist/src/mcpl/modern-connection.d.ts +227 -0
- package/dist/src/mcpl/modern-connection.d.ts.map +1 -0
- package/dist/src/mcpl/modern-connection.js +1088 -0
- package/dist/src/mcpl/modern-connection.js.map +1 -0
- package/dist/src/mcpl/prefix-rule.d.ts +18 -0
- package/dist/src/mcpl/prefix-rule.d.ts.map +1 -0
- package/dist/src/mcpl/prefix-rule.js +25 -0
- package/dist/src/mcpl/prefix-rule.js.map +1 -0
- package/dist/src/mcpl/protocol-family.d.ts +179 -0
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -0
- package/dist/src/mcpl/protocol-family.js +697 -0
- package/dist/src/mcpl/protocol-family.js.map +1 -0
- package/dist/src/mcpl/push-coalescer.d.ts +58 -17
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +93 -32
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +16 -9
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +18 -83
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +76 -13
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +275 -66
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +98 -18
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +170 -32
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +406 -31
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +1331 -272
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts +35 -6
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +63 -13
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/skip-reply-wake.d.ts +36 -0
- package/dist/src/mcpl/skip-reply-wake.d.ts.map +1 -0
- package/dist/src/mcpl/skip-reply-wake.js +55 -0
- package/dist/src/mcpl/skip-reply-wake.js.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts +54 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.js +232 -0
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +104 -12
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +315 -85
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +76 -19
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +16 -0
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +26 -0
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +34 -6
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +119 -31
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/api/index.d.ts +1 -1
- package/dist/src/modules/api/index.d.ts.map +1 -1
- package/dist/src/modules/api/index.js +3 -2
- package/dist/src/modules/api/index.js.map +1 -1
- package/dist/src/modules/discord/discord-js-client.d.ts +43 -2
- package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.js +286 -67
- package/dist/src/modules/discord/discord-js-client.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +53 -5
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +712 -186
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/discord/refusal.d.ts +14 -0
- package/dist/src/modules/discord/refusal.d.ts.map +1 -0
- package/dist/src/modules/discord/refusal.js +14 -0
- package/dist/src/modules/discord/refusal.js.map +1 -0
- package/dist/src/modules/discord/types.d.ts +27 -4
- package/dist/src/modules/discord/types.d.ts.map +1 -1
- package/dist/src/modules/health/index.d.ts.map +1 -1
- package/dist/src/modules/health/index.js +8 -3
- package/dist/src/modules/health/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts +3 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js +359 -127
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts +28 -1
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js +177 -32
- package/dist/src/modules/history/semantic.js.map +1 -1
- package/dist/src/modules/index.d.ts +1 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -1
- package/dist/src/modules/index.js.map +1 -1
- package/dist/src/modules/unknown-tool.d.ts +10 -0
- package/dist/src/modules/unknown-tool.d.ts.map +1 -0
- package/dist/src/modules/unknown-tool.js +17 -0
- package/dist/src/modules/unknown-tool.js.map +1 -0
- package/dist/src/modules/workspace/disk-agreement.d.ts +57 -4
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +75 -7
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +66 -7
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +303 -46
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +313 -45
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +1404 -304
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +315 -16
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +727 -37
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts +58 -7
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +521 -56
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +28 -5
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/modules/workspace/watcher.d.ts +49 -2
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js +158 -29
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/prose-drafts.d.ts +240 -0
- package/dist/src/prose-drafts.d.ts.map +1 -0
- package/dist/src/prose-drafts.js +362 -0
- package/dist/src/prose-drafts.js.map +1 -0
- package/dist/src/prose-segments.d.ts +21 -2
- package/dist/src/prose-segments.d.ts.map +1 -1
- package/dist/src/prose-segments.js +46 -9
- package/dist/src/prose-segments.js.map +1 -1
- package/dist/src/recovery/offline-branch.d.ts +1 -0
- package/dist/src/recovery/offline-branch.d.ts.map +1 -1
- package/dist/src/recovery/offline-branch.js +3 -1
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/safe-slice.d.ts +5 -1
- package/dist/src/safe-slice.d.ts.map +1 -1
- package/dist/src/safe-slice.js +9 -1
- package/dist/src/safe-slice.js.map +1 -1
- package/dist/src/silent-heartbeat.d.ts +112 -39
- package/dist/src/silent-heartbeat.d.ts.map +1 -1
- package/dist/src/silent-heartbeat.js +100 -29
- package/dist/src/silent-heartbeat.js.map +1 -1
- package/dist/src/tool-args.d.ts +40 -0
- package/dist/src/tool-args.d.ts.map +1 -0
- package/dist/src/tool-args.js +207 -0
- package/dist/src/tool-args.js.map +1 -0
- package/dist/src/tool-image-ledger.d.ts +87 -19
- package/dist/src/tool-image-ledger.d.ts.map +1 -1
- package/dist/src/tool-image-ledger.js +135 -32
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-presentation.d.ts +9 -0
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +266 -62
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +7 -10
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +32 -3
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +106 -19
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts +25 -1
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- package/dist/src/tune-out/coordinator.js +260 -65
- package/dist/src/tune-out/coordinator.js.map +1 -1
- package/dist/src/types/agent.d.ts +44 -22
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +25 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +38 -7
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/inference-log.d.ts +1 -1
- package/dist/src/types/inference-log.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +77 -14
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +97 -8
- package/dist/src/types/trace.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.d.ts +5 -0
- package/dist/src/usage/usage-tracker.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.js +35 -8
- package/dist/src/usage/usage-tracker.js.map +1 -1
- package/package.json +5 -4
- package/src/agent.ts +257 -72
- package/src/api/mcp-server-core.ts +1 -1
- package/src/api/server.ts +4 -1
- package/src/api/types.ts +1 -1
- package/src/branch-names.ts +19 -0
- package/src/closest-names.ts +94 -0
- package/src/code-execution/index.ts +1 -0
- package/src/code-execution/py-runner.ts +304 -93
- package/src/code-execution/runtime-py.ts +94 -8
- package/src/code-execution/tool-definition.ts +85 -7
- package/src/config-checks.ts +50 -0
- package/src/deadline-timer.ts +44 -0
- package/src/error-message.ts +48 -0
- package/src/framework.ts +8625 -1984
- package/src/gate/event-gate.ts +38 -5
- package/src/held-writes.ts +59 -0
- package/src/index.ts +29 -5
- package/src/mcpl/capability-grant.ts +1 -1
- package/src/mcpl/channel-registry.ts +1095 -411
- package/src/mcpl/checkpoint-manager.ts +104 -29
- package/src/mcpl/conversation-router.ts +28 -8
- package/src/mcpl/convert-block.ts +105 -0
- package/src/mcpl/errors.ts +28 -0
- package/src/mcpl/hook-orchestrator.ts +84 -77
- package/src/mcpl/inbound-source.ts +156 -0
- package/src/mcpl/index.ts +23 -1
- package/src/mcpl/inference-router.ts +179 -103
- package/src/mcpl/log-value.ts +10 -0
- package/src/mcpl/modern-connection.ts +1182 -0
- package/src/mcpl/prefix-rule.ts +32 -0
- package/src/mcpl/protocol-family.ts +691 -0
- package/src/mcpl/push-coalescer.ts +110 -36
- package/src/mcpl/push-handler.ts +20 -90
- package/src/mcpl/reference-fetcher.ts +318 -67
- package/src/mcpl/references.ts +183 -34
- package/src/mcpl/server-connection.ts +1404 -280
- package/src/mcpl/server-registry.ts +63 -14
- package/src/mcpl/skip-reply-wake.ts +73 -0
- package/src/mcpl/tool-result-normalize.ts +294 -0
- package/src/mcpl/transport.ts +320 -76
- package/src/mcpl/types.ts +77 -19
- package/src/mcpl/visible-content.ts +28 -0
- package/src/module-registry.ts +126 -36
- package/src/modules/api/index.ts +3 -2
- package/src/modules/discord/discord-js-client.ts +306 -74
- package/src/modules/discord/index.ts +737 -201
- package/src/modules/discord/refusal.ts +13 -0
- package/src/modules/discord/types.ts +27 -6
- package/src/modules/health/index.ts +8 -3
- package/src/modules/history/index.ts +410 -120
- package/src/modules/history/semantic.ts +189 -32
- package/src/modules/index.ts +1 -1
- package/src/modules/unknown-tool.ts +16 -0
- package/src/modules/workspace/disk-agreement.ts +97 -8
- package/src/modules/workspace/effects.ts +291 -36
- package/src/modules/workspace/index.ts +1469 -321
- package/src/modules/workspace/observe.ts +784 -41
- package/src/modules/workspace/reconcile.ts +619 -64
- package/src/modules/workspace/types.ts +28 -5
- package/src/modules/workspace/watcher.ts +154 -30
- package/src/prose-drafts.ts +481 -0
- package/src/prose-segments.ts +51 -8
- package/src/recovery/offline-branch.ts +4 -1
- package/src/safe-slice.ts +9 -1
- package/src/silent-heartbeat.ts +184 -59
- package/src/tool-args.ts +213 -0
- package/src/tool-image-ledger.ts +153 -34
- package/src/tool-presentation.ts +233 -42
- package/src/tool-result-guard.ts +7 -8
- package/src/tool-result-history.ts +124 -20
- package/src/tune-out/coordinator.ts +259 -65
- package/src/types/agent.ts +44 -24
- package/src/types/events.ts +25 -0
- package/src/types/framework.ts +38 -7
- package/src/types/inference-log.ts +1 -1
- package/src/types/module.ts +79 -14
- package/src/types/trace.ts +103 -8
- package/src/usage/usage-tracker.ts +32 -8
- package/dist/test/activation-request-sanitize.test.d.ts +0 -2
- package/dist/test/activation-request-sanitize.test.d.ts.map +0 -1
- package/dist/test/activation-request-sanitize.test.js +0 -89
- package/dist/test/activation-request-sanitize.test.js.map +0 -1
- package/dist/test/agent-cache-ttl.test.d.ts +0 -2
- package/dist/test/agent-cache-ttl.test.d.ts.map +0 -1
- package/dist/test/agent-cache-ttl.test.js +0 -41
- package/dist/test/agent-cache-ttl.test.js.map +0 -1
- package/dist/test/agent-runtime-settings.test.d.ts +0 -2
- package/dist/test/agent-runtime-settings.test.d.ts.map +0 -1
- package/dist/test/agent-runtime-settings.test.js +0 -1598
- package/dist/test/agent-runtime-settings.test.js.map +0 -1
- package/dist/test/api-admin-gate.test.d.ts +0 -2
- package/dist/test/api-admin-gate.test.d.ts.map +0 -1
- package/dist/test/api-admin-gate.test.js +0 -116
- package/dist/test/api-admin-gate.test.js.map +0 -1
- package/dist/test/assistant-persist-refusal.test.d.ts +0 -2
- package/dist/test/assistant-persist-refusal.test.d.ts.map +0 -1
- package/dist/test/assistant-persist-refusal.test.js +0 -63
- package/dist/test/assistant-persist-refusal.test.js.map +0 -1
- package/dist/test/batched-wake-locus.test.d.ts +0 -2
- package/dist/test/batched-wake-locus.test.d.ts.map +0 -1
- package/dist/test/batched-wake-locus.test.js +0 -166
- package/dist/test/batched-wake-locus.test.js.map +0 -1
- package/dist/test/busy-agent-scheduler.test.d.ts +0 -2
- package/dist/test/busy-agent-scheduler.test.d.ts.map +0 -1
- package/dist/test/busy-agent-scheduler.test.js +0 -92
- package/dist/test/busy-agent-scheduler.test.js.map +0 -1
- package/dist/test/channel-incoming-targeting.test.d.ts +0 -2
- package/dist/test/channel-incoming-targeting.test.d.ts.map +0 -1
- package/dist/test/channel-incoming-targeting.test.js +0 -81
- package/dist/test/channel-incoming-targeting.test.js.map +0 -1
- package/dist/test/channel-label-history.test.d.ts +0 -2
- package/dist/test/channel-label-history.test.d.ts.map +0 -1
- package/dist/test/channel-label-history.test.js +0 -424
- package/dist/test/channel-label-history.test.js.map +0 -1
- package/dist/test/channel-lifecycle-provenance.test.d.ts +0 -2
- package/dist/test/channel-lifecycle-provenance.test.d.ts.map +0 -1
- package/dist/test/channel-lifecycle-provenance.test.js +0 -47
- package/dist/test/channel-lifecycle-provenance.test.js.map +0 -1
- package/dist/test/channel-registry-routing.test.d.ts +0 -2
- package/dist/test/channel-registry-routing.test.d.ts.map +0 -1
- package/dist/test/channel-registry-routing.test.js +0 -446
- package/dist/test/channel-registry-routing.test.js.map +0 -1
- package/dist/test/channel-registry-typing.test.d.ts +0 -2
- package/dist/test/channel-registry-typing.test.d.ts.map +0 -1
- package/dist/test/channel-registry-typing.test.js +0 -91
- package/dist/test/channel-registry-typing.test.js.map +0 -1
- package/dist/test/channels-changed-respond-first.test.d.ts +0 -2
- package/dist/test/channels-changed-respond-first.test.d.ts.map +0 -1
- package/dist/test/channels-changed-respond-first.test.js +0 -74
- package/dist/test/channels-changed-respond-first.test.js.map +0 -1
- package/dist/test/checkpoint-attribution.test.d.ts +0 -2
- package/dist/test/checkpoint-attribution.test.d.ts.map +0 -1
- package/dist/test/checkpoint-attribution.test.js +0 -200
- package/dist/test/checkpoint-attribution.test.js.map +0 -1
- package/dist/test/code-execution.test.d.ts +0 -11
- package/dist/test/code-execution.test.d.ts.map +0 -1
- package/dist/test/code-execution.test.js +0 -1272
- package/dist/test/code-execution.test.js.map +0 -1
- package/dist/test/component-defaults.test.d.ts +0 -2
- package/dist/test/component-defaults.test.d.ts.map +0 -1
- package/dist/test/component-defaults.test.js +0 -54
- package/dist/test/component-defaults.test.js.map +0 -1
- package/dist/test/conversation-fork-injection-scoping.test.d.ts +0 -2
- package/dist/test/conversation-fork-injection-scoping.test.d.ts.map +0 -1
- package/dist/test/conversation-fork-injection-scoping.test.js +0 -200
- package/dist/test/conversation-fork-injection-scoping.test.js.map +0 -1
- package/dist/test/conversation-router.test.d.ts +0 -2
- package/dist/test/conversation-router.test.d.ts.map +0 -1
- package/dist/test/conversation-router.test.js +0 -174
- package/dist/test/conversation-router.test.js.map +0 -1
- package/dist/test/conversation-routing.test.d.ts +0 -7
- package/dist/test/conversation-routing.test.d.ts.map +0 -1
- package/dist/test/conversation-routing.test.js +0 -621
- package/dist/test/conversation-routing.test.js.map +0 -1
- package/dist/test/deferred-wake-integrity.test.d.ts +0 -29
- package/dist/test/deferred-wake-integrity.test.d.ts.map +0 -1
- package/dist/test/deferred-wake-integrity.test.js +0 -320
- package/dist/test/deferred-wake-integrity.test.js.map +0 -1
- package/dist/test/discord-awareness-outbox.test.d.ts +0 -2
- package/dist/test/discord-awareness-outbox.test.d.ts.map +0 -1
- package/dist/test/discord-awareness-outbox.test.js +0 -371
- package/dist/test/discord-awareness-outbox.test.js.map +0 -1
- package/dist/test/discord-history-delete-window.test.d.ts +0 -2
- package/dist/test/discord-history-delete-window.test.d.ts.map +0 -1
- package/dist/test/discord-history-delete-window.test.js +0 -81
- package/dist/test/discord-history-delete-window.test.js.map +0 -1
- package/dist/test/discord-history-sync.test.d.ts +0 -2
- package/dist/test/discord-history-sync.test.d.ts.map +0 -1
- package/dist/test/discord-history-sync.test.js +0 -56
- package/dist/test/discord-history-sync.test.js.map +0 -1
- package/dist/test/discord-typing-keepalive.test.d.ts +0 -2
- package/dist/test/discord-typing-keepalive.test.d.ts.map +0 -1
- package/dist/test/discord-typing-keepalive.test.js +0 -77
- package/dist/test/discord-typing-keepalive.test.js.map +0 -1
- package/dist/test/ephemeral-settle.test.d.ts +0 -2
- package/dist/test/ephemeral-settle.test.d.ts.map +0 -1
- package/dist/test/ephemeral-settle.test.js +0 -354
- package/dist/test/ephemeral-settle.test.js.map +0 -1
- package/dist/test/event-gate-passthrough.test.d.ts +0 -15
- package/dist/test/event-gate-passthrough.test.d.ts.map +0 -1
- package/dist/test/event-gate-passthrough.test.js +0 -289
- package/dist/test/event-gate-passthrough.test.js.map +0 -1
- package/dist/test/event-gate-policy-mutation.test.d.ts +0 -2
- package/dist/test/event-gate-policy-mutation.test.d.ts.map +0 -1
- package/dist/test/event-gate-policy-mutation.test.js +0 -137
- package/dist/test/event-gate-policy-mutation.test.js.map +0 -1
- package/dist/test/event-gate-rate-limit.test.d.ts +0 -2
- package/dist/test/event-gate-rate-limit.test.d.ts.map +0 -1
- package/dist/test/event-gate-rate-limit.test.js +0 -627
- package/dist/test/event-gate-rate-limit.test.js.map +0 -1
- package/dist/test/event-gate-script.test.d.ts +0 -2
- package/dist/test/event-gate-script.test.d.ts.map +0 -1
- package/dist/test/event-gate-script.test.js +0 -95
- package/dist/test/event-gate-script.test.js.map +0 -1
- package/dist/test/event-gate-selfwake.test.d.ts +0 -15
- package/dist/test/event-gate-selfwake.test.d.ts.map +0 -1
- package/dist/test/event-gate-selfwake.test.js +0 -125
- package/dist/test/event-gate-selfwake.test.js.map +0 -1
- package/dist/test/event-gate-tags.test.d.ts +0 -2
- package/dist/test/event-gate-tags.test.d.ts.map +0 -1
- package/dist/test/event-gate-tags.test.js +0 -76
- package/dist/test/event-gate-tags.test.js.map +0 -1
- package/dist/test/event-gate.test.d.ts +0 -2
- package/dist/test/event-gate.test.d.ts.map +0 -1
- package/dist/test/event-gate.test.js +0 -919
- package/dist/test/event-gate.test.js.map +0 -1
- package/dist/test/explicit-prose-routing.test.d.ts +0 -11
- package/dist/test/explicit-prose-routing.test.d.ts.map +0 -1
- package/dist/test/explicit-prose-routing.test.js +0 -1715
- package/dist/test/explicit-prose-routing.test.js.map +0 -1
- package/dist/test/framework.test.d.ts +0 -5
- package/dist/test/framework.test.d.ts.map +0 -1
- package/dist/test/framework.test.js +0 -1048
- package/dist/test/framework.test.js.map +0 -1
- package/dist/test/gather-context-timeout.test.d.ts +0 -2
- package/dist/test/gather-context-timeout.test.d.ts.map +0 -1
- package/dist/test/gather-context-timeout.test.js +0 -120
- package/dist/test/gather-context-timeout.test.js.map +0 -1
- package/dist/test/health-snapshot.test.d.ts +0 -2
- package/dist/test/health-snapshot.test.d.ts.map +0 -1
- package/dist/test/health-snapshot.test.js +0 -74
- package/dist/test/health-snapshot.test.js.map +0 -1
- package/dist/test/helpers/coalescing-fixture.d.ts +0 -74
- package/dist/test/helpers/coalescing-fixture.d.ts.map +0 -1
- package/dist/test/helpers/coalescing-fixture.js +0 -152
- package/dist/test/helpers/coalescing-fixture.js.map +0 -1
- package/dist/test/helpers/coalescing-kill-child.d.ts +0 -2
- package/dist/test/helpers/coalescing-kill-child.d.ts.map +0 -1
- package/dist/test/helpers/coalescing-kill-child.js +0 -24
- package/dist/test/helpers/coalescing-kill-child.js.map +0 -1
- package/dist/test/helpers/mock-membrane.d.ts +0 -53
- package/dist/test/helpers/mock-membrane.d.ts.map +0 -1
- package/dist/test/helpers/mock-membrane.js +0 -168
- package/dist/test/helpers/mock-membrane.js.map +0 -1
- package/dist/test/helpers/pytc-stop-rows.d.ts +0 -11
- package/dist/test/helpers/pytc-stop-rows.d.ts.map +0 -1
- package/dist/test/helpers/pytc-stop-rows.js +0 -143
- package/dist/test/helpers/pytc-stop-rows.js.map +0 -1
- package/dist/test/helpers/quiesce-crash-child.d.ts +0 -2
- package/dist/test/helpers/quiesce-crash-child.d.ts.map +0 -1
- package/dist/test/helpers/quiesce-crash-child.js +0 -156
- package/dist/test/helpers/quiesce-crash-child.js.map +0 -1
- package/dist/test/hide-then-turn.test.d.ts +0 -2
- package/dist/test/hide-then-turn.test.d.ts.map +0 -1
- package/dist/test/hide-then-turn.test.js +0 -101
- package/dist/test/hide-then-turn.test.js.map +0 -1
- package/dist/test/history-module-overview.test.d.ts +0 -2
- package/dist/test/history-module-overview.test.d.ts.map +0 -1
- package/dist/test/history-module-overview.test.js +0 -711
- package/dist/test/history-module-overview.test.js.map +0 -1
- package/dist/test/history-module-realstore.test.d.ts +0 -2
- package/dist/test/history-module-realstore.test.d.ts.map +0 -1
- package/dist/test/history-module-realstore.test.js +0 -363
- package/dist/test/history-module-realstore.test.js.map +0 -1
- package/dist/test/history-module-semantic.test.d.ts +0 -2
- package/dist/test/history-module-semantic.test.d.ts.map +0 -1
- package/dist/test/history-module-semantic.test.js +0 -213
- package/dist/test/history-module-semantic.test.js.map +0 -1
- package/dist/test/history-module-ux.test.d.ts +0 -2
- package/dist/test/history-module-ux.test.d.ts.map +0 -1
- package/dist/test/history-module-ux.test.js +0 -304
- package/dist/test/history-module-ux.test.js.map +0 -1
- package/dist/test/history-module.test.d.ts +0 -2
- package/dist/test/history-module.test.d.ts.map +0 -1
- package/dist/test/history-module.test.js +0 -619
- package/dist/test/history-module.test.js.map +0 -1
- package/dist/test/history-semantic-review-findings.test.d.ts +0 -2
- package/dist/test/history-semantic-review-findings.test.d.ts.map +0 -1
- package/dist/test/history-semantic-review-findings.test.js +0 -338
- package/dist/test/history-semantic-review-findings.test.js.map +0 -1
- package/dist/test/history-semantic-sync-converges.test.d.ts +0 -2
- package/dist/test/history-semantic-sync-converges.test.d.ts.map +0 -1
- package/dist/test/history-semantic-sync-converges.test.js +0 -109
- package/dist/test/history-semantic-sync-converges.test.js.map +0 -1
- package/dist/test/host-quiesce.test.d.ts +0 -2
- package/dist/test/host-quiesce.test.d.ts.map +0 -1
- package/dist/test/host-quiesce.test.js +0 -988
- package/dist/test/host-quiesce.test.js.map +0 -1
- package/dist/test/inference-exhaustion-rewind.test.d.ts +0 -2
- package/dist/test/inference-exhaustion-rewind.test.d.ts.map +0 -1
- package/dist/test/inference-exhaustion-rewind.test.js +0 -387
- package/dist/test/inference-exhaustion-rewind.test.js.map +0 -1
- package/dist/test/inference-failure-bounds.test.d.ts +0 -2
- package/dist/test/inference-failure-bounds.test.d.ts.map +0 -1
- package/dist/test/inference-failure-bounds.test.js +0 -1202
- package/dist/test/inference-failure-bounds.test.js.map +0 -1
- package/dist/test/inference-failure-observability.test.d.ts +0 -2
- package/dist/test/inference-failure-observability.test.d.ts.map +0 -1
- package/dist/test/inference-failure-observability.test.js +0 -84
- package/dist/test/inference-failure-observability.test.js.map +0 -1
- package/dist/test/journal-tool.test.d.ts +0 -2
- package/dist/test/journal-tool.test.d.ts.map +0 -1
- package/dist/test/journal-tool.test.js +0 -33
- package/dist/test/journal-tool.test.js.map +0 -1
- package/dist/test/kv-unified-open-flight-retry.test.d.ts +0 -2
- package/dist/test/kv-unified-open-flight-retry.test.d.ts.map +0 -1
- package/dist/test/kv-unified-open-flight-retry.test.js +0 -189
- package/dist/test/kv-unified-open-flight-retry.test.js.map +0 -1
- package/dist/test/kv-unified-wiring.test.d.ts +0 -2
- package/dist/test/kv-unified-wiring.test.d.ts.map +0 -1
- package/dist/test/kv-unified-wiring.test.js +0 -95
- package/dist/test/kv-unified-wiring.test.js.map +0 -1
- package/dist/test/late-events-after-stop.test.d.ts +0 -2
- package/dist/test/late-events-after-stop.test.d.ts.map +0 -1
- package/dist/test/late-events-after-stop.test.js +0 -122
- package/dist/test/late-events-after-stop.test.js.map +0 -1
- package/dist/test/liveness-watchdog.test.d.ts +0 -2
- package/dist/test/liveness-watchdog.test.d.ts.map +0 -1
- package/dist/test/liveness-watchdog.test.js +0 -94
- package/dist/test/liveness-watchdog.test.js.map +0 -1
- package/dist/test/machine-close-provenance.test.d.ts +0 -2
- package/dist/test/machine-close-provenance.test.d.ts.map +0 -1
- package/dist/test/machine-close-provenance.test.js +0 -116
- package/dist/test/machine-close-provenance.test.js.map +0 -1
- package/dist/test/maintenance-timer.test.d.ts +0 -2
- package/dist/test/maintenance-timer.test.d.ts.map +0 -1
- package/dist/test/maintenance-timer.test.js +0 -1827
- package/dist/test/maintenance-timer.test.js.map +0 -1
- package/dist/test/mcp-server-bin.test.d.ts +0 -2
- package/dist/test/mcp-server-bin.test.d.ts.map +0 -1
- package/dist/test/mcp-server-bin.test.js +0 -142
- package/dist/test/mcp-server-bin.test.js.map +0 -1
- package/dist/test/mcpl-access-provider.test.d.ts +0 -2
- package/dist/test/mcpl-access-provider.test.d.ts.map +0 -1
- package/dist/test/mcpl-access-provider.test.js +0 -20
- package/dist/test/mcpl-access-provider.test.js.map +0 -1
- package/dist/test/mcpl-awareness-barrier.test.d.ts +0 -2
- package/dist/test/mcpl-awareness-barrier.test.d.ts.map +0 -1
- package/dist/test/mcpl-awareness-barrier.test.js +0 -769
- package/dist/test/mcpl-awareness-barrier.test.js.map +0 -1
- package/dist/test/mcpl-capability-grant.test.d.ts +0 -10
- package/dist/test/mcpl-capability-grant.test.d.ts.map +0 -1
- package/dist/test/mcpl-capability-grant.test.js +0 -111
- package/dist/test/mcpl-capability-grant.test.js.map +0 -1
- package/dist/test/mcpl-capability-scoping.test.d.ts +0 -2
- package/dist/test/mcpl-capability-scoping.test.d.ts.map +0 -1
- package/dist/test/mcpl-capability-scoping.test.js +0 -266
- package/dist/test/mcpl-capability-scoping.test.js.map +0 -1
- package/dist/test/mcpl-child-env.test.d.ts +0 -2
- package/dist/test/mcpl-child-env.test.d.ts.map +0 -1
- package/dist/test/mcpl-child-env.test.js +0 -158
- package/dist/test/mcpl-child-env.test.js.map +0 -1
- package/dist/test/mcpl-coalesced-content-parity.test.d.ts +0 -2
- package/dist/test/mcpl-coalesced-content-parity.test.d.ts.map +0 -1
- package/dist/test/mcpl-coalesced-content-parity.test.js +0 -532
- package/dist/test/mcpl-coalesced-content-parity.test.js.map +0 -1
- package/dist/test/mcpl-coalescing.test.d.ts +0 -2
- package/dist/test/mcpl-coalescing.test.d.ts.map +0 -1
- package/dist/test/mcpl-coalescing.test.js +0 -1125
- package/dist/test/mcpl-coalescing.test.js.map +0 -1
- package/dist/test/mcpl-config-diagnostics.test.d.ts +0 -2
- package/dist/test/mcpl-config-diagnostics.test.d.ts.map +0 -1
- package/dist/test/mcpl-config-diagnostics.test.js +0 -452
- package/dist/test/mcpl-config-diagnostics.test.js.map +0 -1
- package/dist/test/mcpl-empty-content.test.d.ts +0 -2
- package/dist/test/mcpl-empty-content.test.d.ts.map +0 -1
- package/dist/test/mcpl-empty-content.test.js +0 -368
- package/dist/test/mcpl-empty-content.test.js.map +0 -1
- package/dist/test/mcpl-gate-roundtrip.test.d.ts +0 -2
- package/dist/test/mcpl-gate-roundtrip.test.d.ts.map +0 -1
- package/dist/test/mcpl-gate-roundtrip.test.js +0 -285
- package/dist/test/mcpl-gate-roundtrip.test.js.map +0 -1
- package/dist/test/mcpl-list-status.test.d.ts +0 -2
- package/dist/test/mcpl-list-status.test.d.ts.map +0 -1
- package/dist/test/mcpl-list-status.test.js +0 -82
- package/dist/test/mcpl-list-status.test.js.map +0 -1
- package/dist/test/mcpl-manifest-changed.test.d.ts +0 -2
- package/dist/test/mcpl-manifest-changed.test.d.ts.map +0 -1
- package/dist/test/mcpl-manifest-changed.test.js +0 -178
- package/dist/test/mcpl-manifest-changed.test.js.map +0 -1
- package/dist/test/mcpl-push-convert.test.d.ts +0 -2
- package/dist/test/mcpl-push-convert.test.d.ts.map +0 -1
- package/dist/test/mcpl-push-convert.test.js +0 -42
- package/dist/test/mcpl-push-convert.test.js.map +0 -1
- package/dist/test/mcpl-reconnect-events.test.d.ts +0 -2
- package/dist/test/mcpl-reconnect-events.test.d.ts.map +0 -1
- package/dist/test/mcpl-reconnect-events.test.js +0 -144
- package/dist/test/mcpl-reconnect-events.test.js.map +0 -1
- package/dist/test/mcpl-reconnect-reregistration.test.d.ts +0 -2
- package/dist/test/mcpl-reconnect-reregistration.test.d.ts.map +0 -1
- package/dist/test/mcpl-reconnect-reregistration.test.js +0 -238
- package/dist/test/mcpl-reconnect-reregistration.test.js.map +0 -1
- package/dist/test/mcpl-reference-fetcher.test.d.ts +0 -2
- package/dist/test/mcpl-reference-fetcher.test.d.ts.map +0 -1
- package/dist/test/mcpl-reference-fetcher.test.js +0 -427
- package/dist/test/mcpl-reference-fetcher.test.js.map +0 -1
- package/dist/test/mcpl-reference-fields.test.d.ts +0 -2
- package/dist/test/mcpl-reference-fields.test.d.ts.map +0 -1
- package/dist/test/mcpl-reference-fields.test.js +0 -149
- package/dist/test/mcpl-reference-fields.test.js.map +0 -1
- package/dist/test/mcpl-rejection-log-lines.test.d.ts +0 -2
- package/dist/test/mcpl-rejection-log-lines.test.d.ts.map +0 -1
- package/dist/test/mcpl-rejection-log-lines.test.js +0 -349
- package/dist/test/mcpl-rejection-log-lines.test.js.map +0 -1
- package/dist/test/mcpl-request-timeout.test.d.ts +0 -2
- package/dist/test/mcpl-request-timeout.test.d.ts.map +0 -1
- package/dist/test/mcpl-request-timeout.test.js +0 -138
- package/dist/test/mcpl-request-timeout.test.js.map +0 -1
- package/dist/test/mcpl-runtime-lifecycle.test.d.ts +0 -7
- package/dist/test/mcpl-runtime-lifecycle.test.d.ts.map +0 -1
- package/dist/test/mcpl-runtime-lifecycle.test.js +0 -142
- package/dist/test/mcpl-runtime-lifecycle.test.js.map +0 -1
- package/dist/test/mcpl-stderr-tail.test.d.ts +0 -2
- package/dist/test/mcpl-stderr-tail.test.d.ts.map +0 -1
- package/dist/test/mcpl-stderr-tail.test.js +0 -210
- package/dist/test/mcpl-stderr-tail.test.js.map +0 -1
- package/dist/test/mcpl-tool-class-listing.test.d.ts +0 -2
- package/dist/test/mcpl-tool-class-listing.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-class-listing.test.js +0 -147
- package/dist/test/mcpl-tool-class-listing.test.js.map +0 -1
- package/dist/test/mcpl-tool-classes.test.d.ts +0 -7
- package/dist/test/mcpl-tool-classes.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-classes.test.js +0 -80
- package/dist/test/mcpl-tool-classes.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts +0 -2
- package/dist/test/mcpl-tool-lifecycle-e2e.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-e2e.test.js +0 -237
- package/dist/test/mcpl-tool-lifecycle-e2e.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts +0 -11
- package/dist/test/mcpl-tool-lifecycle-emitter.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-emitter.test.js +0 -412
- package/dist/test/mcpl-tool-lifecycle-emitter.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-script.test.d.ts +0 -2
- package/dist/test/mcpl-tool-lifecycle-script.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle-script.test.js +0 -288
- package/dist/test/mcpl-tool-lifecycle-script.test.js.map +0 -1
- package/dist/test/mcpl-tool-lifecycle.test.d.ts +0 -11
- package/dist/test/mcpl-tool-lifecycle.test.d.ts.map +0 -1
- package/dist/test/mcpl-tool-lifecycle.test.js +0 -270
- package/dist/test/mcpl-tool-lifecycle.test.js.map +0 -1
- package/dist/test/mcpl-transport-close.test.d.ts +0 -2
- package/dist/test/mcpl-transport-close.test.d.ts.map +0 -1
- package/dist/test/mcpl-transport-close.test.js +0 -373
- package/dist/test/mcpl-transport-close.test.js.map +0 -1
- package/dist/test/mcpl-transport-spawn.test.d.ts +0 -2
- package/dist/test/mcpl-transport-spawn.test.d.ts.map +0 -1
- package/dist/test/mcpl-transport-spawn.test.js +0 -58
- package/dist/test/mcpl-transport-spawn.test.js.map +0 -1
- package/dist/test/mcpl-ws-transport.test.d.ts +0 -2
- package/dist/test/mcpl-ws-transport.test.d.ts.map +0 -1
- package/dist/test/mcpl-ws-transport.test.js +0 -259
- package/dist/test/mcpl-ws-transport.test.js.map +0 -1
- package/dist/test/module-context-integration.test.d.ts +0 -18
- package/dist/test/module-context-integration.test.d.ts.map +0 -1
- package/dist/test/module-context-integration.test.js +0 -181
- package/dist/test/module-context-integration.test.js.map +0 -1
- package/dist/test/offline-recovery-branch.test.d.ts +0 -2
- package/dist/test/offline-recovery-branch.test.d.ts.map +0 -1
- package/dist/test/offline-recovery-branch.test.js +0 -570
- package/dist/test/offline-recovery-branch.test.js.map +0 -1
- package/dist/test/operator-surgery.test.d.ts +0 -2
- package/dist/test/operator-surgery.test.d.ts.map +0 -1
- package/dist/test/operator-surgery.test.js +0 -595
- package/dist/test/operator-surgery.test.js.map +0 -1
- package/dist/test/ops-alert.test.d.ts +0 -2
- package/dist/test/ops-alert.test.d.ts.map +0 -1
- package/dist/test/ops-alert.test.js +0 -153
- package/dist/test/ops-alert.test.js.map +0 -1
- package/dist/test/overbudget-drain-breaker.test.d.ts +0 -2
- package/dist/test/overbudget-drain-breaker.test.d.ts.map +0 -1
- package/dist/test/overbudget-drain-breaker.test.js +0 -198
- package/dist/test/overbudget-drain-breaker.test.js.map +0 -1
- package/dist/test/pack-installs-alone.test.d.ts +0 -2
- package/dist/test/pack-installs-alone.test.d.ts.map +0 -1
- package/dist/test/pack-installs-alone.test.js +0 -284
- package/dist/test/pack-installs-alone.test.js.map +0 -1
- package/dist/test/per-agent-delivery.test.d.ts +0 -2
- package/dist/test/per-agent-delivery.test.d.ts.map +0 -1
- package/dist/test/per-agent-delivery.test.js +0 -108
- package/dist/test/per-agent-delivery.test.js.map +0 -1
- package/dist/test/physical-window-restart.test.d.ts +0 -16
- package/dist/test/physical-window-restart.test.d.ts.map +0 -1
- package/dist/test/physical-window-restart.test.js +0 -487
- package/dist/test/physical-window-restart.test.js.map +0 -1
- package/dist/test/placed-reaction-baseline.test.d.ts +0 -2
- package/dist/test/placed-reaction-baseline.test.d.ts.map +0 -1
- package/dist/test/placed-reaction-baseline.test.js +0 -312
- package/dist/test/placed-reaction-baseline.test.js.map +0 -1
- package/dist/test/present-while-acting.test.d.ts +0 -19
- package/dist/test/present-while-acting.test.d.ts.map +0 -1
- package/dist/test/present-while-acting.test.js +0 -1649
- package/dist/test/present-while-acting.test.js.map +0 -1
- package/dist/test/prose-segments.test.d.ts +0 -2
- package/dist/test/prose-segments.test.d.ts.map +0 -1
- package/dist/test/prose-segments.test.js +0 -52
- package/dist/test/prose-segments.test.js.map +0 -1
- package/dist/test/prose-stream-router.test.d.ts +0 -2
- package/dist/test/prose-stream-router.test.d.ts.map +0 -1
- package/dist/test/prose-stream-router.test.js +0 -171
- package/dist/test/prose-stream-router.test.js.map +0 -1
- package/dist/test/provider-acceleration-cooldown.test.d.ts +0 -2
- package/dist/test/provider-acceleration-cooldown.test.d.ts.map +0 -1
- package/dist/test/provider-acceleration-cooldown.test.js +0 -435
- package/dist/test/provider-acceleration-cooldown.test.js.map +0 -1
- package/dist/test/provider-waits.test.d.ts +0 -2
- package/dist/test/provider-waits.test.d.ts.map +0 -1
- package/dist/test/provider-waits.test.js +0 -2259
- package/dist/test/provider-waits.test.js.map +0 -1
- package/dist/test/puppet-tool-call.test.d.ts +0 -2
- package/dist/test/puppet-tool-call.test.d.ts.map +0 -1
- package/dist/test/puppet-tool-call.test.js +0 -226
- package/dist/test/puppet-tool-call.test.js.map +0 -1
- package/dist/test/puppet-turn-reservation.test.d.ts +0 -2
- package/dist/test/puppet-turn-reservation.test.d.ts.map +0 -1
- package/dist/test/puppet-turn-reservation.test.js +0 -139
- package/dist/test/puppet-turn-reservation.test.js.map +0 -1
- package/dist/test/reaction-baseline-platform.test.d.ts +0 -2
- package/dist/test/reaction-baseline-platform.test.d.ts.map +0 -1
- package/dist/test/reaction-baseline-platform.test.js +0 -124
- package/dist/test/reaction-baseline-platform.test.js.map +0 -1
- package/dist/test/record-journal.test.d.ts +0 -6
- package/dist/test/record-journal.test.d.ts.map +0 -1
- package/dist/test/record-journal.test.js +0 -269
- package/dist/test/record-journal.test.js.map +0 -1
- package/dist/test/refusal-reaction-baseline.test.d.ts +0 -2
- package/dist/test/refusal-reaction-baseline.test.d.ts.map +0 -1
- package/dist/test/refusal-reaction-baseline.test.js +0 -81
- package/dist/test/refusal-reaction-baseline.test.js.map +0 -1
- package/dist/test/refusal-rewind.test.d.ts +0 -2
- package/dist/test/refusal-rewind.test.d.ts.map +0 -1
- package/dist/test/refusal-rewind.test.js +0 -117
- package/dist/test/refusal-rewind.test.js.map +0 -1
- package/dist/test/refusal-single-call.test.d.ts +0 -2
- package/dist/test/refusal-single-call.test.d.ts.map +0 -1
- package/dist/test/refusal-single-call.test.js +0 -177
- package/dist/test/refusal-single-call.test.js.map +0 -1
- package/dist/test/release-bump.test.d.ts +0 -2
- package/dist/test/release-bump.test.d.ts.map +0 -1
- package/dist/test/release-bump.test.js +0 -248
- package/dist/test/release-bump.test.js.map +0 -1
- package/dist/test/release-changelog.test.d.ts +0 -2
- package/dist/test/release-changelog.test.d.ts.map +0 -1
- package/dist/test/release-changelog.test.js +0 -159
- package/dist/test/release-changelog.test.js.map +0 -1
- package/dist/test/release-holds.test.d.ts +0 -2
- package/dist/test/release-holds.test.d.ts.map +0 -1
- package/dist/test/release-holds.test.js +0 -456
- package/dist/test/release-holds.test.js.map +0 -1
- package/dist/test/same-round-think-policy.test.d.ts +0 -2
- package/dist/test/same-round-think-policy.test.d.ts.map +0 -1
- package/dist/test/same-round-think-policy.test.js +0 -853
- package/dist/test/same-round-think-policy.test.js.map +0 -1
- package/dist/test/save-recent-image.test.d.ts +0 -26
- package/dist/test/save-recent-image.test.d.ts.map +0 -1
- package/dist/test/save-recent-image.test.js +0 -974
- package/dist/test/save-recent-image.test.js.map +0 -1
- package/dist/test/shutdown-errors.test.d.ts +0 -2
- package/dist/test/shutdown-errors.test.d.ts.map +0 -1
- package/dist/test/shutdown-errors.test.js +0 -662
- package/dist/test/shutdown-errors.test.js.map +0 -1
- package/dist/test/silent-heartbeat-rows.test.d.ts +0 -2
- package/dist/test/silent-heartbeat-rows.test.d.ts.map +0 -1
- package/dist/test/silent-heartbeat-rows.test.js +0 -451
- package/dist/test/silent-heartbeat-rows.test.js.map +0 -1
- package/dist/test/silent-heartbeat.test.d.ts +0 -2
- package/dist/test/silent-heartbeat.test.d.ts.map +0 -1
- package/dist/test/silent-heartbeat.test.js +0 -165
- package/dist/test/silent-heartbeat.test.js.map +0 -1
- package/dist/test/state-scaling-e2e.test.d.ts +0 -22
- package/dist/test/state-scaling-e2e.test.d.ts.map +0 -1
- package/dist/test/state-scaling-e2e.test.js +0 -206
- package/dist/test/state-scaling-e2e.test.js.map +0 -1
- package/dist/test/state-scaling.test.d.ts +0 -12
- package/dist/test/state-scaling.test.d.ts.map +0 -1
- package/dist/test/state-scaling.test.js +0 -251
- package/dist/test/state-scaling.test.js.map +0 -1
- package/dist/test/stop-with-host-operations.test.d.ts +0 -20
- package/dist/test/stop-with-host-operations.test.d.ts.map +0 -1
- package/dist/test/stop-with-host-operations.test.js +0 -1174
- package/dist/test/stop-with-host-operations.test.js.map +0 -1
- package/dist/test/stop-with-work-in-flight.test.d.ts +0 -23
- package/dist/test/stop-with-work-in-flight.test.d.ts.map +0 -1
- package/dist/test/stop-with-work-in-flight.test.js +0 -784
- package/dist/test/stop-with-work-in-flight.test.js.map +0 -1
- package/dist/test/surgery-marks-receipt.test.d.ts +0 -2
- package/dist/test/surgery-marks-receipt.test.d.ts.map +0 -1
- package/dist/test/surgery-marks-receipt.test.js +0 -540
- package/dist/test/surgery-marks-receipt.test.js.map +0 -1
- package/dist/test/thinking-token-stamp.test.d.ts +0 -12
- package/dist/test/thinking-token-stamp.test.d.ts.map +0 -1
- package/dist/test/thinking-token-stamp.test.js +0 -129
- package/dist/test/thinking-token-stamp.test.js.map +0 -1
- package/dist/test/timezone.test.d.ts +0 -2
- package/dist/test/timezone.test.d.ts.map +0 -1
- package/dist/test/timezone.test.js +0 -18
- package/dist/test/timezone.test.js.map +0 -1
- package/dist/test/tool-batch-hook.test.d.ts +0 -8
- package/dist/test/tool-batch-hook.test.d.ts.map +0 -1
- package/dist/test/tool-batch-hook.test.js +0 -275
- package/dist/test/tool-batch-hook.test.js.map +0 -1
- package/dist/test/tool-policy.test.d.ts +0 -2
- package/dist/test/tool-policy.test.d.ts.map +0 -1
- package/dist/test/tool-policy.test.js +0 -51
- package/dist/test/tool-policy.test.js.map +0 -1
- package/dist/test/tool-presentation.test.d.ts +0 -2
- package/dist/test/tool-presentation.test.d.ts.map +0 -1
- package/dist/test/tool-presentation.test.js +0 -268
- package/dist/test/tool-presentation.test.js.map +0 -1
- package/dist/test/tool-result-content.test.d.ts +0 -2
- package/dist/test/tool-result-content.test.d.ts.map +0 -1
- package/dist/test/tool-result-content.test.js +0 -37
- package/dist/test/tool-result-content.test.js.map +0 -1
- package/dist/test/tool-result-guard.test.d.ts +0 -2
- package/dist/test/tool-result-guard.test.d.ts.map +0 -1
- package/dist/test/tool-result-guard.test.js +0 -3729
- package/dist/test/tool-result-guard.test.js.map +0 -1
- package/dist/test/tool-result-history.test.d.ts +0 -7
- package/dist/test/tool-result-history.test.d.ts.map +0 -1
- package/dist/test/tool-result-history.test.js +0 -156
- package/dist/test/tool-result-history.test.js.map +0 -1
- package/dist/test/tool-result-spill.test.d.ts +0 -13
- package/dist/test/tool-result-spill.test.d.ts.map +0 -1
- package/dist/test/tool-result-spill.test.js +0 -586
- package/dist/test/tool-result-spill.test.js.map +0 -1
- package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts +0 -2
- package/dist/test/tool-wrapper-prose-guard-integration.test.d.ts.map +0 -1
- package/dist/test/tool-wrapper-prose-guard-integration.test.js +0 -485
- package/dist/test/tool-wrapper-prose-guard-integration.test.js.map +0 -1
- package/dist/test/tool-wrapper-prose-guard.test.d.ts +0 -2
- package/dist/test/tool-wrapper-prose-guard.test.d.ts.map +0 -1
- package/dist/test/tool-wrapper-prose-guard.test.js +0 -34
- package/dist/test/tool-wrapper-prose-guard.test.js.map +0 -1
- package/dist/test/tools-observe-parser-conformance.test.d.ts +0 -2
- package/dist/test/tools-observe-parser-conformance.test.d.ts.map +0 -1
- package/dist/test/tools-observe-parser-conformance.test.js +0 -129
- package/dist/test/tools-observe-parser-conformance.test.js.map +0 -1
- package/dist/test/trunk-channel-routing.test.d.ts +0 -19
- package/dist/test/trunk-channel-routing.test.d.ts.map +0 -1
- package/dist/test/trunk-channel-routing.test.js +0 -652
- package/dist/test/trunk-channel-routing.test.js.map +0 -1
- package/dist/test/tune-out-e2e.test.d.ts +0 -2
- package/dist/test/tune-out-e2e.test.d.ts.map +0 -1
- package/dist/test/tune-out-e2e.test.js +0 -142
- package/dist/test/tune-out-e2e.test.js.map +0 -1
- package/dist/test/tune-out-gate-composition.test.d.ts +0 -2
- package/dist/test/tune-out-gate-composition.test.d.ts.map +0 -1
- package/dist/test/tune-out-gate-composition.test.js +0 -221
- package/dist/test/tune-out-gate-composition.test.js.map +0 -1
- package/dist/test/tune-out-lifecycle.test.d.ts +0 -2
- package/dist/test/tune-out-lifecycle.test.d.ts.map +0 -1
- package/dist/test/tune-out-lifecycle.test.js +0 -121
- package/dist/test/tune-out-lifecycle.test.js.map +0 -1
- package/dist/test/turn-trigger-provenance.test.d.ts +0 -2
- package/dist/test/turn-trigger-provenance.test.d.ts.map +0 -1
- package/dist/test/turn-trigger-provenance.test.js +0 -137
- package/dist/test/turn-trigger-provenance.test.js.map +0 -1
- package/dist/test/unconvertible-tool-result.test.d.ts +0 -2
- package/dist/test/unconvertible-tool-result.test.d.ts.map +0 -1
- package/dist/test/unconvertible-tool-result.test.js +0 -358
- package/dist/test/unconvertible-tool-result.test.js.map +0 -1
- package/dist/test/unsent-compiles.test.d.ts +0 -2
- package/dist/test/unsent-compiles.test.d.ts.map +0 -1
- package/dist/test/unsent-compiles.test.js +0 -139
- package/dist/test/unsent-compiles.test.js.map +0 -1
- package/dist/test/usage-accounting.test.d.ts +0 -2
- package/dist/test/usage-accounting.test.d.ts.map +0 -1
- package/dist/test/usage-accounting.test.js +0 -13
- package/dist/test/usage-accounting.test.js.map +0 -1
- package/dist/test/usage-tracker.test.d.ts +0 -2
- package/dist/test/usage-tracker.test.d.ts.map +0 -1
- package/dist/test/usage-tracker.test.js +0 -129
- package/dist/test/usage-tracker.test.js.map +0 -1
- package/dist/test/utils-surface.test.d.ts +0 -2
- package/dist/test/utils-surface.test.d.ts.map +0 -1
- package/dist/test/utils-surface.test.js +0 -145
- package/dist/test/utils-surface.test.js.map +0 -1
- package/dist/test/workspace-branch-continuation.test.d.ts +0 -15
- package/dist/test/workspace-branch-continuation.test.d.ts.map +0 -1
- package/dist/test/workspace-branch-continuation.test.js +0 -183
- package/dist/test/workspace-branch-continuation.test.js.map +0 -1
- package/dist/test/workspace-materialize-freshness.test.d.ts +0 -16
- package/dist/test/workspace-materialize-freshness.test.d.ts.map +0 -1
- package/dist/test/workspace-materialize-freshness.test.js +0 -252
- package/dist/test/workspace-materialize-freshness.test.js.map +0 -1
- package/dist/test/workspace-path-containment.test.d.ts +0 -19
- package/dist/test/workspace-path-containment.test.d.ts.map +0 -1
- package/dist/test/workspace-path-containment.test.js +0 -91
- package/dist/test/workspace-path-containment.test.js.map +0 -1
- package/dist/test/workspace-read-file-from-disk.test.d.ts +0 -17
- package/dist/test/workspace-read-file-from-disk.test.d.ts.map +0 -1
- package/dist/test/workspace-read-file-from-disk.test.js +0 -174
- package/dist/test/workspace-read-file-from-disk.test.js.map +0 -1
- package/dist/test/workspace-read-image.test.d.ts +0 -2
- package/dist/test/workspace-read-image.test.d.ts.map +0 -1
- package/dist/test/workspace-read-image.test.js +0 -597
- package/dist/test/workspace-read-image.test.js.map +0 -1
- package/dist/test/workspace-read-text.test.d.ts +0 -2
- package/dist/test/workspace-read-text.test.d.ts.map +0 -1
- package/dist/test/workspace-read-text.test.js +0 -101
- package/dist/test/workspace-read-text.test.js.map +0 -1
- package/dist/test/workspace-restore-order.test.d.ts +0 -16
- package/dist/test/workspace-restore-order.test.d.ts.map +0 -1
- package/dist/test/workspace-restore-order.test.js +0 -140
- package/dist/test/workspace-restore-order.test.js.map +0 -1
- package/dist/test/workspace-three-way.test.d.ts +0 -12
- package/dist/test/workspace-three-way.test.d.ts.map +0 -1
- package/dist/test/workspace-three-way.test.js +0 -4094
- package/dist/test/workspace-three-way.test.js.map +0 -1
- package/dist/test/workspace-watcher.test.d.ts +0 -2
- package/dist/test/workspace-watcher.test.d.ts.map +0 -1
- package/dist/test/workspace-watcher.test.js +0 -281
- package/dist/test/workspace-watcher.test.js.map +0 -1
- package/dist/test/xml-round-persist.test.d.ts +0 -19
- package/dist/test/xml-round-persist.test.d.ts.map +0 -1
- package/dist/test/xml-round-persist.test.js +0 -235
- package/dist/test/xml-round-persist.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,595 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Live operator surgery: rollbackToMessage / suppressMessages on an OPEN
|
|
3
|
-
* store, and the durable operator-actions.jsonl record every operator
|
|
4
|
-
* mutation leaves behind.
|
|
5
|
-
*
|
|
6
|
-
* Asserted at the store seam (branch names, message counts on each branch,
|
|
7
|
-
* log file contents, operator:action traces) — no inference runs.
|
|
8
|
-
*/
|
|
9
|
-
import { describe, it, beforeEach, afterEach } from 'node:test';
|
|
10
|
-
import assert from 'node:assert/strict';
|
|
11
|
-
import { tmpdir } from 'node:os';
|
|
12
|
-
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
13
|
-
import { join } from 'node:path';
|
|
14
|
-
import { AgentFramework, OperatorActionError, OperatorLog } from '../src/index.js';
|
|
15
|
-
import { MockMembrane } from './helpers/mock-membrane.js';
|
|
16
|
-
function readLog(path) {
|
|
17
|
-
if (!existsSync(path))
|
|
18
|
-
return [];
|
|
19
|
-
return readFileSync(path, 'utf8')
|
|
20
|
-
.split('\n')
|
|
21
|
-
.filter((l) => l.length > 0)
|
|
22
|
-
.map((l) => JSON.parse(l));
|
|
23
|
-
}
|
|
24
|
-
describe('live operator surgery', () => {
|
|
25
|
-
let tempDir;
|
|
26
|
-
let storePath;
|
|
27
|
-
let framework;
|
|
28
|
-
let membrane;
|
|
29
|
-
let traces;
|
|
30
|
-
let ids;
|
|
31
|
-
const cm = () => framework.getAgent('scout').getContextManager();
|
|
32
|
-
const remainingTexts = () => cm().getAllMessages().map((m) => m.content[0].text);
|
|
33
|
-
beforeEach(async () => {
|
|
34
|
-
tempDir = mkdtempSync(join(tmpdir(), 'operator-surgery-test-'));
|
|
35
|
-
storePath = join(tempDir, 'test.chronicle');
|
|
36
|
-
membrane = new MockMembrane();
|
|
37
|
-
framework = await AgentFramework.create({
|
|
38
|
-
storePath,
|
|
39
|
-
membrane: membrane.asMembrane(),
|
|
40
|
-
agents: [{ name: 'scout', model: 'test-model', systemPrompt: 'You are scout.' }],
|
|
41
|
-
modules: [],
|
|
42
|
-
});
|
|
43
|
-
traces = [];
|
|
44
|
-
framework.onTrace((e) => { traces.push(e); });
|
|
45
|
-
ids = [];
|
|
46
|
-
for (let i = 1; i <= 5; i++) {
|
|
47
|
-
ids.push(cm().addMessage(i % 2 ? 'user' : 'scout', [{ type: 'text', text: `m${i}` }], {
|
|
48
|
-
serverId: 'discord',
|
|
49
|
-
channelId: 'discord:g1:c1',
|
|
50
|
-
messageId: `d${i}`,
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
afterEach(async () => {
|
|
55
|
-
await framework.stop();
|
|
56
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
57
|
-
});
|
|
58
|
-
it('defaults the operator log next to the store', () => {
|
|
59
|
-
assert.equal(framework.getOperatorLogPath(), join(storePath, 'operator-actions.jsonl'));
|
|
60
|
-
});
|
|
61
|
-
it('rollbackToMessage forks at the message, switches to the fork, keeps the source intact, logs', async () => {
|
|
62
|
-
const r = await framework.rollbackToMessage('scout', {
|
|
63
|
-
messageId: ids[2],
|
|
64
|
-
requester: { via: 'webui', name: 'antra' },
|
|
65
|
-
note: 'bad turn',
|
|
66
|
-
});
|
|
67
|
-
assert.equal(r.sourceBranch, 'main');
|
|
68
|
-
assert.match(r.targetBranch, /^rollback\/scout\/\d+$/);
|
|
69
|
-
assert.equal(r.messagesRemoved, 2);
|
|
70
|
-
assert.equal(r.removedRefs.length, 2, 'discord refs of the discarded messages are collected');
|
|
71
|
-
assert.equal(cm().currentBranch().name, r.targetBranch);
|
|
72
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3']);
|
|
73
|
-
// The source branch still has everything.
|
|
74
|
-
await cm().switchBranch('main');
|
|
75
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5']);
|
|
76
|
-
const log = readLog(framework.getOperatorLogPath());
|
|
77
|
-
const entry = log.find((e) => e.kind === 'rollback');
|
|
78
|
-
assert.ok(entry, 'rollback recorded in operator-actions.jsonl');
|
|
79
|
-
assert.equal(entry.agent, 'scout');
|
|
80
|
-
assert.deepEqual(entry.requester, { via: 'webui', name: 'antra' });
|
|
81
|
-
assert.equal(entry.note, 'bad turn');
|
|
82
|
-
assert.deepEqual(entry.params, { messageId: ids[2] });
|
|
83
|
-
assert.equal(entry.result?.messagesRemoved, 2);
|
|
84
|
-
assert.equal(entry.result?.targetBranch, r.targetBranch);
|
|
85
|
-
assert.ok(typeof entry.at === 'string' && !Number.isNaN(Date.parse(entry.at)));
|
|
86
|
-
const trace = traces.find((t) => t.type === 'operator:action' && t.kind === 'rollback');
|
|
87
|
-
assert.ok(trace, 'operator:action trace broadcast');
|
|
88
|
-
assert.equal(trace.agentName, 'scout');
|
|
89
|
-
});
|
|
90
|
-
it('rollback refuses the tail, unknown ids, and busy agents — and logs the refusal', async () => {
|
|
91
|
-
await assert.rejects(framework.rollbackToMessage('scout', { messageId: ids[4] }), (e) => e instanceof OperatorActionError && e.code === 'invalid');
|
|
92
|
-
await assert.rejects(framework.rollbackToMessage('scout', { messageId: 'nope' }), (e) => e instanceof OperatorActionError && e.code === 'unknown-message');
|
|
93
|
-
const agent = framework.getAgent('scout');
|
|
94
|
-
agent._state = { status: 'inferring' };
|
|
95
|
-
try {
|
|
96
|
-
await assert.rejects(framework.rollbackToMessage('scout', { messageId: ids[1] }), (e) => e instanceof OperatorActionError && e.code === 'agent-busy');
|
|
97
|
-
}
|
|
98
|
-
finally {
|
|
99
|
-
agent._state = { status: 'idle' };
|
|
100
|
-
}
|
|
101
|
-
assert.equal(cm().currentBranch().name, 'main', 'nothing moved');
|
|
102
|
-
assert.equal(cm().getMessageCount(), 5);
|
|
103
|
-
const errors = readLog(framework.getOperatorLogPath()).filter((e) => e.kind === 'rollback' && e.error);
|
|
104
|
-
assert.equal(errors.length, 3);
|
|
105
|
-
assert.match(errors[2].error, /Cannot roll back while scout is inferring/);
|
|
106
|
-
});
|
|
107
|
-
// --- store-wide exclusion ---------------------------------------------------
|
|
108
|
-
// A branch switch moves the active branch for EVERY context manager on the
|
|
109
|
-
// store; the gate must cover every agent, and hold across the await.
|
|
110
|
-
it('refuses surgery on an idle agent while a different agent sharing the store has a turn alive', async () => {
|
|
111
|
-
await framework.stop();
|
|
112
|
-
framework = await AgentFramework.create({
|
|
113
|
-
storePath,
|
|
114
|
-
membrane: new MockMembrane().asMembrane(),
|
|
115
|
-
agents: [
|
|
116
|
-
{ name: 'scout', model: 'test-model', systemPrompt: 'You are scout.' },
|
|
117
|
-
{ name: 'shade', model: 'test-model', systemPrompt: 'You are shade.' },
|
|
118
|
-
],
|
|
119
|
-
modules: [],
|
|
120
|
-
});
|
|
121
|
-
const tokens = framework.activeTurnTokens;
|
|
122
|
-
const shadeBefore = framework.getAgent('shade').getContextManager().getMessageCount();
|
|
123
|
-
tokens.set('shade', 7);
|
|
124
|
-
try {
|
|
125
|
-
await assert.rejects(framework.rollbackToMessage('scout', { messageId: ids[1] }), (e) => e instanceof OperatorActionError && e.code === 'agent-busy' && /shade is idle\+turn-alive/.test(e.message));
|
|
126
|
-
await assert.rejects(framework.suppressMessages('scout', { messageIds: [ids[1]] }), (e) => e instanceof OperatorActionError && e.code === 'agent-busy' && /shade/.test(e.message));
|
|
127
|
-
}
|
|
128
|
-
finally {
|
|
129
|
-
tokens.delete('shade');
|
|
130
|
-
}
|
|
131
|
-
assert.equal(cm().currentBranch().name, 'main', 'shared branch untouched');
|
|
132
|
-
assert.equal(framework.getAgent('shade').getContextManager().getMessageCount(), shadeBefore, "shade's history untouched");
|
|
133
|
-
// With shade idle the same call goes through — and the reservation is
|
|
134
|
-
// released afterwards (no token left behind on either agent).
|
|
135
|
-
const r = await framework.rollbackToMessage('scout', { messageId: ids[1] });
|
|
136
|
-
assert.equal(r.messagesRemoved, 3);
|
|
137
|
-
assert.equal(tokens.size, 0, 'store reservation released');
|
|
138
|
-
});
|
|
139
|
-
it('holds a turn token on every agent for the duration of the switch', async () => {
|
|
140
|
-
const tokens = framework.activeTurnTokens;
|
|
141
|
-
const c = cm();
|
|
142
|
-
const original = c.switchBranch;
|
|
143
|
-
let heldDuringSwitch = null;
|
|
144
|
-
c.switchBranch = async (name) => { heldDuringSwitch = tokens.size; return original.call(c, name); };
|
|
145
|
-
try {
|
|
146
|
-
await framework.rollbackToMessage('scout', { messageId: ids[2] });
|
|
147
|
-
}
|
|
148
|
-
finally {
|
|
149
|
-
c.switchBranch = original;
|
|
150
|
-
}
|
|
151
|
-
assert.equal(heldDuringSwitch, 1, 'reservation held while the switch was awaited');
|
|
152
|
-
assert.equal(tokens.size, 0, 'and released after');
|
|
153
|
-
});
|
|
154
|
-
it('holds the store against agents admitted AFTER the reservation: ephemeral admission is refused (ticket kept) and wakes are parked', async () => {
|
|
155
|
-
// Hold the awaited switch open so the surgery is mid-flight.
|
|
156
|
-
const c = cm();
|
|
157
|
-
const originalSwitch = c.switchBranch;
|
|
158
|
-
let releaseSwitch;
|
|
159
|
-
const gate = new Promise((resolve) => { releaseSwitch = resolve; });
|
|
160
|
-
c.switchBranch = async (name) => { await gate; return originalSwitch.call(c, name); };
|
|
161
|
-
// An ephemeral candidate: not in this.agents, so the token snapshot
|
|
162
|
-
// cannot cover it — this is the reviewer's dynamic-admission probe.
|
|
163
|
-
const worker = await framework.createEphemeralAgent({
|
|
164
|
-
name: 'worker', model: 'test-model', systemPrompt: 'Do the task.', allowedTools: 'all',
|
|
165
|
-
});
|
|
166
|
-
worker.contextManager.addMessage('user', [{ type: 'text', text: 'Run once.' }]);
|
|
167
|
-
const internals = framework;
|
|
168
|
-
try {
|
|
169
|
-
const rollback = framework.rollbackToMessage('scout', { messageId: ids[1] });
|
|
170
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
171
|
-
assert.ok(internals.surgeryHold, 'store hold is up while the switch is awaited');
|
|
172
|
-
await assert.rejects(framework.runEphemeralToCompletion(worker.agent, worker.contextManager), /under live roll back/);
|
|
173
|
-
assert.equal(internals.ephemeralCandidates.get(worker.agent), worker.contextManager, 'refused BEFORE consuming the generation ticket — a clean retry stays possible');
|
|
174
|
-
// A wake arriving now is parked by the scheduler, not started.
|
|
175
|
-
framework.nudgeAgent('scout', 'test');
|
|
176
|
-
await internals.processInferenceRequests();
|
|
177
|
-
assert.equal(membrane.calls.length, 0, 'no provider call while the store is held');
|
|
178
|
-
assert.ok(internals.pendingRequests.length >= 1, 'the wake is requeued for after the surgery');
|
|
179
|
-
releaseSwitch();
|
|
180
|
-
const r = await rollback;
|
|
181
|
-
assert.equal(r.messagesRemoved, 3);
|
|
182
|
-
assert.equal(internals.surgeryHold, null, 'hold released with the reservation');
|
|
183
|
-
assert.equal(membrane.calls.length, 0);
|
|
184
|
-
}
|
|
185
|
-
finally {
|
|
186
|
-
c.switchBranch = originalSwitch;
|
|
187
|
-
worker.cleanup();
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
// --- strategy-initialization failure -----------------------------------------
|
|
191
|
-
// switchBranch()/fork() move the chronicle branch BEFORE awaiting strategy
|
|
192
|
-
// initialization, so a rejection there leaves the store on the new branch.
|
|
193
|
-
const failNextStrategyInit = () => {
|
|
194
|
-
const c = cm();
|
|
195
|
-
const original = c.initializeStrategy;
|
|
196
|
-
let armed = true;
|
|
197
|
-
c.initializeStrategy = async function (...args) {
|
|
198
|
-
if (armed) {
|
|
199
|
-
armed = false;
|
|
200
|
-
throw new Error('injected strategy init failure');
|
|
201
|
-
}
|
|
202
|
-
return original.apply(this, args);
|
|
203
|
-
};
|
|
204
|
-
return () => { c.initializeStrategy = original; };
|
|
205
|
-
};
|
|
206
|
-
it('rollback restores the source branch when strategy initialization rejects after the switch', async () => {
|
|
207
|
-
const restore = failNextStrategyInit();
|
|
208
|
-
try {
|
|
209
|
-
await assert.rejects(framework.rollbackToMessage('scout', { messageId: ids[1], branchName: 'failed-rollback' }), (e) => e instanceof OperatorActionError && e.code === 'failed'
|
|
210
|
-
&& /active branch restored to main/.test(e.message) && /injected/.test(e.message));
|
|
211
|
-
}
|
|
212
|
-
finally {
|
|
213
|
-
restore();
|
|
214
|
-
}
|
|
215
|
-
assert.equal(cm().currentBranch().name, 'main');
|
|
216
|
-
assert.equal(cm().isReady(), true, 'strategy re-initialized on the source branch');
|
|
217
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5']);
|
|
218
|
-
assert.ok(cm().listBranches().some((b) => b.name === 'failed-rollback'), 'failed branch kept for diagnosis');
|
|
219
|
-
const tokens = framework.activeTurnTokens;
|
|
220
|
-
assert.equal(tokens.size, 0);
|
|
221
|
-
});
|
|
222
|
-
it('suppress restores the source branch when fork() rejects after the switch', async () => {
|
|
223
|
-
const restore = failNextStrategyInit();
|
|
224
|
-
try {
|
|
225
|
-
await assert.rejects(framework.suppressMessages('scout', { messageIds: [ids[1]], branchName: 'failed-suppress' }), (e) => e instanceof OperatorActionError && e.code === 'failed'
|
|
226
|
-
&& /active branch restored to main/.test(e.message));
|
|
227
|
-
}
|
|
228
|
-
finally {
|
|
229
|
-
restore();
|
|
230
|
-
}
|
|
231
|
-
assert.equal(cm().currentBranch().name, 'main');
|
|
232
|
-
assert.equal(cm().isReady(), true);
|
|
233
|
-
assert.equal(cm().getMessageCount(), 5, 'nothing redacted anywhere visible');
|
|
234
|
-
const outbox = framework.discordAwarenessOutbox;
|
|
235
|
-
assert.equal(outbox.batches().filter((b) => b.status === 'prepared').length, 0);
|
|
236
|
-
});
|
|
237
|
-
it('suppressMessages forks at head, redacts only the chosen messages on the fork, logs', async () => {
|
|
238
|
-
const r = await framework.suppressMessages('scout', {
|
|
239
|
-
messageIds: [ids[1], ids[3], ids[3]],
|
|
240
|
-
requester: { via: 'webui', name: 'antra' },
|
|
241
|
-
});
|
|
242
|
-
assert.equal(r.sourceBranch, 'main');
|
|
243
|
-
assert.match(r.targetBranch, /^suppress\/scout\/\d+$/);
|
|
244
|
-
assert.equal(r.messagesRemoved, 2);
|
|
245
|
-
assert.deepEqual(new Set(r.removedIds), new Set([ids[1], ids[3]]));
|
|
246
|
-
assert.equal(cm().currentBranch().name, r.targetBranch);
|
|
247
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm3', 'm5']);
|
|
248
|
-
await cm().switchBranch('main');
|
|
249
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5'], 'source branch untouched');
|
|
250
|
-
const entry = readLog(framework.getOperatorLogPath()).find((e) => e.kind === 'suppress');
|
|
251
|
-
assert.ok(entry);
|
|
252
|
-
assert.deepEqual(entry.params, { messageIds: [ids[1], ids[3]] });
|
|
253
|
-
assert.deepEqual(new Set(entry.result?.removedIds), new Set([ids[1], ids[3]]));
|
|
254
|
-
});
|
|
255
|
-
it('suppress validates every id before mutating anything', async () => {
|
|
256
|
-
await assert.rejects(framework.suppressMessages('scout', { messageIds: [ids[0], 'ghost'] }), (e) => e instanceof OperatorActionError && e.code === 'unknown-message' && /ghost/.test(e.message));
|
|
257
|
-
await assert.rejects(framework.suppressMessages('scout', { messageIds: ids }), (e) => e instanceof OperatorActionError && e.code === 'invalid');
|
|
258
|
-
assert.equal(cm().currentBranch().name, 'main');
|
|
259
|
-
assert.equal(cm().listBranches().length, 1, 'no fork was created');
|
|
260
|
-
assert.equal(cm().getMessageCount(), 5);
|
|
261
|
-
});
|
|
262
|
-
it('host-command message-granular undo rides on rollbackToMessage and keeps its branch prefix', async () => {
|
|
263
|
-
const internals = framework;
|
|
264
|
-
const r = await internals.handleHostCommand('discord', {
|
|
265
|
-
command: 'undo',
|
|
266
|
-
agentName: 'scout',
|
|
267
|
-
messages: 2,
|
|
268
|
-
requesterName: 'antra',
|
|
269
|
-
});
|
|
270
|
-
assert.equal(r.ok, true);
|
|
271
|
-
assert.equal(r.messagesRemoved, 2);
|
|
272
|
-
assert.match(cm().currentBranch().name, /^undo-msgs\/scout\/\d+$/);
|
|
273
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3']);
|
|
274
|
-
const entry = readLog(framework.getOperatorLogPath()).find((e) => e.kind === 'rollback');
|
|
275
|
-
assert.ok(entry);
|
|
276
|
-
assert.equal(entry.requester?.via, 'host-command:discord');
|
|
277
|
-
assert.equal(entry.requester?.name, 'antra');
|
|
278
|
-
});
|
|
279
|
-
const appendShards = (group, texts) => texts.map((text, shardIndex) => cm().messageStore
|
|
280
|
-
.append('user', [{ type: 'text', text }], {}, undefined, { bodyGroupId: group, shardIndex }).id);
|
|
281
|
-
it('suppress removes a whole body group from any shard id, and a single-shard group as a range', async () => {
|
|
282
|
-
// m1..m5 exist; add a 3-shard group then a plain message, then a 1-shard group.
|
|
283
|
-
const [g0, g1, g2] = appendShards('g3', ['s0', 's1', 's2']);
|
|
284
|
-
cm().addMessage('user', [{ type: 'text', text: 'after' }]);
|
|
285
|
-
const [lone] = appendShards('g1', ['lone']);
|
|
286
|
-
const before = cm().getMessageCount();
|
|
287
|
-
const r = await framework.suppressMessages('scout', { messageIds: [g1, lone] });
|
|
288
|
-
assert.equal(r.messagesRemoved, 4, 'middle shard expands to its 3-shard group; lone shard removed as a range');
|
|
289
|
-
assert.deepEqual(new Set(r.removedIds), new Set([g0, g1, g2, lone]));
|
|
290
|
-
assert.equal(cm().getMessageCount(), before - 4);
|
|
291
|
-
assert.deepEqual(remainingTexts().slice(-2), ['m5', 'after'], 'no partial run survives');
|
|
292
|
-
});
|
|
293
|
-
it('rollback never bisects a body group: a mid-group target snaps to the group tail', async () => {
|
|
294
|
-
const [s0, s1, s2] = appendShards('g3', ['s0', 's1', 's2']);
|
|
295
|
-
cm().addMessage('user', [{ type: 'text', text: 'after' }]);
|
|
296
|
-
const r = await framework.rollbackToMessage('scout', { messageId: s1 });
|
|
297
|
-
assert.equal(r.tailMessageId, s2, 'fork lands on the last shard');
|
|
298
|
-
assert.equal(r.messagesRemoved, 1, 'only the message after the group leaves');
|
|
299
|
-
assert.deepEqual(remainingTexts().slice(-3), ['s0', 's1', 's2']);
|
|
300
|
-
void s0;
|
|
301
|
-
});
|
|
302
|
-
it('hide removes a message stored as a body whole, a one-shard body and every copy included', async () => {
|
|
303
|
-
// Each shard of a long message carries its Discord message id.
|
|
304
|
-
const appendBody = (discordId, group, texts, from = 0) => texts.map((text, i) => cm().messageStore.append('user', [{ type: 'text', text }], { serverId: 'discord', channelId: 'discord:g1:c1', messageId: discordId }, undefined, { bodyGroupId: group, shardIndex: from + i }).id);
|
|
305
|
-
const [lone] = appendBody('d-lone', 'g-lone', ['lone']);
|
|
306
|
-
const long = appendBody('d-long', 'g-long', ['l0', 'l1', 'l2']);
|
|
307
|
-
// A write cut short after two shards, then its retry from shard 0.
|
|
308
|
-
const partial = appendBody('d-cut', 'g-cut', ['c0', 'c1']);
|
|
309
|
-
const retry = appendBody('d-cut', 'g-cut', ['c0', 'c1', 'c2']);
|
|
310
|
-
const internals = framework;
|
|
311
|
-
const hide = (fromMessageId) => internals.handleHostCommand('discord', {
|
|
312
|
-
command: 'hide',
|
|
313
|
-
agentName: 'scout',
|
|
314
|
-
fromMessageId,
|
|
315
|
-
requesterName: 'antra',
|
|
316
|
-
});
|
|
317
|
-
const refsOf = (result) => result.hiddenRefs.map((ref) => ref.messageId);
|
|
318
|
-
const one = await hide('d-lone');
|
|
319
|
-
assert.equal(one.ok, true, String(one.error));
|
|
320
|
-
assert.equal(one.hidden, 1);
|
|
321
|
-
assert.equal(cm().getMessage(lone), null);
|
|
322
|
-
const whole = await hide('d-long');
|
|
323
|
-
assert.equal(whole.ok, true, String(whole.error));
|
|
324
|
-
assert.equal(whole.hidden, 1, 'one message, though stored in three shards');
|
|
325
|
-
assert.deepEqual(refsOf(whole), ['d-long']);
|
|
326
|
-
for (const id of long)
|
|
327
|
-
assert.equal(cm().getMessage(id), null);
|
|
328
|
-
const copies = await hide('d-cut');
|
|
329
|
-
assert.equal(copies.ok, true, String(copies.error));
|
|
330
|
-
assert.equal(copies.hidden, 2, 'the partial copy and its retry');
|
|
331
|
-
assert.deepEqual(refsOf(copies), ['d-cut']);
|
|
332
|
-
for (const id of [...partial, ...retry])
|
|
333
|
-
assert.equal(cm().getMessage(id), null);
|
|
334
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5']);
|
|
335
|
-
// A body of more shards than the operator log keeps ids for: its entry
|
|
336
|
-
// keeps the first 50 and says the list is cut.
|
|
337
|
-
const huge = appendBody('d-huge', 'g-huge', Array.from({ length: 60 }, (_, i) => `h${i}`));
|
|
338
|
-
const big = await hide('d-huge');
|
|
339
|
-
assert.equal(big.ok, true, String(big.error));
|
|
340
|
-
assert.equal(big.hidden, 1);
|
|
341
|
-
const entry = readLog(framework.getOperatorLogPath()).filter((e) => e.kind === 'hide').at(-1);
|
|
342
|
-
assert.deepEqual(entry.result?.removedIds, huge.slice(0, 50));
|
|
343
|
-
assert.equal(entry.result?.removedIdsTruncated, true);
|
|
344
|
-
for (const id of huge)
|
|
345
|
-
assert.equal(cm().getMessage(id), null);
|
|
346
|
-
// The range form takes what was stored between its two messages, from the
|
|
347
|
-
// earlier one's first copy through the later one's first, in either
|
|
348
|
-
// order, and every copy of both: a range ending at a message stored twice
|
|
349
|
-
// takes its retry too.
|
|
350
|
-
const hideRange = (fromMessageId, toMessageId) => internals.handleHostCommand('discord', {
|
|
351
|
-
command: 'hide', agentName: 'scout', fromMessageId, toMessageId, requesterName: 'antra',
|
|
352
|
-
});
|
|
353
|
-
const plain = (text, discordId) => cm().addMessage('user', [{ type: 'text', text }], {
|
|
354
|
-
serverId: 'discord', channelId: 'discord:g1:c1', messageId: discordId,
|
|
355
|
-
});
|
|
356
|
-
appendBody('d-cut2', 'g-cut2', ['p0', 'p1']);
|
|
357
|
-
appendBody('d-cut2', 'g-cut2', ['r0', 'r1', 'r2']);
|
|
358
|
-
plain('after', 'd-after');
|
|
359
|
-
const forward = await hideRange('d4', 'd-cut2');
|
|
360
|
-
assert.equal(forward.ok, true, String(forward.error));
|
|
361
|
-
assert.equal(forward.hidden, 4, 'm4, m5, and both copies of the cut message');
|
|
362
|
-
assert.deepEqual(refsOf(forward), ['d4', 'd5', 'd-cut2']);
|
|
363
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'after']);
|
|
364
|
-
appendBody('d-cut3', 'g-cut3', ['q0']);
|
|
365
|
-
appendBody('d-cut3', 'g-cut3', ['s0', 's1']);
|
|
366
|
-
plain('last', 'd-last');
|
|
367
|
-
const backward = await hideRange('d-cut3', 'd2');
|
|
368
|
-
assert.equal(backward.ok, true, String(backward.error));
|
|
369
|
-
assert.equal(backward.hidden, 5, 'm2, m3, after, and both copies of the cut message');
|
|
370
|
-
assert.deepEqual(remainingTexts(), ['m1', 'last']);
|
|
371
|
-
// What was stored between a message's first copy and its retry came after
|
|
372
|
-
// that message began, so a range ending at it leaves that in.
|
|
373
|
-
plain('A', 'd-a');
|
|
374
|
-
appendBody('d-b', 'g-b', ['bp0']);
|
|
375
|
-
plain('Z', 'd-z');
|
|
376
|
-
appendBody('d-b', 'g-b', ['br0', 'br1']);
|
|
377
|
-
const between = await hideRange('d-a', 'd-b');
|
|
378
|
-
assert.equal(between.ok, true, String(between.error));
|
|
379
|
-
assert.equal(between.hidden, 3, 'A, and both copies of B');
|
|
380
|
-
assert.deepEqual(refsOf(between), ['d-a', 'd-b']);
|
|
381
|
-
assert.deepEqual(remainingTexts(), ['m1', 'last', 'Z']);
|
|
382
|
-
// A copy of the earlier message stored after the later one goes too, on
|
|
383
|
-
// its own: what was stored between them stays.
|
|
384
|
-
appendBody('d-c', 'g-c', ['cp0']);
|
|
385
|
-
plain('D', 'd-d');
|
|
386
|
-
plain('E', 'd-e');
|
|
387
|
-
appendBody('d-c', 'g-c', ['cr0', 'cr1']);
|
|
388
|
-
const mirror = await hideRange('d-d', 'd-c');
|
|
389
|
-
assert.equal(mirror.ok, true, String(mirror.error));
|
|
390
|
-
assert.equal(mirror.hidden, 3, 'both copies of C, and D');
|
|
391
|
-
assert.deepEqual(refsOf(mirror), ['d-c', 'd-d']);
|
|
392
|
-
assert.deepEqual(remainingTexts(), ['m1', 'last', 'Z', 'E']);
|
|
393
|
-
});
|
|
394
|
-
it('hide refuses while a surgery holds the store, and a missing Discord id matches nothing', async () => {
|
|
395
|
-
cm().addMessage('user', [{ type: 'text', text: 'held' }], { serverId: 'discord', channelId: 'discord:g1:c1', messageId: 'd-held' });
|
|
396
|
-
const internals = framework;
|
|
397
|
-
const hide = (fromMessageId) => internals.handleHostCommand('discord', {
|
|
398
|
-
command: 'hide', agentName: 'scout', fromMessageId, requesterName: 'antra',
|
|
399
|
-
});
|
|
400
|
-
const release = internals.reserveStoreForSurgery('roll back', 'scout');
|
|
401
|
-
try {
|
|
402
|
-
const refused = await hide('d-held');
|
|
403
|
-
assert.equal(refused.ok, false);
|
|
404
|
-
assert.match(String(refused.error), /a live roll back for scout holds the store/);
|
|
405
|
-
}
|
|
406
|
-
finally {
|
|
407
|
-
release();
|
|
408
|
-
}
|
|
409
|
-
// Two messages with no Discord id, such as the agent's replies: the
|
|
410
|
-
// text "undefined" names neither of them.
|
|
411
|
-
cm().addMessage('scout', [{ type: 'text', text: 'reply-1' }]);
|
|
412
|
-
cm().addMessage('scout', [{ type: 'text', text: 'reply-2' }]);
|
|
413
|
-
const none = await hide('undefined');
|
|
414
|
-
assert.equal(none.ok, false);
|
|
415
|
-
assert.match(String(none.error), /is not an addressable message in context/);
|
|
416
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5', 'held', 'reply-1', 'reply-2']);
|
|
417
|
-
const hidden = await hide('d-held');
|
|
418
|
-
assert.equal(hidden.ok, true, String(hidden.error));
|
|
419
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5', 'reply-1', 'reply-2']);
|
|
420
|
-
});
|
|
421
|
-
it('hide over a range widens both ends to whole bodies, and counts each message once', async () => {
|
|
422
|
-
const appendBody = (discordId, group, texts) => texts.map((text, shardIndex) => cm().messageStore.append('user', [{ type: 'text', text }], { serverId: 'discord', channelId: 'discord:g1:c1', messageId: discordId }, undefined, { bodyGroupId: group, shardIndex }).id);
|
|
423
|
-
appendBody('d-a', 'g-a', ['a0', 'a1']);
|
|
424
|
-
cm().addMessage('user', [{ type: 'text', text: 'between' }], { serverId: 'discord', channelId: 'discord:g1:c1', messageId: 'd-mid' });
|
|
425
|
-
appendBody('d-b', 'g-b', ['b0', 'b1', 'b2']);
|
|
426
|
-
const internals = framework;
|
|
427
|
-
// From the second body's first shard back to the first body's: both
|
|
428
|
-
// widen to their whole bodies.
|
|
429
|
-
const result = await internals.handleHostCommand('discord', {
|
|
430
|
-
command: 'hide',
|
|
431
|
-
agentName: 'scout',
|
|
432
|
-
fromMessageId: 'd-b',
|
|
433
|
-
toMessageId: 'd-a',
|
|
434
|
-
requesterName: 'antra',
|
|
435
|
-
});
|
|
436
|
-
assert.equal(result.ok, true, String(result.error));
|
|
437
|
-
assert.equal(result.hidden, 3);
|
|
438
|
-
assert.deepEqual(result.hiddenRefs.map((ref) => ref.messageId), ['d-a', 'd-mid', 'd-b']);
|
|
439
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5']);
|
|
440
|
-
});
|
|
441
|
-
it("a module's removal of a message in a body takes the whole body, and a plain message alone, with no full read of the branch", async () => {
|
|
442
|
-
const [b0, b1, b2] = appendShards('g-mod', ['b0', 'b1', 'b2']);
|
|
443
|
-
const plain = String(cm().addMessage('user', [{ type: 'text', text: 'plain' }]));
|
|
444
|
-
const internals = framework;
|
|
445
|
-
// A full read inflates every attachment on the branch: the body is found
|
|
446
|
-
// in blob-free windows instead.
|
|
447
|
-
const reads = cm();
|
|
448
|
-
const getAllMessages = reads.getAllMessages;
|
|
449
|
-
reads.getAllMessages = () => { throw new Error('read the whole branch'); };
|
|
450
|
-
try {
|
|
451
|
-
internals.removeMessage(b1);
|
|
452
|
-
for (const id of [b0, b1, b2])
|
|
453
|
-
assert.equal(cm().getMessage(id), null);
|
|
454
|
-
internals.removeMessage(plain);
|
|
455
|
-
assert.equal(cm().getMessage(plain), null);
|
|
456
|
-
}
|
|
457
|
-
finally {
|
|
458
|
-
reads.getAllMessages = getAllMessages;
|
|
459
|
-
}
|
|
460
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5']);
|
|
461
|
-
});
|
|
462
|
-
it('a rewind whose newest message is the last shard of a body takes the whole body', async () => {
|
|
463
|
-
const [s0, s1, s2] = appendShards('g-doc', ['d0', 'd1', 'd2']);
|
|
464
|
-
const internals = framework;
|
|
465
|
-
const record = internals.shedNewestTurn(framework.getAgent('scout'));
|
|
466
|
-
assert.ok(record);
|
|
467
|
-
assert.deepEqual(record.removedIds, [s2, s1, s0]);
|
|
468
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5']);
|
|
469
|
-
});
|
|
470
|
-
it('a rewind of a tool result takes its tool_use turn whole, a turn stored as a body, in one removal', async () => {
|
|
471
|
-
// As context-manager's chunker stores them: the tool_use block on the
|
|
472
|
-
// turn's first shard, text after it; then the result, also a body.
|
|
473
|
-
const store = cm().messageStore;
|
|
474
|
-
const turn = [
|
|
475
|
-
store.append('assistant', [{ type: 'tool_use', id: 't9', name: 'shell', input: {} }], {}, undefined, { bodyGroupId: 'g-turn', shardIndex: 0 }).id,
|
|
476
|
-
store.append('assistant', [{ type: 'text', text: 'narration' }], {}, undefined, { bodyGroupId: 'g-turn', shardIndex: 1 }).id,
|
|
477
|
-
];
|
|
478
|
-
const result = [
|
|
479
|
-
store.append('user', [{ type: 'tool_result', toolUseId: 't9', content: 'r0' }], {}, undefined, { bodyGroupId: 'g-result', shardIndex: 0 }).id,
|
|
480
|
-
store.append('user', [{ type: 'text', text: 'r1' }], {}, undefined, { bodyGroupId: 'g-result', shardIndex: 1 }).id,
|
|
481
|
-
];
|
|
482
|
-
const c = cm();
|
|
483
|
-
const ranges = [];
|
|
484
|
-
const original = c.removeMessages.bind(c);
|
|
485
|
-
c.removeMessages = (a, b) => { ranges.push([a, b]); original(a, b); };
|
|
486
|
-
try {
|
|
487
|
-
const internals = framework;
|
|
488
|
-
const record = internals.shedNewestTurn(framework.getAgent('scout'));
|
|
489
|
-
assert.ok(record);
|
|
490
|
-
assert.equal(record.kind, 'tool');
|
|
491
|
-
assert.deepEqual(record.removedIds, [result[1], result[0], turn[1], turn[0]]);
|
|
492
|
-
assert.deepEqual(ranges, [[turn[0], result[1]]], "one removal, from the turn's first shard to the result's last");
|
|
493
|
-
}
|
|
494
|
-
finally {
|
|
495
|
-
c.removeMessages = original;
|
|
496
|
-
}
|
|
497
|
-
assert.deepEqual(remainingTexts(), ['m1', 'm2', 'm3', 'm4', 'm5']);
|
|
498
|
-
});
|
|
499
|
-
// --- failure path ----------------------------------------------------------
|
|
500
|
-
it('a failed suppression restores the source branch, retires its outbox batch, and leaves the store bootable', async () => {
|
|
501
|
-
const c = cm();
|
|
502
|
-
const original = c.removeMessages;
|
|
503
|
-
c.removeMessages = () => { throw new Error('injected redaction failure'); };
|
|
504
|
-
try {
|
|
505
|
-
// A 2-shard group forces the range path (the injected failure).
|
|
506
|
-
const [s0] = appendShards('g2', ['x0', 'x1']);
|
|
507
|
-
await assert.rejects(framework.suppressMessages('scout', { messageIds: [s0] }), (e) => e instanceof OperatorActionError && e.code === 'failed'
|
|
508
|
-
&& /active branch restored to main/.test(e.message) && /injected/.test(e.message));
|
|
509
|
-
}
|
|
510
|
-
finally {
|
|
511
|
-
c.removeMessages = original;
|
|
512
|
-
}
|
|
513
|
-
assert.equal(cm().currentBranch().name, 'main');
|
|
514
|
-
const fork = cm().listBranches().find((b) => b.name.startsWith('suppress/'));
|
|
515
|
-
assert.ok(fork, 'the fork is kept for diagnosis');
|
|
516
|
-
const outbox = framework.discordAwarenessOutbox;
|
|
517
|
-
assert.equal(outbox.batches().filter((b) => b.status === 'prepared').length, 0, 'no armed batch left behind');
|
|
518
|
-
// The reproduction from review: open the failed fork, restart the host.
|
|
519
|
-
// Before the fix, the orphaned prepared batch re-ran the failed removal
|
|
520
|
-
// at boot and AgentFramework.create() threw.
|
|
521
|
-
await cm().switchBranch(fork.name);
|
|
522
|
-
await framework.stop();
|
|
523
|
-
framework = await AgentFramework.create({
|
|
524
|
-
storePath,
|
|
525
|
-
membrane: new MockMembrane().asMembrane(),
|
|
526
|
-
agents: [{ name: 'scout', model: 'test-model', systemPrompt: 'You are scout.' }],
|
|
527
|
-
modules: [],
|
|
528
|
-
});
|
|
529
|
-
assert.equal(cm().currentBranch().name, fork.name, 'host boots on the diagnostic branch');
|
|
530
|
-
});
|
|
531
|
-
it('the suppression outbox batch activates only after the last redaction', async () => {
|
|
532
|
-
const outbox = framework.discordAwarenessOutbox;
|
|
533
|
-
const c = cm();
|
|
534
|
-
const original = c.removeMessage;
|
|
535
|
-
const seen = [];
|
|
536
|
-
c.removeMessage = (id) => { seen.push(outbox.batches().map((b) => b.status)); original.call(c, id); };
|
|
537
|
-
try {
|
|
538
|
-
await framework.suppressMessages('scout', { messageIds: [ids[1], ids[3]] });
|
|
539
|
-
}
|
|
540
|
-
finally {
|
|
541
|
-
c.removeMessage = original;
|
|
542
|
-
}
|
|
543
|
-
assert.equal(seen.length, 2);
|
|
544
|
-
for (const statuses of seen)
|
|
545
|
-
assert.deepEqual(statuses, ['prepared'], 'still prepared while removals run');
|
|
546
|
-
assert.deepEqual(outbox.batches().map((b) => b.status), ['active']);
|
|
547
|
-
});
|
|
548
|
-
it("the idle gate also refuses 'idle+turn-alive' (turn token held, status idle)", async () => {
|
|
549
|
-
const tokens = framework.activeTurnTokens;
|
|
550
|
-
tokens.set('scout', 1);
|
|
551
|
-
try {
|
|
552
|
-
await assert.rejects(framework.rollbackToMessage('scout', { messageId: ids[1] }), (e) => e instanceof OperatorActionError && e.code === 'agent-busy' && /idle\+turn-alive/.test(e.message));
|
|
553
|
-
await assert.rejects(framework.suppressMessages('scout', { messageIds: [ids[1]] }), (e) => e instanceof OperatorActionError && e.code === 'agent-busy');
|
|
554
|
-
}
|
|
555
|
-
finally {
|
|
556
|
-
tokens.delete('scout');
|
|
557
|
-
}
|
|
558
|
-
assert.equal(cm().listBranches().length, 1);
|
|
559
|
-
});
|
|
560
|
-
it('nudge and settings changes are recorded; getOperatorLog reads newest-last', async () => {
|
|
561
|
-
framework.nudgeAgent('scout', 'host-console');
|
|
562
|
-
framework.updateAgentRuntimeSettings('scout', { contextBudgetTokens: 150_000 }, {
|
|
563
|
-
persist: false,
|
|
564
|
-
requester: { via: 'webui', name: 'antra' },
|
|
565
|
-
});
|
|
566
|
-
framework.recordOperatorAction({ kind: 'quiesce', requester: { via: 'webui' }, params: { reason: 'maintenance' } });
|
|
567
|
-
const log = framework.getOperatorLog({ limit: 10 });
|
|
568
|
-
assert.deepEqual(log.map((e) => e.kind), ['nudge', 'settings-update', 'quiesce']);
|
|
569
|
-
assert.equal(log[1].params?.persist, false);
|
|
570
|
-
assert.deepEqual(framework.getOperatorLog({ limit: 1 }).map((e) => e.kind), ['quiesce']);
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
describe('OperatorLog', () => {
|
|
574
|
-
it('creates parent directories, tolerates corrupt lines, and is inert when disabled', () => {
|
|
575
|
-
const dir = mkdtempSync(join(tmpdir(), 'operator-log-'));
|
|
576
|
-
try {
|
|
577
|
-
const path = join(dir, 'nested', 'deeper', 'ops.jsonl');
|
|
578
|
-
const log = new OperatorLog(path);
|
|
579
|
-
log.append({ kind: 'a' });
|
|
580
|
-
writeFileSync(path, '{not json\n', { flag: 'a' });
|
|
581
|
-
log.append({ kind: 'b', agent: 'x' });
|
|
582
|
-
assert.deepEqual(log.readTail().map((e) => e.kind), ['a', 'b']);
|
|
583
|
-
assert.deepEqual(log.readTail(1).map((e) => e.kind), ['b']);
|
|
584
|
-
const off = new OperatorLog(undefined);
|
|
585
|
-
assert.equal(off.enabled, false);
|
|
586
|
-
const entry = off.append({ kind: 'noop' });
|
|
587
|
-
assert.equal(entry.kind, 'noop');
|
|
588
|
-
assert.deepEqual(off.readTail(), []);
|
|
589
|
-
}
|
|
590
|
-
finally {
|
|
591
|
-
rmSync(dir, { recursive: true, force: true });
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
//# sourceMappingURL=operator-surgery.test.js.map
|