108 lines
2.7 KiB
TypeScript
108 lines
2.7 KiB
TypeScript
/**
|
|
* Dual-Mode Orchestrator
|
|
* Runs Claude Code and Codex workers in parallel with shared memory
|
|
*/
|
|
import { EventEmitter } from 'events';
|
|
export interface WorkerConfig {
|
|
id: string;
|
|
platform: 'claude' | 'codex';
|
|
role: string;
|
|
prompt: string;
|
|
model?: string;
|
|
maxTurns?: number;
|
|
timeout?: number;
|
|
dependsOn?: string[];
|
|
}
|
|
export interface WorkerResult {
|
|
id: string;
|
|
platform: 'claude' | 'codex';
|
|
role: string;
|
|
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
output?: string;
|
|
error?: string;
|
|
startedAt?: Date;
|
|
completedAt?: Date;
|
|
memoryKeys?: string[];
|
|
}
|
|
export interface DualModeConfig {
|
|
projectPath: string;
|
|
maxConcurrent?: number;
|
|
sharedNamespace?: string;
|
|
timeout?: number;
|
|
claudeCommand?: string;
|
|
codexCommand?: string;
|
|
}
|
|
export interface CollaborationResult {
|
|
success: boolean;
|
|
workers: WorkerResult[];
|
|
sharedMemory: Record<string, any>;
|
|
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<void>;
|
|
/**
|
|
* Spawn a headless worker
|
|
*/
|
|
spawnWorker(config: WorkerConfig): Promise<void>;
|
|
/**
|
|
* 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<CollaborationResult>;
|
|
/**
|
|
* Build dependency levels for parallel execution
|
|
*/
|
|
private buildDependencyLevels;
|
|
/**
|
|
* Collect results from shared memory
|
|
*/
|
|
private collectSharedMemory;
|
|
/**
|
|
* Run a command and return output
|
|
*/
|
|
private runCommand;
|
|
/**
|
|
* Stop all running workers
|
|
*/
|
|
stopAll(): void;
|
|
}
|
|
/**
|
|
* 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
|