/** * Strategy-aware base agent. Replaces layer-mode conditionals with * injected PromptStrategy and OutputParserStrategy. * * This class is BLIND to which layer it operates in. * It delegates prompt construction and output parsing entirely to strategies. * * The original BaseAgent remains untouched for backwards compatibility. * StrategyAgent extends it and overrides the relevant methods. */ import { BaseAgent } from "./agent"; import { GameState } from "../../domains/base/game-state"; import { Action } from "../../domains/base/action"; import { AgentOutput } from "../../types/agent-output"; import { AgentParameters } from "./parameters"; import { AgentRole, PolarisEngineTask } from "../../types/task"; import { PromptStrategy, PromptContext, CumulativeTokenUsage } from "../../strategies/prompt-strategy"; import { OutputParserStrategy, RawLLMResponse } from "../../strategies/output-parser-strategy"; import { LayerMessage } from "../../types/layer"; /** * Configuration for a strategy-aware agent. */ export interface StrategyAgentConfig { id?: string; name: string; type: string; role: AgentRole; task: PolarisEngineTask; parameters: AgentParameters; /** Injected prompt construction strategy */ promptStrategy: PromptStrategy; /** Injected output parsing strategy */ outputParserStrategy: OutputParserStrategy; } /** * Abstract base for strategy-aware agents. * Contains NO conditionals about layers, prompt formats, or output parsing. * All behavioral variation is encapsulated in the injected strategies. */ export declare abstract class StrategyAgent extends BaseAgent { protected readonly promptStrategy: PromptStrategy; protected readonly outputParserStrategy: OutputParserStrategy; /** * Mutable: set by the pipeline before calling evaluate(). * Contains the message from the previous layer (if any). */ private _currentLayerMessage; /** * Mutable: set by the pipeline before calling evaluate(). * Current pipeline iteration for decay computation. */ private _currentPipelineIteration; /** * Mutable: set by the pipeline before calling evaluate(). * Decay-adjusted temperature override. */ private _effectiveTemperatureDelta; /** * Mutable: set by the pipeline before calling evaluate(). * Cumulative token usage for cost-aware routing. */ private _cumulativeTokenUsage; protected constructor(config: StrategyAgentConfig); /** * Inject the incoming layer message before evaluation. * Called by the pipeline orchestrator — the agent never calls this on itself. */ setLayerMessage(message: LayerMessage | undefined): void; /** * Inject pipeline iteration and temperature delta from the Decay system. */ setDecayParameters(iteration: number, temperatureDelta: number): void; /** * Inject cumulative token usage for cost-aware routing (Layer 4). */ setTokenUsage(usage: CumulativeTokenUsage): void; /** * Build the full prompt context for strategy delegation. * This is the ONLY place where context is assembled — NO conditional logic. */ protected buildPromptContext(state: GameState, actions?: Action[]): PromptContext; /** * Delegate system prompt construction to the injected strategy. */ protected getSystemPrompt(context: PromptContext): string; /** * Delegate user prompt construction to the injected strategy. */ protected getUserPrompt(context: PromptContext): string; /** * Get the effective temperature from the strategy. */ protected getEffectiveTemperature(context: PromptContext): number | undefined; /** * Get the effective max tokens from the strategy. */ protected getEffectiveMaxTokens(context: PromptContext): number | undefined; /** * Delegate output parsing to the injected strategy. * Converts the raw LLM response into an AgentOutput using the * parent BaseAgent's createAgentOutput factory method. */ protected parseResponse(rawResponse: RawLLMResponse): AgentOutput; } //# sourceMappingURL=strategy-agent.d.ts.map