claude-flow 2.5.0-alpha.139 → 2.7.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/.claude/agents/reasoning/README.md +171 -0
  2. package/.claude/agents/reasoning/agent.md +816 -0
  3. package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
  4. package/.claude/agents/reasoning/goal-planner.md +73 -0
  5. package/.claude/settings.json +2 -1
  6. package/.claude/sparc-modes.json +108 -0
  7. package/README.md +45 -55
  8. package/bin/claude-flow +1 -1
  9. package/dist/src/cli/command-registry.js +70 -6
  10. package/dist/src/cli/command-registry.js.map +1 -1
  11. package/dist/src/cli/commands/hive-mind/pause.js +2 -9
  12. package/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
  13. package/dist/src/cli/commands/index.js +1 -114
  14. package/dist/src/cli/commands/index.js.map +1 -1
  15. package/dist/src/cli/commands/swarm-spawn.js +5 -33
  16. package/dist/src/cli/commands/swarm-spawn.js.map +1 -1
  17. package/dist/src/cli/help-formatter.js +0 -3
  18. package/dist/src/cli/help-formatter.js.map +1 -1
  19. package/dist/src/cli/help-text.js +69 -7
  20. package/dist/src/cli/help-text.js.map +1 -1
  21. package/dist/src/cli/simple-cli.js +182 -172
  22. package/dist/src/cli/simple-cli.js.map +1 -1
  23. package/dist/src/cli/simple-commands/agent-booster.js +415 -0
  24. package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
  25. package/dist/src/cli/simple-commands/agent.js +856 -13
  26. package/dist/src/cli/simple-commands/agent.js.map +1 -1
  27. package/dist/src/cli/simple-commands/env-template.js +180 -0
  28. package/dist/src/cli/simple-commands/env-template.js.map +1 -0
  29. package/dist/src/cli/simple-commands/hooks.js +233 -0
  30. package/dist/src/cli/simple-commands/hooks.js.map +1 -1
  31. package/dist/src/cli/simple-commands/init/help.js +23 -0
  32. package/dist/src/cli/simple-commands/init/help.js.map +1 -1
  33. package/dist/src/cli/simple-commands/init/index.js +63 -0
  34. package/dist/src/cli/simple-commands/init/index.js.map +1 -1
  35. package/dist/src/cli/simple-commands/memory.js +307 -16
  36. package/dist/src/cli/simple-commands/memory.js.map +1 -1
  37. package/dist/src/cli/simple-commands/proxy.js +304 -0
  38. package/dist/src/cli/simple-commands/proxy.js.map +1 -0
  39. package/dist/src/cli/simple-commands/sparc.js +16 -19
  40. package/dist/src/cli/simple-commands/sparc.js.map +1 -1
  41. package/dist/src/cli/validation-helper.js.map +1 -1
  42. package/dist/src/execution/agent-executor.js +181 -0
  43. package/dist/src/execution/agent-executor.js.map +1 -0
  44. package/dist/src/execution/index.js +12 -0
  45. package/dist/src/execution/index.js.map +1 -0
  46. package/dist/src/execution/provider-manager.js +110 -0
  47. package/dist/src/execution/provider-manager.js.map +1 -0
  48. package/dist/src/hooks/index.js +0 -3
  49. package/dist/src/hooks/index.js.map +1 -1
  50. package/dist/src/hooks/redaction-hook.js +89 -0
  51. package/dist/src/hooks/redaction-hook.js.map +1 -0
  52. package/dist/src/mcp/claude-flow-tools.js +205 -150
  53. package/dist/src/mcp/claude-flow-tools.js.map +1 -1
  54. package/dist/src/mcp/mcp-server.js +125 -0
  55. package/dist/src/mcp/mcp-server.js.map +1 -1
  56. package/dist/src/sdk/query-control.js +293 -139
  57. package/dist/src/sdk/query-control.js.map +1 -1
  58. package/dist/src/sdk/session-forking.js +206 -129
  59. package/dist/src/sdk/session-forking.js.map +1 -1
  60. package/dist/src/utils/key-redactor.js +108 -0
  61. package/dist/src/utils/key-redactor.js.map +1 -0
  62. package/dist/src/utils/metrics-reader.js +37 -39
  63. package/dist/src/utils/metrics-reader.js.map +1 -1
  64. package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
  65. package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
  66. package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
  67. package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
  68. package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
  69. package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
  70. package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
  71. package/docs/COMMIT_SUMMARY.md +247 -0
  72. package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
  73. package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
  74. package/docs/ENV-SETUP-GUIDE.md +270 -0
  75. package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
  76. package/docs/FINAL_VALIDATION_REPORT.md +165 -0
  77. package/docs/HOOKS-V2-MODIFICATION.md +146 -0
  78. package/docs/INDEX.md +568 -0
  79. package/docs/INTEGRATION_COMPLETE.md +414 -0
  80. package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
  81. package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
  82. package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
  83. package/docs/README.md +35 -0
  84. package/docs/REASONING-AGENTS.md +482 -0
  85. package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
  86. package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
  87. package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
  88. package/docs/REASONINGBANK-BENCHMARK.md +396 -0
  89. package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
  90. package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
  91. package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
  92. package/docs/REASONINGBANK-DEMO.md +419 -0
  93. package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
  94. package/docs/REASONINGBANK-VALIDATION.md +532 -0
  95. package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
  96. package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
  97. package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
  98. package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
  99. package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
  100. package/docs/api/API_DOCUMENTATION.md +721 -0
  101. package/docs/architecture/ARCHITECTURE.md +1690 -0
  102. package/docs/ci-cd/README.md +368 -0
  103. package/docs/development/DEPLOYMENT.md +2348 -0
  104. package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
  105. package/docs/development/build-analysis-report.md +252 -0
  106. package/docs/development/pair-optimization.md +156 -0
  107. package/docs/development/token-tracking-status.md +103 -0
  108. package/docs/development/training-pipeline-demo.md +163 -0
  109. package/docs/development/training-pipeline-real-only.md +196 -0
  110. package/docs/epic-sdk-integration.md +1269 -0
  111. package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
  112. package/docs/experimental/computational_verification.py +436 -0
  113. package/docs/experimental/novel_approaches.md +560 -0
  114. package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
  115. package/docs/experimental/riemann_proof_attempt.md +124 -0
  116. package/docs/experimental/riemann_synthesis.md +277 -0
  117. package/docs/experimental/verification_results.json +12 -0
  118. package/docs/experimental/visualization_insights.md +720 -0
  119. package/docs/guides/USER_GUIDE.md +1138 -0
  120. package/docs/guides/token-tracking-guide.md +291 -0
  121. package/docs/reference/AGENTS.md +1011 -0
  122. package/docs/reference/MCP_TOOLS.md +2188 -0
  123. package/docs/reference/SPARC.md +717 -0
  124. package/docs/reference/SWARM.md +2000 -0
  125. package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
  126. package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
  127. package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
  128. package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
  129. package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
  130. package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
  131. package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
  132. package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
  133. package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
  134. package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
  135. package/docs/sdk/epic-sdk-integration.md +1269 -0
  136. package/docs/setup/remote-setup.md +93 -0
  137. package/docs/validation/final-validation-summary.md +220 -0
  138. package/docs/validation/verification-integration.md +190 -0
  139. package/docs/validation/verification-validation.md +349 -0
  140. package/docs/wiki/background-commands.md +1213 -0
  141. package/docs/wiki/session-persistence.md +342 -0
  142. package/docs/wiki/stream-chain-command.md +537 -0
  143. package/package.json +4 -2
  144. package/src/cli/command-registry.js +70 -5
  145. package/src/cli/commands/hive-mind/pause.ts +2 -15
  146. package/src/cli/commands/index.ts +1 -84
  147. package/src/cli/commands/swarm-spawn.ts +3 -47
  148. package/src/cli/help-text.js +42 -7
  149. package/src/cli/simple-cli.ts +18 -8
  150. package/src/cli/simple-commands/agent-booster.js +515 -0
  151. package/src/cli/simple-commands/agent.js +1001 -12
  152. package/src/cli/simple-commands/agent.ts +137 -0
  153. package/src/cli/simple-commands/config.ts +127 -0
  154. package/src/cli/simple-commands/env-template.js +190 -0
  155. package/src/cli/simple-commands/hooks.js +310 -0
  156. package/src/cli/simple-commands/init/help.js +23 -0
  157. package/src/cli/simple-commands/init/index.js +84 -6
  158. package/src/cli/simple-commands/memory.js +363 -16
  159. package/src/cli/simple-commands/proxy.js +384 -0
  160. package/src/cli/simple-commands/sparc.js +16 -19
  161. package/src/execution/agent-executor.ts +306 -0
  162. package/src/execution/index.ts +19 -0
  163. package/src/execution/provider-manager.ts +187 -0
  164. package/src/hooks/index.ts +0 -5
  165. package/src/hooks/redaction-hook.ts +115 -0
  166. package/src/mcp/claude-flow-tools.ts +203 -120
  167. package/src/mcp/mcp-server.js +86 -0
  168. package/src/sdk/query-control.ts +377 -223
  169. package/src/sdk/session-forking.ts +312 -207
  170. package/src/utils/key-redactor.js +178 -0
  171. package/src/utils/key-redactor.ts +184 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/mcp/claude-flow-tools.ts"],"sourcesContent":["/**\n * Claude-Flow specific MCP tools\n */\n\nimport type { MCPTool, MCPContext, AgentProfile, Task, MemoryEntry } from '../utils/types.js';\nimport type { ILogger } from '../core/logger.js';\nimport { getAvailableAgentTypes, getAgentTypeSchema } from '../constants/agent-types.js';\nimport type { Permissions } from './auth.js';\n\nexport interface ClaudeFlowToolContext extends MCPContext {\n orchestrator?: any; // Reference to orchestrator instance\n}\n\n/**\n * Enhance tool schema with dynamic agent types\n */\nasync function enhanceToolWithAgentTypes(tool: MCPTool): Promise<MCPTool> {\n const availableTypes = await getAvailableAgentTypes();\n \n // Clone the tool to avoid modifying the original\n const enhancedTool = JSON.parse(JSON.stringify(tool));\n \n // Find and populate enum fields for agent types\n function addEnumToAgentTypeFields(obj: any) {\n if (typeof obj !== 'object' || obj === null) return;\n \n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'object' && value !== null) {\n // Check if this is an agent type field\n if (key === 'type' || key === 'filterByType' || key === 'assignToAgentType') {\n const field = value as any;\n if (field.type === 'string' && field.description?.includes('loaded dynamically from .claude/agents/')) {\n field.enum = availableTypes;\n }\n }\n addEnumToAgentTypeFields(value);\n }\n }\n }\n \n addEnumToAgentTypeFields(enhancedTool.inputSchema);\n return enhancedTool;\n}\n\n/**\n * Create all Claude-Flow specific MCP tools\n */\nexport async function createClaudeFlowTools(logger: ILogger): Promise<MCPTool[]> {\n const tools = [\n // Agent management tools\n createSpawnAgentTool(logger),\n createListAgentsTool(logger),\n createTerminateAgentTool(logger),\n createGetAgentInfoTool(logger),\n\n // SDK Session Management Tools (NEW: SDK Integration)\n\n // Task management tools\n createCreateTaskTool(logger),\n createListTasksTool(logger),\n createGetTaskStatusTool(logger),\n createCancelTaskTool(logger),\n createAssignTaskTool(logger),\n\n // Memory management tools\n createQueryMemoryTool(logger),\n createStoreMemoryTool(logger),\n createDeleteMemoryTool(logger),\n createExportMemoryTool(logger),\n createImportMemoryTool(logger),\n\n // System monitoring tools\n createGetSystemStatusTool(logger),\n createGetMetricsTool(logger),\n createHealthCheckTool(logger),\n\n // Configuration tools\n createGetConfigTool(logger),\n createUpdateConfigTool(logger),\n createValidateConfigTool(logger),\n\n // Workflow tools\n createExecuteWorkflowTool(logger),\n createCreateWorkflowTool(logger),\n createListWorkflowsTool(logger),\n\n // Terminal management tools\n createExecuteCommandTool(logger),\n createListTerminalsTool(logger),\n createCreateTerminalTool(logger),\n ];\n\n // Enhance tools with dynamic agent types\n const enhancedTools = await Promise.all(\n tools.map(tool => enhanceToolWithAgentTypes(tool))\n );\n\n return enhancedTools;\n}\n\nfunction createSpawnAgentTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/spawn',\n description: 'Spawn a new Claude agent with specified configuration',\n inputSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n // Note: enum will be populated dynamically at runtime\n description: 'Type of specialized agent to spawn (loaded dynamically from .claude/agents/)',\n },\n name: {\n type: 'string',\n description: 'Display name for the agent',\n },\n capabilities: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of capabilities for the agent',\n },\n systemPrompt: {\n type: 'string',\n description: 'Custom system prompt for the agent',\n },\n maxConcurrentTasks: {\n type: 'number',\n default: 3,\n description: 'Maximum number of concurrent tasks',\n },\n priority: {\n type: 'number',\n default: 5,\n description: 'Agent priority level (1-10)',\n },\n environment: {\n type: 'object',\n description: 'Environment variables for the agent',\n },\n workingDirectory: {\n type: 'string',\n description: 'Working directory for the agent',\n },\n },\n required: ['type', 'name'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Spawning agent', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const profile: AgentProfile = {\n id: `agent_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,\n name: input.name,\n type: input.type,\n capabilities: input.capabilities || [],\n systemPrompt: input.systemPrompt || getDefaultSystemPrompt(input.type),\n maxConcurrentTasks: input.maxConcurrentTasks || 3,\n priority: input.priority || 5,\n environment: input.environment,\n workingDirectory: input.workingDirectory,\n };\n\n const sessionId = await context.orchestrator.spawnAgent(profile);\n\n return {\n agentId: profile.id,\n sessionId,\n profile,\n status: 'spawned',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListAgentsTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/list',\n description: 'List all active agents in the system',\n inputSchema: {\n type: 'object',\n properties: {\n includeTerminated: {\n type: 'boolean',\n default: false,\n description: 'Include terminated agents in the list',\n },\n filterByType: {\n type: 'string',\n // Note: enum will be populated dynamically at runtime\n description: 'Filter agents by type (loaded dynamically from .claude/agents/)',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing agents', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const agents = await context.orchestrator.listAgents();\n\n let filteredAgents = agents;\n\n if (!input.includeTerminated) {\n filteredAgents = filteredAgents.filter((agent: any) => agent.status !== 'terminated');\n }\n\n if (input.filterByType) {\n filteredAgents = filteredAgents.filter((agent: any) => agent.type === input.filterByType);\n }\n\n return {\n agents: filteredAgents,\n count: filteredAgents.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createTerminateAgentTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/terminate',\n description: 'Terminate a specific agent',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'ID of the agent to terminate',\n },\n reason: {\n type: 'string',\n description: 'Reason for termination',\n },\n graceful: {\n type: 'boolean',\n default: true,\n description: 'Whether to perform graceful shutdown',\n },\n },\n required: ['agentId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Terminating agent', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.terminateAgent(input.agentId, {\n reason: input.reason || 'Manual termination',\n graceful: input.graceful !== false,\n });\n\n return {\n agentId: input.agentId,\n status: 'terminated',\n reason: input.reason || 'Manual termination',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetAgentInfoTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/info',\n description: 'Get detailed information about a specific agent',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'ID of the agent',\n },\n },\n required: ['agentId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting agent info', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const agentInfo = await context.orchestrator.getAgentInfo(input.agentId);\n\n if (!agentInfo) {\n throw new Error(`Agent not found: ${input.agentId}`);\n }\n\n return {\n agent: agentInfo,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCreateTaskTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/create',\n description: 'Create a new task for execution',\n inputSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'Type of task to create',\n },\n description: {\n type: 'string',\n description: 'Description of the task',\n },\n priority: {\n type: 'number',\n default: 5,\n description: 'Task priority (1-10)',\n },\n dependencies: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of task IDs this task depends on',\n },\n assignToAgent: {\n type: 'string',\n description: 'Specific agent ID to assign the task to',\n },\n assignToAgentType: {\n type: 'string',\n // Note: enum will be populated dynamically at runtime\n description: 'Type of specialized agent to assign the task to (loaded dynamically from .claude/agents/)',\n },\n input: {\n type: 'object',\n description: 'Input data for the task',\n },\n timeout: {\n type: 'number',\n description: 'Task timeout in milliseconds',\n },\n },\n required: ['type', 'description'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Creating task', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const task: Partial<Task> = {\n type: input.type,\n description: input.description,\n priority: input.priority || 5,\n dependencies: input.dependencies || [],\n input: input.input || {},\n status: 'pending',\n createdAt: new Date(),\n };\n\n const taskId = await context.orchestrator.createTask(task);\n\n // Handle assignment\n if (input.assignToAgent) {\n await context.orchestrator.assignTask(taskId, input.assignToAgent);\n } else if (input.assignToAgentType) {\n await context.orchestrator.assignTaskToType(taskId, input.assignToAgentType);\n }\n\n return {\n taskId,\n task: { ...task, id: taskId },\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListTasksTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/list',\n description: 'List tasks with optional filtering',\n inputSchema: {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: ['pending', 'queued', 'assigned', 'running', 'completed', 'failed', 'cancelled'],\n description: 'Filter by task status',\n },\n agentId: {\n type: 'string',\n description: 'Filter by assigned agent ID',\n },\n type: {\n type: 'string',\n description: 'Filter by task type',\n },\n limit: {\n type: 'number',\n default: 50,\n description: 'Maximum number of tasks to return',\n },\n offset: {\n type: 'number',\n default: 0,\n description: 'Number of tasks to skip',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing tasks', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const tasks = await context.orchestrator.listTasks({\n status: input.status,\n agentId: input.agentId,\n type: input.type,\n limit: input.limit || 50,\n offset: input.offset || 0,\n });\n\n return {\n tasks,\n count: tasks.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetTaskStatusTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/status',\n description: 'Get detailed status of a specific task',\n inputSchema: {\n type: 'object',\n properties: {\n taskId: {\n type: 'string',\n description: 'ID of the task',\n },\n },\n required: ['taskId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting task status', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const task = await context.orchestrator.getTask(input.taskId);\n\n if (!task) {\n throw new Error(`Task not found: ${input.taskId}`);\n }\n\n return {\n task,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCancelTaskTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/cancel',\n description: 'Cancel a pending or running task',\n inputSchema: {\n type: 'object',\n properties: {\n taskId: {\n type: 'string',\n description: 'ID of the task to cancel',\n },\n reason: {\n type: 'string',\n description: 'Reason for cancellation',\n },\n },\n required: ['taskId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Cancelling task', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.cancelTask(input.taskId, input.reason || 'Manual cancellation');\n\n return {\n taskId: input.taskId,\n status: 'cancelled',\n reason: input.reason || 'Manual cancellation',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createAssignTaskTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/assign',\n description: 'Assign a task to a specific agent',\n inputSchema: {\n type: 'object',\n properties: {\n taskId: {\n type: 'string',\n description: 'ID of the task to assign',\n },\n agentId: {\n type: 'string',\n description: 'ID of the agent to assign the task to',\n },\n },\n required: ['taskId', 'agentId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Assigning task', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.assignTask(input.taskId, input.agentId);\n\n return {\n taskId: input.taskId,\n agentId: input.agentId,\n status: 'assigned',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createQueryMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory_query',\n description: 'Query agent memory with filters and search',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'Filter by agent ID',\n },\n sessionId: {\n type: 'string',\n description: 'Filter by session ID',\n },\n type: {\n type: 'string',\n enum: ['observation', 'insight', 'decision', 'artifact', 'error'],\n description: 'Filter by entry type',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Filter by tags',\n },\n search: {\n type: 'string',\n description: 'Full-text search query',\n },\n startTime: {\n type: 'string',\n format: 'date-time',\n description: 'Filter entries after this time',\n },\n endTime: {\n type: 'string',\n format: 'date-time',\n description: 'Filter entries before this time',\n },\n limit: {\n type: 'number',\n default: 50,\n description: 'Maximum number of entries to return',\n },\n offset: {\n type: 'number',\n default: 0,\n description: 'Number of entries to skip',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Querying memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const query = {\n agentId: input.agentId,\n sessionId: input.sessionId,\n type: input.type,\n tags: input.tags,\n search: input.search,\n startTime: input.startTime ? new Date(input.startTime) : undefined,\n endTime: input.endTime ? new Date(input.endTime) : undefined,\n limit: input.limit || 50,\n offset: input.offset || 0,\n };\n\n const entries = await context.orchestrator.queryMemory(query);\n\n return {\n entries,\n count: entries.length,\n query,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createStoreMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory_store',\n description: 'Store a new memory entry',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'Agent ID for the memory entry',\n },\n sessionId: {\n type: 'string',\n description: 'Session ID for the memory entry',\n },\n type: {\n type: 'string',\n enum: ['observation', 'insight', 'decision', 'artifact', 'error'],\n description: 'Type of memory entry',\n },\n content: {\n type: 'string',\n description: 'Content of the memory entry',\n },\n context: {\n type: 'object',\n description: 'Context data for the memory entry',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Tags for the memory entry',\n },\n parentId: {\n type: 'string',\n description: 'Parent memory entry ID',\n },\n },\n required: ['agentId', 'sessionId', 'type', 'content'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Storing memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const entry: Partial<MemoryEntry> = {\n agentId: input.agentId,\n sessionId: input.sessionId,\n type: input.type,\n content: input.content,\n context: input.context || {},\n tags: input.tags || [],\n parentId: input.parentId,\n timestamp: new Date(),\n version: 1,\n };\n\n const entryId = await context.orchestrator.storeMemory(entry);\n\n return {\n entryId,\n entry: { ...entry, id: entryId },\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createDeleteMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory_delete',\n description: 'Delete a memory entry',\n inputSchema: {\n type: 'object',\n properties: {\n entryId: {\n type: 'string',\n description: 'ID of the memory entry to delete',\n },\n },\n required: ['entryId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Deleting memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.deleteMemory(input.entryId);\n\n return {\n entryId: input.entryId,\n status: 'deleted',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createExportMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory_export',\n description: 'Export memory entries to a file',\n inputSchema: {\n type: 'object',\n properties: {\n format: {\n type: 'string',\n enum: ['json', 'csv', 'markdown'],\n default: 'json',\n description: 'Export format',\n },\n agentId: {\n type: 'string',\n description: 'Filter by agent ID',\n },\n sessionId: {\n type: 'string',\n description: 'Filter by session ID',\n },\n startTime: {\n type: 'string',\n format: 'date-time',\n description: 'Export entries after this time',\n },\n endTime: {\n type: 'string',\n format: 'date-time',\n description: 'Export entries before this time',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Exporting memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const exportResult = await context.orchestrator.exportMemory({\n format: input.format || 'json',\n agentId: input.agentId,\n sessionId: input.sessionId,\n startTime: input.startTime ? new Date(input.startTime) : undefined,\n endTime: input.endTime ? new Date(input.endTime) : undefined,\n });\n\n return {\n ...exportResult,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createImportMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory_import',\n description: 'Import memory entries from a file',\n inputSchema: {\n type: 'object',\n properties: {\n filePath: {\n type: 'string',\n description: 'Path to the file to import',\n },\n format: {\n type: 'string',\n enum: ['json', 'csv'],\n default: 'json',\n description: 'Import format',\n },\n mergeStrategy: {\n type: 'string',\n enum: ['skip', 'overwrite', 'version'],\n default: 'skip',\n description: 'Strategy for handling duplicate entries',\n },\n },\n required: ['filePath'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Importing memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const importResult = await context.orchestrator.importMemory({\n filePath: input.filePath,\n format: input.format || 'json',\n mergeStrategy: input.mergeStrategy || 'skip',\n });\n\n return {\n ...importResult,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetSystemStatusTool(logger: ILogger): MCPTool {\n return {\n name: 'system/status',\n description: 'Get comprehensive system status information',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting system status', { sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const status = await context.orchestrator.getSystemStatus();\n\n return {\n ...status,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetMetricsTool(logger: ILogger): MCPTool {\n return {\n name: 'system/metrics',\n description: 'Get system performance metrics',\n inputSchema: {\n type: 'object',\n properties: {\n timeRange: {\n type: 'string',\n enum: ['1h', '6h', '24h', '7d'],\n default: '1h',\n description: 'Time range for metrics',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting system metrics', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const metrics = await context.orchestrator.getMetrics(input.timeRange || '1h');\n\n return {\n metrics,\n timeRange: input.timeRange || '1h',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createHealthCheckTool(logger: ILogger): MCPTool {\n return {\n name: 'system/health',\n description: 'Perform a comprehensive health check',\n inputSchema: {\n type: 'object',\n properties: {\n deep: {\n type: 'boolean',\n default: false,\n description: 'Perform deep health check including component tests',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Performing health check', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const healthCheck = await context.orchestrator.performHealthCheck(input.deep || false);\n\n return {\n ...healthCheck,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetConfigTool(logger: ILogger): MCPTool {\n return {\n name: 'config/get',\n description: 'Get current system configuration',\n inputSchema: {\n type: 'object',\n properties: {\n section: {\n type: 'string',\n enum: ['orchestrator', 'terminal', 'memory', 'coordination', 'mcp', 'logging'],\n description: 'Specific configuration section to retrieve',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting configuration', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const config = await context.orchestrator.getConfig(input.section);\n\n return {\n config,\n section: input.section,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createUpdateConfigTool(logger: ILogger): MCPTool {\n return {\n name: 'config/update',\n description: 'Update system configuration',\n inputSchema: {\n type: 'object',\n properties: {\n section: {\n type: 'string',\n enum: ['orchestrator', 'terminal', 'memory', 'coordination', 'mcp', 'logging'],\n description: 'Configuration section to update',\n },\n config: {\n type: 'object',\n description: 'Configuration values to update',\n },\n restart: {\n type: 'boolean',\n default: false,\n description: 'Restart affected components after update',\n },\n },\n required: ['section', 'config'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Updating configuration', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const result = await context.orchestrator.updateConfig(\n input.section,\n input.config,\n input.restart || false,\n );\n\n return {\n ...result,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createValidateConfigTool(logger: ILogger): MCPTool {\n return {\n name: 'config/validate',\n description: 'Validate a configuration object',\n inputSchema: {\n type: 'object',\n properties: {\n config: {\n type: 'object',\n description: 'Configuration object to validate',\n },\n },\n required: ['config'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Validating configuration', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const validation = await context.orchestrator.validateConfig(input.config);\n\n return {\n ...validation,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createExecuteWorkflowTool(logger: ILogger): MCPTool {\n return {\n name: 'workflow/execute',\n description: 'Execute a workflow from a file or definition',\n inputSchema: {\n type: 'object',\n properties: {\n filePath: {\n type: 'string',\n description: 'Path to workflow file',\n },\n workflow: {\n type: 'object',\n description: 'Inline workflow definition',\n },\n parameters: {\n type: 'object',\n description: 'Parameters to pass to the workflow',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Executing workflow', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n if (!input.filePath && !input.workflow) {\n throw new Error('Either filePath or workflow must be provided');\n }\n\n const result = await context.orchestrator.executeWorkflow({\n filePath: input.filePath,\n workflow: input.workflow,\n parameters: input.parameters || {},\n });\n\n return {\n ...result,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCreateWorkflowTool(logger: ILogger): MCPTool {\n return {\n name: 'workflow/create',\n description: 'Create a new workflow definition',\n inputSchema: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'Name of the workflow',\n },\n description: {\n type: 'string',\n description: 'Description of the workflow',\n },\n tasks: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n id: { type: 'string' },\n type: { type: 'string' },\n description: { type: 'string' },\n dependencies: {\n type: 'array',\n items: { type: 'string' },\n },\n assignTo: { type: 'string' },\n },\n required: ['id', 'type', 'description'],\n },\n description: 'List of tasks in the workflow',\n },\n savePath: {\n type: 'string',\n description: 'Path to save the workflow file',\n },\n },\n required: ['name', 'tasks'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Creating workflow', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const workflow = {\n name: input.name,\n description: input.description,\n tasks: input.tasks,\n created: new Date().toISOString(),\n };\n\n const result = await context.orchestrator.createWorkflow(workflow, input.savePath);\n\n return {\n ...result,\n workflow,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListWorkflowsTool(logger: ILogger): MCPTool {\n return {\n name: 'workflow/list',\n description: 'List available workflows',\n inputSchema: {\n type: 'object',\n properties: {\n directory: {\n type: 'string',\n description: 'Directory to search for workflows',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing workflows', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const workflows = await context.orchestrator.listWorkflows(input.directory);\n\n return {\n workflows,\n count: workflows.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createExecuteCommandTool(logger: ILogger): MCPTool {\n return {\n name: 'terminal/execute',\n description: 'Execute a command in a terminal session',\n inputSchema: {\n type: 'object',\n properties: {\n command: {\n type: 'string',\n description: 'Command to execute',\n },\n args: {\n type: 'array',\n items: { type: 'string' },\n description: 'Command arguments',\n },\n cwd: {\n type: 'string',\n description: 'Working directory for the command',\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n },\n timeout: {\n type: 'number',\n default: 30000,\n description: 'Command timeout in milliseconds',\n },\n terminalId: {\n type: 'string',\n description: 'Specific terminal ID to use',\n },\n },\n required: ['command'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Executing command', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const result = await context.orchestrator.executeCommand({\n command: input.command,\n args: input.args,\n cwd: input.cwd,\n env: input.env,\n timeout: input.timeout || 30000,\n terminalId: input.terminalId,\n });\n\n return {\n ...result,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListTerminalsTool(logger: ILogger): MCPTool {\n return {\n name: 'terminal/list',\n description: 'List all terminal sessions',\n inputSchema: {\n type: 'object',\n properties: {\n includeIdle: {\n type: 'boolean',\n default: true,\n description: 'Include idle terminals',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing terminals', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const terminals = await context.orchestrator.listTerminals(input.includeIdle !== false);\n\n return {\n terminals,\n count: terminals.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCreateTerminalTool(logger: ILogger): MCPTool {\n return {\n name: 'terminal/create',\n description: 'Create a new terminal session',\n inputSchema: {\n type: 'object',\n properties: {\n cwd: {\n type: 'string',\n description: 'Working directory for the terminal',\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n },\n shell: {\n type: 'string',\n description: 'Shell to use (bash, zsh, etc.)',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Creating terminal', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const terminal = await context.orchestrator.createTerminal({\n cwd: input.cwd,\n env: input.env,\n shell: input.shell,\n });\n\n return {\n terminal,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\n/**\n * SDK Integration Tools - Session Checkpoints\n */\nfunction createCheckpointCreateTool(logger: ILogger): MCPTool {\n return {\n name: 'checkpoint_create',\n description: 'Create a checkpoint for a session (Git-like time travel)',\n inputSchema: {\n type: 'object',\n properties: {\n sessionId: { type: 'string', description: 'Session ID to checkpoint' },\n description: { type: 'string', description: 'Checkpoint description' },\n },\n required: ['sessionId'],\n },\n handler: async (input: any) => {\n \n const checkpointId = await checkpointManager.createCheckpoint(\n input.sessionId,\n input.description || `Checkpoint at ${new Date().toLocaleString()}`\n );\n return { success: true, checkpointId, sessionId: input.sessionId };\n },\n };\n}\n\nfunction createCheckpointListTool(logger: ILogger): MCPTool {\n return {\n name: 'checkpoint_list',\n description: 'List all checkpoints for a session',\n inputSchema: {\n type: 'object',\n properties: {\n sessionId: { type: 'string', description: 'Session ID' },\n },\n required: ['sessionId'],\n },\n handler: async (input: any) => {\n \n const checkpoints = checkpointManager.listCheckpoints(input.sessionId);\n return { success: true, checkpoints, count: checkpoints.length };\n },\n };\n}\n\nfunction createCheckpointRollbackTool(logger: ILogger): MCPTool {\n return {\n name: 'checkpoint_rollback',\n description: 'Rollback session to a checkpoint',\n inputSchema: {\n type: 'object',\n properties: {\n checkpointId: { type: 'string', description: 'Checkpoint ID to restore' },\n prompt: { type: 'string', description: 'Continue prompt after rollback' },\n },\n required: ['checkpointId'],\n },\n handler: async (input: any) => {\n \n await checkpointManager.rollbackToCheckpoint(\n input.checkpointId,\n input.prompt || 'Continue from checkpoint'\n );\n return { success: true, checkpointId: input.checkpointId };\n },\n };\n}\n\n/**\n * SDK Integration Tools - Session Forking\n */\nfunction createSessionForkTool(logger: ILogger): MCPTool {\n return {\n name: 'session_fork',\n description: 'Fork a session for parallel exploration (real SDK forking)',\n inputSchema: {\n type: 'object',\n properties: {\n sessionId: { type: 'string', description: 'Base session ID to fork from' },\n forkOptions: {\n type: 'object',\n description: 'Fork configuration options',\n properties: {},\n },\n },\n required: ['sessionId'],\n },\n handler: async (input: any) => {\n \n const fork = await sessionForking.fork(input.sessionId, input.forkOptions || {});\n return { success: true, fork };\n },\n };\n}\n\nfunction createSessionInfoTool(logger: ILogger): MCPTool {\n return {\n name: 'session_info',\n description: 'Get session and fork information',\n inputSchema: {\n type: 'object',\n properties: {\n sessionId: { type: 'string', description: 'Session ID' },\n },\n required: ['sessionId'],\n },\n handler: async (input: any) => {\n \n const info = sessionForking.getSessionInfo(input.sessionId);\n return { success: true, session: info };\n },\n };\n}\n\n/**\n * SDK Integration Tools - Query Control\n */\nfunction createPauseQueryTool(logger: ILogger): MCPTool {\n return {\n name: 'query_pause',\n description: 'Pause a query with SDK (real pause with resumeSessionAt)',\n inputSchema: {\n type: 'object',\n properties: {\n sessionId: { type: 'string', description: 'Session ID to pause' },\n },\n required: ['sessionId'],\n },\n handler: async (input: any) => {\n const { queryController } = await import('../sdk/query-control.js');\n queryController.requestPause(input.sessionId);\n return { success: true, sessionId: input.sessionId, paused: true };\n },\n };\n}\n\nfunction createResumeQueryTool(logger: ILogger): MCPTool {\n return {\n name: 'query_resume',\n description: 'Resume a paused query',\n inputSchema: {\n type: 'object',\n properties: {\n sessionId: { type: 'string', description: 'Session ID to resume' },\n },\n required: ['sessionId'],\n },\n handler: async (input: any) => {\n const { queryController } = await import('../sdk/query-control.js');\n const result = await queryController.resumeQuery(input.sessionId);\n return { success: true, sessionId: input.sessionId, resumed: true, result };\n },\n };\n}\n\nfunction getDefaultSystemPrompt(type: string): string {\n const prompts = {\n coordinator:\n 'You are a coordinator agent responsible for planning, delegating, and orchestrating tasks across multiple agents.',\n researcher:\n 'You are a research agent specialized in gathering, analyzing, and synthesizing information from various sources.',\n implementer:\n 'You are an implementation agent focused on writing code, creating solutions, and executing technical tasks.',\n analyst:\n 'You are an analysis agent that identifies patterns, generates insights, and provides data-driven recommendations.',\n custom: 'You are a specialized agent with custom capabilities defined by your configuration.',\n };\n\n return prompts[type as keyof typeof prompts] || prompts.custom;\n}\n"],"names":["getAvailableAgentTypes","enhanceToolWithAgentTypes","tool","availableTypes","enhancedTool","JSON","parse","stringify","addEnumToAgentTypeFields","obj","key","value","Object","entries","field","type","description","includes","enum","inputSchema","createClaudeFlowTools","logger","tools","createSpawnAgentTool","createListAgentsTool","createTerminateAgentTool","createGetAgentInfoTool","createCreateTaskTool","createListTasksTool","createGetTaskStatusTool","createCancelTaskTool","createAssignTaskTool","createQueryMemoryTool","createStoreMemoryTool","createDeleteMemoryTool","createExportMemoryTool","createImportMemoryTool","createGetSystemStatusTool","createGetMetricsTool","createHealthCheckTool","createGetConfigTool","createUpdateConfigTool","createValidateConfigTool","createExecuteWorkflowTool","createCreateWorkflowTool","createListWorkflowsTool","createExecuteCommandTool","createListTerminalsTool","createCreateTerminalTool","enhancedTools","Promise","all","map","name","properties","capabilities","items","systemPrompt","maxConcurrentTasks","default","priority","environment","workingDirectory","required","handler","input","context","info","sessionId","orchestrator","Error","profile","id","Date","now","Math","random","toString","substr","getDefaultSystemPrompt","spawnAgent","agentId","status","timestamp","toISOString","includeTerminated","filterByType","agents","listAgents","filteredAgents","filter","agent","count","length","reason","graceful","terminateAgent","agentInfo","getAgentInfo","dependencies","assignToAgent","assignToAgentType","timeout","task","createdAt","taskId","createTask","assignTask","assignTaskToType","limit","offset","tasks","listTasks","getTask","cancelTask","tags","search","startTime","format","endTime","query","undefined","queryMemory","content","parentId","entry","version","entryId","storeMemory","deleteMemory","exportResult","exportMemory","filePath","mergeStrategy","importResult","importMemory","getSystemStatus","timeRange","metrics","getMetrics","deep","healthCheck","performHealthCheck","section","config","getConfig","restart","result","updateConfig","validation","validateConfig","workflow","parameters","executeWorkflow","assignTo","savePath","created","createWorkflow","directory","workflows","listWorkflows","command","args","cwd","env","terminalId","executeCommand","includeIdle","terminals","listTerminals","shell","terminal","createTerminal","createCheckpointCreateTool","checkpointId","checkpointManager","createCheckpoint","toLocaleString","success","createCheckpointListTool","checkpoints","listCheckpoints","createCheckpointRollbackTool","prompt","rollbackToCheckpoint","createSessionForkTool","forkOptions","fork","sessionForking","createSessionInfoTool","getSessionInfo","session","createPauseQueryTool","queryController","requestPause","paused","createResumeQueryTool","resumeQuery","resumed","prompts","coordinator","researcher","implementer","analyst","custom"],"mappings":"AAMA,SAASA,sBAAsB,QAA4B,8BAA8B;AAUzF,eAAeC,0BAA0BC,IAAa;IACpD,MAAMC,iBAAiB,MAAMH;IAG7B,MAAMI,eAAeC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACL;IAG/C,SAASM,yBAAyBC,GAAQ;QACxC,IAAI,OAAOA,QAAQ,YAAYA,QAAQ,MAAM;QAE7C,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACJ,KAAM;YAC9C,IAAI,OAAOE,UAAU,YAAYA,UAAU,MAAM;gBAE/C,IAAID,QAAQ,UAAUA,QAAQ,kBAAkBA,QAAQ,qBAAqB;oBAC3E,MAAMI,QAAQH;oBACd,IAAIG,MAAMC,IAAI,KAAK,YAAYD,MAAME,WAAW,EAAEC,SAAS,4CAA4C;wBACrGH,MAAMI,IAAI,GAAGf;oBACf;gBACF;gBACAK,yBAAyBG;YAC3B;QACF;IACF;IAEAH,yBAAyBJ,aAAae,WAAW;IACjD,OAAOf;AACT;AAKA,OAAO,eAAegB,sBAAsBC,MAAe;IACzD,MAAMC,QAAQ;QAEZC,qBAAqBF;QACrBG,qBAAqBH;QACrBI,yBAAyBJ;QACzBK,uBAAuBL;QAKvBM,qBAAqBN;QACrBO,oBAAoBP;QACpBQ,wBAAwBR;QACxBS,qBAAqBT;QACrBU,qBAAqBV;QAGrBW,sBAAsBX;QACtBY,sBAAsBZ;QACtBa,uBAAuBb;QACvBc,uBAAuBd;QACvBe,uBAAuBf;QAGvBgB,0BAA0BhB;QAC1BiB,qBAAqBjB;QACrBkB,sBAAsBlB;QAGtBmB,oBAAoBnB;QACpBoB,uBAAuBpB;QACvBqB,yBAAyBrB;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.ts"],"sourcesContent":["/**\n * Claude-Flow specific MCP tools\n */\n\nimport type { MCPTool, MCPContext, AgentProfile, Task, MemoryEntry } from '../utils/types.js';\nimport type { ILogger } from '../core/logger.js';\nimport { getAvailableAgentTypes, getAgentTypeSchema } from '../constants/agent-types.js';\nimport type { Permissions } from './auth.js';\n\nexport interface ClaudeFlowToolContext extends MCPContext {\n orchestrator?: any; // Reference to orchestrator instance\n}\n\n/**\n * Enhance tool schema with dynamic agent types\n */\nasync function enhanceToolWithAgentTypes(tool: MCPTool): Promise<MCPTool> {\n const availableTypes = await getAvailableAgentTypes();\n \n // Clone the tool to avoid modifying the original\n const enhancedTool = JSON.parse(JSON.stringify(tool));\n \n // Find and populate enum fields for agent types\n function addEnumToAgentTypeFields(obj: any) {\n if (typeof obj !== 'object' || obj === null) return;\n \n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'object' && value !== null) {\n // Check if this is an agent type field\n if (key === 'type' || key === 'filterByType' || key === 'assignToAgentType') {\n const field = value as any;\n if (field.type === 'string' && field.description?.includes('loaded dynamically from .claude/agents/')) {\n field.enum = availableTypes;\n }\n }\n addEnumToAgentTypeFields(value);\n }\n }\n }\n \n addEnumToAgentTypeFields(enhancedTool.inputSchema);\n return enhancedTool;\n}\n\n/**\n * Create all Claude-Flow specific MCP tools\n */\nexport async function createClaudeFlowTools(logger: ILogger): Promise<MCPTool[]> {\n const tools = [\n // Agent management tools\n createSpawnAgentTool(logger),\n createSpawnParallelAgentsTool(logger), // NEW: Phase 4 - Parallel spawning\n createListAgentsTool(logger),\n createTerminateAgentTool(logger),\n createGetAgentInfoTool(logger),\n\n // Query control tools (NEW: Phase 4 - Real-time control)\n createQueryControlTool(logger),\n createListQueriesTool(logger),\n\n // Task management tools\n createCreateTaskTool(logger),\n createListTasksTool(logger),\n createGetTaskStatusTool(logger),\n createCancelTaskTool(logger),\n createAssignTaskTool(logger),\n\n // Memory management tools\n createQueryMemoryTool(logger),\n createStoreMemoryTool(logger),\n createDeleteMemoryTool(logger),\n createExportMemoryTool(logger),\n createImportMemoryTool(logger),\n\n // System monitoring tools\n createGetSystemStatusTool(logger),\n createGetMetricsTool(logger),\n createHealthCheckTool(logger),\n\n // Configuration tools\n createGetConfigTool(logger),\n createUpdateConfigTool(logger),\n createValidateConfigTool(logger),\n\n // Workflow tools\n createExecuteWorkflowTool(logger),\n createCreateWorkflowTool(logger),\n createListWorkflowsTool(logger),\n\n // Terminal management tools\n createExecuteCommandTool(logger),\n createListTerminalsTool(logger),\n createCreateTerminalTool(logger),\n ];\n\n // Enhance tools with dynamic agent types\n const enhancedTools = await Promise.all(\n tools.map(tool => enhanceToolWithAgentTypes(tool))\n );\n\n return enhancedTools;\n}\n\nfunction createSpawnAgentTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/spawn',\n description: 'Spawn a new Claude agent with specified configuration',\n inputSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n // Note: enum will be populated dynamically at runtime\n description: 'Type of specialized agent to spawn (loaded dynamically from .claude/agents/)',\n },\n name: {\n type: 'string',\n description: 'Display name for the agent',\n },\n capabilities: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of capabilities for the agent',\n },\n systemPrompt: {\n type: 'string',\n description: 'Custom system prompt for the agent',\n },\n maxConcurrentTasks: {\n type: 'number',\n default: 3,\n description: 'Maximum number of concurrent tasks',\n },\n priority: {\n type: 'number',\n default: 5,\n description: 'Agent priority level (1-10)',\n },\n environment: {\n type: 'object',\n description: 'Environment variables for the agent',\n },\n workingDirectory: {\n type: 'string',\n description: 'Working directory for the agent',\n },\n },\n required: ['type', 'name'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Spawning agent', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const profile: AgentProfile = {\n id: `agent_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,\n name: input.name,\n type: input.type,\n capabilities: input.capabilities || [],\n systemPrompt: input.systemPrompt || getDefaultSystemPrompt(input.type),\n maxConcurrentTasks: input.maxConcurrentTasks || 3,\n priority: input.priority || 5,\n environment: input.environment,\n workingDirectory: input.workingDirectory,\n };\n\n const sessionId = await context.orchestrator.spawnAgent(profile);\n\n return {\n agentId: profile.id,\n sessionId,\n profile,\n status: 'spawned',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListAgentsTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/list',\n description: 'List all active agents in the system',\n inputSchema: {\n type: 'object',\n properties: {\n includeTerminated: {\n type: 'boolean',\n default: false,\n description: 'Include terminated agents in the list',\n },\n filterByType: {\n type: 'string',\n // Note: enum will be populated dynamically at runtime\n description: 'Filter agents by type (loaded dynamically from .claude/agents/)',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing agents', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const agents = await context.orchestrator.listAgents();\n\n let filteredAgents = agents;\n\n if (!input.includeTerminated) {\n filteredAgents = filteredAgents.filter((agent: any) => agent.status !== 'terminated');\n }\n\n if (input.filterByType) {\n filteredAgents = filteredAgents.filter((agent: any) => agent.type === input.filterByType);\n }\n\n return {\n agents: filteredAgents,\n count: filteredAgents.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createTerminateAgentTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/terminate',\n description: 'Terminate a specific agent',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'ID of the agent to terminate',\n },\n reason: {\n type: 'string',\n description: 'Reason for termination',\n },\n graceful: {\n type: 'boolean',\n default: true,\n description: 'Whether to perform graceful shutdown',\n },\n },\n required: ['agentId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Terminating agent', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.terminateAgent(input.agentId, {\n reason: input.reason || 'Manual termination',\n graceful: input.graceful !== false,\n });\n\n return {\n agentId: input.agentId,\n status: 'terminated',\n reason: input.reason || 'Manual termination',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetAgentInfoTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/info',\n description: 'Get detailed information about a specific agent',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'ID of the agent',\n },\n },\n required: ['agentId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting agent info', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const agentInfo = await context.orchestrator.getAgentInfo(input.agentId);\n\n if (!agentInfo) {\n throw new Error(`Agent not found: ${input.agentId}`);\n }\n\n return {\n agent: agentInfo,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCreateTaskTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/create',\n description: 'Create a new task for execution',\n inputSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description: 'Type of task to create',\n },\n description: {\n type: 'string',\n description: 'Description of the task',\n },\n priority: {\n type: 'number',\n default: 5,\n description: 'Task priority (1-10)',\n },\n dependencies: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of task IDs this task depends on',\n },\n assignToAgent: {\n type: 'string',\n description: 'Specific agent ID to assign the task to',\n },\n assignToAgentType: {\n type: 'string',\n // Note: enum will be populated dynamically at runtime\n description: 'Type of specialized agent to assign the task to (loaded dynamically from .claude/agents/)',\n },\n input: {\n type: 'object',\n description: 'Input data for the task',\n },\n timeout: {\n type: 'number',\n description: 'Task timeout in milliseconds',\n },\n },\n required: ['type', 'description'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Creating task', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const task: Partial<Task> = {\n type: input.type,\n description: input.description,\n priority: input.priority || 5,\n dependencies: input.dependencies || [],\n input: input.input || {},\n status: 'pending',\n createdAt: new Date(),\n };\n\n const taskId = await context.orchestrator.createTask(task);\n\n // Handle assignment\n if (input.assignToAgent) {\n await context.orchestrator.assignTask(taskId, input.assignToAgent);\n } else if (input.assignToAgentType) {\n await context.orchestrator.assignTaskToType(taskId, input.assignToAgentType);\n }\n\n return {\n taskId,\n task: { ...task, id: taskId },\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListTasksTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/list',\n description: 'List tasks with optional filtering',\n inputSchema: {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n enum: ['pending', 'queued', 'assigned', 'running', 'completed', 'failed', 'cancelled'],\n description: 'Filter by task status',\n },\n agentId: {\n type: 'string',\n description: 'Filter by assigned agent ID',\n },\n type: {\n type: 'string',\n description: 'Filter by task type',\n },\n limit: {\n type: 'number',\n default: 50,\n description: 'Maximum number of tasks to return',\n },\n offset: {\n type: 'number',\n default: 0,\n description: 'Number of tasks to skip',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing tasks', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const tasks = await context.orchestrator.listTasks({\n status: input.status,\n agentId: input.agentId,\n type: input.type,\n limit: input.limit || 50,\n offset: input.offset || 0,\n });\n\n return {\n tasks,\n count: tasks.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetTaskStatusTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/status',\n description: 'Get detailed status of a specific task',\n inputSchema: {\n type: 'object',\n properties: {\n taskId: {\n type: 'string',\n description: 'ID of the task',\n },\n },\n required: ['taskId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting task status', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const task = await context.orchestrator.getTask(input.taskId);\n\n if (!task) {\n throw new Error(`Task not found: ${input.taskId}`);\n }\n\n return {\n task,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCancelTaskTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/cancel',\n description: 'Cancel a pending or running task',\n inputSchema: {\n type: 'object',\n properties: {\n taskId: {\n type: 'string',\n description: 'ID of the task to cancel',\n },\n reason: {\n type: 'string',\n description: 'Reason for cancellation',\n },\n },\n required: ['taskId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Cancelling task', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.cancelTask(input.taskId, input.reason || 'Manual cancellation');\n\n return {\n taskId: input.taskId,\n status: 'cancelled',\n reason: input.reason || 'Manual cancellation',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createAssignTaskTool(logger: ILogger): MCPTool {\n return {\n name: 'tasks/assign',\n description: 'Assign a task to a specific agent',\n inputSchema: {\n type: 'object',\n properties: {\n taskId: {\n type: 'string',\n description: 'ID of the task to assign',\n },\n agentId: {\n type: 'string',\n description: 'ID of the agent to assign the task to',\n },\n },\n required: ['taskId', 'agentId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Assigning task', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.assignTask(input.taskId, input.agentId);\n\n return {\n taskId: input.taskId,\n agentId: input.agentId,\n status: 'assigned',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createQueryMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory/query',\n description: 'Query agent memory with filters and search',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'Filter by agent ID',\n },\n sessionId: {\n type: 'string',\n description: 'Filter by session ID',\n },\n type: {\n type: 'string',\n enum: ['observation', 'insight', 'decision', 'artifact', 'error'],\n description: 'Filter by entry type',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Filter by tags',\n },\n search: {\n type: 'string',\n description: 'Full-text search query',\n },\n startTime: {\n type: 'string',\n format: 'date-time',\n description: 'Filter entries after this time',\n },\n endTime: {\n type: 'string',\n format: 'date-time',\n description: 'Filter entries before this time',\n },\n limit: {\n type: 'number',\n default: 50,\n description: 'Maximum number of entries to return',\n },\n offset: {\n type: 'number',\n default: 0,\n description: 'Number of entries to skip',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Querying memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const query = {\n agentId: input.agentId,\n sessionId: input.sessionId,\n type: input.type,\n tags: input.tags,\n search: input.search,\n startTime: input.startTime ? new Date(input.startTime) : undefined,\n endTime: input.endTime ? new Date(input.endTime) : undefined,\n limit: input.limit || 50,\n offset: input.offset || 0,\n };\n\n const entries = await context.orchestrator.queryMemory(query);\n\n return {\n entries,\n count: entries.length,\n query,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createStoreMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory/store',\n description: 'Store a new memory entry',\n inputSchema: {\n type: 'object',\n properties: {\n agentId: {\n type: 'string',\n description: 'Agent ID for the memory entry',\n },\n sessionId: {\n type: 'string',\n description: 'Session ID for the memory entry',\n },\n type: {\n type: 'string',\n enum: ['observation', 'insight', 'decision', 'artifact', 'error'],\n description: 'Type of memory entry',\n },\n content: {\n type: 'string',\n description: 'Content of the memory entry',\n },\n context: {\n type: 'object',\n description: 'Context data for the memory entry',\n },\n tags: {\n type: 'array',\n items: { type: 'string' },\n description: 'Tags for the memory entry',\n },\n parentId: {\n type: 'string',\n description: 'Parent memory entry ID',\n },\n },\n required: ['agentId', 'sessionId', 'type', 'content'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Storing memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const entry: Partial<MemoryEntry> = {\n agentId: input.agentId,\n sessionId: input.sessionId,\n type: input.type,\n content: input.content,\n context: input.context || {},\n tags: input.tags || [],\n parentId: input.parentId,\n timestamp: new Date(),\n version: 1,\n };\n\n const entryId = await context.orchestrator.storeMemory(entry);\n\n return {\n entryId,\n entry: { ...entry, id: entryId },\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createDeleteMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory/delete',\n description: 'Delete a memory entry',\n inputSchema: {\n type: 'object',\n properties: {\n entryId: {\n type: 'string',\n description: 'ID of the memory entry to delete',\n },\n },\n required: ['entryId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Deleting memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n await context.orchestrator.deleteMemory(input.entryId);\n\n return {\n entryId: input.entryId,\n status: 'deleted',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createExportMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory/export',\n description: 'Export memory entries to a file',\n inputSchema: {\n type: 'object',\n properties: {\n format: {\n type: 'string',\n enum: ['json', 'csv', 'markdown'],\n default: 'json',\n description: 'Export format',\n },\n agentId: {\n type: 'string',\n description: 'Filter by agent ID',\n },\n sessionId: {\n type: 'string',\n description: 'Filter by session ID',\n },\n startTime: {\n type: 'string',\n format: 'date-time',\n description: 'Export entries after this time',\n },\n endTime: {\n type: 'string',\n format: 'date-time',\n description: 'Export entries before this time',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Exporting memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const exportResult = await context.orchestrator.exportMemory({\n format: input.format || 'json',\n agentId: input.agentId,\n sessionId: input.sessionId,\n startTime: input.startTime ? new Date(input.startTime) : undefined,\n endTime: input.endTime ? new Date(input.endTime) : undefined,\n });\n\n return {\n ...exportResult,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createImportMemoryTool(logger: ILogger): MCPTool {\n return {\n name: 'memory/import',\n description: 'Import memory entries from a file',\n inputSchema: {\n type: 'object',\n properties: {\n filePath: {\n type: 'string',\n description: 'Path to the file to import',\n },\n format: {\n type: 'string',\n enum: ['json', 'csv'],\n default: 'json',\n description: 'Import format',\n },\n mergeStrategy: {\n type: 'string',\n enum: ['skip', 'overwrite', 'version'],\n default: 'skip',\n description: 'Strategy for handling duplicate entries',\n },\n },\n required: ['filePath'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Importing memory', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const importResult = await context.orchestrator.importMemory({\n filePath: input.filePath,\n format: input.format || 'json',\n mergeStrategy: input.mergeStrategy || 'skip',\n });\n\n return {\n ...importResult,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetSystemStatusTool(logger: ILogger): MCPTool {\n return {\n name: 'system/status',\n description: 'Get comprehensive system status information',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting system status', { sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const status = await context.orchestrator.getSystemStatus();\n\n return {\n ...status,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetMetricsTool(logger: ILogger): MCPTool {\n return {\n name: 'system/metrics',\n description: 'Get system performance metrics',\n inputSchema: {\n type: 'object',\n properties: {\n timeRange: {\n type: 'string',\n enum: ['1h', '6h', '24h', '7d'],\n default: '1h',\n description: 'Time range for metrics',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting system metrics', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const metrics = await context.orchestrator.getMetrics(input.timeRange || '1h');\n\n return {\n metrics,\n timeRange: input.timeRange || '1h',\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createHealthCheckTool(logger: ILogger): MCPTool {\n return {\n name: 'system/health',\n description: 'Perform a comprehensive health check',\n inputSchema: {\n type: 'object',\n properties: {\n deep: {\n type: 'boolean',\n default: false,\n description: 'Perform deep health check including component tests',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Performing health check', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const healthCheck = await context.orchestrator.performHealthCheck(input.deep || false);\n\n return {\n ...healthCheck,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createGetConfigTool(logger: ILogger): MCPTool {\n return {\n name: 'config/get',\n description: 'Get current system configuration',\n inputSchema: {\n type: 'object',\n properties: {\n section: {\n type: 'string',\n enum: ['orchestrator', 'terminal', 'memory', 'coordination', 'mcp', 'logging'],\n description: 'Specific configuration section to retrieve',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Getting configuration', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const config = await context.orchestrator.getConfig(input.section);\n\n return {\n config,\n section: input.section,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createUpdateConfigTool(logger: ILogger): MCPTool {\n return {\n name: 'config/update',\n description: 'Update system configuration',\n inputSchema: {\n type: 'object',\n properties: {\n section: {\n type: 'string',\n enum: ['orchestrator', 'terminal', 'memory', 'coordination', 'mcp', 'logging'],\n description: 'Configuration section to update',\n },\n config: {\n type: 'object',\n description: 'Configuration values to update',\n },\n restart: {\n type: 'boolean',\n default: false,\n description: 'Restart affected components after update',\n },\n },\n required: ['section', 'config'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Updating configuration', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const result = await context.orchestrator.updateConfig(\n input.section,\n input.config,\n input.restart || false,\n );\n\n return {\n ...result,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createValidateConfigTool(logger: ILogger): MCPTool {\n return {\n name: 'config/validate',\n description: 'Validate a configuration object',\n inputSchema: {\n type: 'object',\n properties: {\n config: {\n type: 'object',\n description: 'Configuration object to validate',\n },\n },\n required: ['config'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Validating configuration', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const validation = await context.orchestrator.validateConfig(input.config);\n\n return {\n ...validation,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createExecuteWorkflowTool(logger: ILogger): MCPTool {\n return {\n name: 'workflow/execute',\n description: 'Execute a workflow from a file or definition',\n inputSchema: {\n type: 'object',\n properties: {\n filePath: {\n type: 'string',\n description: 'Path to workflow file',\n },\n workflow: {\n type: 'object',\n description: 'Inline workflow definition',\n },\n parameters: {\n type: 'object',\n description: 'Parameters to pass to the workflow',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Executing workflow', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n if (!input.filePath && !input.workflow) {\n throw new Error('Either filePath or workflow must be provided');\n }\n\n const result = await context.orchestrator.executeWorkflow({\n filePath: input.filePath,\n workflow: input.workflow,\n parameters: input.parameters || {},\n });\n\n return {\n ...result,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCreateWorkflowTool(logger: ILogger): MCPTool {\n return {\n name: 'workflow/create',\n description: 'Create a new workflow definition',\n inputSchema: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'Name of the workflow',\n },\n description: {\n type: 'string',\n description: 'Description of the workflow',\n },\n tasks: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n id: { type: 'string' },\n type: { type: 'string' },\n description: { type: 'string' },\n dependencies: {\n type: 'array',\n items: { type: 'string' },\n },\n assignTo: { type: 'string' },\n },\n required: ['id', 'type', 'description'],\n },\n description: 'List of tasks in the workflow',\n },\n savePath: {\n type: 'string',\n description: 'Path to save the workflow file',\n },\n },\n required: ['name', 'tasks'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Creating workflow', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const workflow = {\n name: input.name,\n description: input.description,\n tasks: input.tasks,\n created: new Date().toISOString(),\n };\n\n const result = await context.orchestrator.createWorkflow(workflow, input.savePath);\n\n return {\n ...result,\n workflow,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListWorkflowsTool(logger: ILogger): MCPTool {\n return {\n name: 'workflow/list',\n description: 'List available workflows',\n inputSchema: {\n type: 'object',\n properties: {\n directory: {\n type: 'string',\n description: 'Directory to search for workflows',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing workflows', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const workflows = await context.orchestrator.listWorkflows(input.directory);\n\n return {\n workflows,\n count: workflows.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createExecuteCommandTool(logger: ILogger): MCPTool {\n return {\n name: 'terminal/execute',\n description: 'Execute a command in a terminal session',\n inputSchema: {\n type: 'object',\n properties: {\n command: {\n type: 'string',\n description: 'Command to execute',\n },\n args: {\n type: 'array',\n items: { type: 'string' },\n description: 'Command arguments',\n },\n cwd: {\n type: 'string',\n description: 'Working directory for the command',\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n },\n timeout: {\n type: 'number',\n default: 30000,\n description: 'Command timeout in milliseconds',\n },\n terminalId: {\n type: 'string',\n description: 'Specific terminal ID to use',\n },\n },\n required: ['command'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Executing command', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const result = await context.orchestrator.executeCommand({\n command: input.command,\n args: input.args,\n cwd: input.cwd,\n env: input.env,\n timeout: input.timeout || 30000,\n terminalId: input.terminalId,\n });\n\n return {\n ...result,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createListTerminalsTool(logger: ILogger): MCPTool {\n return {\n name: 'terminal/list',\n description: 'List all terminal sessions',\n inputSchema: {\n type: 'object',\n properties: {\n includeIdle: {\n type: 'boolean',\n default: true,\n description: 'Include idle terminals',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing terminals', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const terminals = await context.orchestrator.listTerminals(input.includeIdle !== false);\n\n return {\n terminals,\n count: terminals.length,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction createCreateTerminalTool(logger: ILogger): MCPTool {\n return {\n name: 'terminal/create',\n description: 'Create a new terminal session',\n inputSchema: {\n type: 'object',\n properties: {\n cwd: {\n type: 'string',\n description: 'Working directory for the terminal',\n },\n env: {\n type: 'object',\n description: 'Environment variables',\n },\n shell: {\n type: 'string',\n description: 'Shell to use (bash, zsh, etc.)',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Creating terminal', { input, sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const terminal = await context.orchestrator.createTerminal({\n cwd: input.cwd,\n env: input.env,\n shell: input.shell,\n });\n\n return {\n terminal,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\n/**\n * NEW: Phase 4 - Parallel Agent Spawning (10-20x faster)\n * Spawn multiple agents in parallel using ParallelSwarmExecutor\n */\nfunction createSpawnParallelAgentsTool(logger: ILogger): MCPTool {\n return {\n name: 'agents/spawn_parallel',\n description: 'Spawn multiple agents in parallel (10-20x faster than sequential spawning)',\n inputSchema: {\n type: 'object',\n properties: {\n agents: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: { type: 'string', description: 'Agent type' },\n name: { type: 'string', description: 'Agent name' },\n capabilities: { type: 'array', items: { type: 'string' } },\n priority: {\n type: 'string',\n enum: ['low', 'medium', 'high', 'critical'],\n default: 'medium'\n },\n },\n required: ['type', 'name'],\n },\n description: 'Array of agent configurations to spawn in parallel',\n },\n maxConcurrency: {\n type: 'number',\n default: 5,\n description: 'Maximum number of agents to spawn concurrently',\n },\n batchSize: {\n type: 'number',\n default: 3,\n description: 'Number of agents per batch',\n },\n },\n required: ['agents'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Spawning parallel agents', {\n count: input.agents?.length,\n sessionId: context?.sessionId\n });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const executor = context.orchestrator.getParallelExecutor();\n if (!executor) {\n throw new Error('ParallelSwarmExecutor not initialized');\n }\n\n // Convert input agents to ParallelAgentConfig format\n const agentConfigs = input.agents.map((agent: any) => ({\n agentId: `agent_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,\n agentType: agent.type,\n task: `Spawn ${agent.name} agent`,\n capabilities: agent.capabilities || [],\n priority: agent.priority || 'medium',\n }));\n\n const startTime = Date.now();\n const sessions = await executor.spawnParallelAgents(agentConfigs, {\n maxConcurrency: input.maxConcurrency || 5,\n batchSize: input.batchSize || 3,\n });\n\n const elapsedTime = Date.now() - startTime;\n\n return {\n success: true,\n agentsSpawned: sessions.size,\n sessions: Array.from(sessions.entries()).map(([id, session]) => ({\n agentId: id,\n sessionId: session.sessionId,\n status: session.status,\n })),\n performance: {\n totalTime: elapsedTime,\n averageTimePerAgent: elapsedTime / sessions.size,\n speedupVsSequential: `~${Math.round((sessions.size * 750) / elapsedTime)}x`,\n },\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\n/**\n * NEW: Phase 4 - Real-Time Query Control\n * Control running queries: pause, resume, terminate, change model\n */\nfunction createQueryControlTool(logger: ILogger): MCPTool {\n return {\n name: 'query/control',\n description: 'Control running queries (pause, resume, terminate, change model)',\n inputSchema: {\n type: 'object',\n properties: {\n action: {\n type: 'string',\n enum: ['pause', 'resume', 'terminate', 'change_model', 'change_permissions', 'execute_command'],\n description: 'Control action to perform',\n },\n queryId: {\n type: 'string',\n description: 'ID of the query to control',\n },\n model: {\n type: 'string',\n enum: ['claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022', 'claude-3-opus-20240229'],\n description: 'Model to switch to (for change_model action)',\n },\n permissionMode: {\n type: 'string',\n enum: ['default', 'acceptEdits', 'bypassPermissions', 'plan'],\n description: 'Permission mode to switch to (for change_permissions action)',\n },\n command: {\n type: 'string',\n description: 'Command to execute (for execute_command action)',\n },\n },\n required: ['action', 'queryId'],\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Query control action', {\n action: input.action,\n queryId: input.queryId,\n sessionId: context?.sessionId\n });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const controller = context.orchestrator.getQueryController();\n if (!controller) {\n throw new Error('RealTimeQueryController not initialized');\n }\n\n let result;\n switch (input.action) {\n case 'pause':\n result = await controller.pauseQuery(input.queryId);\n break;\n case 'resume':\n result = await controller.resumeQuery(input.queryId);\n break;\n case 'terminate':\n result = await controller.terminateQuery(input.queryId);\n break;\n case 'change_model':\n if (!input.model) {\n throw new Error('model parameter required for change_model action');\n }\n result = await controller.changeModel(input.queryId, input.model);\n break;\n case 'change_permissions':\n if (!input.permissionMode) {\n throw new Error('permissionMode parameter required for change_permissions action');\n }\n result = await controller.changePermissionMode(input.queryId, input.permissionMode);\n break;\n case 'execute_command':\n if (!input.command) {\n throw new Error('command parameter required for execute_command action');\n }\n result = await controller.executeCommand(input.queryId, input.command);\n break;\n default:\n throw new Error(`Unknown action: ${input.action}`);\n }\n\n return {\n success: true,\n action: input.action,\n queryId: input.queryId,\n result,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\n/**\n * NEW: Phase 4 - List Active Queries\n * Get status of all active queries being controlled\n */\nfunction createListQueriesTool(logger: ILogger): MCPTool {\n return {\n name: 'query/list',\n description: 'List all active queries and their status',\n inputSchema: {\n type: 'object',\n properties: {\n includeHistory: {\n type: 'boolean',\n default: false,\n description: 'Include completed queries in the list',\n },\n },\n },\n handler: async (input: any, context?: ClaudeFlowToolContext) => {\n logger.info('Listing queries', { sessionId: context?.sessionId });\n\n if (!context?.orchestrator) {\n throw new Error('Orchestrator not available');\n }\n\n const controller = context.orchestrator.getQueryController();\n if (!controller) {\n throw new Error('RealTimeQueryController not initialized');\n }\n\n const queries = controller.getAllQueries();\n\n return {\n success: true,\n queries: Array.from(queries.entries()).map(([id, status]) => ({\n queryId: id,\n ...status,\n })),\n count: queries.size,\n timestamp: new Date().toISOString(),\n };\n },\n };\n}\n\nfunction getDefaultSystemPrompt(type: string): string {\n const prompts = {\n coordinator:\n 'You are a coordinator agent responsible for planning, delegating, and orchestrating tasks across multiple agents.',\n researcher:\n 'You are a research agent specialized in gathering, analyzing, and synthesizing information from various sources.',\n implementer:\n 'You are an implementation agent focused on writing code, creating solutions, and executing technical tasks.',\n analyst:\n 'You are an analysis agent that identifies patterns, generates insights, and provides data-driven recommendations.',\n custom: 'You are a specialized agent with custom capabilities defined by your configuration.',\n };\n\n return prompts[type as keyof typeof prompts] || prompts.custom;\n}\n"],"names":["getAvailableAgentTypes","enhanceToolWithAgentTypes","tool","availableTypes","enhancedTool","JSON","parse","stringify","addEnumToAgentTypeFields","obj","key","value","Object","entries","field","type","description","includes","enum","inputSchema","createClaudeFlowTools","logger","tools","createSpawnAgentTool","createSpawnParallelAgentsTool","createListAgentsTool","createTerminateAgentTool","createGetAgentInfoTool","createQueryControlTool","createListQueriesTool","createCreateTaskTool","createListTasksTool","createGetTaskStatusTool","createCancelTaskTool","createAssignTaskTool","createQueryMemoryTool","createStoreMemoryTool","createDeleteMemoryTool","createExportMemoryTool","createImportMemoryTool","createGetSystemStatusTool","createGetMetricsTool","createHealthCheckTool","createGetConfigTool","createUpdateConfigTool","createValidateConfigTool","createExecuteWorkflowTool","createCreateWorkflowTool","createListWorkflowsTool","createExecuteCommandTool","createListTerminalsTool","createCreateTerminalTool","enhancedTools","Promise","all","map","name","properties","capabilities","items","systemPrompt","maxConcurrentTasks","default","priority","environment","workingDirectory","required","handler","input","context","info","sessionId","orchestrator","Error","profile","id","Date","now","Math","random","toString","substr","getDefaultSystemPrompt","spawnAgent","agentId","status","timestamp","toISOString","includeTerminated","filterByType","agents","listAgents","filteredAgents","filter","agent","count","length","reason","graceful","terminateAgent","agentInfo","getAgentInfo","dependencies","assignToAgent","assignToAgentType","timeout","task","createdAt","taskId","createTask","assignTask","assignTaskToType","limit","offset","tasks","listTasks","getTask","cancelTask","tags","search","startTime","format","endTime","query","undefined","queryMemory","content","parentId","entry","version","entryId","storeMemory","deleteMemory","exportResult","exportMemory","filePath","mergeStrategy","importResult","importMemory","getSystemStatus","timeRange","metrics","getMetrics","deep","healthCheck","performHealthCheck","section","config","getConfig","restart","result","updateConfig","validation","validateConfig","workflow","parameters","executeWorkflow","assignTo","savePath","created","createWorkflow","directory","workflows","listWorkflows","command","args","cwd","env","terminalId","executeCommand","includeIdle","terminals","listTerminals","shell","terminal","createTerminal","maxConcurrency","batchSize","executor","getParallelExecutor","agentConfigs","agentType","sessions","spawnParallelAgents","elapsedTime","success","agentsSpawned","size","Array","from","session","performance","totalTime","averageTimePerAgent","speedupVsSequential","round","action","queryId","model","permissionMode","controller","getQueryController","pauseQuery","resumeQuery","terminateQuery","changeModel","changePermissionMode","includeHistory","queries","getAllQueries","prompts","coordinator","researcher","implementer","analyst","custom"],"mappings":"AAMA,SAASA,sBAAsB,QAA4B,8BAA8B;AAUzF,eAAeC,0BAA0BC,IAAa;IACpD,MAAMC,iBAAiB,MAAMH;IAG7B,MAAMI,eAAeC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACL;IAG/C,SAASM,yBAAyBC,GAAQ;QACxC,IAAI,OAAOA,QAAQ,YAAYA,QAAQ,MAAM;QAE7C,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACJ,KAAM;YAC9C,IAAI,OAAOE,UAAU,YAAYA,UAAU,MAAM;gBAE/C,IAAID,QAAQ,UAAUA,QAAQ,kBAAkBA,QAAQ,qBAAqB;oBAC3E,MAAMI,QAAQH;oBACd,IAAIG,MAAMC,IAAI,KAAK,YAAYD,MAAME,WAAW,EAAEC,SAAS,4CAA4C;wBACrGH,MAAMI,IAAI,GAAGf;oBACf;gBACF;gBACAK,yBAAyBG;YAC3B;QACF;IACF;IAEAH,yBAAyBJ,aAAae,WAAW;IACjD,OAAOf;AACT;AAKA,OAAO,eAAegB,sBAAsBC,MAAe;IACzD,MAAMC,QAAQ;QAEZC,qBAAqBF;QACrBG,8BAA8BH;QAC9BI,qBAAqBJ;QACrBK,yBAAyBL;QACzBM,uBAAuBN;QAGvBO,uBAAuBP;QACvBQ,sBAAsBR;QAGtBS,qBAAqBT;QACrBU,oBAAoBV;QACpBW,wBAAwBX;QACxBY,qBAAqBZ;QACrBa,qBAAqBb;QAGrBc,sBAAsBd;QACtBe,sBAAsBf;QACtBgB,uBAAuBhB;QACvBiB,uBAAuBjB;QACvBkB,uBAAuBlB;QAGvBmB,0BAA0BnB;QAC1BoB,qBAAqBpB;QACrBqB,sBAAsBrB;QAGtBsB,oBAAoBtB;QACpBuB,uBAAuBvB;QACvBwB,yBAAyBxB;QAGzByB,0BAA0BzB;QAC1B0B,yBAAyB1B;QACzB2B,w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anI,QAAQG,YAAY,CAACiI,kBAAkB;YAC1D,IAAI,CAACD,YAAY;gBACf,MAAM,IAAI/H,MAAM;YAClB;YAEA,MAAMuI,UAAUR,WAAWS,aAAa;YAExC,OAAO;gBACLxB,SAAS;gBACTuB,SAASpB,MAAMC,IAAI,CAACmB,QAAQnM,OAAO,IAAI0C,GAAG,CAAC,CAAC,CAACoB,IAAIU,OAAO,GAAM,CAAA;wBAC5DgH,SAAS1H;wBACT,GAAGU,MAAM;oBACX,CAAA;gBACAU,OAAOiH,QAAQrB,IAAI;gBACnBrG,WAAW,IAAIV,OAAOW,WAAW;YACnC;QACF;IACF;AACF;AAEA,SAASL,uBAAuBnE,IAAY;IAC1C,MAAMmM,UAAU;QACdC,aACE;QACFC,YACE;QACFC,aACE;QACFC,SACE;QACFC,QAAQ;IACV;IAEA,OAAOL,OAAO,CAACnM,KAA6B,IAAImM,QAAQK,MAAM;AAChE"}
@@ -1603,6 +1603,131 @@ let ClaudeFlowMCPServer = class ClaudeFlowMCPServer {
1603
1603
  }
1604
1604
  }
1605
1605
  }
1606
+ },
1607
+ agents_spawn_parallel: {
1608
+ name: 'agents_spawn_parallel',
1609
+ description: 'Spawn multiple agents in parallel (10-20x faster than sequential spawning)',
1610
+ inputSchema: {
1611
+ type: 'object',
1612
+ properties: {
1613
+ agents: {
1614
+ type: 'array',
1615
+ items: {
1616
+ type: 'object',
1617
+ properties: {
1618
+ type: {
1619
+ type: 'string',
1620
+ description: 'Agent type'
1621
+ },
1622
+ name: {
1623
+ type: 'string',
1624
+ description: 'Agent name'
1625
+ },
1626
+ capabilities: {
1627
+ type: 'array',
1628
+ items: {
1629
+ type: 'string'
1630
+ }
1631
+ },
1632
+ priority: {
1633
+ type: 'string',
1634
+ enum: [
1635
+ 'low',
1636
+ 'medium',
1637
+ 'high',
1638
+ 'critical'
1639
+ ],
1640
+ default: 'medium'
1641
+ }
1642
+ },
1643
+ required: [
1644
+ 'type',
1645
+ 'name'
1646
+ ]
1647
+ },
1648
+ description: 'Array of agent configurations to spawn in parallel'
1649
+ },
1650
+ maxConcurrency: {
1651
+ type: 'number',
1652
+ default: 5,
1653
+ description: 'Maximum number of agents to spawn concurrently'
1654
+ },
1655
+ batchSize: {
1656
+ type: 'number',
1657
+ default: 3,
1658
+ description: 'Number of agents per batch'
1659
+ }
1660
+ },
1661
+ required: [
1662
+ 'agents'
1663
+ ]
1664
+ }
1665
+ },
1666
+ query_control: {
1667
+ name: 'query_control',
1668
+ description: 'Control running queries (pause, resume, terminate, change model)',
1669
+ inputSchema: {
1670
+ type: 'object',
1671
+ properties: {
1672
+ action: {
1673
+ type: 'string',
1674
+ enum: [
1675
+ 'pause',
1676
+ 'resume',
1677
+ 'terminate',
1678
+ 'change_model',
1679
+ 'change_permissions',
1680
+ 'execute_command'
1681
+ ],
1682
+ description: 'Control action to perform'
1683
+ },
1684
+ queryId: {
1685
+ type: 'string',
1686
+ description: 'ID of the query to control'
1687
+ },
1688
+ model: {
1689
+ type: 'string',
1690
+ enum: [
1691
+ 'claude-3-5-sonnet-20241022',
1692
+ 'claude-3-5-haiku-20241022',
1693
+ 'claude-3-opus-20240229'
1694
+ ],
1695
+ description: 'Model to switch to (for change_model action)'
1696
+ },
1697
+ permissionMode: {
1698
+ type: 'string',
1699
+ enum: [
1700
+ 'default',
1701
+ 'acceptEdits',
1702
+ 'bypassPermissions',
1703
+ 'plan'
1704
+ ],
1705
+ description: 'Permission mode to switch to (for change_permissions action)'
1706
+ },
1707
+ command: {
1708
+ type: 'string',
1709
+ description: 'Command to execute (for execute_command action)'
1710
+ }
1711
+ },
1712
+ required: [
1713
+ 'action',
1714
+ 'queryId'
1715
+ ]
1716
+ }
1717
+ },
1718
+ query_list: {
1719
+ name: 'query_list',
1720
+ description: 'List all active queries and their status',
1721
+ inputSchema: {
1722
+ type: 'object',
1723
+ properties: {
1724
+ includeHistory: {
1725
+ type: 'boolean',
1726
+ default: false,
1727
+ description: 'Include completed queries in the list'
1728
+ }
1729
+ }
1730
+ }
1606
1731
  }
1607
1732
  };
1608
1733
  }