@namzu/sdk 27.0.0 → 28.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 +1714 -0
- package/README.md +45 -42
- package/dist/advisory/executor.d.ts.map +1 -1
- package/dist/advisory/executor.js +14 -12
- package/dist/advisory/executor.js.map +1 -1
- package/dist/advisory/registry.d.ts +2 -2
- package/dist/advisory/registry.d.ts.map +1 -1
- package/dist/advisory/registry.js +2 -2
- package/dist/advisory/registry.js.map +1 -1
- package/dist/agents/AbstractAgent.d.ts +44 -2
- package/dist/agents/AbstractAgent.d.ts.map +1 -1
- package/dist/agents/AbstractAgent.js +62 -13
- package/dist/agents/AbstractAgent.js.map +1 -1
- package/dist/agents/PipelineAgent.d.ts +29 -1
- package/dist/agents/PipelineAgent.d.ts.map +1 -1
- package/dist/agents/PipelineAgent.js +33 -4
- package/dist/agents/PipelineAgent.js.map +1 -1
- package/dist/agents/ReactiveAgent.d.ts +2 -1
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +15 -5
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/RouterAgent.d.ts +2 -1
- package/dist/agents/RouterAgent.d.ts.map +1 -1
- package/dist/agents/RouterAgent.js +21 -13
- package/dist/agents/RouterAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts +3 -2
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +29 -14
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/handle.d.ts +85 -0
- package/dist/agents/handle.d.ts.map +1 -0
- package/dist/agents/handle.js +79 -0
- package/dist/agents/handle.js.map +1 -0
- package/dist/agents/runAgent.d.ts +10 -5
- package/dist/agents/runAgent.d.ts.map +1 -1
- package/dist/agents/runAgent.js +3 -2
- package/dist/agents/runAgent.js.map +1 -1
- package/dist/{verification → authorization}/gate.d.ts +4 -4
- package/dist/authorization/gate.d.ts.map +1 -0
- package/dist/{verification → authorization}/gate.js +31 -24
- package/dist/authorization/gate.js.map +1 -0
- package/dist/authorization/index.d.ts +6 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +14 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/authorization/permission-presets.d.ts +119 -0
- package/dist/authorization/permission-presets.d.ts.map +1 -0
- package/dist/authorization/permission-presets.js +137 -0
- package/dist/authorization/permission-presets.js.map +1 -0
- package/dist/{verification → authorization}/presets.d.ts +3 -3
- package/dist/authorization/presets.d.ts.map +1 -0
- package/dist/{verification → authorization}/presets.js +12 -0
- package/dist/authorization/presets.js.map +1 -0
- package/dist/authorization/rules.d.ts +4 -0
- package/dist/authorization/rules.d.ts.map +1 -0
- package/dist/{verification → authorization}/rules.js +14 -1
- package/dist/authorization/rules.js.map +1 -0
- package/dist/bridge/a2a/client.d.ts +107 -0
- package/dist/bridge/a2a/client.d.ts.map +1 -0
- package/dist/bridge/a2a/client.js +275 -0
- package/dist/bridge/a2a/client.js.map +1 -0
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +16 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/acp/filesystem.d.ts +33 -0
- package/dist/bridge/acp/filesystem.d.ts.map +1 -0
- package/dist/bridge/acp/filesystem.js +30 -0
- package/dist/bridge/acp/filesystem.js.map +1 -0
- package/dist/bridge/acp/index.d.ts +8 -0
- package/dist/bridge/acp/index.d.ts.map +1 -0
- package/dist/bridge/acp/index.js +5 -0
- package/dist/bridge/acp/index.js.map +1 -0
- package/dist/bridge/acp/permission.d.ts +51 -0
- package/dist/bridge/acp/permission.d.ts.map +1 -0
- package/dist/bridge/acp/permission.js +37 -0
- package/dist/bridge/acp/permission.js.map +1 -0
- package/dist/bridge/acp/server.d.ts +163 -0
- package/dist/bridge/acp/server.d.ts.map +1 -0
- package/dist/bridge/acp/server.js +312 -0
- package/dist/bridge/acp/server.js.map +1 -0
- package/dist/bridge/acp/update.d.ts +13 -0
- package/dist/bridge/acp/update.d.ts.map +1 -0
- package/dist/bridge/acp/update.js +94 -0
- package/dist/bridge/acp/update.js.map +1 -0
- package/dist/bridge/mcp/connector/adapter.d.ts +2 -0
- package/dist/bridge/mcp/connector/adapter.d.ts.map +1 -1
- package/dist/bridge/mcp/connector/adapter.js +7 -3
- package/dist/bridge/mcp/connector/adapter.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +27 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/bus/breaker.d.ts.map +1 -1
- package/dist/bus/breaker.js +15 -10
- package/dist/bus/breaker.js.map +1 -1
- package/dist/bus/index.d.ts.map +1 -1
- package/dist/bus/index.js +10 -8
- package/dist/bus/index.js.map +1 -1
- package/dist/bus/lock.d.ts.map +1 -1
- package/dist/bus/lock.js +36 -19
- package/dist/bus/lock.js.map +1 -1
- package/dist/bus/ownership.d.ts.map +1 -1
- package/dist/bus/ownership.js +17 -9
- package/dist/bus/ownership.js.map +1 -1
- package/dist/compaction/context-window.d.ts +18 -2
- package/dist/compaction/context-window.d.ts.map +1 -1
- package/dist/compaction/context-window.js +15 -1
- package/dist/compaction/context-window.js.map +1 -1
- package/dist/compaction/index.d.ts +3 -0
- package/dist/compaction/index.d.ts.map +1 -1
- package/dist/compaction/index.js +4 -0
- package/dist/compaction/index.js.map +1 -1
- package/dist/compaction/manual.d.ts +58 -0
- package/dist/compaction/manual.d.ts.map +1 -0
- package/dist/compaction/manual.js +104 -0
- package/dist/compaction/manual.js.map +1 -0
- package/dist/compaction/plan.d.ts +92 -0
- package/dist/compaction/plan.d.ts.map +1 -0
- package/dist/compaction/plan.js +149 -0
- package/dist/compaction/plan.js.map +1 -0
- package/dist/compaction/summary.d.ts +23 -0
- package/dist/compaction/summary.d.ts.map +1 -0
- package/dist/compaction/summary.js +27 -0
- package/dist/compaction/summary.js.map +1 -0
- package/dist/compaction/verifier.js +2 -2
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/config/registry.d.ts +104 -0
- package/dist/config/registry.d.ts.map +1 -0
- package/dist/config/registry.js +105 -0
- package/dist/config/registry.js.map +1 -0
- package/dist/config/runtime.d.ts +99 -28
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +27 -0
- package/dist/config/runtime.js.map +1 -1
- package/dist/connector/BaseConnector.d.ts +1 -1
- package/dist/connector/BaseConnector.d.ts.map +1 -1
- package/dist/connector/BaseConnector.js +8 -3
- package/dist/connector/BaseConnector.js.map +1 -1
- package/dist/connector/builtins/http.d.ts +1 -1
- package/dist/connector/builtins/http.d.ts.map +1 -1
- package/dist/connector/builtins/http.js +11 -2
- package/dist/connector/builtins/http.js.map +1 -1
- package/dist/connector/builtins/webhook.d.ts +1 -1
- package/dist/connector/builtins/webhook.d.ts.map +1 -1
- package/dist/connector/builtins/webhook.js +5 -2
- package/dist/connector/builtins/webhook.js.map +1 -1
- package/dist/connector/index.d.ts +4 -15
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +12 -12
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/mcp/adapter.d.ts +30 -0
- package/dist/connector/mcp/adapter.d.ts.map +1 -1
- package/dist/connector/mcp/adapter.js +43 -1
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +31 -20
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/discovery.d.ts.map +1 -1
- package/dist/connector/mcp/discovery.js +31 -20
- package/dist/connector/mcp/discovery.js.map +1 -1
- package/dist/connector/mcp/http-sse.d.ts +2 -1
- package/dist/connector/mcp/http-sse.d.ts.map +1 -1
- package/dist/connector/mcp/http-sse.js +9 -6
- package/dist/connector/mcp/http-sse.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +2 -3
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +5 -4
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/reconnect.d.ts +123 -0
- package/dist/connector/mcp/reconnect.d.ts.map +1 -0
- package/dist/connector/mcp/reconnect.js +121 -0
- package/dist/connector/mcp/reconnect.js.map +1 -0
- package/dist/connector/mcp/server/index.d.ts +28 -0
- package/dist/connector/mcp/server/index.d.ts.map +1 -0
- package/dist/connector/mcp/server/index.js +27 -0
- package/dist/connector/mcp/server/index.js.map +1 -0
- package/dist/connector/mcp/{server-stdio.d.ts → server/server-stdio.d.ts} +3 -2
- package/dist/connector/mcp/server/server-stdio.d.ts.map +1 -0
- package/dist/connector/mcp/{server-stdio.js → server/server-stdio.js} +4 -3
- package/dist/connector/mcp/server/server-stdio.js.map +1 -0
- package/dist/connector/mcp/{server.d.ts → server/server.d.ts} +5 -4
- package/dist/connector/mcp/server/server.d.ts.map +1 -0
- package/dist/connector/mcp/{server.js → server/server.js} +14 -9
- package/dist/connector/mcp/server/server.js.map +1 -0
- package/dist/connector/mcp/stdio.d.ts +2 -1
- package/dist/connector/mcp/stdio.d.ts.map +1 -1
- package/dist/connector/mcp/stdio.js +15 -7
- package/dist/connector/mcp/stdio.js.map +1 -1
- package/dist/connector/mcp/streamable-http.d.ts +2 -1
- package/dist/connector/mcp/streamable-http.d.ts.map +1 -1
- package/dist/connector/mcp/streamable-http.js +5 -4
- package/dist/connector/mcp/streamable-http.js.map +1 -1
- package/dist/{bridge/tools/connector → connector/tools}/adapter.d.ts +4 -4
- package/dist/connector/tools/adapter.d.ts.map +1 -0
- package/dist/{bridge/tools/connector → connector/tools}/adapter.js +1 -1
- package/dist/connector/tools/adapter.js.map +1 -0
- package/dist/{bridge/tools/connector → connector/tools}/definitions.d.ts +2 -2
- package/dist/connector/tools/definitions.d.ts.map +1 -0
- package/dist/{bridge/tools/connector → connector/tools}/definitions.js +2 -2
- package/dist/connector/tools/definitions.js.map +1 -0
- package/dist/connector/tools/index.d.ts.map +1 -0
- package/dist/connector/tools/index.js.map +1 -0
- package/dist/{bridge/tools/connector → connector/tools}/router.d.ts +4 -2
- package/dist/connector/tools/router.d.ts.map +1 -0
- package/dist/{bridge/tools/connector → connector/tools}/router.js +14 -7
- package/dist/connector/tools/router.js.map +1 -0
- package/dist/connector/web/guarded-fetch.d.ts +60 -0
- package/dist/connector/web/guarded-fetch.d.ts.map +1 -0
- package/dist/connector/web/guarded-fetch.js +233 -0
- package/dist/connector/web/guarded-fetch.js.map +1 -0
- package/dist/connector/web/index.d.ts +5 -0
- package/dist/connector/web/index.d.ts.map +1 -0
- package/dist/connector/web/index.js +7 -0
- package/dist/connector/web/index.js.map +1 -0
- package/dist/connector/web/types.d.ts +87 -0
- package/dist/connector/web/types.d.ts.map +1 -0
- package/dist/connector/web/types.js +25 -0
- package/dist/connector/web/types.js.map +1 -0
- package/dist/constants/acp/index.d.ts +97 -0
- package/dist/constants/acp/index.d.ts.map +1 -0
- package/dist/constants/acp/index.js +96 -0
- package/dist/constants/acp/index.js.map +1 -0
- package/dist/constants/authorization/index.d.ts.map +1 -0
- package/dist/constants/authorization/index.js.map +1 -0
- package/dist/constants/credential-env-keys.d.ts +36 -0
- package/dist/constants/credential-env-keys.d.ts.map +1 -0
- package/dist/constants/credential-env-keys.js +62 -0
- package/dist/constants/credential-env-keys.js.map +1 -0
- package/dist/constants/index.d.ts +3 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +3 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/secret-patterns.d.ts +78 -0
- package/dist/constants/secret-patterns.d.ts.map +1 -0
- package/dist/constants/secret-patterns.js +99 -0
- package/dist/constants/secret-patterns.js.map +1 -0
- package/dist/constants/telemetry/index.d.ts +42 -0
- package/dist/constants/telemetry/index.d.ts.map +1 -1
- package/dist/constants/telemetry/index.js +87 -0
- package/dist/constants/telemetry/index.js.map +1 -1
- package/dist/contracts/a2a.d.ts +54 -54
- package/dist/contracts/api.d.ts +12 -1
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/schemas.d.ts +12 -12
- package/dist/deprecated-aliases.d.ts +80 -0
- package/dist/deprecated-aliases.d.ts.map +1 -0
- package/dist/deprecated-aliases.js +60 -0
- package/dist/deprecated-aliases.js.map +1 -0
- package/dist/eval/judge.js +2 -2
- package/dist/eval/judge.js.map +1 -1
- package/dist/execution/base.d.ts +1 -1
- package/dist/execution/base.d.ts.map +1 -1
- package/dist/execution/base.js +18 -7
- package/dist/execution/base.js.map +1 -1
- package/dist/execution/code-runtime/types.d.ts +114 -0
- package/dist/execution/code-runtime/types.d.ts.map +1 -0
- package/dist/execution/code-runtime/types.js +40 -0
- package/dist/execution/code-runtime/types.js.map +1 -0
- package/dist/execution/code-runtime/worker.d.ts +6 -0
- package/dist/execution/code-runtime/worker.d.ts.map +1 -0
- package/dist/execution/code-runtime/worker.js +248 -0
- package/dist/execution/code-runtime/worker.js.map +1 -0
- package/dist/{connector/execution → execution}/factory.d.ts +3 -3
- package/dist/execution/factory.d.ts.map +1 -0
- package/dist/{connector/execution → execution}/factory.js +1 -1
- package/dist/execution/factory.js.map +1 -0
- package/dist/{connector/execution → execution}/hybrid.d.ts +5 -3
- package/dist/execution/hybrid.d.ts.map +1 -0
- package/dist/{connector/execution → execution}/hybrid.js +10 -4
- package/dist/execution/hybrid.js.map +1 -0
- package/dist/execution/index.d.ts +23 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +21 -0
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/local.d.ts +2 -0
- package/dist/execution/local.d.ts.map +1 -1
- package/dist/execution/local.js +2 -2
- package/dist/execution/local.js.map +1 -1
- package/dist/{connector/execution → execution}/remote.d.ts +4 -2
- package/dist/execution/remote.d.ts.map +1 -0
- package/dist/{connector/execution → execution}/remote.js +12 -5
- package/dist/execution/remote.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/invariants/index.d.ts +111 -0
- package/dist/invariants/index.d.ts.map +1 -0
- package/dist/invariants/index.js +138 -0
- package/dist/invariants/index.js.map +1 -0
- package/dist/manager/agent/lifecycle.d.ts +29 -7
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +140 -50
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/connector/environment.d.ts +2 -0
- package/dist/manager/connector/environment.d.ts.map +1 -1
- package/dist/manager/connector/environment.js +20 -9
- package/dist/manager/connector/environment.js.map +1 -1
- package/dist/manager/connector/lifecycle.d.ts +10 -0
- package/dist/manager/connector/lifecycle.d.ts.map +1 -1
- package/dist/manager/connector/lifecycle.js +21 -11
- package/dist/manager/connector/lifecycle.js.map +1 -1
- package/dist/manager/connector/tenant.d.ts +9 -0
- package/dist/manager/connector/tenant.d.ts.map +1 -1
- package/dist/manager/connector/tenant.js +24 -10
- package/dist/manager/connector/tenant.js.map +1 -1
- package/dist/manager/index.d.ts +6 -2
- package/dist/manager/index.d.ts.map +1 -1
- package/dist/manager/index.js +7 -1
- package/dist/manager/index.js.map +1 -1
- package/dist/manager/project/lifecycle.d.ts +1 -1
- package/dist/manager/project/lifecycle.js +1 -1
- package/dist/manager/run/emergency.d.ts.map +1 -1
- package/dist/manager/run/emergency.js +9 -7
- package/dist/manager/run/emergency.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +46 -4
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +102 -7
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/manager/topic/lifecycle.d.ts +123 -0
- package/dist/manager/topic/lifecycle.d.ts.map +1 -0
- package/dist/manager/{thread → topic}/lifecycle.js +79 -61
- package/dist/manager/topic/lifecycle.js.map +1 -0
- package/dist/manager/topic/objective.d.ts +77 -0
- package/dist/manager/topic/objective.d.ts.map +1 -0
- package/dist/manager/topic/objective.js +133 -0
- package/dist/manager/topic/objective.js.map +1 -0
- package/dist/model-router/task-router.d.ts.map +1 -0
- package/dist/model-router/task-router.js.map +1 -0
- package/dist/persona/assembler.d.ts +1 -1
- package/dist/persona/assembler.d.ts.map +1 -1
- package/dist/persona/assembler.js +14 -2
- package/dist/persona/assembler.js.map +1 -1
- package/dist/plugin/lifecycle.d.ts +24 -0
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +112 -20
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/plugin/loader.d.ts +17 -2
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +46 -26
- package/dist/plugin/loader.js.map +1 -1
- package/dist/probe/index.d.ts +1 -0
- package/dist/probe/index.d.ts.map +1 -1
- package/dist/probe/registry.d.ts +34 -1
- package/dist/probe/registry.d.ts.map +1 -1
- package/dist/probe/registry.js +5 -4
- package/dist/probe/registry.js.map +1 -1
- package/dist/process/kill-tree.d.ts +40 -0
- package/dist/process/kill-tree.d.ts.map +1 -0
- package/dist/process/kill-tree.js +54 -0
- package/dist/process/kill-tree.js.map +1 -0
- package/dist/prompt/contributions.d.ts +138 -0
- package/dist/prompt/contributions.d.ts.map +1 -0
- package/dist/prompt/contributions.js +78 -0
- package/dist/prompt/contributions.js.map +1 -0
- package/dist/prompt/index.d.ts +3 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +6 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/provider/attribution.d.ts +45 -0
- package/dist/provider/attribution.d.ts.map +1 -0
- package/dist/provider/attribution.js +23 -0
- package/dist/provider/attribution.js.map +1 -0
- package/dist/provider/{collect.d.ts → collect-chat-completion.d.ts} +3 -3
- package/dist/provider/collect-chat-completion.d.ts.map +1 -0
- package/dist/provider/{collect.js → collect-chat-completion.js} +3 -3
- package/dist/provider/collect-chat-completion.js.map +1 -0
- package/dist/provider/conformance.d.ts +93 -0
- package/dist/provider/conformance.d.ts.map +1 -0
- package/dist/provider/conformance.js +124 -0
- package/dist/provider/conformance.js.map +1 -0
- package/dist/provider/errors.d.ts +29 -0
- package/dist/provider/errors.d.ts.map +1 -1
- package/dist/provider/errors.js +27 -10
- package/dist/provider/errors.js.map +1 -1
- package/dist/provider/fallback.d.ts +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +27 -9
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.d.ts +47 -0
- package/dist/provider/idle-timeout.d.ts.map +1 -0
- package/dist/provider/idle-timeout.js +61 -0
- package/dist/provider/idle-timeout.js.map +1 -0
- package/dist/provider/instrumentation.d.ts +3 -2
- package/dist/provider/instrumentation.d.ts.map +1 -1
- package/dist/provider/instrumentation.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +58 -21
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +79 -15
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +173 -17
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +8 -1
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +29 -1
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +21 -4
- package/dist/public-types.d.ts.map +1 -1
- package/dist/rag/rag-tool.d.ts.map +1 -1
- package/dist/rag/rag-tool.js +4 -1
- package/dist/rag/rag-tool.js.map +1 -1
- package/dist/read-model/index.d.ts +5 -0
- package/dist/read-model/index.d.ts.map +1 -0
- package/dist/read-model/index.js +7 -0
- package/dist/read-model/index.js.map +1 -0
- package/dist/read-model/registry.d.ts +112 -0
- package/dist/read-model/registry.d.ts.map +1 -0
- package/dist/read-model/registry.js +105 -0
- package/dist/read-model/registry.js.map +1 -0
- package/dist/read-model/run-status.d.ts +43 -0
- package/dist/read-model/run-status.d.ts.map +1 -0
- package/dist/read-model/run-status.js +89 -0
- package/dist/read-model/run-status.js.map +1 -0
- package/dist/registry/{Registry.d.ts → BaseRegistry.d.ts} +2 -2
- package/dist/registry/BaseRegistry.d.ts.map +1 -0
- package/dist/registry/{Registry.js → BaseRegistry.js} +2 -2
- package/dist/registry/BaseRegistry.js.map +1 -0
- package/dist/registry/ManagedRegistry.d.ts +2 -2
- package/dist/registry/ManagedRegistry.d.ts.map +1 -1
- package/dist/registry/ManagedRegistry.js +26 -9
- package/dist/registry/ManagedRegistry.js.map +1 -1
- package/dist/registry/command/index-exports.d.ts +3 -0
- package/dist/registry/command/index-exports.d.ts.map +1 -0
- package/dist/registry/command/index-exports.js +5 -0
- package/dist/registry/command/index-exports.js.map +1 -0
- package/dist/registry/command/index.d.ts +53 -0
- package/dist/registry/command/index.d.ts.map +1 -0
- package/dist/registry/command/index.js +87 -0
- package/dist/registry/command/index.js.map +1 -0
- package/dist/registry/command/kernel-commands.d.ts +32 -0
- package/dist/registry/command/kernel-commands.d.ts.map +1 -0
- package/dist/registry/command/kernel-commands.js +78 -0
- package/dist/registry/command/kernel-commands.js.map +1 -0
- package/dist/registry/connector/scoped.d.ts +2 -1
- package/dist/registry/connector/scoped.d.ts.map +1 -1
- package/dist/registry/connector/scoped.js +6 -5
- package/dist/registry/connector/scoped.js.map +1 -1
- package/dist/registry/index.d.ts +4 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +5 -1
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/tool/execute.d.ts +1 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +46 -13
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/registry/tool/presentation.d.ts +32 -0
- package/dist/registry/tool/presentation.d.ts.map +1 -0
- package/dist/registry/tool/presentation.js +92 -0
- package/dist/registry/tool/presentation.js.map +1 -0
- package/dist/registry/tool/screen.d.ts +33 -0
- package/dist/registry/tool/screen.d.ts.map +1 -0
- package/dist/registry/tool/screen.js +103 -0
- package/dist/registry/tool/screen.js.map +1 -0
- package/dist/run/drain.d.ts +13 -3
- package/dist/run/drain.d.ts.map +1 -1
- package/dist/run/drain.js +10 -0
- package/dist/run/drain.js.map +1 -1
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +203 -149
- package/dist/run/reporter.js.map +1 -1
- package/dist/run-query/index.d.ts +74 -0
- package/dist/run-query/index.d.ts.map +1 -0
- package/dist/run-query/index.js +73 -0
- package/dist/run-query/index.js.map +1 -0
- package/dist/runtime/bidi/session.d.ts.map +1 -1
- package/dist/runtime/bidi/session.js +7 -2
- package/dist/runtime/bidi/session.js.map +1 -1
- package/dist/runtime/decision/fallback.d.ts.map +1 -1
- package/dist/runtime/decision/fallback.js +6 -3
- package/dist/runtime/decision/fallback.js.map +1 -1
- package/dist/runtime/decision/parser.d.ts.map +1 -1
- package/dist/runtime/decision/parser.js +10 -9
- package/dist/runtime/decision/parser.js.map +1 -1
- package/dist/runtime/jobs/registry.d.ts +147 -0
- package/dist/runtime/jobs/registry.d.ts.map +1 -0
- package/dist/runtime/jobs/registry.js +242 -0
- package/dist/runtime/jobs/registry.js.map +1 -0
- package/dist/runtime/query/approval-policy.d.ts +22 -0
- package/dist/runtime/query/approval-policy.d.ts.map +1 -0
- package/dist/runtime/query/approval-policy.js +61 -0
- package/dist/runtime/query/approval-policy.js.map +1 -0
- package/dist/runtime/query/checkpoint.d.ts +3 -3
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +2 -2
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/context.d.ts +85 -15
- package/dist/runtime/query/context.d.ts.map +1 -1
- package/dist/runtime/query/context.js +57 -14
- package/dist/runtime/query/context.js.map +1 -1
- package/dist/runtime/query/events.d.ts +5 -4
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +9 -6
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +113 -4
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +228 -62
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/guardrail-presets.d.ts +30 -1
- package/dist/runtime/query/guardrail-presets.d.ts.map +1 -1
- package/dist/runtime/query/guardrail-presets.js +59 -14
- package/dist/runtime/query/guardrail-presets.js.map +1 -1
- package/dist/runtime/query/guardrails.d.ts.map +1 -1
- package/dist/runtime/query/guardrails.js +16 -12
- package/dist/runtime/query/guardrails.js.map +1 -1
- package/dist/runtime/query/index.d.ts +140 -16
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +379 -76
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +32 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +256 -88
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +17 -16
- package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts +1 -8
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +202 -178
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +52 -6
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +26 -17
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts +2 -2
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +27 -7
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.js +3 -2
- package/dist/runtime/query/iteration/phases/working-memory.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +14 -14
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/{context-cache.d.ts → prompt-cache.d.ts} +6 -4
- package/dist/runtime/query/prompt-cache.d.ts.map +1 -0
- package/dist/runtime/query/{context-cache.js → prompt-cache.js} +20 -2
- package/dist/runtime/query/prompt-cache.js.map +1 -0
- package/dist/runtime/query/prompt.d.ts +50 -0
- package/dist/runtime/query/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +83 -4
- package/dist/runtime/query/prompt.js.map +1 -1
- package/dist/runtime/query/repeat-call.d.ts +42 -0
- package/dist/runtime/query/repeat-call.d.ts.map +1 -0
- package/dist/runtime/query/repeat-call.js +107 -0
- package/dist/runtime/query/repeat-call.js.map +1 -0
- package/dist/runtime/query/replay/mutate.js +8 -1
- package/dist/runtime/query/replay/mutate.js.map +1 -1
- package/dist/runtime/query/result.d.ts +7 -0
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +38 -10
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +19 -17
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/resume-run.d.ts +2 -2
- package/dist/runtime/query/resume-run.d.ts.map +1 -1
- package/dist/runtime/query/run-state.d.ts +3 -3
- package/dist/runtime/query/run-state.d.ts.map +1 -1
- package/dist/runtime/query/run-state.js +2 -2
- package/dist/runtime/query/run-state.js.map +1 -1
- package/dist/runtime/query/tool-grants.d.ts +7 -0
- package/dist/runtime/query/tool-grants.d.ts.map +1 -1
- package/dist/runtime/query/tool-grants.js +1 -1
- package/dist/runtime/query/tool-grants.js.map +1 -1
- package/dist/runtime/query/tool-output-budget.js +34 -3
- package/dist/runtime/query/tool-output-budget.js.map +1 -1
- package/dist/runtime/query/tool-pause.d.ts.map +1 -1
- package/dist/runtime/query/tool-pause.js +2 -1
- package/dist/runtime/query/tool-pause.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +10 -2
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +3 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/sandbox/provider/local.d.ts +10 -0
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +77 -23
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/sandbox/terminal.d.ts +130 -0
- package/dist/sandbox/terminal.d.ts.map +1 -0
- package/dist/sandbox/terminal.js +119 -0
- package/dist/sandbox/terminal.js.map +1 -0
- package/dist/{gateway → scheduler}/completion-inbox.d.ts +12 -5
- package/dist/scheduler/completion-inbox.d.ts.map +1 -0
- package/dist/{gateway → scheduler}/completion-inbox.js +19 -7
- package/dist/scheduler/completion-inbox.js.map +1 -0
- package/dist/scheduler/delegating.d.ts +90 -0
- package/dist/scheduler/delegating.d.ts.map +1 -0
- package/dist/scheduler/delegating.js +230 -0
- package/dist/scheduler/delegating.js.map +1 -0
- package/dist/{gateway → scheduler}/local.d.ts +10 -2
- package/dist/scheduler/local.d.ts.map +1 -0
- package/dist/{gateway → scheduler}/local.js +20 -11
- package/dist/scheduler/local.js.map +1 -0
- package/dist/session/actor-scope.d.ts +52 -0
- package/dist/session/actor-scope.d.ts.map +1 -0
- package/dist/session/actor-scope.js +112 -0
- package/dist/session/actor-scope.js.map +1 -0
- package/dist/session/errors.d.ts +31 -8
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/errors.js +21 -1
- package/dist/session/errors.js.map +1 -1
- package/dist/session/handoff/assignment.d.ts +5 -5
- package/dist/session/handoff/assignment.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.d.ts +2 -2
- package/dist/session/handoff/broadcast.d.ts.map +1 -1
- package/dist/session/handoff/broadcast.js +7 -7
- package/dist/session/handoff/broadcast.js.map +1 -1
- package/dist/session/handoff/single.d.ts +4 -4
- package/dist/session/handoff/single.d.ts.map +1 -1
- package/dist/session/handoff/single.js +4 -4
- package/dist/session/handoff/single.js.map +1 -1
- package/dist/session/migration/filesystem.d.ts +28 -0
- package/dist/session/migration/filesystem.d.ts.map +1 -1
- package/dist/session/migration/filesystem.js +44 -2
- package/dist/session/migration/filesystem.js.map +1 -1
- package/dist/session/migration/id-prefix.d.ts +50 -19
- package/dist/session/migration/id-prefix.d.ts.map +1 -1
- package/dist/session/migration/id-prefix.js +54 -22
- package/dist/session/migration/id-prefix.js.map +1 -1
- package/dist/session/migration/index.d.ts +6 -2
- package/dist/session/migration/index.d.ts.map +1 -1
- package/dist/session/migration/index.js +6 -2
- package/dist/session/migration/index.js.map +1 -1
- package/dist/session/migration/marker.d.ts.map +1 -1
- package/dist/session/migration/marker.js +21 -4
- package/dist/session/migration/marker.js.map +1 -1
- package/dist/session/retention/archive.d.ts.map +1 -1
- package/dist/session/retention/archive.js +25 -11
- package/dist/session/retention/archive.js.map +1 -1
- package/dist/session/workspace/git-worktree.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.js +17 -8
- package/dist/session/workspace/git-worktree.js.map +1 -1
- package/dist/skills/loader.d.ts +4 -2
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +36 -9
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/registry.d.ts +59 -1
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +154 -20
- package/dist/skills/registry.js.map +1 -1
- package/dist/store/attachment/index.d.ts +111 -0
- package/dist/store/attachment/index.d.ts.map +1 -0
- package/dist/store/attachment/index.js +94 -0
- package/dist/store/attachment/index.js.map +1 -0
- package/dist/store/config/index.d.ts +43 -0
- package/dist/store/config/index.d.ts.map +1 -0
- package/dist/store/config/index.js +51 -0
- package/dist/store/config/index.js.map +1 -0
- package/dist/store/feedback/conformance.d.ts +44 -0
- package/dist/store/feedback/conformance.d.ts.map +1 -0
- package/dist/store/feedback/conformance.js +127 -0
- package/dist/store/feedback/conformance.js.map +1 -0
- package/dist/store/feedback/disk.d.ts +46 -0
- package/dist/store/feedback/disk.d.ts.map +1 -0
- package/dist/store/feedback/disk.js +141 -0
- package/dist/store/feedback/disk.js.map +1 -0
- package/dist/store/feedback/index.d.ts +9 -0
- package/dist/store/feedback/index.d.ts.map +1 -0
- package/dist/store/feedback/index.js +5 -0
- package/dist/store/feedback/index.js.map +1 -0
- package/dist/store/feedback/memory.d.ts +33 -0
- package/dist/store/feedback/memory.d.ts.map +1 -0
- package/dist/store/feedback/memory.js +0 -0
- package/dist/store/feedback/memory.js.map +1 -0
- package/dist/store/feedback/types.d.ts +95 -0
- package/dist/store/feedback/types.d.ts.map +1 -0
- package/dist/store/feedback/types.js +27 -0
- package/dist/store/feedback/types.js.map +1 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +4 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/kv/record-store.d.ts +54 -0
- package/dist/store/kv/record-store.d.ts.map +1 -0
- package/dist/store/kv/record-store.js +94 -0
- package/dist/store/kv/record-store.js.map +1 -0
- package/dist/store/memory/disk.d.ts +2 -0
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +36 -30
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/run/checkpoint-disk.d.ts +4 -4
- package/dist/store/run/checkpoint-disk.d.ts.map +1 -1
- package/dist/store/run/checkpoint-disk.js +22 -1
- package/dist/store/run/checkpoint-disk.js.map +1 -1
- package/dist/store/run/checkpoint-memory.d.ts +4 -4
- package/dist/store/run/checkpoint-memory.d.ts.map +1 -1
- package/dist/store/run/checkpoint-memory.js.map +1 -1
- package/dist/store/run/claim-disk.d.ts +5 -5
- package/dist/store/run/claim-disk.d.ts.map +1 -1
- package/dist/store/run/claim-disk.js +20 -0
- package/dist/store/run/claim-disk.js.map +1 -1
- package/dist/store/run/conformance.d.ts.map +1 -1
- package/dist/store/run/conformance.js +10 -9
- package/dist/store/run/conformance.js.map +1 -1
- package/dist/store/run/disk.d.ts +3 -1
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js +73 -4
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/run/listing.d.ts +4 -4
- package/dist/store/run/listing.d.ts.map +1 -1
- package/dist/store/run/listing.js.map +1 -1
- package/dist/store/run/memory.d.ts +5 -0
- package/dist/store/run/memory.d.ts.map +1 -1
- package/dist/store/run/memory.js +20 -1
- package/dist/store/run/memory.js.map +1 -1
- package/dist/store/session/canonical-path.d.ts +32 -0
- package/dist/store/session/canonical-path.d.ts.map +1 -0
- package/dist/store/session/canonical-path.js +46 -0
- package/dist/store/session/canonical-path.js.map +1 -0
- package/dist/store/session/disk.d.ts +46 -2
- package/dist/store/session/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +191 -205
- package/dist/store/session/disk.js.map +1 -1
- package/dist/store/session/memory.d.ts +10 -2
- package/dist/store/session/memory.d.ts.map +1 -1
- package/dist/store/session/memory.js +36 -4
- package/dist/store/session/memory.js.map +1 -1
- package/dist/store/task/disk.d.ts.map +1 -1
- package/dist/store/task/disk.js +76 -68
- package/dist/store/task/disk.js.map +1 -1
- package/dist/store/topic/index.d.ts +6 -0
- package/dist/store/topic/index.d.ts.map +1 -0
- package/dist/store/topic/index.js +20 -0
- package/dist/store/topic/index.js.map +1 -0
- package/dist/store/topic/memory.d.ts +30 -0
- package/dist/store/topic/memory.d.ts.map +1 -0
- package/dist/store/topic/memory.js +97 -0
- package/dist/store/topic/memory.js.map +1 -0
- package/dist/store/topic/objective.d.ts +104 -0
- package/dist/store/topic/objective.d.ts.map +1 -0
- package/dist/store/topic/objective.js +195 -0
- package/dist/store/topic/objective.js.map +1 -0
- package/dist/store/topic/state.d.ts +60 -0
- package/dist/store/topic/state.d.ts.map +1 -0
- package/dist/store/topic/state.js +128 -0
- package/dist/store/topic/state.js.map +1 -0
- package/dist/streaming/coalesce.d.ts +19 -6
- package/dist/streaming/coalesce.d.ts.map +1 -1
- package/dist/streaming/coalesce.js +13 -4
- package/dist/streaming/coalesce.js.map +1 -1
- package/dist/telemetry/runtime-accessors.d.ts +27 -1
- package/dist/telemetry/runtime-accessors.d.ts.map +1 -1
- package/dist/telemetry/runtime-accessors.js +45 -1
- package/dist/telemetry/runtime-accessors.js.map +1 -1
- package/dist/test-support/ids.d.ts +68 -0
- package/dist/test-support/ids.d.ts.map +1 -0
- package/dist/test-support/ids.js +70 -0
- package/dist/test-support/ids.js.map +1 -0
- package/dist/testing.d.ts +24 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +22 -0
- package/dist/testing.js.map +1 -0
- package/dist/tools/builtins/bash.d.ts +1 -0
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +77 -3
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +8 -8
- package/dist/tools/builtins/edit.d.ts +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +34 -0
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +6 -0
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js +24 -1
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/job.d.ts +6 -0
- package/dist/tools/builtins/job.d.ts.map +1 -0
- package/dist/tools/builtins/job.js +114 -0
- package/dist/tools/builtins/job.js.map +1 -0
- package/dist/tools/builtins/lsp.d.ts +21 -0
- package/dist/tools/builtins/lsp.d.ts.map +1 -0
- package/dist/tools/builtins/lsp.js +186 -0
- package/dist/tools/builtins/lsp.js.map +1 -0
- package/dist/tools/builtins/run-code.d.ts +13 -0
- package/dist/tools/builtins/run-code.d.ts.map +1 -0
- package/dist/tools/builtins/run-code.js +126 -0
- package/dist/tools/builtins/run-code.js.map +1 -0
- package/dist/tools/builtins/skill.d.ts +14 -0
- package/dist/tools/builtins/skill.d.ts.map +1 -0
- package/dist/tools/builtins/skill.js +120 -0
- package/dist/tools/builtins/skill.js.map +1 -0
- package/dist/tools/builtins/web-guidance.d.ts +31 -0
- package/dist/tools/builtins/web-guidance.d.ts.map +1 -0
- package/dist/tools/builtins/web-guidance.js +42 -0
- package/dist/tools/builtins/web-guidance.js.map +1 -0
- package/dist/tools/builtins/web.d.ts +10 -0
- package/dist/tools/builtins/web.d.ts.map +1 -0
- package/dist/tools/builtins/web.js +137 -0
- package/dist/tools/builtins/web.js.map +1 -0
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +35 -0
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/coordinator/agent.d.ts +2 -2
- package/dist/tools/coordinator/agent.d.ts.map +1 -1
- package/dist/tools/coordinator/index.d.ts +13 -4
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +125 -38
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/coordinator/outcome.d.ts +2 -2
- package/dist/tools/coordinator/outcome.d.ts.map +1 -1
- package/dist/tools/coordinator/outcome.js +1 -1
- package/dist/tools/coordinator/wait-with-idle-bound.d.ts +3 -3
- package/dist/tools/coordinator/wait-with-idle-bound.d.ts.map +1 -1
- package/dist/tools/coordinator/wait-with-idle-bound.js.map +1 -1
- package/dist/tools/defineTool.d.ts +12 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +2 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/env-scrub.d.ts +66 -0
- package/dist/tools/env-scrub.d.ts.map +1 -0
- package/dist/tools/env-scrub.js +68 -0
- package/dist/tools/env-scrub.js.map +1 -0
- package/dist/tools/memory/read.d.ts.map +1 -1
- package/dist/tools/memory/read.js +5 -1
- package/dist/tools/memory/read.js.map +1 -1
- package/dist/tools/task/create.d.ts.map +1 -1
- package/dist/tools/task/create.js +2 -1
- package/dist/tools/task/create.js.map +1 -1
- package/dist/tools/task/update.d.ts.map +1 -1
- package/dist/tools/task/update.js +7 -3
- package/dist/tools/task/update.js.map +1 -1
- package/dist/types/acp/index.d.ts +161 -0
- package/dist/types/acp/index.d.ts.map +1 -0
- package/dist/types/acp/index.js +2 -0
- package/dist/types/acp/index.js.map +1 -0
- package/dist/types/agent/base.d.ts +62 -5
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/delegate.d.ts +102 -0
- package/dist/types/agent/delegate.d.ts.map +1 -0
- package/dist/types/agent/delegate.js +2 -0
- package/dist/types/agent/delegate.js.map +1 -0
- package/dist/types/agent/index.d.ts +1 -1
- package/dist/types/agent/index.d.ts.map +1 -1
- package/dist/types/agent/index.js +1 -1
- package/dist/types/agent/index.js.map +1 -1
- package/dist/types/agent/manager.d.ts +7 -1
- package/dist/types/agent/manager.d.ts.map +1 -1
- package/dist/types/agent/reactive.d.ts +24 -3
- package/dist/types/agent/reactive.d.ts.map +1 -1
- package/dist/types/agent/{gateway.d.ts → scheduler.d.ts} +41 -5
- package/dist/types/agent/scheduler.d.ts.map +1 -0
- package/dist/types/agent/scheduler.js +2 -0
- package/dist/types/agent/scheduler.js.map +1 -0
- package/dist/types/agent/supervisor.d.ts +23 -5
- package/dist/types/agent/supervisor.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +31 -9
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/agent/working-memory.d.ts +1 -1
- package/dist/types/authorization/index.d.ts +634 -0
- package/dist/types/authorization/index.d.ts.map +1 -0
- package/dist/types/authorization/index.js +103 -0
- package/dist/types/authorization/index.js.map +1 -0
- package/dist/types/bus/index.d.ts +24 -1
- package/dist/types/bus/index.d.ts.map +1 -1
- package/dist/types/code-navigation/index.d.ts +112 -0
- package/dist/types/code-navigation/index.d.ts.map +1 -0
- package/dist/types/code-navigation/index.js +17 -0
- package/dist/types/code-navigation/index.js.map +1 -0
- package/dist/types/command/index.d.ts +74 -0
- package/dist/types/command/index.d.ts.map +1 -0
- package/dist/types/command/index.js +18 -0
- package/dist/types/command/index.js.map +1 -0
- package/dist/types/common/index.d.ts +19 -2
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/connector/mcp.d.ts +8 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/guardrail/index.d.ts +74 -1
- package/dist/types/guardrail/index.d.ts.map +1 -1
- package/dist/types/hitl/policy.d.ts +79 -0
- package/dist/types/hitl/policy.d.ts.map +1 -0
- package/dist/types/hitl/policy.js +2 -0
- package/dist/types/hitl/policy.js.map +1 -0
- package/dist/types/ids/brand.d.ts +55 -0
- package/dist/types/ids/brand.d.ts.map +1 -0
- package/dist/types/ids/brand.js +45 -0
- package/dist/types/ids/brand.js.map +1 -0
- package/dist/types/ids/index.d.ts +98 -39
- package/dist/types/ids/index.d.ts.map +1 -1
- package/dist/types/ids/index.js +5 -1
- package/dist/types/ids/index.js.map +1 -1
- package/dist/types/message/index.d.ts +24 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +2 -2
- package/dist/types/project/entity.d.ts +22 -2
- package/dist/types/project/entity.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +43 -2
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/provider/model.d.ts +16 -2
- package/dist/types/provider/model.d.ts.map +1 -1
- package/dist/types/run/audit.d.ts +150 -0
- package/dist/types/run/audit.d.ts.map +1 -0
- package/dist/types/run/audit.js +39 -0
- package/dist/types/run/audit.js.map +1 -0
- package/dist/types/run/cancel-cause.d.ts +49 -0
- package/dist/types/run/cancel-cause.d.ts.map +1 -0
- package/dist/types/run/cancel-cause.js +39 -0
- package/dist/types/run/cancel-cause.js.map +1 -0
- package/dist/types/run/checkpoint-store.d.ts +29 -11
- package/dist/types/run/checkpoint-store.d.ts.map +1 -1
- package/dist/types/run/config.d.ts +24 -4
- package/dist/types/run/config.d.ts.map +1 -1
- package/dist/types/run/derive-status.d.ts +3 -3
- package/dist/types/run/derive-status.d.ts.map +1 -1
- package/dist/types/run/derive-status.js +1 -1
- package/dist/types/run/entity.d.ts +2 -3
- package/dist/types/run/entity.d.ts.map +1 -1
- package/dist/types/run/event-cursor.d.ts +3 -3
- package/dist/types/run/event-cursor.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +159 -4
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/index.d.ts +2 -0
- package/dist/types/run/index.d.ts.map +1 -1
- package/dist/types/run/index.js +2 -0
- package/dist/types/run/index.js.map +1 -1
- package/dist/types/run/metadata.d.ts +2 -2
- package/dist/types/run/metadata.d.ts.map +1 -1
- package/dist/types/run/prepare-step.d.ts +29 -0
- package/dist/types/run/prepare-step.d.ts.map +1 -1
- package/dist/types/run/state.d.ts +33 -10
- package/dist/types/run/state.d.ts.map +1 -1
- package/dist/types/run/state.js +60 -3
- package/dist/types/run/state.js.map +1 -1
- package/dist/types/run/stop-reason.d.ts +9 -0
- package/dist/types/run/stop-reason.d.ts.map +1 -1
- package/dist/types/run/store.d.ts +38 -0
- package/dist/types/run/store.d.ts.map +1 -1
- package/dist/types/sandbox/index.d.ts +38 -0
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js +21 -0
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/session/actor.d.ts +2 -2
- package/dist/types/session/actor.d.ts.map +1 -1
- package/dist/types/session/entity.d.ts +9 -7
- package/dist/types/session/entity.d.ts.map +1 -1
- package/dist/types/session/ids.d.ts +3 -1
- package/dist/types/session/ids.d.ts.map +1 -1
- package/dist/types/session/index.d.ts +4 -2
- package/dist/types/session/index.d.ts.map +1 -1
- package/dist/types/session/store.d.ts +51 -22
- package/dist/types/session/store.d.ts.map +1 -1
- package/dist/types/session/sub-session.d.ts +55 -5
- package/dist/types/session/sub-session.d.ts.map +1 -1
- package/dist/types/skills/index.d.ts +41 -0
- package/dist/types/skills/index.d.ts.map +1 -1
- package/dist/types/skills/index.js +17 -1
- package/dist/types/skills/index.js.map +1 -1
- package/dist/types/tool/index.d.ts +186 -1
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +53 -0
- package/dist/types/tool/presentation.d.ts.map +1 -0
- package/dist/types/tool/presentation.js +2 -0
- package/dist/types/tool/presentation.js.map +1 -0
- package/dist/types/{thread → topic}/entity.d.ts +34 -26
- package/dist/types/topic/entity.d.ts.map +1 -0
- package/dist/types/{thread → topic}/entity.js.map +1 -1
- package/dist/types/topic/index.d.ts +5 -0
- package/dist/types/topic/index.d.ts.map +1 -0
- package/dist/types/topic/index.js +11 -0
- package/dist/types/topic/index.js.map +1 -0
- package/dist/types/topic/objective.d.ts +86 -0
- package/dist/types/topic/objective.d.ts.map +1 -0
- package/dist/types/topic/objective.js +10 -0
- package/dist/types/topic/objective.js.map +1 -0
- package/dist/types/topic/state.d.ts +56 -0
- package/dist/types/topic/state.d.ts.map +1 -0
- package/dist/types/topic/state.js +10 -0
- package/dist/types/topic/state.js.map +1 -0
- package/dist/types/topic/store.d.ts +95 -0
- package/dist/types/topic/store.d.ts.map +1 -0
- package/dist/types/topic/store.js +29 -0
- package/dist/types/topic/store.js.map +1 -0
- package/dist/types/workspace/ref.d.ts +7 -0
- package/dist/types/workspace/ref.d.ts.map +1 -1
- package/dist/utils/abort.d.ts.map +1 -1
- package/dist/utils/abort.js +13 -1
- package/dist/utils/abort.js.map +1 -1
- package/dist/utils/hash.d.ts +10 -0
- package/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +15 -0
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/id.d.ts +90 -2
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +113 -5
- package/dist/utils/id.js.map +1 -1
- package/dist/utils/log/attributes.d.ts +17 -0
- package/dist/utils/log/attributes.d.ts.map +1 -0
- package/dist/utils/log/attributes.js +2 -0
- package/dist/utils/log/attributes.js.map +1 -0
- package/dist/utils/log/caps.d.ts +27 -0
- package/dist/utils/log/caps.d.ts.map +1 -0
- package/dist/utils/log/caps.js +107 -0
- package/dist/utils/log/caps.js.map +1 -0
- package/dist/utils/log/create-logger.d.ts +28 -0
- package/dist/utils/log/create-logger.d.ts.map +1 -0
- package/dist/utils/log/create-logger.js +168 -0
- package/dist/utils/log/create-logger.js.map +1 -0
- package/dist/utils/log/exception.d.ts +11 -0
- package/dist/utils/log/exception.d.ts.map +1 -0
- package/dist/utils/log/exception.js +108 -0
- package/dist/utils/log/exception.js.map +1 -0
- package/dist/utils/log/index.d.ts +7 -0
- package/dist/utils/log/index.d.ts.map +1 -0
- package/dist/utils/log/index.js +15 -0
- package/dist/utils/log/index.js.map +1 -0
- package/dist/utils/log/process-sink.d.ts +28 -0
- package/dist/utils/log/process-sink.d.ts.map +1 -0
- package/dist/utils/log/process-sink.js +56 -0
- package/dist/utils/log/process-sink.js.map +1 -0
- package/dist/utils/log/redact.d.ts +3 -0
- package/dist/utils/log/redact.d.ts.map +1 -0
- package/dist/utils/log/redact.js +71 -0
- package/dist/utils/log/redact.js.map +1 -0
- package/dist/utils/log/sinks.d.ts +43 -0
- package/dist/utils/log/sinks.d.ts.map +1 -0
- package/dist/utils/log/sinks.js +184 -0
- package/dist/utils/log/sinks.js.map +1 -0
- package/dist/utils/log/templates.d.ts +63 -0
- package/dist/utils/log/templates.d.ts.map +1 -0
- package/dist/utils/log/templates.js +119 -0
- package/dist/utils/log/templates.js.map +1 -0
- package/dist/utils/log/types.d.ts +183 -0
- package/dist/utils/log/types.d.ts.map +1 -0
- package/dist/utils/log/types.js +55 -0
- package/dist/utils/log/types.js.map +1 -0
- package/dist/utils/logger.d.ts +44 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +102 -2
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/renamed-field.d.ts +19 -0
- package/dist/utils/renamed-field.d.ts.map +1 -0
- package/dist/utils/renamed-field.js +29 -0
- package/dist/utils/renamed-field.js.map +1 -0
- package/dist/vault/CredentialProvider.d.ts +89 -0
- package/dist/vault/CredentialProvider.d.ts.map +1 -0
- package/dist/vault/CredentialProvider.js +64 -0
- package/dist/vault/CredentialProvider.js.map +1 -0
- package/dist/vault/InMemoryCredentialVault.d.ts +2 -1
- package/dist/vault/InMemoryCredentialVault.d.ts.map +1 -1
- package/dist/vault/InMemoryCredentialVault.js +15 -5
- package/dist/vault/InMemoryCredentialVault.js.map +1 -1
- package/dist/vault/index.d.ts +3 -0
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/index.js +5 -0
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/instrumentation.d.ts +18 -2
- package/dist/vault/instrumentation.d.ts.map +1 -1
- package/dist/vault/instrumentation.js +47 -0
- package/dist/vault/instrumentation.js.map +1 -1
- package/package.json +4 -4
- package/src/advisory/executor.ts +14 -12
- package/src/advisory/registry.ts +2 -2
- package/src/agents/AGENTS.md +91 -0
- package/src/agents/AbstractAgent.ts +67 -14
- package/src/agents/PipelineAgent.ts +46 -12
- package/src/agents/ReactiveAgent.ts +27 -13
- package/src/agents/RouterAgent.ts +33 -21
- package/src/agents/SupervisorAgent.ts +51 -26
- package/src/agents/handle.ts +149 -0
- package/src/agents/runAgent.ts +14 -7
- package/src/{verification → authorization}/gate.ts +39 -32
- package/src/authorization/index.ts +26 -0
- package/src/authorization/permission-presets.ts +215 -0
- package/src/{verification → authorization}/presets.ts +15 -3
- package/src/{verification → authorization}/rules.ts +16 -3
- package/src/bridge/a2a/client.ts +369 -0
- package/src/bridge/a2a/mapper.ts +17 -0
- package/src/bridge/acp/filesystem.ts +63 -0
- package/src/bridge/acp/index.ts +11 -0
- package/src/bridge/acp/permission.ts +71 -0
- package/src/bridge/acp/server.ts +500 -0
- package/src/bridge/acp/update.ts +109 -0
- package/src/bridge/mcp/connector/adapter.ts +8 -4
- package/src/bridge/sse/mapper.ts +30 -0
- package/src/bus/breaker.ts +15 -10
- package/src/bus/index.ts +10 -8
- package/src/bus/lock.ts +36 -19
- package/src/bus/ownership.ts +17 -9
- package/src/compaction/context-window.ts +23 -1
- package/src/compaction/index.ts +6 -0
- package/src/compaction/manual.ts +177 -0
- package/src/compaction/plan.ts +226 -0
- package/src/compaction/summary.ts +31 -0
- package/src/compaction/verifier.ts +2 -2
- package/src/config/registry.ts +208 -0
- package/src/config/runtime.ts +27 -0
- package/src/connector/BaseConnector.ts +8 -3
- package/src/connector/builtins/http.ts +12 -2
- package/src/connector/builtins/webhook.ts +6 -2
- package/src/connector/index.ts +45 -29
- package/src/connector/mcp/adapter.ts +51 -1
- package/src/connector/mcp/client.ts +32 -20
- package/src/connector/mcp/discovery.ts +31 -20
- package/src/connector/mcp/http-sse.ts +12 -6
- package/src/connector/mcp/index.ts +8 -7
- package/src/connector/mcp/reconnect.ts +194 -0
- package/src/connector/mcp/server/index.ts +32 -0
- package/src/connector/mcp/{server-stdio.ts → server/server-stdio.ts} +5 -4
- package/src/connector/mcp/{server.ts → server/server.ts} +17 -11
- package/src/connector/mcp/stdio.ts +18 -9
- package/src/connector/mcp/streamable-http.ts +8 -4
- package/src/{bridge/tools/connector → connector/tools}/adapter.ts +5 -5
- package/src/{bridge/tools/connector → connector/tools}/definitions.ts +4 -4
- package/src/{bridge/tools/connector → connector/tools}/router.ts +17 -9
- package/src/connector/web/guarded-fetch.ts +288 -0
- package/src/connector/web/index.ts +17 -0
- package/src/connector/web/types.ts +99 -0
- package/src/constants/acp/index.ts +104 -0
- package/src/constants/credential-env-keys.ts +63 -0
- package/src/constants/index.ts +3 -1
- package/src/constants/secret-patterns.ts +102 -0
- package/src/constants/telemetry/index.ts +98 -0
- package/src/contracts/api.ts +11 -0
- package/src/deprecated-aliases.ts +86 -0
- package/src/eval/judge.ts +2 -2
- package/src/execution/base.ts +18 -7
- package/src/execution/code-runtime/types.ts +116 -0
- package/src/execution/code-runtime/worker.ts +266 -0
- package/src/{connector/execution → execution}/factory.ts +3 -3
- package/src/{connector/execution → execution}/hybrid.ts +13 -7
- package/src/execution/index.ts +24 -0
- package/src/execution/local.ts +4 -2
- package/src/{connector/execution → execution}/remote.ts +15 -8
- package/src/index.ts +17 -0
- package/src/invariants/index.ts +201 -0
- package/src/manager/agent/lifecycle.ts +172 -58
- package/src/manager/connector/environment.ts +22 -11
- package/src/manager/connector/lifecycle.ts +30 -11
- package/src/manager/connector/tenant.ts +33 -14
- package/src/manager/index.ts +16 -2
- package/src/manager/project/lifecycle.ts +1 -1
- package/src/manager/run/emergency.ts +9 -7
- package/src/manager/run/persistence.ts +110 -8
- package/src/manager/topic/lifecycle.ts +235 -0
- package/src/manager/topic/objective.ts +203 -0
- package/src/persona/assembler.ts +14 -3
- package/src/plugin/lifecycle.ts +156 -20
- package/src/plugin/loader.ts +67 -16
- package/src/probe/index.ts +1 -0
- package/src/probe/registry.ts +41 -5
- package/src/process/kill-tree.ts +52 -0
- package/src/prompt/contributions.ts +173 -0
- package/src/prompt/index.ts +15 -0
- package/src/provider/attribution.ts +57 -0
- package/src/provider/{collect.ts → collect-chat-completion.ts} +4 -2
- package/src/provider/conformance.ts +189 -0
- package/src/provider/errors.ts +27 -12
- package/src/provider/fallback.ts +32 -10
- package/src/provider/idle-timeout.ts +112 -0
- package/src/provider/instrumentation.ts +4 -2
- package/src/provider/retry.ts +63 -21
- package/src/public-runtime.ts +378 -14
- package/src/public-tools.ts +41 -1
- package/src/public-types.ts +101 -4
- package/src/rag/rag-tool.ts +4 -2
- package/src/read-model/index.ts +14 -0
- package/src/read-model/registry.ts +152 -0
- package/src/read-model/run-status.ts +127 -0
- package/src/registry/{Registry.ts → BaseRegistry.ts} +1 -1
- package/src/registry/ManagedRegistry.ts +26 -9
- package/src/registry/command/index-exports.ts +4 -0
- package/src/registry/command/index.ts +105 -0
- package/src/registry/command/kernel-commands.ts +110 -0
- package/src/registry/connector/scoped.ts +6 -5
- package/src/registry/index.ts +7 -1
- package/src/registry/tool/execute.ts +52 -13
- package/src/registry/tool/presentation.ts +116 -0
- package/src/registry/tool/screen.ts +132 -0
- package/src/run/drain.ts +13 -3
- package/src/run/reporter.ts +208 -153
- package/src/run-query/index.ts +108 -0
- package/src/runtime/bidi/session.ts +7 -2
- package/src/runtime/decision/fallback.ts +6 -3
- package/src/runtime/decision/parser.ts +10 -9
- package/src/runtime/jobs/registry.ts +346 -0
- package/src/runtime/query/approval-policy.ts +78 -0
- package/src/runtime/query/checkpoint.ts +6 -6
- package/src/runtime/query/context.ts +120 -30
- package/src/runtime/query/events.ts +19 -11
- package/src/runtime/query/executor.ts +287 -66
- package/src/runtime/query/guardrail-presets.ts +61 -14
- package/src/runtime/query/guardrails.ts +16 -12
- package/src/runtime/query/index.ts +579 -96
- package/src/runtime/query/iteration/index.ts +269 -87
- package/src/runtime/query/iteration/phases/advisory.ts +17 -16
- package/src/runtime/query/iteration/phases/compaction.ts +235 -187
- package/src/runtime/query/iteration/phases/context.ts +82 -21
- package/src/runtime/query/iteration/phases/tool-review.ts +28 -9
- package/src/runtime/query/iteration/phases/working-memory.ts +3 -2
- package/src/runtime/query/iteration/stream-turn.ts +14 -14
- package/src/runtime/query/{context-cache.ts → prompt-cache.ts} +23 -3
- package/src/runtime/query/prompt.ts +104 -4
- package/src/runtime/query/repeat-call.ts +130 -0
- package/src/runtime/query/replay/mutate.ts +6 -0
- package/src/runtime/query/result.ts +47 -10
- package/src/runtime/query/resume-pending.ts +19 -17
- package/src/runtime/query/resume-run.ts +2 -2
- package/src/runtime/query/run-state.ts +5 -5
- package/src/runtime/query/tool-grants.ts +1 -1
- package/src/runtime/query/tool-output-budget.ts +36 -3
- package/src/runtime/query/tool-pause.ts +2 -1
- package/src/runtime/query/tooling.ts +17 -2
- package/src/sandbox/provider/local.ts +94 -21
- package/src/sandbox/terminal.ts +197 -0
- package/src/{gateway → scheduler}/completion-inbox.ts +20 -10
- package/src/scheduler/delegating.ts +297 -0
- package/src/{gateway → scheduler}/local.ts +24 -15
- package/src/session/actor-scope.ts +121 -0
- package/src/session/errors.ts +30 -8
- package/src/session/handoff/assignment.ts +5 -5
- package/src/session/handoff/broadcast.ts +9 -9
- package/src/session/handoff/single.ts +8 -8
- package/src/session/migration/filesystem.ts +46 -2
- package/src/session/migration/id-prefix.ts +60 -22
- package/src/session/migration/index.ts +5 -0
- package/src/session/migration/marker.ts +19 -4
- package/src/session/retention/archive.ts +32 -12
- package/src/session/workspace/git-worktree.ts +17 -8
- package/src/skills/loader.ts +39 -9
- package/src/skills/registry.ts +177 -20
- package/src/store/attachment/index.ts +182 -0
- package/src/store/config/index.ts +74 -0
- package/src/store/feedback/conformance.ts +193 -0
- package/src/store/feedback/disk.ts +184 -0
- package/src/store/feedback/index.ts +13 -0
- package/src/store/feedback/memory.ts +0 -0
- package/src/store/feedback/types.ts +107 -0
- package/src/store/index.ts +5 -0
- package/src/store/kv/record-store.ts +91 -0
- package/src/store/memory/disk.ts +35 -32
- package/src/store/run/checkpoint-disk.ts +27 -6
- package/src/store/run/checkpoint-memory.ts +8 -8
- package/src/store/run/claim-disk.ts +58 -13
- package/src/store/run/conformance.ts +11 -10
- package/src/store/run/disk.ts +77 -5
- package/src/store/run/listing.ts +6 -6
- package/src/store/run/memory.ts +24 -1
- package/src/store/session/canonical-path.ts +45 -0
- package/src/store/session/disk.ts +216 -191
- package/src/store/session/memory.ts +43 -5
- package/src/store/task/disk.ts +77 -67
- package/src/store/topic/index.ts +33 -0
- package/src/store/topic/memory.ts +111 -0
- package/src/store/topic/objective.ts +290 -0
- package/src/store/topic/state.ts +204 -0
- package/src/streaming/coalesce.ts +19 -5
- package/src/telemetry/runtime-accessors.ts +45 -1
- package/src/test-support/ids.ts +117 -0
- package/src/testing.ts +40 -0
- package/src/tools/builtins/bash.ts +82 -3
- package/src/tools/builtins/edit.ts +36 -0
- package/src/tools/builtins/index.ts +29 -1
- package/src/tools/builtins/job.ts +133 -0
- package/src/tools/builtins/lsp.ts +214 -0
- package/src/tools/builtins/run-code.ts +154 -0
- package/src/tools/builtins/skill.ts +134 -0
- package/src/tools/builtins/web-guidance.ts +46 -0
- package/src/tools/builtins/web.ts +156 -0
- package/src/tools/builtins/write-file.ts +37 -1
- package/src/tools/coordinator/agent.ts +2 -2
- package/src/tools/coordinator/index.ts +144 -40
- package/src/tools/coordinator/outcome.ts +2 -2
- package/src/tools/coordinator/wait-with-idle-bound.ts +3 -3
- package/src/tools/defineTool.ts +14 -0
- package/src/tools/env-scrub.ts +91 -0
- package/src/tools/memory/read.ts +5 -2
- package/src/tools/task/create.ts +2 -1
- package/src/tools/task/update.ts +7 -4
- package/src/types/acp/index.ts +163 -0
- package/src/types/agent/base.ts +67 -5
- package/src/types/agent/delegate.ts +110 -0
- package/src/types/agent/index.ts +1 -1
- package/src/types/agent/manager.ts +7 -1
- package/src/types/agent/reactive.ts +27 -3
- package/src/types/agent/{gateway.ts → scheduler.ts} +41 -4
- package/src/types/agent/supervisor.ts +26 -5
- package/src/types/agent/task.ts +31 -9
- package/src/types/agent/working-memory.ts +1 -1
- package/src/types/{verification → authorization}/index.ts +79 -10
- package/src/types/bus/index.ts +30 -1
- package/src/types/code-navigation/index.ts +99 -0
- package/src/types/command/index.ts +68 -0
- package/src/types/common/index.ts +26 -2
- package/src/types/connector/mcp.ts +8 -0
- package/src/types/guardrail/index.ts +72 -1
- package/src/types/hitl/policy.ts +83 -0
- package/src/types/ids/brand.ts +58 -0
- package/src/types/ids/index.ts +109 -42
- package/src/types/message/index.ts +25 -1
- package/src/types/project/entity.ts +22 -2
- package/src/types/provider/interface.ts +45 -2
- package/src/types/provider/model.ts +16 -2
- package/src/types/run/audit.ts +164 -0
- package/src/types/run/cancel-cause.ts +60 -0
- package/src/types/run/checkpoint-store.ts +31 -11
- package/src/types/run/config.ts +25 -4
- package/src/types/run/derive-status.ts +3 -3
- package/src/types/run/entity.ts +2 -4
- package/src/types/run/event-cursor.ts +3 -3
- package/src/types/run/events.ts +165 -6
- package/src/types/run/index.ts +2 -0
- package/src/types/run/metadata.ts +2 -2
- package/src/types/run/prepare-step.ts +33 -0
- package/src/types/run/state.ts +78 -11
- package/src/types/run/stop-reason.ts +9 -0
- package/src/types/run/store.ts +40 -0
- package/src/types/sandbox/index.ts +37 -0
- package/src/types/session/actor.ts +10 -2
- package/src/types/session/entity.ts +9 -7
- package/src/types/session/ids.ts +2 -0
- package/src/types/session/index.ts +2 -0
- package/src/types/session/store.ts +53 -22
- package/src/types/session/sub-session.ts +50 -9
- package/src/types/skills/index.ts +50 -0
- package/src/types/tool/index.ts +171 -1
- package/src/types/tool/presentation.ts +48 -0
- package/src/types/{thread → topic}/entity.ts +34 -26
- package/src/types/topic/index.ts +23 -0
- package/src/types/topic/objective.ts +93 -0
- package/src/types/topic/state.ts +60 -0
- package/src/types/topic/store.ts +101 -0
- package/src/types/workspace/ref.ts +7 -0
- package/src/utils/abort.ts +16 -1
- package/src/utils/hash.ts +16 -0
- package/src/utils/id.ts +172 -12
- package/src/utils/log/attributes.ts +47 -0
- package/src/utils/log/caps.ts +118 -0
- package/src/utils/log/create-logger.ts +198 -0
- package/src/utils/log/exception.ts +124 -0
- package/src/utils/log/index.ts +24 -0
- package/src/utils/log/process-sink.ts +76 -0
- package/src/utils/log/redact.ts +77 -0
- package/src/utils/log/sinks.ts +205 -0
- package/src/utils/log/templates.ts +161 -0
- package/src/utils/log/types.ts +195 -0
- package/src/utils/logger.ts +121 -2
- package/src/utils/renamed-field.ts +35 -0
- package/src/vault/CredentialProvider.ts +147 -0
- package/src/vault/InMemoryCredentialVault.ts +16 -5
- package/src/vault/index.ts +16 -0
- package/src/vault/instrumentation.ts +63 -2
- package/dist/bridge/tools/connector/adapter.d.ts.map +0 -1
- package/dist/bridge/tools/connector/adapter.js.map +0 -1
- package/dist/bridge/tools/connector/definitions.d.ts.map +0 -1
- package/dist/bridge/tools/connector/definitions.js.map +0 -1
- package/dist/bridge/tools/connector/index.d.ts.map +0 -1
- package/dist/bridge/tools/connector/index.js.map +0 -1
- package/dist/bridge/tools/connector/router.d.ts.map +0 -1
- package/dist/bridge/tools/connector/router.js.map +0 -1
- package/dist/connector/execution/factory.d.ts.map +0 -1
- package/dist/connector/execution/factory.js.map +0 -1
- package/dist/connector/execution/hybrid.d.ts.map +0 -1
- package/dist/connector/execution/hybrid.js.map +0 -1
- package/dist/connector/execution/index.d.ts +0 -6
- package/dist/connector/execution/index.d.ts.map +0 -1
- package/dist/connector/execution/index.js +0 -4
- package/dist/connector/execution/index.js.map +0 -1
- package/dist/connector/execution/remote.d.ts.map +0 -1
- package/dist/connector/execution/remote.js.map +0 -1
- package/dist/connector/mcp/server-stdio.d.ts.map +0 -1
- package/dist/connector/mcp/server-stdio.js.map +0 -1
- package/dist/connector/mcp/server.d.ts.map +0 -1
- package/dist/connector/mcp/server.js.map +0 -1
- package/dist/constants/verification/index.d.ts.map +0 -1
- package/dist/constants/verification/index.js.map +0 -1
- package/dist/gateway/completion-inbox.d.ts.map +0 -1
- package/dist/gateway/completion-inbox.js.map +0 -1
- package/dist/gateway/local.d.ts.map +0 -1
- package/dist/gateway/local.js.map +0 -1
- package/dist/manager/thread/lifecycle.d.ts +0 -105
- package/dist/manager/thread/lifecycle.d.ts.map +0 -1
- package/dist/manager/thread/lifecycle.js.map +0 -1
- package/dist/provider/collect.d.ts.map +0 -1
- package/dist/provider/collect.js.map +0 -1
- package/dist/registry/Registry.d.ts.map +0 -1
- package/dist/registry/Registry.js.map +0 -1
- package/dist/router/task-router.d.ts.map +0 -1
- package/dist/router/task-router.js.map +0 -1
- package/dist/runtime/query/context-cache.d.ts.map +0 -1
- package/dist/runtime/query/context-cache.js.map +0 -1
- package/dist/store/thread/disk.d.ts +0 -41
- package/dist/store/thread/disk.d.ts.map +0 -1
- package/dist/store/thread/disk.js +0 -238
- package/dist/store/thread/disk.js.map +0 -1
- package/dist/store/thread/index.d.ts +0 -4
- package/dist/store/thread/index.d.ts.map +0 -1
- package/dist/store/thread/index.js +0 -6
- package/dist/store/thread/index.js.map +0 -1
- package/dist/store/thread/memory.d.ts +0 -23
- package/dist/store/thread/memory.d.ts.map +0 -1
- package/dist/store/thread/memory.js +0 -90
- package/dist/store/thread/memory.js.map +0 -1
- package/dist/types/agent/gateway.d.ts.map +0 -1
- package/dist/types/agent/gateway.js +0 -2
- package/dist/types/agent/gateway.js.map +0 -1
- package/dist/types/thread/entity.d.ts.map +0 -1
- package/dist/types/thread/index.d.ts +0 -3
- package/dist/types/thread/index.d.ts.map +0 -1
- package/dist/types/thread/index.js +0 -5
- package/dist/types/thread/index.js.map +0 -1
- package/dist/types/thread/store.d.ts +0 -86
- package/dist/types/thread/store.d.ts.map +0 -1
- package/dist/types/thread/store.js +0 -22
- package/dist/types/thread/store.js.map +0 -1
- package/dist/types/verification/index.d.ts +0 -317
- package/dist/types/verification/index.d.ts.map +0 -1
- package/dist/types/verification/index.js +0 -53
- package/dist/types/verification/index.js.map +0 -1
- package/dist/verification/gate.d.ts.map +0 -1
- package/dist/verification/gate.js.map +0 -1
- package/dist/verification/index.d.ts +0 -4
- package/dist/verification/index.d.ts.map +0 -1
- package/dist/verification/index.js +0 -4
- package/dist/verification/index.js.map +0 -1
- package/dist/verification/presets.d.ts.map +0 -1
- package/dist/verification/presets.js.map +0 -1
- package/dist/verification/rules.d.ts +0 -4
- package/dist/verification/rules.d.ts.map +0 -1
- package/dist/verification/rules.js.map +0 -1
- package/src/connector/execution/index.ts +0 -5
- package/src/manager/thread/lifecycle.ts +0 -217
- package/src/store/thread/disk.ts +0 -272
- package/src/store/thread/index.ts +0 -7
- package/src/store/thread/memory.ts +0 -104
- package/src/types/thread/index.ts +0 -6
- package/src/types/thread/store.ts +0 -92
- package/src/verification/index.ts +0 -3
- /package/dist/{bridge/tools/connector → connector/tools}/index.d.ts +0 -0
- /package/dist/{bridge/tools/connector → connector/tools}/index.js +0 -0
- /package/dist/constants/{verification → authorization}/index.d.ts +0 -0
- /package/dist/constants/{verification → authorization}/index.js +0 -0
- /package/dist/{router → model-router}/task-router.d.ts +0 -0
- /package/dist/{router → model-router}/task-router.js +0 -0
- /package/dist/types/{thread → topic}/entity.js +0 -0
- /package/src/{bridge/tools/connector → connector/tools}/index.ts +0 -0
- /package/src/constants/{verification → authorization}/index.ts +0 -0
- /package/src/{router → model-router}/task-router.ts +0 -0
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
TriggerEvaluator,
|
|
7
7
|
assertBudgetEnforceable,
|
|
8
8
|
} from '../../advisory/index.js'
|
|
9
|
+
import { drainQueuedMessages } from '../../agents/handle.js'
|
|
10
|
+
import { AuthorizationGate } from '../../authorization/gate.js'
|
|
9
11
|
import { findDanglingMessages, removeDanglingMessages } from '../../compaction/dangling.js'
|
|
10
12
|
import { extractFromUserMessage } from '../../compaction/extractor.js'
|
|
11
13
|
import { WorkingStateManager } from '../../compaction/manager.js'
|
|
@@ -13,6 +15,7 @@ import type { ContextReducer } from '../../compaction/reducer.js'
|
|
|
13
15
|
import { serializeState as serializeWorkingState } from '../../compaction/serializer.js'
|
|
14
16
|
import { restoreWorkingState, snapshotWorkingState } from '../../compaction/wire.js'
|
|
15
17
|
import type { CompactionConfig } from '../../config/runtime.js'
|
|
18
|
+
import { BOOT_EVENT_NAMES } from '../../constants/telemetry/index.js'
|
|
16
19
|
import { TOOL_OUTPUT_DIR_NAME } from '../../constants/tools/index.js'
|
|
17
20
|
import { EmergencySaveManager } from '../../manager/run/emergency.js'
|
|
18
21
|
import type { RunPersistence } from '../../manager/run/persistence.js'
|
|
@@ -24,7 +27,9 @@ import {
|
|
|
24
27
|
withProviderFallback,
|
|
25
28
|
} from '../../provider/fallback.js'
|
|
26
29
|
import { type ProviderRetryConfig, withProviderRetry } from '../../provider/retry.js'
|
|
30
|
+
import { DefaultFilesystemMigrator, loggingMigrationSink } from '../../session/migration/index.js'
|
|
27
31
|
import type { PathBuilder } from '../../session/workspace/path-builder.js'
|
|
32
|
+
import { resolveAttachments } from '../../store/attachment/index.js'
|
|
28
33
|
import {
|
|
29
34
|
GENAI,
|
|
30
35
|
NAMZU,
|
|
@@ -45,6 +50,7 @@ import type { AdvisoryConfig } from '../../types/advisory/index.js'
|
|
|
45
50
|
import type { AgentRuntimeContext, RuntimeToolOverrides } from '../../types/agent/base.js'
|
|
46
51
|
import type { AgentContextLevel } from '../../types/agent/factory.js'
|
|
47
52
|
import type { WorkingMemoryProvider } from '../../types/agent/working-memory.js'
|
|
53
|
+
import type { AuthorizationGateConfig } from '../../types/authorization/index.js'
|
|
48
54
|
import { NamzuError } from '../../types/errors/index.js'
|
|
49
55
|
import type { InputGuardrailSpec, OutputGuardrailSpec } from '../../types/guardrail/index.js'
|
|
50
56
|
import {
|
|
@@ -60,11 +66,12 @@ import type { AgentPersona } from '../../types/persona/index.js'
|
|
|
60
66
|
import type { LLMProvider } from '../../types/provider/index.js'
|
|
61
67
|
import type { TaskRouterConfig } from '../../types/router/index.js'
|
|
62
68
|
import type { ReviewAnswer } from '../../types/run/answer-review.js'
|
|
63
|
-
import type { CheckpointStore,
|
|
69
|
+
import type { CheckpointStore, FencingToken } from '../../types/run/checkpoint-store.js'
|
|
64
70
|
import type { RunEventCursor, RunEventReplay } from '../../types/run/event-cursor.js'
|
|
65
71
|
import { resolveRunEventReplay } from '../../types/run/event-cursor.js'
|
|
66
72
|
import type {
|
|
67
73
|
AgentRunConfig,
|
|
74
|
+
BeforeStep,
|
|
68
75
|
PrepareStepChain,
|
|
69
76
|
Run,
|
|
70
77
|
RunEvent,
|
|
@@ -76,19 +83,23 @@ import type { PromoteMemory } from '../../types/run/memory-promotion.js'
|
|
|
76
83
|
import { memoryCandidateFor } from '../../types/run/memory-promotion.js'
|
|
77
84
|
import type { RunStore } from '../../types/run/store.js'
|
|
78
85
|
import type { Sandbox, SandboxProvider } from '../../types/sandbox/index.js'
|
|
79
|
-
import type { ProjectId,
|
|
86
|
+
import type { ProjectId, TopicId } from '../../types/session/ids.js'
|
|
80
87
|
import type { Skill } from '../../types/skills/index.js'
|
|
81
88
|
import type { StructuredOutputConfig } from '../../types/structured-output/index.js'
|
|
82
89
|
import type { TaskStore } from '../../types/task/index.js'
|
|
83
90
|
import type { ToolRegistryContract } from '../../types/tool/index.js'
|
|
84
91
|
import type { RepairToolCall } from '../../types/tool/repair.js'
|
|
85
|
-
import type { VerificationGateConfig } from '../../types/verification/index.js'
|
|
86
92
|
import type { BackoffPolicy } from '../../utils/backoff.js'
|
|
87
93
|
import type { ModelPricing } from '../../utils/cost.js'
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
94
|
+
import { toErrorMessage } from '../../utils/error.js'
|
|
95
|
+
import { generateRunId } from '../../utils/id.js'
|
|
96
|
+
import { errorAttributes } from '../../utils/log/exception.js'
|
|
97
|
+
import { EVENT_NAME_ATTRIBUTE } from '../../utils/log/types.js'
|
|
98
|
+
import type { Logger } from '../../utils/logger.js'
|
|
99
|
+
import { pickRenamed } from '../../utils/renamed-field.js'
|
|
100
|
+
import type { BackgroundJobRegistry } from '../jobs/registry.js'
|
|
101
|
+
import { AUTO_APPROVE_POLICY_NAME, createRunApprovalPolicy } from './approval-policy.js'
|
|
90
102
|
import { CheckpointManager } from './checkpoint.js'
|
|
91
|
-
import type { ContextCache } from './context-cache.js'
|
|
92
103
|
import { RunContextFactory } from './context.js'
|
|
93
104
|
import { EventTranslator } from './events.js'
|
|
94
105
|
import { GuardCoordinator } from './guard.js'
|
|
@@ -97,9 +108,11 @@ import { IterationOrchestrator } from './iteration/index.js'
|
|
|
97
108
|
import { isCompactionMessage } from './iteration/phases/compaction.js'
|
|
98
109
|
import { isWorkingMemoryMessage } from './iteration/phases/working-memory.js'
|
|
99
110
|
import { applyLifecycleHookResults } from './plugin-hooks.js'
|
|
111
|
+
import type { PromptCache } from './prompt-cache.js'
|
|
100
112
|
import { PromptBuilder } from './prompt.js'
|
|
101
113
|
import type { PromptSegments } from './prompt.js'
|
|
102
114
|
import { PendingAnswers, QuestionParkBinding } from './question-park.js'
|
|
115
|
+
import { RepeatCallTracker } from './repeat-call.js'
|
|
103
116
|
import { ResultAssembler } from './result.js'
|
|
104
117
|
import {
|
|
105
118
|
type PendingResumePlan,
|
|
@@ -115,6 +128,22 @@ import { createToolPause } from './tool-pause.js'
|
|
|
115
128
|
import { ToolingBootstrap } from './tooling.js'
|
|
116
129
|
|
|
117
130
|
export interface QueryParams {
|
|
131
|
+
/**
|
|
132
|
+
* Notice when the model issues the identical tool call repeatedly, and
|
|
133
|
+
* say so on the next `tool_result`. Defaults on.
|
|
134
|
+
*
|
|
135
|
+
* `false` removes the tracker entirely rather than gating a branch, so
|
|
136
|
+
* an opted-out run produces byte-identical messages to one from before
|
|
137
|
+
* this existed.
|
|
138
|
+
*/
|
|
139
|
+
repeatCallAdvisory?: boolean
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Tool names this run may not use, subtracted from its effective list.
|
|
143
|
+
* See {@link import('../../types/agent/base.js').BaseAgentConfig.deniedTools}.
|
|
144
|
+
*/
|
|
145
|
+
deniedTools?: readonly string[]
|
|
146
|
+
|
|
118
147
|
systemPrompt?: string
|
|
119
148
|
persona?: AgentPersona
|
|
120
149
|
skills?: Skill[]
|
|
@@ -209,6 +238,54 @@ export interface QueryParams {
|
|
|
209
238
|
|
|
210
239
|
/** Default per-tool execution deadline. See {@link ToolDefinition.timeoutMs}. */
|
|
211
240
|
toolTimeoutMs?: number
|
|
241
|
+
/**
|
|
242
|
+
* Where background jobs this run starts are held, and killed.
|
|
243
|
+
*
|
|
244
|
+
* Host-owned so it can outlive one run — a registry built per run could
|
|
245
|
+
* never be the thing that kills a run's jobs when the run is already
|
|
246
|
+
* gone. This run's jobs are torn down in the `finally` below; another
|
|
247
|
+
* run's are untouched.
|
|
248
|
+
*/
|
|
249
|
+
backgroundJobs?: BackgroundJobRegistry
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* What else goes in this run's prompt.
|
|
253
|
+
*
|
|
254
|
+
* `static` and `dynamic` contributions reach the system prompt through
|
|
255
|
+
* `PromptBuilder`; `turn` contributions reach the ephemeral trailing
|
|
256
|
+
* message once per iteration. A host registers once and the placement
|
|
257
|
+
* decides where it lands.
|
|
258
|
+
*/
|
|
259
|
+
promptContributions?: import('../../prompt/contributions.js').PromptContributionRegistry
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Where the `skill` tool loads from.
|
|
263
|
+
*
|
|
264
|
+
* Separate from `skills`, which is the LIST that goes in the prompt
|
|
265
|
+
* manifest. A run can have the manifest without the tool — that is what
|
|
266
|
+
* every run did before the tool existed — and the two are wired
|
|
267
|
+
* independently on purpose: a host may want the guidance visible without
|
|
268
|
+
* granting a way to pull bodies in mid-run.
|
|
269
|
+
*/
|
|
270
|
+
skillRegistry?: import('../../types/tool/index.js').SkillRegistryRef
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Where a message's stored attachments are resolved from.
|
|
274
|
+
*
|
|
275
|
+
* Absent is fine for every run whose attachments are inline, which is
|
|
276
|
+
* every run that existed before this. A message carrying a ref with no
|
|
277
|
+
* store REFUSES rather than dropping the attachment.
|
|
278
|
+
*/
|
|
279
|
+
attachmentStore?: import('../../store/attachment/index.js').AttachmentStore
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* How this run reaches the web.
|
|
283
|
+
*
|
|
284
|
+
* `fetch` and `search` are independent, and this kernel ships only the
|
|
285
|
+
* first — see `connector/web` for why choosing a search backend here
|
|
286
|
+
* would choose it for every consumer.
|
|
287
|
+
*/
|
|
288
|
+
web?: import('../../types/tool/index.js').ToolContext['web']
|
|
212
289
|
|
|
213
290
|
/**
|
|
214
291
|
* Wait between in-loop retries of a failed tool call, with full jitter.
|
|
@@ -317,6 +394,11 @@ export interface QueryParams {
|
|
|
317
394
|
* Fails open — a throw leaves the step with the run's configuration.
|
|
318
395
|
*/
|
|
319
396
|
prepareStep?: PrepareStepChain
|
|
397
|
+
/**
|
|
398
|
+
* Refuse the next model call before it is made. See {@link BeforeStep}.
|
|
399
|
+
* A throw fails CLOSED, opposite to `prepareStep` beside it.
|
|
400
|
+
*/
|
|
401
|
+
beforeStep?: BeforeStep
|
|
320
402
|
|
|
321
403
|
/**
|
|
322
404
|
* Force the run to finish by calling a schema-validated tool, and land
|
|
@@ -406,13 +488,13 @@ export interface QueryParams {
|
|
|
406
488
|
sessionId: SessionId
|
|
407
489
|
|
|
408
490
|
/**
|
|
409
|
-
* Topic the Session lives under. Required
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
491
|
+
* Topic the Session lives under. Required — every run carries the full
|
|
492
|
+
* five-layer scope (Tenant → Project → Topic → Session → Run).
|
|
493
|
+
* Denormalized from `session.topicId`; callers build this alongside
|
|
494
|
+
* `sessionId` so the query pipeline never needs a second SessionStore
|
|
495
|
+
* round-trip to recover it.
|
|
414
496
|
*/
|
|
415
|
-
|
|
497
|
+
topicId: TopicId
|
|
416
498
|
|
|
417
499
|
/** Long-lived goal scope for the run. Required. */
|
|
418
500
|
projectId: ProjectId
|
|
@@ -455,7 +537,7 @@ export interface QueryParams {
|
|
|
455
537
|
* takes no fence, so two workers that both took one run still overwrite
|
|
456
538
|
* each other's run record, transcript and report — see the changeset.
|
|
457
539
|
*/
|
|
458
|
-
claimFence?:
|
|
540
|
+
claimFence?: FencingToken
|
|
459
541
|
|
|
460
542
|
/**
|
|
461
543
|
* Where this run records its own evidence — the run record, its messages,
|
|
@@ -511,7 +593,14 @@ export interface QueryParams {
|
|
|
511
593
|
|
|
512
594
|
depth?: number
|
|
513
595
|
|
|
514
|
-
|
|
596
|
+
/**
|
|
597
|
+
* @deprecated Renamed to {@link QueryParams.promptCache}. Removed in the
|
|
598
|
+
* next major. Setting both to different instances throws rather than
|
|
599
|
+
* picking one.
|
|
600
|
+
*/
|
|
601
|
+
contextCache?: PromptCache
|
|
602
|
+
|
|
603
|
+
promptCache?: PromptCache
|
|
515
604
|
|
|
516
605
|
contextLevel?: AgentContextLevel
|
|
517
606
|
|
|
@@ -523,7 +612,60 @@ export interface QueryParams {
|
|
|
523
612
|
|
|
524
613
|
runtimeContext?: AgentRuntimeContext
|
|
525
614
|
|
|
526
|
-
|
|
615
|
+
/**
|
|
616
|
+
* @deprecated Renamed to {@link QueryParams.taskScheduler}. Removed in
|
|
617
|
+
* the next major. Setting both to different instances throws.
|
|
618
|
+
*/
|
|
619
|
+
taskGateway?: import('../../types/agent/scheduler.js').TaskScheduler
|
|
620
|
+
|
|
621
|
+
taskScheduler?: import('../../types/agent/scheduler.js').TaskScheduler
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Text queued for this run since its last turn, drained at the boundary.
|
|
625
|
+
*
|
|
626
|
+
* A callback because the queue belongs to whoever accepts the messages,
|
|
627
|
+
* and an array captured here would be whatever was queued before the run
|
|
628
|
+
* started. See `BaseAgentConfig.inboundMessages` for what it closes.
|
|
629
|
+
*/
|
|
630
|
+
inboundMessages?: () => import('../../types/message/index.js').Message[]
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Where this conversation's durable state lives.
|
|
634
|
+
*
|
|
635
|
+
* Supplies the permission mode when `runConfig.permissionMode` names
|
|
636
|
+
* none, and receives the flip when a plan is approved. Absent is the
|
|
637
|
+
* ordinary case: a run with no topic state behaves exactly as it did.
|
|
638
|
+
*/
|
|
639
|
+
topicStateStore?: import('../../store/topic/state.js').TopicStateStore
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* The live permission-mode box, when the caller holds one too.
|
|
643
|
+
*
|
|
644
|
+
* Whoever builds the coordinator tools needs to flip this from the
|
|
645
|
+
* approval hook, and that is not this function. Sharing the object is
|
|
646
|
+
* what lets an approved plan leave plan mode in the SAME run.
|
|
647
|
+
*/
|
|
648
|
+
permissionModeRef?: { current: import('../../types/permission/index.js').PermissionMode }
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* A name for the policy `resumeHandler` implements.
|
|
652
|
+
*
|
|
653
|
+
* Only ever written to the durable log and shown to an operator, so it
|
|
654
|
+
* costs nothing to omit — but omitting it means every entry about who
|
|
655
|
+
* approved something says `host`, which is the answer that helps least.
|
|
656
|
+
*/
|
|
657
|
+
approvalPolicyName?: string
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Receive this run's approval-policy box, so it can be swapped mid-run.
|
|
661
|
+
*
|
|
662
|
+
* The box is built HERE rather than passed in, unlike
|
|
663
|
+
* {@link permissionModeRef}, because changing the policy emits a durable
|
|
664
|
+
* event and only the run holds the emitter. A host that constructed its
|
|
665
|
+
* own box would be able to change the policy without recording it, which
|
|
666
|
+
* is the one thing this must not allow.
|
|
667
|
+
*/
|
|
668
|
+
onApprovalPolicy?: (policy: import('../../types/hitl/policy.js').RunApprovalPolicy) => void
|
|
527
669
|
|
|
528
670
|
/**
|
|
529
671
|
* Where a worker completion goes when no tool call is waiting for it.
|
|
@@ -533,7 +675,7 @@ export interface QueryParams {
|
|
|
533
675
|
* and the loop delivers what is left. Omitted, the loop drains nothing and
|
|
534
676
|
* the behaviour is exactly what it was before the inbox existed.
|
|
535
677
|
*/
|
|
536
|
-
completionInbox?: import('../../
|
|
678
|
+
completionInbox?: import('../../scheduler/completion-inbox.js').CompletionInbox
|
|
537
679
|
|
|
538
680
|
onContextCreated?: (ctx: {
|
|
539
681
|
planManager: import('../../manager/plan/lifecycle.js').PlanManager
|
|
@@ -566,7 +708,13 @@ export interface QueryParams {
|
|
|
566
708
|
|
|
567
709
|
agentBus?: import('../../bus/index.js').AgentBus
|
|
568
710
|
|
|
569
|
-
|
|
711
|
+
/**
|
|
712
|
+
* @deprecated Renamed to `authorizationGate`. Removed in the next major.
|
|
713
|
+
* Setting both to different configs throws.
|
|
714
|
+
*/
|
|
715
|
+
verificationGate?: AuthorizationGateConfig
|
|
716
|
+
|
|
717
|
+
authorizationGate?: AuthorizationGateConfig
|
|
570
718
|
|
|
571
719
|
pluginManager?: import('../../plugin/lifecycle.js').PluginLifecycleManager
|
|
572
720
|
|
|
@@ -667,14 +815,112 @@ function assertBudgetIsMeasurable(params: QueryParams): void {
|
|
|
667
815
|
})
|
|
668
816
|
}
|
|
669
817
|
|
|
818
|
+
/**
|
|
819
|
+
* Ask the driver what this model's window is, and never let the answer
|
|
820
|
+
* cost the run.
|
|
821
|
+
*
|
|
822
|
+
* Three outcomes collapse to two here on purpose. No member and a resolved
|
|
823
|
+
* `undefined` both mean "no answer" — the distinction matters to a driver
|
|
824
|
+
* author, not to a caller about to fall through to the table. A rejection
|
|
825
|
+
* is the third, and it is logged rather than propagated: a run that would
|
|
826
|
+
* have worked on the table must not fail because a listing endpoint was
|
|
827
|
+
* down.
|
|
828
|
+
*/
|
|
829
|
+
async function resolveProviderContextWindow(
|
|
830
|
+
provider: LLMProvider,
|
|
831
|
+
model: string | undefined,
|
|
832
|
+
signal: AbortSignal | undefined,
|
|
833
|
+
log: Logger,
|
|
834
|
+
): Promise<number | undefined> {
|
|
835
|
+
if (!provider.resolveContextWindow || !model) return undefined
|
|
836
|
+
try {
|
|
837
|
+
const reported = await provider.resolveContextWindow(model, signal)
|
|
838
|
+
return typeof reported === 'number' && reported > 0 ? reported : undefined
|
|
839
|
+
} catch (err) {
|
|
840
|
+
log.debug('Provider could not report a context window; using the table', {
|
|
841
|
+
'namzu.model.id': model,
|
|
842
|
+
'namzu.error.message': toErrorMessage(err),
|
|
843
|
+
})
|
|
844
|
+
return undefined
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
670
848
|
export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run> {
|
|
849
|
+
// Resolved at the DOOR, before a run id exists or a logger is built.
|
|
850
|
+
// A caller who set both spellings of a renamed field has a config bug,
|
|
851
|
+
// and refusing it here costs them nothing; refusing it at the read site
|
|
852
|
+
// deep in the loop turns the same bug into a mid-run failure, after a
|
|
853
|
+
// provider call has been paid for and a partial transcript written.
|
|
854
|
+
const promptCache = pickRenamed(
|
|
855
|
+
'contextCache',
|
|
856
|
+
params.contextCache,
|
|
857
|
+
'promptCache',
|
|
858
|
+
params.promptCache,
|
|
859
|
+
)
|
|
860
|
+
const taskScheduler = pickRenamed(
|
|
861
|
+
'taskGateway',
|
|
862
|
+
params.taskGateway,
|
|
863
|
+
'taskScheduler',
|
|
864
|
+
params.taskScheduler,
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
// The run's one correlated logger, built before anything below needs
|
|
868
|
+
// one — the migration check, the retry/fallback wrappers and `ctx`
|
|
869
|
+
// itself all read this SAME object, so a retry warning and the run
|
|
870
|
+
// record it retried for carry the identical `namzu.run.id` instead of
|
|
871
|
+
// three separate `getRootLogger()` reads that happened to agree by
|
|
872
|
+
// accident. `runId` is resolved here, once, rather than left to
|
|
873
|
+
// `build`'s own `config.runId ?? generateRunId()` fallback —
|
|
874
|
+
// generating it twice would silently hand the log and the run two
|
|
875
|
+
// different ids.
|
|
876
|
+
const runId = params.runId ?? generateRunId()
|
|
877
|
+
const log = RunContextFactory.buildLogger({
|
|
878
|
+
agentName: params.agentName,
|
|
879
|
+
runConfig: params.runConfig,
|
|
880
|
+
runId,
|
|
881
|
+
parentRunId: params.parentRunId,
|
|
882
|
+
sessionId: params.sessionId,
|
|
883
|
+
topicId: params.topicId,
|
|
884
|
+
projectId: params.projectId,
|
|
885
|
+
tenantId: params.tenantId,
|
|
886
|
+
})
|
|
887
|
+
|
|
671
888
|
// Boot-time filesystem migration (session-hierarchy.md §13.4.1). First
|
|
672
889
|
// call per process per root actually runs; subsequent calls short-circuit
|
|
673
890
|
// via the in-memory guard in `context.ts`. Kept here rather than inside
|
|
674
891
|
// the synchronous `RunContextFactory.build` so the factory signature stays
|
|
675
892
|
// sync for tests / non-async call sites.
|
|
893
|
+
//
|
|
894
|
+
// The migrator built here — not `ensureMigrated`'s own default — is what
|
|
895
|
+
// turns the migration facts `DefaultFilesystemMigrator` already computes
|
|
896
|
+
// into a `namzu.migration.completed` record instead of discarding them.
|
|
897
|
+
// `ensureMigrated`'s default parameter stays
|
|
898
|
+
// `NOOP_FILESYSTEM_MIGRATION_SINK` (see `context.ts`), so any other path
|
|
899
|
+
// that reaches `ensureMigrated` keeps today's silent behaviour.
|
|
676
900
|
const cwdForMigration = params.workingDirectory ?? process.cwd()
|
|
677
|
-
await RunContextFactory.ensureMigrated(
|
|
901
|
+
const migrationResult = await RunContextFactory.ensureMigrated(
|
|
902
|
+
`${cwdForMigration}/.namzu`,
|
|
903
|
+
new DefaultFilesystemMigrator(loggingMigrationSink(log)),
|
|
904
|
+
)
|
|
905
|
+
// `loggingMigrationSink` only ever hears about `kind: 'migrated'` — the
|
|
906
|
+
// only outcome `DefaultFilesystemMigrator` ever hands its sink (see the
|
|
907
|
+
// module doc on `FilesystemMigrationSink`). The other two are logged
|
|
908
|
+
// here, straight off the resolved result, rather than by widening
|
|
909
|
+
// `FilesystemMigrationEvent` to carry them: a wider union would need a
|
|
910
|
+
// new arm in every exhaustive switch already written over it — a major —
|
|
911
|
+
// for two outcomes `migrationResult.kind` already fully describes.
|
|
912
|
+
if (migrationResult.kind !== 'migrated') {
|
|
913
|
+
log.debug('filesystem migration: nothing to do', {
|
|
914
|
+
[EVENT_NAME_ATTRIBUTE]: BOOT_EVENT_NAMES.MIGRATION_COMPLETED,
|
|
915
|
+
// `namzu.migration.*`, matching `loggingMigrationSink` — the OTHER
|
|
916
|
+
// emitter of this same event name. Two emitters of one event writing
|
|
917
|
+
// two namespaces for the same fact is precisely the collision the
|
|
918
|
+
// namespaced-key rule exists to stop, and a per-module derivation is
|
|
919
|
+
// how it would be reintroduced.
|
|
920
|
+
'namzu.migration.kind': migrationResult.kind,
|
|
921
|
+
'namzu.migration.marker_path': migrationResult.markerPath,
|
|
922
|
+
})
|
|
923
|
+
}
|
|
678
924
|
|
|
679
925
|
// Every model call in the run — the loop's turns, the forced-final
|
|
680
926
|
// summary, advisory and compaction side calls — goes through this one
|
|
@@ -701,9 +947,7 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
701
947
|
assertCostIsAttributable(chain, params.pricing)
|
|
702
948
|
assertBudgetIsMeasurable(params)
|
|
703
949
|
const withRetry = (provider: LLMProvider): LLMProvider =>
|
|
704
|
-
params.retry === false
|
|
705
|
-
? provider
|
|
706
|
-
: withProviderRetry(provider, { config: params.retry, log: getRootLogger() })
|
|
950
|
+
params.retry === false ? provider : withProviderRetry(provider, { config: params.retry, log })
|
|
707
951
|
// Who is serving right now, for the run RECORD rather than for the request.
|
|
708
952
|
//
|
|
709
953
|
// It starts at the head and moves only when the chain does, which is the
|
|
@@ -717,7 +961,7 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
717
961
|
const resilientProvider = withProviderFallback(
|
|
718
962
|
chain.map((member) => ({ ...member, provider: withRetry(member.provider) })),
|
|
719
963
|
{
|
|
720
|
-
log
|
|
964
|
+
log,
|
|
721
965
|
onSwap: (to) => {
|
|
722
966
|
serving.current = to
|
|
723
967
|
// `ctx` is declared below and is initialized before anything can
|
|
@@ -728,7 +972,74 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
728
972
|
},
|
|
729
973
|
)
|
|
730
974
|
|
|
975
|
+
// Asked ONCE, here, before the loop exists. Both readers are synchronous
|
|
976
|
+
// and hot, so this can never move inside the iteration — and a driver
|
|
977
|
+
// that rejects, or one that hangs until the run is cancelled, must not
|
|
978
|
+
// take down a run the table could have served perfectly well. That is
|
|
979
|
+
// why the failure path is a swallow with a log rather than a throw: the
|
|
980
|
+
// window is an optimisation over a working default, not a prerequisite.
|
|
981
|
+
const providerContextWindow = await resolveProviderContextWindow(
|
|
982
|
+
resilientProvider,
|
|
983
|
+
params.runConfig.model,
|
|
984
|
+
params.signal,
|
|
985
|
+
log,
|
|
986
|
+
)
|
|
987
|
+
|
|
988
|
+
// The mode this conversation was left in, when the run config names none.
|
|
989
|
+
// Read once, before the loop exists, for the same reason the context
|
|
990
|
+
// window is: the executor's resolver is synchronous and hot.
|
|
991
|
+
//
|
|
992
|
+
// A store that throws is not a run failure — the run falls back to the
|
|
993
|
+
// config's answer, which is exactly what it did before this existed.
|
|
994
|
+
const topicState = params.topicStateStore
|
|
995
|
+
? await params.topicStateStore
|
|
996
|
+
.getState(params.topicId, params.tenantId)
|
|
997
|
+
.catch((err: unknown) => {
|
|
998
|
+
log.debug('Could not read the topic state; using the run config', {
|
|
999
|
+
'namzu.topic.id': params.topicId,
|
|
1000
|
+
'namzu.error.message': toErrorMessage(err),
|
|
1001
|
+
})
|
|
1002
|
+
return null
|
|
1003
|
+
})
|
|
1004
|
+
: null
|
|
1005
|
+
|
|
1006
|
+
// Whatever a host left for "the next run", taken and cleared in one
|
|
1007
|
+
// compare-and-set write. Prepended to the messages this run starts from,
|
|
1008
|
+
// so it is in the FIRST request rather than arriving a turn late.
|
|
1009
|
+
//
|
|
1010
|
+
// Cleared as it is read: a queue read and cleared separately re-delivers
|
|
1011
|
+
// on a crash between the two, and "start with this" arriving twice is a
|
|
1012
|
+
// different instruction from the one that was left.
|
|
1013
|
+
const queuedForThisRun: readonly Message[] = params.topicStateStore
|
|
1014
|
+
? await drainQueuedMessages(params.topicStateStore, params.topicId, params.tenantId).catch(
|
|
1015
|
+
(err: unknown) => {
|
|
1016
|
+
log.debug('Could not drain the topic queue; starting without it', {
|
|
1017
|
+
'namzu.topic.id': params.topicId,
|
|
1018
|
+
'namzu.error.message': toErrorMessage(err),
|
|
1019
|
+
})
|
|
1020
|
+
return []
|
|
1021
|
+
},
|
|
1022
|
+
)
|
|
1023
|
+
: []
|
|
1024
|
+
|
|
1025
|
+
// One effective list, used everywhere the run is seeded from. Three
|
|
1026
|
+
// branches below push from it, and computing it at each would be three
|
|
1027
|
+
// places to forget the queue.
|
|
1028
|
+
//
|
|
1029
|
+
// Stored attachments are resolved HERE, once, before the messages reach
|
|
1030
|
+
// the run record. Resolving later — at the provider boundary — would put
|
|
1031
|
+
// refs in the durable transcript and in every checkpoint, and a run
|
|
1032
|
+
// resumed against a store that had since forgotten a ref would fail
|
|
1033
|
+
// replaying its own history rather than at the moment somebody asked for
|
|
1034
|
+
// the bytes. Every failure refuses: a message that silently lost its
|
|
1035
|
+
// image is a model answering about a picture it never saw.
|
|
1036
|
+
const seeded: Message[] =
|
|
1037
|
+
queuedForThisRun.length > 0 ? [...queuedForThisRun, ...params.messages] : params.messages
|
|
1038
|
+
const initialMessages: Message[] = [...(await resolveAttachments(seeded, params.attachmentStore))]
|
|
1039
|
+
|
|
731
1040
|
const ctx = RunContextFactory.build({
|
|
1041
|
+
...(topicState ? { topicPermissionMode: topicState.permissionMode } : {}),
|
|
1042
|
+
...(params.permissionModeRef ? { permissionModeRef: params.permissionModeRef } : {}),
|
|
732
1043
|
agentId: params.agentId,
|
|
733
1044
|
agentName: params.agentName,
|
|
734
1045
|
runConfig: params.runConfig,
|
|
@@ -736,22 +1047,52 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
736
1047
|
workingDirectory: params.workingDirectory,
|
|
737
1048
|
pricing: params.pricing,
|
|
738
1049
|
enableActivityTracking: params.enableActivityTracking,
|
|
739
|
-
messages:
|
|
1050
|
+
messages: initialMessages,
|
|
740
1051
|
signal: params.signal,
|
|
741
1052
|
sessionId: params.sessionId,
|
|
742
|
-
|
|
1053
|
+
topicId: params.topicId,
|
|
743
1054
|
projectId: params.projectId,
|
|
744
1055
|
tenantId: params.tenantId,
|
|
745
1056
|
pathBuilder: params.pathBuilder,
|
|
746
1057
|
checkpointStore: params.checkpointStore,
|
|
747
1058
|
runStore: params.runStore,
|
|
748
|
-
runId
|
|
1059
|
+
runId,
|
|
749
1060
|
parentRunId: params.parentRunId,
|
|
750
1061
|
depth: params.depth,
|
|
1062
|
+
log,
|
|
1063
|
+
})
|
|
1064
|
+
|
|
1065
|
+
// Built here because the plan-approval closure below captures it, and
|
|
1066
|
+
// its `emit` resolves `eventTranslator` at CALL time — the translator is
|
|
1067
|
+
// a `const` some lines further down.
|
|
1068
|
+
//
|
|
1069
|
+
// The HANDOUT is therefore deliberately NOT here. A host given the box
|
|
1070
|
+
// at this point can call `set` synchronously, `emit` reaches
|
|
1071
|
+
// `eventTranslator` inside its temporal dead zone, and the run dies
|
|
1072
|
+
// before it starts. That is not hypothetical: it is what the first
|
|
1073
|
+
// version of this did, and the test that hands out the box and
|
|
1074
|
+
// immediately swaps the policy is the one that found it.
|
|
1075
|
+
const approvalPolicy = createRunApprovalPolicy({
|
|
1076
|
+
runId: ctx.runId,
|
|
1077
|
+
initial: {
|
|
1078
|
+
// By identity against the default, not by presence. `resumeHandler`
|
|
1079
|
+
// is REQUIRED on `QueryParams` — `drainQuery` substitutes
|
|
1080
|
+
// `autoApproveHandler` before calling here — so "is it set" is
|
|
1081
|
+
// always yes and would name every run `host`, including the ones
|
|
1082
|
+
// approving everything unattended. Identity is what actually
|
|
1083
|
+
// separates the two.
|
|
1084
|
+
name:
|
|
1085
|
+
params.approvalPolicyName ??
|
|
1086
|
+
(params.resumeHandler === autoApproveHandler ? AUTO_APPROVE_POLICY_NAME : 'host'),
|
|
1087
|
+
handler: params.resumeHandler,
|
|
1088
|
+
},
|
|
1089
|
+
emit: (event) => eventTranslator.emitEvent(event),
|
|
751
1090
|
})
|
|
752
1091
|
|
|
753
1092
|
ctx.planManager.setApprovalHandler(async (request) => {
|
|
754
|
-
|
|
1093
|
+
// `.current.handler`, never a captured `params.resumeHandler`. That
|
|
1094
|
+
// capture is what made changing the policy mean ending the run.
|
|
1095
|
+
const decision = await approvalPolicy.current.handler({
|
|
755
1096
|
type: 'plan_approval',
|
|
756
1097
|
runId: ctx.runId,
|
|
757
1098
|
checkpointId: `cp_plan_${request.planId}` as import('../../types/ids/index.js').CheckpointId,
|
|
@@ -788,7 +1129,7 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
788
1129
|
return { approved: false, feedback: `Action: ${decision.action}` }
|
|
789
1130
|
})
|
|
790
1131
|
|
|
791
|
-
const eventTranslator = new EventTranslator(ctx.runMgr)
|
|
1132
|
+
const eventTranslator = new EventTranslator(ctx.runMgr, undefined, ctx.log)
|
|
792
1133
|
eventTranslator.wireActivityStore(ctx.activityStore, ctx.runId)
|
|
793
1134
|
eventTranslator.wirePlanManager(ctx.planManager, ctx.runId)
|
|
794
1135
|
const unsubscribeTaskStore = params.taskStore
|
|
@@ -853,9 +1194,10 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
853
1194
|
details: { providerId: params.provider.id, capability: 'tools', registeredToolCount },
|
|
854
1195
|
})
|
|
855
1196
|
}
|
|
856
|
-
ctx.log.warn(
|
|
857
|
-
|
|
858
|
-
|
|
1197
|
+
ctx.log.warn('Capability mismatch: the provider declares no tool support', {
|
|
1198
|
+
'namzu.capability.detail': message,
|
|
1199
|
+
[GENAI.SYSTEM]: params.provider.id,
|
|
1200
|
+
'namzu.runtime.registered_tool_count': registeredToolCount,
|
|
859
1201
|
})
|
|
860
1202
|
}
|
|
861
1203
|
|
|
@@ -868,9 +1210,10 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
868
1210
|
details: { providerId: params.provider.id, capability: 'vision', attachmentMessageCount },
|
|
869
1211
|
})
|
|
870
1212
|
}
|
|
871
|
-
ctx.log.warn(
|
|
872
|
-
|
|
873
|
-
|
|
1213
|
+
ctx.log.warn('Capability mismatch: the provider declares no vision support', {
|
|
1214
|
+
'namzu.capability.detail': message,
|
|
1215
|
+
[GENAI.SYSTEM]: params.provider.id,
|
|
1216
|
+
'namzu.runtime.attachment_message_count': attachmentMessageCount,
|
|
874
1217
|
})
|
|
875
1218
|
}
|
|
876
1219
|
|
|
@@ -883,15 +1226,32 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
883
1226
|
details: { providerId: params.provider.id, capability: 'documents', documentMessageCount },
|
|
884
1227
|
})
|
|
885
1228
|
}
|
|
886
|
-
ctx.log.warn(
|
|
887
|
-
|
|
888
|
-
|
|
1229
|
+
ctx.log.warn('Capability mismatch: the provider declares no document support', {
|
|
1230
|
+
'namzu.capability.detail': message,
|
|
1231
|
+
[GENAI.SYSTEM]: params.provider.id,
|
|
1232
|
+
'namzu.runtime.document_message_count': documentMessageCount,
|
|
889
1233
|
})
|
|
890
1234
|
}
|
|
891
1235
|
|
|
892
|
-
|
|
1236
|
+
// Denied names are subtracted LAST, after the allow-list is resolved
|
|
1237
|
+
// against the registry — so a deny reaches a run that named no
|
|
1238
|
+
// allow-list at all, which is the ordinary case for a delegated child.
|
|
1239
|
+
// Applied to `effectiveAllowedTools`, which `query()` binds to both the
|
|
1240
|
+
// request tool list AND the `ToolExecutor`: narrowing only the request
|
|
1241
|
+
// shows the model fewer tools and lets it call any of them by name.
|
|
1242
|
+
const allowedBeforeDenial = stripToolSurfaces
|
|
893
1243
|
? []
|
|
894
1244
|
: withDeferredDiscoveryTool(params.tools, params.allowedTools)
|
|
1245
|
+
const denied = new Set(params.deniedTools ?? [])
|
|
1246
|
+
const effectiveAllowedTools: string[] | undefined =
|
|
1247
|
+
denied.size === 0
|
|
1248
|
+
? allowedBeforeDenial
|
|
1249
|
+
: // An absent allow-list means "every registered tool", so a deny
|
|
1250
|
+
// with no allow-list has to be resolved against the registry
|
|
1251
|
+
// here — otherwise the subtraction would be from an empty list
|
|
1252
|
+
// and would deny nothing, which is the shape a delegated child
|
|
1253
|
+
// arrives in.
|
|
1254
|
+
[...(allowedBeforeDenial ?? params.tools.listNames())].filter((name) => !denied.has(name))
|
|
895
1255
|
|
|
896
1256
|
// The two halves of a durable pause, owned by the RUN when the host
|
|
897
1257
|
// does not own them.
|
|
@@ -922,12 +1282,18 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
922
1282
|
tools: params.tools,
|
|
923
1283
|
runId: ctx.runId,
|
|
924
1284
|
workingDirectory: ctx.cwd,
|
|
925
|
-
permissionMode: ctx.permissionMode,
|
|
1285
|
+
permissionMode: () => ctx.permissionMode.current,
|
|
926
1286
|
env: params.runConfig.env ?? {},
|
|
927
1287
|
abortSignal: ctx.abortController.signal,
|
|
928
1288
|
allowedTools: effectiveAllowedTools,
|
|
929
1289
|
invocationState: params.invocationState,
|
|
930
1290
|
pluginManager: params.pluginManager,
|
|
1291
|
+
...(params.backgroundJobs ? { backgroundJobs: params.backgroundJobs } : {}),
|
|
1292
|
+
// The `skill` tool's registry. Threaded from the run rather than
|
|
1293
|
+
// held by the tool, because a tool that reached for a module-level
|
|
1294
|
+
// registry would answer about whatever the last run configured.
|
|
1295
|
+
...(params.skillRegistry ? { skills: params.skillRegistry } : {}),
|
|
1296
|
+
...(params.web ? { web: params.web } : {}),
|
|
931
1297
|
...(params.toolTimeoutMs !== undefined ? { toolTimeoutMs: params.toolTimeoutMs } : {}),
|
|
932
1298
|
...(params.toolRetryBackoff !== undefined
|
|
933
1299
|
? { toolRetryBackoff: params.toolRetryBackoff }
|
|
@@ -955,7 +1321,7 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
955
1321
|
createToolPause({
|
|
956
1322
|
runId: ctx.runId,
|
|
957
1323
|
toolUseId,
|
|
958
|
-
parkHandler:
|
|
1324
|
+
parkHandler: (request) => approvalPolicy.current.handler(request),
|
|
959
1325
|
recorder: questionParks,
|
|
960
1326
|
pendingAnswers,
|
|
961
1327
|
}),
|
|
@@ -979,6 +1345,7 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
979
1345
|
tools: params.tools,
|
|
980
1346
|
allowedTools: effectiveAllowedTools,
|
|
981
1347
|
runtimeContext: params.runtimeContext,
|
|
1348
|
+
...(params.promptContributions ? { contributions: params.promptContributions } : {}),
|
|
982
1349
|
})
|
|
983
1350
|
|
|
984
1351
|
const guard = new GuardCoordinator({
|
|
@@ -1013,6 +1380,10 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1013
1380
|
// Read at settle time, not now: checkpoints are written per
|
|
1014
1381
|
// iteration, so the answer changes as the run proceeds.
|
|
1015
1382
|
resumeCheckpointId: () => checkpointMgr.lastCheckpointId,
|
|
1383
|
+
// Read only to recover WHY a cancellation happened. The run loop
|
|
1384
|
+
// already knows THAT it was cancelled; the origin lives on the abort
|
|
1385
|
+
// reason and nothing else carries it this far.
|
|
1386
|
+
signal: ctx.abortController.signal,
|
|
1016
1387
|
})
|
|
1017
1388
|
|
|
1018
1389
|
let advisoryCtx: AdvisoryContext | undefined
|
|
@@ -1072,8 +1443,20 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1072
1443
|
}
|
|
1073
1444
|
}
|
|
1074
1445
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1446
|
+
// One resolve, one construction. Four sites read this field, and had
|
|
1447
|
+
// each read `params.verificationGate` directly a host that set only the
|
|
1448
|
+
// new name would get a gate on one path and none on another — which for
|
|
1449
|
+
// an AUTHORIZATION gate means a tool call permitted somewhere it should
|
|
1450
|
+
// have been refused. That is the failure this field's window has to not
|
|
1451
|
+
// have.
|
|
1452
|
+
const gateConfig = pickRenamed(
|
|
1453
|
+
'verificationGate',
|
|
1454
|
+
params.verificationGate,
|
|
1455
|
+
'authorizationGate',
|
|
1456
|
+
params.authorizationGate,
|
|
1457
|
+
)
|
|
1458
|
+
const verificationGate = gateConfig?.enabled
|
|
1459
|
+
? new AuthorizationGate(gateConfig, ctx.log)
|
|
1077
1460
|
: undefined
|
|
1078
1461
|
|
|
1079
1462
|
const iterationOrchestrator = new IterationOrchestrator({
|
|
@@ -1082,6 +1465,7 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1082
1465
|
runConfig: params.runConfig,
|
|
1083
1466
|
...(params.stopWhen ? { stopWhen: params.stopWhen } : {}),
|
|
1084
1467
|
...(params.prepareStep ? { prepareStep: params.prepareStep } : {}),
|
|
1468
|
+
...(params.beforeStep ? { beforeStep: params.beforeStep } : {}),
|
|
1085
1469
|
...(params.onStepFinish ? { onStepFinish: params.onStepFinish } : {}),
|
|
1086
1470
|
...(params.reviewAnswer ? { reviewAnswer: params.reviewAnswer } : {}),
|
|
1087
1471
|
...(params.maxAnswerReviews !== undefined ? { maxAnswerReviews: params.maxAnswerReviews } : {}),
|
|
@@ -1099,17 +1483,27 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1099
1483
|
drainPending: () => eventTranslator.drainPending(),
|
|
1100
1484
|
abortController: ctx.abortController,
|
|
1101
1485
|
log: ctx.log,
|
|
1102
|
-
|
|
1486
|
+
// Read through the box on every call, so a swap lands on the next
|
|
1487
|
+
// question rather than the next run.
|
|
1488
|
+
resumeHandler: (request) => approvalPolicy.current.handler(request),
|
|
1489
|
+
takeApprovalPolicyChange: () => approvalPolicy.takeUnannouncedChange(),
|
|
1490
|
+
...(params.promptContributions ? { promptContributions: params.promptContributions } : {}),
|
|
1103
1491
|
...(params.steering ? { steering: params.steering } : {}),
|
|
1104
1492
|
checkpointMgr,
|
|
1105
1493
|
planManager: ctx.planManager,
|
|
1106
|
-
taskGateway:
|
|
1494
|
+
taskGateway: taskScheduler,
|
|
1107
1495
|
completionInbox: params.completionInbox,
|
|
1108
1496
|
taskStore: params.taskStore,
|
|
1109
1497
|
// Run-scoped. An approval is a statement about this run's work;
|
|
1110
1498
|
// carrying one into a later run would be reuse nobody agreed to.
|
|
1111
1499
|
toolGrants: new ToolGrantSet(),
|
|
1500
|
+
// Run-scoped for the same reason. A repeat count carried into a later
|
|
1501
|
+
// run is a claim about work nobody repeated, and a module-level map
|
|
1502
|
+
// would leak exactly that way.
|
|
1503
|
+
...(params.repeatCallAdvisory === false ? {} : { repeatCalls: new RepeatCallTracker() }),
|
|
1112
1504
|
compactionConfig: params.compactionConfig,
|
|
1505
|
+
...(params.inboundMessages ? { inboundMessages: params.inboundMessages } : {}),
|
|
1506
|
+
...(providerContextWindow !== undefined ? { providerContextWindow } : {}),
|
|
1113
1507
|
workingStateManager,
|
|
1114
1508
|
taskRouter: params.taskRouter,
|
|
1115
1509
|
contextReducer: params.contextReducer,
|
|
@@ -1196,9 +1590,9 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1196
1590
|
// because a host building an approval queue from durable
|
|
1197
1591
|
// state will not see this question.
|
|
1198
1592
|
ctx.log.error('Failed to record a question park — it is not resumable', {
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1593
|
+
[NAMZU.RUN_ID]: ctx.runMgr.id,
|
|
1594
|
+
'namzu.runtime.question_id': question.questionId,
|
|
1595
|
+
'exception.message': err instanceof Error ? err.message : String(err),
|
|
1202
1596
|
})
|
|
1203
1597
|
return null
|
|
1204
1598
|
}
|
|
@@ -1206,9 +1600,9 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1206
1600
|
resolve: async (checkpointId, decision) => {
|
|
1207
1601
|
await checkpointMgr.unpark(checkpointId, decision).catch((err: unknown) => {
|
|
1208
1602
|
ctx.log.error('Failed to clear a recorded question park', {
|
|
1209
|
-
|
|
1210
|
-
checkpointId,
|
|
1211
|
-
|
|
1603
|
+
[NAMZU.RUN_ID]: ctx.runMgr.id,
|
|
1604
|
+
'namzu.checkpoint.id': checkpointId,
|
|
1605
|
+
'exception.message': err instanceof Error ? err.message : String(err),
|
|
1212
1606
|
})
|
|
1213
1607
|
return null
|
|
1214
1608
|
})
|
|
@@ -1272,13 +1666,13 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1272
1666
|
params.onContextCreated?.({ planManager: ctx.planManager })
|
|
1273
1667
|
|
|
1274
1668
|
ctx.log.info('Starting query', {
|
|
1275
|
-
|
|
1276
|
-
agent: params.agentName,
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1669
|
+
[NAMZU.RUN_ID]: ctx.runMgr.id,
|
|
1670
|
+
'namzu.runtime.agent': params.agentName,
|
|
1671
|
+
[GENAI.REQUEST_MODEL]: params.runConfig.model,
|
|
1672
|
+
'namzu.runtime.token_budget': params.runConfig.tokenBudget,
|
|
1673
|
+
'namzu.runtime.activity_tracking': ctx.activityStore.enabled,
|
|
1674
|
+
'namzu.runtime.permission_mode': ctx.permissionMode.current,
|
|
1675
|
+
'namzu.runtime.resume_from_checkpoint': params.resumeFromCheckpoint ?? null,
|
|
1282
1676
|
})
|
|
1283
1677
|
|
|
1284
1678
|
const contextLevel = params.contextLevel ?? 'full'
|
|
@@ -1290,19 +1684,16 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1290
1684
|
tools: params.tools,
|
|
1291
1685
|
allowedTools: effectiveAllowedTools,
|
|
1292
1686
|
runtimeContext: params.runtimeContext,
|
|
1687
|
+
...(params.promptContributions ? { contributions: params.promptContributions } : {}),
|
|
1293
1688
|
}
|
|
1294
1689
|
|
|
1295
|
-
const segments: PromptSegments =
|
|
1296
|
-
?
|
|
1297
|
-
cacheInput,
|
|
1298
|
-
contextLevel,
|
|
1299
|
-
params.workingDirectory,
|
|
1300
|
-
)
|
|
1690
|
+
const segments: PromptSegments = promptCache
|
|
1691
|
+
? promptCache.getSystemPromptSegmented(cacheInput, contextLevel, params.workingDirectory)
|
|
1301
1692
|
: promptBuilder.buildSegmented(contextLevel, params.workingDirectory)
|
|
1302
1693
|
|
|
1303
1694
|
ctx.log.info('Prompt segments assembled', {
|
|
1304
|
-
|
|
1305
|
-
|
|
1695
|
+
'namzu.runtime.static_length': segments.static.length,
|
|
1696
|
+
'namzu.runtime.dynamic_length': segments.dynamic.length,
|
|
1306
1697
|
})
|
|
1307
1698
|
|
|
1308
1699
|
const pushSystemMessages = (): void => {
|
|
@@ -1345,18 +1736,18 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1345
1736
|
const revived = restoreWorkingState(checkpoint.workingState, params.compactionConfig)
|
|
1346
1737
|
workingStateManager.replaceState(revived.getState())
|
|
1347
1738
|
ctx.log.info('Restored compaction working state from checkpoint', {
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
slots: workingStateManager.slotCount(),
|
|
1739
|
+
[NAMZU.RUN_ID]: ctx.runMgr.id,
|
|
1740
|
+
'namzu.checkpoint.id': checkpoint.id,
|
|
1741
|
+
'namzu.runtime.slots': workingStateManager.slotCount(),
|
|
1351
1742
|
})
|
|
1352
1743
|
}
|
|
1353
1744
|
ctx.log.info('Restored budgets from checkpoint', {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1745
|
+
[NAMZU.RUN_ID]: ctx.runMgr.id,
|
|
1746
|
+
'namzu.checkpoint.id': checkpoint.id,
|
|
1747
|
+
'namzu.usage.total_tokens': checkpoint.tokenUsage.totalTokens,
|
|
1748
|
+
'namzu.runtime.total_cost': checkpoint.costInfo.totalCost,
|
|
1749
|
+
[NAMZU.ITERATION]: checkpoint.guardState.iterationCount,
|
|
1750
|
+
'namzu.runtime.elapsed_ms': checkpoint.guardState.elapsedMs,
|
|
1360
1751
|
})
|
|
1361
1752
|
|
|
1362
1753
|
pushSystemMessages()
|
|
@@ -1409,11 +1800,12 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1409
1800
|
: removeDanglingMessages(checkpoint.messages)
|
|
1410
1801
|
if (!dangling.isValid && !pendingResume) {
|
|
1411
1802
|
ctx.log.warn('Checkpoint contained unanswered tool calls — repaired on restore', {
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1803
|
+
[NAMZU.RUN_ID]: ctx.runMgr.id,
|
|
1804
|
+
'namzu.checkpoint.id': checkpoint.id,
|
|
1805
|
+
'namzu.runtime.unanswered_assistant_turns':
|
|
1806
|
+
dangling.assistantsWithUnmatchedCalls.length,
|
|
1807
|
+
'namzu.runtime.orphaned_tool_messages': dangling.orphanedToolMessages.length,
|
|
1808
|
+
'namzu.runtime.removed': checkpoint.messages.length - restoredMessages.length,
|
|
1417
1809
|
})
|
|
1418
1810
|
}
|
|
1419
1811
|
|
|
@@ -1432,14 +1824,24 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1432
1824
|
}
|
|
1433
1825
|
ctx.runMgr.pushMessage(msg)
|
|
1434
1826
|
}
|
|
1827
|
+
|
|
1828
|
+
// The queue, on the resume path too. It is drained
|
|
1829
|
+
// unconditionally above, so leaving this out would take a
|
|
1830
|
+
// host's "start with this" off the record and deliver it
|
|
1831
|
+
// nowhere — the one outcome a durable queue must not have.
|
|
1832
|
+
//
|
|
1833
|
+
// AFTER the restored history rather than before it: on a
|
|
1834
|
+
// resume the conversation already exists, and a message left
|
|
1835
|
+
// for "the next run" is the newest thing said, not the oldest.
|
|
1836
|
+
for (const queued of queuedForThisRun) ctx.runMgr.pushMessage(queued)
|
|
1435
1837
|
} else if (params.continuationMode) {
|
|
1436
|
-
for (const msg of
|
|
1838
|
+
for (const msg of initialMessages) {
|
|
1437
1839
|
ctx.runMgr.pushMessage(msg)
|
|
1438
1840
|
}
|
|
1439
1841
|
} else {
|
|
1440
1842
|
pushSystemMessages()
|
|
1441
1843
|
let isFirstUserMessage = true
|
|
1442
|
-
for (const msg of
|
|
1844
|
+
for (const msg of initialMessages) {
|
|
1443
1845
|
if (msg.role === 'system') continue
|
|
1444
1846
|
ctx.runMgr.pushMessage(msg)
|
|
1445
1847
|
|
|
@@ -1463,6 +1865,23 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1463
1865
|
})
|
|
1464
1866
|
yield* eventTranslator.drainPending()
|
|
1465
1867
|
|
|
1868
|
+
// The box is handed out HERE, after `run_started`, and the position
|
|
1869
|
+
// is load-bearing rather than tidy. It moved twice:
|
|
1870
|
+
//
|
|
1871
|
+
// 1. Beside the box's construction — a host that called `set`
|
|
1872
|
+
// synchronously reached `eventTranslator` inside its temporal
|
|
1873
|
+
// dead zone and killed the run before it started.
|
|
1874
|
+
// 2. Beside the translator's construction — the translator existed,
|
|
1875
|
+
// but the run directory did not, so the durable append hit
|
|
1876
|
+
// ENOENT on `transcript.jsonl`.
|
|
1877
|
+
//
|
|
1878
|
+
// Both were found by the test that takes the box and immediately
|
|
1879
|
+
// swaps the policy, which is not an exotic host: it is the shape of
|
|
1880
|
+
// "start unattended" wiring. A policy change is durably recorded
|
|
1881
|
+
// before it takes effect, so the handout cannot precede the run
|
|
1882
|
+
// being writable.
|
|
1883
|
+
params.onApprovalPolicy?.(approvalPolicy)
|
|
1884
|
+
|
|
1466
1885
|
// Surface capability degradation to the host as run events —
|
|
1467
1886
|
// explicit, not silent (the log.warn above fires at setup time;
|
|
1468
1887
|
// this is the machine-readable channel).
|
|
@@ -1499,7 +1918,27 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1499
1918
|
|
|
1500
1919
|
// --- Sandbox lifecycle: create before iteration loop ---
|
|
1501
1920
|
if (params.sandboxProvider) {
|
|
1921
|
+
const rootAtCwd = params.runConfig.sandbox?.workspace === 'working-directory'
|
|
1922
|
+
// Checked against what the CALLER passed, not against `ctx.cwd`.
|
|
1923
|
+
// `ctx.cwd` falls back to `process.cwd()`, so reading it here
|
|
1924
|
+
// would silently root the sandbox at whatever directory the
|
|
1925
|
+
// host process happens to be in — which is not the directory
|
|
1926
|
+
// anybody asked to confine, and is worse than the temp dir the
|
|
1927
|
+
// caller declined. Refused before the sandbox exists, and not
|
|
1928
|
+
// downgraded to ephemeral: a caller who asked for confinement
|
|
1929
|
+
// of a specific tree and quietly got an empty one has been
|
|
1930
|
+
// told their files are protected by something that is not
|
|
1931
|
+
// looking at them.
|
|
1932
|
+
if (rootAtCwd && params.workingDirectory === undefined) {
|
|
1933
|
+
throw new NamzuError({
|
|
1934
|
+
code: 'invalid_config',
|
|
1935
|
+
message:
|
|
1936
|
+
"sandbox.workspace is 'working-directory' but this run has no workingDirectory. Pass one, or use the default 'ephemeral' — the kernel will not fall back to a temp directory, because that would confine a directory you did not name.",
|
|
1937
|
+
details: { workspace: 'working-directory' },
|
|
1938
|
+
})
|
|
1939
|
+
}
|
|
1502
1940
|
sandbox = await params.sandboxProvider.create({
|
|
1941
|
+
...(rootAtCwd ? { workingDirectory: ctx.cwd } : {}),
|
|
1503
1942
|
timeoutMs: params.runConfig.sandbox?.timeoutMs,
|
|
1504
1943
|
memoryLimitMb: params.runConfig.sandbox?.memoryLimitMb,
|
|
1505
1944
|
maxProcesses: params.runConfig.sandbox?.maxProcesses,
|
|
@@ -1515,9 +1954,9 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1515
1954
|
yield* eventTranslator.drainPending()
|
|
1516
1955
|
|
|
1517
1956
|
ctx.log.info('Sandbox created for run', {
|
|
1518
|
-
|
|
1519
|
-
environment: sandbox.environment,
|
|
1520
|
-
|
|
1957
|
+
'namzu.sandbox.id': sandbox.id,
|
|
1958
|
+
'namzu.execution.environment': sandbox.environment,
|
|
1959
|
+
'namzu.runtime.root_dir': sandbox.rootDir,
|
|
1521
1960
|
})
|
|
1522
1961
|
}
|
|
1523
1962
|
|
|
@@ -1531,7 +1970,7 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1531
1970
|
} else {
|
|
1532
1971
|
ctx.log.warn(
|
|
1533
1972
|
'emergencySave requested but the run has no output directory — crash dumps disabled',
|
|
1534
|
-
{
|
|
1973
|
+
{ [NAMZU.RUN_ID]: ctx.runId },
|
|
1535
1974
|
)
|
|
1536
1975
|
}
|
|
1537
1976
|
}
|
|
@@ -1559,6 +1998,15 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1559
1998
|
...(inputVerdict.reason ? { reason: inputVerdict.reason } : {}),
|
|
1560
1999
|
})
|
|
1561
2000
|
yield* eventTranslator.drainPending()
|
|
2001
|
+
// A guardrail block is a refusal — first-class in the audit trail
|
|
2002
|
+
// (LOG-14, design §5), not merely a RunEvent a host happens to be
|
|
2003
|
+
// subscribed to when it fires.
|
|
2004
|
+
await ctx.runMgr.recordAudit({
|
|
2005
|
+
what: { action: 'guardrail:input', resource: inputVerdict.name },
|
|
2006
|
+
outcome: 'refused',
|
|
2007
|
+
reason: inputVerdict.reason ?? 'blocked by an input guardrail',
|
|
2008
|
+
...(params.persona?.identity.role ? { persona: params.persona.identity.role } : {}),
|
|
2009
|
+
})
|
|
1562
2010
|
ctx.runMgr.setStopReason('input_guardrail')
|
|
1563
2011
|
ctx.runMgr.setLastError(inputVerdict.reason ?? 'blocked by an input guardrail')
|
|
1564
2012
|
yield* resultAssembler.completeRun(rootSpan)
|
|
@@ -1570,9 +2018,11 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1570
2018
|
// tool that needs one gets it.
|
|
1571
2019
|
if (pendingResume) {
|
|
1572
2020
|
ctx.log.info('Applying a pending HITL decision to the checkpointed tool calls', {
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
2021
|
+
[NAMZU.RUN_ID]: ctx.runId,
|
|
2022
|
+
'namzu.tool.names': pendingResume.response.message.toolCalls?.map(
|
|
2023
|
+
(tc) => tc.function.name,
|
|
2024
|
+
),
|
|
2025
|
+
'namzu.runtime.denied': pendingResume.denials.size,
|
|
1576
2026
|
})
|
|
1577
2027
|
// Hand the recorded answer to the already-built tool. The tool
|
|
1578
2028
|
// closed over its registry when the agent was constructed,
|
|
@@ -1598,9 +2048,9 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1598
2048
|
.unpark(resolvedCheckpointId, params.pendingDecision)
|
|
1599
2049
|
.catch((err: unknown) => {
|
|
1600
2050
|
ctx.log.error('Applied a pending decision but failed to clear the park', {
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
2051
|
+
[NAMZU.RUN_ID]: ctx.runId,
|
|
2052
|
+
'namzu.checkpoint.id': resolvedCheckpointId,
|
|
2053
|
+
'exception.message': err instanceof Error ? err.message : String(err),
|
|
1604
2054
|
})
|
|
1605
2055
|
return null
|
|
1606
2056
|
})
|
|
@@ -1651,6 +2101,13 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1651
2101
|
...(outputVerdict.reason ? { reason: outputVerdict.reason } : {}),
|
|
1652
2102
|
})
|
|
1653
2103
|
yield* eventTranslator.drainPending()
|
|
2104
|
+
// Same reasoning as the input-guardrail branch above.
|
|
2105
|
+
await ctx.runMgr.recordAudit({
|
|
2106
|
+
what: { action: 'guardrail:output', resource: outputVerdict.name },
|
|
2107
|
+
outcome: 'refused',
|
|
2108
|
+
reason: outputVerdict.reason ?? 'blocked by an output guardrail',
|
|
2109
|
+
...(params.persona?.identity.role ? { persona: params.persona.identity.role } : {}),
|
|
2110
|
+
})
|
|
1654
2111
|
ctx.runMgr.setStopReason('output_guardrail')
|
|
1655
2112
|
ctx.runMgr.setLastError(outputVerdict.reason ?? 'blocked by an output guardrail')
|
|
1656
2113
|
ctx.runMgr.setResult('')
|
|
@@ -1680,6 +2137,30 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1680
2137
|
// process's life.
|
|
1681
2138
|
emergencyManager?.detach()
|
|
1682
2139
|
|
|
2140
|
+
// A background job outlives the tool call that started it — that
|
|
2141
|
+
// is what it is for — so nothing but this stops it outliving the
|
|
2142
|
+
// RUN. Scoped to this run's id: a shared registry serving several
|
|
2143
|
+
// runs must not have one of them tear down another's work.
|
|
2144
|
+
//
|
|
2145
|
+
// Awaited, and its failure swallowed. A job that would not die is
|
|
2146
|
+
// worth a log line, and is not worth retracting a run's answer.
|
|
2147
|
+
if (params.backgroundJobs) {
|
|
2148
|
+
try {
|
|
2149
|
+
const stopped = await params.backgroundJobs.killOwner(ctx.runId)
|
|
2150
|
+
if (stopped.length > 0) {
|
|
2151
|
+
ctx.log.info('Background jobs stopped with the run', {
|
|
2152
|
+
[NAMZU.RUN_ID]: ctx.runId,
|
|
2153
|
+
'namzu.jobs.stopped': stopped.length,
|
|
2154
|
+
})
|
|
2155
|
+
}
|
|
2156
|
+
} catch (jobErr) {
|
|
2157
|
+
ctx.log.error('A background job did not stop cleanly', {
|
|
2158
|
+
[NAMZU.RUN_ID]: ctx.runId,
|
|
2159
|
+
...errorAttributes(jobErr),
|
|
2160
|
+
})
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
|
|
1683
2164
|
// Same reasoning for the question channel: the tools outlive the
|
|
1684
2165
|
// run that bound them, so leaving it attached would have a later
|
|
1685
2166
|
// run's question written into this run's checkpoint store.
|
|
@@ -1697,8 +2178,9 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1697
2178
|
await params.promoteMemory(candidate)
|
|
1698
2179
|
} catch (promoteErr) {
|
|
1699
2180
|
ctx.log.error('Memory promotion threw — the run is unaffected', {
|
|
1700
|
-
|
|
1701
|
-
|
|
2181
|
+
[NAMZU.RUN_ID]: ctx.runId,
|
|
2182
|
+
'exception.message':
|
|
2183
|
+
promoteErr instanceof Error ? promoteErr.message : String(promoteErr),
|
|
1702
2184
|
})
|
|
1703
2185
|
}
|
|
1704
2186
|
}
|
|
@@ -1713,11 +2195,12 @@ export async function* query(params: QueryParams): AsyncGenerator<RunEvent, Run>
|
|
|
1713
2195
|
runId: ctx.runId,
|
|
1714
2196
|
sandboxId,
|
|
1715
2197
|
})
|
|
1716
|
-
ctx.log.info('Sandbox destroyed', { sandboxId })
|
|
2198
|
+
ctx.log.info('Sandbox destroyed', { 'namzu.sandbox.id': sandboxId })
|
|
1717
2199
|
} catch (destroyErr) {
|
|
1718
2200
|
ctx.log.error('Sandbox destroy failed', {
|
|
1719
|
-
sandboxId,
|
|
1720
|
-
|
|
2201
|
+
'namzu.sandbox.id': sandboxId,
|
|
2202
|
+
'exception.message':
|
|
2203
|
+
destroyErr instanceof Error ? destroyErr.message : String(destroyErr),
|
|
1721
2204
|
})
|
|
1722
2205
|
}
|
|
1723
2206
|
}
|
|
@@ -1749,7 +2232,7 @@ async function* catchUpFromCursor(
|
|
|
1749
2232
|
runMgr: RunPersistence,
|
|
1750
2233
|
cursor: RunEventCursor,
|
|
1751
2234
|
onEventReplay: ((replay: RunEventReplay) => void) | undefined,
|
|
1752
|
-
generation:
|
|
2235
|
+
generation: FencingToken | undefined,
|
|
1753
2236
|
): AsyncGenerator<RunEvent, void> {
|
|
1754
2237
|
const missed = await runMgr.getRunStore().readEvents({ sinceSeq: cursor.sinceSeq })
|
|
1755
2238
|
const replay = resolveRunEventReplay(
|