/** * PhilosopherRunner — Second peer runner for the Internalization Engine (PRI-90). * * Migrated to extend BasePeerRunner (PRI-new). The shared lease → buildContext → * invoke → poll → fetch → validate → succeed/fail pipeline is now in the base * class. This file only contains Philosopher-specific logic. * * Key constraints (ADR-0003): * - Uses PDRuntimeAdapter for all LLM execution (no direct SDK calls) * - Does NOT directly invoke Scribe (host layer enqueues next task) * - No plugin-layer imports (core is infrastructure-agnostic) * - No timer-based scheduling (sleep via setTimeout is polling-only) * - Uses RuntimeStateManager for all state operations * * Pipeline: * 1. acquireLease — isolated try/catch, lease_conflict is non-mutating * 2. resolve Dreamer dependency from dependencyTaskIds * 3. fetch Dreamer artifact via PIArtifactStore * 4. startRun with outputSchemaRef: 'philosopher-output-v1' * 5. pollUntilTerminal * 6. fetchOutput → validate as unknown → cast to PhilosopherOutputV1 * 7. updateRunOutput → persist serialized output * 8. write PIArtifact → markTaskSucceeded with philosopher:// resultRef * * @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 { PhilosopherOutputV1, PhilosopherValidator } from './philosopher-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 PhilosopherRunner.buildContext() and consumed by invokeRuntime(). */ interface PhilosopherContext { readonly contextHash: string; readonly dreamerArtifact: string; readonly sourceDreamerArtifactId: string; } export type PhilosopherRunnerResultStatus = 'succeeded' | 'failed' | 'retried'; export interface PhilosopherRunnerResult { readonly status: PhilosopherRunnerResultStatus; readonly taskId: string; readonly runId?: string; readonly artifactId?: string; readonly resultRef?: string; readonly contextHash?: string; readonly output?: PhilosopherOutputV1; readonly errorCategory?: PDErrorCategory; readonly failureReason?: string; readonly attemptCount: number; } export type PhilosopherRunnerOptions = PeerRunnerOptions; export interface ResolvedPhilosopherRunnerOptions { readonly pollIntervalMs: number; readonly timeoutMs: number; readonly defaultMaxAttempts: number; readonly owner: string; readonly runtimeKind: string; readonly agentId: string; /** * Owner's preferred language for principle candidate fields (PRI-336/PRI-714). * Forwarded to PhilosopherPromptBuilder so thesis/principleCandidate fields * follow the owner's language. Undefined = no directive (backward compatible). */ readonly outputLanguage?: OutputLanguage; /** Whether to inject CORE_PRINCIPLES into the philosopher prompt (default: true). */ readonly coreGrounding: boolean; } export declare const DEFAULT_PHILOSOPHER_RUNNER_OPTIONS: Readonly>; export declare function resolvePhilosopherRunnerOptions(options: PhilosopherRunnerOptions): ResolvedPhilosopherRunnerOptions; export interface PhilosopherRunnerDeps extends PeerRunnerDeps { readonly validator: PhilosopherValidator; } export declare class PhilosopherRunner extends BasePeerRunner { private readonly validator; constructor(deps: PhilosopherRunnerDeps, options: PeerRunnerOptions); get permanentErrorCategories(): ReadonlySet; buildContext(taskId: string): Promise; invokeRuntime(taskId: string, context: PhilosopherContext): Promise; validateOutput(output: unknown, taskId: string): Promise; succeedTask(taskId: string, runId: string, output: PhilosopherOutputV1, task: TaskRecord, contextHash: string, context: PhilosopherContext): 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). * * The generatedAt override is handled by the base class via * super.postFetchTransform(). */ protected postFetchTransform(taskId: string, untrustedOutput: unknown, _context: PhilosopherContext): void; protected emitSuccessTelemetry(taskId: string, output: PhilosopherOutputV1): void; } export {}; //# sourceMappingURL=philosopher-runner.d.ts.map