/** * Dual-Mode Orchestrator * Runs Claude Code and Codex workers in parallel with shared memory */ import { EventEmitter } from 'events'; export interface WorkerCapabilityEnvelope { actions?: string[]; resources?: string[]; tools?: string[]; maxConcurrency?: number; network?: boolean; destructive?: boolean; delegationDepth?: number; expiresAt?: number; } export interface WorkerConfig { id: string; platform: 'claude' | 'codex'; role: string; prompt: string; model?: string; maxTurns?: number; timeout?: number; dependsOn?: string[]; /** Required for concurrent writing roles; each writer must own one cwd. */ worktreePath?: string; readOnly?: boolean; capabilityEnvelope?: WorkerCapabilityEnvelope; } export interface WorkerResult { id: string; platform: 'claude' | 'codex'; role: string; status: 'pending' | 'running' | 'completed' | 'failed' | 'skipped'; output?: string; error?: string; startedAt?: Date; completedAt?: Date; memoryKeys?: string[]; } export interface DualModeConfig { projectPath: string; /** One database shared by bootstrap, collection, policy, and worker CLIs. */ memoryDbPath?: string; maxConcurrent?: number; sharedNamespace?: string; timeout?: number; claudeCommand?: string; codexCommand?: string; maxOutputBytes?: number; maxWriters?: number; worktreeIsolation?: boolean; dependencyFailure?: 'cancel' | 'skip'; policyPreflight?: boolean; } export interface CollaborationResult { success: boolean; workers: WorkerResult[]; sharedMemory: Record; totalDuration: number; errors: string[]; } /** * Orchestrates parallel execution of Claude Code and Codex workers */ export declare class DualModeOrchestrator extends EventEmitter { private config; private workers; private processes; constructor(config: DualModeConfig); /** * Initialize shared memory for collaboration */ initializeSharedMemory(taskContext: string): Promise; /** * Spawn a headless worker */ spawnWorker(config: WorkerConfig): Promise; /** * Execute a headless Claude/Codex instance */ private executeHeadless; /** * Build a prompt that includes memory coordination instructions */ private buildCollaborativePrompt; /** * Wait for dependent workers to complete */ private waitForDependencies; /** * Run a swarm of collaborative workers */ runCollaboration(workers: WorkerConfig[], taskContext: string): Promise; /** * Build dependency levels for parallel execution */ private buildDependencyLevels; /** Preserve read-only parallelism while independently bounding writers. */ private partitionLevel; /** * Collect results from shared memory */ private collectSharedMemory; /** * Run a command and return output */ private runCommand; private authorizeWorker; private defaultWorkerEnvelope; private resolveWorkerEnvelope; private workerEnvironment; /** Keep every Ruflo subprocess on the same collaboration database. */ private sharedEnvironment; /** * Stop all running workers */ stopAll(): void; } export interface LoadedSwarmAutomationConfig { enabled: boolean; maxConcurrent: number; maxWriters: number; worktreeIsolation: boolean; agentTimeoutSeconds: number; maxOutputBytes: number; dependencyFailure: 'cancel' | 'skip'; } export declare function loadSwarmAutomationConfig(projectPath: string): LoadedSwarmAutomationConfig; /** * Pre-built collaboration templates */ export declare const CollaborationTemplates: { /** * Feature development swarm */ featureDevelopment: (feature: string) => WorkerConfig[]; /** * Security audit swarm */ securityAudit: (target: string) => WorkerConfig[]; /** * Refactoring swarm */ refactoring: (target: string) => WorkerConfig[]; }; //# sourceMappingURL=orchestrator.d.ts.map