@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
|
@@ -1,8 +1,68 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { isDeepStrictEqual } from 'node:util';
|
|
3
3
|
import { isStateExistsError } from './module-registry.js';
|
|
4
|
+
import { toolResultDataToHistoryString } from './tool-result-history.js';
|
|
5
|
+
import { safeSlice } from './safe-slice.js';
|
|
4
6
|
export const TOOL_RESULT_GUARD_NOTICE = 'Tool result withheld by the guard. The tool has already executed.';
|
|
5
7
|
export const TOOL_RESULT_GUARD_AUDIT_STATE = 'framework/tool-result-guard';
|
|
8
|
+
/**
|
|
9
|
+
* The stub a withheld result settles to: #159's neutral notice, then where
|
|
10
|
+
* the original is, then, when its tool marked any, the fields kept from its
|
|
11
|
+
* result (`kept`, from keptWhenWithheld). It names no refusal and no
|
|
12
|
+
* category (#159 keeps those in operational logs), so reading the rest back
|
|
13
|
+
* is the agent's deliberate choice (agent-framework #277). The place holds
|
|
14
|
+
* the result as stored, which for one over the inline cap is its capped
|
|
15
|
+
* text, whose own note names the file with the whole output; so the stub
|
|
16
|
+
* says "its result", not its full result. A failed write's own error text
|
|
17
|
+
* stays in the audit record and the logs, not here. The audit record is
|
|
18
|
+
* said to keep the original only when it was saved: a staged record whose
|
|
19
|
+
* save failed is still queued in memory, and a restart before its retry
|
|
20
|
+
* loses it.
|
|
21
|
+
*/
|
|
22
|
+
export function withheldResultNotice(spill, auditDurable, kept) {
|
|
23
|
+
const audit = `the guard's audit record (${TOOL_RESULT_GUARD_AUDIT_STATE}), for an operator`;
|
|
24
|
+
const keptIn = (only) => auditDurable
|
|
25
|
+
? `is kept ${only}in ${audit}`
|
|
26
|
+
: `went ${only}to ${audit}, though saving that record had failed when the result arrived`;
|
|
27
|
+
const place = !spill || 'skipped' in spill
|
|
28
|
+
? `Its result ${keptIn('')}.`
|
|
29
|
+
: spill.unfinished
|
|
30
|
+
? `Its result was still being written to workspace file ${spill.path} when this note was made; ` +
|
|
31
|
+
`if that file is missing, it ${keptIn('')}.`
|
|
32
|
+
: spill.error === undefined
|
|
33
|
+
? `Its result is in workspace file ${spill.path}.`
|
|
34
|
+
: `Writing its result to workspace file ${spill.path} failed, so it ${keptIn('only ')}.`;
|
|
35
|
+
const fields = kept === undefined ? '' : ` Kept from its result: ${kept}`;
|
|
36
|
+
return `${TOOL_RESULT_GUARD_NOTICE} ${place}${fields}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* What a withheld result's stub keeps of it: the fields of its data that its
|
|
40
|
+
* tool marked as saying what it acted on (ToolResult.keepWhenWithheld), in
|
|
41
|
+
* the order marked, serialized as a stored result is. Past the inline cap
|
|
42
|
+
* they're cut, with a note that says so and where the whole result is, since
|
|
43
|
+
* a later field can then be cut away entirely. Undefined when it keeps
|
|
44
|
+
* nothing, as for a failed result (agent-framework #277). A write's file
|
|
45
|
+
* list is evidence of what it did, rarely what drew a refusal, and keeping it
|
|
46
|
+
* is what shows a clobbered file when the receipt is withheld.
|
|
47
|
+
*/
|
|
48
|
+
export function keptWhenWithheld(result, maxChars) {
|
|
49
|
+
const { data, keepWhenWithheld: keys } = result;
|
|
50
|
+
if (!result.success || result.isError || !keys?.length || !data || typeof data !== 'object' || Array.isArray(data)) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const fields = data;
|
|
54
|
+
const kept = Object.fromEntries(keys.filter((key) => Object.hasOwn(fields, key)).map((key) => [key, fields[key]]));
|
|
55
|
+
if (Object.keys(kept).length === 0)
|
|
56
|
+
return undefined;
|
|
57
|
+
const whole = toolResultDataToHistoryString(kept);
|
|
58
|
+
if (!maxChars || whole.length <= maxChars)
|
|
59
|
+
return whole;
|
|
60
|
+
// Never half a surrogate pair: the stub goes to the provider as text, so
|
|
61
|
+
// the cut can be one character short of the cap.
|
|
62
|
+
const head = safeSlice(whole, 0, maxChars);
|
|
63
|
+
return `${head} [cut at the inline cap: ${head.length} of these fields' ${whole.length} ` +
|
|
64
|
+
'characters; the whole result is where this note says]';
|
|
65
|
+
}
|
|
6
66
|
/**
|
|
7
67
|
* Admission of newly returned tool output to durable model-facing memory.
|
|
8
68
|
*
|
|
@@ -21,12 +81,65 @@ export class ToolResultGuard {
|
|
|
21
81
|
override;
|
|
22
82
|
/** True until a recovery produces a clean response/new tool round. */
|
|
23
83
|
recovering = false;
|
|
84
|
+
/** Writes withheld originals where the agent can read them; without it,
|
|
85
|
+
* a stub names only the audit record. */
|
|
86
|
+
host;
|
|
87
|
+
/** Annotations of withheld stubs, chained in settlement order. */
|
|
88
|
+
annotating;
|
|
89
|
+
/** Annotations started so far, so a read can tell one began during it. */
|
|
90
|
+
annotationsStarted = 0;
|
|
24
91
|
constructor(agentName, cm, configured = false) {
|
|
25
92
|
this.agentName = agentName;
|
|
26
93
|
this.cm = cm;
|
|
27
94
|
this.configured = configured;
|
|
28
95
|
}
|
|
29
96
|
get enabled() { return this.override ?? this.configured; }
|
|
97
|
+
setHost(host) { this.host = host; }
|
|
98
|
+
/** Settles once every annotation started so far has finished: each of
|
|
99
|
+
* those stubs has been edited to say where its original is, or its edit
|
|
100
|
+
* failed and waits in the storage queue, retried in order until it lands
|
|
101
|
+
* or an operator's change supersedes it (until then the stub is the bare
|
|
102
|
+
* notice, kept out of summaries by its compression hold, and the audit
|
|
103
|
+
* record names the place). It never rejects. Each batch has one deadline
|
|
104
|
+
* for all its workspace writes; queued batches are annotated in order.
|
|
105
|
+
* A request may carry an unfinished-write notice once that deadline passes. */
|
|
106
|
+
whenAnnotated() { return this.annotating ?? Promise.resolve(); }
|
|
107
|
+
/**
|
|
108
|
+
* Runs `read` (a compile of the context) once no withheld stub is still
|
|
109
|
+
* being annotated, and again if an annotation began while it ran, since a
|
|
110
|
+
* settlement can land during the compile's own awaits, such as a previous
|
|
111
|
+
* frame's teardown abandoning its batch. The framework's sent-request
|
|
112
|
+
* compiles go through it: the agent's activations, its direct
|
|
113
|
+
* API calls and their refusal retry, and a conversation fork's seed from its
|
|
114
|
+
* template. A request preview doesn't, so it never waits on a
|
|
115
|
+
* workspace write.
|
|
116
|
+
*
|
|
117
|
+
* Before `read`, a stub edit that failed gets another try with the rest of
|
|
118
|
+
* the storage queue; a store that is still failing then compiles the bare
|
|
119
|
+
* notice, which its hold keeps out of summaries.
|
|
120
|
+
*/
|
|
121
|
+
async afterAnnotations(read) {
|
|
122
|
+
for (;;) {
|
|
123
|
+
// Counted before the wait, so an annotation that starts while this one
|
|
124
|
+
// is awaited is waited for too.
|
|
125
|
+
const started = this.annotationsStarted;
|
|
126
|
+
await this.whenAnnotated();
|
|
127
|
+
if (this.annotationsStarted !== started)
|
|
128
|
+
continue;
|
|
129
|
+
try {
|
|
130
|
+
this.flushUnrecorded();
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error(`[tool-result-guard] agent=${this.agentName} storage retry before a compile failed:`, error);
|
|
134
|
+
}
|
|
135
|
+
const result = await read();
|
|
136
|
+
if (this.annotationsStarted === started)
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** No annotation is running and no storage work is queued: nothing of this
|
|
141
|
+
* guard is left for a host to wait on or retry. */
|
|
142
|
+
get idle() { return this.annotating === undefined && this.unrecorded.length === 0; }
|
|
30
143
|
setOverride(value) { this.override = value; }
|
|
31
144
|
get settingOverride() { return this.override; }
|
|
32
145
|
get hasPending() { return this.pending !== undefined; }
|
|
@@ -60,41 +173,55 @@ export class ToolResultGuard {
|
|
|
60
173
|
}
|
|
61
174
|
/** Ordered storage work, separate from batches awaiting a provider verdict.
|
|
62
175
|
* A failed acceptance edit retains both the payload and its compression
|
|
63
|
-
* hold here; it can never re-arm refusal handling or tool submission.
|
|
176
|
+
* hold here; it can never re-arm refusal handling or tool submission.
|
|
177
|
+
* Any failed head, including an audit-only record, blocks later queued
|
|
178
|
+
* edits and their holds until that operation succeeds. */
|
|
64
179
|
unrecorded = [];
|
|
65
|
-
/** Retry edits and audit writes before a new activation,
|
|
66
|
-
*
|
|
180
|
+
/** Retry edits and audit writes before a new activation, a compile of a
|
|
181
|
+
* request that is sent (afterAnnotations), an audit write, a maintenance
|
|
182
|
+
* pass, or shutdown. A failed operation stays at the head. */
|
|
67
183
|
flushUnrecorded() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (!sameBranch || !current ||
|
|
80
|
-
(!isDeepStrictEqual(current.content, JSON.parse(JSON.stringify(expected)))
|
|
81
|
-
&& !isDeepStrictEqual(current.content, JSON.parse(JSON.stringify(content))))) {
|
|
82
|
-
operation.record.historyUpdate = 'superseded';
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
this.cm.editMessage(messageId, content);
|
|
86
|
-
}
|
|
87
|
-
// An audit-only retry must not repeat an edit that already succeeded.
|
|
88
|
-
operation.admission = undefined;
|
|
184
|
+
try {
|
|
185
|
+
while (this.unrecorded.length > 0) {
|
|
186
|
+
const operation = this.unrecorded[0];
|
|
187
|
+
try {
|
|
188
|
+
this.applyEdit(operation);
|
|
189
|
+
this.write(operation.record);
|
|
190
|
+
this.unrecorded.shift();
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
if (!operation.admission)
|
|
194
|
+
this.releaseOperationHold(operation);
|
|
89
195
|
}
|
|
90
|
-
this.write(operation.record);
|
|
91
|
-
this.unrecorded.shift();
|
|
92
|
-
}
|
|
93
|
-
finally {
|
|
94
|
-
if (!operation.admission)
|
|
95
|
-
this.releaseOperationHold(operation);
|
|
96
196
|
}
|
|
97
197
|
}
|
|
198
|
+
finally {
|
|
199
|
+
this.host?.idle(this.idle);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** Make an operation's history edit, if it still has one: once it is made,
|
|
203
|
+
* or superseded by an operator's change, only its record is left to
|
|
204
|
+
* write, and its hold can go. */
|
|
205
|
+
applyEdit(operation) {
|
|
206
|
+
if (!operation.admission)
|
|
207
|
+
return;
|
|
208
|
+
const { messageId, content, expected, branch } = operation.admission;
|
|
209
|
+
const sameBranch = this.cm.currentBranch().name === branch;
|
|
210
|
+
const current = sameBranch ? this.cm.getMessage(messageId) : null;
|
|
211
|
+
// A retry must not undo an operator's later edit/removal/rollback.
|
|
212
|
+
// Reapplying our own payload is safe if an earlier edit wrote the
|
|
213
|
+
// message and then failed while propagating to context entries.
|
|
214
|
+
// Chronicle normalizes object-key order and drops undefined fields.
|
|
215
|
+
if (!sameBranch || !current ||
|
|
216
|
+
(!isDeepStrictEqual(current.content, JSON.parse(JSON.stringify(expected)))
|
|
217
|
+
&& !isDeepStrictEqual(current.content, JSON.parse(JSON.stringify(content))))) {
|
|
218
|
+
operation.record.historyUpdate = 'superseded';
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
this.cm.editMessage(messageId, content);
|
|
222
|
+
}
|
|
223
|
+
// An audit-only retry must not repeat an edit that already succeeded.
|
|
224
|
+
operation.admission = undefined;
|
|
98
225
|
}
|
|
99
226
|
append(record) {
|
|
100
227
|
const stamped = { agentName: this.agentName, timestamp: Date.now(), ...record };
|
|
@@ -123,9 +250,13 @@ export class ToolResultGuard {
|
|
|
123
250
|
? { blobId: this.cm.getStore().storeBlob(Buffer.from(json), 'application/json') }
|
|
124
251
|
: JSON.parse(json);
|
|
125
252
|
}
|
|
126
|
-
|
|
253
|
+
/** `inlineCap` is the cap the caller stored `content` under; what a stub
|
|
254
|
+
* keeps of a withheld result is cut at it too. */
|
|
255
|
+
storeResults(content, wireResults, originals, metadata,
|
|
256
|
+
/** The cap the results were stored under: what a stub keeps is cut there too. */
|
|
257
|
+
inlineCap) {
|
|
127
258
|
if (!this.enabled)
|
|
128
|
-
return this.cm.addMessage('user', content);
|
|
259
|
+
return this.cm.addMessage('user', content, metadata);
|
|
129
260
|
if (this.pending) {
|
|
130
261
|
// Idempotent for the same not-yet-submitted batch: a caller that
|
|
131
262
|
// retries after a failure between staging and submission (e.g. a
|
|
@@ -153,13 +284,23 @@ export class ToolResultGuard {
|
|
|
153
284
|
const withheld = content.map((block) => block.type === 'tool_result'
|
|
154
285
|
? { type: 'tool_result', toolUseId: block.toolUseId, content: TOOL_RESULT_GUARD_NOTICE, isError: block.isError }
|
|
155
286
|
: block);
|
|
287
|
+
// What each stub keeps if the batch is withheld, matched to its tool's
|
|
288
|
+
// result by tool use id, keyed by index as the stubs and files are.
|
|
289
|
+
const results = new Map(originals.map((call) => [call.id, call.result]));
|
|
290
|
+
const kept = new Map();
|
|
291
|
+
for (const [index, block] of content.entries()) {
|
|
292
|
+
const result = block.type === 'tool_result' ? results.get(block.toolUseId) : undefined;
|
|
293
|
+
const text = result ? keptWhenWithheld(result, inlineCap) : undefined;
|
|
294
|
+
if (text !== undefined)
|
|
295
|
+
kept.set(index, text);
|
|
296
|
+
}
|
|
156
297
|
// Compression hold (CM >= 0.12): placed BEFORE onNewMessage fires, so no
|
|
157
298
|
// chunk is ever summarized from the placeholder; released after the
|
|
158
299
|
// settlement edit. Holds are in-memory only — a reopened manager has none,
|
|
159
300
|
// which is correct since a reopened guard has no pending batch.
|
|
160
|
-
const messageId = this.cm.addMessage('user', withheld,
|
|
301
|
+
const messageId = this.cm.addMessage('user', withheld, metadata, undefined, { holdCompression: true });
|
|
161
302
|
this.pending = { id, messageId, content, withheld, wireResults,
|
|
162
|
-
branch: this.cm.currentBranch().name, submitted: false, durable: false };
|
|
303
|
+
branch: this.cm.currentBranch().name, submitted: false, durable: false, kept };
|
|
163
304
|
// Durability barrier: the audit must reach Chronicle's chain heads before
|
|
164
305
|
// the originals can go to a provider. On a failed sync the batch fails
|
|
165
306
|
// CLOSED: the placeholders go on the wire instead (the turn continues,
|
|
@@ -271,7 +412,9 @@ export class ToolResultGuard {
|
|
|
271
412
|
}
|
|
272
413
|
/** Transfer ownership from provider admission to an ordered storage job.
|
|
273
414
|
* Failure retains the accepted payload and its hold until the edit succeeds.
|
|
274
|
-
*
|
|
415
|
+
* A withheld batch's hold passes to its annotation instead, and from there
|
|
416
|
+
* to its stub's edit, so no summary is made of a stub that doesn't yet say
|
|
417
|
+
* where its original went. */
|
|
275
418
|
settle(pending, record, admit) {
|
|
276
419
|
this.pending = undefined;
|
|
277
420
|
const operation = {
|
|
@@ -279,8 +422,10 @@ export class ToolResultGuard {
|
|
|
279
422
|
batchId: pending.id, messageId: pending.messageId, sourceBranch: pending.branch },
|
|
280
423
|
...(admit ? { admission: { messageId: pending.messageId, content: pending.content,
|
|
281
424
|
expected: pending.withheld, branch: pending.branch } } : {}),
|
|
282
|
-
heldMessageId: pending.messageId,
|
|
425
|
+
heldMessageId: admit ? pending.messageId : undefined,
|
|
283
426
|
};
|
|
427
|
+
if (!admit)
|
|
428
|
+
this.annotate(pending);
|
|
284
429
|
this.unrecorded.push(operation);
|
|
285
430
|
try {
|
|
286
431
|
this.flushUnrecorded();
|
|
@@ -293,6 +438,182 @@ export class ToolResultGuard {
|
|
|
293
438
|
this.releaseOperationHold(operation);
|
|
294
439
|
}
|
|
295
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Turn a withheld batch's notices into stubs that say where each original
|
|
443
|
+
* is (agent-framework #277): written to the workspace when a writable mount
|
|
444
|
+
* takes it, else kept in the audit record. A stub also keeps the file
|
|
445
|
+
* lists its tool marked. Its own unedited placeholder is
|
|
446
|
+
* the only thing it edits: an operator's later edit, removal or rollback
|
|
447
|
+
* stands.
|
|
448
|
+
*
|
|
449
|
+
* Where each original went is queued first, on its own ('annotated'), so
|
|
450
|
+
* a stub edit that fails can't take the record of a written file with it.
|
|
451
|
+
* The edit is then made at once, so no storage work queued ahead of it
|
|
452
|
+
* holds it, not even that record if its write is failing, and its record
|
|
453
|
+
* ('stub_updated') is written in order after the others. An
|
|
454
|
+
* edit that fails joins the ordered storage queue like an admission's, with
|
|
455
|
+
* the batch's compression hold: retried before the next activation, compile,
|
|
456
|
+
* maintenance pass or stop until it lands or an operator's change supersedes
|
|
457
|
+
* it. Until then the stub is the bare notice, which the hold keeps out of
|
|
458
|
+
* summaries, and the audit record names the file.
|
|
459
|
+
*/
|
|
460
|
+
annotate(pending) {
|
|
461
|
+
const previous = this.annotating ?? Promise.resolve();
|
|
462
|
+
this.annotationsStarted += 1;
|
|
463
|
+
// The batch's deadline runs from when it's queued, not from when the
|
|
464
|
+
// batches ahead of it finish, so a request waiting on a chain of batches
|
|
465
|
+
// waits at most one deadline past the latest one's arrival.
|
|
466
|
+
let deadline = Infinity;
|
|
467
|
+
try {
|
|
468
|
+
deadline = this.host?.deadline() ?? Infinity;
|
|
469
|
+
}
|
|
470
|
+
catch { /* the spill then takes its own deadline, rather than losing the record */ }
|
|
471
|
+
const run = previous.then(async () => {
|
|
472
|
+
// Set once the stub's edit is queued with the hold: the queue releases
|
|
473
|
+
// it when the edit lands or is superseded.
|
|
474
|
+
let holdQueued = false;
|
|
475
|
+
try {
|
|
476
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
477
|
+
// A file is named by its batch and its place in the batch, ahead of
|
|
478
|
+
// anything the writer may cut or substitute: results of one batch
|
|
479
|
+
// never share a file, and results of two batches share one only if 48
|
|
480
|
+
// random bits of their batch ids agree. The tool use id after them is
|
|
481
|
+
// for whoever lists the directory.
|
|
482
|
+
const batch = pending.id.replace(/-/g, '').slice(0, 12);
|
|
483
|
+
// Keyed by the result's index in the batch, which the stub and the
|
|
484
|
+
// original share.
|
|
485
|
+
const spills = new Map();
|
|
486
|
+
// A spill that threw, by index: its error, for the record.
|
|
487
|
+
const thrown = new Map();
|
|
488
|
+
// Set once the branch has changed: no more is written.
|
|
489
|
+
let branchLeft = false;
|
|
490
|
+
let deadlineSpent = false;
|
|
491
|
+
for (const [index, block] of pending.content.entries()) {
|
|
492
|
+
if (block.type !== 'tool_result')
|
|
493
|
+
continue;
|
|
494
|
+
// Once the store has left the batch's branch (a rollback, an undo, a
|
|
495
|
+
// host's switch), write no more. This result and every later one is
|
|
496
|
+
// skipped, and its original stays in the audit record. Nothing
|
|
497
|
+
// yields from here to the edit's own branch check, so while the
|
|
498
|
+
// store is away the stub stays as it is. A write already under way
|
|
499
|
+
// when the branch changes is refused before its tree entry is set,
|
|
500
|
+
// since it names the batch's branch. Once set, that entry stays on
|
|
501
|
+
// its branch; its disk copy uses the mount's shared directory.
|
|
502
|
+
if (branchLeft || this.cm.currentBranch().name !== pending.branch) {
|
|
503
|
+
branchLeft = true;
|
|
504
|
+
spills.set(index, { skipped: 'branch_changed' });
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
// The result as stored. Both paths that store a tool result store
|
|
508
|
+
// its text; content stored as blocks would be written as their JSON.
|
|
509
|
+
const original = typeof block.content === 'string' ? block.content : JSON.stringify(block.content);
|
|
510
|
+
let spill = null;
|
|
511
|
+
if (this.host) {
|
|
512
|
+
try {
|
|
513
|
+
spill = await this.host.spill(`${date}-withheld-${batch}-${index}-${block.toolUseId}`, original, pending.branch, deadline);
|
|
514
|
+
}
|
|
515
|
+
catch (error) {
|
|
516
|
+
// The host reports a failed write rather than throwing; a throw
|
|
517
|
+
// is recorded all the same, without a path.
|
|
518
|
+
thrown.set(index, (error instanceof Error ? error.message : String(error)).slice(0, 200));
|
|
519
|
+
console.error(`[tool-result-guard] agent=${this.agentName} could not spill withheld result ` +
|
|
520
|
+
`${block.toolUseId}:`, error);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
// Declined where it would have committed, since the workspace had
|
|
524
|
+
// left the batch's branch. Nothing was written, and no more are, as
|
|
525
|
+
// for the results the branch check above stops. If the branch is
|
|
526
|
+
// back by the edit, as after an undo and a redo, the stubs of this
|
|
527
|
+
// result and the later ones name the audit record.
|
|
528
|
+
if (spill && 'skipped' in spill && spill.skipped === 'branch_changed')
|
|
529
|
+
branchLeft = true;
|
|
530
|
+
// A batch that used its deadline is said once, here, where the
|
|
531
|
+
// batch is known; the host returns the skip without a line.
|
|
532
|
+
if (spill && 'skipped' in spill && spill.skipped === 'batch_deadline' && !deadlineSpent) {
|
|
533
|
+
deadlineSpent = true;
|
|
534
|
+
console.error(`[tool-result-guard] agent=${this.agentName} batch=${pending.id} used its deadline before all its originals were written; the rest name the audit record (batch_deadline)`);
|
|
535
|
+
}
|
|
536
|
+
spills.set(index, spill);
|
|
537
|
+
}
|
|
538
|
+
const annotated = pending.withheld.map((block, index) => block.type === 'tool_result'
|
|
539
|
+
? { ...block, content: withheldResultNotice(spills.get(index) ?? null, pending.durable, pending.kept.get(index)) }
|
|
540
|
+
: block);
|
|
541
|
+
try {
|
|
542
|
+
this.append({
|
|
543
|
+
type: 'annotated', batchId: pending.id, messageId: pending.messageId, sourceBranch: pending.branch,
|
|
544
|
+
results: pending.content.flatMap((block, index) => {
|
|
545
|
+
if (block.type !== 'tool_result')
|
|
546
|
+
return [];
|
|
547
|
+
if (thrown.has(index))
|
|
548
|
+
return [{ toolUseId: block.toolUseId, error: thrown.get(index) }];
|
|
549
|
+
const spill = spills.get(index) ?? null;
|
|
550
|
+
// No file was written: no writable workspace, or the framework
|
|
551
|
+
// was stopping.
|
|
552
|
+
if (spill === null)
|
|
553
|
+
return [{ toolUseId: block.toolUseId, skipped: 'no_workspace_file' }];
|
|
554
|
+
if ('skipped' in spill)
|
|
555
|
+
return [{ toolUseId: block.toolUseId, skipped: spill.skipped }];
|
|
556
|
+
return [{ toolUseId: block.toolUseId, path: spill.path,
|
|
557
|
+
...(spill.error !== undefined ? { error: spill.error } : {}),
|
|
558
|
+
...(spill.unfinished ? { unfinished: true } : {}) }];
|
|
559
|
+
}),
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
catch (error) {
|
|
563
|
+
// It stays queued and is retried in order with the storage work
|
|
564
|
+
// ahead of it; the stub's record is written after it.
|
|
565
|
+
console.error(`[tool-result-guard] agent=${this.agentName} batch=${pending.id} annotation record queued for retry:`, error);
|
|
566
|
+
}
|
|
567
|
+
const stub = {
|
|
568
|
+
record: { agentName: this.agentName, timestamp: Date.now(), type: 'stub_updated',
|
|
569
|
+
batchId: pending.id, messageId: pending.messageId, sourceBranch: pending.branch },
|
|
570
|
+
admission: { messageId: pending.messageId, content: annotated, expected: pending.withheld, branch: pending.branch },
|
|
571
|
+
heldMessageId: pending.messageId,
|
|
572
|
+
};
|
|
573
|
+
try {
|
|
574
|
+
this.applyEdit(stub);
|
|
575
|
+
}
|
|
576
|
+
catch (error) {
|
|
577
|
+
console.error(`[tool-result-guard] agent=${this.agentName} batch=${pending.id} stub edit queued for retry:`, error);
|
|
578
|
+
}
|
|
579
|
+
this.unrecorded.push(stub);
|
|
580
|
+
holdQueued = true;
|
|
581
|
+
try {
|
|
582
|
+
// A made edit's hold goes now, whatever storage work is still
|
|
583
|
+
// queued ahead of its record.
|
|
584
|
+
if (!stub.admission)
|
|
585
|
+
this.releaseOperationHold(stub);
|
|
586
|
+
this.flushUnrecorded();
|
|
587
|
+
}
|
|
588
|
+
catch (error) {
|
|
589
|
+
console.error(`[tool-result-guard] agent=${this.agentName} batch=${pending.id} stub's storage work queued for retry:`, error);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
catch (error) {
|
|
593
|
+
console.error(`[tool-result-guard] agent=${this.agentName} batch=${pending.id} could not annotate withheld results:`, error);
|
|
594
|
+
}
|
|
595
|
+
finally {
|
|
596
|
+
// Never rejects: a compile and stop() wait on this chain. With no
|
|
597
|
+
// stub edit queued, nothing else holds the batch.
|
|
598
|
+
if (!holdQueued) {
|
|
599
|
+
try {
|
|
600
|
+
this.releaseHold(pending.messageId);
|
|
601
|
+
}
|
|
602
|
+
catch (error) {
|
|
603
|
+
console.error(`[tool-result-guard] agent=${this.agentName} could not release a withheld batch's hold:`, error);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
this.annotating = run;
|
|
609
|
+
void run.finally(() => {
|
|
610
|
+
if (this.annotating === run)
|
|
611
|
+
this.annotating = undefined;
|
|
612
|
+
this.host?.idle(this.idle);
|
|
613
|
+
});
|
|
614
|
+
this.host?.track(run);
|
|
615
|
+
this.host?.idle(false);
|
|
616
|
+
}
|
|
296
617
|
releaseOperationHold(operation) {
|
|
297
618
|
if (operation.heldMessageId !== undefined) {
|
|
298
619
|
this.releaseHold(operation.heldMessageId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-guard.js","sourceRoot":"","sources":["../../src/tool-result-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAI9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,mEAAmE,CAAC;AAC5G,MAAM,CAAC,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAsB3E;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IAQP;IACA;IACA;IATX,OAAO,CAA2B;IAClC,UAAU,GAAG,KAAK,CAAC;IACnB,QAAQ,CAAsB;IACtC,sEAAsE;IACtE,UAAU,GAAG,KAAK,CAAC;IAEnB,YACmB,SAAiB,EACjB,EAAkB,EAClB,aAAa,KAAK;QAFlB,cAAS,GAAT,SAAS,CAAQ;QACjB,OAAE,GAAF,EAAE,CAAgB;QAClB,eAAU,GAAV,UAAU,CAAQ;IAClC,CAAC;IAEJ,IAAI,OAAO,KAAc,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACnE,WAAW,CAAC,KAA0B,IAAU,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC;IACxE,IAAI,eAAe,KAA0B,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE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24000;
|
|
46
46
|
export declare function toolResultDataToHistoryString(data: unknown, maxChars?: number, options?: HistorySerializeOptions): string;
|
|
47
|
+
/**
|
|
48
|
+
* The text of a tool result that isn't an error result: its data, as history
|
|
49
|
+
* stores it, or, when it has no data, its error text. A tool can answer
|
|
50
|
+
* `{ success: false, error, isError: false }`, a failure it doesn't flag as
|
|
51
|
+
* an error for the model, and the model still reads what failed.
|
|
52
|
+
*
|
|
53
|
+
* Each field is read once: the direct Agent API passes its caller's own
|
|
54
|
+
* result here, unchecked, and a getter needn't answer the same way twice.
|
|
55
|
+
*/
|
|
56
|
+
export declare function nonErrorResultText(result: {
|
|
57
|
+
data?: unknown;
|
|
58
|
+
error?: string;
|
|
59
|
+
}, maxChars?: number, options?: HistorySerializeOptions): string;
|
|
47
60
|
/** Bounded copy of an arbitrary string with the standard truncation notice.
|
|
48
61
|
* Image slots past the cut are re-appended, never dropped (issue #104). */
|
|
49
62
|
export declare function truncateForHistory(str: string, maxChars: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-history.d.ts","sourceRoot":"","sources":["../../src/tool-result-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,GAAG,IAAI,CAAC;CAC7F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oCAAoC,QAAQ,CAAC;AAE1D,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,
|
|
1
|
+
{"version":3,"file":"tool-result-history.d.ts","sourceRoot":"","sources":["../../src/tool-result-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,GAAG,IAAI,CAAC;CAC7F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oCAAoC,QAAQ,CAAC;AAE1D,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,CAMR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1C,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,CAOR;AAED;4EAC4E;AAC5E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMxE"}
|
|
@@ -35,9 +35,29 @@ import { formatPreservedImageSlots, formatToolImagePlaceholder, splitPreservingI
|
|
|
35
35
|
export const DEFAULT_TOOL_RESULT_INLINE_MAX_CHARS = 24000;
|
|
36
36
|
export function toolResultDataToHistoryString(data, maxChars, options) {
|
|
37
37
|
const fromArray = tryHistoryStringFromContentArray(data, options);
|
|
38
|
-
|
|
38
|
+
// JSON leaves out undefined, a function and a symbol: a result with no data
|
|
39
|
+
// is stored as no text, as an empty content array is.
|
|
40
|
+
const str = fromArray ?? JSON.stringify(data) ?? '';
|
|
39
41
|
return maxChars ? truncateForHistory(str, maxChars) : str;
|
|
40
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* The text of a tool result that isn't an error result: its data, as history
|
|
45
|
+
* stores it, or, when it has no data, its error text. A tool can answer
|
|
46
|
+
* `{ success: false, error, isError: false }`, a failure it doesn't flag as
|
|
47
|
+
* an error for the model, and the model still reads what failed.
|
|
48
|
+
*
|
|
49
|
+
* Each field is read once: the direct Agent API passes its caller's own
|
|
50
|
+
* result here, unchecked, and a getter needn't answer the same way twice.
|
|
51
|
+
*/
|
|
52
|
+
export function nonErrorResultText(result, maxChars, options) {
|
|
53
|
+
const data = result.data;
|
|
54
|
+
if (data === undefined || data === null) {
|
|
55
|
+
const error = result.error;
|
|
56
|
+
if (typeof error === 'string' && error)
|
|
57
|
+
return maxChars ? truncateForHistory(error, maxChars) : error;
|
|
58
|
+
}
|
|
59
|
+
return toolResultDataToHistoryString(data, maxChars, options);
|
|
60
|
+
}
|
|
41
61
|
/** Bounded copy of an arbitrary string with the standard truncation notice.
|
|
42
62
|
* Image slots past the cut are re-appended, never dropped (issue #104). */
|
|
43
63
|
export function truncateForHistory(str, maxChars) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-history.js","sourceRoot":"","sources":["../../src/tool-result-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAY1H;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,KAAK,CAAC;AAE1D,MAAM,UAAU,6BAA6B,CAC3C,IAAa,EACb,QAAiB,EACjB,OAAiC;IAEjC,MAAM,SAAS,GAAG,gCAAgC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClE,MAAM,GAAG,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"tool-result-history.js","sourceRoot":"","sources":["../../src/tool-result-history.ts"],"names":[],"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