@animalabs/agent-framework 0.21.1 → 0.22.1
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 +54 -4
- package/dist/src/agent.d.ts +17 -4
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +105 -43
- package/dist/src/agent.js.map +1 -1
- package/dist/src/api/server.d.ts.map +1 -1
- package/dist/src/api/server.js +41 -4
- package/dist/src/api/server.js.map +1 -1
- package/dist/src/code-execution/py-runner.d.ts +22 -1
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +64 -9
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts +4 -0
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +215 -38
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/framework.d.ts +569 -59
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +3091 -542
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts +21 -0
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +40 -7
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +26 -3
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/conversation-router.d.ts +28 -1
- package/dist/src/mcpl/conversation-router.d.ts.map +1 -1
- package/dist/src/mcpl/conversation-router.js +17 -0
- package/dist/src/mcpl/conversation-router.js.map +1 -1
- package/dist/src/mcpl/feature-set-manager.d.ts +11 -0
- package/dist/src/mcpl/feature-set-manager.d.ts.map +1 -1
- package/dist/src/mcpl/feature-set-manager.js +31 -7
- package/dist/src/mcpl/feature-set-manager.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +4 -0
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +1 -0
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/prose-stream-router.d.ts +27 -6
- package/dist/src/mcpl/prose-stream-router.d.ts.map +1 -1
- package/dist/src/mcpl/prose-stream-router.js +85 -22
- package/dist/src/mcpl/prose-stream-router.js.map +1 -1
- package/dist/src/mcpl/push-coalescer.d.ts +32 -4
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +46 -13
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/push-handler.d.ts +5 -3
- package/dist/src/mcpl/push-handler.d.ts.map +1 -1
- package/dist/src/mcpl/push-handler.js +41 -11
- 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/server-connection.d.ts +32 -1
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +76 -11
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts +5 -2
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +25 -7
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.d.ts +52 -2
- package/dist/src/mcpl/tool-lifecycle.d.ts.map +1 -1
- package/dist/src/mcpl/tool-lifecycle.js +47 -1
- package/dist/src/mcpl/tool-lifecycle.js.map +1 -1
- package/dist/src/mcpl/tool-pattern-check.d.ts +51 -0
- package/dist/src/mcpl/tool-pattern-check.d.ts.map +1 -0
- package/dist/src/mcpl/tool-pattern-check.js +79 -0
- package/dist/src/mcpl/tool-pattern-check.js.map +1 -0
- package/dist/src/mcpl/types.d.ts +15 -5
- 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 +39 -0
- package/dist/src/mcpl/visible-content.d.ts.map +1 -0
- package/dist/src/mcpl/visible-content.js +54 -0
- package/dist/src/mcpl/visible-content.js.map +1 -0
- package/dist/src/module-registry.d.ts +90 -6
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +260 -18
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/workspace/branch-intent.d.ts +72 -0
- package/dist/src/modules/workspace/branch-intent.d.ts.map +1 -0
- package/dist/src/modules/workspace/branch-intent.js +83 -0
- package/dist/src/modules/workspace/branch-intent.js.map +1 -0
- package/dist/src/modules/workspace/disk-agreement.d.ts +167 -0
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -0
- package/dist/src/modules/workspace/disk-agreement.js +259 -0
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -0
- package/dist/src/modules/workspace/effects.d.ts +84 -0
- package/dist/src/modules/workspace/effects.d.ts.map +1 -0
- package/dist/src/modules/workspace/effects.js +368 -0
- package/dist/src/modules/workspace/effects.js.map +1 -0
- package/dist/src/modules/workspace/index.d.ts +155 -17
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +1101 -424
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +288 -0
- package/dist/src/modules/workspace/observe.d.ts.map +1 -0
- package/dist/src/modules/workspace/observe.js +825 -0
- package/dist/src/modules/workspace/observe.js.map +1 -0
- package/dist/src/modules/workspace/reconcile.d.ts +238 -0
- package/dist/src/modules/workspace/reconcile.d.ts.map +1 -0
- package/dist/src/modules/workspace/reconcile.js +909 -0
- package/dist/src/modules/workspace/reconcile.js.map +1 -0
- package/dist/src/modules/workspace/sync.d.ts +6 -59
- package/dist/src/modules/workspace/sync.d.ts.map +1 -1
- package/dist/src/modules/workspace/sync.js +6 -257
- package/dist/src/modules/workspace/sync.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +77 -10
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.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/record-journal.d.ts +127 -0
- package/dist/src/record-journal.d.ts.map +1 -0
- package/dist/src/record-journal.js +202 -0
- package/dist/src/record-journal.js.map +1 -0
- 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/shutdown.d.ts +13 -0
- package/dist/src/shutdown.d.ts.map +1 -0
- package/dist/src/shutdown.js +46 -0
- package/dist/src/shutdown.js.map +1 -0
- package/dist/src/silent-heartbeat.d.ts +74 -0
- package/dist/src/silent-heartbeat.d.ts.map +1 -0
- package/dist/src/silent-heartbeat.js +77 -0
- package/dist/src/silent-heartbeat.js.map +1 -0
- package/dist/src/tool-presentation.d.ts +50 -0
- package/dist/src/tool-presentation.d.ts.map +1 -0
- package/dist/src/tool-presentation.js +235 -0
- package/dist/src/tool-presentation.js.map +1 -0
- package/dist/src/tool-result-guard.d.ts +142 -6
- package/dist/src/tool-result-guard.d.ts.map +1 -1
- package/dist/src/tool-result-guard.js +357 -36
- package/dist/src/tool-result-guard.js.map +1 -1
- package/dist/src/tool-result-history.d.ts +13 -0
- package/dist/src/tool-result-history.d.ts.map +1 -1
- package/dist/src/tool-result-history.js +21 -1
- package/dist/src/tool-result-history.js.map +1 -1
- package/dist/src/types/agent.d.ts +18 -2
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +16 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +12 -0
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +26 -4
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +87 -3
- package/dist/src/types/trace.d.ts.map +1 -1
- package/dist/test/batched-wake-locus.test.d.ts +2 -0
- package/dist/test/batched-wake-locus.test.d.ts.map +1 -0
- package/dist/test/batched-wake-locus.test.js +166 -0
- package/dist/test/batched-wake-locus.test.js.map +1 -0
- package/dist/test/code-execution.test.js +386 -2
- package/dist/test/code-execution.test.js.map +1 -1
- package/dist/test/component-defaults.test.d.ts +2 -0
- package/dist/test/component-defaults.test.d.ts.map +1 -0
- package/dist/test/component-defaults.test.js +54 -0
- package/dist/test/component-defaults.test.js.map +1 -0
- package/dist/test/conversation-routing.test.js +57 -1
- package/dist/test/conversation-routing.test.js.map +1 -1
- package/dist/test/discord-awareness-outbox.test.js +3 -0
- package/dist/test/discord-awareness-outbox.test.js.map +1 -1
- package/dist/test/ephemeral-settle.test.js +3 -0
- package/dist/test/ephemeral-settle.test.js.map +1 -1
- package/dist/test/event-gate.test.js +118 -0
- package/dist/test/event-gate.test.js.map +1 -1
- package/dist/test/explicit-prose-routing.test.js +975 -0
- 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.map +1 -1
- package/dist/test/helpers/coalescing-fixture.js +3 -2
- package/dist/test/helpers/coalescing-fixture.js.map +1 -1
- package/dist/test/helpers/pytc-stop-rows.d.ts +11 -0
- package/dist/test/helpers/pytc-stop-rows.d.ts.map +1 -0
- package/dist/test/helpers/pytc-stop-rows.js +143 -0
- package/dist/test/helpers/pytc-stop-rows.js.map +1 -0
- package/dist/test/inference-exhaustion-rewind.test.js +142 -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 +1201 -0
- package/dist/test/inference-failure-bounds.test.js.map +1 -0
- 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/mcpl-awareness-barrier.test.js +141 -0
- package/dist/test/mcpl-awareness-barrier.test.js.map +1 -1
- package/dist/test/mcpl-coalescing.test.js +97 -22
- package/dist/test/mcpl-coalescing.test.js.map +1 -1
- package/dist/test/mcpl-config-diagnostics.test.d.ts +2 -0
- package/dist/test/mcpl-config-diagnostics.test.d.ts.map +1 -0
- package/dist/test/mcpl-config-diagnostics.test.js +452 -0
- package/dist/test/mcpl-config-diagnostics.test.js.map +1 -0
- package/dist/test/mcpl-empty-content.test.d.ts +2 -0
- package/dist/test/mcpl-empty-content.test.d.ts.map +1 -0
- package/dist/test/mcpl-empty-content.test.js +368 -0
- package/dist/test/mcpl-empty-content.test.js.map +1 -0
- 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-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-tool-lifecycle-emitter.test.js +106 -1
- package/dist/test/mcpl-tool-lifecycle-emitter.test.js.map +1 -1
- package/dist/test/mcpl-tool-lifecycle-script.test.d.ts +2 -0
- package/dist/test/mcpl-tool-lifecycle-script.test.d.ts.map +1 -0
- package/dist/test/mcpl-tool-lifecycle-script.test.js +288 -0
- package/dist/test/mcpl-tool-lifecycle-script.test.js.map +1 -0
- package/dist/test/mcpl-ws-transport.test.js +103 -0
- package/dist/test/mcpl-ws-transport.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/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/prose-stream-router.test.js +41 -0
- package/dist/test/prose-stream-router.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 +2196 -0
- package/dist/test/provider-waits.test.js.map +1 -0
- 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.d.ts +6 -0
- package/dist/test/record-journal.test.d.ts.map +1 -0
- package/dist/test/record-journal.test.js +269 -0
- package/dist/test/record-journal.test.js.map +1 -0
- package/dist/test/refusal-reaction-baseline.test.js +10 -3
- package/dist/test/refusal-reaction-baseline.test.js.map +1 -1
- package/dist/test/save-recent-image.test.js +240 -2
- package/dist/test/save-recent-image.test.js.map +1 -1
- package/dist/test/shutdown-errors.test.d.ts +2 -0
- package/dist/test/shutdown-errors.test.d.ts.map +1 -0
- package/dist/test/shutdown-errors.test.js +662 -0
- package/dist/test/shutdown-errors.test.js.map +1 -0
- package/dist/test/silent-heartbeat-rows.test.d.ts +2 -0
- package/dist/test/silent-heartbeat-rows.test.d.ts.map +1 -0
- package/dist/test/silent-heartbeat-rows.test.js +451 -0
- package/dist/test/silent-heartbeat-rows.test.js.map +1 -0
- package/dist/test/silent-heartbeat.test.js +49 -38
- package/dist/test/silent-heartbeat.test.js.map +1 -1
- package/dist/test/stop-with-work-in-flight.test.d.ts +23 -0
- package/dist/test/stop-with-work-in-flight.test.d.ts.map +1 -0
- package/dist/test/stop-with-work-in-flight.test.js +672 -0
- package/dist/test/stop-with-work-in-flight.test.js.map +1 -0
- 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.d.ts +8 -0
- package/dist/test/tool-batch-hook.test.d.ts.map +1 -0
- package/dist/test/tool-batch-hook.test.js +275 -0
- package/dist/test/tool-batch-hook.test.js.map +1 -0
- package/dist/test/tool-presentation.test.d.ts +2 -0
- package/dist/test/tool-presentation.test.d.ts.map +1 -0
- package/dist/test/tool-presentation.test.js +268 -0
- package/dist/test/tool-presentation.test.js.map +1 -0
- package/dist/test/tool-result-guard.test.js +2545 -19
- package/dist/test/tool-result-guard.test.js.map +1 -1
- package/dist/test/tool-result-history.test.js +2 -1
- package/dist/test/tool-result-history.test.js.map +1 -1
- package/dist/test/turn-trigger-provenance.test.js +35 -0
- package/dist/test/turn-trigger-provenance.test.js.map +1 -1
- package/dist/test/unconvertible-tool-result.test.d.ts +2 -0
- package/dist/test/unconvertible-tool-result.test.d.ts.map +1 -0
- package/dist/test/unconvertible-tool-result.test.js +358 -0
- package/dist/test/unconvertible-tool-result.test.js.map +1 -0
- package/dist/test/workspace-materialize-freshness.test.d.ts +16 -0
- package/dist/test/workspace-materialize-freshness.test.d.ts.map +1 -0
- package/dist/test/workspace-materialize-freshness.test.js +252 -0
- package/dist/test/workspace-materialize-freshness.test.js.map +1 -0
- package/dist/test/workspace-three-way.test.d.ts +12 -0
- package/dist/test/workspace-three-way.test.d.ts.map +1 -0
- package/dist/test/workspace-three-way.test.js +3194 -0
- package/dist/test/workspace-three-way.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/agent.ts +124 -45
- package/src/api/server.ts +43 -4
- package/src/code-execution/py-runner.ts +66 -9
- package/src/code-execution/runtime-py.ts +215 -38
- package/src/framework.ts +3191 -544
- package/src/gate/event-gate.ts +59 -7
- package/src/index.ts +18 -2
- package/src/mcpl/channel-registry.ts +24 -3
- package/src/mcpl/conversation-router.ts +34 -1
- package/src/mcpl/feature-set-manager.ts +36 -11
- package/src/mcpl/index.ts +4 -0
- package/src/mcpl/prose-stream-router.ts +79 -23
- package/src/mcpl/push-coalescer.ts +62 -13
- package/src/mcpl/push-handler.ts +41 -12
- package/src/mcpl/reference-fetcher.ts +18 -8
- package/src/mcpl/references.ts +57 -13
- package/src/mcpl/server-connection.ts +95 -13
- package/src/mcpl/server-registry.ts +24 -7
- package/src/mcpl/tool-lifecycle.ts +77 -2
- package/src/mcpl/tool-pattern-check.ts +106 -0
- package/src/mcpl/types.ts +15 -5
- package/src/mcpl/visible-content.ts +57 -0
- package/src/module-registry.ts +269 -25
- package/src/modules/workspace/branch-intent.ts +123 -0
- package/src/modules/workspace/disk-agreement.ts +325 -0
- package/src/modules/workspace/effects.ts +362 -0
- package/src/modules/workspace/index.ts +1098 -446
- package/src/modules/workspace/observe.ts +865 -0
- package/src/modules/workspace/reconcile.ts +1157 -0
- package/src/modules/workspace/sync.ts +6 -336
- package/src/modules/workspace/types.ts +75 -10
- package/src/operator-log.ts +30 -0
- package/src/provider-waits.ts +523 -0
- package/src/record-journal.ts +246 -0
- package/src/refusal-reactions.ts +14 -12
- package/src/shutdown.ts +49 -0
- package/src/silent-heartbeat.ts +141 -0
- package/src/tool-presentation.ts +188 -0
- package/src/tool-result-guard.ts +384 -34
- package/src/tool-result-history.ts +25 -1
- package/src/types/agent.ts +18 -2
- package/src/types/events.ts +16 -0
- package/src/types/framework.ts +12 -0
- package/src/types/module.ts +27 -4
- package/src/types/trace.ts +94 -3
package/src/types/module.ts
CHANGED
|
@@ -109,6 +109,21 @@ export interface Module {
|
|
|
109
109
|
*/
|
|
110
110
|
gatherContext?(agentName: string): Promise<ContextInjection[]>;
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Called once an agent's tool batch has completed — when the round's last
|
|
114
|
+
* pending result arrives, before it is provided to the agent and before
|
|
115
|
+
* anything that continues the turn (re-inference, stream resume). The
|
|
116
|
+
* framework awaits it, bounded at 30 s and fail-open, so a module can
|
|
117
|
+
* bring its state up to date with what the batch's tools did (the
|
|
118
|
+
* workspace's `watch: 'on-agent-action'` mounts scan disk here) before the
|
|
119
|
+
* agent's next inference. It's awaited in the framework's event loop, so
|
|
120
|
+
* a slow hook holds every agent's event processing, not only this one's.
|
|
121
|
+
* A hook still running from an earlier batch is skipped, not called again.
|
|
122
|
+
* Not called for script-inner tool calls, nor when the framework fills in
|
|
123
|
+
* error results for a batch whose stream ended before its tools answered.
|
|
124
|
+
*/
|
|
125
|
+
onToolBatchComplete?(agentName: string): Promise<void>;
|
|
126
|
+
|
|
112
127
|
/**
|
|
113
128
|
* Declare extra settings for the synthesized `agent_settings` tool.
|
|
114
129
|
* Modules owning hot-tunable runtime state (e.g. a host settings module
|
|
@@ -202,14 +217,19 @@ export interface ModuleContext {
|
|
|
202
217
|
getLogLength(name: string): number;
|
|
203
218
|
|
|
204
219
|
/**
|
|
205
|
-
* Process queue for pushing events from external listeners.
|
|
220
|
+
* Process queue for pushing events from external listeners. Once stop()
|
|
221
|
+
* has begun, a push is dropped with a log line naming this module, as
|
|
222
|
+
* pushEvent()'s is.
|
|
206
223
|
* @deprecated Use pushEvent() instead — it also emits process:received traces.
|
|
207
224
|
*/
|
|
208
225
|
readonly queue: ProcessQueue;
|
|
209
226
|
|
|
210
227
|
/**
|
|
211
228
|
* Push a process event to the queue and emit a process:received trace.
|
|
212
|
-
* Preferred over direct queue.push() for proper observability.
|
|
229
|
+
* Preferred over direct queue.push() for proper observability. Once stop()
|
|
230
|
+
* has begun, nothing will process the event: it's dropped with a log line
|
|
231
|
+
* naming this module, untraced, rather than thrown into the listener or
|
|
232
|
+
* stop() that pushed it.
|
|
213
233
|
*/
|
|
214
234
|
pushEvent(event: ProcessEvent): void;
|
|
215
235
|
|
|
@@ -355,14 +375,17 @@ export interface ProcessState {
|
|
|
355
375
|
getActiveTools(): ToolDefinition[];
|
|
356
376
|
|
|
357
377
|
/**
|
|
358
|
-
* Queue for emitting follow-up events.
|
|
378
|
+
* Queue for emitting follow-up events. Once stop() has begun, a push is
|
|
379
|
+
* dropped with a log line naming the module, as pushEvent()'s is.
|
|
359
380
|
* @deprecated Use pushEvent() instead — it also emits process:received traces.
|
|
360
381
|
*/
|
|
361
382
|
readonly queue: ProcessQueue;
|
|
362
383
|
|
|
363
384
|
/**
|
|
364
385
|
* Push a process event to the queue and emit a process:received trace.
|
|
365
|
-
* Preferred over direct queue.push() for proper observability.
|
|
386
|
+
* Preferred over direct queue.push() for proper observability. Once stop()
|
|
387
|
+
* has begun, the event is dropped with a log line naming the module,
|
|
388
|
+
* untraced.
|
|
366
389
|
*/
|
|
367
390
|
pushEvent(event: ProcessEvent): void;
|
|
368
391
|
}
|
package/src/types/trace.ts
CHANGED
|
@@ -66,20 +66,29 @@ export type TraceEvent =
|
|
|
66
66
|
| (TraceEventBase & {
|
|
67
67
|
type: 'inference:failed';
|
|
68
68
|
agentName: string;
|
|
69
|
+
/** The failure's message, bounded as every trace event's `error` is (2,000 characters). */
|
|
69
70
|
error: string;
|
|
71
|
+
/** Bounded like `error`. */
|
|
70
72
|
stack?: string;
|
|
71
73
|
})
|
|
72
74
|
| (TraceEventBase & {
|
|
73
75
|
type: 'inference:exhausted';
|
|
74
76
|
agentName: string;
|
|
77
|
+
/** The failure's message, bounded as every trace event's `error` is (2,000 characters). */
|
|
75
78
|
error: string;
|
|
76
79
|
/** Whether membrane classified the failure as retryable (observability). */
|
|
77
80
|
retryable?: boolean;
|
|
78
81
|
/**
|
|
79
|
-
* The membrane error type (e.g. 'invalid_request', 'auth', 'context_length')
|
|
80
|
-
* The poison-history breaker fires only on
|
|
82
|
+
* The membrane error type (e.g. 'invalid_request', 'auth', 'context_length'),
|
|
83
|
+
* at most 128 characters. The poison-history breaker fires only on
|
|
84
|
+
* 'invalid_request' at HTTP 400, 413 or 422 or with no status, and on
|
|
85
|
+
* 'context_length' at 413 (shedMayHelp).
|
|
81
86
|
*/
|
|
82
87
|
errorType?: string;
|
|
88
|
+
/** The provider's HTTP status, when the failure carried one. */
|
|
89
|
+
httpStatus?: number;
|
|
90
|
+
/** The provider's own error code, when it sent one (at most 128 characters). */
|
|
91
|
+
providerErrorCode?: string;
|
|
83
92
|
})
|
|
84
93
|
|
|
85
94
|
// Streaming inference lifecycle
|
|
@@ -171,6 +180,16 @@ export type TraceEvent =
|
|
|
171
180
|
agentStatus: string;
|
|
172
181
|
result: unknown;
|
|
173
182
|
})
|
|
183
|
+
| (TraceEventBase & {
|
|
184
|
+
/**
|
|
185
|
+
* A module's onToolBatchComplete threw or outlasted its bound; the
|
|
186
|
+
* round went on without it.
|
|
187
|
+
*/
|
|
188
|
+
type: 'module:batch_hook_failed';
|
|
189
|
+
agentName: string;
|
|
190
|
+
module: string;
|
|
191
|
+
error: string;
|
|
192
|
+
})
|
|
174
193
|
| (TraceEventBase & {
|
|
175
194
|
/**
|
|
176
195
|
* A writable workspace existed but the oversized-result spill write
|
|
@@ -217,6 +236,33 @@ export type TraceEvent =
|
|
|
217
236
|
messageId: string;
|
|
218
237
|
source: string;
|
|
219
238
|
})
|
|
239
|
+
/** A push/event refused at the MCPL boundary (today: visibly-empty content). */
|
|
240
|
+
| (TraceEventBase & {
|
|
241
|
+
type: 'mcpl:push-event-rejected';
|
|
242
|
+
serverId: string;
|
|
243
|
+
eventId: string;
|
|
244
|
+
featureSet: string;
|
|
245
|
+
reason: string;
|
|
246
|
+
})
|
|
247
|
+
/** A channels/incoming message refused at the MCPL boundary: unregistered
|
|
248
|
+
* channel (§14.5), or visibly-empty content (then `messageId` is set). */
|
|
249
|
+
| (TraceEventBase & {
|
|
250
|
+
type: 'mcpl:channel-incoming-rejected';
|
|
251
|
+
serverId: string;
|
|
252
|
+
channelId: string;
|
|
253
|
+
messageId?: string;
|
|
254
|
+
reason: string;
|
|
255
|
+
})
|
|
256
|
+
/** MCPL content with nothing model-visible reached the store/wake site
|
|
257
|
+
* (module-emitted or coalescer-delivered) and was dropped: no row, no wake. */
|
|
258
|
+
| (TraceEventBase & {
|
|
259
|
+
type: 'mcpl:empty-content-dropped';
|
|
260
|
+
lane: 'push' | 'channel';
|
|
261
|
+
serverId: string;
|
|
262
|
+
eventId?: string;
|
|
263
|
+
channelId?: string;
|
|
264
|
+
messageId?: string;
|
|
265
|
+
})
|
|
220
266
|
/** RFC-006 coalescing decision record (received / displaced / removed /
|
|
221
267
|
* rendered / revoked / render-cancelled / late-render / render-failed). */
|
|
222
268
|
| (TraceEventBase & {
|
|
@@ -430,6 +476,49 @@ export type TraceEvent =
|
|
|
430
476
|
serverId: string;
|
|
431
477
|
error: string;
|
|
432
478
|
})
|
|
479
|
+
// Configuration that is accepted but silently does nothing. Each mirrors
|
|
480
|
+
// a console line, so hosts that keep per-server logs from the trace bus
|
|
481
|
+
// see it too.
|
|
482
|
+
| (TraceEventBase & {
|
|
483
|
+
/** §5.3/§6.7: the server refused the host's policy Request. */
|
|
484
|
+
type: 'mcpl:policy-refused';
|
|
485
|
+
serverId: string;
|
|
486
|
+
/** The initial policy at connect, or the re-negotiation after a manifest change. */
|
|
487
|
+
phase: 'initial' | 'manifest-change';
|
|
488
|
+
reason: string | null;
|
|
489
|
+
/** `close`: the host closed the connection. `mcp-only`: the grant
|
|
490
|
+
* stays empty and only plain MCP tools work. */
|
|
491
|
+
fallback: 'close' | 'mcp-only';
|
|
492
|
+
})
|
|
493
|
+
| (TraceEventBase & {
|
|
494
|
+
/** §6.4 derivation disabled a declared feature set. */
|
|
495
|
+
type: 'mcpl:feature-set-disabled';
|
|
496
|
+
serverId: string;
|
|
497
|
+
featureSet: string;
|
|
498
|
+
/** `invalid_uses`: `uses` absent, empty or unrecognized.
|
|
499
|
+
* `missing_capabilities`: `uses` names capabilities the grant lacks. */
|
|
500
|
+
reason: 'invalid_uses' | 'missing_capabilities';
|
|
501
|
+
/** True when config selected the set (enabledFeatureSets omitted or
|
|
502
|
+
* matching it, and not disabledFeatureSets): derivation overrode it. */
|
|
503
|
+
selectedByConfig: boolean;
|
|
504
|
+
/** invalid_uses: the unrecognized entries (empty when `uses` was absent or empty). */
|
|
505
|
+
unrecognized?: string[];
|
|
506
|
+
/** missing_capabilities: the capability paths the grant lacks. */
|
|
507
|
+
missing?: string[];
|
|
508
|
+
})
|
|
509
|
+
| (TraceEventBase & {
|
|
510
|
+
/** An operator tool-name pattern matches no model-facing tool. Emitted
|
|
511
|
+
* once per pattern, after the servers it could name have listed. */
|
|
512
|
+
type: 'mcpl:tool-pattern-unmatched';
|
|
513
|
+
/** `toolClassOverrides`, `toolLifecycle.observe.tools` or `toolLifecycle.inputs.tools`. */
|
|
514
|
+
setting: string;
|
|
515
|
+
/** The server whose toolLifecycle config holds the pattern. */
|
|
516
|
+
serverId?: string;
|
|
517
|
+
pattern: string;
|
|
518
|
+
/** The pattern rewritten under the server's actual tool prefix. */
|
|
519
|
+
suggestion?: string;
|
|
520
|
+
hint: string;
|
|
521
|
+
})
|
|
433
522
|
| (TraceEventBase & {
|
|
434
523
|
type: 'mcpl:orphaned-response';
|
|
435
524
|
serverId: string;
|
|
@@ -454,8 +543,10 @@ export type TraceEvent =
|
|
|
454
543
|
kind: string;
|
|
455
544
|
/** Agent name, or a server/component id for non-agent alerts (e.g. mcpl-down). */
|
|
456
545
|
agentName: string;
|
|
546
|
+
/** At most 2,000 characters. */
|
|
457
547
|
message: string;
|
|
458
|
-
/** Kind-specific structured payload (mirrors the failures.log record)
|
|
548
|
+
/** Kind-specific structured payload (mirrors the failures.log record),
|
|
549
|
+
* bounded field by field as that record is. */
|
|
459
550
|
data?: Record<string, unknown>;
|
|
460
551
|
})
|
|
461
552
|
|