import type { ModelTier } from './multi-agent.js';
/** Supported orchestration topologies. */
export type RuntimeTopologyType = 'mesh' | 'hierarchical' | 'pipeline' | 'star';
/** How agents are spawned. */
export type RuntimeSpawnMethod = 'cli-subprocess' | 'mcp-client' | 'http-endpoint';
/** Lifecycle status of a spawned agent process. */
export type RuntimeAgentStatus = 'pending' | 'spawning' | 'running' | 'completed' | 'failed' | 'cancelled';
/** Status of a distributed task. */
export type RuntimeTaskStatus = 'queued' | 'assigned' | 'in_progress' | 'completed' | 'failed';
/** Strategy for resolving file conflicts between agents. */
export type RuntimeConflictStrategy = 'last-wins' | 'first-wins' | 'merge-auto' | 'flag-for-review';
/** Overall session status. */
export type RuntimeSessionStatus = 'initializing' | 'running' | 'completed' | 'failed' | 'cancelled';
/** Configuration for an orchestration run. */
export interface RuntimeOrchestrationConfig {
    topology: RuntimeTopologyType;
    tasks: RuntimeTaskDescription[];
    agents?: RuntimeAgentConfig[];
    options: RuntimeOrchestrationOptions;
}
/** Options controlling orchestration behavior. */
export interface RuntimeOrchestrationOptions {
    maxRetries: number;
    timeoutMs: number;
    failFast: boolean;
    spawnMethod: RuntimeSpawnMethod;
    conflictStrategy: RuntimeConflictStrategy;
    dryRun: boolean;
}
/** Description of a task to be distributed. */
export interface RuntimeTaskDescription {
    id: string;
    description: string;
    requirements: string[];
    files: string[];
    dependencies: string[];
    priority: number;
    critical: boolean;
}
/** Configuration for an agent to spawn. */
export interface RuntimeAgentConfig {
    id: string;
    command: string;
    args: string[];
    capabilities: string[];
    modelTier?: ModelTier;
    workDir?: string;
}
/** Assignment of a task to a specific agent. */
export interface RuntimeTaskAssignment {
    taskId: string;
    agentId: string;
    files: string[];
    context: string;
    priority: number;
    dependencies: string[];
}
/** Runtime state of a spawned agent process. */
export interface RuntimeAgentProcess {
    agentId: string;
    pid: number;
    status: RuntimeAgentStatus;
    startedAt: string;
    completedAt?: string;
    stdout: string;
    stderr: string;
    exitCode?: number;
    retryCount: number;
    tokensUsed?: number;
}
/** In-memory session tracking an orchestration run. */
export interface RuntimeOrchestrationSession {
    id: string;
    topology: RuntimeTopologyType;
    config: RuntimeOrchestrationConfig;
    agents: RuntimeAgentProcess[];
    tasks: RuntimeTaskAssignment[];
    status: RuntimeSessionStatus;
    startedAt: string;
    completedAt?: string;
    fileOwnershipMap: Record<string, string>;
}
/** Result entry for a single task. */
export interface RuntimeTaskResultEntry {
    taskId: string;
    agentId: string;
    status: RuntimeTaskStatus;
    output: unknown;
    duration: number;
}
/** Record of a file conflict between agents. */
export interface RuntimeConflictRecord {
    file: string;
    agents: string[];
    strategy: RuntimeConflictStrategy;
    resolved: boolean;
    resolution?: string;
}
/** Cost breakdown for an orchestration run. */
export interface RuntimeOrchestrationCost {
    tokens: number;
    usd: number;
    breakdown: Record<string, {
        tokens: number;
        usd: number;
    }>;
}
/** Final result of an orchestration run. */
export interface RuntimeOrchestrationResult {
    sessionId: string;
    agents: RuntimeAgentProcess[];
    tasks: RuntimeTaskResultEntry[];
    outputs: Record<string, unknown>;
    conflicts: RuntimeConflictRecord[];
    duration: number;
    totalCost: RuntimeOrchestrationCost;
}
/** Pre-defined orchestration template. */
export interface RuntimeOrchestrationTemplate {
    id: string;
    name: string;
    description: string;
    topology: RuntimeTopologyType;
    agentRoles: RuntimeTemplateAgentRole[];
    defaultOptions: Partial<RuntimeOrchestrationOptions>;
    taskDecompositionStrategy: string;
}
/** Agent role within a template. */
export interface RuntimeTemplateAgentRole {
    role: string;
    capabilities: string[];
    modelTier: ModelTier;
    count: number | 'dynamic';
}
/** Progress event emitted during orchestration. */
export interface RuntimeProgressEvent {
    sessionId: string;
    agentId?: string;
    taskId?: string;
    type: 'agent-status' | 'task-status' | 'conflict' | 'completion';
    data: unknown;
    timestamp: string;
}
/** Execution node in a topology-planned DAG. */
export interface RuntimeExecutionNode {
    taskId: string;
    agentId: string;
    dependencies: string[];
    phase: number;
}
/** Execution graph returned by topology planners. */
export interface RuntimeExecutionGraph {
    nodes: RuntimeExecutionNode[];
    phases: number;
    topology: RuntimeTopologyType;
}
/** Input for the orchestrate_runtime MCP tool. */
export interface OrchestrateRuntimeInput {
    topology: RuntimeTopologyType;
    tasks: RuntimeTaskDescription[];
    agents?: RuntimeAgentConfig[];
    maxRetries?: number;
    timeoutMs?: number;
    failFast?: boolean;
    spawnMethod?: RuntimeSpawnMethod;
    conflictStrategy?: RuntimeConflictStrategy;
    dryRun?: boolean;
    templateId?: string;
}
/** Input for the agent_swarm_status MCP tool. */
export interface AgentSwarmStatusInput {
    sessionId?: string;
    status?: 'running' | 'completed' | 'failed';
    agentId?: string;
}
/** Handoff package generated for an agent. */
export interface RuntimeHandoffPackage {
    agentId: string;
    role: string;
    filesToRead: string[];
    filesToModify: string[];
    restrictions: string[];
    instructions: string;
    context: string;
    successCriteria: string[];
    dependencies: string[];
}
/** Agent spawn command descriptor. */
export interface RuntimeSpawnDescriptor {
    command: string;
    args: string[];
    env: Record<string, string>;
    cwd: string;
    timeoutMs: number;
}
/** Progress callback signature. */
export type RuntimeProgressCallback = (event: RuntimeProgressEvent) => void;
//# sourceMappingURL=orchestration-runtime.d.ts.map