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,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WS1 (#23) — a finding, its verdict, and the gate that keeps the two honest.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. This repository has already paid for the bug this closes: a
|
|
5
|
+
* claim that was true-looking and unverified reached a user as fact. The tool
|
|
6
|
+
* descriptions reported success for work that had not happened
|
|
7
|
+
* (`docs/TOOL_TRUTHFULNESS_TRACKER.md`), the dashboard shipped a bundle that did
|
|
8
|
+
* not contain a tab that had been written and reviewed, and a WhatsApp task
|
|
9
|
+
* reported completion while the deliverable was never authored
|
|
10
|
+
* (`docs/rca_false_success_and_no_resume.md`). Every one of those is the same
|
|
11
|
+
* defect in a different costume: something was ASSERTED, nothing was CHECKED,
|
|
12
|
+
* and the assertion travelled as if it had been.
|
|
13
|
+
*
|
|
14
|
+
* The codebase already knows the right shape for this and uses it in one place.
|
|
15
|
+
* `src/nlu/learnings.ts` documents that "a learning is written ONLY when a
|
|
16
|
+
* misreading has been CONFIRMED by the model", and `src/nlu/intent-confirm.ts`
|
|
17
|
+
* is the probe that produces that confirmation. But the confirmation it produced
|
|
18
|
+
* was the model saying so — an assertion about an assertion, with no evidence
|
|
19
|
+
* attached. That is the gap: a verdict two-valued enough to be checked, and an
|
|
20
|
+
* evidence requirement strong enough that "CONFIRMED" cannot be typed in.
|
|
21
|
+
*
|
|
22
|
+
* THE MODEL. A finding is a CLAIM plus a VERDICT plus an OUTCOME plus EVIDENCE:
|
|
23
|
+
*
|
|
24
|
+
* claim — what is being asserted, in the words the reader will see.
|
|
25
|
+
* verdict — CONFIRMED (something was produced that a second party could
|
|
26
|
+
* check) or PLAUSIBLE (a reasoned guess). Binary on purpose: a
|
|
27
|
+
* 0.7 confidence invites arithmetic on a number nobody calibrated,
|
|
28
|
+
* and the interesting question is only ever "can this be checked".
|
|
29
|
+
* outcome — what became of it (kept, corrected, dropped, not persisted). A
|
|
30
|
+
* finding with no outcome is a status report, not a finding.
|
|
31
|
+
* evidence — the concrete things that were checked: a verbatim line, a command
|
|
32
|
+
* and its real output, a path. Never a restatement of the claim.
|
|
33
|
+
*
|
|
34
|
+
* THE GATE, and why it is enforced in code rather than by convention. A rule
|
|
35
|
+
* that lives in a comment is a rule the next contributor is free to be
|
|
36
|
+
* enthusiastic about. `confirmFinding` refuses a promotion with no usable
|
|
37
|
+
* evidence and returns the finding STILL PLAUSIBLE with the reason attached —
|
|
38
|
+
* a refusal, not a throw, because "we could not verify this" is a normal outcome
|
|
39
|
+
* of a probe and must not take down the turn that asked. `enforceVerdicts` then
|
|
40
|
+
* applies the same rule to a whole batch on the way OUT, so no code path —
|
|
41
|
+
* including one written later by someone who never read this file — can emit a
|
|
42
|
+
* CONFIRMED finding that carries nothing.
|
|
43
|
+
*
|
|
44
|
+
* TWO DELIBERATE LIMITS.
|
|
45
|
+
* 1. This module does not decide what a finding MEANS or who may produce one.
|
|
46
|
+
* It is the vocabulary and the gate, so every surface can report the same
|
|
47
|
+
* shape and a reader can compare them (that is the parity requirement WS0
|
|
48
|
+
* exists to measure).
|
|
49
|
+
* 2. It never invents evidence, and never treats its absence as failure of the
|
|
50
|
+
* finding: a PLAUSIBLE finding is a legitimate, useful, honest object. The
|
|
51
|
+
* only thing this module refuses is the promotion.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* What a finding is worth, in the only two amounts that matter.
|
|
55
|
+
*
|
|
56
|
+
* - `CONFIRMED` — something was produced that a second party could check.
|
|
57
|
+
* - `PLAUSIBLE` — reasoned, not verified. The default, and never a failure.
|
|
58
|
+
*/
|
|
59
|
+
export type Verdict = 'CONFIRMED' | 'PLAUSIBLE';
|
|
60
|
+
/**
|
|
61
|
+
* The kinds of check that can produce evidence.
|
|
62
|
+
*
|
|
63
|
+
* `quote` is a verbatim span of the input (the part of a request a reading
|
|
64
|
+
* depends on); `command` is a command line and its REAL output; `file` is a path
|
|
65
|
+
* that was read; `observation` is a value a probe actually returned. Kept as a
|
|
66
|
+
* closed set so a reader can tell how strong a piece of evidence is without
|
|
67
|
+
* parsing prose — and so `describeFinding` can render it uniformly.
|
|
68
|
+
*/
|
|
69
|
+
export type EvidenceKind = 'quote' | 'command' | 'file' | 'observation';
|
|
70
|
+
/**
|
|
71
|
+
* One check that was actually performed.
|
|
72
|
+
*
|
|
73
|
+
* `ref` is the evidence itself — the line, the command, the path — never a
|
|
74
|
+
* summary of it. A blank `ref` is not evidence: it is the type satisfied and the
|
|
75
|
+
* work skipped, which is precisely the defect this module exists to refuse.
|
|
76
|
+
*/
|
|
77
|
+
export interface Evidence {
|
|
78
|
+
kind: EvidenceKind;
|
|
79
|
+
ref: string;
|
|
80
|
+
/** Optional context: the output, the surrounding line, the reason. */
|
|
81
|
+
detail?: string;
|
|
82
|
+
}
|
|
83
|
+
/** A claim, its verdict, what became of it, and what was checked. */
|
|
84
|
+
export interface Finding {
|
|
85
|
+
/** What is asserted, in the words the reader will see. */
|
|
86
|
+
claim: string;
|
|
87
|
+
verdict: Verdict;
|
|
88
|
+
/** What became of the finding. Required: a finding with no outcome is a status report. */
|
|
89
|
+
outcome: string;
|
|
90
|
+
/** The checks behind a CONFIRMED verdict. Empty is legal — for a PLAUSIBLE one. */
|
|
91
|
+
evidence: readonly Evidence[];
|
|
92
|
+
/** Where the finding came from, so a reader can weigh it (`intent-confirm`, `review`, …). */
|
|
93
|
+
source: string;
|
|
94
|
+
/** When it was recorded. Volatile: never part of a comparison between surfaces. */
|
|
95
|
+
at?: number;
|
|
96
|
+
}
|
|
97
|
+
/** The result of asking for a promotion, including the refusal. */
|
|
98
|
+
export interface Promotion {
|
|
99
|
+
/** The finding AFTER the attempt — PLAUSIBLE and unchanged when refused. */
|
|
100
|
+
finding: Finding;
|
|
101
|
+
promoted: boolean;
|
|
102
|
+
/** Why it was refused. Present exactly when `promoted` is false. */
|
|
103
|
+
reason?: string;
|
|
104
|
+
}
|
|
105
|
+
/** What `plausibleFinding` needs. Everything else has a defensible default. */
|
|
106
|
+
export interface FindingInput {
|
|
107
|
+
claim: string;
|
|
108
|
+
outcome: string;
|
|
109
|
+
source: string;
|
|
110
|
+
evidence?: readonly Evidence[];
|
|
111
|
+
at?: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* True when this finding carries anything that was actually checked.
|
|
115
|
+
*
|
|
116
|
+
* Exported because the question "is this checkable" is asked in more places than
|
|
117
|
+
* the gate: a report renderer may want to group a batch by it, and a caller
|
|
118
|
+
* deciding whether to spend a model call on verification wants it before, not
|
|
119
|
+
* after.
|
|
120
|
+
*/
|
|
121
|
+
export declare function hasEvidence(finding: Finding): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* The usable evidence on a finding, in order.
|
|
124
|
+
*
|
|
125
|
+
* A finding is normalised on the way in, so this is not a filter a caller must
|
|
126
|
+
* remember to apply — it exists so a renderer can show the evidence and never
|
|
127
|
+
* the blanks.
|
|
128
|
+
*/
|
|
129
|
+
export declare function evidenceOf(finding: Finding): Evidence[];
|
|
130
|
+
/**
|
|
131
|
+
* Record a claim that has NOT been checked.
|
|
132
|
+
*
|
|
133
|
+
* Deliberately the constructor: a finding cannot be BORN confirmed. Evidence can
|
|
134
|
+
* only arrive through `confirmFinding`, so the gate cannot be bypassed by a
|
|
135
|
+
* caller that helpfully knew the answer all along — the only way to a CONFIRMED
|
|
136
|
+
* verdict is the function that requires the evidence.
|
|
137
|
+
*
|
|
138
|
+
* Evidence passed here is KEPT (a caller that did check something should not lose
|
|
139
|
+
* it) but does not by itself promote the verdict; promotion is a separate,
|
|
140
|
+
* explicit act. That keeps "what we know" and "what we decided" from collapsing
|
|
141
|
+
* into one step that no one can audit.
|
|
142
|
+
*/
|
|
143
|
+
export declare function plausibleFinding(input: FindingInput): Finding;
|
|
144
|
+
/**
|
|
145
|
+
* Promote a PLAUSIBLE finding to CONFIRMED — or refuse, and say why.
|
|
146
|
+
*
|
|
147
|
+
* The refusal is the point of the module. It returns the finding UNCHANGED and
|
|
148
|
+
* PLAUSIBLE rather than throwing, because "we could not check this" is the
|
|
149
|
+
* ordinary outcome of a probe against a world that may be offline, and a probe
|
|
150
|
+
* must never be able to take down the turn that asked it. Callers that need to
|
|
151
|
+
* branch on the answer read `promoted`.
|
|
152
|
+
*
|
|
153
|
+
* A CONFIRMED finding cannot be promoted again (nothing to do), and a CONFIRMED
|
|
154
|
+
* finding whose evidence is IMPOSSIBLE cannot exist: `enforceVerdicts` demotes
|
|
155
|
+
* it. Both cases are reported rather than silently accepted.
|
|
156
|
+
*/
|
|
157
|
+
export declare function confirmFinding(finding: Finding, evidence?: readonly Evidence[], options?: {
|
|
158
|
+
outcome?: string;
|
|
159
|
+
at?: number;
|
|
160
|
+
}): Promotion;
|
|
161
|
+
/** Force a finding back to PLAUSIBLE, keeping why. The inverse of a promotion. */
|
|
162
|
+
export declare function demoteFinding(finding: Finding, why: string): Finding;
|
|
163
|
+
/**
|
|
164
|
+
* The gate applied to a batch, on the way out.
|
|
165
|
+
*
|
|
166
|
+
* This is what makes the rule unfalsifiable-by-accident: ANY batch of findings
|
|
167
|
+
* about to be reported, logged or persisted can be passed through here, and a
|
|
168
|
+
* CONFIRMED verdict that carries nothing is demoted with the reason recorded in
|
|
169
|
+
* its own outcome. `confirmFinding` protects the direct path; this protects the
|
|
170
|
+
* paths nobody has written yet, including a finding assembled by hand in a
|
|
171
|
+
* module that never imported `confirmFinding`.
|
|
172
|
+
*
|
|
173
|
+
* Returns the repaired findings AND the claims that were demoted, because a
|
|
174
|
+
* silent repair would hide the wiring bug that produced the claim — the demotion
|
|
175
|
+
* is correct behaviour, and its CAUSE is still something a caller should see.
|
|
176
|
+
*/
|
|
177
|
+
export declare function enforceVerdicts(findings: readonly Finding[], why?: string): {
|
|
178
|
+
findings: Finding[];
|
|
179
|
+
demoted: string[];
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Claims carrying a CONFIRMED verdict and no usable evidence.
|
|
183
|
+
*
|
|
184
|
+
* The assertion form of `enforceVerdicts`, for a caller that would rather fail
|
|
185
|
+
* than repair — a test, or a check that is about the producing code rather than
|
|
186
|
+
* the report.
|
|
187
|
+
*/
|
|
188
|
+
export declare function unsupportedConfirmations(findings: readonly Finding[]): string[];
|
|
189
|
+
/**
|
|
190
|
+
* The wire form: plain JSON a surface can log, return over IPC or write to a
|
|
191
|
+
* report.
|
|
192
|
+
*
|
|
193
|
+
* Present so the five surfaces report a finding IDENTICALLY (the WS0 requirement)
|
|
194
|
+
* rather than each inventing a shape — a gateway log line and a child's IPC frame
|
|
195
|
+
* that disagree about a verdict are a parity failure nobody would notice until a
|
|
196
|
+
* user compared two outputs. `at` is deliberately excluded: it differs on every
|
|
197
|
+
* invocation, so comparing it would fail for surfaces that behave identically,
|
|
198
|
+
* the same reason `observation.ts` keeps timing out of the compared projection.
|
|
199
|
+
*/
|
|
200
|
+
export interface WireFinding {
|
|
201
|
+
claim: string;
|
|
202
|
+
verdict: Verdict;
|
|
203
|
+
outcome: string;
|
|
204
|
+
evidence: Array<{
|
|
205
|
+
kind: EvidenceKind;
|
|
206
|
+
ref: string;
|
|
207
|
+
detail?: string;
|
|
208
|
+
}>;
|
|
209
|
+
source: string;
|
|
210
|
+
}
|
|
211
|
+
/** One finding, reduced to the comparable wire form. */
|
|
212
|
+
export declare function toWire(finding: Finding): WireFinding;
|
|
213
|
+
/**
|
|
214
|
+
* Read a finding back off the wire, defensively.
|
|
215
|
+
*
|
|
216
|
+
* Returns `undefined` for anything malformed rather than guessing, and — the
|
|
217
|
+
* part that matters — a payload claiming CONFIRMED with no usable evidence comes
|
|
218
|
+
* back PLAUSIBLE. A reader on the other side of an IPC boundary or a log file
|
|
219
|
+
* cannot trust the producer, so the gate is re-applied on the way in rather than
|
|
220
|
+
* assumed to have been applied on the way out.
|
|
221
|
+
*/
|
|
222
|
+
export declare function fromWire(value: unknown): Finding | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* One line a person reads, used everywhere so two surfaces cannot render the
|
|
225
|
+
* same finding two ways.
|
|
226
|
+
*
|
|
227
|
+
* The evidence is shown for a CONFIRMED verdict and the reason for a PLAUSIBLE
|
|
228
|
+
* one, because those are the two things a reader needs to decide whether to
|
|
229
|
+
* trust the line — and printing a confidence number neither of them can act on
|
|
230
|
+
* is how a report starts lying politely.
|
|
231
|
+
*/
|
|
232
|
+
export declare function describeFinding(finding: Finding): string;
|
|
233
|
+
/**
|
|
234
|
+
* A batch, summarised: how many are confirmed, and how many are still guesses.
|
|
235
|
+
*
|
|
236
|
+
* Exists so a caller cannot report a total without also having to look at the
|
|
237
|
+
* split. "12 findings" reads as twelve facts; "12 findings (3 confirmed, 9
|
|
238
|
+
* plausible)" cannot.
|
|
239
|
+
*/
|
|
240
|
+
export declare function summarizeVerdicts(findings: readonly Finding[]): string;
|
|
241
|
+
//# sourceMappingURL=verdicts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdicts.d.ts","sourceRoot":"","sources":["../../src/findings/verdicts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,aAAa,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,sEAA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X;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAIpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,GAAG,SAAqC,GACvC;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAQ5C;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,EAAE,CAI/E;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wDAAwD;AACxD,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAYpD;AAID;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAiC5D;AAUD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAOxD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAItE"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WS1 (#23) — a finding, its verdict, and the gate that keeps the two honest.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. This repository has already paid for the bug this closes: a
|
|
5
|
+
* claim that was true-looking and unverified reached a user as fact. The tool
|
|
6
|
+
* descriptions reported success for work that had not happened
|
|
7
|
+
* (`docs/TOOL_TRUTHFULNESS_TRACKER.md`), the dashboard shipped a bundle that did
|
|
8
|
+
* not contain a tab that had been written and reviewed, and a WhatsApp task
|
|
9
|
+
* reported completion while the deliverable was never authored
|
|
10
|
+
* (`docs/rca_false_success_and_no_resume.md`). Every one of those is the same
|
|
11
|
+
* defect in a different costume: something was ASSERTED, nothing was CHECKED,
|
|
12
|
+
* and the assertion travelled as if it had been.
|
|
13
|
+
*
|
|
14
|
+
* The codebase already knows the right shape for this and uses it in one place.
|
|
15
|
+
* `src/nlu/learnings.ts` documents that "a learning is written ONLY when a
|
|
16
|
+
* misreading has been CONFIRMED by the model", and `src/nlu/intent-confirm.ts`
|
|
17
|
+
* is the probe that produces that confirmation. But the confirmation it produced
|
|
18
|
+
* was the model saying so — an assertion about an assertion, with no evidence
|
|
19
|
+
* attached. That is the gap: a verdict two-valued enough to be checked, and an
|
|
20
|
+
* evidence requirement strong enough that "CONFIRMED" cannot be typed in.
|
|
21
|
+
*
|
|
22
|
+
* THE MODEL. A finding is a CLAIM plus a VERDICT plus an OUTCOME plus EVIDENCE:
|
|
23
|
+
*
|
|
24
|
+
* claim — what is being asserted, in the words the reader will see.
|
|
25
|
+
* verdict — CONFIRMED (something was produced that a second party could
|
|
26
|
+
* check) or PLAUSIBLE (a reasoned guess). Binary on purpose: a
|
|
27
|
+
* 0.7 confidence invites arithmetic on a number nobody calibrated,
|
|
28
|
+
* and the interesting question is only ever "can this be checked".
|
|
29
|
+
* outcome — what became of it (kept, corrected, dropped, not persisted). A
|
|
30
|
+
* finding with no outcome is a status report, not a finding.
|
|
31
|
+
* evidence — the concrete things that were checked: a verbatim line, a command
|
|
32
|
+
* and its real output, a path. Never a restatement of the claim.
|
|
33
|
+
*
|
|
34
|
+
* THE GATE, and why it is enforced in code rather than by convention. A rule
|
|
35
|
+
* that lives in a comment is a rule the next contributor is free to be
|
|
36
|
+
* enthusiastic about. `confirmFinding` refuses a promotion with no usable
|
|
37
|
+
* evidence and returns the finding STILL PLAUSIBLE with the reason attached —
|
|
38
|
+
* a refusal, not a throw, because "we could not verify this" is a normal outcome
|
|
39
|
+
* of a probe and must not take down the turn that asked. `enforceVerdicts` then
|
|
40
|
+
* applies the same rule to a whole batch on the way OUT, so no code path —
|
|
41
|
+
* including one written later by someone who never read this file — can emit a
|
|
42
|
+
* CONFIRMED finding that carries nothing.
|
|
43
|
+
*
|
|
44
|
+
* TWO DELIBERATE LIMITS.
|
|
45
|
+
* 1. This module does not decide what a finding MEANS or who may produce one.
|
|
46
|
+
* It is the vocabulary and the gate, so every surface can report the same
|
|
47
|
+
* shape and a reader can compare them (that is the parity requirement WS0
|
|
48
|
+
* exists to measure).
|
|
49
|
+
* 2. It never invents evidence, and never treats its absence as failure of the
|
|
50
|
+
* finding: a PLAUSIBLE finding is a legitimate, useful, honest object. The
|
|
51
|
+
* only thing this module refuses is the promotion.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* A usable piece of evidence: a non-blank `ref`.
|
|
55
|
+
*
|
|
56
|
+
* Whitespace-only is rejected rather than trimmed to "": a caller that passed
|
|
57
|
+
* `' '` passed nothing, and accepting it would make the gate trivially avoidable.
|
|
58
|
+
*/
|
|
59
|
+
function isUsable(evidence) {
|
|
60
|
+
return Boolean(evidence) && typeof evidence.ref === 'string' && evidence.ref.trim().length > 0;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* True when this finding carries anything that was actually checked.
|
|
64
|
+
*
|
|
65
|
+
* Exported because the question "is this checkable" is asked in more places than
|
|
66
|
+
* the gate: a report renderer may want to group a batch by it, and a caller
|
|
67
|
+
* deciding whether to spend a model call on verification wants it before, not
|
|
68
|
+
* after.
|
|
69
|
+
*/
|
|
70
|
+
export function hasEvidence(finding) {
|
|
71
|
+
return finding.evidence.some(isUsable);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The usable evidence on a finding, in order.
|
|
75
|
+
*
|
|
76
|
+
* A finding is normalised on the way in, so this is not a filter a caller must
|
|
77
|
+
* remember to apply — it exists so a renderer can show the evidence and never
|
|
78
|
+
* the blanks.
|
|
79
|
+
*/
|
|
80
|
+
export function evidenceOf(finding) {
|
|
81
|
+
return finding.evidence.filter(isUsable);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Record a claim that has NOT been checked.
|
|
85
|
+
*
|
|
86
|
+
* Deliberately the constructor: a finding cannot be BORN confirmed. Evidence can
|
|
87
|
+
* only arrive through `confirmFinding`, so the gate cannot be bypassed by a
|
|
88
|
+
* caller that helpfully knew the answer all along — the only way to a CONFIRMED
|
|
89
|
+
* verdict is the function that requires the evidence.
|
|
90
|
+
*
|
|
91
|
+
* Evidence passed here is KEPT (a caller that did check something should not lose
|
|
92
|
+
* it) but does not by itself promote the verdict; promotion is a separate,
|
|
93
|
+
* explicit act. That keeps "what we know" and "what we decided" from collapsing
|
|
94
|
+
* into one step that no one can audit.
|
|
95
|
+
*/
|
|
96
|
+
export function plausibleFinding(input) {
|
|
97
|
+
return {
|
|
98
|
+
claim: input.claim,
|
|
99
|
+
verdict: 'PLAUSIBLE',
|
|
100
|
+
outcome: input.outcome,
|
|
101
|
+
evidence: [...(input.evidence ?? [])],
|
|
102
|
+
source: input.source,
|
|
103
|
+
...(input.at !== undefined ? { at: input.at } : {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Promote a PLAUSIBLE finding to CONFIRMED — or refuse, and say why.
|
|
108
|
+
*
|
|
109
|
+
* The refusal is the point of the module. It returns the finding UNCHANGED and
|
|
110
|
+
* PLAUSIBLE rather than throwing, because "we could not check this" is the
|
|
111
|
+
* ordinary outcome of a probe against a world that may be offline, and a probe
|
|
112
|
+
* must never be able to take down the turn that asked it. Callers that need to
|
|
113
|
+
* branch on the answer read `promoted`.
|
|
114
|
+
*
|
|
115
|
+
* A CONFIRMED finding cannot be promoted again (nothing to do), and a CONFIRMED
|
|
116
|
+
* finding whose evidence is IMPOSSIBLE cannot exist: `enforceVerdicts` demotes
|
|
117
|
+
* it. Both cases are reported rather than silently accepted.
|
|
118
|
+
*/
|
|
119
|
+
export function confirmFinding(finding, evidence = [], options = {}) {
|
|
120
|
+
const combined = [...finding.evidence, ...evidence];
|
|
121
|
+
const outcome = options.outcome ?? finding.outcome;
|
|
122
|
+
if (finding.verdict === 'CONFIRMED' && hasEvidence(finding)) {
|
|
123
|
+
return {
|
|
124
|
+
finding: { ...finding, outcome, ...(options.at !== undefined ? { at: options.at } : {}) },
|
|
125
|
+
promoted: false,
|
|
126
|
+
reason: 'already CONFIRMED — a verdict is recorded once, and the evidence that earned it is on the finding',
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (!combined.some(isUsable)) {
|
|
130
|
+
return {
|
|
131
|
+
finding: { ...finding, outcome, evidence: combined, ...(options.at !== undefined ? { at: options.at } : {}) },
|
|
132
|
+
promoted: false,
|
|
133
|
+
reason: 'no usable evidence — a CONFIRMED verdict means something was CHECKED, so it needs a command ' +
|
|
134
|
+
'and its output, a path that was read, a quote from the input, or a value a probe returned. ' +
|
|
135
|
+
'A restatement of the claim is not evidence, and a blank reference is not a check.',
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
finding: {
|
|
140
|
+
...finding,
|
|
141
|
+
verdict: 'CONFIRMED',
|
|
142
|
+
outcome,
|
|
143
|
+
evidence: combined,
|
|
144
|
+
...(options.at !== undefined ? { at: options.at } : {}),
|
|
145
|
+
},
|
|
146
|
+
promoted: true,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/** Force a finding back to PLAUSIBLE, keeping why. The inverse of a promotion. */
|
|
150
|
+
export function demoteFinding(finding, why) {
|
|
151
|
+
if (finding.verdict === 'PLAUSIBLE')
|
|
152
|
+
return finding;
|
|
153
|
+
const note = finding.outcome.includes(why) ? finding.outcome : `${finding.outcome} — ${why}`;
|
|
154
|
+
return { ...finding, verdict: 'PLAUSIBLE', outcome: note };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The gate applied to a batch, on the way out.
|
|
158
|
+
*
|
|
159
|
+
* This is what makes the rule unfalsifiable-by-accident: ANY batch of findings
|
|
160
|
+
* about to be reported, logged or persisted can be passed through here, and a
|
|
161
|
+
* CONFIRMED verdict that carries nothing is demoted with the reason recorded in
|
|
162
|
+
* its own outcome. `confirmFinding` protects the direct path; this protects the
|
|
163
|
+
* paths nobody has written yet, including a finding assembled by hand in a
|
|
164
|
+
* module that never imported `confirmFinding`.
|
|
165
|
+
*
|
|
166
|
+
* Returns the repaired findings AND the claims that were demoted, because a
|
|
167
|
+
* silent repair would hide the wiring bug that produced the claim — the demotion
|
|
168
|
+
* is correct behaviour, and its CAUSE is still something a caller should see.
|
|
169
|
+
*/
|
|
170
|
+
export function enforceVerdicts(findings, why = 'not promoted: no usable evidence') {
|
|
171
|
+
const demoted = [];
|
|
172
|
+
const repaired = findings.map((finding) => {
|
|
173
|
+
if (finding.verdict !== 'CONFIRMED' || hasEvidence(finding))
|
|
174
|
+
return finding;
|
|
175
|
+
demoted.push(finding.claim);
|
|
176
|
+
return demoteFinding(finding, why);
|
|
177
|
+
});
|
|
178
|
+
return { findings: repaired, demoted };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Claims carrying a CONFIRMED verdict and no usable evidence.
|
|
182
|
+
*
|
|
183
|
+
* The assertion form of `enforceVerdicts`, for a caller that would rather fail
|
|
184
|
+
* than repair — a test, or a check that is about the producing code rather than
|
|
185
|
+
* the report.
|
|
186
|
+
*/
|
|
187
|
+
export function unsupportedConfirmations(findings) {
|
|
188
|
+
return findings
|
|
189
|
+
.filter((finding) => finding.verdict === 'CONFIRMED' && !hasEvidence(finding))
|
|
190
|
+
.map((finding) => finding.claim);
|
|
191
|
+
}
|
|
192
|
+
/** One finding, reduced to the comparable wire form. */
|
|
193
|
+
export function toWire(finding) {
|
|
194
|
+
return {
|
|
195
|
+
claim: finding.claim,
|
|
196
|
+
verdict: finding.verdict,
|
|
197
|
+
outcome: finding.outcome,
|
|
198
|
+
evidence: evidenceOf(finding).map((e) => ({
|
|
199
|
+
kind: e.kind,
|
|
200
|
+
ref: e.ref,
|
|
201
|
+
...(e.detail ? { detail: e.detail } : {}),
|
|
202
|
+
})),
|
|
203
|
+
source: finding.source,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const EVIDENCE_KINDS = ['quote', 'command', 'file', 'observation'];
|
|
207
|
+
/**
|
|
208
|
+
* Read a finding back off the wire, defensively.
|
|
209
|
+
*
|
|
210
|
+
* Returns `undefined` for anything malformed rather than guessing, and — the
|
|
211
|
+
* part that matters — a payload claiming CONFIRMED with no usable evidence comes
|
|
212
|
+
* back PLAUSIBLE. A reader on the other side of an IPC boundary or a log file
|
|
213
|
+
* cannot trust the producer, so the gate is re-applied on the way in rather than
|
|
214
|
+
* assumed to have been applied on the way out.
|
|
215
|
+
*/
|
|
216
|
+
export function fromWire(value) {
|
|
217
|
+
if (!value || typeof value !== 'object')
|
|
218
|
+
return undefined;
|
|
219
|
+
const raw = value;
|
|
220
|
+
if (typeof raw.claim !== 'string' || !raw.claim.trim())
|
|
221
|
+
return undefined;
|
|
222
|
+
if (typeof raw.outcome !== 'string')
|
|
223
|
+
return undefined;
|
|
224
|
+
if (typeof raw.source !== 'string')
|
|
225
|
+
return undefined;
|
|
226
|
+
if (raw.verdict !== 'CONFIRMED' && raw.verdict !== 'PLAUSIBLE')
|
|
227
|
+
return undefined;
|
|
228
|
+
const evidence = Array.isArray(raw.evidence)
|
|
229
|
+
? raw.evidence
|
|
230
|
+
.filter((e) => Boolean(e) &&
|
|
231
|
+
typeof e === 'object' &&
|
|
232
|
+
EVIDENCE_KINDS.includes(e.kind) &&
|
|
233
|
+
typeof e.ref === 'string')
|
|
234
|
+
.map((e) => ({
|
|
235
|
+
kind: e.kind,
|
|
236
|
+
ref: e.ref,
|
|
237
|
+
...(typeof e.detail === 'string' && e.detail ? { detail: e.detail } : {}),
|
|
238
|
+
}))
|
|
239
|
+
: [];
|
|
240
|
+
const finding = {
|
|
241
|
+
claim: raw.claim,
|
|
242
|
+
verdict: raw.verdict,
|
|
243
|
+
outcome: raw.outcome,
|
|
244
|
+
evidence,
|
|
245
|
+
source: raw.source,
|
|
246
|
+
};
|
|
247
|
+
// Re-applied, not trusted: see the docstring.
|
|
248
|
+
return enforceVerdicts([finding]).findings[0];
|
|
249
|
+
}
|
|
250
|
+
/** How one piece of evidence reads. */
|
|
251
|
+
function describeEvidence(evidence) {
|
|
252
|
+
const label = evidence.kind === 'command' ? 'ran' : evidence.kind === 'file' ? 'read' : evidence.kind;
|
|
253
|
+
return `${label} ${evidence.kind === 'quote' ? `"${evidence.ref}"` : evidence.ref}${evidence.detail ? ` (${evidence.detail})` : ''}`;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* One line a person reads, used everywhere so two surfaces cannot render the
|
|
257
|
+
* same finding two ways.
|
|
258
|
+
*
|
|
259
|
+
* The evidence is shown for a CONFIRMED verdict and the reason for a PLAUSIBLE
|
|
260
|
+
* one, because those are the two things a reader needs to decide whether to
|
|
261
|
+
* trust the line — and printing a confidence number neither of them can act on
|
|
262
|
+
* is how a report starts lying politely.
|
|
263
|
+
*/
|
|
264
|
+
export function describeFinding(finding) {
|
|
265
|
+
const head = `${finding.verdict === 'CONFIRMED' ? '✅' : '🔎'} ${finding.claim} — ${finding.outcome}`;
|
|
266
|
+
const evidence = evidenceOf(finding);
|
|
267
|
+
if (finding.verdict === 'CONFIRMED' && evidence.length > 0) {
|
|
268
|
+
return `${head}\n evidence: ${evidence.map(describeEvidence).join('; ')}`;
|
|
269
|
+
}
|
|
270
|
+
return `${head}\n no evidence — reported as PLAUSIBLE, not verified.`;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* A batch, summarised: how many are confirmed, and how many are still guesses.
|
|
274
|
+
*
|
|
275
|
+
* Exists so a caller cannot report a total without also having to look at the
|
|
276
|
+
* split. "12 findings" reads as twelve facts; "12 findings (3 confirmed, 9
|
|
277
|
+
* plausible)" cannot.
|
|
278
|
+
*/
|
|
279
|
+
export function summarizeVerdicts(findings) {
|
|
280
|
+
const confirmed = findings.filter((f) => f.verdict === 'CONFIRMED' && hasEvidence(f)).length;
|
|
281
|
+
const plausible = findings.length - confirmed;
|
|
282
|
+
return `${findings.length} finding(s): ${confirmed} confirmed, ${plausible} plausible`;
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=verdicts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdicts.js","sourceRoot":"","sources":["../../src/findings/verdicts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAoEH;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,QAA8B;IAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,QAAS,CAAC,GAAG,KAAK,QAAQ,IAAI,QAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACnG,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAmB;IAClD,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,CAA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,KAAK,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7F,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;IAC9C,OAAO,GAAG,QAAQ,CAAC,MAAM,gBAAgB,SAAS,eAAe,SAAS,YAAY,CAAC;AACzF,CAAC"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { Platform } from './channel-directory.js';
|
|
16
16
|
import type { WhatsAppBridge } from './whatsapp/bridge.js';
|
|
17
|
+
import { type InboundMedia } from './inbound-media.js';
|
|
17
18
|
export interface InboundMessage {
|
|
18
19
|
platform: Platform;
|
|
19
20
|
/** Channel id (chat id / webhook channel id) to REPLY to. */
|
|
@@ -38,6 +39,13 @@ export interface InboundMessage {
|
|
|
38
39
|
* every delivery is treated as new (content dedup is opt-in — see dedup.ts).
|
|
39
40
|
*/
|
|
40
41
|
messageId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* A document/image attachment that rode in on this message, already
|
|
44
|
+
* downloaded by the transport. `handleInbound` hydrates it through the same
|
|
45
|
+
* `read_extract` the agent uses, so a document is TEXT by the time routing
|
|
46
|
+
* happens instead of a message with empty text that gets dropped.
|
|
47
|
+
*/
|
|
48
|
+
media?: InboundMedia;
|
|
41
49
|
}
|
|
42
50
|
/** The handler an adapter calls for every inbound message. */
|
|
43
51
|
export type MessageHandler = (msg: InboundMessage) => void | Promise<void>;
|
|
@@ -100,6 +108,17 @@ export declare class TelegramAdapter implements ChannelAdapter {
|
|
|
100
108
|
describe(): string;
|
|
101
109
|
private api;
|
|
102
110
|
start(onMessage: MessageHandler): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Download an inbound attachment's bytes via `getFile` + the file endpoint.
|
|
113
|
+
* Never throws — returns null on any failure (or when the file is larger than
|
|
114
|
+
* the extraction cap), so the turn still runs with its caption text.
|
|
115
|
+
*/
|
|
116
|
+
private downloadFile;
|
|
117
|
+
/**
|
|
118
|
+
* Build the inbound media payload from a Telegram message, or null when it
|
|
119
|
+
* carries none. Photos arrive as several sizes — the largest is used.
|
|
120
|
+
*/
|
|
121
|
+
private inboundMedia;
|
|
103
122
|
stop(): Promise<void>;
|
|
104
123
|
send(channelId: string, text: string): Promise<boolean>;
|
|
105
124
|
/**
|
|
@@ -138,7 +157,16 @@ export declare class DiscordAdapter extends WebhookChannelAdapter {
|
|
|
138
157
|
readonly tokenEnvVar = "BUFF_DISCORD_BOT_TOKEN";
|
|
139
158
|
readonly configured: boolean;
|
|
140
159
|
constructor();
|
|
160
|
+
/** The real-time Gateway connection, when a bot token is configured. */
|
|
161
|
+
private gateway;
|
|
141
162
|
describe(): string;
|
|
163
|
+
/**
|
|
164
|
+
* Inbound Discord messages arrive over the Gateway WebSocket (a bot cannot
|
|
165
|
+
* own the Discord webhook), so a bot token starts the real-time source. The
|
|
166
|
+
* shared webhook receiver still serves outbound-only webhook setups.
|
|
167
|
+
*/
|
|
168
|
+
start(onMessage: MessageHandler): Promise<void>;
|
|
169
|
+
stop(): Promise<void>;
|
|
142
170
|
protected sendUrl(channelId: string): string;
|
|
143
171
|
protected payloadFor(_channelId: string, text: string): unknown;
|
|
144
172
|
/**
|
|
@@ -156,7 +184,16 @@ export declare class SlackAdapter extends WebhookChannelAdapter {
|
|
|
156
184
|
readonly tokenEnvVar = "BUFF_SLACK_BOT_TOKEN";
|
|
157
185
|
readonly configured: boolean;
|
|
158
186
|
constructor();
|
|
187
|
+
/** The Socket Mode connection, when an app-level token is configured. */
|
|
188
|
+
private socketMode;
|
|
159
189
|
describe(): string;
|
|
190
|
+
/**
|
|
191
|
+
* Slack Events API inbound needs a public HTTPS endpoint; apps that cannot
|
|
192
|
+
* expose one use Socket Mode, which carries the same `event_callback`
|
|
193
|
+
* envelopes. Enabled by an app-level token (`SLACK_APP_TOKEN`, `xapp-…`).
|
|
194
|
+
*/
|
|
195
|
+
start(onMessage: MessageHandler): Promise<void>;
|
|
196
|
+
stop(): Promise<void>;
|
|
160
197
|
protected sendUrl(channelId: string): string;
|
|
161
198
|
protected payloadFor(channelId: string, text: string): unknown;
|
|
162
199
|
}
|
|
@@ -636,6 +673,15 @@ export declare class HomeAssistantAdapter implements ChannelAdapter {
|
|
|
636
673
|
stop(): Promise<void>;
|
|
637
674
|
send(channelId: string, text: string): Promise<boolean>;
|
|
638
675
|
}
|
|
676
|
+
/** An inbound webhook attachment that must be downloaded before extraction. */
|
|
677
|
+
export interface WebhookAttachment {
|
|
678
|
+
url: string;
|
|
679
|
+
filename?: string;
|
|
680
|
+
mimetype?: string;
|
|
681
|
+
size?: number;
|
|
682
|
+
/** True when fetching the URL needs the platform bot token (Slack files). */
|
|
683
|
+
authenticated?: boolean;
|
|
684
|
+
}
|
|
639
685
|
/** Payload parsers: extract {channelId, text, from} from each platform's webhook body. */
|
|
640
686
|
export interface WebhookPayload {
|
|
641
687
|
channelId: string;
|
|
@@ -647,7 +693,20 @@ export interface WebhookPayload {
|
|
|
647
693
|
isGroup?: boolean;
|
|
648
694
|
/** The platform's message id, when the webhook body carries one (dedup). */
|
|
649
695
|
messageId?: string;
|
|
696
|
+
/** An attachment that rode in on the message (Discord CDN / Slack file). */
|
|
697
|
+
media?: {
|
|
698
|
+
type: InboundMedia['type'];
|
|
699
|
+
attachment: WebhookAttachment;
|
|
700
|
+
caption?: string;
|
|
701
|
+
};
|
|
650
702
|
}
|
|
703
|
+
/**
|
|
704
|
+
* Classify an attachment by MIME type, falling back to its filename extension.
|
|
705
|
+
* Exported for the real-time transports (`realtime.ts`), which receive Discord
|
|
706
|
+
* `content_type` / Slack `mimetype` on a live gateway event rather than a
|
|
707
|
+
* webhook body.
|
|
708
|
+
*/
|
|
709
|
+
export declare function mediaKindFromMime(mimetype?: string, filename?: string): InboundMedia['type'];
|
|
651
710
|
/**
|
|
652
711
|
* Parse platform-specific webhook bodies into a normal InboundMessage.
|
|
653
712
|
* Returns null when the payload isn't a user message (e.g. Slack challenge).
|
|
@@ -665,6 +724,12 @@ export declare class WebhookReceiver {
|
|
|
665
724
|
* When the platform secret is set, unsigned POSTs are rejected (401).
|
|
666
725
|
*/
|
|
667
726
|
start(onMessage: MessageHandler, port?: number, host?: string): Promise<void>;
|
|
727
|
+
/**
|
|
728
|
+
* Download a webhook attachment's bytes. Never throws — returns null on any
|
|
729
|
+
* failure, so the text turn still runs. Slack's `url_private*` endpoints need
|
|
730
|
+
* the bot token; Discord's CDN URL is public.
|
|
731
|
+
*/
|
|
732
|
+
private downloadWebhookMedia;
|
|
668
733
|
/**
|
|
669
734
|
* Verify a webhook POST's platform signature. Returns true when the
|
|
670
735
|
* platform has NO secret configured (local/trusted setup) or the signature
|