@namzu/sdk 45.1.0 → 48.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 +436 -8
- package/README.md +7 -8
- package/dist/advisory/history.d.ts.map +1 -1
- package/dist/advisory/history.js +21 -1
- package/dist/advisory/history.js.map +1 -1
- package/dist/advisory/index.d.ts +1 -1
- package/dist/advisory/index.d.ts.map +1 -1
- package/dist/advisory/index.js +1 -1
- package/dist/advisory/index.js.map +1 -1
- package/dist/advisory/registry.d.ts +17 -0
- package/dist/advisory/registry.d.ts.map +1 -1
- package/dist/advisory/registry.js +26 -0
- package/dist/advisory/registry.js.map +1 -1
- package/dist/agents/PipelineAgent.d.ts +2 -46
- package/dist/agents/PipelineAgent.d.ts.map +1 -1
- package/dist/agents/PipelineAgent.js +2 -242
- package/dist/agents/PipelineAgent.js.map +1 -1
- package/dist/agents/QueryAgent.d.ts +21 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -0
- package/dist/agents/QueryAgent.js +214 -0
- package/dist/agents/QueryAgent.js.map +1 -0
- package/dist/agents/ReactiveAgent.d.ts +4 -16
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +4 -183
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/RouterAgent.d.ts +2 -20
- package/dist/agents/RouterAgent.d.ts.map +1 -1
- package/dist/agents/RouterAgent.js +2 -266
- package/dist/agents/RouterAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts +3 -43
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +3 -418
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/defineAgent.d.ts +2 -1
- package/dist/agents/defineAgent.d.ts.map +1 -1
- package/dist/agents/defineAgent.js +6 -1
- package/dist/agents/defineAgent.js.map +1 -1
- package/dist/agents/examples/PipelineAgent.d.ts +46 -0
- package/dist/agents/examples/PipelineAgent.d.ts.map +1 -0
- package/dist/agents/examples/PipelineAgent.js +242 -0
- package/dist/agents/examples/PipelineAgent.js.map +1 -0
- package/dist/agents/examples/RouterAgent.d.ts +22 -0
- package/dist/agents/examples/RouterAgent.d.ts.map +1 -0
- package/dist/agents/examples/RouterAgent.js +268 -0
- package/dist/agents/examples/RouterAgent.js.map +1 -0
- package/dist/agents/examples/SupervisorAgent.d.ts +45 -0
- package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -0
- package/dist/agents/examples/SupervisorAgent.js +406 -0
- package/dist/agents/examples/SupervisorAgent.js.map +1 -0
- package/dist/agents/explore.d.ts +6 -3
- package/dist/agents/explore.d.ts.map +1 -1
- package/dist/agents/explore.js +6 -3
- package/dist/agents/explore.js.map +1 -1
- package/dist/agents/forward-options.d.ts +11 -0
- package/dist/agents/forward-options.d.ts.map +1 -0
- package/dist/agents/forward-options.js +15 -0
- package/dist/agents/forward-options.js.map +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/runAgent.d.ts +19 -8
- package/dist/agents/runAgent.d.ts.map +1 -1
- package/dist/agents/runAgent.js +99 -29
- package/dist/agents/runAgent.js.map +1 -1
- package/dist/authorization/command-line.d.ts +2 -0
- package/dist/authorization/command-line.d.ts.map +1 -1
- package/dist/authorization/command-line.js +2 -2
- package/dist/authorization/command-line.js.map +1 -1
- package/dist/authorization/gate.d.ts +13 -2
- package/dist/authorization/gate.d.ts.map +1 -1
- package/dist/authorization/gate.js +37 -5
- package/dist/authorization/gate.js.map +1 -1
- package/dist/authorization/program.d.ts +151 -0
- package/dist/authorization/program.d.ts.map +1 -0
- package/dist/authorization/program.js +713 -0
- package/dist/authorization/program.js.map +1 -0
- package/dist/authorization/reexec-wrapper.d.ts +106 -0
- package/dist/authorization/reexec-wrapper.d.ts.map +1 -0
- package/dist/authorization/reexec-wrapper.js +532 -0
- package/dist/authorization/reexec-wrapper.js.map +1 -0
- package/dist/authorization/rules.d.ts +9 -0
- package/dist/authorization/rules.d.ts.map +1 -1
- package/dist/authorization/rules.js +27 -1
- package/dist/authorization/rules.js.map +1 -1
- package/dist/authorization/shell-lexer.d.ts +39 -0
- package/dist/authorization/shell-lexer.d.ts.map +1 -1
- package/dist/authorization/shell-lexer.js +113 -69
- package/dist/authorization/shell-lexer.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +6 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/capabilities/index.d.ts +54 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +92 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/config/registry.d.ts +2 -1
- package/dist/config/registry.d.ts.map +1 -1
- package/dist/config/registry.js +3 -2
- package/dist/config/registry.js.map +1 -1
- package/dist/connector/index.d.ts +4 -4
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +3 -3
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/mcp/adapter.d.ts +16 -1
- package/dist/connector/mcp/adapter.d.ts.map +1 -1
- package/dist/connector/mcp/adapter.js +60 -4
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +13 -4
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +20 -3
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/discovery.d.ts +24 -1
- package/dist/connector/mcp/discovery.d.ts.map +1 -1
- package/dist/connector/mcp/discovery.js +44 -0
- package/dist/connector/mcp/discovery.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +2 -0
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +11 -0
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/mcp-toolset.d.ts +133 -0
- package/dist/connector/mcp/mcp-toolset.d.ts.map +1 -0
- package/dist/connector/mcp/mcp-toolset.js +399 -0
- package/dist/connector/mcp/mcp-toolset.js.map +1 -0
- package/dist/connector/tools/index.d.ts +2 -2
- package/dist/connector/tools/index.d.ts.map +1 -1
- package/dist/connector/tools/index.js +1 -1
- package/dist/connector/tools/index.js.map +1 -1
- package/dist/connector/tools/router.d.ts +15 -13
- package/dist/connector/tools/router.d.ts.map +1 -1
- package/dist/connector/tools/router.js +30 -51
- package/dist/connector/tools/router.js.map +1 -1
- package/dist/contracts/a2a.d.ts +2 -2
- package/dist/directory/derive-supervisor.d.ts +2 -2
- package/dist/directory/derive-supervisor.d.ts.map +1 -1
- package/dist/directory/derive-supervisor.js +6 -7
- package/dist/directory/derive-supervisor.js.map +1 -1
- package/dist/directory/derive.d.ts.map +1 -1
- package/dist/directory/derive.js +5 -5
- package/dist/directory/derive.js.map +1 -1
- package/dist/execution/code-runtime/types.d.ts +2 -2
- package/dist/execution/code-runtime/types.js +1 -1
- package/dist/invariants/index.d.ts +2 -1
- package/dist/invariants/index.d.ts.map +1 -1
- package/dist/invariants/index.js +3 -2
- package/dist/invariants/index.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +9 -0
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/connector/environment.d.ts +6 -0
- package/dist/manager/connector/environment.d.ts.map +1 -1
- package/dist/manager/connector/environment.js +11 -4
- package/dist/manager/connector/environment.js.map +1 -1
- package/dist/manager/connector/index.d.ts +2 -2
- package/dist/manager/connector/index.d.ts.map +1 -1
- package/dist/manager/connector/index.js +2 -2
- package/dist/manager/connector/index.js.map +1 -1
- package/dist/manager/connector/tenant.d.ts +6 -0
- package/dist/manager/connector/tenant.d.ts.map +1 -1
- package/dist/manager/connector/tenant.js +11 -4
- package/dist/manager/connector/tenant.js.map +1 -1
- package/dist/manager/index.d.ts +2 -2
- package/dist/manager/index.d.ts.map +1 -1
- package/dist/manager/index.js +2 -2
- package/dist/manager/index.js.map +1 -1
- package/dist/manager/resident/learning-observation.d.ts +4 -4
- package/dist/manager/resident/learning.d.ts +36 -36
- package/dist/manager/session/attribution.d.ts +22 -0
- package/dist/manager/session/attribution.d.ts.map +1 -0
- package/dist/manager/session/attribution.js +64 -0
- package/dist/manager/session/attribution.js.map +1 -0
- package/dist/manager/session/turn-recorder.d.ts +14 -0
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +208 -55
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/peers/address.d.ts +36 -0
- package/dist/peers/address.d.ts.map +1 -0
- package/dist/peers/address.js +52 -0
- package/dist/peers/address.js.map +1 -0
- package/dist/peers/client.d.ts +47 -0
- package/dist/peers/client.d.ts.map +1 -0
- package/dist/peers/client.js +132 -0
- package/dist/peers/client.js.map +1 -0
- package/dist/peers/dir.d.ts +88 -0
- package/dist/peers/dir.d.ts.map +1 -0
- package/dist/peers/dir.js +139 -0
- package/dist/peers/dir.js.map +1 -0
- package/dist/peers/endpoint.d.ts +144 -0
- package/dist/peers/endpoint.d.ts.map +1 -0
- package/dist/peers/endpoint.js +420 -0
- package/dist/peers/endpoint.js.map +1 -0
- package/dist/peers/envelope.d.ts +42 -0
- package/dist/peers/envelope.d.ts.map +1 -0
- package/dist/peers/envelope.js +110 -0
- package/dist/peers/envelope.js.map +1 -0
- package/dist/peers/index.d.ts +30 -0
- package/dist/peers/index.d.ts.map +1 -0
- package/dist/peers/index.js +22 -0
- package/dist/peers/index.js.map +1 -0
- package/dist/peers/protocol.d.ts +645 -0
- package/dist/peers/protocol.d.ts.map +1 -0
- package/dist/peers/protocol.js +151 -0
- package/dist/peers/protocol.js.map +1 -0
- package/dist/peers/record.d.ts +71 -0
- package/dist/peers/record.d.ts.map +1 -0
- package/dist/peers/record.js +45 -0
- package/dist/peers/record.js.map +1 -0
- package/dist/peers/registry.d.ts +54 -0
- package/dist/peers/registry.d.ts.map +1 -0
- package/dist/peers/registry.js +213 -0
- package/dist/peers/registry.js.map +1 -0
- package/dist/plugin/define.d.ts +24 -0
- package/dist/plugin/define.d.ts.map +1 -0
- package/dist/plugin/define.js +42 -0
- package/dist/plugin/define.js.map +1 -0
- package/dist/plugin/index.d.ts +2 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +1 -0
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/lifecycle.d.ts +27 -3
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +242 -92
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/plugin/resolver.d.ts +2 -2
- package/dist/plugin/resolver.d.ts.map +1 -1
- package/dist/plugin/resolver.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +17 -3
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/pricing/catalogue.generated.d.ts.map +1 -1
- package/dist/pricing/catalogue.generated.js +28 -4
- package/dist/pricing/catalogue.generated.js.map +1 -1
- package/dist/probe/errors.d.ts +2 -1
- package/dist/probe/errors.d.ts.map +1 -1
- package/dist/probe/errors.js +3 -2
- package/dist/probe/errors.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +18 -7
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +11 -6
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/prompt/contributions.d.ts +4 -1
- package/dist/prompt/contributions.d.ts.map +1 -1
- package/dist/prompt/contributions.js +7 -2
- package/dist/prompt/contributions.js.map +1 -1
- package/dist/prompt/index.d.ts +1 -1
- package/dist/prompt/index.d.ts.map +1 -1
- package/dist/prompt/index.js +1 -1
- package/dist/prompt/index.js.map +1 -1
- package/dist/provider/collect-chat-completion.d.ts +6 -1
- package/dist/provider/collect-chat-completion.d.ts.map +1 -1
- package/dist/provider/collect-chat-completion.js +88 -10
- package/dist/provider/collect-chat-completion.js.map +1 -1
- package/dist/provider/mock.d.ts.map +1 -1
- package/dist/provider/mock.js +23 -6
- package/dist/provider/mock.js.map +1 -1
- package/dist/provider/registry.d.ts +2 -1
- package/dist/provider/registry.d.ts.map +1 -1
- package/dist/provider/registry.js +3 -2
- package/dist/provider/registry.js.map +1 -1
- package/dist/provider/tool-call-framing.d.ts +164 -0
- package/dist/provider/tool-call-framing.d.ts.map +1 -0
- package/dist/provider/tool-call-framing.js +163 -0
- package/dist/provider/tool-call-framing.js.map +1 -0
- package/dist/public-runtime.d.ts +27 -14
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +49 -11
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +9 -6
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +13 -5
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +16 -5
- package/dist/public-types.d.ts.map +1 -1
- package/dist/read-model/registry.d.ts +2 -1
- package/dist/read-model/registry.d.ts.map +1 -1
- package/dist/read-model/registry.js +3 -2
- package/dist/read-model/registry.js.map +1 -1
- package/dist/registry/ManagedRegistry.d.ts +30 -0
- package/dist/registry/ManagedRegistry.d.ts.map +1 -1
- package/dist/registry/ManagedRegistry.js +45 -6
- package/dist/registry/ManagedRegistry.js.map +1 -1
- package/dist/registry/collision.d.ts +57 -0
- package/dist/registry/collision.d.ts.map +1 -0
- package/dist/registry/collision.js +41 -0
- package/dist/registry/collision.js.map +1 -0
- package/dist/registry/command/index.d.ts +5 -3
- package/dist/registry/command/index.d.ts.map +1 -1
- package/dist/registry/command/index.js +6 -4
- package/dist/registry/command/index.js.map +1 -1
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +2 -2
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/plugin/index.d.ts.map +1 -1
- package/dist/registry/plugin/index.js +14 -1
- package/dist/registry/plugin/index.js.map +1 -1
- package/dist/registry/tool/callable.d.ts +22 -0
- package/dist/registry/tool/callable.d.ts.map +1 -0
- package/dist/registry/tool/callable.js +28 -0
- package/dist/registry/tool/callable.js.map +1 -0
- package/dist/registry/tool/execute.d.ts +14 -77
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +15 -720
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/registry/tool/portable.d.ts +25 -0
- package/dist/registry/tool/portable.d.ts.map +1 -1
- package/dist/registry/tool/portable.js +50 -0
- package/dist/registry/tool/portable.js.map +1 -1
- package/dist/registry/tool/presentation.d.ts +6 -5
- package/dist/registry/tool/presentation.d.ts.map +1 -1
- package/dist/registry/tool/presentation.js +3 -3
- package/dist/registry/tool/presentation.js.map +1 -1
- package/dist/runtime/bidi/session.d.ts +5 -4
- package/dist/runtime/bidi/session.d.ts.map +1 -1
- package/dist/runtime/bidi/session.js +18 -1
- package/dist/runtime/bidi/session.js.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts +82 -13
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +227 -17
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +37 -5
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +103 -14
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/file-evidence-replay.d.ts +1 -1
- package/dist/runtime/query/file-evidence-replay.d.ts.map +1 -1
- package/dist/runtime/query/file-evidence-replay.js +8 -7
- package/dist/runtime/query/file-evidence-replay.js.map +1 -1
- package/dist/runtime/query/fork/prepare.d.ts +4 -1
- package/dist/runtime/query/fork/prepare.d.ts.map +1 -1
- package/dist/runtime/query/fork/prepare.js +4 -0
- package/dist/runtime/query/fork/prepare.js.map +1 -1
- package/dist/runtime/query/guardrail-presets.d.ts +4 -3
- package/dist/runtime/query/guardrail-presets.d.ts.map +1 -1
- package/dist/runtime/query/guardrail-presets.js +4 -3
- package/dist/runtime/query/guardrail-presets.js.map +1 -1
- package/dist/runtime/query/index.d.ts +23 -10
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +149 -70
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +8 -1
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +2 -2
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +55 -2
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +342 -116
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/iteration/tool-input.d.ts +79 -0
- package/dist/runtime/query/iteration/tool-input.d.ts.map +1 -0
- package/dist/runtime/query/iteration/tool-input.js +291 -0
- package/dist/runtime/query/iteration/tool-input.js.map +1 -0
- package/dist/runtime/query/observation-context.d.ts +2 -2
- package/dist/runtime/query/observation-context.d.ts.map +1 -1
- package/dist/runtime/query/observation-context.js.map +1 -1
- package/dist/runtime/query/prelude-lease.d.ts +18 -0
- package/dist/runtime/query/prelude-lease.d.ts.map +1 -0
- package/dist/runtime/query/prelude-lease.js +121 -0
- package/dist/runtime/query/prelude-lease.js.map +1 -0
- package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
- package/dist/runtime/query/prepare-turn.js +386 -187
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/prompt-cache.d.ts +2 -2
- package/dist/runtime/query/prompt-cache.d.ts.map +1 -1
- package/dist/runtime/query/prompt.d.ts +2 -2
- package/dist/runtime/query/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +1 -1
- package/dist/runtime/query/prompt.js.map +1 -1
- package/dist/runtime/query/resume-session.d.ts.map +1 -1
- package/dist/runtime/query/resume-session.js +37 -2
- package/dist/runtime/query/resume-session.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +65 -3
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +143 -22
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +3 -2
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/runtime/query/turn-state.d.ts.map +1 -1
- package/dist/runtime/query/turn-state.js +5 -0
- package/dist/runtime/query/turn-state.js.map +1 -1
- package/dist/runtime/system-events.d.ts +112 -0
- package/dist/runtime/system-events.d.ts.map +1 -0
- package/dist/runtime/system-events.js +183 -0
- package/dist/runtime/system-events.js.map +1 -0
- package/dist/scheduler/delegating.d.ts +2 -1
- package/dist/scheduler/delegating.d.ts.map +1 -1
- package/dist/scheduler/delegating.js +3 -2
- package/dist/scheduler/delegating.js.map +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/registry.d.ts +18 -0
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +20 -0
- package/dist/skills/registry.js.map +1 -1
- package/dist/store/evidence/index-page.d.ts +2 -2
- package/dist/store/session-log/conformance.d.ts +1 -1
- package/dist/store/session-log/conformance.d.ts.map +1 -1
- package/dist/store/session-log/conformance.js +49 -8
- package/dist/store/session-log/conformance.js.map +1 -1
- package/dist/store/session-log/core.d.ts +8 -3
- package/dist/store/session-log/core.d.ts.map +1 -1
- package/dist/store/session-log/core.js +2 -1
- package/dist/store/session-log/core.js.map +1 -1
- package/dist/store/session-log/fold.d.ts +12 -0
- package/dist/store/session-log/fold.d.ts.map +1 -1
- package/dist/store/session-log/fold.js +57 -7
- package/dist/store/session-log/fold.js.map +1 -1
- package/dist/store/session-log/index.d.ts +2 -2
- package/dist/store/session-log/index.d.ts.map +1 -1
- package/dist/store/session-log/index.js +1 -1
- package/dist/store/session-log/index.js.map +1 -1
- package/dist/test-support/toolset.d.ts +19 -0
- package/dist/test-support/toolset.d.ts.map +1 -0
- package/dist/test-support/toolset.js +20 -0
- package/dist/test-support/toolset.js.map +1 -0
- package/dist/tools/builtins/bash.d.ts +29 -0
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +19 -9
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/browser-url.d.ts +1 -1
- package/dist/tools/builtins/browser-url.js +1 -1
- package/dist/tools/builtins/browser.d.ts +6 -6
- package/dist/tools/builtins/computer-use-coordinates.d.ts +65 -0
- package/dist/tools/builtins/computer-use-coordinates.d.ts.map +1 -0
- package/dist/tools/builtins/computer-use-coordinates.js +123 -0
- package/dist/tools/builtins/computer-use-coordinates.js.map +1 -0
- package/dist/tools/builtins/computer-use-image.d.ts +77 -0
- package/dist/tools/builtins/computer-use-image.d.ts.map +1 -0
- package/dist/tools/builtins/computer-use-image.js +223 -0
- package/dist/tools/builtins/computer-use-image.js.map +1 -0
- package/dist/tools/builtins/computer-use.d.ts +519 -14
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +1196 -183
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +9 -1
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +2 -1
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js +1 -1
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/json-string-hint.d.ts +15 -0
- package/dist/tools/builtins/json-string-hint.d.ts.map +1 -0
- package/dist/tools/builtins/json-string-hint.js +17 -0
- package/dist/tools/builtins/json-string-hint.js.map +1 -0
- package/dist/tools/builtins/search-tools.d.ts.map +1 -1
- package/dist/tools/builtins/search-tools.js +7 -15
- package/dist/tools/builtins/search-tools.js.map +1 -1
- package/dist/tools/builtins/skill.d.ts +74 -0
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +214 -174
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +11 -0
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/command-shell.d.ts +10 -0
- package/dist/tools/command-shell.d.ts.map +1 -1
- package/dist/tools/command-shell.js +45 -1
- package/dist/tools/command-shell.js.map +1 -1
- package/dist/tools/coordinator/agent.d.ts.map +1 -1
- package/dist/tools/coordinator/agent.js +5 -0
- package/dist/tools/coordinator/agent.js.map +1 -1
- package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
- package/dist/tools/coordinator/ask-user-question.js +26 -13
- package/dist/tools/coordinator/ask-user-question.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +5 -0
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/coordinator/question-options.d.ts +78 -0
- package/dist/tools/coordinator/question-options.d.ts.map +1 -0
- package/dist/tools/coordinator/question-options.js +153 -0
- package/dist/tools/coordinator/question-options.js.map +1 -0
- package/dist/tools/defineTool.d.ts +12 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +24 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/memory/search.d.ts.map +1 -1
- package/dist/tools/memory/search.js +4 -1
- package/dist/tools/memory/search.js.map +1 -1
- package/dist/tools/memory/update.d.ts.map +1 -1
- package/dist/tools/memory/update.js +8 -5
- package/dist/tools/memory/update.js.map +1 -1
- package/dist/tools/render-nonce.d.ts +47 -0
- package/dist/tools/render-nonce.d.ts.map +1 -0
- package/dist/tools/render-nonce.js +63 -0
- package/dist/tools/render-nonce.js.map +1 -0
- package/dist/tools/roster.d.ts +46 -19
- package/dist/tools/roster.d.ts.map +1 -1
- package/dist/tools/roster.js +63 -33
- package/dist/tools/roster.js.map +1 -1
- package/dist/tools/schedules/present.d.ts.map +1 -1
- package/dist/tools/schedules/present.js +2 -0
- package/dist/tools/schedules/present.js.map +1 -1
- package/dist/tools/schedules/schedule-tool.d.ts +6 -5
- package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +208 -37
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/schedules/types.d.ts +120 -6
- package/dist/tools/schedules/types.d.ts.map +1 -1
- package/dist/tools/trusted-read-only.d.ts +9 -5
- package/dist/tools/trusted-read-only.d.ts.map +1 -1
- package/dist/tools/trusted-read-only.js +14 -10
- package/dist/tools/trusted-read-only.js.map +1 -1
- package/dist/tools/untrusted-envelope.d.ts +67 -28
- package/dist/tools/untrusted-envelope.d.ts.map +1 -1
- package/dist/tools/untrusted-envelope.js +108 -59
- package/dist/tools/untrusted-envelope.js.map +1 -1
- package/dist/toolsets/combine.d.ts +44 -0
- package/dist/toolsets/combine.d.ts.map +1 -0
- package/dist/toolsets/combine.js +153 -0
- package/dist/toolsets/combine.js.map +1 -0
- package/dist/toolsets/manager.d.ts +201 -0
- package/dist/toolsets/manager.d.ts.map +1 -0
- package/dist/toolsets/manager.js +837 -0
- package/dist/toolsets/manager.js.map +1 -0
- package/dist/toolsets/source-glob.d.ts +15 -0
- package/dist/toolsets/source-glob.d.ts.map +1 -0
- package/dist/toolsets/source-glob.js +23 -0
- package/dist/toolsets/source-glob.js.map +1 -0
- package/dist/toolsets/toolset.d.ts +20 -0
- package/dist/toolsets/toolset.d.ts.map +1 -0
- package/dist/toolsets/toolset.js +28 -0
- package/dist/toolsets/toolset.js.map +1 -0
- package/dist/toolsets/types.d.ts +128 -0
- package/dist/toolsets/types.d.ts.map +1 -0
- package/dist/toolsets/types.js +33 -0
- package/dist/toolsets/types.js.map +1 -0
- package/dist/toolsets/wrappers.d.ts +59 -0
- package/dist/toolsets/wrappers.d.ts.map +1 -0
- package/dist/toolsets/wrappers.js +165 -0
- package/dist/toolsets/wrappers.js.map +1 -0
- package/dist/types/agent/base.d.ts +27 -16
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/index.d.ts +1 -0
- package/dist/types/agent/index.d.ts.map +1 -1
- package/dist/types/agent/index.js +1 -0
- package/dist/types/agent/index.js.map +1 -1
- package/dist/types/agent/pipeline.d.ts +2 -0
- package/dist/types/agent/pipeline.d.ts.map +1 -1
- package/dist/types/agent/query.d.ts +117 -0
- package/dist/types/agent/query.d.ts.map +1 -0
- package/dist/types/agent/query.js +2 -0
- package/dist/types/agent/query.js.map +1 -0
- package/dist/types/agent/reactive.d.ts +2 -129
- package/dist/types/agent/reactive.d.ts.map +1 -1
- package/dist/types/agent/router.d.ts +2 -0
- package/dist/types/agent/router.d.ts.map +1 -1
- package/dist/types/agent/supervisor.d.ts +5 -2
- package/dist/types/agent/supervisor.d.ts.map +1 -1
- package/dist/types/authorization/index.d.ts +70 -12
- package/dist/types/authorization/index.d.ts.map +1 -1
- package/dist/types/authorization/index.js +11 -0
- package/dist/types/authorization/index.js.map +1 -1
- package/dist/types/computer-use/index.d.ts +176 -0
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.js.map +1 -1
- package/dist/types/connector/mcp.d.ts +32 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/errors/index.d.ts +15 -0
- package/dist/types/errors/index.d.ts.map +1 -1
- package/dist/types/errors/index.js.map +1 -1
- package/dist/types/hitl/index.d.ts +57 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/message/index.d.ts +130 -9
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +4 -1
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +22 -4
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +1 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/chat.d.ts +5 -0
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/config.d.ts +8 -3
- package/dist/types/provider/config.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +39 -0
- package/dist/types/provider/stream.d.ts.map +1 -1
- package/dist/types/sandbox/index.d.ts +1 -1
- package/dist/types/session/events.d.ts +14 -3
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/tool/index.d.ts +171 -91
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/toolset/index.d.ts +10 -40
- package/dist/types/toolset/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/advisory/history.ts +27 -2
- package/src/advisory/index.ts +1 -1
- package/src/advisory/registry.ts +33 -0
- package/src/agents/AGENTS.md +14 -7
- package/src/agents/PipelineAgent.ts +2 -303
- package/src/agents/QueryAgent.ts +269 -0
- package/src/agents/ReactiveAgent.ts +6 -216
- package/src/agents/RouterAgent.ts +2 -337
- package/src/agents/SupervisorAgent.ts +3 -476
- package/src/agents/defineAgent.ts +13 -2
- package/src/agents/examples/PipelineAgent.ts +302 -0
- package/src/agents/examples/RouterAgent.ts +338 -0
- package/src/agents/examples/SupervisorAgent.ts +472 -0
- package/src/agents/explore.ts +6 -3
- package/src/agents/forward-options.ts +37 -0
- package/src/agents/index.ts +2 -0
- package/src/agents/runAgent.ts +144 -37
- package/src/authorization/command-line.ts +2 -2
- package/src/authorization/gate.ts +46 -5
- package/src/authorization/program.ts +773 -0
- package/src/authorization/reexec-wrapper.ts +589 -0
- package/src/authorization/rules.ts +36 -1
- package/src/authorization/shell-lexer.ts +136 -63
- package/src/bridge/sse/mapper.ts +6 -0
- package/src/capabilities/index.ts +157 -0
- package/src/config/registry.ts +4 -1
- package/src/connector/index.ts +9 -2
- package/src/connector/mcp/adapter.ts +58 -3
- package/src/connector/mcp/client.ts +20 -4
- package/src/connector/mcp/discovery.ts +60 -0
- package/src/connector/mcp/index.ts +13 -0
- package/src/connector/mcp/mcp-toolset.ts +515 -0
- package/src/connector/tools/index.ts +2 -2
- package/src/connector/tools/router.ts +35 -58
- package/src/directory/derive-supervisor.ts +12 -8
- package/src/directory/derive.ts +8 -5
- package/src/execution/code-runtime/types.ts +2 -2
- package/src/invariants/index.ts +4 -1
- package/src/manager/agent/lifecycle.ts +9 -0
- package/src/manager/connector/environment.ts +17 -4
- package/src/manager/connector/index.ts +2 -2
- package/src/manager/connector/tenant.ts +17 -4
- package/src/manager/index.ts +2 -2
- package/src/manager/session/attribution.ts +79 -0
- package/src/manager/session/turn-recorder.ts +211 -55
- package/src/peers/address.ts +58 -0
- package/src/peers/client.ts +202 -0
- package/src/peers/dir.ts +176 -0
- package/src/peers/endpoint.ts +564 -0
- package/src/peers/envelope.ts +121 -0
- package/src/peers/index.ts +96 -0
- package/src/peers/protocol.ts +196 -0
- package/src/peers/record.ts +56 -0
- package/src/peers/registry.ts +241 -0
- package/src/plugin/define.ts +68 -0
- package/src/plugin/index.ts +2 -0
- package/src/plugin/lifecycle.ts +286 -106
- package/src/plugin/resolver.ts +6 -3
- package/src/plugin/shell-hook.ts +21 -5
- package/src/pricing/catalogue.generated.ts +28 -4
- package/src/pricing/rates.source.json +27 -6
- package/src/probe/errors.ts +4 -1
- package/src/prompt/coding-agent-doctrine.ts +22 -10
- package/src/prompt/contributions.ts +12 -2
- package/src/prompt/index.ts +1 -0
- package/src/provider/collect-chat-completion.ts +96 -11
- package/src/provider/mock.ts +24 -6
- package/src/provider/registry.ts +4 -1
- package/src/provider/tool-call-framing.ts +226 -0
- package/src/public-runtime.ts +152 -9
- package/src/public-tools.ts +43 -5
- package/src/public-types.ts +65 -6
- package/src/read-model/registry.ts +7 -2
- package/src/registry/ManagedRegistry.ts +57 -6
- package/src/registry/collision.ts +64 -0
- package/src/registry/command/index.ts +7 -3
- package/src/registry/index.ts +3 -9
- package/src/registry/plugin/index.ts +14 -1
- package/src/registry/tool/callable.ts +36 -0
- package/src/registry/tool/execute.ts +16 -839
- package/src/registry/tool/portable.ts +59 -0
- package/src/registry/tool/presentation.ts +6 -5
- package/src/runtime/bidi/session.ts +24 -5
- package/src/runtime/query/executor/tool-call-admission.ts +288 -22
- package/src/runtime/query/executor.ts +129 -16
- package/src/runtime/query/file-evidence-replay.ts +8 -7
- package/src/runtime/query/fork/prepare.ts +6 -1
- package/src/runtime/query/guardrail-presets.ts +4 -3
- package/src/runtime/query/index.ts +199 -101
- package/src/runtime/query/iteration/index.ts +13 -3
- package/src/runtime/query/iteration/phases/compaction.ts +1 -1
- package/src/runtime/query/iteration/phases/context.ts +2 -2
- package/src/runtime/query/iteration/phases/tool-review.ts +59 -2
- package/src/runtime/query/iteration/stream-turn.ts +390 -136
- package/src/runtime/query/iteration/tool-input.ts +284 -0
- package/src/runtime/query/observation-context.ts +2 -2
- package/src/runtime/query/prelude-lease.ts +132 -0
- package/src/runtime/query/prepare-turn.ts +477 -198
- package/src/runtime/query/prompt-cache.ts +2 -2
- package/src/runtime/query/prompt.ts +4 -4
- package/src/runtime/query/resume-session.ts +42 -3
- package/src/runtime/query/review-policy.ts +190 -24
- package/src/runtime/query/tooling.ts +3 -6
- package/src/runtime/query/turn-state.ts +4 -0
- package/src/runtime/system-events.ts +246 -0
- package/src/scheduler/delegating.ts +7 -2
- package/src/skills/index.ts +1 -1
- package/src/skills/registry.ts +33 -0
- package/src/store/session-log/conformance.ts +51 -8
- package/src/store/session-log/core.ts +10 -4
- package/src/store/session-log/fold.ts +33 -7
- package/src/store/session-log/index.ts +2 -0
- package/src/test-support/toolset.ts +23 -0
- package/src/tools/builtins/bash.ts +27 -10
- package/src/tools/builtins/browser-url.ts +1 -1
- package/src/tools/builtins/computer-use-coordinates.ts +144 -0
- package/src/tools/builtins/computer-use-image.ts +278 -0
- package/src/tools/builtins/computer-use.ts +1495 -191
- package/src/tools/builtins/edit.ts +12 -2
- package/src/tools/builtins/index.ts +7 -1
- package/src/tools/builtins/json-string-hint.ts +16 -0
- package/src/tools/builtins/search-tools.ts +7 -20
- package/src/tools/builtins/skill.ts +304 -174
- package/src/tools/builtins/write-file.ts +12 -0
- package/src/tools/command-shell.ts +46 -1
- package/src/tools/coordinator/agent.ts +6 -0
- package/src/tools/coordinator/ask-user-question.ts +29 -15
- package/src/tools/coordinator/index.ts +6 -0
- package/src/tools/coordinator/question-options.ts +195 -0
- package/src/tools/defineTool.ts +38 -0
- package/src/tools/memory/search.ts +4 -1
- package/src/tools/memory/update.ts +8 -5
- package/src/tools/render-nonce.ts +69 -0
- package/src/tools/roster.ts +84 -33
- package/src/tools/schedules/present.ts +2 -0
- package/src/tools/schedules/schedule-tool.ts +238 -39
- package/src/tools/schedules/types.ts +120 -6
- package/src/tools/trusted-read-only.ts +19 -10
- package/src/tools/untrusted-envelope.ts +121 -57
- package/src/toolsets/combine.ts +181 -0
- package/src/toolsets/manager.ts +996 -0
- package/src/toolsets/source-glob.ts +22 -0
- package/src/toolsets/toolset.ts +31 -0
- package/src/toolsets/types.ts +154 -0
- package/src/toolsets/wrappers.ts +191 -0
- package/src/types/agent/base.ts +29 -16
- package/src/types/agent/index.ts +1 -0
- package/src/types/agent/pipeline.ts +2 -0
- package/src/types/agent/query.ts +129 -0
- package/src/types/agent/reactive.ts +5 -142
- package/src/types/agent/router.ts +2 -0
- package/src/types/agent/supervisor.ts +5 -2
- package/src/types/authorization/index.ts +33 -0
- package/src/types/computer-use/index.ts +202 -0
- package/src/types/connector/mcp.ts +32 -0
- package/src/types/errors/index.ts +15 -0
- package/src/types/hitl/index.ts +57 -0
- package/src/types/message/index.ts +135 -7
- package/src/types/plugin/index.ts +44 -21
- package/src/types/provider/chat.ts +5 -0
- package/src/types/provider/config.ts +8 -3
- package/src/types/provider/stream.ts +39 -0
- package/src/types/sandbox/index.ts +1 -1
- package/src/types/session/events.ts +14 -3
- package/src/types/tool/index.ts +173 -105
- package/src/types/toolset/index.ts +10 -47
- package/dist/registry/toolset/catalog.d.ts +0 -42
- package/dist/registry/toolset/catalog.d.ts.map +0 -1
- package/dist/registry/toolset/catalog.js +0 -234
- package/dist/registry/toolset/catalog.js.map +0 -1
- package/src/registry/toolset/catalog.ts +0 -308
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto'
|
|
2
2
|
import type { PromptContributionRegistry } from '../../prompt/contributions.js'
|
|
3
|
+
import type { ToolManager } from '../../toolsets/manager.js'
|
|
3
4
|
import type { AgentRuntimeContext } from '../../types/agent/base.js'
|
|
4
5
|
import type { AgentContextLevel } from '../../types/agent/factory.js'
|
|
5
6
|
import type { AgentPersona } from '../../types/persona/index.js'
|
|
6
7
|
import type { ProjectId } from '../../types/session/ids.js'
|
|
7
8
|
import type { Skill } from '../../types/skills/index.js'
|
|
8
|
-
import type { ToolRegistryContract } from '../../types/tool/index.js'
|
|
9
9
|
import { PromptBuilder, type PromptSegments } from './prompt.js'
|
|
10
10
|
|
|
11
11
|
export interface PromptCacheConfig {
|
|
@@ -18,7 +18,7 @@ export interface PromptCacheInput {
|
|
|
18
18
|
persona?: AgentPersona
|
|
19
19
|
skills?: Skill[]
|
|
20
20
|
basePrompt?: string
|
|
21
|
-
tools:
|
|
21
|
+
tools: ToolManager
|
|
22
22
|
allowedTools?: string[]
|
|
23
23
|
runtimeContext?: AgentRuntimeContext
|
|
24
24
|
contributions?: PromptContributionRegistry
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
type PromptContributionRegistry,
|
|
6
6
|
SKILLS_CONTRIBUTION_ID,
|
|
7
7
|
} from '../../prompt/contributions.js'
|
|
8
|
+
import type { ToolManager } from '../../toolsets/manager.js'
|
|
8
9
|
import type { AgentRuntimeContext } from '../../types/agent/base.js'
|
|
9
10
|
import type { AgentContextLevel } from '../../types/agent/factory.js'
|
|
10
11
|
import type { AgentPersona } from '../../types/persona/index.js'
|
|
11
12
|
import type { Skill } from '../../types/skills/index.js'
|
|
12
|
-
import type { ToolRegistryContract } from '../../types/tool/index.js'
|
|
13
13
|
|
|
14
14
|
export interface PromptSegments {
|
|
15
15
|
/** Layers 1-6: basePrompt, persona identity/expertise/reflexes/skills/outputDiscipline. Stable within a turn. */
|
|
@@ -27,7 +27,7 @@ export interface PromptBuilderConfig {
|
|
|
27
27
|
|
|
28
28
|
basePrompt?: string
|
|
29
29
|
|
|
30
|
-
tools:
|
|
30
|
+
tools: ToolManager
|
|
31
31
|
allowedTools?: string[]
|
|
32
32
|
runtimeContext?: AgentRuntimeContext
|
|
33
33
|
/**
|
|
@@ -79,7 +79,7 @@ Resolve relative paths against the working directory above; use supplied absolut
|
|
|
79
79
|
const canGlob =
|
|
80
80
|
tools.has('glob') &&
|
|
81
81
|
(!allowedTools || allowedTools.includes('glob')) &&
|
|
82
|
-
tools.
|
|
82
|
+
tools.availability('glob') === 'active'
|
|
83
83
|
lines.push(
|
|
84
84
|
canGlob
|
|
85
85
|
? "For an immediate directory overview, use glob with pattern '*' or an available directory listing tool. Use '**' only when recursive discovery is needed."
|
|
@@ -106,7 +106,7 @@ Resolve relative paths against the working directory above; use supplied absolut
|
|
|
106
106
|
*
|
|
107
107
|
* The name set is kept as a fallback for tools that declare neither.
|
|
108
108
|
*/
|
|
109
|
-
function hasFilesystemTools(tools:
|
|
109
|
+
function hasFilesystemTools(tools: ToolManager, allowedTools?: string[]): boolean {
|
|
110
110
|
const activeTools = allowedTools ?? tools.listNames()
|
|
111
111
|
return activeTools.some((name) => {
|
|
112
112
|
if (FILESYSTEM_TOOLS.has(name)) return true
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertSessionLogAttribution } from '../../manager/session/attribution.js'
|
|
1
2
|
import type { SessionCheckpointStore } from '../../store/checkpoint/index.js'
|
|
2
3
|
import type { SessionLease, SessionLog } from '../../store/session-log/index.js'
|
|
3
4
|
import { NamzuError } from '../../types/errors/index.js'
|
|
@@ -75,6 +76,12 @@ export interface ResumeSessionParams
|
|
|
75
76
|
export async function resumeSession(params: ResumeSessionParams): Promise<ResumeOutcome> {
|
|
76
77
|
const { scope, sessionLog, checkpointId, pendingDecision, listener, onEventReplay, ...rest } =
|
|
77
78
|
params
|
|
79
|
+
// A caller-chosen checkpoint scope is not proof that the source log belongs
|
|
80
|
+
// to it. Refuse foreign attribution before reading any checkpoint or park.
|
|
81
|
+
assertResumeRequestAttribution(params, scope)
|
|
82
|
+
if (!(await assertSessionLogAttribution(sessionLog, scope))) {
|
|
83
|
+
return { resumed: false, reason: 'no-checkpoint' }
|
|
84
|
+
}
|
|
78
85
|
const checkpointStore =
|
|
79
86
|
params.checkpointStore ??
|
|
80
87
|
(
|
|
@@ -92,10 +99,34 @@ export async function resumeSession(params: ResumeSessionParams): Promise<Resume
|
|
|
92
99
|
if (!state?.checkpointId || !selected) return { resumed: false, reason: 'no-checkpoint' }
|
|
93
100
|
assertResumeRequestAttribution(params, state)
|
|
94
101
|
|
|
102
|
+
// A checkpoint outlives the turn it was written for: nothing prunes it
|
|
103
|
+
// just because `turn_completed`/`turn_failed` settled that turn, and a
|
|
104
|
+
// turn that never checkpointed leaves none at all — `no-checkpoint`
|
|
105
|
+
// above already covers that half. This half is the OTHER way a
|
|
106
|
+
// checkpoint can stop meaning "resumable": the turn it belongs to
|
|
107
|
+
// finished. `assertTurnMayStart` (`prepare-turn.ts`) refuses this too,
|
|
108
|
+
// once `resumeFromCheckpoint` reaches it inside `query()` — but only
|
|
109
|
+
// after this function has already claimed a lease and resolved storage
|
|
110
|
+
// under the dead turn's id. Refusing here is cheaper and names the
|
|
111
|
+
// caller's own mistake instead of `query()`'s internal contract.
|
|
112
|
+
const active = await sessionLog.activeTurn()
|
|
113
|
+
if (active?.turnId !== state.turnId) {
|
|
114
|
+
throw new NamzuError({
|
|
115
|
+
code: 'invalid_config',
|
|
116
|
+
message: `Turn ${state.turnId} already ended; a completed or failed turn's checkpoint cannot be resumed.`,
|
|
117
|
+
details: { sessionId: state.sessionId, turnId: state.turnId },
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
95
121
|
// A park is outstanding until it is answered.
|
|
96
122
|
const outstanding = state.pending && !state.pending.resolvedAt ? state.pending : undefined
|
|
97
123
|
if (outstanding && !pendingDecision) {
|
|
98
|
-
return {
|
|
124
|
+
return {
|
|
125
|
+
resumed: false,
|
|
126
|
+
reason: 'awaiting-decision',
|
|
127
|
+
pending: outstanding,
|
|
128
|
+
state,
|
|
129
|
+
}
|
|
99
130
|
}
|
|
100
131
|
|
|
101
132
|
let replay: SessionLogReplay | undefined
|
|
@@ -128,10 +159,18 @@ export async function resumeSession(params: ResumeSessionParams): Promise<Resume
|
|
|
128
159
|
listener,
|
|
129
160
|
)
|
|
130
161
|
|
|
131
|
-
return {
|
|
162
|
+
return {
|
|
163
|
+
resumed: true,
|
|
164
|
+
turn,
|
|
165
|
+
state,
|
|
166
|
+
...(replay !== undefined ? { replay } : {}),
|
|
167
|
+
}
|
|
132
168
|
}
|
|
133
169
|
|
|
134
|
-
function assertResumeRequestAttribution(
|
|
170
|
+
function assertResumeRequestAttribution(
|
|
171
|
+
params: ResumeSessionParams,
|
|
172
|
+
state: TurnState | TurnStateScope,
|
|
173
|
+
): void {
|
|
135
174
|
const mismatchedFields: string[] = []
|
|
136
175
|
if (params.scope.turnId !== state.turnId) mismatchedFields.push('turnId')
|
|
137
176
|
if (params.sessionId !== state.sessionId) mismatchedFields.push('sessionId')
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* person (`prompt`).
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import type { ToolRegistry } from '../../registry/tool/execute.js'
|
|
25
24
|
import { isTrustedReadOnly } from '../../tools/trusted-read-only.js'
|
|
25
|
+
import type { ToolManager } from '../../toolsets/manager.js'
|
|
26
26
|
import type { HITLResumeDecision, ResumeHandler, ToolCallSummary } from '../../types/hitl/index.js'
|
|
27
27
|
import type { ApprovalPolicy } from '../../types/hitl/policy.js'
|
|
28
28
|
import type { SessionId, TurnId } from '../../types/ids/index.js'
|
|
@@ -122,14 +122,16 @@ export const REVIEW_EXEMPT_WRITES: ReadonlySet<string> = new Set([
|
|
|
122
122
|
* know, or one that declares nothing, is reviewed.
|
|
123
123
|
*/
|
|
124
124
|
export function isReviewExempt(
|
|
125
|
-
registry: Pick<
|
|
125
|
+
registry: Pick<ToolManager, 'get' | 'sourceOf'>,
|
|
126
126
|
name: string,
|
|
127
127
|
input: unknown,
|
|
128
128
|
): boolean {
|
|
129
129
|
if (REVIEW_EXEMPT_WRITES.has(name.toLowerCase())) return true
|
|
130
|
-
const
|
|
130
|
+
const resolvedName = registry.get(name) ? name : name.toLowerCase()
|
|
131
|
+
const tool = registry.get(resolvedName)
|
|
131
132
|
if (tool?.category === 'network') return false
|
|
132
|
-
|
|
133
|
+
const source = tool ? registry.sourceOf(resolvedName) : undefined
|
|
134
|
+
return isTrustedReadOnly(tool, input, source)
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
export type ReviewExemption = (name: string, input: unknown) => boolean
|
|
@@ -152,6 +154,7 @@ export function batchNeedsReview(
|
|
|
152
154
|
tc.authorization?.explicitReview ||
|
|
153
155
|
tc.escalation !== undefined ||
|
|
154
156
|
tc.isDestructive ||
|
|
157
|
+
tc.requiresApproval === true ||
|
|
155
158
|
!exempt(tc.name, tc.input),
|
|
156
159
|
)
|
|
157
160
|
}
|
|
@@ -197,6 +200,51 @@ export const SANDBOX_ESCAPE_UNATTENDED_REFUSAL =
|
|
|
197
200
|
export const OUTSIDE_ROOTS_UNATTENDED_REFUSAL =
|
|
198
201
|
"Refused: a call in this batch reaches a path outside the working directory and the added directories, which needs a person to approve it each time, and nobody can be asked in this session. Nothing in this batch ran. Stay inside the working directory, or tell the user which directory you need so they can add it to the session (the CLI's --add-dir)."
|
|
199
202
|
|
|
203
|
+
/**
|
|
204
|
+
* What the model is told when a batch carries a call the tool itself
|
|
205
|
+
* declared always needs a person's approval and nobody can be asked.
|
|
206
|
+
*
|
|
207
|
+
* Refuses the whole batch, the same way a sandbox escape does: the
|
|
208
|
+
* declaration is the tool author's, not the operator's, so no rule, mode or
|
|
209
|
+
* remembered grant can stand in for the person it names.
|
|
210
|
+
*/
|
|
211
|
+
export const REQUIRES_APPROVAL_UNATTENDED_REFUSAL =
|
|
212
|
+
"Refused: a call in this batch is one the tool itself declared always needs a person's approval, and nobody can be asked in this session. Nothing in this batch ran. This cannot be granted by a rule, an automation mode, a remembered approval or a skill; run it in a session where a person can be asked."
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* What the model is told when a batch runs a command whose own program name
|
|
216
|
+
* is decided at runtime and nobody can be asked.
|
|
217
|
+
*
|
|
218
|
+
* Refused rather than approved by `auto`: no rule, allow, grant or
|
|
219
|
+
* unattended setting can vouch for a program nobody can read the name of
|
|
220
|
+
* before it runs — unlike a sandbox escape, there is no equivalent
|
|
221
|
+
* "unattended allow" for this.
|
|
222
|
+
*/
|
|
223
|
+
export const UNKNOWN_PROGRAM_UNATTENDED_REFUSAL =
|
|
224
|
+
'Refused: a call in this batch runs a command whose own program name is decided at runtime (a substitution or a variable stands for it), which needs a person to approve it each time, and nobody can be asked in this session. Nothing in this batch ran. Write the program name literally; compute what needs computing in the arguments instead.'
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* What the model is told when a batch would show it the operator's screen for
|
|
228
|
+
* the first time in a session and nobody can be asked.
|
|
229
|
+
*/
|
|
230
|
+
export const SCREEN_CONSENT_UNATTENDED_REFUSAL =
|
|
231
|
+
"Refused: this call would send what is on the user's screen to the model provider, which a person agrees to once per session, and nobody can be asked in this session. Nothing in this batch ran. Tell the user computer use needs their consent in an interactive session."
|
|
232
|
+
|
|
233
|
+
/** What the model is told when the operator declines to share the screen. */
|
|
234
|
+
export const SCREEN_CONSENT_DECLINED_FEEDBACK =
|
|
235
|
+
'The user declined to share their screen in this session. Nothing in this batch ran. Do not take screenshots or read windows again; ask the user how they want to proceed.'
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The sessions whose operator agreed to let the model see the screen.
|
|
239
|
+
*
|
|
240
|
+
* A host keeps one for as long as its sessions live and hands the same box to
|
|
241
|
+
* every policy it builds, so a mode switch keeps the answer and a new session
|
|
242
|
+
* (a different id) is asked again. The policy only adds to it.
|
|
243
|
+
*/
|
|
244
|
+
export interface ScreenConsentRecord {
|
|
245
|
+
readonly sessions: Set<string>
|
|
246
|
+
}
|
|
247
|
+
|
|
200
248
|
/** The batch a person is asked about. */
|
|
201
249
|
export interface ToolReviewRequest {
|
|
202
250
|
/** Originating session, preserved by createReviewHandler for host attribution. */
|
|
@@ -204,6 +252,14 @@ export interface ToolReviewRequest {
|
|
|
204
252
|
/** Originating turn, preserved by createReviewHandler for host attribution. */
|
|
205
253
|
readonly turnId?: TurnId
|
|
206
254
|
readonly toolCalls: readonly ToolCallSummary[]
|
|
255
|
+
/**
|
|
256
|
+
* This batch would send the screen to the model provider for the first
|
|
257
|
+
* time in the session (see {@link ReviewPolicyOptions.screenConsent}).
|
|
258
|
+
* The question is whether the model may see the screen for the rest of
|
|
259
|
+
* the session; a yes also approves this batch, and later screen captures
|
|
260
|
+
* in the session run without asking.
|
|
261
|
+
*/
|
|
262
|
+
readonly screenConsent?: true
|
|
207
263
|
}
|
|
208
264
|
|
|
209
265
|
export type ToolReviewAnswer =
|
|
@@ -221,7 +277,7 @@ export interface ReviewPolicyOptions {
|
|
|
221
277
|
readonly prompt?: ToolReviewPrompt
|
|
222
278
|
/** Which calls skip review; default `isReviewExempt` over `registry`, or nothing without one. */
|
|
223
279
|
readonly exempt?: ReviewExemption
|
|
224
|
-
readonly registry?: Pick<
|
|
280
|
+
readonly registry?: Pick<ToolManager, 'get' | 'sourceOf'>
|
|
225
281
|
/**
|
|
226
282
|
* Where "approve all" is remembered. A host that shows the state (a
|
|
227
283
|
* badge saying the session is unattended) passes its own box so both
|
|
@@ -250,6 +306,24 @@ export interface ReviewPolicyOptions {
|
|
|
250
306
|
* either way.
|
|
251
307
|
*/
|
|
252
308
|
readonly skillGrants?: 'honour' | 'ignore'
|
|
309
|
+
/**
|
|
310
|
+
* Ask once per session before the model first sees the screen.
|
|
311
|
+
*
|
|
312
|
+
* With a record, a batch holding a call that captures the screen
|
|
313
|
+
* ({@link capturesScreen}) in a session not yet in `sessions` is put to
|
|
314
|
+
* a person first, as a {@link ToolReviewRequest.screenConsent} request,
|
|
315
|
+
* even when every call in it only reads: in `prompt`, `accept-edits` and
|
|
316
|
+
* `plan`. A yes adds the session; a no refuses the batch. `strict`
|
|
317
|
+
* refuses such a call unless a rule allowed it, `auto` never asks, and a
|
|
318
|
+
* policy without a `prompt` refuses. A call a rule allowed is never
|
|
319
|
+
* asked about. Omitted, the screen is treated like any other read.
|
|
320
|
+
*/
|
|
321
|
+
readonly screenConsent?: ScreenConsentRecord
|
|
322
|
+
/**
|
|
323
|
+
* Which calls capture the screen. Default: the tool's own
|
|
324
|
+
* `capturesScreen` declaration, read from `registry`; nothing without one.
|
|
325
|
+
*/
|
|
326
|
+
readonly capturesScreen?: (name: string, input: unknown) => boolean
|
|
253
327
|
}
|
|
254
328
|
|
|
255
329
|
/**
|
|
@@ -264,7 +338,8 @@ function isSkillGranted(tc: ToolCallSummary): boolean {
|
|
|
264
338
|
!tc.authorization?.explicitReview &&
|
|
265
339
|
tc.authorization?.decision !== 'deny' &&
|
|
266
340
|
!tc.isDestructive &&
|
|
267
|
-
tc.escalation === undefined
|
|
341
|
+
tc.escalation === undefined &&
|
|
342
|
+
tc.requiresApproval !== true
|
|
268
343
|
)
|
|
269
344
|
}
|
|
270
345
|
|
|
@@ -276,10 +351,61 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
276
351
|
options.exempt ??
|
|
277
352
|
(registry ? (name, input) => isReviewExempt(registry, name, input) : () => false)
|
|
278
353
|
const remembered = options.remembered ?? { all: false }
|
|
354
|
+
const capturesScreen =
|
|
355
|
+
options.capturesScreen ??
|
|
356
|
+
(registry
|
|
357
|
+
? (name: string, input: unknown) => {
|
|
358
|
+
const tool = registry.get(name) ?? registry.get(name.toLowerCase())
|
|
359
|
+
return tool?.capturesScreen?.(input) === true
|
|
360
|
+
}
|
|
361
|
+
: () => false)
|
|
279
362
|
return async (request): Promise<HITLResumeDecision> => {
|
|
280
363
|
if (request.type !== 'tool_review') {
|
|
281
364
|
return request.type === 'plan_approval' ? { action: 'approve_plan' } : { action: 'continue' }
|
|
282
365
|
}
|
|
366
|
+
// The one answer a person gives for this batch. The screen question
|
|
367
|
+
// below shows the whole batch, so its yes also answers any question
|
|
368
|
+
// the rest of this function would ask; nobody is asked twice.
|
|
369
|
+
let answered: ToolReviewAnswer | undefined
|
|
370
|
+
const ask = async (screenConsent?: true): Promise<ToolReviewAnswer> =>
|
|
371
|
+
answered ??
|
|
372
|
+
(prompt as ToolReviewPrompt)({
|
|
373
|
+
sessionId: request.sessionId,
|
|
374
|
+
turnId: request.turnId,
|
|
375
|
+
toolCalls: request.toolCalls,
|
|
376
|
+
...(screenConsent ? { screenConsent } : {}),
|
|
377
|
+
})
|
|
378
|
+
// The first look at the screen in a session is the operator's to allow:
|
|
379
|
+
// what is on it goes to the model provider, and a screenshot reads as
|
|
380
|
+
// harmlessly as a file read to every rule below. Asked once, in the
|
|
381
|
+
// modes where a person decides; a rule that allowed the call already
|
|
382
|
+
// said yes, and a call a rule denied will not run.
|
|
383
|
+
const consent = options.screenConsent
|
|
384
|
+
const sessionKey = String(request.sessionId ?? '')
|
|
385
|
+
if (
|
|
386
|
+
consent &&
|
|
387
|
+
mode !== 'auto' &&
|
|
388
|
+
!consent.sessions.has(sessionKey) &&
|
|
389
|
+
request.toolCalls.some(
|
|
390
|
+
(tc) =>
|
|
391
|
+
tc.authorization?.decision !== 'allow' &&
|
|
392
|
+
tc.authorization?.decision !== 'deny' &&
|
|
393
|
+
capturesScreen(tc.name, tc.input),
|
|
394
|
+
)
|
|
395
|
+
) {
|
|
396
|
+
if (mode === 'strict') return { action: 'reject_tools', feedback: STRICT_MODE_REFUSAL }
|
|
397
|
+
if (!prompt) return { action: 'reject_tools', feedback: SCREEN_CONSENT_UNATTENDED_REFUSAL }
|
|
398
|
+
const answer = await ask(true)
|
|
399
|
+
if (answer.kind === 'reject') {
|
|
400
|
+
return {
|
|
401
|
+
action: 'reject_tools',
|
|
402
|
+
feedback: answer.feedback ?? SCREEN_CONSENT_DECLINED_FEEDBACK,
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
consent.sessions.add(sessionKey)
|
|
406
|
+
if (answer.kind === 'approve-all') remembered.all = true
|
|
407
|
+
answered = answer
|
|
408
|
+
}
|
|
283
409
|
if (!batchNeedsReview(request.toolCalls, exempt)) {
|
|
284
410
|
return { action: 'approve_tools' }
|
|
285
411
|
}
|
|
@@ -295,6 +421,7 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
295
421
|
!tc.authorization?.explicitReview &&
|
|
296
422
|
tc.escalation === undefined &&
|
|
297
423
|
!tc.isDestructive &&
|
|
424
|
+
tc.requiresApproval !== true &&
|
|
298
425
|
(ACCEPT_EDITS_TOOLS.has(tc.name) || exempt(tc.name, tc.input)),
|
|
299
426
|
)
|
|
300
427
|
) {
|
|
@@ -322,15 +449,24 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
322
449
|
.map((tc) => tc.id)
|
|
323
450
|
if (escapes.length > 0) {
|
|
324
451
|
if (!prompt) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
452
|
+
if (options.unattendedSandboxEscape !== 'allow') {
|
|
453
|
+
return { action: 'reject_tools', feedback: SANDBOX_ESCAPE_UNATTENDED_REFUSAL }
|
|
454
|
+
}
|
|
455
|
+
// This opt-in confirms only the sandbox escape. A different call in
|
|
456
|
+
// the batch, or another boundary on this same call, still needs a
|
|
457
|
+
// person; the early return must not approve that boundary too.
|
|
458
|
+
if (request.toolCalls.some((tc) => (tc.escalation?.outsidePaths?.length ?? 0) > 0)) {
|
|
459
|
+
return { action: 'reject_tools', feedback: OUTSIDE_ROOTS_UNATTENDED_REFUSAL }
|
|
460
|
+
}
|
|
461
|
+
if (request.toolCalls.some((tc) => tc.requiresApproval === true)) {
|
|
462
|
+
return { action: 'reject_tools', feedback: REQUIRES_APPROVAL_UNATTENDED_REFUSAL }
|
|
463
|
+
}
|
|
464
|
+
if (request.toolCalls.some((tc) => tc.escalation?.unknownProgram !== undefined)) {
|
|
465
|
+
return { action: 'reject_tools', feedback: UNKNOWN_PROGRAM_UNATTENDED_REFUSAL }
|
|
466
|
+
}
|
|
467
|
+
return { action: 'approve_tools', confirmedEscalations: escapes }
|
|
328
468
|
}
|
|
329
|
-
const answer = await
|
|
330
|
-
sessionId: request.sessionId,
|
|
331
|
-
turnId: request.turnId,
|
|
332
|
-
toolCalls: request.toolCalls,
|
|
333
|
-
})
|
|
469
|
+
const answer = await ask()
|
|
334
470
|
if (answer.kind === 'reject') {
|
|
335
471
|
return {
|
|
336
472
|
action: 'reject_tools',
|
|
@@ -348,11 +484,7 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
348
484
|
// With nobody to ask it is refused, not approved.
|
|
349
485
|
if (request.toolCalls.some((tc) => (tc.escalation?.outsidePaths?.length ?? 0) > 0)) {
|
|
350
486
|
if (!prompt) return { action: 'reject_tools', feedback: OUTSIDE_ROOTS_UNATTENDED_REFUSAL }
|
|
351
|
-
const answer = await
|
|
352
|
-
sessionId: request.sessionId,
|
|
353
|
-
turnId: request.turnId,
|
|
354
|
-
toolCalls: request.toolCalls,
|
|
355
|
-
})
|
|
487
|
+
const answer = await ask()
|
|
356
488
|
if (answer.kind === 'reject') {
|
|
357
489
|
return {
|
|
358
490
|
action: 'reject_tools',
|
|
@@ -363,6 +495,43 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
363
495
|
if (answer.kind === 'approve-all') remembered.all = true
|
|
364
496
|
return { action: 'approve_tools' }
|
|
365
497
|
}
|
|
498
|
+
// A call the tool itself declared always needs a person's approval is
|
|
499
|
+
// asked about every time, in every mode that got this far — `auto`
|
|
500
|
+
// and a remembered "approve all" included, for the same reason an
|
|
501
|
+
// escape or a path outside the roots is: the tool author's
|
|
502
|
+
// declaration travels with the tool, and no rule, mode or remembered
|
|
503
|
+
// grant was ever an answer to IT specifically.
|
|
504
|
+
if (request.toolCalls.some((tc) => tc.requiresApproval === true)) {
|
|
505
|
+
if (!prompt) return { action: 'reject_tools', feedback: REQUIRES_APPROVAL_UNATTENDED_REFUSAL }
|
|
506
|
+
const answer = await ask()
|
|
507
|
+
if (answer.kind === 'reject') {
|
|
508
|
+
return {
|
|
509
|
+
action: 'reject_tools',
|
|
510
|
+
feedback: answer.feedback ?? DECLINED_TOOL_CALL_FEEDBACK,
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (answer.kind === 'approve-all') remembered.all = true
|
|
514
|
+
return { action: 'approve_tools' }
|
|
515
|
+
}
|
|
516
|
+
// A command whose own program name is decided at runtime is a
|
|
517
|
+
// question for a person, every time, for the same reason: no rule, no
|
|
518
|
+
// remembered grant and no unattended mode can vouch for a program
|
|
519
|
+
// nobody can read the name of before it runs. There is no
|
|
520
|
+
// "unattended allow" setting for this the way there is for a sandbox
|
|
521
|
+
// escape — an operator who wants this can only write the program
|
|
522
|
+
// name literally.
|
|
523
|
+
if (request.toolCalls.some((tc) => tc.escalation?.unknownProgram !== undefined)) {
|
|
524
|
+
if (!prompt) return { action: 'reject_tools', feedback: UNKNOWN_PROGRAM_UNATTENDED_REFUSAL }
|
|
525
|
+
const answer = await ask()
|
|
526
|
+
if (answer.kind === 'reject') {
|
|
527
|
+
return {
|
|
528
|
+
action: 'reject_tools',
|
|
529
|
+
feedback: answer.feedback ?? DECLINED_TOOL_CALL_FEEDBACK,
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (answer.kind === 'approve-all') remembered.all = true
|
|
533
|
+
return { action: 'approve_tools' }
|
|
534
|
+
}
|
|
366
535
|
if (mode === 'auto' || !prompt || remembered.all) {
|
|
367
536
|
return { action: 'approve_tools' }
|
|
368
537
|
}
|
|
@@ -383,6 +552,7 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
383
552
|
),
|
|
384
553
|
)
|
|
385
554
|
if (
|
|
555
|
+
answered === undefined &&
|
|
386
556
|
options.skillGrants !== 'ignore' &&
|
|
387
557
|
needsPerson.length > 0 &&
|
|
388
558
|
needsPerson.every(isSkillGranted)
|
|
@@ -392,11 +562,7 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
392
562
|
skillGranted: needsPerson.map((tc) => tc.id),
|
|
393
563
|
}
|
|
394
564
|
}
|
|
395
|
-
const answer = await
|
|
396
|
-
sessionId: request.sessionId,
|
|
397
|
-
turnId: request.turnId,
|
|
398
|
-
toolCalls: request.toolCalls,
|
|
399
|
-
})
|
|
565
|
+
const answer = await ask()
|
|
400
566
|
switch (answer.kind) {
|
|
401
567
|
case 'approve':
|
|
402
568
|
return { action: 'approve_tools' }
|
|
@@ -2,16 +2,13 @@ import type { AuthorizationGate } from '../../authorization/gate.js'
|
|
|
2
2
|
import type { SkillGrantSet } from '../../authorization/skill-grant.js'
|
|
3
3
|
import type { PluginLifecycleManager } from '../../plugin/lifecycle.js'
|
|
4
4
|
import type { ActivityStore } from '../../store/activity/memory.js'
|
|
5
|
+
import type { ToolManager } from '../../toolsets/manager.js'
|
|
5
6
|
import type { SessionId, TurnId } from '../../types/ids/index.js'
|
|
6
7
|
import type { InvocationState } from '../../types/invocation/index.js'
|
|
7
8
|
import type { PermissionMode } from '../../types/permission/index.js'
|
|
8
9
|
import type { AuditEventInput } from '../../types/session/audit.js'
|
|
9
10
|
import type { SessionRecord } from '../../types/session/records.js'
|
|
10
|
-
import type {
|
|
11
|
-
RequestToolPause,
|
|
12
|
-
SkillRegistryRef,
|
|
13
|
-
ToolRegistryContract,
|
|
14
|
-
} from '../../types/tool/index.js'
|
|
11
|
+
import type { RequestToolPause, SkillRegistryRef } from '../../types/tool/index.js'
|
|
15
12
|
import type { RepairToolCall } from '../../types/tool/repair.js'
|
|
16
13
|
import type { BackoffPolicy } from '../../utils/backoff.js'
|
|
17
14
|
import type { Logger } from '../../utils/logger.js'
|
|
@@ -22,7 +19,7 @@ import type { EmitEvent } from './events.js'
|
|
|
22
19
|
|
|
23
20
|
export interface ToolingBootstrapConfig {
|
|
24
21
|
fileReadTracker?: import('../../types/tool/index.js').FileReadTracker
|
|
25
|
-
tools:
|
|
22
|
+
tools: ToolManager
|
|
26
23
|
sessionId: SessionId
|
|
27
24
|
turnId: TurnId
|
|
28
25
|
workingDirectory: string
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertSessionLogAttribution } from '../../manager/session/attribution.js'
|
|
1
2
|
import type { TurnRecorder } from '../../manager/session/turn-recorder.js'
|
|
2
3
|
import type { SessionCheckpointStore } from '../../store/checkpoint/index.js'
|
|
3
4
|
import type { SessionLog } from '../../store/session-log/index.js'
|
|
@@ -113,6 +114,9 @@ export async function loadSelectedTurnContext(
|
|
|
113
114
|
readonly checkpoint: Checkpoint
|
|
114
115
|
readonly messageIds: ReadonlyMap<Message, MessageId>
|
|
115
116
|
} | null> {
|
|
117
|
+
// A checkpoint scope is supplied by the caller; prove that it owns the
|
|
118
|
+
// source log before finding a park or reading a checkpoint document.
|
|
119
|
+
if (!(await assertSessionLogAttribution(log, scope))) return null
|
|
116
120
|
const storeScope = {
|
|
117
121
|
tenantId: scope.tenantId,
|
|
118
122
|
projectId: scope.projectId,
|