UNPKG

cortexweaver

Version:

CortexWeaver is a command-line interface (CLI) tool that orchestrates a swarm of specialized AI agents, powered by Claude Code and Gemini CLI, to assist in software development. It transforms a high-level project plan (plan.md) into a series of coordinate

118 lines 4.05 kB
import { ClaudeClient, SendMessageOptions, ClaudeResponse, Message } from './claude-client'; import { WorkspaceManager, CommandResult } from './workspace'; import { CognitiveCanvas, TaskData } from './cognitive-canvas'; import { SessionManager, SessionInfo } from './session'; import { AgentConfig, TaskContext, TaskResult, AgentStatus } from './types/agent-types'; import { AgentErrorHandler } from './agent-error-handling'; import { AgentSessionManager } from './agent-session-management'; /** * Abstract base class for all CortexWeaver agents * Provides common functionality for specialized agent implementations */ export declare abstract class Agent { protected config: AgentConfig | null; protected claudeClient: ClaudeClient | null; protected workspace: WorkspaceManager | null; protected cognitiveCanvas: CognitiveCanvas | null; protected sessionManager: SessionManager | null; protected currentTask: TaskData | null; protected taskContext: TaskContext | null; protected status: AgentStatus; protected lastError: Error | null; protected currentSession: SessionInfo | null; protected conversationHistory: Message[]; protected errorHandler: AgentErrorHandler | null; protected sessionMgr: AgentSessionManager | null; /** * Initialize the agent with configuration */ initialize(config: AgentConfig): Promise<void>; /** * Receive a task assignment with context */ receiveTask(task: TaskData, context: TaskContext): Promise<void>; /** * Execute the assigned task */ run(): Promise<TaskResult>; /** * Abstract method to be implemented by specific agents */ abstract executeTask(): Promise<any>; /** * Abstract method to get agent-specific prompt template */ abstract getPromptTemplate(): string; /** * Send message to Claude API */ sendToClaude(message: string, options?: Partial<SendMessageOptions>): Promise<ClaudeResponse>; /** * Read file from workspace */ readFile(filePath: string): Promise<string>; /** * Write file to workspace */ writeFile(filePath: string, content: string): Promise<void>; /** * Execute command in workspace */ executeCommand(command: string): Promise<CommandResult>; /** * Report progress to Cognitive Canvas */ reportProgress(status: string, details: string, strength?: number): Promise<void>; /** * Report impasse - delegated to error handler */ reportImpasse(reason: string, context?: Record<string, any>, urgency?: 'low' | 'medium' | 'high'): Promise<void>; /** * Handle errors - delegated to error handler */ handleError(error: Error): Promise<void>; /** * Create session - delegated to session manager */ createSession(): Promise<SessionInfo>; /** * Run command in session - delegated to session manager */ runInSession(command: string): Promise<any>; /** * Format prompt template with context variables */ formatPrompt(template: string, context: Record<string, any>): string; /** * Reset agent state */ reset(): Promise<void>; /** * Update configuration */ updateConfig(updates: Partial<AgentConfig>): void; getId(): string; getRole(): string; getCapabilities(): string[]; getStatus(): AgentStatus; getCurrentTask(): TaskData | null; getTaskContext(): TaskContext | null; getLastError(): Error | null; /** * Set the last error (primarily for testing purposes) */ setLastError(error: Error | null): void; getConfig(): AgentConfig | null; getWorkspace(): WorkspaceManager | null; getCognitiveCanvas(): CognitiveCanvas | null; setStatus(status: AgentStatus): void; /** * Update helper components with current state */ private updateHelperComponents; /** * Validate agent configuration */ private validateConfig; } //# sourceMappingURL=agent-base.d.ts.map