@namzu/sdk 46.0.0 → 48.1.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 +351 -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 +71 -4
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +32 -4
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +383 -5
- 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/era.d.ts.map +1 -1
- package/dist/connector/mcp/era.js +7 -0
- package/dist/connector/mcp/era.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/mcp/streamable-http.d.ts +15 -0
- package/dist/connector/mcp/streamable-http.d.ts.map +1 -1
- package/dist/connector/mcp/streamable-http.js +281 -6
- package/dist/connector/mcp/streamable-http.js.map +1 -1
- 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 +1 -0
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +146 -18
- 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/initiative.d.ts +6 -6
- package/dist/manager/resident/learning-observation.d.ts +4 -4
- package/dist/manager/resident/learning.d.ts +36 -36
- package/dist/manager/resident/outbox.d.ts +4 -4
- 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/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +2 -0
- package/dist/scheduler/local.js.map +1 -1
- package/dist/session/retention/archive.js +1 -1
- package/dist/session/retention/archive.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/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +2 -0
- package/dist/store/session/disk.js.map +1 -1
- 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/browser.js +2 -2
- package/dist/tools/builtins/browser.js.map +1 -1
- 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/scheduler.d.ts +6 -1
- package/dist/types/agent/scheduler.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/agent/task.d.ts +19 -1
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/agent/task.js.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 +45 -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/session/sub-session.d.ts +2 -0
- package/dist/types/session/sub-session.d.ts.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 +73 -3
- package/src/connector/mcp/client.ts +425 -6
- package/src/connector/mcp/discovery.ts +60 -0
- package/src/connector/mcp/era.ts +7 -0
- package/src/connector/mcp/index.ts +13 -0
- package/src/connector/mcp/mcp-toolset.ts +515 -0
- package/src/connector/mcp/streamable-http.ts +302 -5
- 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 +167 -19
- 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/scheduler/local.ts +2 -0
- package/src/session/retention/archive.ts +1 -1
- package/src/skills/index.ts +1 -1
- package/src/skills/registry.ts +25 -0
- package/src/store/session/disk.ts +3 -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/browser.ts +2 -2
- 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/scheduler.ts +6 -1
- package/src/types/agent/supervisor.ts +5 -2
- package/src/types/agent/task.ts +21 -1
- package/src/types/authorization/index.ts +12 -0
- package/src/types/connector/mcp.ts +46 -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/session/sub-session.ts +2 -0
- 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
package/src/public-runtime.ts
CHANGED
|
@@ -278,9 +278,13 @@ export type { JsonSchemaDialect } from './registry/tool/dialect.js'
|
|
|
278
278
|
// by construction. Exported so a driver or a CI gate can assert it.
|
|
279
279
|
export {
|
|
280
280
|
findPortableSchemaViolations,
|
|
281
|
+
findUndescribedProperties,
|
|
281
282
|
toPortableToolSchema,
|
|
282
283
|
} from './registry/tool/portable.js'
|
|
283
|
-
export type {
|
|
284
|
+
export type {
|
|
285
|
+
PortableSchemaViolation,
|
|
286
|
+
UndescribedPropertyViolation,
|
|
287
|
+
} from './registry/tool/portable.js'
|
|
284
288
|
// The renderer itself, so a driver or a contract test can ask what a tool will
|
|
285
289
|
// actually put on the wire without reaching into the registry.
|
|
286
290
|
export { renderToolSchema, toolWireSchema } from './registry/tool/schema.js'
|
|
@@ -424,6 +428,7 @@ export {
|
|
|
424
428
|
loadSkill,
|
|
425
429
|
resolveSkillChain,
|
|
426
430
|
SKILL_FRONTMATTER_KEYS,
|
|
431
|
+
SkillCollisionError,
|
|
427
432
|
SkillRegistry,
|
|
428
433
|
} from './skills/index.js'
|
|
429
434
|
// The one frontmatter reader. `loadSkill` is built on it, and a host reading
|
|
@@ -450,6 +455,7 @@ export {
|
|
|
450
455
|
loadDirectory,
|
|
451
456
|
} from './directory/index.js'
|
|
452
457
|
export {
|
|
458
|
+
AdvisorCollisionError,
|
|
453
459
|
AdvisorRegistry,
|
|
454
460
|
AdvisoryContext,
|
|
455
461
|
AdvisoryExecutor,
|
|
@@ -464,6 +470,7 @@ export {
|
|
|
464
470
|
defineAgent,
|
|
465
471
|
InvocationLock,
|
|
466
472
|
PipelineAgent,
|
|
473
|
+
QueryAgent,
|
|
467
474
|
ReactiveAgent,
|
|
468
475
|
RouterAgent,
|
|
469
476
|
// The short path: provider + model + prompt. Assembles the identity and
|
|
@@ -552,18 +559,42 @@ export {
|
|
|
552
559
|
BaseRegistry,
|
|
553
560
|
ManagedRegistry,
|
|
554
561
|
PluginRegistry,
|
|
555
|
-
|
|
562
|
+
RegistryCollisionError,
|
|
556
563
|
ToolNameCollisionError,
|
|
557
|
-
ToolRegistry,
|
|
558
|
-
createToolCatalogFromRegistry,
|
|
559
|
-
loadingFromAvailability,
|
|
560
|
-
toolDefinitionToCatalogEntry,
|
|
561
564
|
} from './registry/index.js'
|
|
565
|
+
export type { ManagedRegistryConfig, RegistryCollisionPolicy } from './registry/index.js'
|
|
566
|
+
|
|
567
|
+
// Toolsets (plan.md v3 §1-2): the unit every tool comes from, and the
|
|
568
|
+
// runtime-owned resolver of them. `toolset()` builds a plain static one;
|
|
569
|
+
// `combineToolsets` merges several under one umbrella source, atomically
|
|
570
|
+
// (throwing `ToolsetConflictError` on a name collision instead of silently
|
|
571
|
+
// picking a winner); the rest are composable wrappers over any `Toolset`.
|
|
572
|
+
// `ToolManager` is an advanced API: `query()` builds one per turn from
|
|
573
|
+
// `toolsets`, and a host embedding the execution pipeline directly (rather
|
|
574
|
+
// than through `query()`/the agent classes) builds its own.
|
|
575
|
+
export { combineToolsets, ToolsetConflictError } from './toolsets/combine.js'
|
|
576
|
+
export { defineCapability, dynamicCapability } from './capabilities/index.js'
|
|
577
|
+
export { ToolManager } from './toolsets/manager.js'
|
|
578
|
+
export type { ToolManagerConfig, ToolsetChangeReport } from './toolsets/manager.js'
|
|
579
|
+
export { matchesSourceIdGlob } from './toolsets/source-glob.js'
|
|
580
|
+
export { toolset } from './toolsets/toolset.js'
|
|
581
|
+
export { toToolSourceRef } from './toolsets/types.js'
|
|
582
|
+
export {
|
|
583
|
+
deferred,
|
|
584
|
+
filtered,
|
|
585
|
+
mapTools,
|
|
586
|
+
prefixed,
|
|
587
|
+
renamed,
|
|
588
|
+
readyWhen,
|
|
589
|
+
requireApproval,
|
|
590
|
+
withMetadata,
|
|
591
|
+
} from './toolsets/wrappers.js'
|
|
562
592
|
|
|
563
593
|
export {
|
|
564
594
|
attachShellHooks,
|
|
565
595
|
createShellHook,
|
|
566
596
|
DEFAULT_SHELL_HOOK_TIMEOUT_MS,
|
|
597
|
+
definePlugin,
|
|
567
598
|
discoverAllPluginDirs,
|
|
568
599
|
discoverPlugins,
|
|
569
600
|
loadPluginManifest,
|
|
@@ -576,6 +607,7 @@ export {
|
|
|
576
607
|
shellHookMatches,
|
|
577
608
|
shellHookVerdict,
|
|
578
609
|
} from './plugin/index.js'
|
|
610
|
+
export type { DefinedPlugin, DefinePluginOptions } from './plugin/define.js'
|
|
579
611
|
|
|
580
612
|
export {
|
|
581
613
|
AgentManager,
|
|
@@ -742,6 +774,7 @@ export {
|
|
|
742
774
|
CommandCancellationUnsupportedError,
|
|
743
775
|
ConnectorManager,
|
|
744
776
|
ConnectorRegistry,
|
|
777
|
+
EnvironmentCollisionError,
|
|
745
778
|
EnvironmentConnectorManager,
|
|
746
779
|
ExecutionContextFactory,
|
|
747
780
|
HttpConnector,
|
|
@@ -778,6 +811,8 @@ export {
|
|
|
778
811
|
renderPromptMessages,
|
|
779
812
|
mcpJsonSchemaToZod,
|
|
780
813
|
mcpToolResultToToolResult,
|
|
814
|
+
mcpToolset,
|
|
815
|
+
mcpToolsetName,
|
|
781
816
|
mcpToolToToolDefinition,
|
|
782
817
|
RemoteExecutionContext,
|
|
783
818
|
RemoteExecutionBusyError,
|
|
@@ -788,6 +823,7 @@ export {
|
|
|
788
823
|
ServerStdioTransport,
|
|
789
824
|
StdioTransport,
|
|
790
825
|
StreamableHttpTransport,
|
|
826
|
+
TenantCollisionError,
|
|
791
827
|
TenantConnectorManager,
|
|
792
828
|
toolDefinitionToMCPTool,
|
|
793
829
|
toolResultToMCPToolResult,
|
|
@@ -810,6 +846,8 @@ export type {
|
|
|
810
846
|
MCPToolDrift,
|
|
811
847
|
MCPToolPolicy,
|
|
812
848
|
MCPToolPolicyDecision,
|
|
849
|
+
MCPToolsetOptions,
|
|
850
|
+
MCPToolsets,
|
|
813
851
|
} from './connector/index.js'
|
|
814
852
|
|
|
815
853
|
// ─── bridges (a2a + sse) ─────────────────────────────────────────────────
|
|
@@ -931,6 +969,24 @@ export {
|
|
|
931
969
|
nestedShellCommand,
|
|
932
970
|
} from './authorization/shell-lexer.js'
|
|
933
971
|
|
|
972
|
+
// Where a command line actually execs a program — unwrapping `sudo`, `env`,
|
|
973
|
+
// `nice`, `timeout` and the rest of a re-exec chain with their own real
|
|
974
|
+
// option grammars, rather than assuming the program sits right after the
|
|
975
|
+
// wrapper's name. The live `bash` tool's escalation, the CLI's
|
|
976
|
+
// scheduled-run floor and its script check all read this the same way, so
|
|
977
|
+
// `env $(echo git) push` and `timeout 5 $(echo systemctl) stop …` cannot be
|
|
978
|
+
// verified by one and missed by another.
|
|
979
|
+
export {
|
|
980
|
+
DYNAMIC_RESOLUTION_VARIABLES,
|
|
981
|
+
hasPoisoningPrefix,
|
|
982
|
+
poisonedProgramPosition,
|
|
983
|
+
poisonsLaterCommands,
|
|
984
|
+
programPositions,
|
|
985
|
+
resolveScriptPrograms,
|
|
986
|
+
unknownProgramInLine,
|
|
987
|
+
} from './authorization/program.js'
|
|
988
|
+
export type { CommandProgramPositions, ProgramPosition } from './authorization/program.js'
|
|
989
|
+
|
|
934
990
|
// NZ-BOOT-03: the module-attributed invariant registry. `compaction.ts` and
|
|
935
991
|
// `claim-disk.ts` register themselves against the shared `invariants`
|
|
936
992
|
// instance at import time (see each file); `namzu doctor` and any host can
|
|
@@ -1325,6 +1381,7 @@ export { DECLINED_TOOL_CALL_FEEDBACK } from './runtime/query/declined.js'
|
|
|
1325
1381
|
export {
|
|
1326
1382
|
CODING_AGENT_DELEGATION_DOCTRINE,
|
|
1327
1383
|
CODING_AGENT_DOCTRINE_CONTRIBUTION_ID,
|
|
1384
|
+
CODING_AGENT_HYPERMODE_DOCTRINE,
|
|
1328
1385
|
CODING_AGENT_ORCHESTRATE_DOCTRINE,
|
|
1329
1386
|
CODING_AGENT_WORKING_DOCTRINE,
|
|
1330
1387
|
PLAN_MODE_DOCTRINE,
|
|
@@ -1424,7 +1481,6 @@ export type {
|
|
|
1424
1481
|
GoalCommandScope,
|
|
1425
1482
|
KernelCommandOptions,
|
|
1426
1483
|
} from './registry/command/kernel-commands.js'
|
|
1427
|
-
export type { ToolCatalogFromRegistryOptions } from './registry/toolset/catalog.js'
|
|
1428
1484
|
export type { MockBidiScript, MockBidiSession } from './runtime/bidi/mock.js'
|
|
1429
1485
|
export type { BidiTurn, BidiTurnParams } from './runtime/bidi/session.js'
|
|
1430
1486
|
export type { SecretRedactionOptions } from './runtime/query/guardrail-presets.js'
|
|
@@ -1558,3 +1614,76 @@ export * from './store/session-index/index.js'
|
|
|
1558
1614
|
export * from './store/checkpoint/index.js'
|
|
1559
1615
|
export * from './store/budget/index.js'
|
|
1560
1616
|
export * from './contracts/session/index.js'
|
|
1617
|
+
|
|
1618
|
+
// ─── system events (@experimental) ──────────────────────────────────────
|
|
1619
|
+
//
|
|
1620
|
+
// One envelope for every asynchronous event a running turn reads as
|
|
1621
|
+
// provider-required user-role context. See `runtime/system-events.ts`.
|
|
1622
|
+
|
|
1623
|
+
export {
|
|
1624
|
+
SYSTEM_EVENT_HEADER,
|
|
1625
|
+
SYSTEM_EVENT_KINDS,
|
|
1626
|
+
SYSTEM_EVENT_STATUSES,
|
|
1627
|
+
formatSystemEvent,
|
|
1628
|
+
} from './runtime/system-events.js'
|
|
1629
|
+
|
|
1630
|
+
// ─── peer messaging (@experimental) ─────────────────────────────────────
|
|
1631
|
+
//
|
|
1632
|
+
// Cross-session messaging's SDK half: the live-session registry, the
|
|
1633
|
+
// `namzu-peer/1` transport (server + client), and the runtime-context
|
|
1634
|
+
// rendering of a delivered message or notice. CLI wiring (registry
|
|
1635
|
+
// lifecycle, inbox policy, `/peers`) is a separate workstream. See
|
|
1636
|
+
// `peers/index.ts`.
|
|
1637
|
+
|
|
1638
|
+
export {
|
|
1639
|
+
DEFAULT_PEER_READ_DEADLINE_MS,
|
|
1640
|
+
DeliverRequestSchema,
|
|
1641
|
+
DeliverResponseSchema,
|
|
1642
|
+
DeliverStatusSchema,
|
|
1643
|
+
LONGEST_PEER_SOCKET_FILE_NAME_LENGTH,
|
|
1644
|
+
MAX_OUTSTANDING_PEERS,
|
|
1645
|
+
MAX_OUTSTANDING_PER_PEER,
|
|
1646
|
+
MAX_PEER_CONNECTIONS,
|
|
1647
|
+
MAX_PEER_MESSAGE_TEXT_BYTES,
|
|
1648
|
+
MAX_PEER_REQUEST_BYTES,
|
|
1649
|
+
NoticeRequestSchema,
|
|
1650
|
+
NoticeResponseSchema,
|
|
1651
|
+
OUTSTANDING_EXPIRY_MS,
|
|
1652
|
+
PEER_PROTOCOL_VERSION,
|
|
1653
|
+
PEER_RECORD_VERSION,
|
|
1654
|
+
PeerAddressError,
|
|
1655
|
+
PeerClient,
|
|
1656
|
+
PeerClientError,
|
|
1657
|
+
PeerDirectoryError,
|
|
1658
|
+
PeerEndpointError,
|
|
1659
|
+
PeerFromSchema,
|
|
1660
|
+
PeerNoticeAboutSchema,
|
|
1661
|
+
PeerNoticePayloadSchema,
|
|
1662
|
+
PeerRecordSchema,
|
|
1663
|
+
PeerRefSchema,
|
|
1664
|
+
PeerRegistryError,
|
|
1665
|
+
PeerRequestSchema,
|
|
1666
|
+
PeerSessionKindSchema,
|
|
1667
|
+
PeerSessionStateSchema,
|
|
1668
|
+
PingRequestSchema,
|
|
1669
|
+
PingResponseSchema,
|
|
1670
|
+
SubscribeIdleRequestSchema,
|
|
1671
|
+
SubscribeIdleResponseSchema,
|
|
1672
|
+
createPeerEndpoint,
|
|
1673
|
+
derivePeerRef,
|
|
1674
|
+
formatPeerMessage,
|
|
1675
|
+
formatPeerNotice,
|
|
1676
|
+
hardenPeerRuntimeDir,
|
|
1677
|
+
isPeerRecordLive,
|
|
1678
|
+
listLivePeers,
|
|
1679
|
+
parsePeerAddress,
|
|
1680
|
+
peerSocketFileName,
|
|
1681
|
+
pingPeer,
|
|
1682
|
+
pipePeerAddress,
|
|
1683
|
+
readPeerRecord,
|
|
1684
|
+
readPeerRecords,
|
|
1685
|
+
removePeerRecord,
|
|
1686
|
+
resolvePeerRuntimeDir,
|
|
1687
|
+
udsPeerAddress,
|
|
1688
|
+
writePeerRecord,
|
|
1689
|
+
} from './peers/index.js'
|
package/src/public-tools.ts
CHANGED
|
@@ -32,8 +32,9 @@ export {
|
|
|
32
32
|
untrustedEnvelopeBody,
|
|
33
33
|
wrapUntrusted,
|
|
34
34
|
} from './tools/untrusted-envelope.js'
|
|
35
|
-
export {
|
|
36
|
-
export type {
|
|
35
|
+
export { matchesToolSelector } from './tools/roster.js'
|
|
36
|
+
export type { ToolSelector } from './tools/roster.js'
|
|
37
|
+
export type { UntrustedEnvelope, WrapUntrustedOptions } from './tools/untrusted-envelope.js'
|
|
37
38
|
|
|
38
39
|
// ─── Built-in tools ──────────────────────────────────────────────────────
|
|
39
40
|
|
|
@@ -44,10 +45,29 @@ export { buildResidentHistoryTools } from './tools/resident-history.js'
|
|
|
44
45
|
// input, which is how an `allow` for `git status*` came to approve
|
|
45
46
|
// `git status && rm -rf ~`.
|
|
46
47
|
export { builtinCommandArguments, commandArgumentOf } from './tools/command-arguments.js'
|
|
48
|
+
// Which shell a host-side command runs in, and how to spawn it, so a host
|
|
49
|
+
// that runs a command line outside the `bash` tool itself (a scheduled
|
|
50
|
+
// job's own script, say) resolves the SAME shell the rules already read the
|
|
51
|
+
// line in — never a second, drifting copy of this resolution.
|
|
52
|
+
export {
|
|
53
|
+
type CommandShell,
|
|
54
|
+
type CommandShellProbe,
|
|
55
|
+
findCommandShell,
|
|
56
|
+
findCommandShellForDialect,
|
|
57
|
+
hostCommandShell,
|
|
58
|
+
hostShellSpawn,
|
|
59
|
+
installedCommandShellForDialect,
|
|
60
|
+
withoutBashStartup,
|
|
61
|
+
} from './tools/command-shell.js'
|
|
47
62
|
export { ReadFileTool } from './tools/builtins/read-file.js'
|
|
48
63
|
export { WriteFileTool } from './tools/builtins/write-file.js'
|
|
49
64
|
export { EditTool } from './tools/builtins/edit.js'
|
|
50
|
-
export {
|
|
65
|
+
export {
|
|
66
|
+
BashTool,
|
|
67
|
+
type ExecHostShellProgress,
|
|
68
|
+
SANDBOX_ESCAPE_NOT_APPROVED,
|
|
69
|
+
execHostShell,
|
|
70
|
+
} from './tools/builtins/bash.js'
|
|
51
71
|
export { LSP_TOOL_NAME, LspTool, getCodeNavigationTools } from './tools/builtins/lsp.js'
|
|
52
72
|
export { GlobTool } from './tools/builtins/glob.js'
|
|
53
73
|
export { GrepTool } from './tools/builtins/grep.js'
|
|
@@ -192,7 +212,7 @@ export {
|
|
|
192
212
|
allConnectorTools,
|
|
193
213
|
connectorInstanceToTools,
|
|
194
214
|
connectorMethodToTool,
|
|
195
|
-
|
|
215
|
+
connectorTools,
|
|
196
216
|
createConnectorExecuteTool,
|
|
197
217
|
createConnectorListTool,
|
|
198
218
|
createConnectorRouterTool,
|
package/src/public-types.ts
CHANGED
|
@@ -39,6 +39,23 @@ export type {
|
|
|
39
39
|
SupervisorPlan,
|
|
40
40
|
} from './directory/derive-supervisor.js'
|
|
41
41
|
export type * from './types/toolset/index.js'
|
|
42
|
+
// The toolset layer (plan.md §1): the unit every tool comes from, and its
|
|
43
|
+
// composable wrappers. `ToolSource`/`ToolSourceKind` above are the ones
|
|
44
|
+
// `Toolset.source` and `toolset()` use — this only adds what is new.
|
|
45
|
+
export type {
|
|
46
|
+
ToolFilterSelector,
|
|
47
|
+
ToolPredicate,
|
|
48
|
+
Toolset,
|
|
49
|
+
ToolsetAvailability,
|
|
50
|
+
ToolSourceRef,
|
|
51
|
+
} from './toolsets/types.js'
|
|
52
|
+
export type {
|
|
53
|
+
AgentCapability,
|
|
54
|
+
Capability,
|
|
55
|
+
CapabilityModelSettings,
|
|
56
|
+
CapabilityRunContext,
|
|
57
|
+
DynamicCapability,
|
|
58
|
+
} from './capabilities/index.js'
|
|
42
59
|
export type * from './types/permission/index.js'
|
|
43
60
|
export type * from './types/errors/index.js'
|
|
44
61
|
export type * from './types/provider/index.js'
|
|
@@ -183,11 +200,7 @@ export type {
|
|
|
183
200
|
Timestamped,
|
|
184
201
|
} from './store/index.js'
|
|
185
202
|
|
|
186
|
-
export type {
|
|
187
|
-
ManagedRegistryConfig,
|
|
188
|
-
ToolExecutionResult,
|
|
189
|
-
ToolRegistryForkOptions,
|
|
190
|
-
} from './registry/index.js'
|
|
203
|
+
export type { ManagedRegistryConfig } from './registry/index.js'
|
|
191
204
|
|
|
192
205
|
export type { PluginLifecycleManagerConfig } from './plugin/lifecycle.js'
|
|
193
206
|
export type {
|
|
@@ -242,7 +255,7 @@ export type {
|
|
|
242
255
|
export type {
|
|
243
256
|
ConnectorRouterInput,
|
|
244
257
|
ConnectorToolConfig,
|
|
245
|
-
|
|
258
|
+
ConnectorTools,
|
|
246
259
|
ConnectorToolStrategy,
|
|
247
260
|
} from './connector/tools/index.js'
|
|
248
261
|
|
|
@@ -684,3 +697,44 @@ export type {
|
|
|
684
697
|
SessionLoop,
|
|
685
698
|
SessionLoopHost,
|
|
686
699
|
} from './tools/schedules/index.js'
|
|
700
|
+
|
|
701
|
+
// ─── system events + peer messaging (@experimental) ───────────────────────
|
|
702
|
+
|
|
703
|
+
export type {
|
|
704
|
+
FormatSystemEventOptions,
|
|
705
|
+
SystemEvent,
|
|
706
|
+
SystemEventBody,
|
|
707
|
+
SystemEventKind,
|
|
708
|
+
SystemEventStatus,
|
|
709
|
+
SystemEventUsage,
|
|
710
|
+
} from './runtime/system-events.js'
|
|
711
|
+
|
|
712
|
+
export type { PeerAddress } from './peers/address.js'
|
|
713
|
+
export type {
|
|
714
|
+
HardenPeerDirectory,
|
|
715
|
+
PeerRuntimeDir,
|
|
716
|
+
ResolvePeerRuntimeDirOptions,
|
|
717
|
+
} from './peers/dir.js'
|
|
718
|
+
export type { PeerRecord } from './peers/record.js'
|
|
719
|
+
export type { ListLivePeersOptions, PeerLivenessOptions } from './peers/registry.js'
|
|
720
|
+
export type {
|
|
721
|
+
DeliverRequest,
|
|
722
|
+
DeliverResponse,
|
|
723
|
+
DeliverStatus,
|
|
724
|
+
NoticeRequest,
|
|
725
|
+
NoticeResponse,
|
|
726
|
+
PeerFrom,
|
|
727
|
+
PeerNoticeAbout,
|
|
728
|
+
PeerNoticePayload,
|
|
729
|
+
PeerRequest,
|
|
730
|
+
PeerResponse,
|
|
731
|
+
PeerSessionKind,
|
|
732
|
+
PeerSessionState,
|
|
733
|
+
PingRequest,
|
|
734
|
+
PingResponse,
|
|
735
|
+
SubscribeIdleRequest,
|
|
736
|
+
SubscribeIdleResponse,
|
|
737
|
+
} from './peers/protocol.js'
|
|
738
|
+
export type { CreatePeerEndpointOptions, PeerEndpoint } from './peers/endpoint.js'
|
|
739
|
+
export type { PeerClientOptions, PeerClientResult } from './peers/client.js'
|
|
740
|
+
export type { PeerMessageEnvelopeInput } from './peers/envelope.js'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RegistryCollisionError } from '../registry/collision.js'
|
|
1
2
|
import type { SessionRecord } from '../types/session/index.js'
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -70,11 +71,15 @@ export class UnknownReadModelError extends Error {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/** Two models claiming one id. */
|
|
73
|
-
export class ReadModelCollisionError extends
|
|
74
|
+
export class ReadModelCollisionError extends RegistryCollisionError {
|
|
74
75
|
readonly details: { id: string }
|
|
75
76
|
|
|
76
77
|
constructor(details: { id: string }) {
|
|
77
|
-
super(
|
|
78
|
+
super(
|
|
79
|
+
'ReadModelRegistry',
|
|
80
|
+
details.id,
|
|
81
|
+
`A read model with id "${details.id}" is already registered.`,
|
|
82
|
+
)
|
|
78
83
|
this.name = 'ReadModelCollisionError'
|
|
79
84
|
this.details = details
|
|
80
85
|
}
|
|
@@ -2,6 +2,7 @@ import { NAMZU } from '../constants/telemetry/index.js'
|
|
|
2
2
|
import { SCOPE_ATTRIBUTE } from '../utils/log/types.js'
|
|
3
3
|
import { type Logger, resolveLogger } from '../utils/logger.js'
|
|
4
4
|
import { BaseRegistry } from './BaseRegistry.js'
|
|
5
|
+
import { RegistryCollisionError, type RegistryCollisionPolicy } from './collision.js'
|
|
5
6
|
|
|
6
7
|
export interface ManagedRegistryConfig<TDefinition> {
|
|
7
8
|
componentName: string
|
|
@@ -12,17 +13,31 @@ export interface ManagedRegistryConfig<TDefinition> {
|
|
|
12
13
|
*/
|
|
13
14
|
computeId?: (item: TDefinition) => string
|
|
14
15
|
logger?: Logger
|
|
16
|
+
/**
|
|
17
|
+
* What to do when `register` is given an id already present.
|
|
18
|
+
*
|
|
19
|
+
* Defaults to `'throw'`. Pass `'warn-overwrite'` or `'warn-skip'` only for
|
|
20
|
+
* a registry that genuinely means one of those (see
|
|
21
|
+
* {@link RegistryCollisionPolicy}). A single call that needs to replace
|
|
22
|
+
* one entry on an otherwise-`'throw'` registry calls {@link ManagedRegistry.replace}
|
|
23
|
+
* instead of changing the registry's policy.
|
|
24
|
+
*/
|
|
25
|
+
onCollision?: RegistryCollisionPolicy
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
export class ManagedRegistry<TDefinition> extends BaseRegistry<TDefinition> {
|
|
18
29
|
protected log: Logger
|
|
19
30
|
private idField?: keyof TDefinition & string
|
|
20
31
|
private computeId?: (item: TDefinition) => string
|
|
32
|
+
private componentName: string
|
|
33
|
+
private onCollision: RegistryCollisionPolicy
|
|
21
34
|
|
|
22
35
|
constructor(config: ManagedRegistryConfig<TDefinition>) {
|
|
23
36
|
super()
|
|
24
37
|
this.idField = config.idField
|
|
25
38
|
this.computeId = config.computeId
|
|
39
|
+
this.componentName = config.componentName
|
|
40
|
+
this.onCollision = config.onCollision ?? 'throw'
|
|
26
41
|
this.log = resolveLogger(config.logger).child({
|
|
27
42
|
[SCOPE_ATTRIBUTE]: 'registry',
|
|
28
43
|
[NAMZU.REGISTRY_NAME]: config.componentName,
|
|
@@ -46,8 +61,8 @@ export class ManagedRegistry<TDefinition> extends BaseRegistry<TDefinition> {
|
|
|
46
61
|
}
|
|
47
62
|
const id = idOrItem
|
|
48
63
|
const item = maybeItem
|
|
49
|
-
if (this.has(id)) {
|
|
50
|
-
|
|
64
|
+
if (this.has(id) && !this.applyCollisionPolicy(id)) {
|
|
65
|
+
return
|
|
51
66
|
}
|
|
52
67
|
super.register(id, item)
|
|
53
68
|
this.log.debug('Registered', { 'namzu.registry.item_id': id })
|
|
@@ -64,8 +79,8 @@ export class ManagedRegistry<TDefinition> extends BaseRegistry<TDefinition> {
|
|
|
64
79
|
throw new Error('register(item) requires idField or computeId to be configured')
|
|
65
80
|
}
|
|
66
81
|
|
|
67
|
-
if (this.has(id)) {
|
|
68
|
-
|
|
82
|
+
if (this.has(id) && !this.applyCollisionPolicy(id)) {
|
|
83
|
+
return
|
|
69
84
|
}
|
|
70
85
|
super.register(id, item)
|
|
71
86
|
// `debug`, not `info`. Registration is the startup path doing exactly
|
|
@@ -75,8 +90,8 @@ export class ManagedRegistry<TDefinition> extends BaseRegistry<TDefinition> {
|
|
|
75
90
|
// failure as silence with the sign flipped — the interesting lines are
|
|
76
91
|
// there, and nobody can find them.
|
|
77
92
|
//
|
|
78
|
-
// The overwrite case above stays at `warn
|
|
79
|
-
// registration under a live id IS news.
|
|
93
|
+
// The overwrite case above stays at `warn` (or throws), because a
|
|
94
|
+
// second registration under a live id IS news.
|
|
80
95
|
//
|
|
81
96
|
// Found by running the CLI against a real provider rather than a mock.
|
|
82
97
|
// Every unit test here asserts on a logger stub, so the LEVEL was
|
|
@@ -85,6 +100,42 @@ export class ManagedRegistry<TDefinition> extends BaseRegistry<TDefinition> {
|
|
|
85
100
|
this.log.debug('Registered', { 'namzu.registry.item_id': id })
|
|
86
101
|
}
|
|
87
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Register `item` under `id`, replacing whatever is already there —
|
|
105
|
+
* regardless of this registry's {@link RegistryCollisionPolicy}.
|
|
106
|
+
*
|
|
107
|
+
* For the one call site that legitimately supersedes an earlier
|
|
108
|
+
* registration under the same id (a plugin's status transition, a
|
|
109
|
+
* reload) — not a registry-wide escape hatch. A registry whose intended
|
|
110
|
+
* behaviour IS overwrite-by-default declares `onCollision: 'warn-overwrite'`
|
|
111
|
+
* instead of routing every caller through this method.
|
|
112
|
+
*/
|
|
113
|
+
replace(id: string, item: TDefinition): void {
|
|
114
|
+
const existed = this.has(id)
|
|
115
|
+
super.register(id, item)
|
|
116
|
+
this.log.debug(existed ? 'Replaced' : 'Registered', { 'namzu.registry.item_id': id })
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Runs this registry's {@link RegistryCollisionPolicy} for an id already
|
|
121
|
+
* present. Returns `true` when the caller should proceed to overwrite,
|
|
122
|
+
* `false` when it should leave the existing item alone.
|
|
123
|
+
*/
|
|
124
|
+
private applyCollisionPolicy(id: string): boolean {
|
|
125
|
+
switch (this.onCollision) {
|
|
126
|
+
case 'throw':
|
|
127
|
+
throw new RegistryCollisionError(this.componentName, id)
|
|
128
|
+
case 'warn-skip':
|
|
129
|
+
this.log.warn('Already registered, keeping existing', {
|
|
130
|
+
'namzu.registry.item_id': id,
|
|
131
|
+
})
|
|
132
|
+
return false
|
|
133
|
+
default:
|
|
134
|
+
this.log.warn('Already registered, overwriting', { 'namzu.registry.item_id': id })
|
|
135
|
+
return true
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
88
139
|
getOrThrow(id: string): TDefinition {
|
|
89
140
|
const item = this.get(id)
|
|
90
141
|
if (!item) {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a registry does when a second item claims an id it already holds.
|
|
3
|
+
*
|
|
4
|
+
* Nine `*CollisionError` classes existed across the SDK before this file did
|
|
5
|
+
* (tool, host command, config namespace, prompt contribution, read model,
|
|
6
|
+
* invariant, probe, provider — see `RegistryCollisionError` below), each
|
|
7
|
+
* hand-rolled, and a handful of registries never threw at all —
|
|
8
|
+
* `ManagedRegistry.register` warned and overwrote by default, `AdvisorRegistry`
|
|
9
|
+
* and the two connector managers (`manager/connector/environment.ts`,
|
|
10
|
+
* `tenant.ts`) warned and kept the original, and `SkillRegistry.add` did
|
|
11
|
+
* neither, in total silence. This file gives the concept a shared
|
|
12
|
+
* vocabulary, and every one of those registries now throws on a duplicate id
|
|
13
|
+
* by default (`RegistryCollisionError` or a domain-specific subclass); a
|
|
14
|
+
* caller that genuinely means to replace an existing entry says so
|
|
15
|
+
* explicitly at the call site.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A named collision policy for a `ManagedRegistry`.
|
|
20
|
+
*
|
|
21
|
+
* - `'throw'` (default): raise a {@link RegistryCollisionError} naming this
|
|
22
|
+
* registry and the id, and leave the existing item in place. Right for
|
|
23
|
+
* every registry here unless a caller can name a reason a second
|
|
24
|
+
* registration under one id should not be a bug.
|
|
25
|
+
* - `'warn-overwrite'`: log a warning and replace the existing item.
|
|
26
|
+
* `ToolRegistry` used to keep this policy for its own `register`, so a
|
|
27
|
+
* host mounting the same tool twice (once a legitimate, common shape)
|
|
28
|
+
* kept working unchanged; that class is gone now (plan.md v3 §2) — a
|
|
29
|
+
* `ToolManager`'s toolsets throw `ToolsetConflictError` on any collision
|
|
30
|
+
* instead, naming both sources, with no overwrite mode at all.
|
|
31
|
+
* - `'warn-skip'`: log a warning and keep the existing item — the one being
|
|
32
|
+
* registered is discarded.
|
|
33
|
+
*
|
|
34
|
+
* A single call that needs to replace an existing entry on a registry whose
|
|
35
|
+
* policy is `'throw'` passes `{ replace: true }` to that call instead of
|
|
36
|
+
* changing the registry's policy — see `ManagedRegistry.register`.
|
|
37
|
+
*/
|
|
38
|
+
export type RegistryCollisionPolicy = 'throw' | 'warn-overwrite' | 'warn-skip'
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A second item claiming an id a registry already holds.
|
|
42
|
+
*
|
|
43
|
+
* The base class every SDK `*CollisionError` extends, so a host that wants
|
|
44
|
+
* to catch "some registry collided" without naming every concrete error
|
|
45
|
+
* class can catch this one instead. Each concrete subclass keeps its own
|
|
46
|
+
* `name`, message and fields exactly as before — this only adds
|
|
47
|
+
* `registryName` and `collidingId`, which every collision shares by
|
|
48
|
+
* definition — and `ManagedRegistry`'s own `'throw'` policy (see
|
|
49
|
+
* {@link RegistryCollisionPolicy}) raises this class directly when a
|
|
50
|
+
* registry has no domain-specific subclass of its own.
|
|
51
|
+
*/
|
|
52
|
+
export class RegistryCollisionError extends Error {
|
|
53
|
+
/** Which registry raised this, e.g. `"ToolRegistry"`. */
|
|
54
|
+
readonly registryName: string
|
|
55
|
+
/** The id or name two registrations collided on. */
|
|
56
|
+
readonly collidingId: string
|
|
57
|
+
|
|
58
|
+
constructor(registryName: string, collidingId: string, message?: string) {
|
|
59
|
+
super(message ?? `"${collidingId}" is already registered in ${registryName}.`)
|
|
60
|
+
this.name = 'RegistryCollisionError'
|
|
61
|
+
this.registryName = registryName
|
|
62
|
+
this.collidingId = collidingId
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
SerializableHostCommand,
|
|
6
6
|
} from '../../types/command/index.js'
|
|
7
7
|
import { ManagedRegistry } from '../ManagedRegistry.js'
|
|
8
|
+
import { RegistryCollisionError } from '../collision.js'
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* A second command claiming a name that is already taken.
|
|
@@ -14,11 +15,13 @@ import { ManagedRegistry } from '../ManagedRegistry.js'
|
|
|
14
15
|
* skip, rename, refuse to boot — has to catch it narrowly instead of
|
|
15
16
|
* matching on message text.
|
|
16
17
|
*/
|
|
17
|
-
export class HostCommandNameCollisionError extends
|
|
18
|
+
export class HostCommandNameCollisionError extends RegistryCollisionError {
|
|
18
19
|
readonly commandName: string
|
|
19
20
|
|
|
20
21
|
constructor(commandName: string) {
|
|
21
22
|
super(
|
|
23
|
+
'HostCommandRegistry',
|
|
24
|
+
commandName,
|
|
22
25
|
`Host command "/${commandName}" is already registered. Two commands answering to one name shadow each other silently, and which one wins depends on registration order.`,
|
|
23
26
|
)
|
|
24
27
|
this.name = 'HostCommandNameCollisionError'
|
|
@@ -35,8 +38,9 @@ export class HostCommandNameCollisionError extends Error {
|
|
|
35
38
|
* right for a tool roster a host assembles deliberately and wrong here.
|
|
36
39
|
* These are operator-facing, and a shadowed command is invisible — it does
|
|
37
40
|
* not fail, it simply never runs, and the one that wins depends on
|
|
38
|
-
* registration order. `
|
|
39
|
-
* same reason one directory over
|
|
41
|
+
* registration order. `ToolManager` (`toolsets/manager.ts`) reaches the
|
|
42
|
+
* same conclusion for the same reason one directory over — a toolset
|
|
43
|
+
* collision throws rather than shadowing silently.
|
|
40
44
|
*/
|
|
41
45
|
export class HostCommandRegistry extends ManagedRegistry<HostCommandDescriptor> {
|
|
42
46
|
constructor(logger?: ConstructorParameters<typeof ManagedRegistry>[0]['logger']) {
|
package/src/registry/index.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
export { BaseRegistry } from './BaseRegistry.js'
|
|
2
|
+
export { RegistryCollisionError } from './collision.js'
|
|
3
|
+
export type { RegistryCollisionPolicy } from './collision.js'
|
|
2
4
|
export { ManagedRegistry } from './ManagedRegistry.js'
|
|
3
5
|
export type { ManagedRegistryConfig } from './ManagedRegistry.js'
|
|
4
6
|
|
|
5
|
-
export { ToolNameCollisionError,
|
|
6
|
-
export type { ToolExecutionResult, ToolRegistryForkOptions } from './tool/execute.js'
|
|
7
|
-
export {
|
|
8
|
-
ToolCatalog,
|
|
9
|
-
createToolCatalogFromRegistry,
|
|
10
|
-
loadingFromAvailability,
|
|
11
|
-
toolDefinitionToCatalogEntry,
|
|
12
|
-
} from './toolset/catalog.js'
|
|
13
|
-
export type { ToolCatalogFromRegistryOptions, ToolCatalogSearchOptions } from './toolset/catalog.js'
|
|
7
|
+
export { ToolNameCollisionError, TOOL_NAME_PATTERN, assertToolName } from './tool/execute.js'
|
|
14
8
|
|
|
15
9
|
export { ConnectorRegistry } from './connector/definitions.js'
|
|
16
10
|
export { ScopedConnectorRegistry } from './connector/scoped.js'
|
|
@@ -3,7 +3,20 @@ import { ManagedRegistry } from '../ManagedRegistry.js'
|
|
|
3
3
|
|
|
4
4
|
export class PluginRegistry extends ManagedRegistry<PluginDefinition> {
|
|
5
5
|
constructor() {
|
|
6
|
-
super({
|
|
6
|
+
super({
|
|
7
|
+
componentName: 'PluginRegistry',
|
|
8
|
+
idField: 'id',
|
|
9
|
+
// A public projection a host is meant to be able to overwrite —
|
|
10
|
+
// `PluginLifecycleManager` itself re-registers the same id under
|
|
11
|
+
// a new status on every enable/disable/error transition, and a
|
|
12
|
+
// host may write its own record here directly (executable
|
|
13
|
+
// contribution ownership, not this registry, is the lifecycle's
|
|
14
|
+
// real guard against a forged status — see `enable()`'s comment
|
|
15
|
+
// in `plugin/lifecycle.ts`). `ManagedRegistry`'s own default is
|
|
16
|
+
// `'throw'` now (see `registry/collision.ts`); this registry is
|
|
17
|
+
// one of the named exceptions.
|
|
18
|
+
onCollision: 'warn-overwrite',
|
|
19
|
+
})
|
|
7
20
|
}
|
|
8
21
|
|
|
9
22
|
listByScope(scope: PluginScope): PluginDefinition[] {
|