claude-flow 2.5.0-alpha.138 → 2.5.0-alpha.139
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/bin/claude-flow +1 -1
- package/dist/src/cli/commands/checkpoint.js +156 -0
- package/dist/src/cli/commands/checkpoint.js.map +1 -0
- package/dist/src/cli/commands/hive-mind/pause.js +9 -2
- package/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
- package/dist/src/cli/commands/index.js +114 -1
- package/dist/src/cli/commands/index.js.map +1 -1
- package/dist/src/cli/commands/swarm-spawn.js +33 -5
- package/dist/src/cli/commands/swarm-spawn.js.map +1 -1
- package/dist/src/cli/help-formatter.js +3 -0
- package/dist/src/cli/help-formatter.js.map +1 -1
- package/dist/src/cli/help-text.js +2 -16
- package/dist/src/cli/help-text.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/hooks/index.js +3 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/mcp/claude-flow-tools.js +150 -205
- package/dist/src/mcp/claude-flow-tools.js.map +1 -1
- package/dist/src/mcp/mcp-server.js +0 -125
- package/dist/src/mcp/mcp-server.js.map +1 -1
- package/dist/src/sdk/checkpoint-manager.js +237 -0
- package/dist/src/sdk/checkpoint-manager.js.map +1 -0
- package/dist/src/sdk/claude-flow-mcp-integration.js +221 -0
- package/dist/src/sdk/claude-flow-mcp-integration.js.map +1 -0
- package/dist/src/sdk/in-process-mcp.js +374 -0
- package/dist/src/sdk/in-process-mcp.js.map +1 -0
- package/dist/src/sdk/query-control.js +139 -293
- package/dist/src/sdk/query-control.js.map +1 -1
- package/dist/src/sdk/session-forking.js +129 -206
- package/dist/src/sdk/session-forking.js.map +1 -1
- package/dist/src/sdk/validation-demo.js +369 -0
- package/dist/src/sdk/validation-demo.js.map +1 -0
- package/package.json +1 -1
- package/scripts/validate-sdk-integration.ts +188 -0
- package/src/cli/commands/checkpoint.ts +220 -0
- package/src/cli/commands/hive-mind/pause.ts +15 -2
- package/src/cli/commands/index.ts +84 -1
- package/src/cli/commands/swarm-spawn.ts +47 -3
- package/src/cli/help-text.js +2 -16
- package/src/cli/simple-cli.ts +1 -0
- package/src/hooks/index.ts +5 -0
- package/src/mcp/claude-flow-tools.ts +120 -203
- package/src/mcp/mcp-server.js +0 -86
- package/src/sdk/checkpoint-manager.ts +403 -0
- package/src/sdk/claude-flow-mcp-integration.ts +387 -0
- package/src/sdk/in-process-mcp.ts +489 -0
- package/src/sdk/query-control.ts +223 -377
- package/src/sdk/session-forking.ts +207 -312
- package/src/sdk/validation-demo.ts +544 -0
|
@@ -22,12 +22,9 @@ async function enhanceToolWithAgentTypes(tool) {
|
|
|
22
22
|
export async function createClaudeFlowTools(logger) {
|
|
23
23
|
const tools = [
|
|
24
24
|
createSpawnAgentTool(logger),
|
|
25
|
-
createSpawnParallelAgentsTool(logger),
|
|
26
25
|
createListAgentsTool(logger),
|
|
27
26
|
createTerminateAgentTool(logger),
|
|
28
27
|
createGetAgentInfoTool(logger),
|
|
29
|
-
createQueryControlTool(logger),
|
|
30
|
-
createListQueriesTool(logger),
|
|
31
28
|
createCreateTaskTool(logger),
|
|
32
29
|
createListTasksTool(logger),
|
|
33
30
|
createGetTaskStatusTool(logger),
|
|
@@ -517,7 +514,7 @@ function createAssignTaskTool(logger) {
|
|
|
517
514
|
}
|
|
518
515
|
function createQueryMemoryTool(logger) {
|
|
519
516
|
return {
|
|
520
|
-
name: '
|
|
517
|
+
name: 'memory_query',
|
|
521
518
|
description: 'Query agent memory with filters and search',
|
|
522
519
|
inputSchema: {
|
|
523
520
|
type: 'object',
|
|
@@ -605,7 +602,7 @@ function createQueryMemoryTool(logger) {
|
|
|
605
602
|
}
|
|
606
603
|
function createStoreMemoryTool(logger) {
|
|
607
604
|
return {
|
|
608
|
-
name: '
|
|
605
|
+
name: 'memory_store',
|
|
609
606
|
description: 'Store a new memory entry',
|
|
610
607
|
inputSchema: {
|
|
611
608
|
type: 'object',
|
|
@@ -689,7 +686,7 @@ function createStoreMemoryTool(logger) {
|
|
|
689
686
|
}
|
|
690
687
|
function createDeleteMemoryTool(logger) {
|
|
691
688
|
return {
|
|
692
|
-
name: '
|
|
689
|
+
name: 'memory_delete',
|
|
693
690
|
description: 'Delete a memory entry',
|
|
694
691
|
inputSchema: {
|
|
695
692
|
type: 'object',
|
|
@@ -722,7 +719,7 @@ function createDeleteMemoryTool(logger) {
|
|
|
722
719
|
}
|
|
723
720
|
function createExportMemoryTool(logger) {
|
|
724
721
|
return {
|
|
725
|
-
name: '
|
|
722
|
+
name: 'memory_export',
|
|
726
723
|
description: 'Export memory entries to a file',
|
|
727
724
|
inputSchema: {
|
|
728
725
|
type: 'object',
|
|
@@ -781,7 +778,7 @@ function createExportMemoryTool(logger) {
|
|
|
781
778
|
}
|
|
782
779
|
function createImportMemoryTool(logger) {
|
|
783
780
|
return {
|
|
784
|
-
name: '
|
|
781
|
+
name: 'memory_import',
|
|
785
782
|
description: 'Import memory entries from a file',
|
|
786
783
|
inputSchema: {
|
|
787
784
|
type: 'object',
|
|
@@ -1333,249 +1330,197 @@ function createCreateTerminalTool(logger) {
|
|
|
1333
1330
|
}
|
|
1334
1331
|
};
|
|
1335
1332
|
}
|
|
1336
|
-
function
|
|
1333
|
+
function createCheckpointCreateTool(logger) {
|
|
1337
1334
|
return {
|
|
1338
|
-
name: '
|
|
1339
|
-
description: '
|
|
1335
|
+
name: 'checkpoint_create',
|
|
1336
|
+
description: 'Create a checkpoint for a session (Git-like time travel)',
|
|
1340
1337
|
inputSchema: {
|
|
1341
1338
|
type: 'object',
|
|
1342
1339
|
properties: {
|
|
1343
|
-
|
|
1344
|
-
type: '
|
|
1345
|
-
|
|
1346
|
-
type: 'object',
|
|
1347
|
-
properties: {
|
|
1348
|
-
type: {
|
|
1349
|
-
type: 'string',
|
|
1350
|
-
description: 'Agent type'
|
|
1351
|
-
},
|
|
1352
|
-
name: {
|
|
1353
|
-
type: 'string',
|
|
1354
|
-
description: 'Agent name'
|
|
1355
|
-
},
|
|
1356
|
-
capabilities: {
|
|
1357
|
-
type: 'array',
|
|
1358
|
-
items: {
|
|
1359
|
-
type: 'string'
|
|
1360
|
-
}
|
|
1361
|
-
},
|
|
1362
|
-
priority: {
|
|
1363
|
-
type: 'string',
|
|
1364
|
-
enum: [
|
|
1365
|
-
'low',
|
|
1366
|
-
'medium',
|
|
1367
|
-
'high',
|
|
1368
|
-
'critical'
|
|
1369
|
-
],
|
|
1370
|
-
default: 'medium'
|
|
1371
|
-
}
|
|
1372
|
-
},
|
|
1373
|
-
required: [
|
|
1374
|
-
'type',
|
|
1375
|
-
'name'
|
|
1376
|
-
]
|
|
1377
|
-
},
|
|
1378
|
-
description: 'Array of agent configurations to spawn in parallel'
|
|
1379
|
-
},
|
|
1380
|
-
maxConcurrency: {
|
|
1381
|
-
type: 'number',
|
|
1382
|
-
default: 5,
|
|
1383
|
-
description: 'Maximum number of agents to spawn concurrently'
|
|
1340
|
+
sessionId: {
|
|
1341
|
+
type: 'string',
|
|
1342
|
+
description: 'Session ID to checkpoint'
|
|
1384
1343
|
},
|
|
1385
|
-
|
|
1386
|
-
type: '
|
|
1387
|
-
|
|
1388
|
-
description: 'Number of agents per batch'
|
|
1344
|
+
description: {
|
|
1345
|
+
type: 'string',
|
|
1346
|
+
description: "Checkpoint description"
|
|
1389
1347
|
}
|
|
1390
1348
|
},
|
|
1391
1349
|
required: [
|
|
1392
|
-
'
|
|
1350
|
+
'sessionId'
|
|
1393
1351
|
]
|
|
1394
1352
|
},
|
|
1395
|
-
handler: async (input
|
|
1396
|
-
|
|
1397
|
-
count: input.agents?.length,
|
|
1398
|
-
sessionId: context?.sessionId
|
|
1399
|
-
});
|
|
1400
|
-
if (!context?.orchestrator) {
|
|
1401
|
-
throw new Error('Orchestrator not available');
|
|
1402
|
-
}
|
|
1403
|
-
const executor = context.orchestrator.getParallelExecutor();
|
|
1404
|
-
if (!executor) {
|
|
1405
|
-
throw new Error('ParallelSwarmExecutor not initialized');
|
|
1406
|
-
}
|
|
1407
|
-
const agentConfigs = input.agents.map((agent)=>({
|
|
1408
|
-
agentId: `agent_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
1409
|
-
agentType: agent.type,
|
|
1410
|
-
task: `Spawn ${agent.name} agent`,
|
|
1411
|
-
capabilities: agent.capabilities || [],
|
|
1412
|
-
priority: agent.priority || 'medium'
|
|
1413
|
-
}));
|
|
1414
|
-
const startTime = Date.now();
|
|
1415
|
-
const sessions = await executor.spawnParallelAgents(agentConfigs, {
|
|
1416
|
-
maxConcurrency: input.maxConcurrency || 5,
|
|
1417
|
-
batchSize: input.batchSize || 3
|
|
1418
|
-
});
|
|
1419
|
-
const elapsedTime = Date.now() - startTime;
|
|
1353
|
+
handler: async (input)=>{
|
|
1354
|
+
const checkpointId = await checkpointManager.createCheckpoint(input.sessionId, input.description || `Checkpoint at ${new Date().toLocaleString()}`);
|
|
1420
1355
|
return {
|
|
1421
1356
|
success: true,
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
agentId: id,
|
|
1425
|
-
sessionId: session.sessionId,
|
|
1426
|
-
status: session.status
|
|
1427
|
-
})),
|
|
1428
|
-
performance: {
|
|
1429
|
-
totalTime: elapsedTime,
|
|
1430
|
-
averageTimePerAgent: elapsedTime / sessions.size,
|
|
1431
|
-
speedupVsSequential: `~${Math.round(sessions.size * 750 / elapsedTime)}x`
|
|
1432
|
-
},
|
|
1433
|
-
timestamp: new Date().toISOString()
|
|
1357
|
+
checkpointId,
|
|
1358
|
+
sessionId: input.sessionId
|
|
1434
1359
|
};
|
|
1435
1360
|
}
|
|
1436
1361
|
};
|
|
1437
1362
|
}
|
|
1438
|
-
function
|
|
1363
|
+
function createCheckpointListTool(logger) {
|
|
1439
1364
|
return {
|
|
1440
|
-
name: '
|
|
1441
|
-
description: '
|
|
1365
|
+
name: 'checkpoint_list',
|
|
1366
|
+
description: 'List all checkpoints for a session',
|
|
1442
1367
|
inputSchema: {
|
|
1443
1368
|
type: 'object',
|
|
1444
1369
|
properties: {
|
|
1445
|
-
|
|
1370
|
+
sessionId: {
|
|
1446
1371
|
type: 'string',
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1372
|
+
description: 'Session ID'
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
required: [
|
|
1376
|
+
'sessionId'
|
|
1377
|
+
]
|
|
1378
|
+
},
|
|
1379
|
+
handler: async (input)=>{
|
|
1380
|
+
const checkpoints = checkpointManager.listCheckpoints(input.sessionId);
|
|
1381
|
+
return {
|
|
1382
|
+
success: true,
|
|
1383
|
+
checkpoints,
|
|
1384
|
+
count: checkpoints.length
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
function createCheckpointRollbackTool(logger) {
|
|
1390
|
+
return {
|
|
1391
|
+
name: 'checkpoint_rollback',
|
|
1392
|
+
description: 'Rollback session to a checkpoint',
|
|
1393
|
+
inputSchema: {
|
|
1394
|
+
type: 'object',
|
|
1395
|
+
properties: {
|
|
1396
|
+
checkpointId: {
|
|
1458
1397
|
type: 'string',
|
|
1459
|
-
description: 'ID
|
|
1398
|
+
description: 'Checkpoint ID to restore'
|
|
1460
1399
|
},
|
|
1461
|
-
|
|
1400
|
+
prompt: {
|
|
1462
1401
|
type: 'string',
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1402
|
+
description: 'Continue prompt after rollback'
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
required: [
|
|
1406
|
+
'checkpointId'
|
|
1407
|
+
]
|
|
1408
|
+
},
|
|
1409
|
+
handler: async (input)=>{
|
|
1410
|
+
await checkpointManager.rollbackToCheckpoint(input.checkpointId, input.prompt || 'Continue from checkpoint');
|
|
1411
|
+
return {
|
|
1412
|
+
success: true,
|
|
1413
|
+
checkpointId: input.checkpointId
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
function createSessionForkTool(logger) {
|
|
1419
|
+
return {
|
|
1420
|
+
name: 'session_fork',
|
|
1421
|
+
description: 'Fork a session for parallel exploration (real SDK forking)',
|
|
1422
|
+
inputSchema: {
|
|
1423
|
+
type: 'object',
|
|
1424
|
+
properties: {
|
|
1425
|
+
sessionId: {
|
|
1471
1426
|
type: 'string',
|
|
1472
|
-
|
|
1473
|
-
'default',
|
|
1474
|
-
'acceptEdits',
|
|
1475
|
-
'bypassPermissions',
|
|
1476
|
-
'plan'
|
|
1477
|
-
],
|
|
1478
|
-
description: 'Permission mode to switch to (for change_permissions action)'
|
|
1427
|
+
description: 'Base session ID to fork from'
|
|
1479
1428
|
},
|
|
1480
|
-
|
|
1429
|
+
forkOptions: {
|
|
1430
|
+
type: 'object',
|
|
1431
|
+
description: 'Fork configuration options',
|
|
1432
|
+
properties: {}
|
|
1433
|
+
}
|
|
1434
|
+
},
|
|
1435
|
+
required: [
|
|
1436
|
+
'sessionId'
|
|
1437
|
+
]
|
|
1438
|
+
},
|
|
1439
|
+
handler: async (input)=>{
|
|
1440
|
+
const fork = await sessionForking.fork(input.sessionId, input.forkOptions || {});
|
|
1441
|
+
return {
|
|
1442
|
+
success: true,
|
|
1443
|
+
fork
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
function createSessionInfoTool(logger) {
|
|
1449
|
+
return {
|
|
1450
|
+
name: 'session_info',
|
|
1451
|
+
description: 'Get session and fork information',
|
|
1452
|
+
inputSchema: {
|
|
1453
|
+
type: 'object',
|
|
1454
|
+
properties: {
|
|
1455
|
+
sessionId: {
|
|
1481
1456
|
type: 'string',
|
|
1482
|
-
description: '
|
|
1457
|
+
description: 'Session ID'
|
|
1483
1458
|
}
|
|
1484
1459
|
},
|
|
1485
1460
|
required: [
|
|
1486
|
-
'
|
|
1487
|
-
'queryId'
|
|
1461
|
+
'sessionId'
|
|
1488
1462
|
]
|
|
1489
1463
|
},
|
|
1490
|
-
handler: async (input
|
|
1491
|
-
|
|
1492
|
-
action: input.action,
|
|
1493
|
-
queryId: input.queryId,
|
|
1494
|
-
sessionId: context?.sessionId
|
|
1495
|
-
});
|
|
1496
|
-
if (!context?.orchestrator) {
|
|
1497
|
-
throw new Error('Orchestrator not available');
|
|
1498
|
-
}
|
|
1499
|
-
const controller = context.orchestrator.getQueryController();
|
|
1500
|
-
if (!controller) {
|
|
1501
|
-
throw new Error('RealTimeQueryController not initialized');
|
|
1502
|
-
}
|
|
1503
|
-
let result;
|
|
1504
|
-
switch(input.action){
|
|
1505
|
-
case 'pause':
|
|
1506
|
-
result = await controller.pauseQuery(input.queryId);
|
|
1507
|
-
break;
|
|
1508
|
-
case 'resume':
|
|
1509
|
-
result = await controller.resumeQuery(input.queryId);
|
|
1510
|
-
break;
|
|
1511
|
-
case 'terminate':
|
|
1512
|
-
result = await controller.terminateQuery(input.queryId);
|
|
1513
|
-
break;
|
|
1514
|
-
case 'change_model':
|
|
1515
|
-
if (!input.model) {
|
|
1516
|
-
throw new Error('model parameter required for change_model action');
|
|
1517
|
-
}
|
|
1518
|
-
result = await controller.changeModel(input.queryId, input.model);
|
|
1519
|
-
break;
|
|
1520
|
-
case 'change_permissions':
|
|
1521
|
-
if (!input.permissionMode) {
|
|
1522
|
-
throw new Error('permissionMode parameter required for change_permissions action');
|
|
1523
|
-
}
|
|
1524
|
-
result = await controller.changePermissionMode(input.queryId, input.permissionMode);
|
|
1525
|
-
break;
|
|
1526
|
-
case 'execute_command':
|
|
1527
|
-
if (!input.command) {
|
|
1528
|
-
throw new Error('command parameter required for execute_command action');
|
|
1529
|
-
}
|
|
1530
|
-
result = await controller.executeCommand(input.queryId, input.command);
|
|
1531
|
-
break;
|
|
1532
|
-
default:
|
|
1533
|
-
throw new Error(`Unknown action: ${input.action}`);
|
|
1534
|
-
}
|
|
1464
|
+
handler: async (input)=>{
|
|
1465
|
+
const info = sessionForking.getSessionInfo(input.sessionId);
|
|
1535
1466
|
return {
|
|
1536
1467
|
success: true,
|
|
1537
|
-
|
|
1538
|
-
queryId: input.queryId,
|
|
1539
|
-
result,
|
|
1540
|
-
timestamp: new Date().toISOString()
|
|
1468
|
+
session: info
|
|
1541
1469
|
};
|
|
1542
1470
|
}
|
|
1543
1471
|
};
|
|
1544
1472
|
}
|
|
1545
|
-
function
|
|
1473
|
+
function createPauseQueryTool(logger) {
|
|
1546
1474
|
return {
|
|
1547
|
-
name: '
|
|
1548
|
-
description: '
|
|
1475
|
+
name: 'query_pause',
|
|
1476
|
+
description: 'Pause a query with SDK (real pause with resumeSessionAt)',
|
|
1549
1477
|
inputSchema: {
|
|
1550
1478
|
type: 'object',
|
|
1551
1479
|
properties: {
|
|
1552
|
-
|
|
1553
|
-
type: '
|
|
1554
|
-
|
|
1555
|
-
description: 'Include completed queries in the list'
|
|
1480
|
+
sessionId: {
|
|
1481
|
+
type: 'string',
|
|
1482
|
+
description: 'Session ID to pause'
|
|
1556
1483
|
}
|
|
1557
|
-
}
|
|
1484
|
+
},
|
|
1485
|
+
required: [
|
|
1486
|
+
'sessionId'
|
|
1487
|
+
]
|
|
1558
1488
|
},
|
|
1559
|
-
handler: async (input
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
});
|
|
1563
|
-
if (!context?.orchestrator) {
|
|
1564
|
-
throw new Error('Orchestrator not available');
|
|
1565
|
-
}
|
|
1566
|
-
const controller = context.orchestrator.getQueryController();
|
|
1567
|
-
if (!controller) {
|
|
1568
|
-
throw new Error('RealTimeQueryController not initialized');
|
|
1569
|
-
}
|
|
1570
|
-
const queries = controller.getAllQueries();
|
|
1489
|
+
handler: async (input)=>{
|
|
1490
|
+
const { queryController } = await import('../sdk/query-control.js');
|
|
1491
|
+
queryController.requestPause(input.sessionId);
|
|
1571
1492
|
return {
|
|
1572
1493
|
success: true,
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1494
|
+
sessionId: input.sessionId,
|
|
1495
|
+
paused: true
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
function createResumeQueryTool(logger) {
|
|
1501
|
+
return {
|
|
1502
|
+
name: 'query_resume',
|
|
1503
|
+
description: 'Resume a paused query',
|
|
1504
|
+
inputSchema: {
|
|
1505
|
+
type: 'object',
|
|
1506
|
+
properties: {
|
|
1507
|
+
sessionId: {
|
|
1508
|
+
type: 'string',
|
|
1509
|
+
description: 'Session ID to resume'
|
|
1510
|
+
}
|
|
1511
|
+
},
|
|
1512
|
+
required: [
|
|
1513
|
+
'sessionId'
|
|
1514
|
+
]
|
|
1515
|
+
},
|
|
1516
|
+
handler: async (input)=>{
|
|
1517
|
+
const { queryController } = await import('../sdk/query-control.js');
|
|
1518
|
+
const result = await queryController.resumeQuery(input.sessionId);
|
|
1519
|
+
return {
|
|
1520
|
+
success: true,
|
|
1521
|
+
sessionId: input.sessionId,
|
|
1522
|
+
resumed: true,
|
|
1523
|
+
result
|
|
1579
1524
|
};
|
|
1580
1525
|
}
|
|
1581
1526
|
};
|