@sethdouglasford/claude-flow
Version:
Claude Code Flow - Advanced AI-powered development workflows with SPARC methodology
138 lines • 4.58 kB
TypeScript
/**
* Task Coordination Layer - Integrates with TodoWrite/TodoRead and Memory for orchestration
* Provides seamless coordination between task management and Claude Code batch tools
*/
import { EventEmitter } from "events";
import { TaskEngine } from "./engine.js";
export interface TodoItem {
id: string;
content: string;
status: "pending" | "in_progress" | "completed";
priority: "high" | "medium" | "low";
dependencies?: string[];
estimatedTime?: string;
assignedAgent?: string;
batchOptimized?: boolean;
parallelExecution?: boolean;
memoryKey?: string;
tags?: string[];
metadata?: Record<string, unknown>;
}
export interface MemoryEntry {
key: string;
value: any;
timestamp: Date;
namespace?: string;
tags?: string[];
expiresAt?: Date;
}
export interface CoordinationContext {
sessionId: string;
agentId?: string;
workflowId?: string;
batchId?: string;
parentTaskId?: string;
coordinationMode: "centralized" | "distributed" | "hierarchical" | "mesh" | "hybrid";
}
export declare class TaskCoordinator extends EventEmitter {
private taskEngine;
private memoryManager?;
private todoItems;
private memoryStore;
private coordinationSessions;
private batchOperations;
private agentCoordination;
constructor(taskEngine: TaskEngine, memoryManager?: any | undefined);
private setupCoordinationHandlers;
/**
* Create TodoWrite-style task breakdown for complex operations
*/
createTaskTodos(objective: string, context: CoordinationContext, options?: {
strategy?: "research" | "development" | "analysis" | "testing" | "optimization" | "maintenance";
maxTasks?: number;
batchOptimized?: boolean;
parallelExecution?: boolean;
memoryCoordination?: boolean;
}): Promise<TodoItem[]>;
/**
* Update TodoRead-style progress tracking
*/
updateTodoProgress(todoId: string, status: "pending" | "in_progress" | "completed", metadata?: Record<string, unknown>): Promise<void>;
/**
* Read all todos for coordination (TodoRead equivalent)
*/
readTodos(sessionId?: string, filter?: {
status?: TodoItem["status"][];
priority?: TodoItem["priority"][];
assignedAgent?: string;
tags?: string[];
batchOptimized?: boolean;
}): Promise<TodoItem[]>;
/**
* Store data in Memory for cross-agent coordination
*/
storeInMemory(key: string, value: any, options?: {
namespace?: string;
tags?: string[];
expiresAt?: Date;
}): Promise<void>;
/**
* Retrieve data from Memory for coordination
*/
retrieveFromMemory(key: string, namespace?: string): Promise<any | null>;
/**
* Query Memory with filters for coordination
*/
queryMemory(query: {
namespace?: string;
tags?: string[];
keyPattern?: string;
since?: Date;
limit?: number;
}): Promise<MemoryEntry[]>;
/**
* Launch parallel agents using Task tool pattern
*/
launchParallelAgents(tasks: Array<{
agentType: string;
objective: string;
mode?: string;
configuration?: Record<string, unknown>;
memoryKey?: string;
batchOptimized?: boolean;
}>, coordinationContext: CoordinationContext): Promise<string[]>;
/**
* Coordinate batch operations for maximum efficiency
*/
coordinateBatchOperations(operations: Array<{
type: "read" | "write" | "edit" | "search" | "analyze";
targets: string[];
configuration?: Record<string, unknown>;
}>, context: CoordinationContext): Promise<Map<string, any>>;
/**
* Swarm coordination patterns based on mode
*/
coordinateSwarm(objective: string, context: CoordinationContext, agents: Array<{
type: string;
role: string;
capabilities: string[];
}>): Promise<void>;
private generateTaskBreakdown;
private createTaskFromTodo;
private priorityToNumber;
private launchAgent;
private executeBatchOperationType;
private simulateBatchOperation;
private coordinateCentralizedSwarm;
private coordinateDistributedSwarm;
private coordinateHierarchicalSwarm;
private coordinateMeshSwarm;
private coordinateHybridSwarm;
private getSessionTodos;
private handleTaskCreated;
private handleTaskStarted;
private handleTaskCompleted;
private handleTaskFailed;
private handleTaskCancelled;
}
//# sourceMappingURL=coordination.d.ts.map