@animalabs/agent-framework 0.22.0 → 0.22.2
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 +12 -5
- package/dist/src/agent.d.ts +192 -19
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +407 -66
- 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 +84 -23
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/api/types.d.ts +9 -1
- package/dist/src/api/types.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/framework.d.ts +682 -103
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +3202 -718
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts.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 +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- 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 +26 -7
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +102 -22
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.d.ts.map +1 -1
- package/dist/src/mcpl/checkpoint-manager.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/src/mcpl/index.d.ts +2 -0
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts.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 +38 -3
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +81 -16
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +26 -3
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +87 -23
- package/dist/src/mcpl/push-handler.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +2 -1
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +20 -9
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +29 -6
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +57 -16
- 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 +46 -3
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +98 -15
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- 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 +23 -5
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +103 -10
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +30 -26
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/module-registry.d.ts +9 -3
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +3 -2
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/api/index.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +4 -2
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/health/index.d.ts.map +1 -1
- package/dist/src/modules/health/index.js.map +1 -1
- package/dist/src/modules/history/index.d.ts.map +1 -1
- package/dist/src/modules/history/index.js.map +1 -1
- package/dist/src/modules/history/semantic.d.ts.map +1 -1
- package/dist/src/modules/history/semantic.js.map +1 -1
- 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 +22 -4
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +63 -25
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +8 -4
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +85 -16
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +56 -11
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +288 -43
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/reconcile.d.ts +31 -1
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -1
- package/dist/src/modules/workspace/reconcile.js +63 -12
- package/dist/src/modules/workspace/reconcile.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +27 -2
- 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.map +1 -1
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/operator-log.d.ts +41 -0
- package/dist/src/operator-log.d.ts.map +1 -1
- package/dist/src/operator-log.js.map +1 -1
- package/dist/src/provider-waits.d.ts +216 -0
- package/dist/src/provider-waits.d.ts.map +1 -0
- package/dist/src/provider-waits.js +482 -0
- package/dist/src/provider-waits.js.map +1 -0
- 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.map +1 -1
- package/dist/src/recovery/offline-branch.js +29 -24
- package/dist/src/recovery/offline-branch.js.map +1 -1
- package/dist/src/recovery/recover-cli.js.map +1 -1
- package/dist/src/refusal-reactions.d.ts +14 -12
- package/dist/src/refusal-reactions.d.ts.map +1 -1
- package/dist/src/refusal-reactions.js +14 -12
- package/dist/src/refusal-reactions.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/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.map +1 -1
- package/dist/src/tool-image-ledger.js.map +1 -1
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/tool-result-guard.d.ts +30 -13
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +71 -25
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tune-out/coordinator.d.ts.map +1 -1
- 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 +42 -6
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +12 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +10 -0
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +20 -8
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +75 -13
- package/dist/src/types/trace.d.ts.map +1 -1
- package/dist/src/usage/usage-tracker.d.ts.map +1 -1
- package/dist/test/agent-runtime-settings.test.js +1139 -3
- package/dist/test/agent-runtime-settings.test.js.map +1 -1
- package/dist/test/batched-wake-locus.test.js.map +1 -1
- package/dist/test/channel-label-history.test.js.map +1 -1
- package/dist/test/code-execution.test.js.map +1 -1
- package/dist/test/conversation-fork-injection-scoping.test.js.map +1 -1
- package/dist/test/conversation-router.test.js.map +1 -1
- package/dist/test/conversation-routing.test.js +240 -6
- package/dist/test/conversation-routing.test.js.map +1 -1
- package/dist/test/discord-awareness-outbox.test.js +107 -0
- package/dist/test/discord-awareness-outbox.test.js.map +1 -1
- package/dist/test/discord-typing-keepalive.test.d.ts +2 -0
- package/dist/test/discord-typing-keepalive.test.d.ts.map +1 -0
- package/dist/test/discord-typing-keepalive.test.js +77 -0
- package/dist/test/discord-typing-keepalive.test.js.map +1 -0
- package/dist/test/ephemeral-settle.test.js.map +1 -1
- package/dist/test/event-gate-passthrough.test.js.map +1 -1
- package/dist/test/event-gate-policy-mutation.test.js.map +1 -1
- package/dist/test/event-gate-rate-limit.test.js.map +1 -1
- package/dist/test/event-gate-script.test.js.map +1 -1
- package/dist/test/event-gate-selfwake.test.js.map +1 -1
- package/dist/test/event-gate-tags.test.js.map +1 -1
- package/dist/test/event-gate.test.js.map +1 -1
- package/dist/test/explicit-prose-routing.test.js +363 -44
- package/dist/test/explicit-prose-routing.test.js.map +1 -1
- package/dist/test/framework.test.js +160 -1
- package/dist/test/framework.test.js.map +1 -1
- package/dist/test/helpers/coalescing-fixture.d.ts +2 -0
- package/dist/test/helpers/coalescing-fixture.d.ts.map +1 -1
- package/dist/test/helpers/coalescing-fixture.js +11 -4
- package/dist/test/helpers/coalescing-fixture.js.map +1 -1
- package/dist/test/helpers/mock-membrane.d.ts.map +1 -1
- package/dist/test/helpers/mock-membrane.js.map +1 -1
- package/dist/test/hide-then-turn.test.d.ts +2 -0
- package/dist/test/hide-then-turn.test.d.ts.map +1 -0
- package/dist/test/hide-then-turn.test.js +101 -0
- package/dist/test/hide-then-turn.test.js.map +1 -0
- package/dist/test/history-module-overview.test.js.map +1 -1
- package/dist/test/history-module-semantic.test.js.map +1 -1
- package/dist/test/history-module.test.js.map +1 -1
- package/dist/test/history-semantic-review-findings.test.js.map +1 -1
- package/dist/test/host-quiesce.test.js +125 -0
- package/dist/test/host-quiesce.test.js.map +1 -1
- package/dist/test/inference-exhaustion-rewind.test.js +220 -14
- package/dist/test/inference-exhaustion-rewind.test.js.map +1 -1
- package/dist/test/inference-failure-bounds.test.d.ts +2 -0
- package/dist/test/inference-failure-bounds.test.d.ts.map +1 -0
- package/dist/test/inference-failure-bounds.test.js +1202 -0
- package/dist/test/inference-failure-bounds.test.js.map +1 -0
- package/dist/test/kv-unified-open-flight-retry.test.js.map +1 -1
- package/dist/test/late-events-after-stop.test.d.ts +2 -0
- package/dist/test/late-events-after-stop.test.d.ts.map +1 -0
- package/dist/test/late-events-after-stop.test.js +122 -0
- package/dist/test/late-events-after-stop.test.js.map +1 -0
- package/dist/test/liveness-watchdog.test.js.map +1 -1
- package/dist/test/maintenance-timer.test.js +1564 -2
- package/dist/test/maintenance-timer.test.js.map +1 -1
- package/dist/test/mcp-server-bin.test.d.ts +2 -0
- package/dist/test/mcp-server-bin.test.d.ts.map +1 -0
- package/dist/test/mcp-server-bin.test.js +142 -0
- package/dist/test/mcp-server-bin.test.js.map +1 -0
- package/dist/test/mcpl-awareness-barrier.test.js +141 -0
- package/dist/test/mcpl-awareness-barrier.test.js.map +1 -1
- package/dist/test/mcpl-child-env.test.js +1 -1
- package/dist/test/mcpl-child-env.test.js.map +1 -1
- package/dist/test/mcpl-coalesced-content-parity.test.d.ts +2 -0
- package/dist/test/mcpl-coalesced-content-parity.test.d.ts.map +1 -0
- package/dist/test/mcpl-coalesced-content-parity.test.js +532 -0
- package/dist/test/mcpl-coalesced-content-parity.test.js.map +1 -0
- package/dist/test/mcpl-coalescing.test.js +78 -16
- package/dist/test/mcpl-coalescing.test.js.map +1 -1
- package/dist/test/mcpl-config-diagnostics.test.js +6 -3
- package/dist/test/mcpl-config-diagnostics.test.js.map +1 -1
- package/dist/test/mcpl-gate-roundtrip.test.js.map +1 -1
- package/dist/test/mcpl-manifest-changed.test.js +2 -1
- package/dist/test/mcpl-manifest-changed.test.js.map +1 -1
- package/dist/test/mcpl-reconnect-events.test.js.map +1 -1
- package/dist/test/mcpl-reconnect-reregistration.test.js +2 -0
- package/dist/test/mcpl-reconnect-reregistration.test.js.map +1 -1
- package/dist/test/mcpl-reference-fetcher.test.js +232 -4
- package/dist/test/mcpl-reference-fetcher.test.js.map +1 -1
- package/dist/test/mcpl-reference-fields.test.js +69 -2
- package/dist/test/mcpl-reference-fields.test.js.map +1 -1
- package/dist/test/mcpl-rejection-log-lines.test.d.ts +2 -0
- package/dist/test/mcpl-rejection-log-lines.test.d.ts.map +1 -0
- package/dist/test/mcpl-rejection-log-lines.test.js +349 -0
- package/dist/test/mcpl-rejection-log-lines.test.js.map +1 -0
- package/dist/test/mcpl-stderr-tail.test.d.ts +2 -0
- package/dist/test/mcpl-stderr-tail.test.d.ts.map +1 -0
- package/dist/test/mcpl-stderr-tail.test.js +210 -0
- package/dist/test/mcpl-stderr-tail.test.js.map +1 -0
- package/dist/test/mcpl-tool-lifecycle-e2e.test.js.map +1 -1
- package/dist/test/mcpl-tool-lifecycle-emitter.test.js.map +1 -1
- package/dist/test/mcpl-tool-lifecycle-script.test.js.map +1 -1
- package/dist/test/mcpl-tool-lifecycle.test.js.map +1 -1
- package/dist/test/mcpl-transport-close.test.d.ts +2 -0
- package/dist/test/mcpl-transport-close.test.d.ts.map +1 -0
- package/dist/test/mcpl-transport-close.test.js +373 -0
- package/dist/test/mcpl-transport-close.test.js.map +1 -0
- package/dist/test/mcpl-transport-spawn.test.d.ts +2 -0
- package/dist/test/mcpl-transport-spawn.test.d.ts.map +1 -0
- package/dist/test/mcpl-transport-spawn.test.js +58 -0
- package/dist/test/mcpl-transport-spawn.test.js.map +1 -0
- package/dist/test/mcpl-ws-transport.test.js +104 -0
- package/dist/test/mcpl-ws-transport.test.js.map +1 -1
- package/dist/test/offline-recovery-branch.test.js +344 -0
- package/dist/test/offline-recovery-branch.test.js.map +1 -1
- package/dist/test/operator-surgery.test.js +197 -0
- package/dist/test/operator-surgery.test.js.map +1 -1
- package/dist/test/ops-alert.test.js +2 -1
- package/dist/test/ops-alert.test.js.map +1 -1
- package/dist/test/overbudget-drain-breaker.test.js +1 -0
- package/dist/test/overbudget-drain-breaker.test.js.map +1 -1
- package/dist/test/pack-installs-alone.test.d.ts +2 -0
- package/dist/test/pack-installs-alone.test.d.ts.map +1 -0
- package/dist/test/pack-installs-alone.test.js +284 -0
- package/dist/test/pack-installs-alone.test.js.map +1 -0
- package/dist/test/physical-window-restart.test.d.ts +6 -4
- package/dist/test/physical-window-restart.test.d.ts.map +1 -1
- package/dist/test/physical-window-restart.test.js +275 -10
- package/dist/test/physical-window-restart.test.js.map +1 -1
- package/dist/test/placed-reaction-baseline.test.d.ts +2 -0
- package/dist/test/placed-reaction-baseline.test.d.ts.map +1 -0
- package/dist/test/placed-reaction-baseline.test.js +312 -0
- package/dist/test/placed-reaction-baseline.test.js.map +1 -0
- package/dist/test/present-while-acting.test.js +949 -6
- package/dist/test/present-while-acting.test.js.map +1 -1
- package/dist/test/provider-acceleration-cooldown.test.js +5 -1
- package/dist/test/provider-acceleration-cooldown.test.js.map +1 -1
- package/dist/test/provider-waits.test.d.ts +2 -0
- package/dist/test/provider-waits.test.d.ts.map +1 -0
- package/dist/test/provider-waits.test.js +2259 -0
- package/dist/test/provider-waits.test.js.map +1 -0
- package/dist/test/puppet-tool-call.test.js +2 -0
- package/dist/test/puppet-tool-call.test.js.map +1 -1
- package/dist/test/reaction-baseline-platform.test.d.ts +2 -0
- package/dist/test/reaction-baseline-platform.test.d.ts.map +1 -0
- package/dist/test/reaction-baseline-platform.test.js +124 -0
- package/dist/test/reaction-baseline-platform.test.js.map +1 -0
- package/dist/test/record-journal.test.js.map +1 -1
- package/dist/test/refusal-reaction-baseline.test.js +10 -3
- package/dist/test/refusal-reaction-baseline.test.js.map +1 -1
- package/dist/test/refusal-rewind.test.js +9 -0
- package/dist/test/refusal-rewind.test.js.map +1 -1
- package/dist/test/refusal-single-call.test.js.map +1 -1
- package/dist/test/release-bump.test.d.ts +2 -0
- package/dist/test/release-bump.test.d.ts.map +1 -0
- package/dist/test/release-bump.test.js +248 -0
- package/dist/test/release-bump.test.js.map +1 -0
- package/dist/test/release-changelog.test.js.map +1 -1
- package/dist/test/release-holds.test.d.ts +2 -0
- package/dist/test/release-holds.test.d.ts.map +1 -0
- package/dist/test/release-holds.test.js +456 -0
- package/dist/test/release-holds.test.js.map +1 -0
- package/dist/test/same-round-think-policy.test.js.map +1 -1
- package/dist/test/save-recent-image.test.js +138 -2
- package/dist/test/save-recent-image.test.js.map +1 -1
- package/dist/test/shutdown-errors.test.js.map +1 -1
- package/dist/test/silent-heartbeat-rows.test.js.map +1 -1
- package/dist/test/stop-with-host-operations.test.d.ts +20 -0
- package/dist/test/stop-with-host-operations.test.d.ts.map +1 -0
- package/dist/test/stop-with-host-operations.test.js +1174 -0
- package/dist/test/stop-with-host-operations.test.js.map +1 -0
- package/dist/test/stop-with-work-in-flight.test.js +162 -50
- package/dist/test/stop-with-work-in-flight.test.js.map +1 -1
- package/dist/test/surgery-marks-receipt.test.d.ts +2 -0
- package/dist/test/surgery-marks-receipt.test.d.ts.map +1 -0
- package/dist/test/surgery-marks-receipt.test.js +540 -0
- package/dist/test/surgery-marks-receipt.test.js.map +1 -0
- package/dist/test/tool-batch-hook.test.js.map +1 -1
- package/dist/test/tool-result-guard.test.js +352 -16
- package/dist/test/tool-result-guard.test.js.map +1 -1
- package/dist/test/tool-result-spill.test.js.map +1 -1
- package/dist/test/tool-wrapper-prose-guard-integration.test.js.map +1 -1
- package/dist/test/trunk-channel-routing.test.js +330 -7
- package/dist/test/trunk-channel-routing.test.js.map +1 -1
- package/dist/test/tune-out-e2e.test.js.map +1 -1
- package/dist/test/unconvertible-tool-result.test.js.map +1 -1
- package/dist/test/unsent-compiles.test.d.ts +2 -0
- package/dist/test/unsent-compiles.test.d.ts.map +1 -0
- package/dist/test/unsent-compiles.test.js +139 -0
- package/dist/test/unsent-compiles.test.js.map +1 -0
- package/dist/test/workspace-branch-continuation.test.js.map +1 -1
- package/dist/test/workspace-materialize-freshness.test.js.map +1 -1
- package/dist/test/workspace-read-text.test.js.map +1 -1
- package/dist/test/workspace-three-way.test.js +1022 -7
- package/dist/test/workspace-three-way.test.js.map +1 -1
- package/dist/test/workspace-watcher.test.js.map +1 -1
- package/dist/test/xml-round-persist.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -6
- package/src/agent.ts +415 -67
- package/src/api/mcp-server-core.ts +681 -0
- package/src/api/mcp-server.ts +16 -685
- package/src/api/server.ts +87 -26
- package/src/api/types.ts +9 -1
- package/src/framework.ts +3389 -782
- package/src/index.ts +9 -4
- package/src/mcpl/channel-registry.ts +126 -31
- package/src/mcpl/feature-set-manager.ts +4 -3
- package/src/mcpl/index.ts +2 -0
- package/src/mcpl/log-value.ts +116 -0
- package/src/mcpl/prose-stream-router.ts +6 -6
- package/src/mcpl/push-coalescer.ts +76 -12
- package/src/mcpl/push-handler.ts +95 -23
- package/src/mcpl/reference-fetcher.ts +18 -8
- package/src/mcpl/references.ts +57 -13
- package/src/mcpl/refusal-lines.ts +59 -0
- package/src/mcpl/server-connection.ts +125 -15
- package/src/mcpl/tool-classes.ts +3 -2
- package/src/mcpl/transport.ts +105 -14
- package/src/mcpl/types.ts +5 -1
- package/src/module-registry.ts +17 -9
- package/src/modules/discord/index.ts +4 -2
- package/src/modules/workspace/disk-agreement.ts +74 -18
- package/src/modules/workspace/index.ts +85 -15
- package/src/modules/workspace/observe.ts +295 -43
- package/src/modules/workspace/reconcile.ts +90 -12
- package/src/modules/workspace/types.ts +26 -1
- package/src/operator-log.ts +30 -0
- package/src/provider-waits.ts +523 -0
- package/src/recovery/offline-branch.ts +32 -28
- package/src/refusal-reactions.ts +14 -12
- package/src/stored-removal.ts +126 -0
- package/src/tool-result-guard.ts +72 -24
- package/src/types/agent.ts +42 -6
- package/src/types/events.ts +12 -0
- package/src/types/framework.ts +10 -0
- package/src/types/module.ts +20 -8
- package/src/types/trace.ts +76 -14
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider waits: a provider's stated `retry-after`, kept as a deadline that
|
|
3
|
+
* outlives the process.
|
|
4
|
+
*
|
|
5
|
+
* When a provider answers "retry after N", calling the same model again
|
|
6
|
+
* before then adds traffic the provider has said will fail. The framework
|
|
7
|
+
* therefore records the wait per (agent, model) and admits no call to that
|
|
8
|
+
* model for that agent until it passes. The wait is a fact about the provider,
|
|
9
|
+
* not about the conversation, so it is kept in typed Chronicle records
|
|
10
|
+
* (RecordJournal): a restart honours it, and a branch switch or rollback
|
|
11
|
+
* does not rewind it.
|
|
12
|
+
*
|
|
13
|
+
* - A later, shorter wait for the same (agent, model) never shortens an
|
|
14
|
+
* outstanding longer one: the binding deadline is the maximum. Requests
|
|
15
|
+
* that finish at different times can carry different hints.
|
|
16
|
+
* - A negative wait is already over (a provider's "retry now", or an HTTP
|
|
17
|
+
* date already past), -Infinity included: it binds nothing, the same as 0.
|
|
18
|
+
* - A wait that cannot be represented as an instant (NaN, +Infinity, or past
|
|
19
|
+
* the last instant a Date can hold) becomes an indefinite wait rather than
|
|
20
|
+
* a shorter one, held until explicitly released.
|
|
21
|
+
* - A wait ends when its instant passes (nothing is written), or when an
|
|
22
|
+
* operator releases it (recorded). Selecting a different model is not a
|
|
23
|
+
* release: that model proceeds, and the old model's wait still applies if it
|
|
24
|
+
* is selected again before the wait passes.
|
|
25
|
+
*
|
|
26
|
+
* One writer per record type (RecordJournal's contract): the framework that
|
|
27
|
+
* owns the store.
|
|
28
|
+
*/
|
|
29
|
+
import type { JsStore } from '@animalabs/chronicle';
|
|
30
|
+
export declare const PROVIDER_WAIT_RECORD_TYPE = "framework/provider-wait";
|
|
31
|
+
export interface ProviderWait {
|
|
32
|
+
agent: string;
|
|
33
|
+
model: string;
|
|
34
|
+
/** Epoch ms before which no call is admitted; null holds until released. */
|
|
35
|
+
until: number | null;
|
|
36
|
+
/** Why, in the provider's words (bounded by the caller). */
|
|
37
|
+
reason: string;
|
|
38
|
+
/** When the binding wait was recorded. */
|
|
39
|
+
setAt: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The instant a stated wait ends, or null when it cannot be represented:
|
|
43
|
+
* the wait is then held until released, never shortened. A negative wait
|
|
44
|
+
* ends at `now`: it is already over, never indefinite.
|
|
45
|
+
*/
|
|
46
|
+
export declare function waitDeadline(retryAfterMs: unknown, now: number): number | null;
|
|
47
|
+
export interface ProviderWaitChange {
|
|
48
|
+
/** The binding wait after this call; for a wait already over with nothing
|
|
49
|
+
* binding, that wait as stated, which binds nothing and isn't recorded. */
|
|
50
|
+
wait: ProviderWait;
|
|
51
|
+
/** False when an outstanding longer (or indefinite) wait already binds, or
|
|
52
|
+
* when the wait is already over and nothing binds. */
|
|
53
|
+
changed: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One wait a release lifted. `release` says how far that reaches:
|
|
57
|
+
* - 'recorded': the release is durably recorded, so a restart keeps it;
|
|
58
|
+
* - 'pending': it binds in this process, but its record has not landed yet
|
|
59
|
+
* and is offered again at the next act (a restart before then restores the
|
|
60
|
+
* wait). Once the journal can't be written again (an append that threw
|
|
61
|
+
* inside the store), it is offered no more in this process;
|
|
62
|
+
* - 'in-process override': the hold that stands for unreadable recorded
|
|
63
|
+
* waits, lifted for this process only (a restart that still cannot read
|
|
64
|
+
* them holds again). The release itself is still offered to the journal,
|
|
65
|
+
* so once the history can be read it applies there, in order.
|
|
66
|
+
*/
|
|
67
|
+
export interface ProviderWaitRelease {
|
|
68
|
+
wait: ProviderWait;
|
|
69
|
+
release: 'recorded' | 'pending' | 'in-process override';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The model that stands for every model: how list() shows the hold for
|
|
73
|
+
* unreadable records, and what release() takes as "every model" (the same as
|
|
74
|
+
* omitting it). No provider model is named that.
|
|
75
|
+
*/
|
|
76
|
+
export declare const EVERY_MODEL = "*";
|
|
77
|
+
/** Text from a caller or a provider, with each control character a space, so
|
|
78
|
+
* it can't forge a log line where it is printed. */
|
|
79
|
+
export declare function withoutControls(text: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether a release's `model`, as an operator surface receives it, names a
|
|
82
|
+
* scope: omitted or EVERY_MODEL for every model, any other nonempty string
|
|
83
|
+
* without a control character for that model. Anything else is malformed and
|
|
84
|
+
* is refused, never taken as "every model" (and never logged).
|
|
85
|
+
*/
|
|
86
|
+
export declare function isReleaseModel(model: unknown): model is string | undefined;
|
|
87
|
+
export declare class ProviderWaits {
|
|
88
|
+
/**
|
|
89
|
+
* The reduction of exactly what the journal holds: its latest checkpoint and
|
|
90
|
+
* every entry after it, as loaded or as appended and synced. A checkpoint
|
|
91
|
+
* records this, so it covers the same ordered acts the journal does.
|
|
92
|
+
*/
|
|
93
|
+
private durable;
|
|
94
|
+
/**
|
|
95
|
+
* Acts of this process not yet known to be durably recorded, in the order
|
|
96
|
+
* they were made. They bind here from the moment they are made, and are
|
|
97
|
+
* offered to the journal, in order, at every later act until one lands.
|
|
98
|
+
* Once the journal can't be written again (an append that threw inside the
|
|
99
|
+
* store: RecordJournal.needsReopen), they are offered no more: the act that
|
|
100
|
+
* threw may still be in the store's log, where the next start finds it,
|
|
101
|
+
* and every later one holds in this process only.
|
|
102
|
+
*/
|
|
103
|
+
private readonly pending;
|
|
104
|
+
/** What binds in this process: `durable` with `pending` applied in order. */
|
|
105
|
+
private view;
|
|
106
|
+
/**
|
|
107
|
+
* Set while the recorded waits cannot be read. Their absence is then
|
|
108
|
+
* unknown, not "no waits": every (agent, model) is held (fail closed) until
|
|
109
|
+
* they can be read or an operator releases the agent's waits. Releases made
|
|
110
|
+
* meanwhile are kept in `waived` (agent, model or EVERY_MODEL) for this
|
|
111
|
+
* process; a restart that still cannot read them holds again.
|
|
112
|
+
*/
|
|
113
|
+
private unreadable;
|
|
114
|
+
private lastWriteTry;
|
|
115
|
+
/**
|
|
116
|
+
* How often unreadable recorded waits are read again. The hold that stands
|
|
117
|
+
* for them ends without any act (the records read again), so whoever holds
|
|
118
|
+
* on a wait with no deadline asks active() again this often.
|
|
119
|
+
*/
|
|
120
|
+
readonly retryReadMs: number;
|
|
121
|
+
private readonly store;
|
|
122
|
+
private readonly journal;
|
|
123
|
+
private readonly now;
|
|
124
|
+
private readonly log;
|
|
125
|
+
private readonly onUnreadable;
|
|
126
|
+
/**
|
|
127
|
+
* `store` null keeps waits in memory only (a framework without a store has
|
|
128
|
+
* no restart to survive). `onUnreadable` hears each time the recorded waits
|
|
129
|
+
* become unreadable, once per episode (a restart that still cannot read them
|
|
130
|
+
* is a new one): every (agent, model) is then held until they read again or
|
|
131
|
+
* an operator releases, and a cause that persists (a malformed or newer
|
|
132
|
+
* record) never reads again, so a person has to hear of it.
|
|
133
|
+
*/
|
|
134
|
+
constructor(store: JsStore | null, opts?: {
|
|
135
|
+
now?: () => number;
|
|
136
|
+
log?: (line: string) => void;
|
|
137
|
+
retryReadMs?: number;
|
|
138
|
+
onUnreadable?: (error: string) => void;
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* The wait binding (agent, model) now, if any. While the recorded waits
|
|
142
|
+
* cannot be read, an indefinite wait saying so, unless an operator released
|
|
143
|
+
* this agent's waits since.
|
|
144
|
+
*/
|
|
145
|
+
active(agent: string, model: string): ProviderWait | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Whether a recorded wait binds this agent now, unreadable history aside:
|
|
148
|
+
* the agent of a wait the listing shows, even one the framework no longer
|
|
149
|
+
* has (a disposed conversation fork), which a release can then name.
|
|
150
|
+
*/
|
|
151
|
+
recorded(agent: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Every wait binding now, for one agent or all. While the recorded waits
|
|
154
|
+
* cannot be read, it leads with an indefinite wait on EVERY_MODEL saying
|
|
155
|
+
* so (for the agent asked about, or for EVERY_MODEL agents).
|
|
156
|
+
*/
|
|
157
|
+
list(agent?: string): ProviderWait[];
|
|
158
|
+
/** Record a provider's stated wait for (agent, model). */
|
|
159
|
+
set(agent: string, model: string, retryAfterMs: unknown, reason: string): ProviderWaitChange;
|
|
160
|
+
/**
|
|
161
|
+
* Release (agent, model)'s wait, or every wait of the agent when `model` is
|
|
162
|
+
* omitted; recorded. While the recorded waits cannot be read, it also lifts
|
|
163
|
+
* the hold that stands for them, exactly as far as the release names (that
|
|
164
|
+
* model, or every model), in this process only. Each lifted wait says how
|
|
165
|
+
* far its release reaches (ProviderWaitRelease). A release that finds
|
|
166
|
+
* nothing binding lifts and records nothing, and lists nothing. That
|
|
167
|
+
* includes a replay of an earlier release. It still offers this process's
|
|
168
|
+
* unrecorded acts to the journal again.
|
|
169
|
+
*/
|
|
170
|
+
release(agent: string, model: string | undefined, by: string): ProviderWaitRelease[];
|
|
171
|
+
private waived;
|
|
172
|
+
private unreadableWait;
|
|
173
|
+
/** Make an act bind in this process, ahead of its record. */
|
|
174
|
+
private apply;
|
|
175
|
+
/** Rebuild what binds from the journal's reduction and this process's pending acts, in order. */
|
|
176
|
+
private rebuildView;
|
|
177
|
+
/**
|
|
178
|
+
* Read the journal into `durable`. A failure leaves the history unreadable
|
|
179
|
+
* (fail closed, reported once), never empty. So does a record that parses
|
|
180
|
+
* but cannot be read as provider waits: a checkpoint also stands for every
|
|
181
|
+
* entry before it, so a malformed one read as empty would drop them all.
|
|
182
|
+
*/
|
|
183
|
+
private load;
|
|
184
|
+
/** Reconcile an ambiguous write before deciding anything against the journal. */
|
|
185
|
+
private reconcile;
|
|
186
|
+
/** Offer unrecorded acts and unreadable history again, at most every so often, absent other acts. */
|
|
187
|
+
private retry;
|
|
188
|
+
/**
|
|
189
|
+
* Record pending acts in order, each durable before the next: a lost wait
|
|
190
|
+
* would admit an early call after a crash. The first that fails stays
|
|
191
|
+
* pending with every act after it (they still bind in this process) and is
|
|
192
|
+
* reported; an ambiguous one is reconciled before the next attempt, so an
|
|
193
|
+
* act may be recorded twice, which reduces the same. An append or
|
|
194
|
+
* checkpoint that throws inside the store leaves the journal unwritable
|
|
195
|
+
* until the store is reopened (RecordJournal.needsReopen), so nothing is
|
|
196
|
+
* written after it: that is said once, where it happens, and the acts stay
|
|
197
|
+
* pending, binding in this process. A checkpoint records the
|
|
198
|
+
* journal's own reduction, never this process's unrecorded acts, and never
|
|
199
|
+
* while the history is unreadable (it would cover entries that were never
|
|
200
|
+
* reduced).
|
|
201
|
+
*/
|
|
202
|
+
private flush;
|
|
203
|
+
/**
|
|
204
|
+
* Say that the journal can't be written again: the store's append threw
|
|
205
|
+
* inside the store, and only a reopen (as at the next start) reads its log
|
|
206
|
+
* back. Called where that first happens; flush() writes nothing after it,
|
|
207
|
+
* so it is said once for the journal's life. What `writing` names may still
|
|
208
|
+
* be in the store's log, and the next start loads it if so. A stated wait
|
|
209
|
+
* still holds here, which is always safe; a later act loses only its
|
|
210
|
+
* record, so after a restart the agent's next call goes to the provider,
|
|
211
|
+
* and a wait it states again starts a new hold. No alert: a failed write
|
|
212
|
+
* is log-only.
|
|
213
|
+
*/
|
|
214
|
+
private reportUnwritable;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=provider-waits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-waits.d.ts","sourceRoot":"","sources":["../../src/provider-waits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIpD,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AAOnE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,4DAA4D;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