{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../../src/core/routing/probe.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAID,oEAAoE;AACpE,wBAAgB,mBAAmB,IAAI,kBAAkB,CAiExD","sourcesContent":["/**\n * Deterministic routing evaluation self-probe.\n *\n * Runs a fixed set of offline decision fixtures with fixture evidence and no\n * provider, returning a bounded verdict used by CLI (and the packed/binary\n * artifact acceptance). This is the deterministic gate for routing decisions.\n */\n\nimport { fixtureEvidence } from \"./cli-helpers.js\";\nimport { decide } from \"./engine.js\";\nimport { resolveFallback } from \"./fallback.js\";\nimport { extractFeatures } from \"./features.js\";\n\nexport interface RoutingProbeCheck {\n\tscenario: string;\n\tpassed: boolean;\n\texpected?: string;\n\tactual?: string;\n\tmessage: string;\n}\n\nexport interface RoutingProbeResult {\n\tpassed: boolean;\n\tchecks: RoutingProbeCheck[];\n}\n\nconst evidence = fixtureEvidence();\n\n/** Run the canonical offline routing fixtures deterministically. */\nexport function runRoutingSelfProbe(): RoutingProbeResult {\n\tconst checks: RoutingProbeCheck[] = [];\n\n\tconst simple = decide({ task: \"Where is the Foo symbol defined?\", evidence });\n\tchecks.push(check(\"simple read-only task produces a decision\", Boolean(simple.decision.decisionId)));\n\n\tconst impl = decide({ task: \"Fix the timeout bug in the scheduler across three files\", evidence });\n\tchecks.push(check(\"bounded implementation produces a decision\", Boolean(impl.decision.decisionId)));\n\n\tconst release = decide({ task: \"Release version 1.9.0 across seven packages and tag it\", evidence });\n\tchecks.push(\n\t\tcheck(\n\t\t\t\"release task routes to a release budget class\",\n\t\t\trelease.selectedCandidate?.budgetClass === \"release\",\n\t\t\t\"release\",\n\t\t\trelease.selectedCandidate?.budgetClass,\n\t\t),\n\t);\n\n\t// Provider unavailable -> deterministic baseline fallback (not blocked).\n\tconst fb = resolveFallback(\"provider_unavailable\", extractFeatures(\"Fix the bug\"), {\n\t\texplicitFallback: undefined,\n\t\tpolicyFallback: undefined,\n\t\tlocalOnly: false,\n\t\tsafetyClass: \"high\",\n\t});\n\tchecks.push(\n\t\tcheck(\n\t\t\t\"provider unavailable falls back safely\",\n\t\t\tfb.fallbackLayer === \"deterministic_baseline\" || fb.fallbackLayer === \"operator\",\n\t\t\t\"deterministic_baseline\",\n\t\t\tfb.fallbackLayer,\n\t\t),\n\t);\n\n\t// Insufficient evidence -> confidence insufficient.\n\tconst noEv = decide({ task: \"Investigate the unknown symbol\", evidence: {} });\n\tchecks.push(\n\t\tcheck(\n\t\t\t\"insufficient evidence is explicit when no evidence\",\n\t\t\tnoEv.decision.confidence === \"insufficient_evidence\",\n\t\t\t\"insufficient_evidence\",\n\t\t\tnoEv.decision.confidence,\n\t\t),\n\t);\n\n\t// Operator override is recorded.\n\tconst overridden = decide({\n\t\ttask: \"Fix the parser bug\",\n\t\tevidence,\n\t\toperatorOverride: {\n\t\t\tauthorizedBy: \"probe\",\n\t\t\tcandidateId: \"c-fixture-fixture-deterministic-single_agent-hybrid-standard\",\n\t\t\treason: \"probe override\",\n\t\t},\n\t});\n\tchecks.push(\n\t\tcheck(\n\t\t\t\"operator override is recorded and authoritative\",\n\t\t\tBoolean(overridden.decision.operatorOverride) &&\n\t\t\t\toverridden.decision.selectedCandidateId === \"c-fixture-fixture-deterministic-single_agent-hybrid-standard\",\n\t\t),\n\t);\n\n\treturn { passed: checks.every((c) => c.passed), checks };\n}\n\nfunction check(message: string, passed: boolean, expected?: string, actual?: string): RoutingProbeCheck {\n\treturn { scenario: message, passed, expected, actual, message };\n}\n"]}