agent-nuvira 3.3.1 → 3.3.4
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/README.md +18 -13
- package/dist/agent-sdk/src/agent.d.ts +2 -0
- package/dist/agent-sdk/src/agent.d.ts.map +1 -1
- package/dist/agent-sdk/src/define.d.ts +64 -0
- package/dist/agent-sdk/src/define.d.ts.map +1 -0
- package/dist/agent-sdk/src/define.js +76 -0
- package/dist/agent-sdk/src/define.js.map +1 -0
- package/dist/agent-sdk/src/index.d.ts +9 -0
- package/dist/agent-sdk/src/index.d.ts.map +1 -1
- package/dist/agent-sdk/src/index.js +9 -0
- package/dist/agent-sdk/src/index.js.map +1 -1
- package/dist/agent-sdk/src/scaffold.d.ts +11 -0
- package/dist/agent-sdk/src/scaffold.d.ts.map +1 -1
- package/dist/agent-sdk/src/scaffold.js +16 -6
- package/dist/agent-sdk/src/scaffold.js.map +1 -1
- package/dist/agents/agents/runner.d.ts +9 -0
- package/dist/agents/agents/runner.d.ts.map +1 -1
- package/dist/agents/agents/runner.js +34 -12
- package/dist/agents/agents/runner.js.map +1 -1
- package/dist/agents/agents/writer-tool-calling.d.ts.map +1 -1
- package/dist/agents/agents/writer-tool-calling.js +7 -2
- package/dist/agents/agents/writer-tool-calling.js.map +1 -1
- package/dist/agents/agents/writer.d.ts.map +1 -1
- package/dist/agents/agents/writer.js +7 -1
- package/dist/agents/agents/writer.js.map +1 -1
- package/dist/agents/artifact-verification.d.ts +102 -0
- package/dist/agents/artifact-verification.d.ts.map +1 -0
- package/dist/agents/artifact-verification.js +216 -0
- package/dist/agents/artifact-verification.js.map +1 -0
- package/dist/agents/checkpoint-store.d.ts +73 -0
- package/dist/agents/checkpoint-store.d.ts.map +1 -1
- package/dist/agents/checkpoint-store.js +161 -0
- package/dist/agents/checkpoint-store.js.map +1 -1
- package/dist/agents/credential-store.d.ts +120 -0
- package/dist/agents/credential-store.d.ts.map +1 -1
- package/dist/agents/credential-store.js +358 -19
- package/dist/agents/credential-store.js.map +1 -1
- package/dist/agents/long-form-plan.d.ts.map +1 -1
- package/dist/agents/long-form-plan.js +2 -1
- package/dist/agents/long-form-plan.js.map +1 -1
- package/dist/agents/orchestrator.d.ts +10 -1
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/agents/orchestrator.js +239 -79
- package/dist/agents/orchestrator.js.map +1 -1
- package/dist/agents/phase-engine.d.ts +61 -0
- package/dist/agents/phase-engine.d.ts.map +1 -1
- package/dist/agents/phase-engine.js +68 -2
- package/dist/agents/phase-engine.js.map +1 -1
- package/dist/agents/prompt-assembly.d.ts +11 -0
- package/dist/agents/prompt-assembly.d.ts.map +1 -1
- package/dist/agents/prompt-assembly.js +17 -0
- package/dist/agents/prompt-assembly.js.map +1 -1
- package/dist/agents/release-preflight.d.ts +121 -0
- package/dist/agents/release-preflight.d.ts.map +1 -0
- package/dist/agents/release-preflight.js +259 -0
- package/dist/agents/release-preflight.js.map +1 -0
- package/dist/agents/release-runner.d.ts +157 -0
- package/dist/agents/release-runner.d.ts.map +1 -0
- package/dist/agents/release-runner.js +719 -0
- package/dist/agents/release-runner.js.map +1 -0
- package/dist/agents/step-handoff.d.ts +190 -0
- package/dist/agents/step-handoff.d.ts.map +1 -0
- package/dist/agents/step-handoff.js +443 -0
- package/dist/agents/step-handoff.js.map +1 -0
- package/dist/cli/agent.d.ts +2 -2
- package/dist/cli/agent.js +10 -10
- package/dist/cli/benchmark.d.ts.map +1 -1
- package/dist/cli/benchmark.js +11 -4
- package/dist/cli/benchmark.js.map +1 -1
- package/dist/cli/chat.d.ts +94 -0
- package/dist/cli/chat.d.ts.map +1 -1
- package/dist/cli/chat.js +379 -24
- package/dist/cli/chat.js.map +1 -1
- package/dist/cli/cli-program.d.ts.map +1 -1
- package/dist/cli/cli-program.js +8 -0
- package/dist/cli/cli-program.js.map +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +9 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/credentials.d.ts +28 -0
- package/dist/cli/credentials.d.ts.map +1 -0
- package/dist/cli/credentials.js +213 -0
- package/dist/cli/credentials.js.map +1 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +3 -2
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/edit.js +2 -2
- package/dist/cli/eval.d.ts +17 -0
- package/dist/cli/eval.d.ts.map +1 -1
- package/dist/cli/eval.js +105 -2
- package/dist/cli/eval.js.map +1 -1
- package/dist/cli/execute.d.ts +16 -1
- package/dist/cli/execute.d.ts.map +1 -1
- package/dist/cli/execute.js +192 -22
- package/dist/cli/execute.js.map +1 -1
- package/dist/cli/failover-runner.d.ts.map +1 -1
- package/dist/cli/failover-runner.js +9 -3
- package/dist/cli/failover-runner.js.map +1 -1
- package/dist/cli/loop-executor.d.ts +55 -0
- package/dist/cli/loop-executor.d.ts.map +1 -1
- package/dist/cli/loop-executor.js +285 -19
- package/dist/cli/loop-executor.js.map +1 -1
- package/dist/cli/model.d.ts.map +1 -1
- package/dist/cli/model.js +9 -8
- package/dist/cli/model.js.map +1 -1
- package/dist/cli/models.d.ts +1 -1
- package/dist/cli/models.js +4 -4
- package/dist/cli/nlu.d.ts.map +1 -1
- package/dist/cli/nlu.js +8 -2
- package/dist/cli/nlu.js.map +1 -1
- package/dist/cli/parity.d.ts +85 -0
- package/dist/cli/parity.d.ts.map +1 -0
- package/dist/cli/parity.js +506 -0
- package/dist/cli/parity.js.map +1 -0
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +2 -1
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/publish.d.ts +22 -0
- package/dist/cli/publish.d.ts.map +1 -1
- package/dist/cli/publish.js +109 -13
- package/dist/cli/publish.js.map +1 -1
- package/dist/cli/retrieval.d.ts.map +1 -1
- package/dist/cli/retrieval.js +5 -4
- package/dist/cli/retrieval.js.map +1 -1
- package/dist/cli/sdk.js +4 -4
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli/trace.d.ts.map +1 -1
- package/dist/cli/trace.js +2 -1
- package/dist/cli/trace.js.map +1 -1
- package/dist/cli/workflow.js +2 -2
- package/dist/cli/workflow.js.map +1 -1
- package/dist/config/live-credentials.d.ts +57 -0
- package/dist/config/live-credentials.d.ts.map +1 -0
- package/dist/config/live-credentials.js +126 -0
- package/dist/config/live-credentials.js.map +1 -0
- package/dist/config/paths.d.ts +18 -0
- package/dist/config/paths.d.ts.map +1 -1
- package/dist/config/paths.js +25 -0
- package/dist/config/paths.js.map +1 -1
- package/dist/config/types.d.ts +44 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/federation/a2a-types.js +1 -1
- package/dist/federation/a2a-types.js.map +1 -1
- package/dist/findings/verdicts.d.ts +241 -0
- package/dist/findings/verdicts.d.ts.map +1 -0
- package/dist/findings/verdicts.js +284 -0
- package/dist/findings/verdicts.js.map +1 -0
- package/dist/gateway/adapters.d.ts +65 -0
- package/dist/gateway/adapters.d.ts.map +1 -1
- package/dist/gateway/adapters.js +216 -10
- package/dist/gateway/adapters.js.map +1 -1
- package/dist/gateway/channel-directory.d.ts +31 -0
- package/dist/gateway/channel-directory.d.ts.map +1 -1
- package/dist/gateway/channel-directory.js +40 -0
- package/dist/gateway/channel-directory.js.map +1 -1
- package/dist/gateway/gateway-log.d.ts +1 -1
- package/dist/gateway/gateway-log.d.ts.map +1 -1
- package/dist/gateway/gateway-log.js.map +1 -1
- package/dist/gateway/hooks.d.ts +87 -19
- package/dist/gateway/hooks.d.ts.map +1 -1
- package/dist/gateway/hooks.js +62 -23
- package/dist/gateway/hooks.js.map +1 -1
- package/dist/gateway/inbound-media.d.ts +147 -0
- package/dist/gateway/inbound-media.d.ts.map +1 -0
- package/dist/gateway/inbound-media.js +317 -0
- package/dist/gateway/inbound-media.js.map +1 -0
- package/dist/gateway/inbox.d.ts +8 -1
- package/dist/gateway/inbox.d.ts.map +1 -1
- package/dist/gateway/inbox.js.map +1 -1
- package/dist/gateway/platform-config.d.ts +14 -0
- package/dist/gateway/platform-config.d.ts.map +1 -1
- package/dist/gateway/platform-config.js +26 -8
- package/dist/gateway/platform-config.js.map +1 -1
- package/dist/gateway/realtime.d.ts +114 -0
- package/dist/gateway/realtime.d.ts.map +1 -0
- package/dist/gateway/realtime.js +402 -0
- package/dist/gateway/realtime.js.map +1 -0
- package/dist/gateway/registry.d.ts +31 -0
- package/dist/gateway/registry.d.ts.map +1 -1
- package/dist/gateway/registry.js +224 -4
- package/dist/gateway/registry.js.map +1 -1
- package/dist/gateway/whatsapp/baileys-bridge.d.ts +11 -1
- package/dist/gateway/whatsapp/baileys-bridge.d.ts.map +1 -1
- package/dist/gateway/whatsapp/baileys-bridge.js +123 -4
- package/dist/gateway/whatsapp/baileys-bridge.js.map +1 -1
- package/dist/gateway/whatsapp/bridge.d.ts +6 -2
- package/dist/gateway/whatsapp/bridge.d.ts.map +1 -1
- package/dist/gateway/whatsapp/bridge.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/inference/factory.d.ts +14 -0
- package/dist/inference/factory.d.ts.map +1 -1
- package/dist/inference/factory.js +17 -0
- package/dist/inference/factory.js.map +1 -1
- package/dist/inference/groq-adapter.d.ts +2 -0
- package/dist/inference/groq-adapter.d.ts.map +1 -1
- package/dist/inference/groq-adapter.js +16 -6
- package/dist/inference/groq-adapter.js.map +1 -1
- package/dist/inference/model-validator.d.ts +6 -1
- package/dist/inference/model-validator.d.ts.map +1 -1
- package/dist/inference/model-validator.js +7 -2
- package/dist/inference/model-validator.js.map +1 -1
- package/dist/inference/route-resolver.d.ts +116 -0
- package/dist/inference/route-resolver.d.ts.map +1 -0
- package/dist/inference/route-resolver.js +159 -0
- package/dist/inference/route-resolver.js.map +1 -0
- package/dist/inference/tools.d.ts.map +1 -1
- package/dist/inference/tools.js +29 -0
- package/dist/inference/tools.js.map +1 -1
- package/dist/learning/autonomy-policy.d.ts +18 -0
- package/dist/learning/autonomy-policy.d.ts.map +1 -1
- package/dist/learning/autonomy-policy.js +35 -0
- package/dist/learning/autonomy-policy.js.map +1 -1
- package/dist/learning/benchmark.d.ts.map +1 -1
- package/dist/learning/benchmark.js +3 -2
- package/dist/learning/benchmark.js.map +1 -1
- package/dist/learning/continuation.d.ts.map +1 -1
- package/dist/learning/continuation.js +2 -1
- package/dist/learning/continuation.js.map +1 -1
- package/dist/learning/cost-tracker.d.ts.map +1 -1
- package/dist/learning/cost-tracker.js +2 -1
- package/dist/learning/cost-tracker.js.map +1 -1
- package/dist/learning/deferred-task.d.ts.map +1 -1
- package/dist/learning/deferred-task.js +13 -4
- package/dist/learning/deferred-task.js.map +1 -1
- package/dist/learning/eval-framework.d.ts.map +1 -1
- package/dist/learning/eval-framework.js +2 -1
- package/dist/learning/eval-framework.js.map +1 -1
- package/dist/learning/long-form.d.ts.map +1 -1
- package/dist/learning/long-form.js +2 -1
- package/dist/learning/long-form.js.map +1 -1
- package/dist/learning/model-registry.d.ts.map +1 -1
- package/dist/learning/model-registry.js +2 -1
- package/dist/learning/model-registry.js.map +1 -1
- package/dist/learning/reasoning-cache.d.ts.map +1 -1
- package/dist/learning/reasoning-cache.js +2 -1
- package/dist/learning/reasoning-cache.js.map +1 -1
- package/dist/learning/reasoning-trace.d.ts +38 -2
- package/dist/learning/reasoning-trace.d.ts.map +1 -1
- package/dist/learning/reasoning-trace.js +91 -1
- package/dist/learning/reasoning-trace.js.map +1 -1
- package/dist/learning/resilient-call.d.ts.map +1 -1
- package/dist/learning/resilient-call.js +31 -18
- package/dist/learning/resilient-call.js.map +1 -1
- package/dist/learning/retrieval.d.ts.map +1 -1
- package/dist/learning/retrieval.js +2 -1
- package/dist/learning/retrieval.js.map +1 -1
- package/dist/learning/seeded-benchmark.d.ts +160 -0
- package/dist/learning/seeded-benchmark.d.ts.map +1 -0
- package/dist/learning/seeded-benchmark.js +321 -0
- package/dist/learning/seeded-benchmark.js.map +1 -0
- package/dist/learning/seeded-bugs.d.ts +142 -0
- package/dist/learning/seeded-bugs.d.ts.map +1 -0
- package/dist/learning/seeded-bugs.js +535 -0
- package/dist/learning/seeded-bugs.js.map +1 -0
- package/dist/learning/skill-store.d.ts.map +1 -1
- package/dist/learning/skill-store.js +30 -9
- package/dist/learning/skill-store.js.map +1 -1
- package/dist/learning/step-checkpoint.d.ts +127 -0
- package/dist/learning/step-checkpoint.d.ts.map +1 -0
- package/dist/learning/step-checkpoint.js +244 -0
- package/dist/learning/step-checkpoint.js.map +1 -0
- package/dist/mcp/catalog.js +2 -3
- package/dist/mcp/catalog.js.map +1 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +5 -3
- package/dist/mcp/manager.js.map +1 -1
- package/dist/nlu/intent-confirm.d.ts +23 -1
- package/dist/nlu/intent-confirm.d.ts.map +1 -1
- package/dist/nlu/intent-confirm.js +85 -2
- package/dist/nlu/intent-confirm.js.map +1 -1
- package/dist/nlu/learnings.d.ts +7 -0
- package/dist/nlu/learnings.d.ts.map +1 -1
- package/dist/nlu/learnings.js +7 -0
- package/dist/nlu/learnings.js.map +1 -1
- package/dist/observability/debug-log.d.ts +250 -0
- package/dist/observability/debug-log.d.ts.map +1 -0
- package/dist/observability/debug-log.js +500 -0
- package/dist/observability/debug-log.js.map +1 -0
- package/dist/observability/event-bus.d.ts.map +1 -1
- package/dist/observability/event-bus.js +4 -1
- package/dist/observability/event-bus.js.map +1 -1
- package/dist/observability/otel.d.ts +278 -0
- package/dist/observability/otel.d.ts.map +1 -0
- package/dist/observability/otel.js +590 -0
- package/dist/observability/otel.js.map +1 -0
- package/dist/parity/drivers.d.ts +99 -0
- package/dist/parity/drivers.d.ts.map +1 -0
- package/dist/parity/drivers.js +1362 -0
- package/dist/parity/drivers.js.map +1 -0
- package/dist/parity/graph.d.ts +73 -0
- package/dist/parity/graph.d.ts.map +1 -0
- package/dist/parity/graph.js +162 -0
- package/dist/parity/graph.js.map +1 -0
- package/dist/parity/matrix.d.ts +105 -0
- package/dist/parity/matrix.d.ts.map +1 -0
- package/dist/parity/matrix.js +352 -0
- package/dist/parity/matrix.js.map +1 -0
- package/dist/parity/observation.d.ts +444 -0
- package/dist/parity/observation.d.ts.map +1 -0
- package/dist/parity/observation.js +333 -0
- package/dist/parity/observation.js.map +1 -0
- package/dist/parity/scenarios.d.ts +229 -0
- package/dist/parity/scenarios.d.ts.map +1 -0
- package/dist/parity/scenarios.js +175 -0
- package/dist/parity/scenarios.js.map +1 -0
- package/dist/parity/surfaces.d.ts +122 -0
- package/dist/parity/surfaces.d.ts.map +1 -0
- package/dist/parity/surfaces.js +190 -0
- package/dist/parity/surfaces.js.map +1 -0
- package/dist/runtime/fault-injection.d.ts +173 -0
- package/dist/runtime/fault-injection.d.ts.map +1 -0
- package/dist/runtime/fault-injection.js +281 -0
- package/dist/runtime/fault-injection.js.map +1 -0
- package/dist/skills/secret-capture.d.ts.map +1 -1
- package/dist/skills/secret-capture.js +9 -4
- package/dist/skills/secret-capture.js.map +1 -1
- package/dist/tools/child-agent-entry.d.ts +23 -0
- package/dist/tools/child-agent-entry.d.ts.map +1 -0
- package/dist/tools/child-agent-entry.js +129 -0
- package/dist/tools/child-agent-entry.js.map +1 -0
- package/dist/tools/child-agent-runtime.d.ts +124 -0
- package/dist/tools/child-agent-runtime.d.ts.map +1 -0
- package/dist/tools/child-agent-runtime.js +704 -0
- package/dist/tools/child-agent-runtime.js.map +1 -0
- package/dist/tools/coding-tools.d.ts.map +1 -1
- package/dist/tools/coding-tools.js +82 -10
- package/dist/tools/coding-tools.js.map +1 -1
- package/dist/tools/credentials-tool.d.ts +24 -0
- package/dist/tools/credentials-tool.d.ts.map +1 -0
- package/dist/tools/credentials-tool.js +125 -0
- package/dist/tools/credentials-tool.js.map +1 -0
- package/dist/tools/delegation-system.d.ts +31 -0
- package/dist/tools/delegation-system.d.ts.map +1 -1
- package/dist/tools/delegation-system.js +70 -9
- package/dist/tools/delegation-system.js.map +1 -1
- package/dist/tools/extract/docx.d.ts +27 -0
- package/dist/tools/extract/docx.d.ts.map +1 -0
- package/dist/tools/extract/docx.js +48 -0
- package/dist/tools/extract/docx.js.map +1 -0
- package/dist/tools/extract/html-text.d.ts +27 -0
- package/dist/tools/extract/html-text.d.ts.map +1 -0
- package/dist/tools/extract/html-text.js +86 -0
- package/dist/tools/extract/html-text.js.map +1 -0
- package/dist/tools/extract/pdf-ocr.d.ts +58 -0
- package/dist/tools/extract/pdf-ocr.d.ts.map +1 -0
- package/dist/tools/extract/pdf-ocr.js +116 -0
- package/dist/tools/extract/pdf-ocr.js.map +1 -0
- package/dist/tools/extract/pdf.d.ts +65 -0
- package/dist/tools/extract/pdf.d.ts.map +1 -0
- package/dist/tools/extract/pdf.js +197 -0
- package/dist/tools/extract/pdf.js.map +1 -0
- package/dist/tools/extract/pptx.d.ts +32 -0
- package/dist/tools/extract/pptx.d.ts.map +1 -0
- package/dist/tools/extract/pptx.js +77 -0
- package/dist/tools/extract/pptx.js.map +1 -0
- package/dist/tools/extract/xlsx.d.ts +47 -0
- package/dist/tools/extract/xlsx.d.ts.map +1 -0
- package/dist/tools/extract/xlsx.js +111 -0
- package/dist/tools/extract/xlsx.js.map +1 -0
- package/dist/tools/finding-tool.d.ts +76 -0
- package/dist/tools/finding-tool.d.ts.map +1 -0
- package/dist/tools/finding-tool.js +125 -0
- package/dist/tools/finding-tool.js.map +1 -0
- package/dist/tools/git-tool.d.ts +25 -7
- package/dist/tools/git-tool.d.ts.map +1 -1
- package/dist/tools/git-tool.js +155 -15
- package/dist/tools/git-tool.js.map +1 -1
- package/dist/tools/loop-project-context.d.ts.map +1 -1
- package/dist/tools/loop-project-context.js +16 -0
- package/dist/tools/loop-project-context.js.map +1 -1
- package/dist/tools/loop-route-feed.d.ts +57 -0
- package/dist/tools/loop-route-feed.d.ts.map +1 -0
- package/dist/tools/loop-route-feed.js +101 -0
- package/dist/tools/loop-route-feed.js.map +1 -0
- package/dist/tools/messaging-tools.d.ts +41 -11
- package/dist/tools/messaging-tools.d.ts.map +1 -1
- package/dist/tools/messaging-tools.js +104 -55
- package/dist/tools/messaging-tools.js.map +1 -1
- package/dist/tools/neutts-synth.d.ts +27 -3
- package/dist/tools/neutts-synth.d.ts.map +1 -1
- package/dist/tools/neutts-synth.js +57 -13
- package/dist/tools/neutts-synth.js.map +1 -1
- package/dist/tools/pipeline-tool.d.ts +43 -1
- package/dist/tools/pipeline-tool.d.ts.map +1 -1
- package/dist/tools/pipeline-tool.js +21 -4
- package/dist/tools/pipeline-tool.js.map +1 -1
- package/dist/tools/publish-tool.d.ts.map +1 -1
- package/dist/tools/publish-tool.js +76 -10
- package/dist/tools/publish-tool.js.map +1 -1
- package/dist/tools/read-extract.d.ts +116 -45
- package/dist/tools/read-extract.d.ts.map +1 -1
- package/dist/tools/read-extract.js +494 -158
- package/dist/tools/read-extract.js.map +1 -1
- package/dist/tools/registry.d.ts +23 -3
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +196 -29
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/run-terminal.d.ts +9 -0
- package/dist/tools/run-terminal.d.ts.map +1 -1
- package/dist/tools/run-terminal.js +80 -2
- package/dist/tools/run-terminal.js.map +1 -1
- package/dist/tools/subagent-refusal.d.ts +15 -0
- package/dist/tools/subagent-refusal.d.ts.map +1 -0
- package/dist/tools/subagent-refusal.js +18 -0
- package/dist/tools/subagent-refusal.js.map +1 -0
- package/dist/tools/subagent-spawner.d.ts +122 -0
- package/dist/tools/subagent-spawner.d.ts.map +1 -1
- package/dist/tools/subagent-spawner.js +249 -28
- package/dist/tools/subagent-spawner.js.map +1 -1
- package/dist/tools/tool-hooks.d.ts +177 -0
- package/dist/tools/tool-hooks.d.ts.map +1 -0
- package/dist/tools/tool-hooks.js +427 -0
- package/dist/tools/tool-hooks.js.map +1 -0
- package/dist/tools/tool-loop.d.ts +94 -5
- package/dist/tools/tool-loop.d.ts.map +1 -1
- package/dist/tools/tool-loop.js +315 -9
- package/dist/tools/tool-loop.js.map +1 -1
- package/dist/tools/tool-refusal.d.ts +68 -0
- package/dist/tools/tool-refusal.d.ts.map +1 -0
- package/dist/tools/tool-refusal.js +78 -0
- package/dist/tools/tool-refusal.js.map +1 -0
- package/dist/tools/toolsets.d.ts +8 -0
- package/dist/tools/toolsets.d.ts.map +1 -1
- package/dist/tools/toolsets.js +14 -4
- package/dist/tools/toolsets.js.map +1 -1
- package/dist/tools/vision-tools.d.ts +88 -83
- package/dist/tools/vision-tools.d.ts.map +1 -1
- package/dist/tools/vision-tools.js +134 -103
- package/dist/tools/vision-tools.js.map +1 -1
- package/dist/tools/worktree.d.ts +210 -0
- package/dist/tools/worktree.d.ts.map +1 -0
- package/dist/tools/worktree.js +374 -0
- package/dist/tools/worktree.js.map +1 -0
- package/dist/utils/format.d.ts +3 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +32 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/web-dashboard/attachment-extract.d.ts +64 -0
- package/dist/web-dashboard/attachment-extract.d.ts.map +1 -0
- package/dist/web-dashboard/attachment-extract.js +154 -0
- package/dist/web-dashboard/attachment-extract.js.map +1 -0
- package/dist/web-dashboard/chat-console.d.ts +108 -1
- package/dist/web-dashboard/chat-console.d.ts.map +1 -1
- package/dist/web-dashboard/chat-console.js +36 -0
- package/dist/web-dashboard/chat-console.js.map +1 -1
- package/dist/web-dashboard/hub-data.d.ts +37 -0
- package/dist/web-dashboard/hub-data.d.ts.map +1 -1
- package/dist/web-dashboard/hub-data.js +61 -1
- package/dist/web-dashboard/hub-data.js.map +1 -1
- package/dist/web-dashboard/server.d.ts +14 -0
- package/dist/web-dashboard/server.d.ts.map +1 -1
- package/dist/web-dashboard/server.js +247 -13
- package/dist/web-dashboard/server.js.map +1 -1
- package/dist/web-dashboard/src/types.d.ts +196 -48
- package/dist/web-dashboard/src/types.d.ts.map +1 -1
- package/dist/workflow/registry.js +1 -1
- package/dist/workflow/registry.js.map +1 -1
- package/package.json +22 -6
- package/src/web-dashboard/public/assets/{index-Cyd6tIew.css → index-XJjj2cBX.css} +1 -1
- package/src/web-dashboard/public/assets/index-YWF9FpwQ.js +207 -0
- package/src/web-dashboard/public/assets/index-YWF9FpwQ.js.map +1 -0
- package/src/web-dashboard/public/index.html +2 -2
- package/dist/tools/child-agent-worker.js +0 -212
- package/src/web-dashboard/public/assets/index-CjvoBhlz.js +0 -207
- package/src/web-dashboard/public/assets/index-CjvoBhlz.js.map +0 -1
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WS4 (#26) — tool lifecycle hooks an operator can subscribe to.
|
|
3
|
+
*
|
|
4
|
+
* WHY AN OPERATOR-FACING HOOK, AND WHY IT REUSES THE REGISTRY. The registry
|
|
5
|
+
* (`src/gateway/hooks.ts`) already existed and already had a `post_tool_call`
|
|
6
|
+
* event — wired to the event bus and installed by NOTHING in production, so it
|
|
7
|
+
* reached the gateway and nowhere else, and could not stop a call even where it
|
|
8
|
+
* did fire. This module is the missing half: it lets an operator DECLARE hooks in
|
|
9
|
+
* config or in the environment, and binds them into that same registry, so the
|
|
10
|
+
* seam has one subscription model instead of a second, parallel system.
|
|
11
|
+
*
|
|
12
|
+
* DECLARED, NOT PROGRAMMED. A hook is a COMMAND with three phases to choose from
|
|
13
|
+
* (`before` / `after` / `failed`), because the operator of a CLI is a person with
|
|
14
|
+
* a shell — not someone who edits this repository to install a callback. The call
|
|
15
|
+
* is written to the command's STDIN as JSON and its decision is read from STDOUT
|
|
16
|
+
* as JSON, so a tool argument can never change which program runs: nothing is
|
|
17
|
+
* interpolated into a command line, only passed as data.
|
|
18
|
+
*
|
|
19
|
+
* CONFIG, WITH THE ENVIRONMENT WINNING. `tools.hooks` in `buffconfig.json` is the
|
|
20
|
+
* durable, reviewable declaration; `NUVIRA_TOOL_HOOK_BEFORE` / `_AFTER` /
|
|
21
|
+
* `_FAILED` declare one hook for a single run. For a given phase the environment
|
|
22
|
+
* REPLACES the configured hooks — "the environment wins" has to mean one list per
|
|
23
|
+
* phase, or the effective hooks are not knowable from reading either source. That
|
|
24
|
+
* also makes the variables the way a forked subagent is covered with no extra
|
|
25
|
+
* plumbing: it inherits its parent's environment, and reads its own config.
|
|
26
|
+
*
|
|
27
|
+
* A BROKEN HOOK DOES NOT VETO. This is the rule the rest of this codebase already
|
|
28
|
+
* follows for its own instruments (the debug log, the OTLP tracer): a hook that
|
|
29
|
+
* crashes, times out, or prints something unparseable is REPORTED and the call
|
|
30
|
+
* proceeds. The alternative is worse than it looks — one bad hook would stop
|
|
31
|
+
* every tool call in the process, and it would do so silently, because the hook
|
|
32
|
+
* that was supposed to report problems is the one that is broken. A veto must be
|
|
33
|
+
* explicit and well-formed (`{"decision":"deny","reason":"…"}`), so a hook can
|
|
34
|
+
* only stop work by saying so.
|
|
35
|
+
*
|
|
36
|
+
* Hooks see LOCAL data and it is NOT redacted, unlike the debug log and the trace:
|
|
37
|
+
* those leave the machine, this is the operator's own command on their own
|
|
38
|
+
* machine. The result preview is bounded so a huge tool result cannot be handed
|
|
39
|
+
* over in full on every call.
|
|
40
|
+
*/
|
|
41
|
+
import { spawn } from 'node:child_process';
|
|
42
|
+
import { hooks } from '../gateway/hooks.js';
|
|
43
|
+
/** The phase a hook is declared for, in the order a call goes through them. */
|
|
44
|
+
export const TOOL_HOOK_PHASES = ['before', 'after', 'failed'];
|
|
45
|
+
/** The environment variable that declares one hook for a single phase. */
|
|
46
|
+
export const TOOL_HOOK_ENV = {
|
|
47
|
+
before: 'NUVIRA_TOOL_HOOK_BEFORE',
|
|
48
|
+
after: 'NUVIRA_TOOL_HOOK_AFTER',
|
|
49
|
+
failed: 'NUVIRA_TOOL_HOOK_FAILED',
|
|
50
|
+
};
|
|
51
|
+
/** How long a hook may take before it is killed and reported. */
|
|
52
|
+
export const TOOL_HOOK_TIMEOUT_MS = 5_000;
|
|
53
|
+
/** Cap on what we read back from a hook, so a runaway command cannot fill memory. */
|
|
54
|
+
export const TOOL_HOOK_OUTPUT_LIMIT_CHARS = 8_000;
|
|
55
|
+
/** Cap on the tool result a hook receives — a preview, not the payload. */
|
|
56
|
+
export const TOOL_HOOK_RESULT_PREVIEW_CHARS = 4_000;
|
|
57
|
+
/** The honest "no hook had anything to say" value. Fresh each call. */
|
|
58
|
+
function allow() {
|
|
59
|
+
return { denied: false, problems: [] };
|
|
60
|
+
}
|
|
61
|
+
/** The label a problem/decision is reported under. */
|
|
62
|
+
function labelOf(decl) {
|
|
63
|
+
return decl.label?.trim() || decl.command;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The declarations in effect: config first, then each phase REPLACED by its
|
|
67
|
+
* environment variable when one is set.
|
|
68
|
+
*
|
|
69
|
+
* Exported because the precedence rule is the part worth testing on its own: a
|
|
70
|
+
* caller cannot see which list won by watching a hook run.
|
|
71
|
+
*/
|
|
72
|
+
export function resolveToolHookDeclarations(cm, env = process.env) {
|
|
73
|
+
let configured = [];
|
|
74
|
+
try {
|
|
75
|
+
const raw = cm?.getAll?.()?.tools?.hooks;
|
|
76
|
+
if (Array.isArray(raw))
|
|
77
|
+
configured = raw;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// A config read that fails means no configured hooks — never a throw on the
|
|
81
|
+
// path that runs before every tool call.
|
|
82
|
+
configured = [];
|
|
83
|
+
}
|
|
84
|
+
const declarations = [];
|
|
85
|
+
for (const phase of TOOL_HOOK_PHASES) {
|
|
86
|
+
const fromEnv = env[TOOL_HOOK_ENV[phase]]?.trim();
|
|
87
|
+
if (fromEnv) {
|
|
88
|
+
// The environment WINS for its phase, and it is one command: an operator
|
|
89
|
+
// setting a variable is overriding, not appending — otherwise the effective
|
|
90
|
+
// list would depend on a merge order invisible from both sources.
|
|
91
|
+
declarations.push({ phase, command: fromEnv, label: `${TOOL_HOOK_ENV[phase]} (env)` });
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
for (const entry of configured) {
|
|
95
|
+
if (!entry || entry.phase !== phase)
|
|
96
|
+
continue;
|
|
97
|
+
const command = typeof entry.command === 'string' ? entry.command.trim() : '';
|
|
98
|
+
if (!command)
|
|
99
|
+
continue;
|
|
100
|
+
declarations.push({ ...entry, phase, command });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return declarations;
|
|
104
|
+
}
|
|
105
|
+
/** Does this declaration apply to this tool? Absent/empty `tools` = every tool. */
|
|
106
|
+
export function hookAppliesTo(decl, tool) {
|
|
107
|
+
if (!Array.isArray(decl.tools) || decl.tools.length === 0)
|
|
108
|
+
return true;
|
|
109
|
+
return decl.tools.some((name) => typeof name === 'string' && name.trim() === tool);
|
|
110
|
+
}
|
|
111
|
+
function runHookCommand(decl, payload, timeoutMs) {
|
|
112
|
+
return new Promise((resolve) => {
|
|
113
|
+
let settled = false;
|
|
114
|
+
const done = (run) => {
|
|
115
|
+
if (settled)
|
|
116
|
+
return;
|
|
117
|
+
settled = true;
|
|
118
|
+
resolve(run);
|
|
119
|
+
};
|
|
120
|
+
let child;
|
|
121
|
+
try {
|
|
122
|
+
child = spawn(decl.command, [], { shell: true, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
done({ stdout: '', code: null, timedOut: false, failure: err instanceof Error ? err.message : String(err) });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
let stdout = '';
|
|
129
|
+
let stderr = '';
|
|
130
|
+
let overflowed = false;
|
|
131
|
+
const timer = setTimeout(() => {
|
|
132
|
+
try {
|
|
133
|
+
child.kill('SIGKILL');
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
/* already gone */
|
|
137
|
+
}
|
|
138
|
+
// `timedOut` is the flag `runOneHook` reads; a null exit code alone would
|
|
139
|
+
// make a hung hook indistinguishable from one that printed nothing, and
|
|
140
|
+
// silence means ALLOW.
|
|
141
|
+
done({ stdout, code: null, timedOut: true });
|
|
142
|
+
}, timeoutMs);
|
|
143
|
+
timer.unref?.();
|
|
144
|
+
child.stdout?.on('data', (chunk) => {
|
|
145
|
+
if (stdout.length >= TOOL_HOOK_OUTPUT_LIMIT_CHARS) {
|
|
146
|
+
overflowed = true;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
stdout += chunk.toString('utf8').slice(0, TOOL_HOOK_OUTPUT_LIMIT_CHARS - stdout.length);
|
|
150
|
+
});
|
|
151
|
+
child.stderr?.on('data', (chunk) => {
|
|
152
|
+
if (stderr.length < 500)
|
|
153
|
+
stderr += chunk.toString('utf8').slice(0, 500);
|
|
154
|
+
});
|
|
155
|
+
child.on('error', (err) => {
|
|
156
|
+
clearTimeout(timer);
|
|
157
|
+
done({ stdout, code: null, timedOut: false, failure: err.message });
|
|
158
|
+
});
|
|
159
|
+
child.on('close', (code) => {
|
|
160
|
+
clearTimeout(timer);
|
|
161
|
+
// A hook that exits non-zero has not made a decision; only its stdout can
|
|
162
|
+
// veto, so a non-zero exit is a problem to report, not a refusal.
|
|
163
|
+
const failure = code === 0
|
|
164
|
+
? overflowed
|
|
165
|
+
? 'output exceeded the limit and was truncated'
|
|
166
|
+
: undefined
|
|
167
|
+
: `exited with code ${code}${stderr.trim() ? `: ${stderr.trim()}` : ''}`;
|
|
168
|
+
done({ stdout, code, timedOut: false, ...(failure ? { failure } : {}) });
|
|
169
|
+
});
|
|
170
|
+
try {
|
|
171
|
+
child.stdin?.on('error', () => {
|
|
172
|
+
/* the command closed stdin early — its exit code decides */
|
|
173
|
+
});
|
|
174
|
+
child.stdin?.end(JSON.stringify(payload));
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
clearTimeout(timer);
|
|
178
|
+
done({ stdout, code: null, timedOut: false, failure: err instanceof Error ? err.message : String(err) });
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Read a hook's decision out of its stdout.
|
|
184
|
+
*
|
|
185
|
+
* Empty output is ALLOW, not a problem: a hook that only records something has
|
|
186
|
+
* nothing to decide. Anything non-empty must be the documented object — a hook
|
|
187
|
+
* that prints prose has not made a decision, and guessing one from loose text is
|
|
188
|
+
* how an operator ends up with a veto they never asked for.
|
|
189
|
+
*/
|
|
190
|
+
export function parseToolHookDecision(stdout, by) {
|
|
191
|
+
const text = stdout.trim();
|
|
192
|
+
if (!text)
|
|
193
|
+
return { decision: null };
|
|
194
|
+
let parsed;
|
|
195
|
+
try {
|
|
196
|
+
parsed = JSON.parse(text);
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return { decision: null, problem: `printed output that is not JSON (${text.slice(0, 120)})` };
|
|
200
|
+
}
|
|
201
|
+
if (typeof parsed !== 'object' || parsed === null) {
|
|
202
|
+
return { decision: null, problem: 'printed JSON that is not an object' };
|
|
203
|
+
}
|
|
204
|
+
const record = parsed;
|
|
205
|
+
if (record.decision === 'allow')
|
|
206
|
+
return { decision: null };
|
|
207
|
+
if (record.decision === 'deny') {
|
|
208
|
+
return {
|
|
209
|
+
decision: {
|
|
210
|
+
deny: true,
|
|
211
|
+
...(typeof record.reason === 'string' && record.reason.trim() ? { reason: record.reason.trim() } : {}),
|
|
212
|
+
by,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
return { decision: null, problem: `printed a JSON object without a usable "decision" (${text.slice(0, 120)})` };
|
|
217
|
+
}
|
|
218
|
+
/** Run one declaration and interpret it. Never throws; failures come back as text. */
|
|
219
|
+
async function runOneHook(decl, payload) {
|
|
220
|
+
const label = labelOf(decl);
|
|
221
|
+
const timeoutMs = typeof decl.timeoutMs === 'number' && decl.timeoutMs > 0 ? decl.timeoutMs : TOOL_HOOK_TIMEOUT_MS;
|
|
222
|
+
const run = await runHookCommand(decl, payload, timeoutMs);
|
|
223
|
+
// The timeout is checked FIRST and on its own flag: a killed hook prints
|
|
224
|
+
// nothing, so without this branch it would be read as a hook that ran and said
|
|
225
|
+
// nothing — and silence means ALLOW.
|
|
226
|
+
if (run.timedOut) {
|
|
227
|
+
return { decision: null, problem: `hook '${label}' timed out after ${timeoutMs}ms` };
|
|
228
|
+
}
|
|
229
|
+
if (run.failure) {
|
|
230
|
+
return { decision: null, problem: `hook '${label}' ${run.failure}` };
|
|
231
|
+
}
|
|
232
|
+
return parseToolHookDecision(run.stdout, label);
|
|
233
|
+
}
|
|
234
|
+
// ─── Installation into the registry ─────────────────────────────────────────
|
|
235
|
+
/** The declaration signature currently installed, so a change re-installs. */
|
|
236
|
+
let installedSignature = null;
|
|
237
|
+
let installed = [];
|
|
238
|
+
/**
|
|
239
|
+
* Bind the declared hooks into the registry, if the declarations changed.
|
|
240
|
+
*
|
|
241
|
+
* Idempotent, and it REPLACES rather than accumulates: the registry is a
|
|
242
|
+
* singleton for the process, so a signature change has to unregister what the
|
|
243
|
+
* previous declarations installed — otherwise a hook that was removed from config
|
|
244
|
+
* would go on vetoing calls for the life of the process, and a test that turns a
|
|
245
|
+
* hook on could never turn it off.
|
|
246
|
+
*/
|
|
247
|
+
export function installDeclaredToolHooks(cm, env = process.env) {
|
|
248
|
+
const declarations = resolveToolHookDeclarations(cm, env);
|
|
249
|
+
const signature = JSON.stringify(declarations);
|
|
250
|
+
if (signature === installedSignature)
|
|
251
|
+
return declarations;
|
|
252
|
+
for (const entry of installed)
|
|
253
|
+
hooks.unregister(entry.event, entry.handler);
|
|
254
|
+
installed = [];
|
|
255
|
+
try {
|
|
256
|
+
const forPhase = (phase) => declarations.filter((decl) => decl.phase === phase);
|
|
257
|
+
const before = forPhase('before');
|
|
258
|
+
if (before.length > 0) {
|
|
259
|
+
const handler = async (ctx) => {
|
|
260
|
+
for (const decl of before) {
|
|
261
|
+
if (!hookAppliesTo(decl, ctx.tool))
|
|
262
|
+
continue;
|
|
263
|
+
const payload = buildPayload(decl, 'before', ctx);
|
|
264
|
+
const run = await runOneHook(decl, payload);
|
|
265
|
+
if (run.problem) {
|
|
266
|
+
ctx.report?.(`${run.problem} (the call was allowed — a broken hook never vetoes)`);
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (run.decision)
|
|
270
|
+
return run.decision;
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
};
|
|
274
|
+
hooks.register('before_tool_call', handler);
|
|
275
|
+
installed.push({ event: 'before_tool_call', handler: handler });
|
|
276
|
+
}
|
|
277
|
+
for (const [phase, event] of [
|
|
278
|
+
['after', 'after_tool_call'],
|
|
279
|
+
['failed', 'failed_tool_call'],
|
|
280
|
+
]) {
|
|
281
|
+
const list = forPhase(phase);
|
|
282
|
+
if (list.length === 0)
|
|
283
|
+
continue;
|
|
284
|
+
const handler = async (ctx) => {
|
|
285
|
+
for (const decl of list) {
|
|
286
|
+
if (!hookAppliesTo(decl, ctx.tool))
|
|
287
|
+
continue;
|
|
288
|
+
const run = await runOneHook(decl, buildPayload(decl, phase, ctx));
|
|
289
|
+
// These phases observe; a decision here is not honoured, and a problem
|
|
290
|
+
// is still worth saying out loud.
|
|
291
|
+
if (run.problem)
|
|
292
|
+
ctx.report?.(run.problem);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
hooks.register(event, handler);
|
|
296
|
+
installed.push({ event, handler: handler });
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
// Never let installation break the turn: with nothing installed, behaviour is
|
|
301
|
+
// exactly "no hooks declared".
|
|
302
|
+
}
|
|
303
|
+
installedSignature = signature;
|
|
304
|
+
return declarations;
|
|
305
|
+
}
|
|
306
|
+
/** The payload for one hook invocation, with the result bounded to a preview. */
|
|
307
|
+
function buildPayload(decl, phase, ctx) {
|
|
308
|
+
const result = typeof ctx.result === 'string' ? ctx.result : undefined;
|
|
309
|
+
const truncated = result !== undefined && result.length > TOOL_HOOK_RESULT_PREVIEW_CHARS;
|
|
310
|
+
return {
|
|
311
|
+
phase,
|
|
312
|
+
tool: ctx.tool,
|
|
313
|
+
...(ctx.args ? { arguments: ctx.args } : {}),
|
|
314
|
+
...(ctx.callId ? { callId: ctx.callId } : {}),
|
|
315
|
+
...(ctx.surface ? { surface: ctx.surface } : {}),
|
|
316
|
+
...(ctx.cwd ? { cwd: ctx.cwd } : {}),
|
|
317
|
+
hook: labelOf(decl),
|
|
318
|
+
...(phase === 'before'
|
|
319
|
+
? {}
|
|
320
|
+
: {
|
|
321
|
+
ok: ctx.ok === true,
|
|
322
|
+
...(result !== undefined
|
|
323
|
+
? {
|
|
324
|
+
result: truncated ? result.slice(0, TOOL_HOOK_RESULT_PREVIEW_CHARS) : result,
|
|
325
|
+
resultTruncated: truncated,
|
|
326
|
+
}
|
|
327
|
+
: {}),
|
|
328
|
+
...(ctx.error ? { error: ctx.error } : {}),
|
|
329
|
+
...(typeof ctx.durationMs === 'number' ? { durationMs: ctx.durationMs } : {}),
|
|
330
|
+
}),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Ask the `before` hooks whether this call may run.
|
|
335
|
+
*
|
|
336
|
+
* ALWAYS RESOLVES: a hook that cannot answer never blocks the call, and the reason
|
|
337
|
+
* it could not answer comes back in `problems` for the caller to report.
|
|
338
|
+
*/
|
|
339
|
+
export async function runBeforeToolHooks(req) {
|
|
340
|
+
const env = req.env ?? process.env;
|
|
341
|
+
const declarations = installDeclaredToolHooks(req.configManager, env);
|
|
342
|
+
if (!declarations.some((decl) => decl.phase === 'before' && hookAppliesTo(decl, req.tool))) {
|
|
343
|
+
return allow();
|
|
344
|
+
}
|
|
345
|
+
const problems = [];
|
|
346
|
+
let decision = null;
|
|
347
|
+
try {
|
|
348
|
+
decision = await hooks.runBefore({
|
|
349
|
+
tool: req.tool,
|
|
350
|
+
...(req.args ? { args: req.args } : {}),
|
|
351
|
+
...(req.callId ? { callId: req.callId } : {}),
|
|
352
|
+
...(req.surface ? { surface: req.surface } : {}),
|
|
353
|
+
...(req.cwd ? { cwd: req.cwd } : {}),
|
|
354
|
+
report: (message) => problems.push(message),
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
// runBefore is documented never to throw; if it ever does, the call proceeds.
|
|
359
|
+
return { denied: false, problems };
|
|
360
|
+
}
|
|
361
|
+
if (!decision)
|
|
362
|
+
return { denied: false, problems };
|
|
363
|
+
return {
|
|
364
|
+
denied: true,
|
|
365
|
+
...(decision.reason ? { reason: decision.reason } : {}),
|
|
366
|
+
...(decision.by ? { by: decision.by } : {}),
|
|
367
|
+
problems,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Tell the `after` / `failed` hooks what happened.
|
|
372
|
+
*
|
|
373
|
+
* One of the two fires, never both: a call either succeeded or it did not, and
|
|
374
|
+
* firing `failed` for a success would make a hook that counts failures wrong.
|
|
375
|
+
*/
|
|
376
|
+
export async function runToolOutcomeHooks(req) {
|
|
377
|
+
const env = req.env ?? process.env;
|
|
378
|
+
const phase = req.ok ? 'after' : 'failed';
|
|
379
|
+
const declarations = installDeclaredToolHooks(req.configManager, env);
|
|
380
|
+
if (!declarations.some((decl) => decl.phase === phase && hookAppliesTo(decl, req.tool))) {
|
|
381
|
+
return { problems: [] };
|
|
382
|
+
}
|
|
383
|
+
const problems = [];
|
|
384
|
+
const base = {
|
|
385
|
+
tool: req.tool,
|
|
386
|
+
...(req.args ? { args: req.args } : {}),
|
|
387
|
+
...(req.callId ? { callId: req.callId } : {}),
|
|
388
|
+
...(req.surface ? { surface: req.surface } : {}),
|
|
389
|
+
...(req.cwd ? { cwd: req.cwd } : {}),
|
|
390
|
+
ok: req.ok,
|
|
391
|
+
...(req.result !== undefined ? { result: req.result } : {}),
|
|
392
|
+
...(typeof req.durationMs === 'number' ? { durationMs: req.durationMs } : {}),
|
|
393
|
+
report: (message) => problems.push(message),
|
|
394
|
+
};
|
|
395
|
+
try {
|
|
396
|
+
if (phase === 'after') {
|
|
397
|
+
await hooks.run('after_tool_call', base);
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
// `error` is required on this phase: a hook that is told a call failed is
|
|
401
|
+
// owed a reason, and a tool that failed without saying why still has its
|
|
402
|
+
// result text (or the plainest possible sentence) rather than a blank.
|
|
403
|
+
await hooks.run('failed_tool_call', {
|
|
404
|
+
...base,
|
|
405
|
+
error: req.error ?? req.result ?? 'the call did not succeed and said nothing about why',
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
catch {
|
|
410
|
+
/* observe-only: a report is a courtesy, never a failure */
|
|
411
|
+
}
|
|
412
|
+
return { problems };
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* The refusal text a vetoed call is fed back as.
|
|
416
|
+
*
|
|
417
|
+
* Shaped like the loop's other refusals (the `Error:` prefix is how a tool
|
|
418
|
+
* result is recognised as a failure everywhere in this codebase), so a veto is
|
|
419
|
+
* accounted as a failed call rather than as work that silently did not happen.
|
|
420
|
+
*/
|
|
421
|
+
export function toolHookRefusalText(verdict) {
|
|
422
|
+
const by = verdict.by ? ` (${verdict.by})` : '';
|
|
423
|
+
return verdict.reason
|
|
424
|
+
? `Error: refused by a tool hook${by}: ${verdict.reason}`
|
|
425
|
+
: `Error: refused by a tool hook${by}.`;
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=tool-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-hooks.js","sourceRoot":"","sources":["../../src/tools/tool-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,EAAE,KAAK,EAAqB,MAAM,qBAAqB,CAAC;AAE/D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAGvE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,aAAa,GAAkC;IAC1D,MAAM,EAAE,yBAAyB;IACjC,KAAK,EAAE,wBAAwB;IAC/B,MAA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MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7E,MAAM,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;KACpD,CAAC;IACF,IAAI,CAAC;QACH,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YACtB,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,0EAA0E;YAC1E,yEAAyE;YACzE,uEAAuE;YACvE,MAAM,KAAK,CAAC,GAAG,CAAC,kBAAkB,EAAE;gBAClC,GAAG,IAAI;gBACP,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,qDAAqD;aACxF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,2DAA2D;IAC7D,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAwB;IAC1D,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,MAAM;QACnB,CAAC,CAAC,gCAAgC,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE;QACzD,CAAC,CAAC,gCAAgC,EAAE,GAAG,CAAC;AAC5C,CAAC"}
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* blocks after its response text (contract in TOOL_CONTRACT_JSON).
|
|
17
17
|
*/
|
|
18
18
|
import { type ToolContext, type ToolJsonSchema } from './registry.js';
|
|
19
|
+
import { type SpanHandle } from '../observability/otel.js';
|
|
20
|
+
import { type StepReplay } from '../learning/step-checkpoint.js';
|
|
19
21
|
import { RunTrace, type RunTraceSnapshot } from '../learning/run-trace.js';
|
|
20
22
|
import { type FollowupSuggestion } from './followup-utils.js';
|
|
21
23
|
import { type ToolCallEvidence } from './edit-verification.js';
|
|
@@ -31,6 +33,7 @@ import type { TraceEvent, TraceGateName } from '../learning/reasoning-trace.js';
|
|
|
31
33
|
*/
|
|
32
34
|
export type LoopTraceEvent = Omit<TraceEvent, 'seq' | 'timestamp'>;
|
|
33
35
|
import type { ToolMessage } from '../inference/interface.js';
|
|
36
|
+
import type { ServedRoute } from '../inference/route-resolver.js';
|
|
34
37
|
export { type ToolMessage };
|
|
35
38
|
/**
|
|
36
39
|
* The P3c fallback hint for a failed tool call — appended to the error text
|
|
@@ -61,6 +64,24 @@ export interface StepResponse {
|
|
|
61
64
|
/** Provider-owned opaque data echoed back on replay (Gemini thoughtSignature). */
|
|
62
65
|
providerMeta?: Record<string, unknown>;
|
|
63
66
|
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Which transport ACTUALLY carried this step's tool calls, in the same
|
|
69
|
+
* vocabulary the subagent child announces
|
|
70
|
+
* (`src/tools/child-agent-runtime.ts`):
|
|
71
|
+
*
|
|
72
|
+
* - `native` — the provider's own tool-calling API served the step.
|
|
73
|
+
* - `json` — the shared JSON-fallback transport served it (the provider
|
|
74
|
+
* could not do native tool calling, or is known not to).
|
|
75
|
+
* - `none` — no tool schema was offered, so no tool transport was
|
|
76
|
+
* involved at all.
|
|
77
|
+
*
|
|
78
|
+
* The CALLER sets it, because only the caller knows which branch of its own
|
|
79
|
+
* model-call seam ran (the loop above it just relays). Absent means "this
|
|
80
|
+
* caller does not report a transport" — deliberately not the same fact as
|
|
81
|
+
* `none`, and the reason a comparison treats a missing value as a missing
|
|
82
|
+
* value rather than as silence that equals agreement.
|
|
83
|
+
*/
|
|
84
|
+
transport?: 'native' | 'json' | 'none';
|
|
64
85
|
}
|
|
65
86
|
/** What the caller injects — chat.ts wires providers/failover, tests use mocks. */
|
|
66
87
|
export interface ToolLoopDeps {
|
|
@@ -76,6 +97,12 @@ export interface ToolLoopDeps {
|
|
|
76
97
|
* support simply ignores it and returns the whole step at once.
|
|
77
98
|
* Optional `signal`: forwarded from ToolLoopOptions so an in-flight
|
|
78
99
|
* provider request can abort (the dashboard Cancel button).
|
|
100
|
+
*
|
|
101
|
+
* R2 — the caller should set {@link StepResponse.transport} on every step it
|
|
102
|
+
* returns: it is the only party that knows whether its own seam spoke the
|
|
103
|
+
* provider's native tool protocol or the shared JSON fallback. The loop
|
|
104
|
+
* relays the last value it saw to `ToolLoopResult.transport`, which is how a
|
|
105
|
+
* surface that is NOT the subagent child can still be attributed a transport.
|
|
79
106
|
*/
|
|
80
107
|
callModel(messages: ToolMessage[], toolSchemas: ToolJsonSchema[], onToken?: (token: string) => void, signal?: AbortSignal): Promise<StepResponse>;
|
|
81
108
|
/** Execute one tool call. Returns the tool-result text fed back to the model. */
|
|
@@ -99,6 +126,39 @@ export interface ToolLoopOptions {
|
|
|
99
126
|
* callers opt in (chat reads `tools.loopExposure` from config).
|
|
100
127
|
*/
|
|
101
128
|
toolExposure?: 'all' | 'tiered';
|
|
129
|
+
/**
|
|
130
|
+
* WS3 (#25) — the turn's span, when span export is on (else null/absent).
|
|
131
|
+
*
|
|
132
|
+
* Tool calls become child spans under it and each one is made ACTIVE while the
|
|
133
|
+
* tool runs, so a tool that forks a subagent can hand that child the right
|
|
134
|
+
* trace parent (`childTraceEnv` reads the active context, not module state).
|
|
135
|
+
*
|
|
136
|
+
* The name is built HERE rather than at each surface, so every surface's tree
|
|
137
|
+
* has the same shape — which is the only reason a tree can be compared across
|
|
138
|
+
* surfaces at all.
|
|
139
|
+
*/
|
|
140
|
+
otel?: SpanHandle | null;
|
|
141
|
+
/**
|
|
142
|
+
* WS5 (#27) — the resume ledger for this run, or null when it is a fresh run.
|
|
143
|
+
*
|
|
144
|
+
* With one supplied, a model call whose EXACT input (thread + tool schema)
|
|
145
|
+
* matches a recorded step is replayed from the record instead of being made
|
|
146
|
+
* again, and every call that is still made is recorded so the next resume can
|
|
147
|
+
* replay it. Omitted entirely on an ordinary run: the ledger is then never
|
|
148
|
+
* consulted, never built, and the turn behaves exactly as it did before.
|
|
149
|
+
*/
|
|
150
|
+
resume?: StepReplay | null;
|
|
151
|
+
/**
|
|
152
|
+
* WS4 (#26) — the surface label this loop is running as (`cli-chat`,
|
|
153
|
+
* `cli-execute`, `dashboard-chat`, `gateway-chat`, `subagent`).
|
|
154
|
+
*
|
|
155
|
+
* Passed on to a tool hook, so an operator's hook can tell WHERE a call came
|
|
156
|
+
* from — which is the difference between a policy that can be written and one
|
|
157
|
+
* that has to be guessed at. It is the same label the debug log header and the
|
|
158
|
+
* turn span carry; the loop is the only place that knows it, so a surface that
|
|
159
|
+
* does not pass it simply reports its calls with no surface name.
|
|
160
|
+
*/
|
|
161
|
+
surface?: string;
|
|
102
162
|
/**
|
|
103
163
|
* R1 — bound on concurrent read-only calls per step, from the model's harness
|
|
104
164
|
* profile. Omit for the default (4); pass 1 for tiny models.
|
|
@@ -172,6 +232,17 @@ export interface ToolLoopOptions {
|
|
|
172
232
|
/** ToolContext for executions (configManager, followups sink, board, ...). */
|
|
173
233
|
context: ToolContext;
|
|
174
234
|
deps: ToolLoopDeps;
|
|
235
|
+
/**
|
|
236
|
+
* The route that is ACTUALLY serving this turn, read before every model call.
|
|
237
|
+
*
|
|
238
|
+
* The loop re-reads it each step so a mid-turn failover cannot leave the model
|
|
239
|
+
* believing it is still the model it started on — the cheap alternative (state
|
|
240
|
+
* the route once, in the system prompt) is a fact that decays. Returning `null`
|
|
241
|
+
* injects nothing: a caller that does not know the route must not be "helped"
|
|
242
|
+
* by a guess. See `src/tools/loop-route-feed.ts` for why the model is told at
|
|
243
|
+
* all.
|
|
244
|
+
*/
|
|
245
|
+
servedRoute?: () => ServedRoute | null;
|
|
175
246
|
/**
|
|
176
247
|
* P4 — stream content tokens as the model generates them (typewriter for
|
|
177
248
|
* the dashboard's final answer). Passed to every callModel; providers that
|
|
@@ -232,6 +303,11 @@ export interface ToolLoopResult {
|
|
|
232
303
|
* (rules act only when the model is unavailable, never as a bypass).
|
|
233
304
|
*/
|
|
234
305
|
generationFailed?: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* WS5 (#27) — model calls this turn did NOT make because a recorded step with
|
|
308
|
+
* the SAME input was replayed. Omitted on a run with no resume ledger.
|
|
309
|
+
*/
|
|
310
|
+
replayedSteps?: number;
|
|
235
311
|
/**
|
|
236
312
|
* P4 — true when the turn was cancelled via ToolLoopOptions.signal (the
|
|
237
313
|
* dashboard's Cancel button). The caller DISCARDS the turn: no cache write,
|
|
@@ -293,6 +369,17 @@ export interface ToolLoopResult {
|
|
|
293
369
|
* trace flags it.
|
|
294
370
|
*/
|
|
295
371
|
unverifiedEditClaim?: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* R2 — which transport carried this turn's tool calls (`native` / `json` /
|
|
374
|
+
* `none`), as reported by the caller's own model-call seam. Absent when the
|
|
375
|
+
* caller reports none (an in-process mock, or a surface that has not been
|
|
376
|
+
* taught yet), which is why absence is not compared as equal to `none`.
|
|
377
|
+
*
|
|
378
|
+
* Recorded on EVERY exit path via the shared progress object, so a bounded
|
|
379
|
+
* turn, a cancelled one and a clean end all say the same thing about how the
|
|
380
|
+
* work travelled — the fact a run-attribution claim is made of.
|
|
381
|
+
*/
|
|
382
|
+
transport?: 'native' | 'json' | 'none';
|
|
296
383
|
}
|
|
297
384
|
/** An orphan reasoning block or bare <think> is a think-only response. */
|
|
298
385
|
export declare function isThinkOnlyResponse(content: string): boolean;
|
|
@@ -384,6 +471,13 @@ export interface ToolLoopProgress {
|
|
|
384
471
|
* dashboard) reads the same counting instead of re-deriving it.
|
|
385
472
|
*/
|
|
386
473
|
runTrace?: RunTrace;
|
|
474
|
+
/**
|
|
475
|
+
* R2 — the tool transport that served this turn, as reported by the caller's
|
|
476
|
+
* `callModel` on each step. Last write wins, deliberately: a turn that began
|
|
477
|
+
* on native tool calling and finished over the JSON fallback IS a JSON turn,
|
|
478
|
+
* because that is how its answer was finally produced.
|
|
479
|
+
*/
|
|
480
|
+
transport?: 'native' | 'json' | 'none';
|
|
387
481
|
}
|
|
388
482
|
/**
|
|
389
483
|
* True when the answer asserts a delivery that no delivery tool performed.
|
|
@@ -413,11 +507,6 @@ export declare function detectUnverifiedDeliveryClaim(content: string, toolsRun:
|
|
|
413
507
|
* summarise) are excluded.
|
|
414
508
|
*/
|
|
415
509
|
export declare function detectUnfulfilledIntentPromise(content: string): boolean;
|
|
416
|
-
/**
|
|
417
|
-
* Public entry point. Runs the loop, then annotates the result with the
|
|
418
|
-
* honest-answer flags so every surface (CLI, dashboard, gateway, trace) can
|
|
419
|
-
* distinguish "generated a reply" from "actually performed the action".
|
|
420
|
-
*/
|
|
421
510
|
export declare function runToolLoop(opts: ToolLoopOptions): Promise<ToolLoopResult>;
|
|
422
511
|
/**
|
|
423
512
|
* Classify a DECLINED call's result text (G18).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-loop.d.ts","sourceRoot":"","sources":["../../src/tools/tool-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAA4B,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-loop.d.ts","sourceRoot":"","sources":["../../src/tools/tool-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAA4B,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAGhG,OAAO,EAAoC,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAW7F,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAoB7E,OAAO,EAKL,QAAQ,EACR,KAAK,gBAAgB,E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