@namzu/sdk 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2265 -0
- package/README.md +49 -53
- package/dist/__tests__/default-path-conformance.test.d.ts +2 -0
- package/dist/__tests__/default-path-conformance.test.d.ts.map +1 -0
- package/dist/__tests__/default-path-conformance.test.js +262 -0
- package/dist/__tests__/default-path-conformance.test.js.map +1 -0
- package/dist/__tests__/shipped-defaults.test.d.ts +2 -0
- package/dist/__tests__/shipped-defaults.test.d.ts.map +1 -0
- package/dist/__tests__/shipped-defaults.test.js +97 -0
- package/dist/__tests__/shipped-defaults.test.js.map +1 -0
- package/dist/advisory/__tests__/budget-enforcement.test.d.ts +2 -0
- package/dist/advisory/__tests__/budget-enforcement.test.d.ts.map +1 -0
- package/dist/advisory/__tests__/budget-enforcement.test.js +159 -0
- package/dist/advisory/__tests__/budget-enforcement.test.js.map +1 -0
- package/dist/advisory/__tests__/structured-response.test.d.ts +2 -0
- package/dist/advisory/__tests__/structured-response.test.d.ts.map +1 -0
- package/dist/advisory/__tests__/structured-response.test.js +99 -0
- package/dist/advisory/__tests__/structured-response.test.js.map +1 -0
- package/dist/advisory/budget.d.ts +15 -0
- package/dist/advisory/budget.d.ts.map +1 -0
- package/dist/advisory/budget.js +21 -0
- package/dist/advisory/budget.js.map +1 -0
- package/dist/advisory/context.d.ts +2 -0
- package/dist/advisory/context.d.ts.map +1 -1
- package/dist/advisory/context.js +16 -0
- package/dist/advisory/context.js.map +1 -1
- package/dist/advisory/executor.d.ts +14 -11
- package/dist/advisory/executor.d.ts.map +1 -1
- package/dist/advisory/executor.js +36 -24
- package/dist/advisory/executor.js.map +1 -1
- package/dist/advisory/executor.test.d.ts +8 -6
- package/dist/advisory/executor.test.d.ts.map +1 -1
- package/dist/advisory/executor.test.js +12 -8
- package/dist/advisory/executor.test.js.map +1 -1
- package/dist/advisory/index.d.ts +2 -0
- package/dist/advisory/index.d.ts.map +1 -1
- package/dist/advisory/index.js +2 -0
- package/dist/advisory/index.js.map +1 -1
- package/dist/advisory/parse.d.ts +23 -0
- package/dist/advisory/parse.d.ts.map +1 -0
- package/dist/advisory/parse.js +56 -0
- package/dist/advisory/parse.js.map +1 -0
- package/dist/agents/AbstractAgent.d.ts +48 -0
- package/dist/agents/AbstractAgent.d.ts.map +1 -1
- package/dist/agents/AbstractAgent.js +77 -0
- package/dist/agents/AbstractAgent.js.map +1 -1
- package/dist/agents/PipelineAgent.d.ts +10 -0
- package/dist/agents/PipelineAgent.d.ts.map +1 -1
- package/dist/agents/PipelineAgent.js +12 -0
- package/dist/agents/PipelineAgent.js.map +1 -1
- package/dist/agents/ReactiveAgent.d.ts +10 -0
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +40 -0
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/RouterAgent.d.ts +10 -0
- package/dist/agents/RouterAgent.d.ts.map +1 -1
- package/dist/agents/RouterAgent.js +23 -2
- package/dist/agents/RouterAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts +11 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +23 -1
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/__tests__/idempotency-key.test.d.ts +2 -0
- package/dist/agents/__tests__/idempotency-key.test.d.ts.map +1 -0
- package/dist/agents/__tests__/idempotency-key.test.js +149 -0
- package/dist/agents/__tests__/idempotency-key.test.js.map +1 -0
- package/dist/agents/__tests__/invocation-lock.test.d.ts +2 -0
- package/dist/agents/__tests__/invocation-lock.test.d.ts.map +1 -0
- package/dist/agents/__tests__/invocation-lock.test.js +126 -0
- package/dist/agents/__tests__/invocation-lock.test.js.map +1 -0
- package/dist/agents/__tests__/reachability.test.d.ts +2 -0
- package/dist/agents/__tests__/reachability.test.d.ts.map +1 -0
- package/dist/agents/__tests__/reachability.test.js +173 -0
- package/dist/agents/__tests__/reachability.test.js.map +1 -0
- package/dist/agents/__tests__/supervisor-ledger.test.js +1 -1
- package/dist/agents/__tests__/supervisor-ledger.test.js.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/lock.d.ts +0 -1
- package/dist/agents/lock.d.ts.map +1 -1
- package/dist/agents/lock.js.map +1 -1
- package/dist/bridge/a2a/late-events.test.d.ts +2 -0
- package/dist/bridge/a2a/late-events.test.d.ts.map +1 -0
- package/dist/bridge/a2a/late-events.test.js +70 -0
- package/dist/bridge/a2a/late-events.test.js.map +1 -0
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +55 -3
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/a2a/mapper.test.js +1 -1
- package/dist/bridge/a2a/mapper.test.js.map +1 -1
- package/dist/bridge/a2a/message.d.ts.map +1 -1
- package/dist/bridge/a2a/message.js +5 -1
- package/dist/bridge/a2a/message.js.map +1 -1
- package/dist/bridge/sse/late-events.test.d.ts +2 -0
- package/dist/bridge/sse/late-events.test.d.ts.map +1 -0
- package/dist/bridge/sse/late-events.test.js +163 -0
- package/dist/bridge/sse/late-events.test.js.map +1 -0
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +100 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/compaction/__tests__/cleared-result-recovery.test.d.ts +2 -0
- package/dist/compaction/__tests__/cleared-result-recovery.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/cleared-result-recovery.test.js +101 -0
- package/dist/compaction/__tests__/cleared-result-recovery.test.js.map +1 -0
- package/dist/compaction/__tests__/context-window.test.d.ts +2 -0
- package/dist/compaction/__tests__/context-window.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/context-window.test.js +62 -0
- package/dist/compaction/__tests__/context-window.test.js.map +1 -0
- package/dist/compaction/__tests__/dangling.test.js +16 -5
- package/dist/compaction/__tests__/dangling.test.js.map +1 -1
- package/dist/compaction/__tests__/lossiness.test.d.ts +2 -0
- package/dist/compaction/__tests__/lossiness.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/lossiness.test.js +163 -0
- package/dist/compaction/__tests__/lossiness.test.js.map +1 -0
- package/dist/compaction/__tests__/state-across-resume.test.d.ts +2 -0
- package/dist/compaction/__tests__/state-across-resume.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/state-across-resume.test.js +88 -0
- package/dist/compaction/__tests__/state-across-resume.test.js.map +1 -0
- package/dist/compaction/__tests__/tool-result-editing.test.d.ts +2 -0
- package/dist/compaction/__tests__/tool-result-editing.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/tool-result-editing.test.js +184 -0
- package/dist/compaction/__tests__/tool-result-editing.test.js.map +1 -0
- package/dist/compaction/__tests__/trim-opens-on-user.test.d.ts +2 -0
- package/dist/compaction/__tests__/trim-opens-on-user.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/trim-opens-on-user.test.js +109 -0
- package/dist/compaction/__tests__/trim-opens-on-user.test.js.map +1 -0
- package/dist/compaction/__tests__/verifier-model.test.d.ts +2 -0
- package/dist/compaction/__tests__/verifier-model.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/verifier-model.test.js +58 -0
- package/dist/compaction/__tests__/verifier-model.test.js.map +1 -0
- package/dist/compaction/context-window.d.ts +44 -0
- package/dist/compaction/context-window.d.ts.map +1 -0
- package/dist/compaction/context-window.js +97 -0
- package/dist/compaction/context-window.js.map +1 -0
- package/dist/compaction/dangling.js +48 -1
- package/dist/compaction/dangling.js.map +1 -1
- package/dist/compaction/extractor.d.ts.map +1 -1
- package/dist/compaction/extractor.js +55 -1
- package/dist/compaction/extractor.js.map +1 -1
- package/dist/compaction/index.d.ts +5 -0
- package/dist/compaction/index.d.ts.map +1 -1
- package/dist/compaction/index.js +3 -0
- package/dist/compaction/index.js.map +1 -1
- package/dist/compaction/manager.d.ts +25 -0
- package/dist/compaction/manager.d.ts.map +1 -1
- package/dist/compaction/manager.js +42 -8
- package/dist/compaction/manager.js.map +1 -1
- package/dist/compaction/managers/structured.d.ts.map +1 -1
- package/dist/compaction/managers/structured.js +7 -3
- package/dist/compaction/managers/structured.js.map +1 -1
- package/dist/compaction/retention.d.ts +15 -0
- package/dist/compaction/retention.d.ts.map +1 -0
- package/dist/compaction/retention.js +89 -0
- package/dist/compaction/retention.js.map +1 -0
- package/dist/compaction/serializer.d.ts.map +1 -1
- package/dist/compaction/serializer.js +28 -11
- package/dist/compaction/serializer.js.map +1 -1
- package/dist/compaction/tool-result-editing.d.ts +54 -0
- package/dist/compaction/tool-result-editing.d.ts.map +1 -0
- package/dist/compaction/tool-result-editing.js +164 -0
- package/dist/compaction/tool-result-editing.js.map +1 -0
- package/dist/compaction/types.d.ts +10 -0
- package/dist/compaction/types.d.ts.map +1 -1
- package/dist/compaction/verifier.d.ts +20 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +11 -2
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/compaction/wire.d.ts +54 -0
- package/dist/compaction/wire.d.ts.map +1 -0
- package/dist/compaction/wire.js +45 -0
- package/dist/compaction/wire.js.map +1 -0
- package/dist/config/runtime.d.ts +161 -45
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +61 -19
- package/dist/config/runtime.js.map +1 -1
- package/dist/connector/builtins/http.d.ts.map +1 -1
- package/dist/connector/builtins/http.js +14 -1
- package/dist/connector/builtins/http.js.map +1 -1
- package/dist/connector/builtins/http.test.js +12 -0
- package/dist/connector/builtins/http.test.js.map +1 -1
- package/dist/connector/mcp/__tests__/discovery-policy.test.d.ts +2 -0
- package/dist/connector/mcp/__tests__/discovery-policy.test.d.ts.map +1 -0
- package/dist/connector/mcp/__tests__/discovery-policy.test.js +109 -0
- package/dist/connector/mcp/__tests__/discovery-policy.test.js.map +1 -0
- package/dist/connector/mcp/__tests__/list-pagination.test.d.ts +2 -0
- package/dist/connector/mcp/__tests__/list-pagination.test.d.ts.map +1 -0
- package/dist/connector/mcp/__tests__/list-pagination.test.js +81 -0
- package/dist/connector/mcp/__tests__/list-pagination.test.js.map +1 -0
- package/dist/connector/mcp/__tests__/policy.test.d.ts +2 -0
- package/dist/connector/mcp/__tests__/policy.test.d.ts.map +1 -0
- package/dist/connector/mcp/__tests__/policy.test.js +86 -0
- package/dist/connector/mcp/__tests__/policy.test.js.map +1 -0
- package/dist/connector/mcp/__tests__/protocol-negotiation.test.d.ts +2 -0
- package/dist/connector/mcp/__tests__/protocol-negotiation.test.d.ts.map +1 -0
- package/dist/connector/mcp/__tests__/protocol-negotiation.test.js +81 -0
- package/dist/connector/mcp/__tests__/protocol-negotiation.test.js.map +1 -0
- package/dist/connector/mcp/__tests__/schema-fidelity.test.d.ts +2 -0
- package/dist/connector/mcp/__tests__/schema-fidelity.test.d.ts.map +1 -0
- package/dist/connector/mcp/__tests__/schema-fidelity.test.js +206 -0
- package/dist/connector/mcp/__tests__/schema-fidelity.test.js.map +1 -0
- package/dist/connector/mcp/__tests__/structured-result.test.d.ts +2 -0
- package/dist/connector/mcp/__tests__/structured-result.test.d.ts.map +1 -0
- package/dist/connector/mcp/__tests__/structured-result.test.js +112 -0
- package/dist/connector/mcp/__tests__/structured-result.test.js.map +1 -0
- package/dist/connector/mcp/adapter.d.ts +14 -0
- package/dist/connector/mcp/adapter.d.ts.map +1 -1
- package/dist/connector/mcp/adapter.js +292 -18
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +38 -0
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +138 -12
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/client.test.d.ts +2 -0
- package/dist/connector/mcp/client.test.d.ts.map +1 -0
- package/dist/connector/mcp/client.test.js +105 -0
- package/dist/connector/mcp/client.test.js.map +1 -0
- package/dist/connector/mcp/discovery.d.ts +32 -1
- package/dist/connector/mcp/discovery.d.ts.map +1 -1
- package/dist/connector/mcp/discovery.js +41 -4
- package/dist/connector/mcp/discovery.js.map +1 -1
- package/dist/connector/mcp/http-sse.d.ts.map +1 -1
- package/dist/connector/mcp/http-sse.js +15 -1
- package/dist/connector/mcp/http-sse.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +3 -0
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +1 -0
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/policy.d.ts +57 -0
- package/dist/connector/mcp/policy.d.ts.map +1 -0
- package/dist/connector/mcp/policy.js +84 -0
- package/dist/connector/mcp/policy.js.map +1 -0
- package/dist/connector/mcp/schema-refs.d.ts +26 -0
- package/dist/connector/mcp/schema-refs.d.ts.map +1 -0
- package/dist/connector/mcp/schema-refs.js +111 -0
- package/dist/connector/mcp/schema-refs.js.map +1 -0
- package/dist/constants/agent/index.d.ts.map +1 -1
- package/dist/constants/agent/index.js +3 -0
- package/dist/constants/agent/index.js.map +1 -1
- package/dist/constants/compaction/index.js +1 -1
- package/dist/constants/compaction/index.js.map +1 -1
- package/dist/constants/continuation.d.ts +4 -4
- package/dist/constants/continuation.js +4 -4
- package/dist/constants/mcp/index.d.ts +31 -0
- package/dist/constants/mcp/index.d.ts.map +1 -1
- package/dist/constants/mcp/index.js +31 -0
- package/dist/constants/mcp/index.js.map +1 -1
- package/dist/constants/plugin/index.d.ts +23 -2
- package/dist/constants/plugin/index.d.ts.map +1 -1
- package/dist/constants/plugin/index.js +23 -2
- package/dist/constants/plugin/index.js.map +1 -1
- package/dist/constants/sandbox/index.d.ts +2 -3
- package/dist/constants/sandbox/index.d.ts.map +1 -1
- package/dist/constants/sandbox/index.js +6 -5
- package/dist/constants/sandbox/index.js.map +1 -1
- package/dist/constants/telemetry/index.d.ts +7 -0
- package/dist/constants/telemetry/index.d.ts.map +1 -1
- package/dist/constants/telemetry/index.js +7 -0
- package/dist/constants/telemetry/index.js.map +1 -1
- package/dist/constants/tools/index.d.ts +16 -0
- package/dist/constants/tools/index.d.ts.map +1 -1
- package/dist/constants/tools/index.js +16 -0
- package/dist/constants/tools/index.js.map +1 -1
- package/dist/contracts/a2a.d.ts +94 -94
- package/dist/contracts/api.d.ts +40 -2
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/run-status.d.ts +17 -0
- package/dist/contracts/run-status.d.ts.map +1 -0
- package/dist/contracts/run-status.js +41 -0
- package/dist/contracts/run-status.js.map +1 -0
- package/dist/contracts/schemas.d.ts +6 -6
- package/dist/eval/__tests__/case-deadline.test.d.ts +2 -0
- package/dist/eval/__tests__/case-deadline.test.d.ts.map +1 -0
- package/dist/eval/__tests__/case-deadline.test.js +128 -0
- package/dist/eval/__tests__/case-deadline.test.js.map +1 -0
- package/dist/eval/__tests__/end-to-end.test.d.ts +2 -0
- package/dist/eval/__tests__/end-to-end.test.d.ts.map +1 -0
- package/dist/eval/__tests__/end-to-end.test.js +223 -0
- package/dist/eval/__tests__/end-to-end.test.js.map +1 -0
- package/dist/eval/__tests__/harness-honesty.test.d.ts +2 -0
- package/dist/eval/__tests__/harness-honesty.test.d.ts.map +1 -0
- package/dist/eval/__tests__/harness-honesty.test.js +85 -0
- package/dist/eval/__tests__/harness-honesty.test.js.map +1 -0
- package/dist/eval/__tests__/harness.test.d.ts +2 -0
- package/dist/eval/__tests__/harness.test.d.ts.map +1 -0
- package/dist/eval/__tests__/harness.test.js +207 -0
- package/dist/eval/__tests__/harness.test.js.map +1 -0
- package/dist/eval/__tests__/judge.test.d.ts +2 -0
- package/dist/eval/__tests__/judge.test.d.ts.map +1 -0
- package/dist/eval/__tests__/judge.test.js +255 -0
- package/dist/eval/__tests__/judge.test.js.map +1 -0
- package/dist/eval/__tests__/scorer-gates.test.d.ts +2 -0
- package/dist/eval/__tests__/scorer-gates.test.d.ts.map +1 -0
- package/dist/eval/__tests__/scorer-gates.test.js +136 -0
- package/dist/eval/__tests__/scorer-gates.test.js.map +1 -0
- package/dist/eval/experiment.d.ts +54 -0
- package/dist/eval/experiment.d.ts.map +1 -0
- package/dist/eval/experiment.js +263 -0
- package/dist/eval/experiment.js.map +1 -0
- package/dist/eval/from-run.d.ts +30 -0
- package/dist/eval/from-run.d.ts.map +1 -0
- package/dist/eval/from-run.js +46 -0
- package/dist/eval/from-run.js.map +1 -0
- package/dist/eval/index.d.ts +8 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +5 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/judge.d.ts +63 -0
- package/dist/eval/judge.d.ts.map +1 -0
- package/dist/eval/judge.js +136 -0
- package/dist/eval/judge.js.map +1 -0
- package/dist/eval/scorers.d.ts +40 -0
- package/dist/eval/scorers.d.ts.map +1 -0
- package/dist/eval/scorers.js +151 -0
- package/dist/eval/scorers.js.map +1 -0
- package/dist/eval/types.d.ts +150 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +2 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/execution/local.d.ts.map +1 -1
- package/dist/execution/local.js +6 -1
- package/dist/execution/local.js.map +1 -1
- package/dist/execution/local.test.d.ts +2 -0
- package/dist/execution/local.test.d.ts.map +1 -0
- package/dist/execution/local.test.js +37 -0
- package/dist/execution/local.test.js.map +1 -0
- package/dist/gateway/__tests__/list-survives-eviction.test.d.ts +2 -0
- package/dist/gateway/__tests__/list-survives-eviction.test.d.ts.map +1 -0
- package/dist/gateway/__tests__/list-survives-eviction.test.js +102 -0
- package/dist/gateway/__tests__/list-survives-eviction.test.js.map +1 -0
- package/dist/gateway/local.d.ts +42 -2
- package/dist/gateway/local.d.ts.map +1 -1
- package/dist/gateway/local.js +110 -3
- package/dist/gateway/local.js.map +1 -1
- package/dist/manager/agent/__tests__/dispose-cancels.test.d.ts +2 -0
- package/dist/manager/agent/__tests__/dispose-cancels.test.d.ts.map +1 -0
- package/dist/manager/agent/__tests__/dispose-cancels.test.js +88 -0
- package/dist/manager/agent/__tests__/dispose-cancels.test.js.map +1 -0
- package/dist/manager/agent/__tests__/lifecycle.test.js +230 -0
- package/dist/manager/agent/__tests__/lifecycle.test.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +35 -0
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +117 -7
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +90 -1
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +120 -0
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/plugin/__tests__/enable-contributions.test.js +3 -3
- package/dist/plugin/__tests__/enable-contributions.test.js.map +1 -1
- package/dist/plugin/__tests__/hook-ordering.test.d.ts +2 -0
- package/dist/plugin/__tests__/hook-ordering.test.d.ts.map +1 -0
- package/dist/plugin/__tests__/hook-ordering.test.js +227 -0
- package/dist/plugin/__tests__/hook-ordering.test.js.map +1 -0
- package/dist/plugin/__tests__/install-time-refusal.test.d.ts +2 -0
- package/dist/plugin/__tests__/install-time-refusal.test.d.ts.map +1 -0
- package/dist/plugin/__tests__/install-time-refusal.test.js +49 -0
- package/dist/plugin/__tests__/install-time-refusal.test.js.map +1 -0
- package/dist/plugin/__tests__/lifecycle.test.js +95 -68
- package/dist/plugin/__tests__/lifecycle.test.js.map +1 -1
- package/dist/plugin/lifecycle.d.ts +15 -1
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +67 -20
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/plugin/loader.d.ts +15 -0
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +33 -1
- package/dist/plugin/loader.js.map +1 -1
- package/dist/probe/registry.d.ts.map +1 -1
- package/dist/probe/registry.js +19 -1
- package/dist/probe/registry.js.map +1 -1
- package/dist/probe/registry.test.d.ts +9 -3
- package/dist/probe/registry.test.d.ts.map +1 -1
- package/dist/probe/registry.test.js +44 -6
- package/dist/probe/registry.test.js.map +1 -1
- package/dist/provider/__tests__/mock-script.test.d.ts +2 -0
- package/dist/provider/__tests__/mock-script.test.d.ts.map +1 -0
- package/dist/provider/__tests__/mock-script.test.js +151 -0
- package/dist/provider/__tests__/mock-script.test.js.map +1 -0
- package/dist/provider/__tests__/retry-visibility.test.d.ts +2 -0
- package/dist/provider/__tests__/retry-visibility.test.d.ts.map +1 -0
- package/dist/provider/__tests__/retry-visibility.test.js +137 -0
- package/dist/provider/__tests__/retry-visibility.test.js.map +1 -0
- package/dist/provider/__tests__/retry.test.d.ts +2 -0
- package/dist/provider/__tests__/retry.test.d.ts.map +1 -0
- package/dist/provider/__tests__/retry.test.js +259 -0
- package/dist/provider/__tests__/retry.test.js.map +1 -0
- package/dist/provider/capabilities.d.ts +1 -0
- package/dist/provider/capabilities.d.ts.map +1 -1
- package/dist/provider/capabilities.js +2 -0
- package/dist/provider/capabilities.js.map +1 -1
- package/dist/provider/collect.d.ts +1 -1
- package/dist/provider/collect.js +1 -1
- package/dist/provider/collect.test.d.ts +1 -1
- package/dist/provider/collect.test.js +1 -1
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +2 -0
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/mock-register.d.ts.map +1 -1
- package/dist/provider/mock-register.js +5 -2
- package/dist/provider/mock-register.js.map +1 -1
- package/dist/provider/mock.d.ts +35 -5
- package/dist/provider/mock.d.ts.map +1 -1
- package/dist/provider/mock.js +104 -32
- package/dist/provider/mock.js.map +1 -1
- package/dist/provider/retry.d.ts +42 -0
- package/dist/provider/retry.d.ts.map +1 -0
- package/dist/provider/retry.js +161 -0
- package/dist/provider/retry.js.map +1 -0
- package/dist/public-runtime.d.ts +26 -7
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +50 -7
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +5 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/rag/__tests__/retrieval-math.test.d.ts +2 -0
- package/dist/rag/__tests__/retrieval-math.test.d.ts.map +1 -0
- package/dist/rag/__tests__/retrieval-math.test.js +46 -0
- package/dist/rag/__tests__/retrieval-math.test.js.map +1 -0
- package/dist/rag/chunking.d.ts +12 -0
- package/dist/rag/chunking.d.ts.map +1 -1
- package/dist/rag/chunking.js +32 -1
- package/dist/rag/chunking.js.map +1 -1
- package/dist/rag/embedding.d.ts +4 -4
- package/dist/rag/embedding.d.ts.map +1 -1
- package/dist/rag/embedding.js +23 -3
- package/dist/rag/embedding.js.map +1 -1
- package/dist/rag/embedding.test.d.ts +1 -1
- package/dist/rag/embedding.test.js +59 -10
- package/dist/rag/embedding.test.js.map +1 -1
- package/dist/rag/index.d.ts +1 -1
- package/dist/rag/index.d.ts.map +1 -1
- package/dist/rag/index.js +1 -1
- package/dist/rag/index.js.map +1 -1
- package/dist/rag/retriever.d.ts +0 -1
- package/dist/rag/retriever.d.ts.map +1 -1
- package/dist/rag/retriever.js +75 -22
- package/dist/rag/retriever.js.map +1 -1
- package/dist/rag/vector-store.test.d.ts +1 -1
- package/dist/rag/vector-store.test.js +2 -2
- package/dist/rag/vector-store.test.js.map +1 -1
- package/dist/registry/ManagedRegistry.test.d.ts +1 -1
- package/dist/registry/ManagedRegistry.test.js +1 -1
- package/dist/registry/Registry.test.d.ts +1 -1
- package/dist/registry/Registry.test.js +1 -1
- package/dist/registry/connector/definitions.test.d.ts +1 -1
- package/dist/registry/connector/definitions.test.js +1 -1
- package/dist/registry/tool/__tests__/schema.test.d.ts +2 -0
- package/dist/registry/tool/__tests__/schema.test.d.ts.map +1 -0
- package/dist/registry/tool/__tests__/schema.test.js +176 -0
- package/dist/registry/tool/__tests__/schema.test.js.map +1 -0
- package/dist/registry/tool/__tests__/tool-name-validation.test.d.ts +2 -0
- package/dist/registry/tool/__tests__/tool-name-validation.test.d.ts.map +1 -0
- package/dist/registry/tool/__tests__/tool-name-validation.test.js +70 -0
- package/dist/registry/tool/__tests__/tool-name-validation.test.js.map +1 -0
- package/dist/registry/tool/execute.d.ts +37 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +91 -21
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/registry/tool/schema.d.ts +26 -0
- package/dist/registry/tool/schema.d.ts.map +1 -0
- package/dist/registry/tool/schema.js +77 -0
- package/dist/registry/tool/schema.js.map +1 -0
- package/dist/registry/toolset/catalog.d.ts.map +1 -1
- package/dist/registry/toolset/catalog.js +0 -1
- package/dist/registry/toolset/catalog.js.map +1 -1
- package/dist/registry/toolset/catalog.test.js +0 -1
- package/dist/registry/toolset/catalog.test.js.map +1 -1
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +76 -0
- package/dist/run/reporter.js.map +1 -1
- package/dist/runtime/bidi/__tests__/session.test.d.ts +2 -0
- package/dist/runtime/bidi/__tests__/session.test.d.ts.map +1 -0
- package/dist/runtime/bidi/__tests__/session.test.js +201 -0
- package/dist/runtime/bidi/__tests__/session.test.js.map +1 -0
- package/dist/runtime/bidi/index.d.ts +5 -0
- package/dist/runtime/bidi/index.d.ts.map +1 -0
- package/dist/runtime/bidi/index.js +3 -0
- package/dist/runtime/bidi/index.js.map +1 -0
- package/dist/runtime/bidi/mock.d.ts +34 -0
- package/dist/runtime/bidi/mock.d.ts.map +1 -0
- package/dist/runtime/bidi/mock.js +60 -0
- package/dist/runtime/bidi/mock.js.map +1 -0
- package/dist/runtime/bidi/session.d.ts +44 -0
- package/dist/runtime/bidi/session.d.ts.map +1 -0
- package/dist/runtime/bidi/session.js +154 -0
- package/dist/runtime/bidi/session.js.map +1 -0
- package/dist/runtime/decision/parser.d.ts.map +1 -1
- package/dist/runtime/decision/parser.js +8 -1
- package/dist/runtime/decision/parser.js.map +1 -1
- package/dist/runtime/decision/parser.test.d.ts +2 -0
- package/dist/runtime/decision/parser.test.d.ts.map +1 -0
- package/dist/runtime/decision/parser.test.js +37 -0
- package/dist/runtime/decision/parser.test.js.map +1 -0
- package/dist/runtime/query/__tests__/answer-review.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/answer-review.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/answer-review.test.js +141 -0
- package/dist/runtime/query/__tests__/answer-review.test.js.map +1 -0
- package/dist/runtime/query/__tests__/capability-negotiation.test.js +24 -111
- package/dist/runtime/query/__tests__/capability-negotiation.test.js.map +1 -1
- package/dist/runtime/query/__tests__/checkpoint-store.test.js +12 -44
- package/dist/runtime/query/__tests__/checkpoint-store.test.js.map +1 -1
- package/dist/runtime/query/__tests__/checkpoint.test.js +2 -10
- package/dist/runtime/query/__tests__/checkpoint.test.js.map +1 -1
- package/dist/runtime/query/__tests__/citations.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/citations.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/citations.test.js +85 -0
- package/dist/runtime/query/__tests__/citations.test.js.map +1 -0
- package/dist/runtime/query/__tests__/content-budget.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/content-budget.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/content-budget.test.js +69 -0
- package/dist/runtime/query/__tests__/content-budget.test.js.map +1 -0
- package/dist/runtime/query/__tests__/context.test.js +3 -2
- package/dist/runtime/query/__tests__/context.test.js.map +1 -1
- package/dist/runtime/query/__tests__/deferred-tools.test.js +21 -130
- package/dist/runtime/query/__tests__/deferred-tools.test.js.map +1 -1
- package/dist/runtime/query/__tests__/delegation-resume.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/delegation-resume.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/delegation-resume.test.js +111 -0
- package/dist/runtime/query/__tests__/delegation-resume.test.js.map +1 -0
- package/dist/runtime/query/__tests__/document-attachments.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/document-attachments.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/document-attachments.test.js +92 -0
- package/dist/runtime/query/__tests__/document-attachments.test.js.map +1 -0
- package/dist/runtime/query/__tests__/durable-park-and-trace.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/durable-park-and-trace.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/durable-park-and-trace.test.js +194 -0
- package/dist/runtime/query/__tests__/durable-park-and-trace.test.js.map +1 -0
- package/dist/runtime/query/__tests__/durable-question-park.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/durable-question-park.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/durable-question-park.test.js +253 -0
- package/dist/runtime/query/__tests__/durable-question-park.test.js.map +1 -0
- package/dist/runtime/query/__tests__/durable-run-state.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/durable-run-state.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/durable-run-state.test.js +158 -0
- package/dist/runtime/query/__tests__/durable-run-state.test.js.map +1 -0
- package/dist/runtime/query/__tests__/executor-plugin-hooks.test.js +24 -20
- package/dist/runtime/query/__tests__/executor-plugin-hooks.test.js.map +1 -1
- package/dist/runtime/query/__tests__/finish-reason-vs-tool-calls.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/finish-reason-vs-tool-calls.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/finish-reason-vs-tool-calls.test.js +187 -0
- package/dist/runtime/query/__tests__/finish-reason-vs-tool-calls.test.js.map +1 -0
- package/dist/runtime/query/__tests__/grant-cannot-overrule-the-gate.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/grant-cannot-overrule-the-gate.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/grant-cannot-overrule-the-gate.test.js +95 -0
- package/dist/runtime/query/__tests__/grant-cannot-overrule-the-gate.test.js.map +1 -0
- package/dist/runtime/query/__tests__/guardrails-e2e.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/guardrails-e2e.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/guardrails-e2e.test.js +132 -0
- package/dist/runtime/query/__tests__/guardrails-e2e.test.js.map +1 -0
- package/dist/runtime/query/__tests__/guardrails.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/guardrails.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/guardrails.test.js +163 -0
- package/dist/runtime/query/__tests__/guardrails.test.js.map +1 -0
- package/dist/runtime/query/__tests__/hook-model-visibility.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/hook-model-visibility.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/hook-model-visibility.test.js +119 -0
- package/dist/runtime/query/__tests__/hook-model-visibility.test.js.map +1 -0
- package/dist/runtime/query/__tests__/long-document-flow.test.js +9 -2
- package/dist/runtime/query/__tests__/long-document-flow.test.js.map +1 -1
- package/dist/runtime/query/__tests__/memory-promotion.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/memory-promotion.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/memory-promotion.test.js +119 -0
- package/dist/runtime/query/__tests__/memory-promotion.test.js.map +1 -0
- package/dist/runtime/query/__tests__/orphan-task-turn-end.test.js +5 -27
- package/dist/runtime/query/__tests__/orphan-task-turn-end.test.js.map +1 -1
- package/dist/runtime/query/__tests__/overflow-relief.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/overflow-relief.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/overflow-relief.test.js +119 -0
- package/dist/runtime/query/__tests__/overflow-relief.test.js.map +1 -0
- package/dist/runtime/query/__tests__/partial-batch-resume.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/partial-batch-resume.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/partial-batch-resume.test.js +205 -0
- package/dist/runtime/query/__tests__/partial-batch-resume.test.js.map +1 -0
- package/dist/runtime/query/__tests__/plugin-hooks.test.js +0 -1
- package/dist/runtime/query/__tests__/plugin-hooks.test.js.map +1 -1
- package/dist/runtime/query/__tests__/prepare-step-chain.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/prepare-step-chain.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/prepare-step-chain.test.js +104 -0
- package/dist/runtime/query/__tests__/prepare-step-chain.test.js.map +1 -0
- package/dist/runtime/query/__tests__/prepare-step.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/prepare-step.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/prepare-step.test.js +194 -0
- package/dist/runtime/query/__tests__/prepare-step.test.js.map +1 -0
- package/dist/runtime/query/__tests__/probe-veto-is-error.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/probe-veto-is-error.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/probe-veto-is-error.test.js +111 -0
- package/dist/runtime/query/__tests__/probe-veto-is-error.test.js.map +1 -0
- package/dist/runtime/query/__tests__/prompt.test.js +1 -1
- package/dist/runtime/query/__tests__/prompt.test.js.map +1 -1
- package/dist/runtime/query/__tests__/provider-fault-pauses.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/provider-fault-pauses.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/provider-fault-pauses.test.js +86 -0
- package/dist/runtime/query/__tests__/provider-fault-pauses.test.js.map +1 -0
- package/dist/runtime/query/__tests__/reasoning-stream.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/reasoning-stream.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/reasoning-stream.test.js +146 -0
- package/dist/runtime/query/__tests__/reasoning-stream.test.js.map +1 -0
- package/dist/runtime/query/__tests__/recoverable-settle.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/recoverable-settle.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/recoverable-settle.test.js +119 -0
- package/dist/runtime/query/__tests__/recoverable-settle.test.js.map +1 -0
- package/dist/runtime/query/__tests__/resume-budget.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/resume-budget.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/resume-budget.test.js +130 -0
- package/dist/runtime/query/__tests__/resume-budget.test.js.map +1 -0
- package/dist/runtime/query/__tests__/resume-pending.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/resume-pending.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/resume-pending.test.js +226 -0
- package/dist/runtime/query/__tests__/resume-pending.test.js.map +1 -0
- package/dist/runtime/query/__tests__/rich-content-budget-wiring.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/rich-content-budget-wiring.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/rich-content-budget-wiring.test.js +89 -0
- package/dist/runtime/query/__tests__/rich-content-budget-wiring.test.js.map +1 -0
- package/dist/runtime/query/__tests__/stop-condition.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/stop-condition.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/stop-condition.test.js +205 -0
- package/dist/runtime/query/__tests__/stop-condition.test.js.map +1 -0
- package/dist/runtime/query/__tests__/structured-output.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/structured-output.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/structured-output.test.js +219 -0
- package/dist/runtime/query/__tests__/structured-output.test.js.map +1 -0
- package/dist/runtime/query/__tests__/structured-run-failure.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/structured-run-failure.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/structured-run-failure.test.js +117 -0
- package/dist/runtime/query/__tests__/structured-run-failure.test.js.map +1 -0
- package/dist/runtime/query/__tests__/terminal-tool.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/terminal-tool.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/terminal-tool.test.js +119 -0
- package/dist/runtime/query/__tests__/terminal-tool.test.js.map +1 -0
- package/dist/runtime/query/__tests__/tool-grants.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/tool-grants.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/tool-grants.test.js +85 -0
- package/dist/runtime/query/__tests__/tool-grants.test.js.map +1 -0
- package/dist/runtime/query/__tests__/tool-output-budget.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/tool-output-budget.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/tool-output-budget.test.js +0 -0
- package/dist/runtime/query/__tests__/tool-output-budget.test.js.map +1 -0
- package/dist/runtime/query/__tests__/tool-pause.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/tool-pause.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/tool-pause.test.js +165 -0
- package/dist/runtime/query/__tests__/tool-pause.test.js.map +1 -0
- package/dist/runtime/query/__tests__/tool-progress.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/tool-progress.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/tool-progress.test.js +122 -0
- package/dist/runtime/query/__tests__/tool-progress.test.js.map +1 -0
- package/dist/runtime/query/__tests__/tool-repair-retry.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/tool-repair-retry.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/tool-repair-retry.test.js +196 -0
- package/dist/runtime/query/__tests__/tool-repair-retry.test.js.map +1 -0
- package/dist/runtime/query/__tests__/tool-result-wire.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/tool-result-wire.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/tool-result-wire.test.js +106 -0
- package/dist/runtime/query/__tests__/tool-result-wire.test.js.map +1 -0
- package/dist/runtime/query/__tests__/tool-timeout.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/tool-timeout.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/tool-timeout.test.js +184 -0
- package/dist/runtime/query/__tests__/tool-timeout.test.js.map +1 -0
- package/dist/runtime/query/__tests__/trace-parenting.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/trace-parenting.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/trace-parenting.test.js +111 -0
- package/dist/runtime/query/__tests__/trace-parenting.test.js.map +1 -0
- package/dist/runtime/query/__tests__/wiring-seams.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/wiring-seams.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/wiring-seams.test.js +237 -0
- package/dist/runtime/query/__tests__/wiring-seams.test.js.map +1 -0
- package/dist/runtime/query/checkpoint.d.ts +124 -6
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +207 -6
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/events.js +2 -2
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +224 -7
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +662 -35
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/guard.d.ts +18 -0
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +16 -1
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/guardrail-presets.d.ts +36 -0
- package/dist/runtime/query/guardrail-presets.d.ts.map +1 -0
- package/dist/runtime/query/guardrail-presets.js +96 -0
- package/dist/runtime/query/guardrail-presets.js.map +1 -0
- package/dist/runtime/query/guardrails.d.ts +35 -0
- package/dist/runtime/query/guardrails.d.ts.map +1 -0
- package/dist/runtime/query/guardrails.js +102 -0
- package/dist/runtime/query/guardrails.js.map +1 -0
- package/dist/runtime/query/index.d.ts +213 -2
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +458 -10
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/__tests__/cancel-settles-turn.test.d.ts +2 -0
- package/dist/runtime/query/iteration/__tests__/cancel-settles-turn.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/__tests__/cancel-settles-turn.test.js +131 -0
- package/dist/runtime/query/iteration/__tests__/cancel-settles-turn.test.js.map +1 -0
- package/dist/runtime/query/iteration/index.d.ts +76 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +577 -34
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +14 -2
- package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.test.d.ts +1 -1
- package/dist/runtime/query/iteration/phases/advisory.test.js +4 -1
- package/dist/runtime/query/iteration/phases/advisory.test.js.map +1 -1
- package/dist/runtime/query/iteration/phases/checkpoint.js +2 -2
- package/dist/runtime/query/iteration/phases/checkpoint.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction-safe-cut.test.js +1 -1
- package/dist/runtime/query/iteration/phases/compaction-safe-cut.test.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts +22 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +297 -64
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context-measurement.test.d.ts +21 -0
- package/dist/runtime/query/iteration/phases/context-measurement.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/context-measurement.test.js +161 -0
- package/dist/runtime/query/iteration/phases/context-measurement.test.js.map +1 -0
- package/dist/runtime/query/iteration/phases/context.d.ts +62 -2
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +87 -0
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/hitl-answer-question.test.js +3 -1
- package/dist/runtime/query/iteration/phases/hitl-answer-question.test.js.map +1 -1
- package/dist/runtime/query/iteration/phases/overflow-escalation.test.d.ts +15 -0
- package/dist/runtime/query/iteration/phases/overflow-escalation.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/overflow-escalation.test.js +130 -0
- package/dist/runtime/query/iteration/phases/overflow-escalation.test.js.map +1 -0
- package/dist/runtime/query/iteration/phases/plan.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/plan.js +8 -2
- package/dist/runtime/query/iteration/phases/plan.js.map +1 -1
- package/dist/runtime/query/iteration/phases/retained-messages.test.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/retained-messages.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/retained-messages.test.js +180 -0
- package/dist/runtime/query/iteration/phases/retained-messages.test.js.map +1 -0
- package/dist/runtime/query/iteration/phases/tool-review-denials.test.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/tool-review-denials.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/tool-review-denials.test.js +224 -0
- package/dist/runtime/query/iteration/phases/tool-review-denials.test.js.map +1 -0
- package/dist/runtime/query/iteration/phases/tool-review.d.ts +29 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +114 -44
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory-compaction.test.js +20 -9
- package/dist/runtime/query/iteration/phases/working-memory-compaction.test.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts +2 -26
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +254 -16
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/plugin-hooks.d.ts.map +1 -1
- package/dist/runtime/query/plugin-hooks.js +6 -2
- package/dist/runtime/query/plugin-hooks.js.map +1 -1
- package/dist/runtime/query/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +25 -1
- package/dist/runtime/query/prompt.js.map +1 -1
- package/dist/runtime/query/question-park.d.ts +85 -0
- package/dist/runtime/query/question-park.d.ts.map +1 -0
- package/dist/runtime/query/question-park.js +71 -0
- package/dist/runtime/query/question-park.js.map +1 -0
- package/dist/runtime/query/result.d.ts +9 -0
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +49 -0
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts +106 -0
- package/dist/runtime/query/resume-pending.d.ts.map +1 -0
- package/dist/runtime/query/resume-pending.js +312 -0
- package/dist/runtime/query/resume-pending.js.map +1 -0
- package/dist/runtime/query/run-state.d.ts +52 -0
- package/dist/runtime/query/run-state.d.ts.map +1 -0
- package/dist/runtime/query/run-state.js +87 -0
- package/dist/runtime/query/run-state.js.map +1 -0
- package/dist/runtime/query/tool-grants.d.ts +44 -0
- package/dist/runtime/query/tool-grants.d.ts.map +1 -0
- package/dist/runtime/query/tool-grants.js +63 -0
- package/dist/runtime/query/tool-grants.js.map +1 -0
- package/dist/runtime/query/tool-output-budget.d.ts +83 -0
- package/dist/runtime/query/tool-output-budget.d.ts.map +1 -0
- package/dist/runtime/query/tool-output-budget.js +147 -0
- package/dist/runtime/query/tool-output-budget.js.map +1 -0
- package/dist/runtime/query/tool-pause.d.ts +41 -0
- package/dist/runtime/query/tool-pause.d.ts.map +1 -0
- package/dist/runtime/query/tool-pause.js +94 -0
- package/dist/runtime/query/tool-pause.js.map +1 -0
- package/dist/runtime/query/tooling.d.ts +10 -1
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +13 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/sandbox/__tests__/isolation.test.d.ts +2 -0
- package/dist/sandbox/__tests__/isolation.test.d.ts.map +1 -0
- package/dist/sandbox/__tests__/isolation.test.js +139 -0
- package/dist/sandbox/__tests__/isolation.test.js.map +1 -0
- package/dist/sandbox/__tests__/output-truncation.test.d.ts +2 -0
- package/dist/sandbox/__tests__/output-truncation.test.d.ts.map +1 -0
- package/dist/sandbox/__tests__/output-truncation.test.js +88 -0
- package/dist/sandbox/__tests__/output-truncation.test.js.map +1 -0
- package/dist/sandbox/__tests__/resource-limits.test.d.ts +2 -0
- package/dist/sandbox/__tests__/resource-limits.test.d.ts.map +1 -0
- package/dist/sandbox/__tests__/resource-limits.test.js +86 -0
- package/dist/sandbox/__tests__/resource-limits.test.js.map +1 -0
- package/dist/sandbox/factory.js +1 -1
- package/dist/sandbox/factory.js.map +1 -1
- package/dist/sandbox/index.d.ts +2 -0
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +1 -0
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/isolation.d.ts +15 -0
- package/dist/sandbox/isolation.d.ts.map +1 -0
- package/dist/sandbox/isolation.js +53 -0
- package/dist/sandbox/isolation.js.map +1 -0
- package/dist/sandbox/provider/local.d.ts +51 -2
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +139 -69
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/session/__tests__/integration/spawn-rollback.test.d.ts +1 -1
- package/dist/session/__tests__/integration/spawn-rollback.test.js +1 -1
- package/dist/session/handoff/broadcast.js +3 -3
- package/dist/session/handoff/broadcast.js.map +1 -1
- package/dist/session/migration/__tests__/filesystem.test.js +5 -1
- package/dist/session/migration/__tests__/filesystem.test.js.map +1 -1
- package/dist/session/migration/filesystem.d.ts.map +1 -1
- package/dist/session/migration/filesystem.js +7 -13
- package/dist/session/migration/filesystem.js.map +1 -1
- package/dist/session/migration/marker.d.ts.map +1 -1
- package/dist/session/migration/marker.js +5 -10
- package/dist/session/migration/marker.js.map +1 -1
- package/dist/session/retention/disk-backend.d.ts.map +1 -1
- package/dist/session/retention/disk-backend.js +5 -12
- package/dist/session/retention/disk-backend.js.map +1 -1
- package/dist/session/workspace/__tests__/git-worktree.test.js +6 -2
- package/dist/session/workspace/__tests__/git-worktree.test.js.map +1 -1
- package/dist/session/workspace/__tests__/shared-run.test.js +15 -0
- package/dist/session/workspace/__tests__/shared-run.test.js.map +1 -1
- package/dist/session/workspace/shared-run.js +8 -1
- package/dist/session/workspace/shared-run.js.map +1 -1
- package/dist/skills/__tests__/frontmatter.test.d.ts +2 -0
- package/dist/skills/__tests__/frontmatter.test.d.ts.map +1 -0
- package/dist/skills/__tests__/frontmatter.test.js +106 -0
- package/dist/skills/__tests__/frontmatter.test.js.map +1 -0
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +42 -3
- package/dist/skills/loader.js.map +1 -1
- package/dist/store/__tests__/checkpoint-integrity.test.d.ts +2 -0
- package/dist/store/__tests__/checkpoint-integrity.test.d.ts.map +1 -0
- package/dist/store/__tests__/checkpoint-integrity.test.js +112 -0
- package/dist/store/__tests__/checkpoint-integrity.test.js.map +1 -0
- package/dist/store/__tests__/checkpoint-versioning.test.d.ts +2 -0
- package/dist/store/__tests__/checkpoint-versioning.test.d.ts.map +1 -0
- package/dist/store/__tests__/checkpoint-versioning.test.js +151 -0
- package/dist/store/__tests__/checkpoint-versioning.test.js.map +1 -0
- package/dist/store/__tests__/schema-adoption.test.d.ts +2 -0
- package/dist/store/__tests__/schema-adoption.test.d.ts.map +1 -0
- package/dist/store/__tests__/schema-adoption.test.js +90 -0
- package/dist/store/__tests__/schema-adoption.test.js.map +1 -0
- package/dist/store/__tests__/schema.test.d.ts +2 -0
- package/dist/store/__tests__/schema.test.d.ts.map +1 -0
- package/dist/store/__tests__/schema.test.js +93 -0
- package/dist/store/__tests__/schema.test.js.map +1 -0
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +16 -16
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/run/disk.d.ts +23 -0
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js +148 -23
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/schema.d.ts +73 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +103 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/session/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +25 -13
- package/dist/store/session/disk.js.map +1 -1
- package/dist/store/task/__tests__/lookup-across-runs.test.d.ts +2 -0
- package/dist/store/task/__tests__/lookup-across-runs.test.d.ts.map +1 -0
- package/dist/store/task/__tests__/lookup-across-runs.test.js +60 -0
- package/dist/store/task/__tests__/lookup-across-runs.test.js.map +1 -0
- package/dist/store/task/disk.d.ts +18 -0
- package/dist/store/task/disk.d.ts.map +1 -1
- package/dist/store/task/disk.js +61 -16
- package/dist/store/task/disk.js.map +1 -1
- package/dist/store/thread/disk.d.ts.map +1 -1
- package/dist/store/thread/disk.js +20 -11
- package/dist/store/thread/disk.js.map +1 -1
- package/dist/streaming/coalesce.d.ts +1 -1
- package/dist/streaming/coalesce.js +1 -1
- package/dist/telemetry/__tests__/latency-instruments.test.d.ts +2 -0
- package/dist/telemetry/__tests__/latency-instruments.test.d.ts.map +1 -0
- package/dist/telemetry/__tests__/latency-instruments.test.js +82 -0
- package/dist/telemetry/__tests__/latency-instruments.test.js.map +1 -0
- package/dist/telemetry/__tests__/metrics.test.d.ts +2 -0
- package/dist/telemetry/__tests__/metrics.test.d.ts.map +1 -0
- package/dist/telemetry/__tests__/metrics.test.js +112 -0
- package/dist/telemetry/__tests__/metrics.test.js.map +1 -0
- package/dist/telemetry/__tests__/span-hierarchy.test.d.ts +2 -0
- package/dist/telemetry/__tests__/span-hierarchy.test.d.ts.map +1 -0
- package/dist/telemetry/__tests__/span-hierarchy.test.js +84 -0
- package/dist/telemetry/__tests__/span-hierarchy.test.js.map +1 -0
- package/dist/telemetry/attributes.d.ts +44 -0
- package/dist/telemetry/attributes.d.ts.map +1 -1
- package/dist/telemetry/attributes.js +80 -0
- package/dist/telemetry/attributes.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +41 -0
- package/dist/telemetry/metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics.js +160 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/test-setup.d.ts +3 -3
- package/dist/test-setup.js +3 -3
- package/dist/test-support/paths.d.ts +14 -0
- package/dist/test-support/paths.d.ts.map +1 -0
- package/dist/test-support/paths.js +16 -0
- package/dist/test-support/paths.js.map +1 -0
- package/dist/tools/__tests__/path-containment.test.d.ts +2 -0
- package/dist/tools/__tests__/path-containment.test.d.ts.map +1 -0
- package/dist/tools/__tests__/path-containment.test.js +133 -0
- package/dist/tools/__tests__/path-containment.test.js.map +1 -0
- package/dist/tools/__tests__/posix-path.test.d.ts +2 -0
- package/dist/tools/__tests__/posix-path.test.d.ts.map +1 -0
- package/dist/tools/__tests__/posix-path.test.js +67 -0
- package/dist/tools/__tests__/posix-path.test.js.map +1 -0
- package/dist/tools/__tests__/sandboxed-search.test.d.ts +2 -0
- package/dist/tools/__tests__/sandboxed-search.test.d.ts.map +1 -0
- package/dist/tools/__tests__/sandboxed-search.test.js +114 -0
- package/dist/tools/__tests__/sandboxed-search.test.js.map +1 -0
- package/dist/tools/builtins/__tests__/computer-use.test.js +12 -2
- package/dist/tools/builtins/__tests__/computer-use.test.js.map +1 -1
- package/dist/tools/builtins/__tests__/edit.test.js +10 -216
- package/dist/tools/builtins/__tests__/edit.test.js.map +1 -1
- package/dist/tools/builtins/__tests__/payload-budget.test.js +16 -30
- package/dist/tools/builtins/__tests__/payload-budget.test.js.map +1 -1
- package/dist/tools/builtins/__tests__/read-file.test.js +23 -1
- package/dist/tools/builtins/__tests__/read-file.test.js.map +1 -1
- package/dist/tools/builtins/__tests__/write-file.test.js +13 -37
- package/dist/tools/builtins/__tests__/write-file.test.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +33 -4
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +22 -22
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +7 -1
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts +5 -2
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +125 -105
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/glob.d.ts +1 -1
- package/dist/tools/builtins/glob.d.ts.map +1 -1
- package/dist/tools/builtins/glob.js +63 -6
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.d.ts.map +1 -1
- package/dist/tools/builtins/grep.js +61 -8
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/index.js +6 -6
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/ls.d.ts.map +1 -1
- package/dist/tools/builtins/ls.js +4 -2
- package/dist/tools/builtins/ls.js.map +1 -1
- package/dist/tools/builtins/read-file.d.ts +1 -1
- package/dist/tools/builtins/read-file.d.ts.map +1 -1
- package/dist/tools/builtins/read-file.js +38 -4
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts +2 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +40 -66
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/coordinator/__tests__/agent.test.d.ts +1 -1
- package/dist/tools/coordinator/__tests__/agent.test.js +2 -2
- package/dist/tools/coordinator/__tests__/agent.test.js.map +1 -1
- package/dist/tools/coordinator/agent.d.ts +20 -9
- package/dist/tools/coordinator/agent.d.ts.map +1 -1
- package/dist/tools/coordinator/agent.js +2 -1
- package/dist/tools/coordinator/agent.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts +20 -0
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +80 -32
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/defineTool.d.ts +16 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +4 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/glob-match.d.ts +18 -0
- package/dist/tools/glob-match.d.ts.map +1 -0
- package/dist/tools/glob-match.js +50 -0
- package/dist/tools/glob-match.js.map +1 -0
- package/dist/tools/paths.d.ts +20 -0
- package/dist/tools/paths.d.ts.map +1 -0
- package/dist/tools/paths.js +41 -0
- package/dist/tools/paths.js.map +1 -0
- package/dist/tools/posix-path.d.ts +24 -0
- package/dist/tools/posix-path.d.ts.map +1 -0
- package/dist/tools/posix-path.js +67 -0
- package/dist/tools/posix-path.js.map +1 -0
- package/dist/types/advisory/config.d.ts +21 -3
- package/dist/types/advisory/config.d.ts.map +1 -1
- package/dist/types/advisory/result.d.ts +12 -10
- package/dist/types/advisory/result.d.ts.map +1 -1
- package/dist/types/agent/base.d.ts +20 -2
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/factory.d.ts +15 -9
- package/dist/types/agent/factory.d.ts.map +1 -1
- package/dist/types/agent/gateway.d.ts +18 -0
- package/dist/types/agent/gateway.d.ts.map +1 -1
- package/dist/types/agent/manager.d.ts +19 -0
- package/dist/types/agent/manager.d.ts.map +1 -1
- package/dist/types/agent/reactive.d.ts +48 -0
- package/dist/types/agent/reactive.d.ts.map +1 -1
- package/dist/types/agent/router.d.ts +11 -0
- package/dist/types/agent/router.d.ts.map +1 -1
- package/dist/types/agent/supervisor.d.ts +2 -2
- package/dist/types/agent/task.d.ts +24 -0
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/bidi/index.d.ts +140 -0
- package/dist/types/bidi/index.d.ts.map +1 -0
- package/dist/types/bidi/index.js +2 -0
- package/dist/types/bidi/index.js.map +1 -0
- package/dist/types/common/__tests__/numeric-correctness.test.d.ts +2 -0
- package/dist/types/common/__tests__/numeric-correctness.test.d.ts.map +1 -0
- package/dist/types/common/__tests__/numeric-correctness.test.js +108 -0
- package/dist/types/common/__tests__/numeric-correctness.test.js.map +1 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js +15 -4
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/connector/mcp.d.ts +29 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/errors/__tests__/catalog.test.d.ts +2 -0
- package/dist/types/errors/__tests__/catalog.test.d.ts.map +1 -0
- package/dist/types/errors/__tests__/catalog.test.js +106 -0
- package/dist/types/errors/__tests__/catalog.test.js.map +1 -0
- package/dist/types/errors/__tests__/errors.test.d.ts +2 -0
- package/dist/types/errors/__tests__/errors.test.d.ts.map +1 -0
- package/dist/types/errors/__tests__/errors.test.js +104 -0
- package/dist/types/errors/__tests__/errors.test.js.map +1 -0
- package/dist/types/errors/catalog.d.ts +83 -0
- package/dist/types/errors/catalog.d.ts.map +1 -0
- package/dist/types/errors/catalog.js +148 -0
- package/dist/types/errors/catalog.js.map +1 -0
- package/dist/types/errors/index.d.ts +73 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/errors/index.js +70 -0
- package/dist/types/errors/index.js.map +1 -0
- package/dist/types/guardrail/index.d.ts +57 -0
- package/dist/types/guardrail/index.d.ts.map +1 -0
- package/dist/types/guardrail/index.js +2 -0
- package/dist/types/guardrail/index.js.map +1 -0
- package/dist/types/hitl/index.d.ts +97 -14
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/ids/index.d.ts +2 -2
- package/dist/types/message/content.d.ts +22 -0
- package/dist/types/message/content.d.ts.map +1 -0
- package/dist/types/message/content.js +49 -0
- package/dist/types/message/content.js.map +1 -0
- package/dist/types/message/index.d.ts +193 -8
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +19 -4
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +78 -3
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +0 -1
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/__tests__/cause-chain.test.d.ts +2 -0
- package/dist/types/provider/__tests__/cause-chain.test.d.ts.map +1 -0
- package/dist/types/provider/__tests__/cause-chain.test.js +108 -0
- package/dist/types/provider/__tests__/cause-chain.test.js.map +1 -0
- package/dist/types/provider/__tests__/declared-retryable.test.d.ts +2 -0
- package/dist/types/provider/__tests__/declared-retryable.test.d.ts.map +1 -0
- package/dist/types/provider/__tests__/declared-retryable.test.js +70 -0
- package/dist/types/provider/__tests__/declared-retryable.test.js.map +1 -0
- package/dist/types/provider/__tests__/overflow-classification.test.d.ts +2 -0
- package/dist/types/provider/__tests__/overflow-classification.test.d.ts.map +1 -0
- package/dist/types/provider/__tests__/overflow-classification.test.js +80 -0
- package/dist/types/provider/__tests__/overflow-classification.test.js.map +1 -0
- package/dist/types/provider/chat.d.ts +27 -1
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/config.d.ts +83 -2
- package/dist/types/provider/config.d.ts.map +1 -1
- package/dist/types/provider/errors.d.ts +102 -0
- package/dist/types/provider/errors.d.ts.map +1 -0
- package/dist/types/provider/errors.js +393 -0
- package/dist/types/provider/errors.js.map +1 -0
- package/dist/types/provider/index.d.ts +3 -2
- package/dist/types/provider/index.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +59 -3
- package/dist/types/provider/stream.d.ts.map +1 -1
- package/dist/types/rag/embedding.d.ts +11 -2
- package/dist/types/rag/embedding.d.ts.map +1 -1
- package/dist/types/run/__tests__/step.test.d.ts +2 -0
- package/dist/types/run/__tests__/step.test.d.ts.map +1 -0
- package/dist/types/run/__tests__/step.test.js +107 -0
- package/dist/types/run/__tests__/step.test.js.map +1 -0
- package/dist/types/run/answer-review.d.ts +46 -0
- package/dist/types/run/answer-review.d.ts.map +1 -0
- package/dist/types/run/answer-review.js +2 -0
- package/dist/types/run/answer-review.js.map +1 -0
- package/dist/types/run/config.d.ts +33 -0
- package/dist/types/run/config.d.ts.map +1 -1
- package/dist/types/run/derive-status.d.ts +29 -0
- package/dist/types/run/derive-status.d.ts.map +1 -0
- package/dist/types/run/derive-status.js +49 -0
- package/dist/types/run/derive-status.js.map +1 -0
- package/dist/types/run/entity.d.ts +16 -0
- package/dist/types/run/entity.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +228 -4
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js +7 -0
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/index.d.ts +5 -0
- package/dist/types/run/index.d.ts.map +1 -1
- package/dist/types/run/index.js +3 -0
- package/dist/types/run/index.js.map +1 -1
- package/dist/types/run/memory-promotion.d.ts +90 -0
- package/dist/types/run/memory-promotion.d.ts.map +1 -0
- package/dist/types/run/memory-promotion.js +38 -0
- package/dist/types/run/memory-promotion.js.map +1 -0
- package/dist/types/run/prepare-step.d.ts +100 -0
- package/dist/types/run/prepare-step.d.ts.map +1 -0
- package/dist/types/run/prepare-step.js +2 -0
- package/dist/types/run/prepare-step.js.map +1 -0
- package/dist/types/run/state.d.ts +85 -0
- package/dist/types/run/state.d.ts.map +1 -0
- package/dist/types/run/state.js +33 -0
- package/dist/types/run/state.js.map +1 -0
- package/dist/types/run/step.d.ts +77 -0
- package/dist/types/run/step.d.ts.map +1 -0
- package/dist/types/run/step.js +26 -0
- package/dist/types/run/step.js.map +1 -0
- package/dist/types/run/stop-reason.d.ts +31 -3
- package/dist/types/run/stop-reason.d.ts.map +1 -1
- package/dist/types/sandbox/index.d.ts +82 -10
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js +13 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/structured-output/index.d.ts +6 -5
- package/dist/types/structured-output/index.d.ts.map +1 -1
- package/dist/types/thread/entity.d.ts +2 -3
- package/dist/types/thread/entity.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +193 -1
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/repair.d.ts +49 -0
- package/dist/types/tool/repair.d.ts.map +1 -0
- package/dist/types/tool/repair.js +2 -0
- package/dist/types/tool/repair.js.map +1 -0
- package/dist/types/toolset/index.d.ts +2 -5
- package/dist/types/toolset/index.d.ts.map +1 -1
- package/dist/utils/__tests__/atomic-write.test.d.ts +2 -0
- package/dist/utils/__tests__/atomic-write.test.d.ts.map +1 -0
- package/dist/utils/__tests__/atomic-write.test.js +91 -0
- package/dist/utils/__tests__/atomic-write.test.js.map +1 -0
- package/dist/utils/__tests__/shell-compress.test.d.ts +2 -0
- package/dist/utils/__tests__/shell-compress.test.d.ts.map +1 -0
- package/dist/utils/__tests__/shell-compress.test.js +41 -0
- package/dist/utils/__tests__/shell-compress.test.js.map +1 -0
- package/dist/utils/atomic-write.d.ts +10 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/atomic-write.js +83 -0
- package/dist/utils/atomic-write.js.map +1 -0
- package/dist/utils/shell-compress.d.ts.map +1 -1
- package/dist/utils/shell-compress.js +12 -1
- package/dist/utils/shell-compress.js.map +1 -1
- package/dist/verification/presets.d.ts +6 -3
- package/dist/verification/presets.d.ts.map +1 -1
- package/dist/verification/presets.js +6 -3
- package/dist/verification/presets.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/default-path-conformance.test.ts +306 -0
- package/src/__tests__/shipped-defaults.test.ts +111 -0
- package/src/advisory/__tests__/budget-enforcement.test.ts +208 -0
- package/src/advisory/__tests__/structured-response.test.ts +128 -0
- package/src/advisory/budget.ts +27 -0
- package/src/advisory/context.ts +19 -0
- package/src/advisory/executor.test.ts +12 -8
- package/src/advisory/executor.ts +37 -25
- package/src/advisory/index.ts +2 -0
- package/src/advisory/parse.ts +63 -0
- package/src/agents/AbstractAgent.ts +82 -0
- package/src/agents/PipelineAgent.ts +19 -0
- package/src/agents/ReactiveAgent.ts +47 -0
- package/src/agents/RouterAgent.ts +32 -2
- package/src/agents/SupervisorAgent.ts +31 -1
- package/src/agents/__tests__/idempotency-key.test.ts +177 -0
- package/src/agents/__tests__/invocation-lock.test.ts +154 -0
- package/src/agents/__tests__/reachability.test.ts +224 -0
- package/src/agents/__tests__/supervisor-ledger.test.ts +1 -1
- package/src/agents/index.ts +1 -1
- package/src/agents/lock.ts +0 -2
- package/src/bridge/a2a/late-events.test.ts +84 -0
- package/src/bridge/a2a/mapper.test.ts +1 -1
- package/src/bridge/a2a/mapper.ts +70 -5
- package/src/bridge/a2a/message.ts +5 -1
- package/src/bridge/sse/late-events.test.ts +182 -0
- package/src/bridge/sse/mapper.ts +109 -0
- package/src/compaction/__tests__/cleared-result-recovery.test.ts +118 -0
- package/src/compaction/__tests__/context-window.test.ts +77 -0
- package/src/compaction/__tests__/dangling.test.ts +16 -6
- package/src/compaction/__tests__/lossiness.test.ts +187 -0
- package/src/compaction/__tests__/state-across-resume.test.ts +99 -0
- package/src/compaction/__tests__/tool-result-editing.test.ts +213 -0
- package/src/compaction/__tests__/trim-opens-on-user.test.ts +118 -0
- package/src/compaction/__tests__/verifier-model.test.ts +83 -0
- package/src/compaction/context-window.ts +107 -0
- package/src/compaction/dangling.ts +48 -1
- package/src/compaction/extractor.ts +56 -1
- package/src/compaction/index.ts +16 -0
- package/src/compaction/manager.ts +53 -8
- package/src/compaction/managers/structured.ts +7 -6
- package/src/compaction/retention.ts +89 -0
- package/src/compaction/serializer.ts +42 -11
- package/src/compaction/tool-result-editing.ts +229 -0
- package/src/compaction/types.ts +10 -0
- package/src/compaction/verifier.ts +24 -1
- package/src/compaction/wire.ts +91 -0
- package/src/config/runtime.ts +63 -19
- package/src/connector/builtins/http.test.ts +13 -0
- package/src/connector/builtins/http.ts +15 -1
- package/src/connector/mcp/__tests__/discovery-policy.test.ts +133 -0
- package/src/connector/mcp/__tests__/list-pagination.test.ts +98 -0
- package/src/connector/mcp/__tests__/policy.test.ts +100 -0
- package/src/connector/mcp/__tests__/protocol-negotiation.test.ts +105 -0
- package/src/connector/mcp/__tests__/schema-fidelity.test.ts +250 -0
- package/src/connector/mcp/__tests__/structured-result.test.ts +143 -0
- package/src/connector/mcp/adapter.ts +306 -19
- package/src/connector/mcp/client.test.ts +159 -0
- package/src/connector/mcp/client.ts +160 -13
- package/src/connector/mcp/discovery.ts +74 -5
- package/src/connector/mcp/http-sse.ts +16 -1
- package/src/connector/mcp/index.ts +4 -0
- package/src/connector/mcp/policy.ts +134 -0
- package/src/connector/mcp/schema-refs.ts +126 -0
- package/src/constants/agent/index.ts +3 -0
- package/src/constants/compaction/index.ts +1 -1
- package/src/constants/continuation.ts +4 -4
- package/src/constants/mcp/index.ts +34 -0
- package/src/constants/plugin/index.ts +24 -2
- package/src/constants/sandbox/index.ts +6 -5
- package/src/constants/telemetry/index.ts +8 -0
- package/src/constants/tools/index.ts +20 -0
- package/src/contracts/api.ts +40 -0
- package/src/contracts/run-status.ts +43 -0
- package/src/eval/__tests__/case-deadline.test.ts +147 -0
- package/src/eval/__tests__/end-to-end.test.ts +259 -0
- package/src/eval/__tests__/harness-honesty.test.ts +99 -0
- package/src/eval/__tests__/harness.test.ts +249 -0
- package/src/eval/__tests__/judge.test.ts +306 -0
- package/src/eval/__tests__/scorer-gates.test.ts +156 -0
- package/src/eval/experiment.ts +335 -0
- package/src/eval/from-run.ts +48 -0
- package/src/eval/index.ts +21 -0
- package/src/eval/judge.ts +240 -0
- package/src/eval/scorers.ts +169 -0
- package/src/eval/types.ts +157 -0
- package/src/execution/local.test.ts +46 -0
- package/src/execution/local.ts +6 -1
- package/src/gateway/__tests__/list-survives-eviction.test.ts +124 -0
- package/src/gateway/local.ts +117 -3
- package/src/manager/agent/__tests__/dispose-cancels.test.ts +104 -0
- package/src/manager/agent/__tests__/lifecycle.test.ts +297 -0
- package/src/manager/agent/lifecycle.ts +127 -7
- package/src/manager/run/persistence.ts +132 -1
- package/src/plugin/__tests__/enable-contributions.test.ts +3 -3
- package/src/plugin/__tests__/hook-ordering.test.ts +252 -0
- package/src/plugin/__tests__/install-time-refusal.test.ts +68 -0
- package/src/plugin/__tests__/lifecycle.test.ts +95 -73
- package/src/plugin/lifecycle.ts +76 -22
- package/src/plugin/loader.ts +37 -1
- package/src/probe/registry.test.ts +49 -6
- package/src/probe/registry.ts +21 -1
- package/src/provider/__tests__/mock-script.test.ts +179 -0
- package/src/provider/__tests__/registry.test.ts +1 -1
- package/src/provider/__tests__/retry-visibility.test.ts +160 -0
- package/src/provider/__tests__/retry.test.ts +296 -0
- package/src/provider/capabilities.ts +4 -0
- package/src/provider/collect.test.ts +1 -1
- package/src/provider/collect.ts +1 -1
- package/src/provider/index.ts +8 -0
- package/src/provider/mock-register.ts +5 -2
- package/src/provider/mock.ts +117 -34
- package/src/provider/retry.ts +199 -0
- package/src/public-runtime.ts +111 -7
- package/src/public-types.ts +5 -1
- package/src/rag/__tests__/retrieval-math.test.ts +54 -0
- package/src/rag/chunking.ts +32 -1
- package/src/rag/embedding.test.ts +65 -10
- package/src/rag/embedding.ts +26 -5
- package/src/rag/index.ts +1 -1
- package/src/rag/retriever.ts +92 -21
- package/src/rag/vector-store.test.ts +2 -2
- package/src/registry/ManagedRegistry.test.ts +1 -1
- package/src/registry/Registry.test.ts +1 -1
- package/src/registry/connector/definitions.test.ts +1 -1
- package/src/registry/tool/__tests__/schema.test.ts +208 -0
- package/src/registry/tool/__tests__/tool-name-validation.test.ts +88 -0
- package/src/registry/tool/execute.ts +104 -22
- package/src/registry/tool/schema.ts +80 -0
- package/src/registry/toolset/catalog.test.ts +0 -1
- package/src/registry/toolset/catalog.ts +0 -1
- package/src/run/reporter.ts +84 -0
- package/src/runtime/bidi/__tests__/session.test.ts +232 -0
- package/src/runtime/bidi/index.ts +4 -0
- package/src/runtime/bidi/mock.ts +90 -0
- package/src/runtime/bidi/session.ts +205 -0
- package/src/runtime/decision/parser.test.ts +46 -0
- package/src/runtime/decision/parser.ts +8 -1
- package/src/runtime/query/__tests__/answer-review.test.ts +172 -0
- package/src/runtime/query/__tests__/capability-negotiation.test.ts +25 -129
- package/src/runtime/query/__tests__/checkpoint-store.test.ts +13 -50
- package/src/runtime/query/__tests__/checkpoint.test.ts +2 -10
- package/src/runtime/query/__tests__/citations.test.ts +111 -0
- package/src/runtime/query/__tests__/content-budget.test.ts +83 -0
- package/src/runtime/query/__tests__/context.test.ts +3 -2
- package/src/runtime/query/__tests__/deferred-tools.test.ts +23 -148
- package/src/runtime/query/__tests__/delegation-resume.test.ts +159 -0
- package/src/runtime/query/__tests__/document-attachments.test.ts +125 -0
- package/src/runtime/query/__tests__/durable-park-and-trace.test.ts +245 -0
- package/src/runtime/query/__tests__/durable-question-park.test.ts +305 -0
- package/src/runtime/query/__tests__/durable-run-state.test.ts +194 -0
- package/src/runtime/query/__tests__/executor-plugin-hooks.test.ts +24 -20
- package/src/runtime/query/__tests__/finish-reason-vs-tool-calls.test.ts +206 -0
- package/src/runtime/query/__tests__/grant-cannot-overrule-the-gate.test.ts +115 -0
- package/src/runtime/query/__tests__/guardrails-e2e.test.ts +164 -0
- package/src/runtime/query/__tests__/guardrails.test.ts +236 -0
- package/src/runtime/query/__tests__/hook-model-visibility.test.ts +143 -0
- package/src/runtime/query/__tests__/long-document-flow.test.ts +9 -2
- package/src/runtime/query/__tests__/memory-promotion.test.ts +148 -0
- package/src/runtime/query/__tests__/orphan-task-turn-end.test.ts +5 -31
- package/src/runtime/query/__tests__/overflow-relief.test.ts +139 -0
- package/src/runtime/query/__tests__/partial-batch-resume.test.ts +264 -0
- package/src/runtime/query/__tests__/plugin-hooks.test.ts +0 -1
- package/src/runtime/query/__tests__/prepare-step-chain.test.ts +127 -0
- package/src/runtime/query/__tests__/prepare-step.test.ts +233 -0
- package/src/runtime/query/__tests__/probe-veto-is-error.test.ts +145 -0
- package/src/runtime/query/__tests__/prompt.test.ts +1 -1
- package/src/runtime/query/__tests__/provider-fault-pauses.test.ts +104 -0
- package/src/runtime/query/__tests__/reasoning-stream.test.ts +177 -0
- package/src/runtime/query/__tests__/recoverable-settle.test.ts +145 -0
- package/src/runtime/query/__tests__/resume-budget.test.ts +158 -0
- package/src/runtime/query/__tests__/resume-pending.test.ts +273 -0
- package/src/runtime/query/__tests__/rich-content-budget-wiring.test.ts +109 -0
- package/src/runtime/query/__tests__/stop-condition.test.ts +265 -0
- package/src/runtime/query/__tests__/structured-output.test.ts +268 -0
- package/src/runtime/query/__tests__/structured-run-failure.test.ts +144 -0
- package/src/runtime/query/__tests__/terminal-tool.test.ts +148 -0
- package/src/runtime/query/__tests__/tool-grants.test.ts +102 -0
- package/src/runtime/query/__tests__/tool-output-budget.test.ts +0 -0
- package/src/runtime/query/__tests__/tool-pause.test.ts +209 -0
- package/src/runtime/query/__tests__/tool-progress.test.ts +154 -0
- package/src/runtime/query/__tests__/tool-repair-retry.test.ts +255 -0
- package/src/runtime/query/__tests__/tool-result-wire.test.ts +135 -0
- package/src/runtime/query/__tests__/tool-timeout.test.ts +230 -0
- package/src/runtime/query/__tests__/trace-parenting.test.ts +128 -0
- package/src/runtime/query/__tests__/wiring-seams.test.ts +288 -0
- package/src/runtime/query/checkpoint.ts +242 -10
- package/src/runtime/query/events.ts +2 -2
- package/src/runtime/query/executor.ts +847 -39
- package/src/runtime/query/guard.ts +26 -1
- package/src/runtime/query/guardrail-presets.ts +124 -0
- package/src/runtime/query/guardrails.ts +144 -0
- package/src/runtime/query/index.ts +759 -12
- package/src/runtime/query/iteration/__tests__/cancel-settles-turn.test.ts +177 -0
- package/src/runtime/query/iteration/index.ts +656 -40
- package/src/runtime/query/iteration/phases/advisory.test.ts +4 -1
- package/src/runtime/query/iteration/phases/advisory.ts +14 -2
- package/src/runtime/query/iteration/phases/checkpoint.ts +2 -2
- package/src/runtime/query/iteration/phases/compaction-safe-cut.test.ts +3 -1
- package/src/runtime/query/iteration/phases/compaction.ts +329 -64
- package/src/runtime/query/iteration/phases/context-measurement.test.ts +196 -0
- package/src/runtime/query/iteration/phases/context.ts +155 -2
- package/src/runtime/query/iteration/phases/hitl-answer-question.test.ts +3 -1
- package/src/runtime/query/iteration/phases/overflow-escalation.test.ts +167 -0
- package/src/runtime/query/iteration/phases/plan.ts +10 -2
- package/src/runtime/query/iteration/phases/retained-messages.test.ts +226 -0
- package/src/runtime/query/iteration/phases/tool-review-denials.test.ts +270 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +140 -51
- package/src/runtime/query/iteration/phases/working-memory-compaction.test.ts +21 -9
- package/src/runtime/query/iteration/stream-turn.ts +285 -15
- package/src/runtime/query/plugin-hooks.ts +6 -2
- package/src/runtime/query/prompt.ts +26 -1
- package/src/runtime/query/question-park.ts +120 -0
- package/src/runtime/query/result.ts +64 -0
- package/src/runtime/query/resume-pending.ts +394 -0
- package/src/runtime/query/run-state.ts +124 -0
- package/src/runtime/query/tool-grants.ts +83 -0
- package/src/runtime/query/tool-output-budget.ts +183 -0
- package/src/runtime/query/tool-pause.ts +119 -0
- package/src/runtime/query/tooling.ts +23 -1
- package/src/sandbox/__tests__/isolation.test.ts +164 -0
- package/src/sandbox/__tests__/output-truncation.test.ts +106 -0
- package/src/sandbox/__tests__/resource-limits.test.ts +106 -0
- package/src/sandbox/factory.ts +1 -1
- package/src/sandbox/index.ts +2 -0
- package/src/sandbox/isolation.ts +72 -0
- package/src/sandbox/provider/local.ts +173 -74
- package/src/session/__tests__/integration/spawn-rollback.test.ts +1 -1
- package/src/session/handoff/broadcast.ts +3 -3
- package/src/session/migration/__tests__/filesystem.test.ts +26 -19
- package/src/session/migration/filesystem.ts +7 -12
- package/src/session/migration/marker.ts +5 -9
- package/src/session/retention/disk-backend.ts +5 -11
- package/src/session/workspace/__tests__/git-worktree.test.ts +6 -2
- package/src/session/workspace/__tests__/shared-run.test.ts +18 -0
- package/src/session/workspace/shared-run.ts +7 -1
- package/src/skills/__tests__/frontmatter.test.ts +135 -0
- package/src/skills/loader.ts +47 -3
- package/src/store/__tests__/checkpoint-integrity.test.ts +134 -0
- package/src/store/__tests__/checkpoint-versioning.test.ts +194 -0
- package/src/store/__tests__/schema-adoption.test.ts +118 -0
- package/src/store/__tests__/schema.test.ts +119 -0
- package/src/store/memory/disk.ts +17 -16
- package/src/store/run/disk.ts +169 -22
- package/src/store/schema.ts +135 -0
- package/src/store/session/disk.ts +30 -21
- package/src/store/task/__tests__/lookup-across-runs.test.ts +77 -0
- package/src/store/task/disk.ts +59 -15
- package/src/store/thread/disk.ts +21 -10
- package/src/streaming/coalesce.ts +1 -1
- package/src/telemetry/__tests__/latency-instruments.test.ts +120 -0
- package/src/telemetry/__tests__/metrics.test.ts +160 -0
- package/src/telemetry/__tests__/span-hierarchy.test.ts +94 -0
- package/src/telemetry/attributes.ts +109 -0
- package/src/telemetry/metrics.ts +190 -0
- package/src/test-setup.ts +3 -3
- package/src/test-support/paths.ts +17 -0
- package/src/tools/__tests__/path-containment.test.ts +167 -0
- package/src/tools/__tests__/posix-path.test.ts +83 -0
- package/src/tools/__tests__/sandboxed-search.test.ts +140 -0
- package/src/tools/builtins/__tests__/computer-use.test.ts +15 -2
- package/src/tools/builtins/__tests__/edit.test.ts +10 -270
- package/src/tools/builtins/__tests__/payload-budget.test.ts +20 -40
- package/src/tools/builtins/__tests__/read-file.test.ts +29 -1
- package/src/tools/builtins/__tests__/write-file.test.ts +13 -52
- package/src/tools/builtins/bash.ts +34 -4
- package/src/tools/builtins/computer-use.ts +7 -1
- package/src/tools/builtins/edit.ts +162 -116
- package/src/tools/builtins/glob.ts +71 -6
- package/src/tools/builtins/grep.ts +82 -8
- package/src/tools/builtins/index.ts +6 -6
- package/src/tools/builtins/ls.ts +4 -2
- package/src/tools/builtins/read-file.ts +40 -4
- package/src/tools/builtins/write-file.ts +44 -68
- package/src/tools/coordinator/__tests__/agent.test.ts +2 -2
- package/src/tools/coordinator/agent.ts +23 -10
- package/src/tools/coordinator/index.ts +111 -31
- package/src/tools/defineTool.ts +20 -0
- package/src/tools/glob-match.ts +50 -0
- package/src/tools/paths.ts +44 -0
- package/src/tools/posix-path.ts +73 -0
- package/src/types/advisory/config.ts +21 -3
- package/src/types/advisory/result.ts +12 -7
- package/src/types/agent/base.ts +22 -2
- package/src/types/agent/factory.ts +15 -9
- package/src/types/agent/gateway.ts +20 -0
- package/src/types/agent/manager.ts +19 -0
- package/src/types/agent/reactive.ts +50 -0
- package/src/types/agent/router.ts +11 -0
- package/src/types/agent/supervisor.ts +2 -2
- package/src/types/agent/task.ts +26 -0
- package/src/types/bidi/index.ts +119 -0
- package/src/types/common/__tests__/numeric-correctness.test.ts +123 -0
- package/src/types/common/index.ts +16 -4
- package/src/types/computer-use/index.ts +1 -1
- package/src/types/connector/mcp.ts +29 -0
- package/src/types/errors/__tests__/catalog.test.ts +130 -0
- package/src/types/errors/__tests__/errors.test.ts +118 -0
- package/src/types/errors/catalog.ts +211 -0
- package/src/types/errors/index.ts +121 -0
- package/src/types/guardrail/index.ts +62 -0
- package/src/types/hitl/index.ts +102 -20
- package/src/types/ids/index.ts +2 -2
- package/src/types/message/content.ts +50 -0
- package/src/types/message/index.ts +210 -9
- package/src/types/plugin/index.ts +82 -2
- package/src/types/provider/__tests__/cause-chain.test.ts +132 -0
- package/src/types/provider/__tests__/declared-retryable.test.ts +85 -0
- package/src/types/provider/__tests__/overflow-classification.test.ts +113 -0
- package/src/types/provider/chat.ts +29 -1
- package/src/types/provider/config.ts +83 -2
- package/src/types/provider/errors.ts +472 -0
- package/src/types/provider/index.ts +5 -0
- package/src/types/provider/stream.ts +63 -3
- package/src/types/rag/embedding.ts +11 -2
- package/src/types/run/__tests__/step.test.ts +123 -0
- package/src/types/run/answer-review.ts +51 -0
- package/src/types/run/config.ts +35 -0
- package/src/types/run/derive-status.ts +62 -0
- package/src/types/run/entity.ts +18 -0
- package/src/types/run/events.ts +230 -3
- package/src/types/run/index.ts +5 -0
- package/src/types/run/memory-promotion.ts +112 -0
- package/src/types/run/prepare-step.ts +109 -0
- package/src/types/run/state.ts +111 -0
- package/src/types/run/step.ts +95 -0
- package/src/types/run/stop-reason.ts +29 -1
- package/src/types/sandbox/index.ts +93 -12
- package/src/types/structured-output/index.ts +6 -5
- package/src/types/thread/entity.ts +2 -3
- package/src/types/tool/index.ts +204 -1
- package/src/types/tool/repair.ts +54 -0
- package/src/types/toolset/index.ts +2 -6
- package/src/utils/__tests__/atomic-write.test.ts +108 -0
- package/src/utils/__tests__/shell-compress.test.ts +49 -0
- package/src/utils/atomic-write.ts +85 -0
- package/src/utils/shell-compress.ts +12 -1
- package/src/verification/presets.ts +6 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync } from 'node:fs'
|
|
2
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
3
|
+
import { tmpdir } from 'node:os'
|
|
4
|
+
import { join } from 'node:path'
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
|
+
|
|
7
|
+
import type { ProjectId, SessionId, TenantId, ThreadId, UserId } from '../../types/ids/index.js'
|
|
8
|
+
import { createUserMessage } from '../../types/message/index.js'
|
|
9
|
+
import type { ActorRef } from '../../types/session/actor.js'
|
|
10
|
+
import { DiskSessionStore } from '../session/disk.js'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The primitive is unit-tested next door. What matters here is that a store
|
|
14
|
+
* actually goes through it — a version that is stamped but never checked,
|
|
15
|
+
* or checked but never stamped, is the same silent read it replaces.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const TENANT = 'tnt_schema' as TenantId
|
|
19
|
+
const THREAD = 'thd_schema' as ThreadId
|
|
20
|
+
|
|
21
|
+
const actor = (): ActorRef => ({ kind: 'user', userId: 'usr_a' as UserId, tenantId: TENANT })
|
|
22
|
+
|
|
23
|
+
let rootDir: string
|
|
24
|
+
let store: DiskSessionStore
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
rootDir = mkdtempSync(join(tmpdir(), 'namzu-schema-'))
|
|
28
|
+
store = new DiskSessionStore({ rootDir })
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
rmSync(rootDir, { recursive: true, force: true })
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
async function seed(): Promise<{ projectId: ProjectId; sessionId: SessionId }> {
|
|
36
|
+
const project = await store.createProject({ tenantId: TENANT, name: 'p' }, TENANT)
|
|
37
|
+
const session = await store.createSession(
|
|
38
|
+
{ threadId: THREAD, projectId: project.id, currentActor: actor() },
|
|
39
|
+
TENANT,
|
|
40
|
+
)
|
|
41
|
+
return { projectId: project.id, sessionId: session.id }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const sessionPath = (projectId: ProjectId, sessionId: SessionId) =>
|
|
45
|
+
join(rootDir, 'projects', projectId, 'sessions', sessionId, 'session.json')
|
|
46
|
+
|
|
47
|
+
describe('what lands on disk', () => {
|
|
48
|
+
it('stamps a session record', async () => {
|
|
49
|
+
const { projectId, sessionId } = await seed()
|
|
50
|
+
const raw = JSON.parse(await readFile(sessionPath(projectId, sessionId), 'utf-8'))
|
|
51
|
+
expect(raw.schemaVersion).toBe(1)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('stamps every line of the append-only message log', async () => {
|
|
55
|
+
const { projectId, sessionId } = await seed()
|
|
56
|
+
await store.appendMessage(sessionId, createUserMessage('one'), TENANT)
|
|
57
|
+
await store.appendMessage(sessionId, createUserMessage('two'), TENANT)
|
|
58
|
+
|
|
59
|
+
const log = await readFile(
|
|
60
|
+
join(rootDir, 'projects', projectId, 'sessions', sessionId, 'messages.jsonl'),
|
|
61
|
+
'utf-8',
|
|
62
|
+
)
|
|
63
|
+
const lines = log.split('\n').filter((l) => l.length > 0)
|
|
64
|
+
expect(lines).toHaveLength(2)
|
|
65
|
+
// An append-only log is written by many builds over its lifetime, so
|
|
66
|
+
// its lines can legitimately differ in version — each carries its own.
|
|
67
|
+
for (const line of lines) expect(JSON.parse(line).schemaVersion).toBe(1)
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
describe('what comes back off disk', () => {
|
|
72
|
+
it('reads a legacy record that predates the stamp', async () => {
|
|
73
|
+
const { projectId, sessionId } = await seed()
|
|
74
|
+
const path = sessionPath(projectId, sessionId)
|
|
75
|
+
const record = JSON.parse(await readFile(path, 'utf-8'))
|
|
76
|
+
record.schemaVersion = undefined
|
|
77
|
+
await writeFile(path, JSON.stringify(record), 'utf-8')
|
|
78
|
+
|
|
79
|
+
// Every file written before this mechanism existed looks exactly
|
|
80
|
+
// like this, and has to keep opening.
|
|
81
|
+
expect(await store.getSession(sessionId, TENANT)).not.toBeNull()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('refuses a record from a build that knew more than this one', async () => {
|
|
85
|
+
const { projectId, sessionId } = await seed()
|
|
86
|
+
const path = sessionPath(projectId, sessionId)
|
|
87
|
+
const record = JSON.parse(await readFile(path, 'utf-8'))
|
|
88
|
+
record.schemaVersion = 99
|
|
89
|
+
record.somethingThisBuildDoesNotKnow = { important: true }
|
|
90
|
+
await writeFile(path, JSON.stringify(record), 'utf-8')
|
|
91
|
+
|
|
92
|
+
// Reading it would drop the unknown field, and the next write would
|
|
93
|
+
// destroy it. A refusal is recoverable by upgrading.
|
|
94
|
+
await expect(store.getSession(sessionId, TENANT)).rejects.toThrow(/schema version 99/)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it('refuses a message line from the future rather than skipping it', async () => {
|
|
98
|
+
const { projectId, sessionId } = await seed()
|
|
99
|
+
await store.appendMessage(sessionId, createUserMessage('fine'), TENANT)
|
|
100
|
+
|
|
101
|
+
const path = join(rootDir, 'projects', projectId, 'sessions', sessionId, 'messages.jsonl')
|
|
102
|
+
const line = JSON.parse((await readFile(path, 'utf-8')).trim())
|
|
103
|
+
await writeFile(path, `${JSON.stringify({ ...line, schemaVersion: 42 })}\n`, 'utf-8')
|
|
104
|
+
|
|
105
|
+
// Silently dropping a message the build cannot read would hand the
|
|
106
|
+
// model a conversation with a hole in it.
|
|
107
|
+
await expect(store.loadMessages(sessionId, TENANT)).rejects.toThrow(/schema version 42/)
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('still round-trips a normal write and read', async () => {
|
|
111
|
+
const { sessionId } = await seed()
|
|
112
|
+
await store.appendMessage(sessionId, createUserMessage('hello'), TENANT)
|
|
113
|
+
await store.appendMessage(sessionId, createUserMessage('world'), TENANT)
|
|
114
|
+
|
|
115
|
+
const loaded = await store.loadMessages(sessionId, TENANT)
|
|
116
|
+
expect(loaded.map((m) => m.content)).toEqual(['hello', 'world'])
|
|
117
|
+
})
|
|
118
|
+
})
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
INITIAL_SCHEMA_VERSION,
|
|
5
|
+
SchemaVersionError,
|
|
6
|
+
defineSchema,
|
|
7
|
+
migrate,
|
|
8
|
+
stamp,
|
|
9
|
+
} from '../schema.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Every persisted read was `JSON.parse(raw) as T`. A record from an older
|
|
13
|
+
* build arrived with fields missing and nothing said so; a record from a
|
|
14
|
+
* NEWER build was read partially and, once written back, permanently lost
|
|
15
|
+
* whatever this build did not understand.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const V1 = defineSchema({ kind: 'thing', current: 1, migrations: {} })
|
|
19
|
+
|
|
20
|
+
const V3 = defineSchema({
|
|
21
|
+
kind: 'thing',
|
|
22
|
+
current: 3,
|
|
23
|
+
migrations: {
|
|
24
|
+
1: (r) => ({ ...r, addedInV2: true }),
|
|
25
|
+
2: (r) => ({ ...r, addedInV3: true }),
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe('reading an older record', () => {
|
|
30
|
+
it('treats an unstamped record as the first version', () => {
|
|
31
|
+
// Every file written before this mechanism existed IS version 1 —
|
|
32
|
+
// by definition, not by assumption.
|
|
33
|
+
const migrated = migrate<Record<string, unknown>>(V3, { name: 'legacy' })
|
|
34
|
+
expect(migrated.addedInV2).toBe(true)
|
|
35
|
+
expect(migrated.addedInV3).toBe(true)
|
|
36
|
+
expect(migrated.schemaVersion).toBe(3)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('runs only the steps that are missing', () => {
|
|
40
|
+
const migrated = migrate<Record<string, unknown>>(V3, { schemaVersion: 2, name: 'x' })
|
|
41
|
+
expect(migrated.addedInV2).toBeUndefined()
|
|
42
|
+
expect(migrated.addedInV3).toBe(true)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('leaves a current record alone apart from the stamp', () => {
|
|
46
|
+
const migrated = migrate<Record<string, unknown>>(V3, { schemaVersion: 3, name: 'x' })
|
|
47
|
+
expect(migrated).toEqual({ schemaVersion: 3, name: 'x' })
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
describe('reading a newer record', () => {
|
|
52
|
+
it('refuses rather than reading it partially', () => {
|
|
53
|
+
expect(() => migrate(V1, { schemaVersion: 2, name: 'from the future' })).toThrow(
|
|
54
|
+
SchemaVersionError,
|
|
55
|
+
)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('says what it found and what it understands', () => {
|
|
59
|
+
try {
|
|
60
|
+
migrate(V1, { schemaVersion: 7 })
|
|
61
|
+
expect.unreachable()
|
|
62
|
+
} catch (err) {
|
|
63
|
+
const e = err as SchemaVersionError
|
|
64
|
+
expect(e.found).toBe(7)
|
|
65
|
+
expect(e.supported).toBe(1)
|
|
66
|
+
// A refusal is recoverable by upgrading. A partial read that
|
|
67
|
+
// gets written back is not.
|
|
68
|
+
expect(e.message).toContain('Upgrade')
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
describe('declaring a schema', () => {
|
|
74
|
+
it('rejects a gap in the migration chain at declaration time', () => {
|
|
75
|
+
// Discovered here, not in production by a user whose session will
|
|
76
|
+
// not open.
|
|
77
|
+
expect(() => defineSchema({ kind: 'gappy', current: 3, migrations: { 1: (r) => r } })).toThrow(
|
|
78
|
+
/no migration from version 2 to 3/,
|
|
79
|
+
)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('rejects a version below the first one', () => {
|
|
83
|
+
expect(() => defineSchema({ kind: 'x', current: 0, migrations: {} })).toThrow(/integer >= 1/)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('accepts a schema that has never migrated', () => {
|
|
87
|
+
expect(() =>
|
|
88
|
+
defineSchema({ kind: 'x', current: INITIAL_SCHEMA_VERSION, migrations: {} }),
|
|
89
|
+
).not.toThrow()
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
describe('stamping', () => {
|
|
94
|
+
it('marks a record with the version this build writes', () => {
|
|
95
|
+
expect(stamp(V3, { a: 1 })).toEqual({ a: 1, schemaVersion: 3 })
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('leaves an array untouched', () => {
|
|
99
|
+
// There is nowhere on an array to put a field that survives
|
|
100
|
+
// `JSON.stringify`, and wrapping it would change every file already
|
|
101
|
+
// written.
|
|
102
|
+
const list = [{ a: 1 }, { a: 2 }]
|
|
103
|
+
expect(stamp(V3, list)).toEqual(list)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('round-trips through JSON', () => {
|
|
107
|
+
const written = JSON.stringify(stamp(V1, { name: 'x' }))
|
|
108
|
+
expect(migrate<Record<string, unknown>>(V1, JSON.parse(written))).toEqual({
|
|
109
|
+
name: 'x',
|
|
110
|
+
schemaVersion: 1,
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('passes a non-object through both ways', () => {
|
|
115
|
+
expect(stamp(V3, null)).toBeNull()
|
|
116
|
+
expect(migrate(V3, null)).toBeNull()
|
|
117
|
+
expect(migrate(V3, [1, 2])).toEqual([1, 2])
|
|
118
|
+
})
|
|
119
|
+
})
|
package/src/store/memory/disk.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, readFile,
|
|
1
|
+
import { mkdir, readFile, unlink } from 'node:fs/promises'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
3
|
import type { MemoryId } from '../../types/ids/index.js'
|
|
4
4
|
import type {
|
|
@@ -9,10 +9,22 @@ import type {
|
|
|
9
9
|
MemorySearchResult,
|
|
10
10
|
MemoryStore,
|
|
11
11
|
} from '../../types/memory/index.js'
|
|
12
|
+
import { atomicWriteFile } from '../../utils/atomic-write.js'
|
|
12
13
|
import { generateMemoryId } from '../../utils/id.js'
|
|
13
14
|
import { type Logger, getRootLogger } from '../../utils/logger.js'
|
|
15
|
+
import { defineSchema, migrate, stamp } from '../schema.js'
|
|
14
16
|
import { InMemoryMemoryIndex } from './index.js'
|
|
15
17
|
|
|
18
|
+
/**
|
|
19
|
+
* This store's on-disk format, versioned as a unit — which is how a
|
|
20
|
+
* migration would actually be written and shipped, and it keeps every call
|
|
21
|
+
* site free of schema plumbing.
|
|
22
|
+
*
|
|
23
|
+
* Bump `current` and add the migration for the step you are leaving when
|
|
24
|
+
* the shape changes.
|
|
25
|
+
*/
|
|
26
|
+
const SCHEMA = defineSchema({ kind: 'memory-store', current: 1, migrations: {} })
|
|
27
|
+
|
|
16
28
|
export interface DiskMemoryStoreConfig {
|
|
17
29
|
baseDir: string
|
|
18
30
|
logger?: Logger
|
|
@@ -48,7 +60,7 @@ export class DiskMemoryStore implements MemoryStore {
|
|
|
48
60
|
|
|
49
61
|
try {
|
|
50
62
|
const raw = await readFile(this.indexPath, 'utf-8')
|
|
51
|
-
const entries = JSON.parse(raw)
|
|
63
|
+
const entries = migrate<MemoryIndexEntry[]>(SCHEMA, JSON.parse(raw))
|
|
52
64
|
this.index.rebuild(entries)
|
|
53
65
|
this.log.info('Memory index loaded', { count: entries.length })
|
|
54
66
|
} catch (err) {
|
|
@@ -105,7 +117,7 @@ export class DiskMemoryStore implements MemoryStore {
|
|
|
105
117
|
|
|
106
118
|
try {
|
|
107
119
|
const raw = await readFile(this.contentPath(id), 'utf-8')
|
|
108
|
-
return JSON.parse(raw)
|
|
120
|
+
return migrate<MemoryContent>(SCHEMA, JSON.parse(raw))
|
|
109
121
|
} catch {
|
|
110
122
|
this.log.warn('Failed to read memory content', { memoryId: id })
|
|
111
123
|
return undefined
|
|
@@ -141,7 +153,7 @@ export class DiskMemoryStore implements MemoryStore {
|
|
|
141
153
|
) {
|
|
142
154
|
try {
|
|
143
155
|
const raw = await readFile(this.contentPath(id), 'utf-8')
|
|
144
|
-
const existingContent = JSON.parse(raw)
|
|
156
|
+
const existingContent = migrate<MemoryContent>(SCHEMA, JSON.parse(raw))
|
|
145
157
|
|
|
146
158
|
const updatedContent: MemoryContent = {
|
|
147
159
|
...existingContent,
|
|
@@ -189,17 +201,6 @@ export class DiskMemoryStore implements MemoryStore {
|
|
|
189
201
|
}
|
|
190
202
|
}
|
|
191
203
|
|
|
192
|
-
async function atomicWriteFile(filePath: string, content: string): Promise<void> {
|
|
193
|
-
const tempPath = `${filePath}.tmp`
|
|
194
|
-
try {
|
|
195
|
-
await writeFile(tempPath, content, 'utf-8')
|
|
196
|
-
await rename(tempPath, filePath)
|
|
197
|
-
} catch (err) {
|
|
198
|
-
await unlink(tempPath).catch(() => undefined)
|
|
199
|
-
throw err
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
204
|
async function atomicWriteJson(filePath: string, value: unknown): Promise<void> {
|
|
204
|
-
await atomicWriteFile(filePath, JSON.stringify(value, null, 2))
|
|
205
|
+
await atomicWriteFile(filePath, JSON.stringify(stamp(SCHEMA, value), null, 2))
|
|
205
206
|
}
|
package/src/store/run/disk.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
|
-
import { appendFile, mkdir, readFile, readdir,
|
|
1
|
+
import { appendFile, mkdir, readFile, readdir, unlink } from 'node:fs/promises'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
3
|
import type { CheckpointId, IterationCheckpoint } from '../../types/hitl/index.js'
|
|
4
4
|
import type { Run, RunEvent, RunStoreConfig } from '../../types/run/index.js'
|
|
5
|
+
import { atomicWriteFile } from '../../utils/atomic-write.js'
|
|
5
6
|
import { type Logger, getRootLogger } from '../../utils/logger.js'
|
|
7
|
+
import { defineSchema, migrate, stamp } from '../schema.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This store's on-disk format, versioned as a unit — which is how a
|
|
11
|
+
* migration would actually be written and shipped, and it keeps every call
|
|
12
|
+
* site free of schema plumbing.
|
|
13
|
+
*
|
|
14
|
+
* Bump `current` and add the migration for the step you are leaving when
|
|
15
|
+
* the shape changes.
|
|
16
|
+
*/
|
|
17
|
+
const SCHEMA = defineSchema({ kind: 'run-store', current: 1, migrations: {} })
|
|
18
|
+
|
|
19
|
+
/** One finished tool call, recovered from the transcript. */
|
|
20
|
+
export interface CompletedToolRecord {
|
|
21
|
+
readonly toolUseId: string
|
|
22
|
+
readonly toolName: string
|
|
23
|
+
readonly result: string
|
|
24
|
+
readonly isError: boolean
|
|
25
|
+
}
|
|
6
26
|
|
|
7
27
|
export class RunDiskStore {
|
|
8
28
|
private baseDir: string
|
|
@@ -44,6 +64,63 @@ export class RunDiskStore {
|
|
|
44
64
|
await appendFile(join(dir, 'transcript.jsonl'), line, 'utf-8')
|
|
45
65
|
}
|
|
46
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Every tool call this run has already finished, keyed by `toolUseId`.
|
|
69
|
+
*
|
|
70
|
+
* A batch's results are pushed onto the history only once the WHOLE
|
|
71
|
+
* batch settles, so a hard kill part-way through loses every result
|
|
72
|
+
* that had already come back — and the resumed run re-executes those
|
|
73
|
+
* calls. For a `write_file` that is waste; for a payment or an email it
|
|
74
|
+
* is a second one.
|
|
75
|
+
*
|
|
76
|
+
* Nothing new has to be written to make that recoverable: the executor
|
|
77
|
+
* already awaits a `tool_completed` event per tool, inline, carrying the
|
|
78
|
+
* id, the name, the result and the error flag, and the transcript
|
|
79
|
+
* already persists it. The record was durable all along and simply
|
|
80
|
+
* never read back.
|
|
81
|
+
*/
|
|
82
|
+
async readCompletedTools(): Promise<Map<string, CompletedToolRecord>> {
|
|
83
|
+
const dir = this.requireInit()
|
|
84
|
+
const completed = new Map<string, CompletedToolRecord>()
|
|
85
|
+
|
|
86
|
+
let raw: string
|
|
87
|
+
try {
|
|
88
|
+
raw = await readFile(join(dir, 'transcript.jsonl'), 'utf-8')
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') return completed
|
|
91
|
+
throw error
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
for (const line of raw.split('\n')) {
|
|
95
|
+
if (line.length === 0) continue
|
|
96
|
+
let event: Record<string, unknown>
|
|
97
|
+
try {
|
|
98
|
+
event = JSON.parse(line) as Record<string, unknown>
|
|
99
|
+
} catch {
|
|
100
|
+
// A torn last line is the normal shape of a file that was
|
|
101
|
+
// being appended to when the process died — which is exactly
|
|
102
|
+
// the case this method exists for. Skip it; every whole line
|
|
103
|
+
// before it is still good.
|
|
104
|
+
continue
|
|
105
|
+
}
|
|
106
|
+
if (event.type !== 'tool_completed') continue
|
|
107
|
+
const toolUseId = event.toolUseId
|
|
108
|
+
const toolName = event.toolName
|
|
109
|
+
if (typeof toolUseId !== 'string' || typeof toolName !== 'string') continue
|
|
110
|
+
|
|
111
|
+
// Last write wins: a retried tool emits one event per attempt and
|
|
112
|
+
// the final one is what actually answered the call.
|
|
113
|
+
completed.set(toolUseId, {
|
|
114
|
+
toolUseId,
|
|
115
|
+
toolName,
|
|
116
|
+
result: typeof event.result === 'string' ? event.result : '',
|
|
117
|
+
isError: event.isError === true,
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return completed
|
|
122
|
+
}
|
|
123
|
+
|
|
47
124
|
async writeRunMeta(run: Run): Promise<void> {
|
|
48
125
|
const dir = this.requireInit()
|
|
49
126
|
|
|
@@ -87,14 +164,21 @@ export class RunDiskStore {
|
|
|
87
164
|
const dir = this.requireInit()
|
|
88
165
|
const cpDir = join(dir, 'checkpoints')
|
|
89
166
|
await mkdir(cpDir, { recursive: true })
|
|
90
|
-
|
|
167
|
+
// Stamped, not written bare. Unstamped is read as version 1 by
|
|
168
|
+
// definition, which is correct only while version 1 is the only
|
|
169
|
+
// version there has ever been — the moment a second one exists, an
|
|
170
|
+
// unstamped file written by the newer build is read by the older one
|
|
171
|
+
// as if it were the older shape, and the refusal that exists to
|
|
172
|
+
// prevent exactly that never fires. The stamp is what gives the
|
|
173
|
+
// migration chain something to hang on.
|
|
174
|
+
await atomicWriteJson(join(cpDir, `${checkpoint.id}.json`), stamp(SCHEMA, checkpoint))
|
|
91
175
|
}
|
|
92
176
|
|
|
93
177
|
async readCheckpoint(checkpointId: CheckpointId): Promise<IterationCheckpoint | null> {
|
|
94
178
|
const dir = this.requireInit()
|
|
95
179
|
try {
|
|
96
180
|
const content = await readFile(join(dir, 'checkpoints', `${checkpointId}.json`), 'utf-8')
|
|
97
|
-
return
|
|
181
|
+
return parseCheckpoint(content, `${checkpointId}.json`)
|
|
98
182
|
} catch (err) {
|
|
99
183
|
if (isFileNotFound(err)) return null
|
|
100
184
|
throw err
|
|
@@ -109,12 +193,20 @@ export class RunDiskStore {
|
|
|
109
193
|
const checkpoints: IterationCheckpoint[] = []
|
|
110
194
|
for (const file of files) {
|
|
111
195
|
if (!file.endsWith('.json')) continue
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
196
|
+
// An unreadable checkpoint used to be logged and skipped, so
|
|
197
|
+
// this returned a silently short list that four callers treat
|
|
198
|
+
// as complete. A missing NEWEST checkpoint quietly resumes
|
|
199
|
+
// from an older point and re-runs a whole iteration of tool
|
|
200
|
+
// calls; a missing PARKED one reports "not parked" and drops
|
|
201
|
+
// an approval a human already granted, because the file is
|
|
202
|
+
// the only durable record of a park. Pruning under-deletes
|
|
203
|
+
// too: a file the keep-count cannot see is immortal.
|
|
204
|
+
//
|
|
205
|
+
// The by-id read next door was already strict. Two read paths
|
|
206
|
+
// disagreeing about whether damage matters is how the lenient
|
|
207
|
+
// one gets trusted.
|
|
208
|
+
const content = await readFile(join(cpDir, file), 'utf-8')
|
|
209
|
+
checkpoints.push(parseCheckpoint(content, file))
|
|
118
210
|
}
|
|
119
211
|
return checkpoints.sort((a, b) => a.createdAt - b.createdAt)
|
|
120
212
|
} catch (err) {
|
|
@@ -144,7 +236,7 @@ export class RunDiskStore {
|
|
|
144
236
|
try {
|
|
145
237
|
const indexPath = join(baseDir, 'index.json')
|
|
146
238
|
const content = await readFile(indexPath, 'utf-8')
|
|
147
|
-
return JSON.parse(content)
|
|
239
|
+
return migrate(SCHEMA, JSON.parse(content))
|
|
148
240
|
} catch (err) {
|
|
149
241
|
if (isFileNotFound(err)) return []
|
|
150
242
|
throw err
|
|
@@ -168,7 +260,7 @@ export class RunDiskStore {
|
|
|
168
260
|
|
|
169
261
|
try {
|
|
170
262
|
const content = await readFile(indexPath, 'utf-8')
|
|
171
|
-
index = JSON.parse(content)
|
|
263
|
+
index = migrate(SCHEMA, JSON.parse(content))
|
|
172
264
|
} catch (err) {
|
|
173
265
|
if (!isFileNotFound(err)) throw err
|
|
174
266
|
}
|
|
@@ -199,19 +291,74 @@ export class RunDiskStore {
|
|
|
199
291
|
}
|
|
200
292
|
}
|
|
201
293
|
|
|
202
|
-
async function
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
await writeFile(tempPath, content, 'utf-8')
|
|
206
|
-
await rename(tempPath, filePath)
|
|
207
|
-
} catch (err) {
|
|
208
|
-
await unlink(tempPath).catch(() => undefined)
|
|
209
|
-
throw err
|
|
210
|
-
}
|
|
294
|
+
async function atomicWriteJson(filePath: string, value: unknown): Promise<void> {
|
|
295
|
+
await atomicWriteFile(filePath, JSON.stringify(stamp(SCHEMA, value), null, 2))
|
|
211
296
|
}
|
|
212
297
|
|
|
213
|
-
|
|
214
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Parse a checkpoint, checking it is one.
|
|
300
|
+
*
|
|
301
|
+
* Both read paths were `JSON.parse(content) as IterationCheckpoint` — a
|
|
302
|
+
* cast, not a check, so `{}` passed both and failed much later at the
|
|
303
|
+
* point of use, where the message names a missing property rather than a
|
|
304
|
+
* damaged file. The fields checked here are the ones the resume path
|
|
305
|
+
* dereferences immediately; the rest are optional and their absence is
|
|
306
|
+
* survivable.
|
|
307
|
+
*/
|
|
308
|
+
/** A finite number, not `NaN` and not `Infinity`. */
|
|
309
|
+
function isCount(value: unknown): value is number {
|
|
310
|
+
return typeof value === 'number' && Number.isFinite(value)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* The budget fields a resume restores before its first iteration.
|
|
315
|
+
*
|
|
316
|
+
* Checked because a resume DEREFERENCES them: a run recalled at $4.80 of a
|
|
317
|
+
* $5 cap whose `costInfo` came back malformed continues with `NaN`
|
|
318
|
+
* budgets, which compare false against every limit — so the guard that
|
|
319
|
+
* exists to stop it silently never stops it. That is a run that looks
|
|
320
|
+
* healthy and has lost its cap, which is worse than one that refuses to
|
|
321
|
+
* resume.
|
|
322
|
+
*/
|
|
323
|
+
function hasUsableBudgets(record: Partial<IterationCheckpoint>): boolean {
|
|
324
|
+
const usage = record.tokenUsage as Record<string, unknown> | undefined
|
|
325
|
+
const cost = record.costInfo as Record<string, unknown> | undefined
|
|
326
|
+
const guard = record.guardState as Record<string, unknown> | undefined
|
|
327
|
+
if (!usage || !cost || !guard) return false
|
|
328
|
+
return (
|
|
329
|
+
isCount(usage.promptTokens) &&
|
|
330
|
+
isCount(usage.completionTokens) &&
|
|
331
|
+
isCount(usage.totalTokens) &&
|
|
332
|
+
isCount(cost.totalCost) &&
|
|
333
|
+
isCount(guard.iterationCount) &&
|
|
334
|
+
isCount(guard.elapsedMs)
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function parseCheckpoint(content: string, file: string): IterationCheckpoint {
|
|
339
|
+
const parsed = migrate<unknown>(SCHEMA, JSON.parse(content))
|
|
340
|
+
const record = parsed as Partial<IterationCheckpoint> | null
|
|
341
|
+
|
|
342
|
+
if (
|
|
343
|
+
record === null ||
|
|
344
|
+
typeof record !== 'object' ||
|
|
345
|
+
typeof record.id !== 'string' ||
|
|
346
|
+
typeof record.iteration !== 'number' ||
|
|
347
|
+
typeof record.createdAt !== 'number' ||
|
|
348
|
+
!Array.isArray(record.messages)
|
|
349
|
+
) {
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Checkpoint file "${file}" is not a usable checkpoint: it parsed as JSON but is missing the fields a resume needs (id, iteration, createdAt, messages). Refusing rather than resuming from it.`,
|
|
352
|
+
)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (!hasUsableBudgets(record)) {
|
|
356
|
+
throw new Error(
|
|
357
|
+
`Checkpoint file "${file}" has malformed budget state (tokenUsage, costInfo, guardState). A resume restores these before its first iteration, so reading them as NaN or undefined produces a run that compares false against every limit and never stops. Refusing rather than resuming without a cap.`,
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return record as IterationCheckpoint
|
|
215
362
|
}
|
|
216
363
|
|
|
217
364
|
function isFileNotFound(err: unknown): boolean {
|