/** * DreamerRunner — First real peer runner for the Internalization Engine (PRI-67). * * Migrated to extend BasePeerRunner (PRI-302). The shared lease → buildContext → * invoke → poll → fetch → validate → succeed/fail pipeline is now in the base * class. This file only contains Dreamer-specific logic. * * Key constraints (ADR-0003): * - Uses PDRuntimeAdapter for all LLM execution (no direct SDK calls) * - Does NOT directly invoke Philosopher/Scribe (host layer enqueues next task) * - No plugin-layer imports (core is infrastructure-agnostic) * - Uses RuntimeStateManager for all state operations * * @see docs/adr/0003-peer-agent-state-machine-orchestration.md * @see BasePeerRunner in runner/base-peer-runner.ts */ import type { RunHandle } from '../runtime-protocol.js'; import type { DreamerOutput, DreamerValidator } from './dreamer-output.js'; import type { TaskRecord } from '../task-status.js'; import type { OutputLanguage } from '../language-directive.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 DreamerRunner.buildContext() and consumed by invokeRuntime(). */ interface DreamerContext { readonly contextHash: string; readonly contextRefs: string[]; readonly predecessorOutput: unknown; } export type DreamerRunnerResultStatus = 'succeeded' | 'failed' | 'retried'; export interface DreamerRunnerResult { readonly status: DreamerRunnerResultStatus; readonly taskId: string; readonly runId?: string; readonly artifactId?: string; readonly resultRef?: string; readonly contextHash?: string; readonly output?: DreamerOutput; readonly errorCategory?: PDErrorCategory; readonly failureReason?: string; readonly attemptCount: number; } export type DreamerRunnerOptions = PeerRunnerOptions; export interface ResolvedDreamerRunnerOptions { readonly pollIntervalMs: number; readonly timeoutMs: number; readonly defaultMaxAttempts: number; readonly owner: string; readonly runtimeKind: string; readonly agentId: string; /** * Owner's preferred language for candidate fields (PRI-336/PRI-714). * Forwarded to DreamerPromptBuilder so badDecision/betterDecision/rationale * follow the owner's language. Undefined = no directive (backward compatible). */ readonly outputLanguage?: OutputLanguage; /** Whether to inject CORE_PRINCIPLES into the dreamer prompt (default: true). */ readonly coreGrounding: boolean; } export declare const DEFAULT_DREAMER_RUNNER_OPTIONS: Readonly>; export declare function resolveDreamerRunnerOptions(options: DreamerRunnerOptions): ResolvedDreamerRunnerOptions; export interface DreamerRunnerDeps extends PeerRunnerDeps { readonly validator: DreamerValidator; } export declare class DreamerRunner extends BasePeerRunner { private readonly validator; constructor(deps: DreamerRunnerDeps, options: PeerRunnerOptions); get permanentErrorCategories(): ReadonlySet; buildContext(taskId: string): Promise; invokeRuntime(taskId: string, context: DreamerContext): Promise; validateOutput(output: unknown, taskId: string): Promise; succeedTask(taskId: string, runId: string, output: DreamerOutput, task: TaskRecord, contextHash: string, _context: DreamerContext): 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). * * Also strips fabricated sourcePrincipleId values via the shared * stripFabricatedCorePrincipleIds utility. The generatedAt override is * handled by the base class via super.postFetchTransform(). */ protected postFetchTransform(taskId: string, untrustedOutput: unknown, _context: DreamerContext): void; protected emitSuccessTelemetry(taskId: string, output: DreamerOutput): void; } export {}; //# sourceMappingURL=dreamer-runner.d.ts.map