/** * @holoscript/core - Choreography Planner * * Creates and validates choreography execution plans. * Part of HoloScript v3.1 Agentic Choreography. */ import type { AgentManifest } from '@holoscript/framework/agents'; import type { CapabilityQuery } from '@holoscript/framework/agents'; import type { ChoreographyPlan, ExecutionConstraint, StepIO } from './ChoreographyTypes'; /** * Step definition for plan builder */ export interface StepDefinition { /** Step ID (auto-generated if not provided) */ id?: string; /** Step name */ name?: string; /** Description */ description?: string; /** Agent ID or capability query */ agent: string | CapabilityQuery; /** Action to execute */ action: string; /** Input parameters */ inputs?: Record; /** Output definitions */ outputs?: Record; /** Dependencies (step IDs) */ dependencies?: string[]; /** Alias for dependencies (step names or IDs) */ dependsOn?: string[]; /** Parallel execution group */ parallelGroup?: string; /** Timeout (ms) */ timeout?: number; /** Max retries */ retries?: number; /** Condition expression */ condition?: string; /** Whether this is a HITL gate */ hitlGate?: boolean; /** ID of step to execute if this step fails */ fallbackStepId?: string; } /** * Plan definition for planner */ export interface PlanDefinition { /** Plan name */ name?: string; /** Goal description */ goal: string; /** Available agents */ agents: AgentManifest[]; /** Step definitions */ steps: StepDefinition[]; /** Constraints */ constraints?: ExecutionConstraint[]; /** Fallback plan */ fallback?: PlanDefinition; /** Priority */ priority?: number; /** Tags */ tags?: string[]; /** Custom metadata */ metadata?: Record; } /** * Validation result */ export interface PlanValidationResult { valid: boolean; errors: string[]; warnings: string[]; } /** * Execution order result */ export interface ExecutionOrder { /** Groups of steps that can run in parallel */ parallelGroups: string[][]; /** Flat ordered list (topological sort) */ flatOrder: string[]; /** Dependency graph */ graph: Map; } /** * Creates and validates choreography plans */ export declare class ChoreographyPlanner { private matcher; /** * Create a choreography plan from definition */ createPlan(definition: PlanDefinition): ChoreographyPlan; /** * Validate a choreography plan */ validate(plan: ChoreographyPlan): PlanValidationResult; /** * Calculate execution order */ calculateExecutionOrder(plan: ChoreographyPlan): ExecutionOrder; /** * Clone and reset a plan for re-execution */ resetPlan(plan: ChoreographyPlan): ChoreographyPlan; /** * Resolve agent from ID or capability query */ private resolveAgent; /** * Detect circular dependencies */ private detectCycles; } /** * Fluent builder for choreography plans */ export declare class PlanBuilder { private definition; private planner; constructor(goal: string); /** * Set plan name */ name(name: string): this; /** * Add an agent to the plan */ agent(manifest: AgentManifest): this; /** * Add multiple agents */ agents(manifests: AgentManifest[]): this; /** * Add a step to the plan */ step(definition: StepDefinition): this; /** * Add a constraint */ constraint(constraint: ExecutionConstraint): this; /** * Set timeout constraint */ timeout(ms: number): this; /** * Set concurrency constraint */ concurrency(max: number): this; /** * Set fallback plan */ fallback(fallbackPlan: PlanDefinition): this; /** * Set priority */ priority(priority: number): this; /** * Add tags */ tags(...tags: string[]): this; /** * Set metadata */ metadata(meta: Record): this; /** * Build and validate the plan */ build(): ChoreographyPlan; /** * Build without validation (for testing) */ buildUnsafe(): ChoreographyPlan; } /** * Create a new plan builder */ export declare function plan(goal: string): PlanBuilder; /** * Get default planner */ export declare function getDefaultPlanner(): ChoreographyPlanner; //# sourceMappingURL=ChoreographyPlanner.d.ts.map