agent-nuvira 3.3.3 → 3.3.5
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 +13 -5
- 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/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.map +1 -1
- package/dist/agents/orchestrator.js +5 -4
- package/dist/agents/orchestrator.js.map +1 -1
- package/dist/cli/agent.d.ts +2 -2
- package/dist/cli/agent.js +10 -10
- package/dist/cli/chat.d.ts +94 -0
- package/dist/cli/chat.d.ts.map +1 -1
- package/dist/cli/chat.js +354 -20
- package/dist/cli/chat.js.map +1 -1
- package/dist/cli/cli-program.d.ts.map +1 -1
- package/dist/cli/cli-program.js +5 -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/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/loop-executor.d.ts +55 -0
- package/dist/cli/loop-executor.d.ts.map +1 -1
- package/dist/cli/loop-executor.js +212 -13
- 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/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/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/process-env.d.ts +136 -0
- package/dist/config/process-env.d.ts.map +1 -0
- package/dist/config/process-env.js +217 -0
- package/dist/config/process-env.js.map +1 -0
- package/dist/config/types.d.ts +44 -0
- package/dist/config/types.d.ts.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/tools.d.ts.map +1 -1
- package/dist/inference/tools.js +29 -0
- package/dist/inference/tools.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-reachability.d.ts +95 -0
- package/dist/learning/model-reachability.d.ts.map +1 -0
- package/dist/learning/model-reachability.js +111 -0
- package/dist/learning/model-reachability.js.map +1 -0
- package/dist/learning/model-registry.d.ts +22 -0
- package/dist/learning/model-registry.d.ts.map +1 -1
- package/dist/learning/model-registry.js +26 -1
- package/dist/learning/model-registry.js.map +1 -1
- package/dist/learning/model-verify-job.d.ts +131 -0
- package/dist/learning/model-verify-job.d.ts.map +1 -0
- package/dist/learning/model-verify-job.js +221 -0
- package/dist/learning/model-verify-job.js.map +1 -0
- 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 +37 -1
- package/dist/learning/reasoning-trace.d.ts.map +1 -1
- package/dist/learning/reasoning-trace.js +66 -0
- 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 +2 -1
- 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/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/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/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/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/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 +13 -2
- package/dist/tools/pipeline-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 +2 -2
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +152 -23
- package/dist/tools/registry.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 +82 -0
- package/dist/tools/tool-loop.d.ts.map +1 -1
- package/dist/tools/tool-loop.js +167 -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 +12 -2
- 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/process-env-inventory.d.ts +57 -0
- package/dist/web-dashboard/process-env-inventory.d.ts.map +1 -0
- package/dist/web-dashboard/process-env-inventory.js +96 -0
- package/dist/web-dashboard/process-env-inventory.js.map +1 -0
- 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 +493 -30
- package/dist/web-dashboard/server.js.map +1 -1
- package/dist/web-dashboard/src/types.d.ts +261 -48
- package/dist/web-dashboard/src/types.d.ts.map +1 -1
- package/package.json +18 -3
- package/src/web-dashboard/public/assets/{index-Cyd6tIew.css → index-CIJ6FHHZ.css} +1 -1
- package/src/web-dashboard/public/assets/index-CsySzR41.js +207 -0
- package/src/web-dashboard/public/assets/index-CsySzR41.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-CxDj7p6i.js +0 -207
- package/src/web-dashboard/public/assets/index-CxDj7p6i.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-env.js","sourceRoot":"","sources":["../../src/config/process-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;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,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAClD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAoC,EAAE,KAAoB;IAC3F,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC;QAC5F,KAAK,MAAM;YACT,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,KAAK,CAAC;QAC3D,KAAK,YAAY;YACf,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC;QAC9B,KAAK,eAAe;YAClB,uEAAuE;YACvE,6DAA6D;YAC7D,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,OAAO,CAAC;QACzD;YACE,uEAAuE;YACvE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -508,6 +508,20 @@ export interface BuffConfig {
|
|
|
508
508
|
askUserWait?: boolean;
|
|
509
509
|
/** Reply window for `askUserWait`, in ms (default 120000; clamped 5s–10min). */
|
|
510
510
|
askUserTimeoutMs?: number;
|
|
511
|
+
/**
|
|
512
|
+
* Inbound attachment handling (documents + voice notes).
|
|
513
|
+
*
|
|
514
|
+
* - `enabled` (default true): when false the gateway still ACCEPTS a
|
|
515
|
+
* message with an attachment, but never downloads or extracts it — the
|
|
516
|
+
* model just sees a note that an attachment was dropped by policy. Use
|
|
517
|
+
* this on a locked-down or metered deployment.
|
|
518
|
+
* - `maxBytes` (default 20 MB): per-attachment cap; anything larger is not
|
|
519
|
+
* downloaded/extracted.
|
|
520
|
+
*/
|
|
521
|
+
inboundAttachments?: {
|
|
522
|
+
enabled?: boolean;
|
|
523
|
+
maxBytes?: number;
|
|
524
|
+
};
|
|
511
525
|
};
|
|
512
526
|
}
|
|
513
527
|
/**
|
|
@@ -544,6 +558,36 @@ export interface ToolsConfig {
|
|
|
544
558
|
toolsets?: Record<string, {
|
|
545
559
|
enabled?: boolean;
|
|
546
560
|
}>;
|
|
561
|
+
/**
|
|
562
|
+
* WS4 (#26) — tool lifecycle hooks an operator subscribes to: a command per
|
|
563
|
+
* phase (`before` / `after` / `failed`) that receives the call as JSON on
|
|
564
|
+
* stdin, and may VETO a call from a `before` hook. See
|
|
565
|
+
* `src/tools/tool-hooks.ts` for the contract and the fail-open rule.
|
|
566
|
+
*/
|
|
567
|
+
hooks?: ToolHookConfig[];
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* One declared tool hook, as it is written in `buffconfig.json`.
|
|
571
|
+
*
|
|
572
|
+
* The environment (`NUVIRA_TOOL_HOOK_BEFORE` / `_AFTER` / `_FAILED`) declares the
|
|
573
|
+
* same thing for a single run and WINS over the config for its phase, so a policy
|
|
574
|
+
* can be checked in and an experiment needs no edit to it.
|
|
575
|
+
*/
|
|
576
|
+
export interface ToolHookConfig {
|
|
577
|
+
/** Which moment of the call this hook sees. */
|
|
578
|
+
phase: 'before' | 'after' | 'failed';
|
|
579
|
+
/**
|
|
580
|
+
* The command to run. It is executed by the platform shell, and the CALL is
|
|
581
|
+
* written to its stdin as JSON — never interpolated into the command line, so
|
|
582
|
+
* a tool argument can never change what runs.
|
|
583
|
+
*/
|
|
584
|
+
command: string;
|
|
585
|
+
/** Tool names this hook applies to. Absent or empty = every tool. */
|
|
586
|
+
tools?: string[];
|
|
587
|
+
/** Kill the hook after this many milliseconds (default 5000). */
|
|
588
|
+
timeoutMs?: number;
|
|
589
|
+
/** A name for this hook, used in the report when it vetoes or fails. */
|
|
590
|
+
label?: string;
|
|
547
591
|
}
|
|
548
592
|
/**
|
|
549
593
|
* Inference options passed to each generation call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhG;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,MAAM,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE/D,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,yDAAyD;IACzD,WAAW,C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tB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -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,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qEAAqE;AACrE,MAAM,WAAW,OAAO;IACtB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB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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,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QACrC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EA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