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.
- package/.claude/agents/reasoning/README.md +171 -0
- package/.claude/agents/reasoning/agent.md +816 -0
- package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/settings.json +2 -1
- package/.claude/sparc-modes.json +108 -0
- package/README.md +45 -55
- package/bin/claude-flow +1 -1
- package/dist/src/cli/command-registry.js +70 -6
- package/dist/src/cli/command-registry.js.map +1 -1
- package/dist/src/cli/commands/hive-mind/pause.js +2 -9
- package/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
- package/dist/src/cli/commands/index.js +1 -114
- package/dist/src/cli/commands/index.js.map +1 -1
- package/dist/src/cli/commands/swarm-spawn.js +5 -33
- package/dist/src/cli/commands/swarm-spawn.js.map +1 -1
- package/dist/src/cli/help-formatter.js +0 -3
- package/dist/src/cli/help-formatter.js.map +1 -1
- package/dist/src/cli/help-text.js +69 -7
- package/dist/src/cli/help-text.js.map +1 -1
- package/dist/src/cli/simple-cli.js +182 -172
- package/dist/src/cli/simple-cli.js.map +1 -1
- package/dist/src/cli/simple-commands/agent-booster.js +415 -0
- package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
- package/dist/src/cli/simple-commands/agent.js +856 -13
- package/dist/src/cli/simple-commands/agent.js.map +1 -1
- package/dist/src/cli/simple-commands/env-template.js +180 -0
- package/dist/src/cli/simple-commands/env-template.js.map +1 -0
- package/dist/src/cli/simple-commands/hooks.js +233 -0
- package/dist/src/cli/simple-commands/hooks.js.map +1 -1
- package/dist/src/cli/simple-commands/init/help.js +23 -0
- package/dist/src/cli/simple-commands/init/help.js.map +1 -1
- package/dist/src/cli/simple-commands/init/index.js +63 -0
- package/dist/src/cli/simple-commands/init/index.js.map +1 -1
- package/dist/src/cli/simple-commands/memory.js +307 -16
- package/dist/src/cli/simple-commands/memory.js.map +1 -1
- package/dist/src/cli/simple-commands/proxy.js +304 -0
- package/dist/src/cli/simple-commands/proxy.js.map +1 -0
- package/dist/src/cli/simple-commands/sparc.js +16 -19
- package/dist/src/cli/simple-commands/sparc.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/execution/agent-executor.js +181 -0
- package/dist/src/execution/agent-executor.js.map +1 -0
- package/dist/src/execution/index.js +12 -0
- package/dist/src/execution/index.js.map +1 -0
- package/dist/src/execution/provider-manager.js +110 -0
- package/dist/src/execution/provider-manager.js.map +1 -0
- package/dist/src/hooks/index.js +0 -3
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/redaction-hook.js +89 -0
- package/dist/src/hooks/redaction-hook.js.map +1 -0
- package/dist/src/mcp/claude-flow-tools.js +205 -150
- package/dist/src/mcp/claude-flow-tools.js.map +1 -1
- package/dist/src/mcp/mcp-server.js +125 -0
- package/dist/src/mcp/mcp-server.js.map +1 -1
- package/dist/src/sdk/query-control.js +293 -139
- package/dist/src/sdk/query-control.js.map +1 -1
- package/dist/src/sdk/session-forking.js +206 -129
- package/dist/src/sdk/session-forking.js.map +1 -1
- package/dist/src/utils/key-redactor.js +108 -0
- package/dist/src/utils/key-redactor.js.map +1 -0
- package/dist/src/utils/metrics-reader.js +37 -39
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
- package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
- package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
- package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
- package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
- package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
- package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
- package/docs/COMMIT_SUMMARY.md +247 -0
- package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
- package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
- package/docs/ENV-SETUP-GUIDE.md +270 -0
- package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
- package/docs/FINAL_VALIDATION_REPORT.md +165 -0
- package/docs/HOOKS-V2-MODIFICATION.md +146 -0
- package/docs/INDEX.md +568 -0
- package/docs/INTEGRATION_COMPLETE.md +414 -0
- package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
- package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
- package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
- package/docs/README.md +35 -0
- package/docs/REASONING-AGENTS.md +482 -0
- package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
- package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
- package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
- package/docs/REASONINGBANK-BENCHMARK.md +396 -0
- package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
- package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
- package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
- package/docs/REASONINGBANK-DEMO.md +419 -0
- package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
- package/docs/REASONINGBANK-VALIDATION.md +532 -0
- package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
- package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
- package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
- package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
- package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
- package/docs/api/API_DOCUMENTATION.md +721 -0
- package/docs/architecture/ARCHITECTURE.md +1690 -0
- package/docs/ci-cd/README.md +368 -0
- package/docs/development/DEPLOYMENT.md +2348 -0
- package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
- package/docs/development/build-analysis-report.md +252 -0
- package/docs/development/pair-optimization.md +156 -0
- package/docs/development/token-tracking-status.md +103 -0
- package/docs/development/training-pipeline-demo.md +163 -0
- package/docs/development/training-pipeline-real-only.md +196 -0
- package/docs/epic-sdk-integration.md +1269 -0
- package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
- package/docs/experimental/computational_verification.py +436 -0
- package/docs/experimental/novel_approaches.md +560 -0
- package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
- package/docs/experimental/riemann_proof_attempt.md +124 -0
- package/docs/experimental/riemann_synthesis.md +277 -0
- package/docs/experimental/verification_results.json +12 -0
- package/docs/experimental/visualization_insights.md +720 -0
- package/docs/guides/USER_GUIDE.md +1138 -0
- package/docs/guides/token-tracking-guide.md +291 -0
- package/docs/reference/AGENTS.md +1011 -0
- package/docs/reference/MCP_TOOLS.md +2188 -0
- package/docs/reference/SPARC.md +717 -0
- package/docs/reference/SWARM.md +2000 -0
- package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
- package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
- package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
- package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
- package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
- package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
- package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
- package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
- package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
- package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
- package/docs/sdk/epic-sdk-integration.md +1269 -0
- package/docs/setup/remote-setup.md +93 -0
- package/docs/validation/final-validation-summary.md +220 -0
- package/docs/validation/verification-integration.md +190 -0
- package/docs/validation/verification-validation.md +349 -0
- package/docs/wiki/background-commands.md +1213 -0
- package/docs/wiki/session-persistence.md +342 -0
- package/docs/wiki/stream-chain-command.md +537 -0
- package/package.json +4 -2
- package/src/cli/command-registry.js +70 -5
- package/src/cli/commands/hive-mind/pause.ts +2 -15
- package/src/cli/commands/index.ts +1 -84
- package/src/cli/commands/swarm-spawn.ts +3 -47
- package/src/cli/help-text.js +42 -7
- package/src/cli/simple-cli.ts +18 -8
- package/src/cli/simple-commands/agent-booster.js +515 -0
- package/src/cli/simple-commands/agent.js +1001 -12
- package/src/cli/simple-commands/agent.ts +137 -0
- package/src/cli/simple-commands/config.ts +127 -0
- package/src/cli/simple-commands/env-template.js +190 -0
- package/src/cli/simple-commands/hooks.js +310 -0
- package/src/cli/simple-commands/init/help.js +23 -0
- package/src/cli/simple-commands/init/index.js +84 -6
- package/src/cli/simple-commands/memory.js +363 -16
- package/src/cli/simple-commands/proxy.js +384 -0
- package/src/cli/simple-commands/sparc.js +16 -19
- package/src/execution/agent-executor.ts +306 -0
- package/src/execution/index.ts +19 -0
- package/src/execution/provider-manager.ts +187 -0
- package/src/hooks/index.ts +0 -5
- package/src/hooks/redaction-hook.ts +115 -0
- package/src/mcp/claude-flow-tools.ts +203 -120
- package/src/mcp/mcp-server.js +86 -0
- package/src/sdk/query-control.ts +377 -223
- package/src/sdk/session-forking.ts +312 -207
- package/src/utils/key-redactor.js +178 -0
- package/src/utils/key-redactor.ts +184 -0
|
@@ -49,11 +49,14 @@ export async function createClaudeFlowTools(logger: ILogger): Promise<MCPTool[]>
|
|
|
49
49
|
const tools = [
|
|
50
50
|
// Agent management tools
|
|
51
51
|
createSpawnAgentTool(logger),
|
|
52
|
+
createSpawnParallelAgentsTool(logger), // NEW: Phase 4 - Parallel spawning
|
|
52
53
|
createListAgentsTool(logger),
|
|
53
54
|
createTerminateAgentTool(logger),
|
|
54
55
|
createGetAgentInfoTool(logger),
|
|
55
56
|
|
|
56
|
-
//
|
|
57
|
+
// Query control tools (NEW: Phase 4 - Real-time control)
|
|
58
|
+
createQueryControlTool(logger),
|
|
59
|
+
createListQueriesTool(logger),
|
|
57
60
|
|
|
58
61
|
// Task management tools
|
|
59
62
|
createCreateTaskTool(logger),
|
|
@@ -550,7 +553,7 @@ function createAssignTaskTool(logger: ILogger): MCPTool {
|
|
|
550
553
|
|
|
551
554
|
function createQueryMemoryTool(logger: ILogger): MCPTool {
|
|
552
555
|
return {
|
|
553
|
-
name: '
|
|
556
|
+
name: 'memory/query',
|
|
554
557
|
description: 'Query agent memory with filters and search',
|
|
555
558
|
inputSchema: {
|
|
556
559
|
type: 'object',
|
|
@@ -632,7 +635,7 @@ function createQueryMemoryTool(logger: ILogger): MCPTool {
|
|
|
632
635
|
|
|
633
636
|
function createStoreMemoryTool(logger: ILogger): MCPTool {
|
|
634
637
|
return {
|
|
635
|
-
name: '
|
|
638
|
+
name: 'memory/store',
|
|
636
639
|
description: 'Store a new memory entry',
|
|
637
640
|
inputSchema: {
|
|
638
641
|
type: 'object',
|
|
@@ -702,7 +705,7 @@ function createStoreMemoryTool(logger: ILogger): MCPTool {
|
|
|
702
705
|
|
|
703
706
|
function createDeleteMemoryTool(logger: ILogger): MCPTool {
|
|
704
707
|
return {
|
|
705
|
-
name: '
|
|
708
|
+
name: 'memory/delete',
|
|
706
709
|
description: 'Delete a memory entry',
|
|
707
710
|
inputSchema: {
|
|
708
711
|
type: 'object',
|
|
@@ -734,7 +737,7 @@ function createDeleteMemoryTool(logger: ILogger): MCPTool {
|
|
|
734
737
|
|
|
735
738
|
function createExportMemoryTool(logger: ILogger): MCPTool {
|
|
736
739
|
return {
|
|
737
|
-
name: '
|
|
740
|
+
name: 'memory/export',
|
|
738
741
|
description: 'Export memory entries to a file',
|
|
739
742
|
inputSchema: {
|
|
740
743
|
type: 'object',
|
|
@@ -790,7 +793,7 @@ function createExportMemoryTool(logger: ILogger): MCPTool {
|
|
|
790
793
|
|
|
791
794
|
function createImportMemoryTool(logger: ILogger): MCPTool {
|
|
792
795
|
return {
|
|
793
|
-
name: '
|
|
796
|
+
name: 'memory/import',
|
|
794
797
|
description: 'Import memory entries from a file',
|
|
795
798
|
inputSchema: {
|
|
796
799
|
type: 'object',
|
|
@@ -1309,156 +1312,236 @@ function createCreateTerminalTool(logger: ILogger): MCPTool {
|
|
|
1309
1312
|
}
|
|
1310
1313
|
|
|
1311
1314
|
/**
|
|
1312
|
-
*
|
|
1315
|
+
* NEW: Phase 4 - Parallel Agent Spawning (10-20x faster)
|
|
1316
|
+
* Spawn multiple agents in parallel using ParallelSwarmExecutor
|
|
1313
1317
|
*/
|
|
1314
|
-
function
|
|
1318
|
+
function createSpawnParallelAgentsTool(logger: ILogger): MCPTool {
|
|
1315
1319
|
return {
|
|
1316
|
-
name: '
|
|
1317
|
-
description: '
|
|
1320
|
+
name: 'agents/spawn_parallel',
|
|
1321
|
+
description: 'Spawn multiple agents in parallel (10-20x faster than sequential spawning)',
|
|
1318
1322
|
inputSchema: {
|
|
1319
1323
|
type: 'object',
|
|
1320
1324
|
properties: {
|
|
1321
|
-
|
|
1322
|
-
|
|
1325
|
+
agents: {
|
|
1326
|
+
type: 'array',
|
|
1327
|
+
items: {
|
|
1328
|
+
type: 'object',
|
|
1329
|
+
properties: {
|
|
1330
|
+
type: { type: 'string', description: 'Agent type' },
|
|
1331
|
+
name: { type: 'string', description: 'Agent name' },
|
|
1332
|
+
capabilities: { type: 'array', items: { type: 'string' } },
|
|
1333
|
+
priority: {
|
|
1334
|
+
type: 'string',
|
|
1335
|
+
enum: ['low', 'medium', 'high', 'critical'],
|
|
1336
|
+
default: 'medium'
|
|
1337
|
+
},
|
|
1338
|
+
},
|
|
1339
|
+
required: ['type', 'name'],
|
|
1340
|
+
},
|
|
1341
|
+
description: 'Array of agent configurations to spawn in parallel',
|
|
1342
|
+
},
|
|
1343
|
+
maxConcurrency: {
|
|
1344
|
+
type: 'number',
|
|
1345
|
+
default: 5,
|
|
1346
|
+
description: 'Maximum number of agents to spawn concurrently',
|
|
1347
|
+
},
|
|
1348
|
+
batchSize: {
|
|
1349
|
+
type: 'number',
|
|
1350
|
+
default: 3,
|
|
1351
|
+
description: 'Number of agents per batch',
|
|
1352
|
+
},
|
|
1323
1353
|
},
|
|
1324
|
-
required: ['
|
|
1354
|
+
required: ['agents'],
|
|
1325
1355
|
},
|
|
1326
|
-
handler: async (input: any) => {
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
);
|
|
1332
|
-
return { success: true, checkpointId, sessionId: input.sessionId };
|
|
1333
|
-
},
|
|
1334
|
-
};
|
|
1335
|
-
}
|
|
1356
|
+
handler: async (input: any, context?: ClaudeFlowToolContext) => {
|
|
1357
|
+
logger.info('Spawning parallel agents', {
|
|
1358
|
+
count: input.agents?.length,
|
|
1359
|
+
sessionId: context?.sessionId
|
|
1360
|
+
});
|
|
1336
1361
|
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
description: 'List all checkpoints for a session',
|
|
1341
|
-
inputSchema: {
|
|
1342
|
-
type: 'object',
|
|
1343
|
-
properties: {
|
|
1344
|
-
sessionId: { type: 'string', description: 'Session ID' },
|
|
1345
|
-
},
|
|
1346
|
-
required: ['sessionId'],
|
|
1347
|
-
},
|
|
1348
|
-
handler: async (input: any) => {
|
|
1349
|
-
|
|
1350
|
-
const checkpoints = checkpointManager.listCheckpoints(input.sessionId);
|
|
1351
|
-
return { success: true, checkpoints, count: checkpoints.length };
|
|
1352
|
-
},
|
|
1353
|
-
};
|
|
1354
|
-
}
|
|
1362
|
+
if (!context?.orchestrator) {
|
|
1363
|
+
throw new Error('Orchestrator not available');
|
|
1364
|
+
}
|
|
1355
1365
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
input.
|
|
1373
|
-
|
|
1374
|
-
|
|
1366
|
+
const executor = context.orchestrator.getParallelExecutor();
|
|
1367
|
+
if (!executor) {
|
|
1368
|
+
throw new Error('ParallelSwarmExecutor not initialized');
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
// Convert input agents to ParallelAgentConfig format
|
|
1372
|
+
const agentConfigs = input.agents.map((agent: any) => ({
|
|
1373
|
+
agentId: `agent_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
1374
|
+
agentType: agent.type,
|
|
1375
|
+
task: `Spawn ${agent.name} agent`,
|
|
1376
|
+
capabilities: agent.capabilities || [],
|
|
1377
|
+
priority: agent.priority || 'medium',
|
|
1378
|
+
}));
|
|
1379
|
+
|
|
1380
|
+
const startTime = Date.now();
|
|
1381
|
+
const sessions = await executor.spawnParallelAgents(agentConfigs, {
|
|
1382
|
+
maxConcurrency: input.maxConcurrency || 5,
|
|
1383
|
+
batchSize: input.batchSize || 3,
|
|
1384
|
+
});
|
|
1385
|
+
|
|
1386
|
+
const elapsedTime = Date.now() - startTime;
|
|
1387
|
+
|
|
1388
|
+
return {
|
|
1389
|
+
success: true,
|
|
1390
|
+
agentsSpawned: sessions.size,
|
|
1391
|
+
sessions: Array.from(sessions.entries()).map(([id, session]) => ({
|
|
1392
|
+
agentId: id,
|
|
1393
|
+
sessionId: session.sessionId,
|
|
1394
|
+
status: session.status,
|
|
1395
|
+
})),
|
|
1396
|
+
performance: {
|
|
1397
|
+
totalTime: elapsedTime,
|
|
1398
|
+
averageTimePerAgent: elapsedTime / sessions.size,
|
|
1399
|
+
speedupVsSequential: `~${Math.round((sessions.size * 750) / elapsedTime)}x`,
|
|
1400
|
+
},
|
|
1401
|
+
timestamp: new Date().toISOString(),
|
|
1402
|
+
};
|
|
1375
1403
|
},
|
|
1376
1404
|
};
|
|
1377
1405
|
}
|
|
1378
1406
|
|
|
1379
1407
|
/**
|
|
1380
|
-
*
|
|
1408
|
+
* NEW: Phase 4 - Real-Time Query Control
|
|
1409
|
+
* Control running queries: pause, resume, terminate, change model
|
|
1381
1410
|
*/
|
|
1382
|
-
function
|
|
1411
|
+
function createQueryControlTool(logger: ILogger): MCPTool {
|
|
1383
1412
|
return {
|
|
1384
|
-
name: '
|
|
1385
|
-
description: '
|
|
1413
|
+
name: 'query/control',
|
|
1414
|
+
description: 'Control running queries (pause, resume, terminate, change model)',
|
|
1386
1415
|
inputSchema: {
|
|
1387
1416
|
type: 'object',
|
|
1388
1417
|
properties: {
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
description: '
|
|
1393
|
-
|
|
1418
|
+
action: {
|
|
1419
|
+
type: 'string',
|
|
1420
|
+
enum: ['pause', 'resume', 'terminate', 'change_model', 'change_permissions', 'execute_command'],
|
|
1421
|
+
description: 'Control action to perform',
|
|
1422
|
+
},
|
|
1423
|
+
queryId: {
|
|
1424
|
+
type: 'string',
|
|
1425
|
+
description: 'ID of the query to control',
|
|
1426
|
+
},
|
|
1427
|
+
model: {
|
|
1428
|
+
type: 'string',
|
|
1429
|
+
enum: ['claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022', 'claude-3-opus-20240229'],
|
|
1430
|
+
description: 'Model to switch to (for change_model action)',
|
|
1431
|
+
},
|
|
1432
|
+
permissionMode: {
|
|
1433
|
+
type: 'string',
|
|
1434
|
+
enum: ['default', 'acceptEdits', 'bypassPermissions', 'plan'],
|
|
1435
|
+
description: 'Permission mode to switch to (for change_permissions action)',
|
|
1436
|
+
},
|
|
1437
|
+
command: {
|
|
1438
|
+
type: 'string',
|
|
1439
|
+
description: 'Command to execute (for execute_command action)',
|
|
1394
1440
|
},
|
|
1395
1441
|
},
|
|
1396
|
-
required: ['
|
|
1397
|
-
},
|
|
1398
|
-
handler: async (input: any) => {
|
|
1399
|
-
|
|
1400
|
-
const fork = await sessionForking.fork(input.sessionId, input.forkOptions || {});
|
|
1401
|
-
return { success: true, fork };
|
|
1442
|
+
required: ['action', 'queryId'],
|
|
1402
1443
|
},
|
|
1403
|
-
|
|
1404
|
-
|
|
1444
|
+
handler: async (input: any, context?: ClaudeFlowToolContext) => {
|
|
1445
|
+
logger.info('Query control action', {
|
|
1446
|
+
action: input.action,
|
|
1447
|
+
queryId: input.queryId,
|
|
1448
|
+
sessionId: context?.sessionId
|
|
1449
|
+
});
|
|
1405
1450
|
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1451
|
+
if (!context?.orchestrator) {
|
|
1452
|
+
throw new Error('Orchestrator not available');
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
const controller = context.orchestrator.getQueryController();
|
|
1456
|
+
if (!controller) {
|
|
1457
|
+
throw new Error('RealTimeQueryController not initialized');
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
let result;
|
|
1461
|
+
switch (input.action) {
|
|
1462
|
+
case 'pause':
|
|
1463
|
+
result = await controller.pauseQuery(input.queryId);
|
|
1464
|
+
break;
|
|
1465
|
+
case 'resume':
|
|
1466
|
+
result = await controller.resumeQuery(input.queryId);
|
|
1467
|
+
break;
|
|
1468
|
+
case 'terminate':
|
|
1469
|
+
result = await controller.terminateQuery(input.queryId);
|
|
1470
|
+
break;
|
|
1471
|
+
case 'change_model':
|
|
1472
|
+
if (!input.model) {
|
|
1473
|
+
throw new Error('model parameter required for change_model action');
|
|
1474
|
+
}
|
|
1475
|
+
result = await controller.changeModel(input.queryId, input.model);
|
|
1476
|
+
break;
|
|
1477
|
+
case 'change_permissions':
|
|
1478
|
+
if (!input.permissionMode) {
|
|
1479
|
+
throw new Error('permissionMode parameter required for change_permissions action');
|
|
1480
|
+
}
|
|
1481
|
+
result = await controller.changePermissionMode(input.queryId, input.permissionMode);
|
|
1482
|
+
break;
|
|
1483
|
+
case 'execute_command':
|
|
1484
|
+
if (!input.command) {
|
|
1485
|
+
throw new Error('command parameter required for execute_command action');
|
|
1486
|
+
}
|
|
1487
|
+
result = await controller.executeCommand(input.queryId, input.command);
|
|
1488
|
+
break;
|
|
1489
|
+
default:
|
|
1490
|
+
throw new Error(`Unknown action: ${input.action}`);
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
return {
|
|
1494
|
+
success: true,
|
|
1495
|
+
action: input.action,
|
|
1496
|
+
queryId: input.queryId,
|
|
1497
|
+
result,
|
|
1498
|
+
timestamp: new Date().toISOString(),
|
|
1499
|
+
};
|
|
1421
1500
|
},
|
|
1422
1501
|
};
|
|
1423
1502
|
}
|
|
1424
1503
|
|
|
1425
1504
|
/**
|
|
1426
|
-
*
|
|
1505
|
+
* NEW: Phase 4 - List Active Queries
|
|
1506
|
+
* Get status of all active queries being controlled
|
|
1427
1507
|
*/
|
|
1428
|
-
function
|
|
1508
|
+
function createListQueriesTool(logger: ILogger): MCPTool {
|
|
1429
1509
|
return {
|
|
1430
|
-
name: '
|
|
1431
|
-
description: '
|
|
1510
|
+
name: 'query/list',
|
|
1511
|
+
description: 'List all active queries and their status',
|
|
1432
1512
|
inputSchema: {
|
|
1433
1513
|
type: 'object',
|
|
1434
1514
|
properties: {
|
|
1435
|
-
|
|
1515
|
+
includeHistory: {
|
|
1516
|
+
type: 'boolean',
|
|
1517
|
+
default: false,
|
|
1518
|
+
description: 'Include completed queries in the list',
|
|
1519
|
+
},
|
|
1436
1520
|
},
|
|
1437
|
-
required: ['sessionId'],
|
|
1438
|
-
},
|
|
1439
|
-
handler: async (input: any) => {
|
|
1440
|
-
const { queryController } = await import('../sdk/query-control.js');
|
|
1441
|
-
queryController.requestPause(input.sessionId);
|
|
1442
|
-
return { success: true, sessionId: input.sessionId, paused: true };
|
|
1443
1521
|
},
|
|
1444
|
-
|
|
1445
|
-
}
|
|
1522
|
+
handler: async (input: any, context?: ClaudeFlowToolContext) => {
|
|
1523
|
+
logger.info('Listing queries', { sessionId: context?.sessionId });
|
|
1446
1524
|
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1525
|
+
if (!context?.orchestrator) {
|
|
1526
|
+
throw new Error('Orchestrator not available');
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
const controller = context.orchestrator.getQueryController();
|
|
1530
|
+
if (!controller) {
|
|
1531
|
+
throw new Error('RealTimeQueryController not initialized');
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
const queries = controller.getAllQueries();
|
|
1535
|
+
|
|
1536
|
+
return {
|
|
1537
|
+
success: true,
|
|
1538
|
+
queries: Array.from(queries.entries()).map(([id, status]) => ({
|
|
1539
|
+
queryId: id,
|
|
1540
|
+
...status,
|
|
1541
|
+
})),
|
|
1542
|
+
count: queries.size,
|
|
1543
|
+
timestamp: new Date().toISOString(),
|
|
1544
|
+
};
|
|
1462
1545
|
},
|
|
1463
1546
|
};
|
|
1464
1547
|
}
|
package/src/mcp/mcp-server.js
CHANGED
|
@@ -932,6 +932,92 @@ class ClaudeFlowMCPServer {
|
|
|
932
932
|
inputSchema: { type: 'object', properties: { components: { type: 'array' } } },
|
|
933
933
|
},
|
|
934
934
|
|
|
935
|
+
// Phase 4: SDK Integration - Real-Time Query Control & Parallel Spawning (v2.5.0-alpha.131)
|
|
936
|
+
agents_spawn_parallel: {
|
|
937
|
+
name: 'agents_spawn_parallel',
|
|
938
|
+
description: 'Spawn multiple agents in parallel (10-20x faster than sequential spawning)',
|
|
939
|
+
inputSchema: {
|
|
940
|
+
type: 'object',
|
|
941
|
+
properties: {
|
|
942
|
+
agents: {
|
|
943
|
+
type: 'array',
|
|
944
|
+
items: {
|
|
945
|
+
type: 'object',
|
|
946
|
+
properties: {
|
|
947
|
+
type: { type: 'string', description: 'Agent type' },
|
|
948
|
+
name: { type: 'string', description: 'Agent name' },
|
|
949
|
+
capabilities: { type: 'array', items: { type: 'string' } },
|
|
950
|
+
priority: {
|
|
951
|
+
type: 'string',
|
|
952
|
+
enum: ['low', 'medium', 'high', 'critical'],
|
|
953
|
+
default: 'medium'
|
|
954
|
+
},
|
|
955
|
+
},
|
|
956
|
+
required: ['type', 'name'],
|
|
957
|
+
},
|
|
958
|
+
description: 'Array of agent configurations to spawn in parallel',
|
|
959
|
+
},
|
|
960
|
+
maxConcurrency: {
|
|
961
|
+
type: 'number',
|
|
962
|
+
default: 5,
|
|
963
|
+
description: 'Maximum number of agents to spawn concurrently',
|
|
964
|
+
},
|
|
965
|
+
batchSize: {
|
|
966
|
+
type: 'number',
|
|
967
|
+
default: 3,
|
|
968
|
+
description: 'Number of agents per batch',
|
|
969
|
+
},
|
|
970
|
+
},
|
|
971
|
+
required: ['agents'],
|
|
972
|
+
},
|
|
973
|
+
},
|
|
974
|
+
query_control: {
|
|
975
|
+
name: 'query_control',
|
|
976
|
+
description: 'Control running queries (pause, resume, terminate, change model)',
|
|
977
|
+
inputSchema: {
|
|
978
|
+
type: 'object',
|
|
979
|
+
properties: {
|
|
980
|
+
action: {
|
|
981
|
+
type: 'string',
|
|
982
|
+
enum: ['pause', 'resume', 'terminate', 'change_model', 'change_permissions', 'execute_command'],
|
|
983
|
+
description: 'Control action to perform',
|
|
984
|
+
},
|
|
985
|
+
queryId: {
|
|
986
|
+
type: 'string',
|
|
987
|
+
description: 'ID of the query to control',
|
|
988
|
+
},
|
|
989
|
+
model: {
|
|
990
|
+
type: 'string',
|
|
991
|
+
enum: ['claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022', 'claude-3-opus-20240229'],
|
|
992
|
+
description: 'Model to switch to (for change_model action)',
|
|
993
|
+
},
|
|
994
|
+
permissionMode: {
|
|
995
|
+
type: 'string',
|
|
996
|
+
enum: ['default', 'acceptEdits', 'bypassPermissions', 'plan'],
|
|
997
|
+
description: 'Permission mode to switch to (for change_permissions action)',
|
|
998
|
+
},
|
|
999
|
+
command: {
|
|
1000
|
+
type: 'string',
|
|
1001
|
+
description: 'Command to execute (for execute_command action)',
|
|
1002
|
+
},
|
|
1003
|
+
},
|
|
1004
|
+
required: ['action', 'queryId'],
|
|
1005
|
+
},
|
|
1006
|
+
},
|
|
1007
|
+
query_list: {
|
|
1008
|
+
name: 'query_list',
|
|
1009
|
+
description: 'List all active queries and their status',
|
|
1010
|
+
inputSchema: {
|
|
1011
|
+
type: 'object',
|
|
1012
|
+
properties: {
|
|
1013
|
+
includeHistory: {
|
|
1014
|
+
type: 'boolean',
|
|
1015
|
+
default: false,
|
|
1016
|
+
description: 'Include completed queries in the list',
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
},
|
|
935
1021
|
};
|
|
936
1022
|
}
|
|
937
1023
|
|