/** * Execution Context - Manages shared state between pipeline execution and variable resolution * * Separates concerns between: * - PipelineExecutor: Orchestrates stage execution (Command) * - VariableResolver: Resolves variables (Query) * - ExecutionContext: Manages shared state and coordination * * This implements Command Query Separation by ensuring: * - Commands (execution) don't perform queries (resolution) * - Queries (resolution) don't modify state * - State management is centralized in the context */ import type { EffectivePermissions } from '../security/permission-propagation.service.js'; import type { AgentConstraints } from '../types/agent.types.js'; import type { AllowedTool, IsolatedExecutionOptions, StageOutput } from '../types/command.types.js'; import type { LLMProvider } from '../types/llm.types.js'; import { VariableResolutionService } from './variable-resolution.service.js'; /** * Session information for tracking execution mode */ export interface ExecutionContextOptions { agentConstraints?: AgentConstraints; agentRole: string; allowedTools?: AllowedTool[]; args: string[]; commandName: string; delegationDepth?: number; flags: Record; initialStageOutputs?: Record>; interactive?: boolean; isolation?: IsolatedExecutionOptions; /** * Knowledge files to load from knowledge-base/ directory. * These are command-specific and loaded selectively to save tokens. */ knowledgeFiles?: string[]; mode?: string; model?: string; parentAgentRole?: string; provider: LLMProvider; sessionContext?: Record; /** * Session information for tracking execution mode (live vs resumed) */ sessionInfo?: SessionInfo; } export interface SessionInfo { /** Whether this is a resumed session (vs newly created) */ isResumed: boolean; /** The session ID */ sessionId: string; } /** * Execution Context - Coordinates between pipeline execution and variable resolution * * Responsible for: * - Maintaining execution state (stages, context, resolver) * - Coordinating between PipelineExecutor and VariableResolver * - Providing clean interfaces for both query and command operations */ export declare class ExecutionContext { readonly agentRole: string; readonly allowedTools?: AllowedTool[]; readonly args: string[]; readonly commandName: string; readonly delegationDepth: number; readonly effectiveConstraints: EffectivePermissions; readonly flags: Record; readonly interactive?: boolean; readonly isolation?: IsolatedExecutionOptions; readonly knowledgeFiles?: string[]; readonly mode?: string; readonly model?: string; readonly parentAgentRole?: string; readonly provider: LLMProvider; readonly sessionInfo?: SessionInfo; stages: Record>; private completedStages; private stageOutputs; private variableResolutionService; constructor(options: ExecutionContextOptions, variableResolutionService?: VariableResolutionService); /** * Get the variable resolution service for query operations * This allows stages to resolve variables without modifying state */ getVariableResolver(): VariableResolutionService; /** * Record a completed stage and update variable resolution context * This is the command operation that modifies state */ recordStageCompletion(stageOutput: StageOutput): void; /** * Get all stage outputs */ getStageOutputs(): StageOutput[]; /** * Check if a stage has been completed successfully */ isStageCompleted(stageName: string): boolean; /** * Get execution summary */ getExecutionSummary(): unknown; /** * Validate that all stage dependencies are satisfied * This is a query operation that checks state without modifying it */ validateStageDependencies(stageInputs?: Record): string[]; /** * Create the initial variable resolution service with context */ private createVariableResolutionService; } //# sourceMappingURL=execution-context.d.ts.map