@namzu/sdk 46.0.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 +325 -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 +8 -0
- package/dist/authorization/gate.d.ts.map +1 -1
- package/dist/authorization/gate.js +12 -1
- 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 +8 -1
- package/dist/authorization/rules.js.map +1 -1
- package/dist/authorization/shell-lexer.d.ts +19 -4
- package/dist/authorization/shell-lexer.d.ts.map +1 -1
- package/dist/authorization/shell-lexer.js +91 -65
- 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/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 +24 -11
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +45 -9
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +6 -4
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +8 -3
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +13 -2
- 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 +7 -7
- package/dist/registry/tool/callable.d.ts.map +1 -1
- package/dist/registry/tool/callable.js +6 -7
- package/dist/registry/tool/callable.js.map +1 -1
- 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 -727
- 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 +45 -2
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +189 -5
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +33 -3
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +86 -10
- 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 +22 -3
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +84 -6
- 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 +12 -0
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +19 -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.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +19 -11
- 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/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/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 +10 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +17 -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/schedule-tool.d.ts.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +94 -14
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/schedules/types.d.ts +52 -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 +49 -12
- package/dist/types/authorization/index.d.ts.map +1 -1
- package/dist/types/authorization/index.js +6 -0
- package/dist/types/authorization/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 +152 -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 +1 -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 +21 -1
- package/src/authorization/program.ts +773 -0
- package/src/authorization/reexec-wrapper.ts +589 -0
- package/src/authorization/rules.ts +18 -1
- package/src/authorization/shell-lexer.ts +104 -59
- 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/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 +136 -7
- package/src/public-tools.ts +24 -4
- package/src/public-types.ts +60 -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 +8 -9
- package/src/registry/tool/execute.ts +16 -846
- 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 +228 -6
- package/src/runtime/query/executor.ts +110 -12
- 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 +87 -9
- 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 +25 -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.ts +21 -11
- package/src/tools/builtins/edit.ts +12 -2
- package/src/tools/builtins/json-string-hint.ts +16 -0
- package/src/tools/builtins/search-tools.ts +7 -20
- 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 +28 -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/schedule-tool.ts +107 -14
- package/src/tools/schedules/types.ts +52 -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 +12 -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 +154 -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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Match a hierarchical source id against a glob pattern.
|
|
3
|
+
*
|
|
4
|
+
* Source ids are strings like `mcp:github`, `plugin:acme`,
|
|
5
|
+
* `plugin:acme/mcp:db` (plan.md §1) — no filesystem semantics, so this is
|
|
6
|
+
* not a path glob: `*` matches any run of characters, including `/` and
|
|
7
|
+
* `:`, so `plugin:acme/*` matches `plugin:acme/mcp:db` in one step. There
|
|
8
|
+
* is no `**`, `?` or character class — the id space does not need them, and
|
|
9
|
+
* a smaller matcher is one with no surprising cases to test.
|
|
10
|
+
*
|
|
11
|
+
* A pattern with no `*` is an exact match, so callers never have to special
|
|
12
|
+
* case "no wildcard" themselves.
|
|
13
|
+
*/
|
|
14
|
+
export function matchesSourceIdGlob(id: string, pattern: string): boolean {
|
|
15
|
+
if (!pattern.includes('*')) return id === pattern
|
|
16
|
+
const escaped = pattern.split('*').map(escapeRegExpLiteral).join('.*')
|
|
17
|
+
return new RegExp(`^${escaped}$`).test(id)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function escapeRegExpLiteral(literal: string): string {
|
|
21
|
+
return literal.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ToolDefinition } from '../types/tool/index.js'
|
|
2
|
+
import type { ToolSource, Toolset } from './types.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The plain, static `Toolset`: a fixed list of tools from one source.
|
|
6
|
+
*
|
|
7
|
+
* A bare string source is shorthand for a `host_tool` source with that
|
|
8
|
+
* string as both `id` and `name` — the common case for a small, in-process
|
|
9
|
+
* bundle of tools ("builtin", "memory") that has no separate discovery
|
|
10
|
+
* metadata worth writing out. Anything that needs a real `kind`
|
|
11
|
+
* (`mcp_server`, `plugin`, …) passes a full {@link ToolSource}; string
|
|
12
|
+
* shorthand never guesses a kind from the text of the id.
|
|
13
|
+
*
|
|
14
|
+
* The tools array is snapshotted once, at construction, so a caller that
|
|
15
|
+
* mutates the array it passed in afterward cannot change what this toolset
|
|
16
|
+
* reports. There is no `onChange`: a plain toolset never changes on its
|
|
17
|
+
* own — wrap it with a live source (a future MCP toolset) or rebuild it
|
|
18
|
+
* with a new snapshot instead.
|
|
19
|
+
*/
|
|
20
|
+
export function toolset(source: ToolSource | string, tools: readonly ToolDefinition[]): Toolset {
|
|
21
|
+
const resolvedSource = typeof source === 'string' ? hostToolSource(source) : source
|
|
22
|
+
const snapshot = tools.slice()
|
|
23
|
+
return {
|
|
24
|
+
source: resolvedSource,
|
|
25
|
+
tools: () => snapshot,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function hostToolSource(id: string): ToolSource {
|
|
30
|
+
return { id, kind: 'host_tool', name: id }
|
|
31
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { ToolDefinition } from '../types/tool/index.js'
|
|
2
|
+
import type { ToolSource, ToolSourceKind } from '../types/toolset/index.js'
|
|
3
|
+
|
|
4
|
+
// Re-exported so the rest of `toolsets/` can `import type { ToolSource }
|
|
5
|
+
// from './types.js'` and never reach past this module's own boundary.
|
|
6
|
+
// `public-types.ts` already exports these from `types/toolset/index.js`
|
|
7
|
+
// directly, and lists this module's OWN new names explicitly (not `export
|
|
8
|
+
// type *`), so this re-export does not create a duplicate public export.
|
|
9
|
+
export type { ToolSource, ToolSourceKind }
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A toolset's own default for the tools it contributes.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately narrower than {@link ToolAvailability} (`'active' |
|
|
15
|
+
* 'deferred' | 'suspended'`): `'suspended'` is derived from a host readiness
|
|
16
|
+
* check, not a static declaration. Absent means `'active'`.
|
|
17
|
+
*/
|
|
18
|
+
export type ToolsetAvailability = 'active' | 'deferred'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The unit every tool comes from.
|
|
22
|
+
*
|
|
23
|
+
* A `Toolset` is a value, not a registration: `toolset()`, every wrapper
|
|
24
|
+
* below, and `combineToolsets` all return one without touching any shared
|
|
25
|
+
* state. The runtime resolves it through a `ToolManager` when a turn starts.
|
|
26
|
+
*/
|
|
27
|
+
export interface Toolset {
|
|
28
|
+
/** Where these tools come from. Ownership and trust stay with this. */
|
|
29
|
+
readonly source: ToolSource
|
|
30
|
+
/**
|
|
31
|
+
* The current snapshot, in a deterministic order.
|
|
32
|
+
*
|
|
33
|
+
* Called fresh whenever a caller wants the current tools — a wrapper
|
|
34
|
+
* re-derives its mapping/filtering on every call rather than caching,
|
|
35
|
+
* so a live inner toolset's change is visible the moment `tools()` is
|
|
36
|
+
* called again, with no separate invalidation step.
|
|
37
|
+
*/
|
|
38
|
+
tools(): readonly ToolDefinition[]
|
|
39
|
+
/**
|
|
40
|
+
* This toolset's default for tools it contributes. Absent means
|
|
41
|
+
* `'active'`. A wrapper composes this along with everything else: see
|
|
42
|
+
* {@link deferred}.
|
|
43
|
+
*/
|
|
44
|
+
readonly availability?: ToolsetAvailability
|
|
45
|
+
/**
|
|
46
|
+
* Host-owned readiness, independent of whether the model has loaded a
|
|
47
|
+
* deferred schema. A false (or throwing) check keeps every tool in this
|
|
48
|
+
* source out of discovery, prompts and execution. Read fresh on each use.
|
|
49
|
+
*/
|
|
50
|
+
readonly isReady?: () => boolean
|
|
51
|
+
/**
|
|
52
|
+
* Subscribe to "the next `tools()` call may return something different"
|
|
53
|
+
* — an MCP server's `list_changed`, for instance. Returns the
|
|
54
|
+
* unsubscribe function. Absent means this toolset never changes on its
|
|
55
|
+
* own (a plain {@link toolset} never does).
|
|
56
|
+
*
|
|
57
|
+
* A wrapper or {@link combineToolsets} that wraps a live toolset forwards
|
|
58
|
+
* this by calling the inner `onChange` with the same listener, so a
|
|
59
|
+
* change three layers down reaches a listener on the outermost toolset,
|
|
60
|
+
* and unsubscribing at the outer layer unsubscribes at every inner one.
|
|
61
|
+
*/
|
|
62
|
+
onChange?(listener: () => void): () => void
|
|
63
|
+
/** Release whatever this toolset holds open (a connection, a watcher). */
|
|
64
|
+
close?(): Promise<void>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** A broken readiness check must never expose the tools it guards. */
|
|
68
|
+
export function toolsetIsReady(ts: Toolset): boolean {
|
|
69
|
+
try {
|
|
70
|
+
return ts.isReady?.() ?? true
|
|
71
|
+
} catch {
|
|
72
|
+
return false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A lean reference to the toolset that contributed a tool.
|
|
78
|
+
* `ToolManager.sourceOf(name)` derives it from the owning toolset; no source
|
|
79
|
+
* pointer is stored on the `ToolDefinition` itself.
|
|
80
|
+
*/
|
|
81
|
+
export interface ToolSourceRef {
|
|
82
|
+
readonly id: string
|
|
83
|
+
readonly kind: ToolSourceKind
|
|
84
|
+
/** Only set when `kind` is `'mcp_server'`: the connected server's configured name. */
|
|
85
|
+
readonly server?: string
|
|
86
|
+
/**
|
|
87
|
+
* Only set when `kind` is `'mcp_server'`. See `ToolProvenance.readOnlyHintTrusted`
|
|
88
|
+
* (`types/tool/index.ts`) — same meaning, carried on the source instead of
|
|
89
|
+
* duplicated onto every tool the source contributes.
|
|
90
|
+
*/
|
|
91
|
+
readonly readOnlyHintTrusted?: boolean
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Project a `ToolSource` down to the lean reference returned by
|
|
96
|
+
* `ToolManager.sourceOf(name)`. Pure; reads nothing but its arguments.
|
|
97
|
+
*
|
|
98
|
+
* `readOnlyHintTrusted` defaults to `source.mcpServer?.readOnlyHintTrusted`
|
|
99
|
+
* — the operator's per-server trust decision, wired by whatever built this
|
|
100
|
+
* `ToolSource` (`mcpToolset`, plan.md §4). The `mcp` parameter overrides that
|
|
101
|
+
* default rather than being the only channel for it: a caller that already
|
|
102
|
+
* has the decision in hand some other way (a test, a wrapper) may still pass
|
|
103
|
+
* it explicitly, but `sourceOf` (`toolsets/manager.ts`) relies on the
|
|
104
|
+
* default so a trusted server's tools resolve as trusted with no extra
|
|
105
|
+
* wiring at the call site.
|
|
106
|
+
*/
|
|
107
|
+
export function toToolSourceRef(
|
|
108
|
+
source: ToolSource,
|
|
109
|
+
mcp?: { readonly readOnlyHintTrusted: boolean },
|
|
110
|
+
): ToolSourceRef {
|
|
111
|
+
if (source.kind !== 'mcp_server') return { id: source.id, kind: source.kind }
|
|
112
|
+
return {
|
|
113
|
+
id: source.id,
|
|
114
|
+
kind: source.kind,
|
|
115
|
+
server: source.mcpServer?.name ?? source.name,
|
|
116
|
+
readOnlyHintTrusted: mcp?.readOnlyHintTrusted ?? source.mcpServer?.readOnlyHintTrusted ?? false,
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A synchronous test over one tool, for {@link filtered} and
|
|
122
|
+
* {@link requireApproval}.
|
|
123
|
+
*
|
|
124
|
+
* `source` is the CONTRIBUTING TOOLSET's own source (`ts.source` projected
|
|
125
|
+
* through {@link toToolSourceRef}) — not a source declared by a tool
|
|
126
|
+
* definition (see {@link ToolFilterSelector}'s note on `sourceIdGlob`). A
|
|
127
|
+
* predicate that
|
|
128
|
+
* needs to tell a trusted MCP server's tool from an untrusted one's (the
|
|
129
|
+
* `isTrustedReadOnly` recipe in `tools/roster.ts`) reads this — which is
|
|
130
|
+
* correct for a plain, single-source toolset, and why that recipe must run
|
|
131
|
+
* on each contributing toolset before {@link combineToolsets} merges them:
|
|
132
|
+
* applied to an already-combined multi-source toolset, `source` is the
|
|
133
|
+
* COMBINED umbrella source, not any one contributor's, and a predicate that
|
|
134
|
+
* trusts it that far trusts every contributor equally.
|
|
135
|
+
*/
|
|
136
|
+
export type ToolPredicate = (tool: ToolDefinition, source: ToolSourceRef) => boolean
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* What `filtered` (and `requireApproval`'s optional selector) may match on.
|
|
140
|
+
*
|
|
141
|
+
* `sourceIdGlob` matches the WHOLE toolset's own {@link ToolSource.id}
|
|
142
|
+
* (glob syntax: {@link matchesSourceIdGlob}) — not a per-tool source.
|
|
143
|
+
* A toolset is one source, so this keeps every tool the toolset contributes
|
|
144
|
+
* when the glob matches, and none when it does not.
|
|
145
|
+
*
|
|
146
|
+
* `metadata` is a deep-match against `ToolDefinition.metadata`: every key in
|
|
147
|
+
* the pattern must be present and equal (or, for a nested plain object,
|
|
148
|
+
* recursively matched) on the tool's own metadata. A tool with no metadata
|
|
149
|
+
* never matches a metadata selector.
|
|
150
|
+
*/
|
|
151
|
+
export type ToolFilterSelector =
|
|
152
|
+
| readonly string[]
|
|
153
|
+
| { readonly metadata: Readonly<Record<string, unknown>> }
|
|
154
|
+
| { readonly sourceIdGlob: string }
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { matchesToolSelector } from '../tools/roster.js'
|
|
2
|
+
import type { ToolDefinition } from '../types/tool/index.js'
|
|
3
|
+
import { matchesSourceIdGlob } from './source-glob.js'
|
|
4
|
+
import {
|
|
5
|
+
type ToolFilterSelector,
|
|
6
|
+
type ToolPredicate,
|
|
7
|
+
type Toolset,
|
|
8
|
+
type ToolsetAvailability,
|
|
9
|
+
toToolSourceRef,
|
|
10
|
+
} from './types.js'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Build a derived `Toolset` that keeps the inner toolset's `source`,
|
|
14
|
+
* `availability` (unless overridden) and live-update wiring (`onChange`,
|
|
15
|
+
* `close`), forwarded rather than re-implemented.
|
|
16
|
+
*
|
|
17
|
+
* Every wrapper in this file goes through this one function, so "keep the
|
|
18
|
+
* inner source", "forward `onChange` through every layer" and "clean up
|
|
19
|
+
* `close`" are each written exactly once.
|
|
20
|
+
*/
|
|
21
|
+
function deriveToolset(
|
|
22
|
+
ts: Toolset,
|
|
23
|
+
overrides: {
|
|
24
|
+
tools?: () => readonly ToolDefinition[]
|
|
25
|
+
availability?: ToolsetAvailability
|
|
26
|
+
isReady?: () => boolean
|
|
27
|
+
},
|
|
28
|
+
): Toolset {
|
|
29
|
+
const derived: Toolset = {
|
|
30
|
+
source: ts.source,
|
|
31
|
+
tools: overrides.tools ?? (() => ts.tools()),
|
|
32
|
+
availability: overrides.availability ?? ts.availability,
|
|
33
|
+
isReady: overrides.isReady ?? ts.isReady,
|
|
34
|
+
}
|
|
35
|
+
if (ts.onChange) {
|
|
36
|
+
// A direct forward: calling the derived toolset's `onChange` subscribes
|
|
37
|
+
// the inner one with the same listener and hands back ITS unsubscribe,
|
|
38
|
+
// so a change three layers down reaches the outermost listener, and
|
|
39
|
+
// unsubscribing at any layer tears down exactly that subscription.
|
|
40
|
+
const innerOnChange = ts.onChange
|
|
41
|
+
derived.onChange = (listener) => innerOnChange(listener)
|
|
42
|
+
}
|
|
43
|
+
if (ts.close) {
|
|
44
|
+
const innerClose = ts.close
|
|
45
|
+
derived.close = () => innerClose()
|
|
46
|
+
}
|
|
47
|
+
return derived
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Apply `fn` to every tool this toolset contributes, recomputed on every
|
|
52
|
+
* `tools()` call (no caching) so a live inner toolset's change is visible
|
|
53
|
+
* immediately. Every other wrapper below is written in terms of this one.
|
|
54
|
+
*/
|
|
55
|
+
export function mapTools(ts: Toolset, fn: (tool: ToolDefinition) => ToolDefinition): Toolset {
|
|
56
|
+
return deriveToolset(ts, { tools: () => ts.tools().map(fn) })
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Prepend `prefix` to every tool's name. `execute` and every other field are untouched. */
|
|
60
|
+
export function prefixed(ts: Toolset, prefix: string): Toolset {
|
|
61
|
+
const cache = new WeakMap<ToolDefinition, ToolDefinition>()
|
|
62
|
+
return deriveToolset(ts, {
|
|
63
|
+
tools: () =>
|
|
64
|
+
ts.tools().map((tool) => {
|
|
65
|
+
let renamed = cache.get(tool)
|
|
66
|
+
if (!renamed) {
|
|
67
|
+
renamed = { ...tool, name: `${prefix}${tool.name}` }
|
|
68
|
+
cache.set(tool, renamed)
|
|
69
|
+
}
|
|
70
|
+
return renamed
|
|
71
|
+
}),
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Rename the tools named as keys in `names` to their mapped value. A tool
|
|
77
|
+
* whose name is not a key keeps its name. `execute` and every other field
|
|
78
|
+
* are untouched — only `name` changes.
|
|
79
|
+
*/
|
|
80
|
+
export function renamed(ts: Toolset, names: Readonly<Record<string, string>>): Toolset {
|
|
81
|
+
return mapTools(ts, (tool) => {
|
|
82
|
+
const next = names[tool.name]
|
|
83
|
+
return next === undefined ? tool : { ...tool, name: next }
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Keep only the tools `selector` (or `predicate`) admits.
|
|
89
|
+
*
|
|
90
|
+
* See {@link ToolFilterSelector} for what a non-function selector can match
|
|
91
|
+
* on. A `sourceIdGlob` selector is all-or-nothing per toolset — it tests
|
|
92
|
+
* this toolset's own `source.id`, not a per-tool source. A function
|
|
93
|
+
* `predicate` is handed `ts.source` (projected through
|
|
94
|
+
* {@link toToolSourceRef}) as its second argument for the same reason —
|
|
95
|
+
* see {@link ToolPredicate}'s note on what that source means, and does not
|
|
96
|
+
* mean, once toolsets have been combined.
|
|
97
|
+
*/
|
|
98
|
+
export function filtered(ts: Toolset, selector: ToolFilterSelector | ToolPredicate): Toolset {
|
|
99
|
+
const predicate = toPredicate(ts, selector)
|
|
100
|
+
const source = toToolSourceRef(ts.source)
|
|
101
|
+
return deriveToolset(ts, {
|
|
102
|
+
tools: () => ts.tools().filter((tool) => predicate(tool, source)),
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function toPredicate(ts: Toolset, selector: ToolFilterSelector | ToolPredicate): ToolPredicate {
|
|
107
|
+
if (typeof selector === 'function') return selector
|
|
108
|
+
if (Array.isArray(selector)) {
|
|
109
|
+
const names = new Set<string>(selector as readonly string[])
|
|
110
|
+
return (tool) => names.has(tool.name)
|
|
111
|
+
}
|
|
112
|
+
// `Array.isArray`'s built-in guard narrows against a MUTABLE `any[]`, so
|
|
113
|
+
// TypeScript cannot use the negative case above to drop `readonly
|
|
114
|
+
// string[]` from the union — the cast is just naming what the runtime
|
|
115
|
+
// check already proved.
|
|
116
|
+
const objectSelector = selector as Exclude<ToolFilterSelector, readonly string[]>
|
|
117
|
+
if ('sourceIdGlob' in objectSelector) {
|
|
118
|
+
const keepEverything = matchesSourceIdGlob(ts.source.id, objectSelector.sourceIdGlob)
|
|
119
|
+
return () => keepEverything
|
|
120
|
+
}
|
|
121
|
+
// The deep-match itself (nested plain objects recursed, arrays compared
|
|
122
|
+
// elementwise) is `matchesToolSelector`'s (`tools/roster.ts`) — the same
|
|
123
|
+
// rule a permission `by_source`/metadata rule matches by, so a metadata
|
|
124
|
+
// selector means the same thing wherever it is written.
|
|
125
|
+
const pattern = objectSelector.metadata
|
|
126
|
+
return (tool) => matchesToolSelector(pattern, tool)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* This toolset's tools default to `'deferred'` instead of `'active'` — the
|
|
131
|
+
* model has to ask for them by name (or a `search_tools`/reveal path) rather
|
|
132
|
+
* than seeing them offered up front.
|
|
133
|
+
*/
|
|
134
|
+
export function deferred(ts: Toolset): Toolset {
|
|
135
|
+
return deriveToolset(ts, { availability: 'deferred' })
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Keep tools unavailable until the host confirms their prerequisite is ready.
|
|
140
|
+
* This guard is independent of `deferred`: search cannot grant readiness.
|
|
141
|
+
* The callback must read current host state and return synchronously.
|
|
142
|
+
*/
|
|
143
|
+
export function readyWhen(ts: Toolset, isReady: () => boolean): Toolset {
|
|
144
|
+
return deriveToolset(ts, {
|
|
145
|
+
isReady: () => (ts.isReady?.() ?? true) && isReady(),
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Mark the tools `selector` admits (every tool, when omitted) as needing
|
|
151
|
+
* approval every time they are called.
|
|
152
|
+
*
|
|
153
|
+
* Sets `ToolDefinition.requiresApproval` to a predicate that always answers
|
|
154
|
+
* `true`, and nothing else — this wrapper does not enforce approval itself;
|
|
155
|
+
* that is `runtime/query/review-policy.ts`'s job, which reads the field this
|
|
156
|
+
* writes. `requiresApproval` is declared as `(input: TInput) => boolean`
|
|
157
|
+
* (method-shorthand, like `isReadOnly`), not a plain boolean, so every tool
|
|
158
|
+
* this wrapper marks gets the same always-true predicate rather than a
|
|
159
|
+
* second field shape to check for.
|
|
160
|
+
*/
|
|
161
|
+
export function requireApproval(
|
|
162
|
+
ts: Toolset,
|
|
163
|
+
selector?: ToolFilterSelector | ToolPredicate,
|
|
164
|
+
): Toolset {
|
|
165
|
+
const predicate = selector ? toPredicate(ts, selector) : () => true
|
|
166
|
+
const source = toToolSourceRef(ts.source)
|
|
167
|
+
const mapped = new WeakMap<ToolDefinition, ToolDefinition>()
|
|
168
|
+
return deriveToolset(ts, {
|
|
169
|
+
tools: () =>
|
|
170
|
+
ts.tools().map((tool) => {
|
|
171
|
+
if (!predicate(tool, source)) return tool
|
|
172
|
+
let approved = mapped.get(tool)
|
|
173
|
+
if (!approved) {
|
|
174
|
+
approved = { ...tool, requiresApproval: () => true }
|
|
175
|
+
mapped.set(tool, approved)
|
|
176
|
+
}
|
|
177
|
+
return approved
|
|
178
|
+
}),
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Merge `metadata` onto every tool this toolset contributes, keeping
|
|
184
|
+
* whatever metadata a tool already carries (last write wins per key).
|
|
185
|
+
*/
|
|
186
|
+
export function withMetadata(ts: Toolset, metadata: Readonly<Record<string, unknown>>): Toolset {
|
|
187
|
+
return mapTools(ts, (tool) => ({
|
|
188
|
+
...tool,
|
|
189
|
+
metadata: { ...tool.metadata, ...metadata },
|
|
190
|
+
}))
|
|
191
|
+
}
|
package/src/types/agent/base.ts
CHANGED
|
@@ -16,7 +16,8 @@ import type { TurnExecutionStatus } from '../session/turn.js'
|
|
|
16
16
|
import type { TaskStore } from '../task/index.js'
|
|
17
17
|
import type { ToolAvailability } from '../tool/index.js'
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/** Application-owned agent kind; the SDK does not prescribe an agent taxonomy. */
|
|
20
|
+
export type AgentType = string
|
|
20
21
|
|
|
21
22
|
export type AgentContextLevel = 'full' | 'standard' | 'minimal'
|
|
22
23
|
|
|
@@ -225,30 +226,23 @@ export interface BaseAgentConfig {
|
|
|
225
226
|
idempotencyKey?: string
|
|
226
227
|
|
|
227
228
|
/**
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* Kept optional at the TYPE level because {@link AgentManager} stamps
|
|
233
|
-
* this field AFTER `configBuilder` returns (manager/agent/lifecycle.ts).
|
|
234
|
-
* Tightening to required is a separate task alongside
|
|
235
|
-
* `AgentFactoryOptions` carrying the triple.
|
|
229
|
+
* Project scope for a store-backed turn. Optional on the general Agent
|
|
230
|
+
* contract: {@link AgentManager} supplies the real project to delegated
|
|
231
|
+
* agents after `configBuilder` returns. A standalone application agent need
|
|
232
|
+
* not take its identity from a project store.
|
|
236
233
|
*/
|
|
237
234
|
projectId?: ProjectId
|
|
238
235
|
|
|
239
236
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* `configBuilder` returns so `configBuilder` implementations do not
|
|
243
|
-
* need to be updated before this tightens. Tightening to required
|
|
244
|
-
* lands with the `AgentFactoryOptions` triple refactor.
|
|
237
|
+
* Optional topic scope. A host with topics supplies it for its own session
|
|
238
|
+
* and delegation records; it is not intrinsic to an Agent implementation.
|
|
245
239
|
*/
|
|
246
240
|
topicId?: TopicId
|
|
247
241
|
|
|
248
|
-
/** Session
|
|
242
|
+
/** Session correlation for a persisted turn; a host may resolve it at invocation. */
|
|
249
243
|
sessionId?: SessionId
|
|
250
244
|
|
|
251
|
-
/**
|
|
245
|
+
/** Host tenancy scope; store-backed delegation needs a real tenant owner. */
|
|
252
246
|
tenantId?: TenantId
|
|
253
247
|
|
|
254
248
|
/** Present on a child session: the session that delegated it. */
|
|
@@ -338,6 +332,15 @@ export interface AgentRuntimeContext {
|
|
|
338
332
|
notes?: readonly string[]
|
|
339
333
|
}
|
|
340
334
|
|
|
335
|
+
/** Host-owned scope for a managed invocation, separate from agent configuration. */
|
|
336
|
+
export interface AgentInvocationScope {
|
|
337
|
+
readonly kind: 'managed'
|
|
338
|
+
readonly sessionId: SessionId
|
|
339
|
+
readonly topicId: TopicId
|
|
340
|
+
readonly projectId: ProjectId
|
|
341
|
+
readonly tenantId: TenantId
|
|
342
|
+
}
|
|
343
|
+
|
|
341
344
|
export interface AgentInput {
|
|
342
345
|
messages: Message[]
|
|
343
346
|
workingDirectory: string
|
|
@@ -352,6 +355,15 @@ export interface AgentInput {
|
|
|
352
355
|
runtimeContext?: AgentRuntimeContext
|
|
353
356
|
}
|
|
354
357
|
|
|
358
|
+
/** Input for an adapter that runs a managed session through the query kernel. */
|
|
359
|
+
export type ManagedAgentInput = AgentInput & {
|
|
360
|
+
/**
|
|
361
|
+
* Host-owned session attribution. `AgentManager` sets this from the admitted
|
|
362
|
+
* child session, so the reusable agent config need not own its identity.
|
|
363
|
+
*/
|
|
364
|
+
readonly managedScope?: AgentInvocationScope
|
|
365
|
+
}
|
|
366
|
+
|
|
355
367
|
export interface BaseAgentResult {
|
|
356
368
|
/** Aggregate tree accounting, separate from this invocation's own usage. */
|
|
357
369
|
budget?: ReturnType<SessionTokenBudget['summary']>
|
|
@@ -389,6 +401,7 @@ export interface BaseAgentResult {
|
|
|
389
401
|
lastError?: string
|
|
390
402
|
}
|
|
391
403
|
|
|
404
|
+
/** Descriptive metadata. Access and concurrency are enforced by the host and runtime seams. */
|
|
392
405
|
export interface AgentCapabilities {
|
|
393
406
|
supportsTools: boolean
|
|
394
407
|
supportsStreaming: boolean
|
package/src/types/agent/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface PipelineStep<TInput = unknown, TOutput = unknown> {
|
|
|
24
24
|
validate?(input: TInput): boolean
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/** @deprecated Configuration for the pipeline example; define application orchestration as needed. */
|
|
27
28
|
export interface PipelineAgentConfig extends BaseAgentConfig {
|
|
28
29
|
steps: PipelineStep[]
|
|
29
30
|
provider?: LLMProvider
|
|
@@ -38,6 +39,7 @@ export interface PipelineStepResult {
|
|
|
38
39
|
durationMs: number
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
/** @deprecated Result of the pipeline example. */
|
|
41
43
|
export interface PipelineAgentResult extends BaseAgentResult {
|
|
42
44
|
stepResults: PipelineStepResult[]
|
|
43
45
|
completedSteps: number
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { CompactionConfig } from '../../config/runtime.js'
|
|
2
|
+
import type { QueryParams } from '../../runtime/query/index.js'
|
|
3
|
+
import type { SteeringChannel } from '../../runtime/query/steering.js'
|
|
4
|
+
import type { Toolset } from '../../toolsets/types.js'
|
|
5
|
+
import type { AdvisoryConfig } from '../advisory/index.js'
|
|
6
|
+
import type { AuthorizationGateConfig } from '../authorization/index.js'
|
|
7
|
+
import type { InputGuardrailSpec, OutputGuardrailSpec } from '../guardrail/index.js'
|
|
8
|
+
import type { ResumeHandler } from '../hitl/index.js'
|
|
9
|
+
import type { AgentPersona } from '../persona/index.js'
|
|
10
|
+
import type { LLMProvider } from '../provider/index.js'
|
|
11
|
+
import type { SandboxProvider } from '../sandbox/index.js'
|
|
12
|
+
import type { BeforeStep, PrepareStepChain, StepResult, StopCondition } from '../session/index.js'
|
|
13
|
+
import type { Skill } from '../skills/index.js'
|
|
14
|
+
import type { StructuredOutputConfig } from '../structured-output/index.js'
|
|
15
|
+
import type { RepairToolCall } from '../tool/repair.js'
|
|
16
|
+
import type { BaseAgentConfig, BaseAgentResult } from './base.js'
|
|
17
|
+
import type { WorkingMemoryProvider } from './working-memory.js'
|
|
18
|
+
|
|
19
|
+
export interface QueryAgentConfig extends BaseAgentConfig {
|
|
20
|
+
systemPrompt?: string
|
|
21
|
+
/** Provider-hosted search for this turn; the selected driver must support it. */
|
|
22
|
+
webSearch?: { mode: 'live' | 'cached' }
|
|
23
|
+
|
|
24
|
+
persona?: AgentPersona
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Channel a host uses to hand guidance to this turn's current turn.
|
|
28
|
+
*
|
|
29
|
+
* Forwarded into `drainQuery` so a host using this adapter can steer the
|
|
30
|
+
* same turn it could steer through a direct `query()` call.
|
|
31
|
+
*/
|
|
32
|
+
steering?: SteeringChannel
|
|
33
|
+
|
|
34
|
+
skills?: Skill[]
|
|
35
|
+
|
|
36
|
+
basePrompt?: string
|
|
37
|
+
provider: LLMProvider
|
|
38
|
+
/** Every tool this turn may see comes from one of these — see `toolsets/types.ts`. */
|
|
39
|
+
toolsets: readonly Toolset[]
|
|
40
|
+
|
|
41
|
+
advisory?: AdvisoryConfig
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Optional capability-aware deny/allow gate for tool calls.
|
|
45
|
+
* When omitted,
|
|
46
|
+
* `drainQuery` falls back to its `autoApproveHandler` default
|
|
47
|
+
* (every tool call auto-approves, no policy applied). Hosts that
|
|
48
|
+
* trust their sandbox should still pass at least
|
|
49
|
+
* `{ enabled: true, denyDangerousPatterns: true, ... }` so the
|
|
50
|
+
* canonical brick patterns hard-deny instead of executing
|
|
51
|
+
* silently.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
authorizationGate?: AuthorizationGateConfig
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Optional ephemeral sandbox provider. When set, drainQuery creates
|
|
58
|
+
* a sandbox via `provider.create()` before the iteration loop and
|
|
59
|
+
* routes filesystem / shell tool calls through it; on turn end the
|
|
60
|
+
* SDK calls `sandbox.destroy()`. Hosts that want related turns to share
|
|
61
|
+
* one container pass the same caching provider instance to those turns.
|
|
62
|
+
*/
|
|
63
|
+
sandboxProvider?: SandboxProvider
|
|
64
|
+
/** See {@link QueryParams.sandboxTeardownTimeoutMs}. */
|
|
65
|
+
sandboxTeardownTimeoutMs?: number
|
|
66
|
+
/** See {@link QueryParams.outsideRootAccess}. Default `'refuse'`. */
|
|
67
|
+
outsideRootAccess?: 'refuse' | 'review'
|
|
68
|
+
/** See {@link QueryParams.sandboxEscape}. Default `'refuse'`. */
|
|
69
|
+
sandboxEscape?: 'refuse' | 'review'
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Optional structured-compaction config. Omitted ⇒ byte-identical run path
|
|
73
|
+
* (no `WorkingStateManager`, compaction early-returns).
|
|
74
|
+
*/
|
|
75
|
+
compactionConfig?: CompactionConfig
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Optional neutral working-memory seam. Absent ⇒ no block injected.
|
|
79
|
+
* Related turns can share one provider when the host wants shared memory.
|
|
80
|
+
*/
|
|
81
|
+
workingMemoryProvider?: WorkingMemoryProvider
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Loop-control and resilience seams, forwarded verbatim to `query()`.
|
|
85
|
+
*
|
|
86
|
+
* The optional `QueryAgent` adapter forwards these settings for hosts that
|
|
87
|
+
* need an `AgentManager` shell. Hosts using `query()` configure them there.
|
|
88
|
+
*
|
|
89
|
+
* Every field is optional and absent means exactly what it meant
|
|
90
|
+
* before, so no existing agent changes behavior.
|
|
91
|
+
*/
|
|
92
|
+
resumeHandler?: ResumeHandler
|
|
93
|
+
retry?: QueryParams['retry']
|
|
94
|
+
toolTimeoutMs?: number
|
|
95
|
+
toolRetryBackoff?: QueryParams['toolRetryBackoff']
|
|
96
|
+
maxToolConcurrency?: number
|
|
97
|
+
maxToolOutputChars?: number
|
|
98
|
+
retainedToolPreviewChars?: QueryParams['retainedToolPreviewChars']
|
|
99
|
+
/**
|
|
100
|
+
* Cap on the RICH channel of a single tool result, in base64 characters.
|
|
101
|
+
* `0` or absent disables it. Separate from {@link maxToolOutputChars}:
|
|
102
|
+
* that one bounds characters the model reads, this one bounds the image
|
|
103
|
+
* payload beside them, which no text budget ever touched.
|
|
104
|
+
*/
|
|
105
|
+
maxToolContentBytes?: number
|
|
106
|
+
repairToolCall?: RepairToolCall
|
|
107
|
+
stopWhen?: StopCondition
|
|
108
|
+
onStepFinish?: (step: StepResult) => void
|
|
109
|
+
prepareStep?: PrepareStepChain
|
|
110
|
+
/**
|
|
111
|
+
* Refuse the next model call before it is made. See {@link BeforeStep}.
|
|
112
|
+
* A throw fails CLOSED, opposite to `prepareStep` beside it.
|
|
113
|
+
*/
|
|
114
|
+
beforeStep?: BeforeStep
|
|
115
|
+
|
|
116
|
+
structuredOutput?: StructuredOutputConfig
|
|
117
|
+
inputGuardrails?: readonly InputGuardrailSpec[]
|
|
118
|
+
outputGuardrails?: readonly OutputGuardrailSpec[]
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Span this turn should hang off, when it is a delegated one. Absent for
|
|
122
|
+
* a top-level turn, which correctly starts its own root trace.
|
|
123
|
+
*/
|
|
124
|
+
parentSpan?: import('@opentelemetry/api').Span
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface QueryAgentResult extends BaseAgentResult {
|
|
128
|
+
toolCallCount: number
|
|
129
|
+
}
|