/** * DiagRootCauseRunner — Stage A runner for the split diagnostician pipeline. * * Identifies the underlying cause of a pain signal using a 5-Whys causal * chain and categorises it into one of four root-cause categories. * * Extends BasePeerRunner following the DreamerRunner pattern (PRI-302). * The shared lease → buildContext → invoke → poll → fetch → validate → * succeed/fail pipeline is in the base class. This file only contains * Stage A–specific logic. * * Key constraints: * - Uses PDRuntimeAdapter for all LLM execution (no direct SDK calls) * - No plugin-layer imports (core is infrastructure-agnostic) * - Uses RuntimeStateManager for all state operations * - NO candidate commit — only writes PIArtifact (like DreamerRunner) * - Reads diagnostician_core_grounding flag from effectiveConfig (PRI-371) * * @see PRI-372 * @see BasePeerRunner in runner/base-peer-runner.ts */ import type { RunHandle } from '../runtime-protocol.js'; import type { DiagRootCauseOutputV1, DiagRootCauseValidator } from '../diagnostician/diag-rootcause-output.js'; import type { DiagnosticianContextPayload } from '../context-payload.js'; import type { ContextAssembler } from '../store/context/context-assembler.js'; import type { TaskRecord } from '../task-status.js'; import type { EffectivePdConfig } from '../config/pd-config-types.js'; import type { IntentDocReader } from '../intent/intent-doc-reader-port.js'; import { type PDErrorCategory } from '../error-categories.js'; import { BasePeerRunner } from '../runner/base-peer-runner.js'; import type { PeerRunnerOptions, PeerRunnerDeps, PeerRunnerResult, PeerRunnerValidationResult } from '../runner/peer-runner-types.js'; /** Context built by DiagRootCauseRunner.buildContext() and consumed by invokeRuntime(). */ interface DiagRootCauseContext { readonly contextHash: string; readonly contextRefs: string[]; readonly painPayload: DiagnosticianContextPayload; } export interface DiagRootCauseRunnerDeps extends PeerRunnerDeps { readonly validator: DiagRootCauseValidator; readonly contextAssembler: ContextAssembler; /** * PRI-468: Optional INTENT.md reader for Stage A intent tension check. * * When provided AND `intent_engineering` flag is on, the runner reads * INTENT.md and injects it into the Stage A prompt as reference context * for the LLM to optionally produce `intentTension`. * * When absent or flag off, the runner behaves as before (byte-identical * prompt — EP-03: no silent fallback). */ readonly intentDocReader?: IntentDocReader; } export interface DiagRootCauseRunnerOptions extends PeerRunnerOptions { /** Effective PD config for feature flag resolution (PRI-371). */ readonly effectiveConfig?: EffectivePdConfig; } /** * Stage A runner for the split diagnostician pipeline. * * Produces a DiagRootCauseOutputV1 containing the 5-Whys causal chain, * root cause classification, and evidence. Does NOT commit candidates — * that is the responsibility of Stage C (DiagRouterRunner). * * @see PRI-372 */ export declare class DiagRootCauseRunner extends BasePeerRunner { private readonly validator; private readonly contextAssembler; private readonly effectiveConfig?; private readonly intentDocReader?; constructor(deps: DiagRootCauseRunnerDeps, options: DiagRootCauseRunnerOptions); get permanentErrorCategories(): ReadonlySet; buildContext(taskId: string): Promise; invokeRuntime(taskId: string, context: DiagRootCauseContext): Promise; validateOutput(output: unknown, taskId: string, _context: DiagRootCauseContext): Promise; succeedTask(taskId: string, runId: string, output: DiagRootCauseOutputV1, task: TaskRecord, contextHash: string, _context: DiagRootCauseContext): Promise>; /** * Re-inject taskId if stripped by stripLineageFields (PRI-272 / ERR-008). * Only fill when absent via Object.hasOwn — present-but-falsy values * must reach validation and fail loud (Runtime Contract Rule 3). */ protected postFetchTransform(taskId: string, untrustedOutput: unknown): void; protected emitSuccessTelemetry(taskId: string, output: DiagRootCauseOutputV1, _context: DiagRootCauseContext): void; } export {}; //# sourceMappingURL=diag-rootcause-runner.d.ts.map