import { MiniMaxToolCall } from "../minimax/client.js"; import { ToolResult } from "../types/index.js"; import { EventEmitter } from "events"; import { SessionStorage } from "../utils/session-storage.js"; import { ActionPlan } from "./action-planner.js"; export interface ChatEntry { type: "user" | "assistant" | "tool_result" | "tool_call"; content: string; timestamp: Date; toolCalls?: MiniMaxToolCall[]; toolCall?: MiniMaxToolCall; toolResult?: { success: boolean; output?: string; error?: string; }; isStreaming?: boolean; } export interface StreamingChunk { type: "content" | "tool_calls" | "tool_result" | "done" | "token_count"; content?: string; toolCalls?: MiniMaxToolCall[]; toolCall?: MiniMaxToolCall; toolResult?: ToolResult; tokenCount?: number; } export declare class MiniMaxAgent extends EventEmitter { private miniMaxClient; private textEditor; private morphEditor; private bash; private todoTool; private confirmationTool; private search; private sessionStorage; private actionPlanner; private subagentManager; private worktreeManager; private chatHistory; private messages; private tokenCounter; private abortController; private mcpInitialized; private maxToolRounds; constructor(apiKey: string, baseURL?: string, model?: string, maxToolRounds?: number); private initializeMCP; private isMiniMaxModel; private shouldUseSearchFor; processUserMessage(message: string): Promise; private messageReducer; private isValidJson; processUserMessageStream(message: string): AsyncGenerator; private executeTool; private executeMCPTool; /** * Manage context window by pruning old messages when limits are reached * This ensures the conversation history doesn't grow unbounded */ private manageContextWindow; getChatHistory(): ChatEntry[]; getCurrentDirectory(): string; executeBashCommand(command: string): Promise; getCurrentModel(): string; setModel(model: string): void; abortCurrentOperation(): void; /** * Execute a complex task using the IOEEA (Investigate, Observe, Evaluate, Execute, Act) autonomous loop */ executeTaskAutonomously(task: string): Promise<{ plan: ActionPlan; adaptation: any; success: boolean; }>; /** * Get session storage instance for external access */ getSessionStorage(): SessionStorage; /** * Multi-Instance Orchestration Methods */ /** * Detect and validate Git worktrees for multi-instance execution */ getWorktreeStatus(): Promise<{ worktrees: any[]; compatibility: any; recommendations: string[]; }>; /** * Create an isolated worktree for agent execution */ createIsolatedWorktree(baseBranch?: string, name?: string): Promise<{ success: boolean; worktreePath?: string; error?: string; }>; /** * Spawn a specialized subagent for specific tasks */ spawnSubagent(specialization: string, context: string, workingDirectory?: string): Promise; /** * Execute a task using a subagent */ executeWithSubagent(subagentId: string, task: string, priority?: 'low' | 'medium' | 'high'): Promise; /** * Get subagent statistics and status */ getSubagentStats(): any; /** * Clean up all subagents */ cleanupSubagents(): void; }