/** * LayerPipeline: The core asynchronous engine for Polaris Creativa. * * Orchestrates the 4-layer pipeline with: * - Latency-bounded parallel execution for Layer 1 (AbortController + allSettled) * - Strict message isolation between layers * - Decay loop with entropy escalation on rerun cycles * - Cost-aware routing via cumulative token tracking */ import { StrategyAgent } from "../agents/base/strategy-agent"; import { AgentOutput } from "../types/agent-output"; import { GameState } from "../domains/base/game-state"; import { Action } from "../domains/base/action"; import { PolarisEngineTask } from "../types/task"; import { DecayState, DecayConfig, OrchestratorVerdict } from "../types/layer"; export interface LayerPipelineConfig { /** Task context for the pipeline */ task: PolarisEngineTask; /** Layer 1: Divergent generator agents (executed in parallel) */ divergentAgents: StrategyAgent[]; /** Layer 2: Inquisitor agent (single) */ inquisitorAgent: StrategyAgent; /** Layer 3: Synthesizer agent (single) */ synthesizerAgent: StrategyAgent; /** Layer 4: Orchestrator agent (single) */ orchestratorAgent: StrategyAgent; /** Decay parameter configuration */ decayConfig: DecayConfig; } export interface PipelineResult { /** The final delivered output (draft text) */ finalOutput: string; /** Total pipeline iterations executed */ totalIterations: number; /** Whether delivery was forced by maxIterations or budget exhaustion */ forcedDelivery: boolean; /** Reason for forced delivery (if applicable) */ forcedDeliveryReason?: "max_iterations" | "budget_exhausted" | "insufficient_agents"; /** Orchestrator verdict from the last iteration */ lastVerdict: OrchestratorVerdict; /** Per-layer timing breakdown for each iteration */ iterationBreakdowns: IterationBreakdown[]; /** All agent outputs from the final iteration */ finalAgentOutputs: AgentOutput[]; /** Total pipeline execution time in ms */ totalExecutionTime: number; /** Total tokens consumed across all iterations */ totalTokensConsumed: number; } export interface IterationBreakdown { iteration: number; divergentTimeMs: number; inquisitorTimeMs: number; synthesizerTimeMs: number; orchestratorTimeMs: number; totalTimeMs: number; verdict: OrchestratorVerdict; decayState: DecayState; tokensConsumed: number; agentsSurvived: number; agentsTimedOut: number; } export declare class LayerPipeline { private readonly config; private readonly logger; constructor(config: LayerPipelineConfig); /** * Execute the full pipeline with decay loop. */ execute(state: GameState, actions?: Action[]): Promise; private executeDivergentLayer; private executeInquisitorLayer; private executeSynthesizerLayer; private executeOrchestratorLayer; private buildForcedResult; private buildLayerMessage; private validateConfig; } //# sourceMappingURL=layer-pipeline.d.ts.map