/** * Dreamer output types and validator (PRI-67). * * Dreamer generates 2-3 diverse candidate corrections for principle violations. * Output is consumed by Philosopher (next stage in dreamer→philosopher→scribe chain). * * Follows ADR-0003 peer runner contract: DreamerRunner does NOT directly invoke * Philosopher/Scribe — it returns artifact/proposal for host layer to enqueue. * * @see docs/adr/0003-peer-agent-state-machine-orchestration.md */ import type { PDErrorCategory } from '../error-categories.js'; import { type Static } from '@sinclair/typebox'; /** * A single candidate correction generated by Dreamer. * * Represents a different valid approach to addressing a principle violation * observed in a session trajectory. */ export interface DreamerCandidate { /** 0-based index within the candidate list */ readonly candidateIndex: number; /** What the agent did wrong in the observed case */ readonly badDecision: string; /** What the agent should have done instead */ readonly betterDecision: string; /** Why this alternative is better than the bad decision */ readonly rationale: string; /** Confidence score [0, 1] */ readonly confidence: number; /** LLM-judged risk level of applying this candidate */ readonly riskLevel: 'low' | 'medium' | 'high'; /** Strategic lens through which this candidate was evaluated */ readonly strategicPerspective: string; } /** * The structured output of a Dreamer run. * * Produced by the LLM runtime via PDRuntimeAdapter, validated by DreamerValidator, * and stored as a RunRecord output. The host layer (orchestrator or committer) * converts this into Philosopher's input. */ export interface DreamerOutput { /** Whether the Dreamer LLM call succeeded and produced valid output */ readonly valid: boolean; /** Task ID this output belongs to */ readonly taskId: string; /** List of candidate corrections (1-5 items) */ readonly candidates: readonly DreamerCandidate[]; /** Optional principle this Dreamer run was targeting */ readonly sourcePrincipleId?: string; /** Optional pain signal that triggered this Dreamer run */ readonly sourcePainId?: string; /** Artifact/context references consumed as input */ readonly contextRefs: readonly string[]; /** ISO-8601 timestamp when output was generated */ readonly generatedAt: string; /** Human-readable explanation when valid=false */ readonly reason?: string; } export declare const DreamerCandidateSchema: import("@sinclair/typebox").TObject<{ candidateIndex: import("@sinclair/typebox").TNumber; badDecision: import("@sinclair/typebox").TString; betterDecision: import("@sinclair/typebox").TString; rationale: import("@sinclair/typebox").TString; confidence: import("@sinclair/typebox").TNumber; riskLevel: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"low">, import("@sinclair/typebox").TLiteral<"medium">, import("@sinclair/typebox").TLiteral<"high">]>; strategicPerspective: import("@sinclair/typebox").TString; }>; export declare const DreamerOutputV1Schema: import("@sinclair/typebox").TObject<{ valid: import("@sinclair/typebox").TBoolean; taskId: import("@sinclair/typebox").TString; candidates: import("@sinclair/typebox").TArray, import("@sinclair/typebox").TLiteral<"medium">, import("@sinclair/typebox").TLiteral<"high">]>; strategicPerspective: import("@sinclair/typebox").TString; }>>; sourcePrincipleId: import("@sinclair/typebox").TOptional; sourcePainId: import("@sinclair/typebox").TOptional; contextRefs: import("@sinclair/typebox").TArray; generatedAt: import("@sinclair/typebox").TString; reason: import("@sinclair/typebox").TOptional; }>; export type DreamerOutputV1 = Static; /** * Result of DreamerOutput validation. */ export interface DreamerValidationResult { readonly valid: boolean; readonly errors: readonly string[]; readonly errorCategory?: PDErrorCategory; } /** * Validator interface consumed by DreamerRunner. * * Production code must use DefaultDreamerValidator (strict validation). * PassThroughDreamerValidator is test-only and must not be used in production paths. */ export interface DreamerValidator { /** Validate untrusted output. Accepts `unknown` — must perform runtime checks (ERR-001). */ validate(output: unknown, taskId: string): Promise; } export declare class DefaultDreamerValidator implements DreamerValidator { validate(output: unknown, taskId: string): Promise; } /** * Pass-through validator — accepts all output. * * @deprecated Test-only. Do NOT use in production paths. * Production code must use DefaultDreamerValidator which enforces schema, * candidate count (1-5), confidence range (0..1), and riskLevel validation. * @internal */ export declare class PassThroughDreamerValidator implements DreamerValidator { validate(_output: unknown, _taskId: string): Promise; } //# sourceMappingURL=dreamer-output.d.ts.map