/** * PRI-456: Pure result-shaping function for PainSignalBridge. * * Extracts the duplicated status-decision tree from: * - PainSignalBridge.onDiagnosisComplete() (fresh diagnosis path) * - PainSignalBridge.buildExistingResult() (idempotent existing-task path) * * Both paths decide: no candidates → failed; admitted-but-no-ledger → failed; * gated/partial → degraded; otherwise succeeded. But they differ in message * strings and the fresh path has admission results + degraded states. * * This function is pure: zero I/O, zero side effects. Callers pass all * computed values; the function never re-derives lineage fields. * * ERR gate: * - ERR-007 / EP-02: single source for status decision — branches can't diverge * - ERR-002 / EP-03: every degraded/failed branch keeps its structured message * - ERR-004 / ERR-008 / EP-07: lineage fields are received, never re-derived */ import type { PainSignalBridgeResult, NotInternalizableCandidate } from './pain-signal-bridge.js'; import type { CandidateAdmissionResult } from './admission-gate.js'; /** Base fields shared by both fresh and existing paths. */ interface ShapeBridgeResultBase { painId: string; taskId: string; candidateIds: string[]; ledgerEntryIds: string[]; runId?: string; artifactId?: string; autoIntakeEnabled: boolean; /** PRI-539: candidates admitted+ledgered but not internalizable (MVP-disabled channel). */ notInternalizable?: NotInternalizableCandidate[]; } /** Fresh diagnosis path — has admission results and seed failure notes. */ export interface ShapeBridgeResultFreshInput extends ShapeBridgeResultBase { path: 'fresh'; admissionResults: CandidateAdmissionResult[]; /** Non-empty string when dreamer seed failed; empty string otherwise. */ seedFailureNote: string; } /** Existing-task idempotent path — ledger-existence-derived, no admissions. */ export interface ShapeBridgeResultExistingInput extends ShapeBridgeResultBase { path: 'existing'; } export type ShapeBridgeResultInput = ShapeBridgeResultFreshInput | ShapeBridgeResultExistingInput; /** * Derive the final PainSignalBridgeResult from computed inputs. * * Byte-for-byte identical to the original inline logic in both call sites. * The `path` discriminator selects the appropriate message strings and * decision branches. */ export declare function shapeBridgeResult(input: ShapeBridgeResultInput): PainSignalBridgeResult; export {}; //# sourceMappingURL=bridge-result-shaper.d.ts.map