@synergenius/flow-weaver-pack-weaver 0.9.59 → 0.9.77
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/dist/ai-chat-provider.d.ts +12 -0
- package/dist/ai-chat-provider.d.ts.map +1 -1
- package/dist/ai-chat-provider.js +351 -335
- package/dist/ai-chat-provider.js.map +1 -1
- package/dist/bot/agent-loop.d.ts +20 -0
- package/dist/bot/agent-loop.d.ts.map +1 -0
- package/dist/bot/agent-loop.js +331 -0
- package/dist/bot/agent-loop.js.map +1 -0
- package/dist/bot/ai-router.d.ts +19 -0
- package/dist/bot/ai-router.d.ts.map +1 -0
- package/dist/bot/ai-router.js +104 -0
- package/dist/bot/ai-router.js.map +1 -0
- package/dist/bot/assistant-tools.d.ts.map +1 -1
- package/dist/bot/assistant-tools.js +49 -33
- package/dist/bot/assistant-tools.js.map +1 -1
- package/dist/bot/async-mutex.d.ts +13 -0
- package/dist/bot/async-mutex.d.ts.map +1 -0
- package/dist/bot/async-mutex.js +37 -0
- package/dist/bot/async-mutex.js.map +1 -0
- package/dist/bot/bot-manager.d.ts +2 -2
- package/dist/bot/bot-manager.d.ts.map +1 -1
- package/dist/bot/bot-manager.js +3 -3
- package/dist/bot/bot-manager.js.map +1 -1
- package/dist/bot/bot-registry.js +2 -2
- package/dist/bot/bot-registry.js.map +1 -1
- package/dist/bot/conversation-store.d.ts +1 -0
- package/dist/bot/conversation-store.d.ts.map +1 -1
- package/dist/bot/conversation-store.js.map +1 -1
- package/dist/bot/dashboard.d.ts.map +1 -1
- package/dist/bot/dashboard.js +17 -8
- package/dist/bot/dashboard.js.map +1 -1
- package/dist/bot/improve-loop.js.map +1 -1
- package/dist/bot/index.d.ts +2 -4
- package/dist/bot/index.d.ts.map +1 -1
- package/dist/bot/index.js +1 -2
- package/dist/bot/index.js.map +1 -1
- package/dist/bot/instance-manager.d.ts +31 -0
- package/dist/bot/instance-manager.d.ts.map +1 -0
- package/dist/bot/instance-manager.js +115 -0
- package/dist/bot/instance-manager.js.map +1 -0
- package/dist/bot/orchestrator.d.ts +36 -0
- package/dist/bot/orchestrator.d.ts.map +1 -0
- package/dist/bot/orchestrator.js +176 -0
- package/dist/bot/orchestrator.js.map +1 -0
- package/dist/bot/profile-store.d.ts +36 -0
- package/dist/bot/profile-store.d.ts.map +1 -0
- package/dist/bot/profile-store.js +208 -0
- package/dist/bot/profile-store.js.map +1 -0
- package/dist/bot/profile-types.d.ts +126 -0
- package/dist/bot/profile-types.d.ts.map +1 -0
- package/dist/bot/profile-types.js +7 -0
- package/dist/bot/profile-types.js.map +1 -0
- package/dist/bot/run-store.d.ts.map +1 -1
- package/dist/bot/run-store.js +8 -0
- package/dist/bot/run-store.js.map +1 -1
- package/dist/bot/runner.d.ts +4 -0
- package/dist/bot/runner.d.ts.map +1 -1
- package/dist/bot/runner.js +5 -1
- package/dist/bot/runner.js.map +1 -1
- package/dist/bot/swarm-controller.d.ts +109 -0
- package/dist/bot/swarm-controller.d.ts.map +1 -0
- package/dist/bot/swarm-controller.js +640 -0
- package/dist/bot/swarm-controller.js.map +1 -0
- package/dist/bot/swarm-event-log.d.ts +28 -0
- package/dist/bot/swarm-event-log.d.ts.map +1 -0
- package/dist/bot/swarm-event-log.js +54 -0
- package/dist/bot/swarm-event-log.js.map +1 -0
- package/dist/bot/task-prompt-builder.d.ts +22 -0
- package/dist/bot/task-prompt-builder.d.ts.map +1 -0
- package/dist/bot/task-prompt-builder.js +240 -0
- package/dist/bot/task-prompt-builder.js.map +1 -0
- package/dist/bot/task-store.d.ts +21 -0
- package/dist/bot/task-store.d.ts.map +1 -0
- package/dist/bot/task-store.js +364 -0
- package/dist/bot/task-store.js.map +1 -0
- package/dist/bot/task-types.d.ts +79 -0
- package/dist/bot/task-types.d.ts.map +1 -0
- package/dist/bot/task-types.js +6 -0
- package/dist/bot/task-types.js.map +1 -0
- package/dist/bot/types.d.ts +8 -0
- package/dist/bot/types.d.ts.map +1 -1
- package/dist/cli-handlers.d.ts.map +1 -1
- package/dist/cli-handlers.js +79 -54
- package/dist/cli-handlers.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +749 -0
- package/dist/cli.js.map +1 -0
- package/dist/docs/docs/weaver-bot-usage.md +35 -18
- package/dist/docs/docs/weaver-config.md +20 -0
- package/dist/docs/docs/weaver-task-queue.md +31 -19
- package/dist/docs/weaver-config.md +15 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-tools.d.ts +17 -0
- package/dist/mcp-tools.d.ts.map +1 -1
- package/dist/mcp-tools.js +98 -279
- package/dist/mcp-tools.js.map +1 -1
- package/dist/node-types/bot-report.d.ts.map +1 -1
- package/dist/node-types/bot-report.js +6 -24
- package/dist/node-types/bot-report.js.map +1 -1
- package/dist/node-types/orchestrator-dispatch.d.ts +17 -0
- package/dist/node-types/orchestrator-dispatch.d.ts.map +1 -0
- package/dist/node-types/orchestrator-dispatch.js +63 -0
- package/dist/node-types/orchestrator-dispatch.js.map +1 -0
- package/dist/node-types/orchestrator-load-state.d.ts +16 -0
- package/dist/node-types/orchestrator-load-state.d.ts.map +1 -0
- package/dist/node-types/orchestrator-load-state.js +60 -0
- package/dist/node-types/orchestrator-load-state.js.map +1 -0
- package/dist/node-types/orchestrator-route.d.ts +16 -0
- package/dist/node-types/orchestrator-route.d.ts.map +1 -0
- package/dist/node-types/orchestrator-route.js +28 -0
- package/dist/node-types/orchestrator-route.js.map +1 -0
- package/dist/node-types/receive-task.d.ts +2 -3
- package/dist/node-types/receive-task.d.ts.map +1 -1
- package/dist/node-types/receive-task.js +3 -48
- package/dist/node-types/receive-task.js.map +1 -1
- package/dist/templates/weaver-template.d.ts +11 -0
- package/dist/templates/weaver-template.d.ts.map +1 -0
- package/dist/templates/weaver-template.js +53 -0
- package/dist/templates/weaver-template.js.map +1 -0
- package/dist/ui/bot-activity.js +2 -2
- package/dist/ui/bot-constants.d.ts +14 -0
- package/dist/ui/bot-constants.d.ts.map +1 -0
- package/dist/ui/bot-constants.js +189 -0
- package/dist/ui/bot-constants.js.map +1 -0
- package/dist/ui/bot-panel.js +207 -245
- package/dist/ui/bot-slot-card.js +141 -0
- package/dist/ui/budget-bar.js +59 -0
- package/dist/ui/chat-task-result.js +178 -0
- package/dist/ui/decision-log.js +136 -0
- package/dist/ui/profile-card.js +158 -0
- package/dist/ui/profile-editor.js +597 -0
- package/dist/ui/swarm-controls.js +245 -0
- package/dist/ui/swarm-dashboard.js +3012 -0
- package/dist/ui/task-create-form.js +98 -0
- package/dist/ui/task-detail-view.js +1044 -0
- package/dist/ui/task-pool-list.js +156 -0
- package/dist/workflows/orchestrator.d.ts +21 -0
- package/dist/workflows/orchestrator.d.ts.map +1 -0
- package/dist/workflows/orchestrator.js +281 -0
- package/dist/workflows/orchestrator.js.map +1 -0
- package/dist/workflows/weaver-bot-session.d.ts +65 -0
- package/dist/workflows/weaver-bot-session.d.ts.map +1 -0
- package/dist/workflows/weaver-bot-session.js +68 -0
- package/dist/workflows/weaver-bot-session.js.map +1 -0
- package/dist/workflows/weaver.d.ts +24 -0
- package/dist/workflows/weaver.d.ts.map +1 -0
- package/dist/workflows/weaver.js +28 -0
- package/dist/workflows/weaver.js.map +1 -0
- package/flowweaver.manifest.json +547 -133
- package/package.json +1 -1
- package/src/ai-chat-provider.ts +378 -371
- package/src/bot/ai-router.ts +132 -0
- package/src/bot/assistant-tools.ts +47 -29
- package/src/bot/async-mutex.ts +37 -0
- package/src/bot/bot-manager.ts +3 -3
- package/src/bot/bot-registry.ts +2 -2
- package/src/bot/conversation-store.ts +2 -1
- package/src/bot/dashboard.ts +17 -8
- package/src/bot/improve-loop.ts +6 -6
- package/src/bot/index.ts +2 -4
- package/src/bot/instance-manager.ts +128 -0
- package/src/bot/orchestrator.ts +244 -0
- package/src/bot/profile-store.ts +225 -0
- package/src/bot/profile-types.ts +141 -0
- package/src/bot/run-store.ts +8 -0
- package/src/bot/runner.ts +9 -1
- package/src/bot/swarm-controller.ts +780 -0
- package/src/bot/swarm-event-log.ts +57 -0
- package/src/bot/task-prompt-builder.ts +309 -0
- package/src/bot/task-store.ts +407 -0
- package/src/bot/task-types.ts +100 -0
- package/src/bot/types.ts +8 -0
- package/src/cli-handlers.ts +78 -53
- package/src/docs/weaver-bot-usage.md +35 -18
- package/src/docs/weaver-config.md +20 -0
- package/src/docs/weaver-task-queue.md +31 -19
- package/src/index.ts +5 -4
- package/src/mcp-tools.ts +129 -372
- package/src/node-types/bot-report.ts +6 -24
- package/src/node-types/orchestrator-dispatch.ts +71 -0
- package/src/node-types/orchestrator-load-state.ts +66 -0
- package/src/node-types/orchestrator-route.ts +33 -0
- package/src/node-types/receive-task.ts +3 -57
- package/src/ui/bot-activity.tsx +2 -2
- package/src/ui/bot-constants.ts +192 -0
- package/src/ui/bot-panel.tsx +213 -247
- package/src/ui/bot-slot-card.tsx +139 -0
- package/src/ui/budget-bar.tsx +30 -0
- package/src/ui/chat-task-result.tsx +236 -0
- package/src/ui/decision-log.tsx +148 -0
- package/src/ui/profile-card.tsx +157 -0
- package/src/ui/profile-editor.tsx +384 -0
- package/src/ui/swarm-controls.tsx +260 -0
- package/src/ui/swarm-dashboard.tsx +647 -0
- package/src/ui/task-create-form.tsx +87 -0
- package/src/ui/task-detail-view.tsx +841 -0
- package/src/ui/task-pool-list.tsx +187 -0
- package/src/workflows/orchestrator.ts +302 -0
- package/dist/docs/weaver-bot-usage.md +0 -34
- package/dist/docs/weaver-genesis.md +0 -32
- package/dist/docs/weaver-task-queue.md +0 -34
- package/dist/ui/bot-workspace.js +0 -1015
- package/dist/ui/chat-bot-result.js +0 -71
- package/dist/ui/queue-input.js +0 -82
- package/dist/ui/session-bar.js +0 -174
- package/src/bot/error-guide.ts +0 -4
- package/src/bot/retry-utils.ts +0 -4
- package/src/bot/session-state.ts +0 -116
- package/src/bot/task-queue.ts +0 -262
- package/src/ui/bot-workspace.tsx +0 -442
- package/src/ui/chat-bot-result.tsx +0 -81
- package/src/ui/queue-input.tsx +0 -56
- package/src/ui/session-bar.tsx +0 -157
package/src/cli-handlers.ts
CHANGED
|
@@ -1374,9 +1374,15 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1374
1374
|
|
|
1375
1375
|
// Crash recovery
|
|
1376
1376
|
if (continuous) {
|
|
1377
|
-
const {
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1377
|
+
const { TaskStore } = await import('./bot/task-store.js');
|
|
1378
|
+
const recoveryStore = new TaskStore(projectDir);
|
|
1379
|
+
// Recover orphaned in-progress tasks back to pending
|
|
1380
|
+
const inProgressTasks = await recoveryStore.list({ status: 'in-progress' });
|
|
1381
|
+
let recovered = 0;
|
|
1382
|
+
for (const t of inProgressTasks) {
|
|
1383
|
+
await recoveryStore.update(t.id, { status: 'pending' });
|
|
1384
|
+
recovered++;
|
|
1385
|
+
}
|
|
1380
1386
|
if (recovered > 0) renderer.info(`Recovered ${recovered} orphaned task(s)`);
|
|
1381
1387
|
}
|
|
1382
1388
|
|
|
@@ -1419,9 +1425,9 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1419
1425
|
}
|
|
1420
1426
|
|
|
1421
1427
|
// Continuous mode: loop until deadline/maxTasks/interrupt
|
|
1422
|
-
const {
|
|
1428
|
+
const { TaskStore } = await import('./bot/task-store.js');
|
|
1423
1429
|
const { isTransientError, getErrorGuidance } = await import('./bot/error-classifier.js');
|
|
1424
|
-
const
|
|
1430
|
+
const taskStore = new TaskStore(projectDir);
|
|
1425
1431
|
let taskCount = 0;
|
|
1426
1432
|
let interrupted = false;
|
|
1427
1433
|
let consecutiveErrors = 0;
|
|
@@ -1440,10 +1446,11 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1440
1446
|
const running = new Map<string, Promise<void>>();
|
|
1441
1447
|
const filesInUse = new Set<string>();
|
|
1442
1448
|
|
|
1443
|
-
const processTask = async (task: { id: string;
|
|
1449
|
+
const processTask = async (task: { id: string; title: string; description: string; context: { files: string[] } }) => {
|
|
1450
|
+
const taskPayload = { id: task.id, instruction: task.title, description: task.description, targets: task.context.files };
|
|
1444
1451
|
try {
|
|
1445
1452
|
const result = await runWorkflow(workflowPath, {
|
|
1446
|
-
params: { projectDir, taskJson: JSON.stringify(
|
|
1453
|
+
params: { projectDir, taskJson: JSON.stringify(taskPayload) },
|
|
1447
1454
|
verbose: opts.verbose,
|
|
1448
1455
|
dryRun: opts.dryRun,
|
|
1449
1456
|
config,
|
|
@@ -1460,17 +1467,17 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1460
1467
|
);
|
|
1461
1468
|
|
|
1462
1469
|
if (isNoOp) {
|
|
1463
|
-
await
|
|
1470
|
+
await taskStore.update(task.id, { status: 'done' });
|
|
1464
1471
|
sessionNoOp++;
|
|
1465
1472
|
consecutiveNoOps++;
|
|
1466
1473
|
consecutiveErrors = 0;
|
|
1467
1474
|
} else if (result.success) {
|
|
1468
|
-
await
|
|
1475
|
+
await taskStore.update(task.id, { status: 'done' });
|
|
1469
1476
|
sessionCompleted++;
|
|
1470
1477
|
consecutiveErrors = 0;
|
|
1471
1478
|
consecutiveNoOps = 0;
|
|
1472
1479
|
} else {
|
|
1473
|
-
await
|
|
1480
|
+
await taskStore.update(task.id, { status: 'failed' });
|
|
1474
1481
|
sessionFailed++;
|
|
1475
1482
|
consecutiveErrors++;
|
|
1476
1483
|
consecutiveNoOps = 0;
|
|
@@ -1487,13 +1494,13 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1487
1494
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1488
1495
|
const guidance = getErrorGuidance(msg);
|
|
1489
1496
|
renderer.error(`Task ${task.id.slice(0, 8)} error`, guidance ? `${msg}\n Hint: ${guidance}` : msg);
|
|
1490
|
-
await
|
|
1497
|
+
await taskStore.update(task.id, { status: 'failed' });
|
|
1491
1498
|
sessionFailed++;
|
|
1492
1499
|
if (!isTransientError(err)) {
|
|
1493
1500
|
consecutiveErrors++;
|
|
1494
1501
|
}
|
|
1495
1502
|
} finally {
|
|
1496
|
-
for (const f of task.
|
|
1503
|
+
for (const f of task.context.files) filesInUse.delete(f);
|
|
1497
1504
|
running.delete(task.id);
|
|
1498
1505
|
}
|
|
1499
1506
|
};
|
|
@@ -1522,7 +1529,8 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1522
1529
|
continue;
|
|
1523
1530
|
}
|
|
1524
1531
|
|
|
1525
|
-
const
|
|
1532
|
+
const pendingTasks = await taskStore.list({ status: 'pending', limit: 1 });
|
|
1533
|
+
const task = pendingTasks[0] ?? null;
|
|
1526
1534
|
if (!task) {
|
|
1527
1535
|
if (running.size > 0) {
|
|
1528
1536
|
// Tasks still running — wait for one to finish
|
|
@@ -1536,22 +1544,26 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1536
1544
|
|
|
1537
1545
|
// Auto-decompose broad tasks into per-file tasks
|
|
1538
1546
|
const { decomposeTask } = await import('./bot/task-decomposer.js');
|
|
1539
|
-
const {
|
|
1547
|
+
const decomposable = { id: task.id, instruction: task.title, targets: task.context.files, priority: task.priority };
|
|
1548
|
+
const { decomposed, tasks: subtasks } = decomposeTask(decomposable, projectDir);
|
|
1540
1549
|
if (decomposed && subtasks.length > 1) {
|
|
1541
1550
|
// Replace the broad task with per-file tasks
|
|
1542
|
-
await
|
|
1543
|
-
let decomposedCount = 0;
|
|
1551
|
+
await taskStore.update(task.id, { status: 'done' });
|
|
1544
1552
|
for (const st of subtasks) {
|
|
1545
|
-
|
|
1546
|
-
|
|
1553
|
+
await taskStore.create({
|
|
1554
|
+
title: st.instruction,
|
|
1555
|
+
description: st.instruction,
|
|
1556
|
+
priority: st.priority ?? 0,
|
|
1557
|
+
createdBy: 'ai',
|
|
1558
|
+
});
|
|
1547
1559
|
}
|
|
1548
1560
|
renderer.info(`Decomposed into ${subtasks.length} per-file tasks`);
|
|
1549
1561
|
continue;
|
|
1550
1562
|
}
|
|
1551
1563
|
|
|
1552
1564
|
// File conflict check: if task targets overlap with files in use, wait
|
|
1553
|
-
const taskTargets = task.
|
|
1554
|
-
const hasConflict = taskTargets.some(f => filesInUse.has(f));
|
|
1565
|
+
const taskTargets = task.context.files;
|
|
1566
|
+
const hasConflict = taskTargets.some((f: string) => filesInUse.has(f));
|
|
1555
1567
|
if (hasConflict && running.size > 0) {
|
|
1556
1568
|
await Promise.race(running.values());
|
|
1557
1569
|
continue;
|
|
@@ -1559,9 +1571,9 @@ export async function handleSession(opts: ParsedArgs): Promise<void> {
|
|
|
1559
1571
|
|
|
1560
1572
|
taskCount++;
|
|
1561
1573
|
if (opts.verbose) process.env.WEAVER_VERBOSE = '1';
|
|
1562
|
-
renderer.taskStart(taskCount, task.
|
|
1574
|
+
renderer.taskStart(taskCount, task.title ?? task.id);
|
|
1563
1575
|
|
|
1564
|
-
await
|
|
1576
|
+
await taskStore.update(task.id, { status: 'in-progress' });
|
|
1565
1577
|
// Reserve files
|
|
1566
1578
|
for (const f of taskTargets) filesInUse.add(f);
|
|
1567
1579
|
|
|
@@ -1784,8 +1796,9 @@ export async function handleSteer(opts: ParsedArgs): Promise<void> {
|
|
|
1784
1796
|
}
|
|
1785
1797
|
|
|
1786
1798
|
export async function handleQueue(opts: ParsedArgs): Promise<void> {
|
|
1787
|
-
const {
|
|
1788
|
-
const
|
|
1799
|
+
const { TaskStore } = await import('./bot/task-store.js');
|
|
1800
|
+
const projectDir = process.env.WEAVER_PROJECT_DIR ?? process.cwd();
|
|
1801
|
+
const store = new TaskStore(projectDir);
|
|
1789
1802
|
|
|
1790
1803
|
const action = opts.botTask;
|
|
1791
1804
|
if (!action || !['add', 'list', 'clear', 'remove', 'retry'].includes(action)) {
|
|
@@ -1800,30 +1813,31 @@ export async function handleQueue(opts: ParsedArgs): Promise<void> {
|
|
|
1800
1813
|
console.error('[weaver] Usage: flow-weaver weaver queue add "task instruction"');
|
|
1801
1814
|
process.exit(1);
|
|
1802
1815
|
}
|
|
1803
|
-
const
|
|
1804
|
-
|
|
1805
|
-
console.log(`[weaver] Task already queued (${id}).`);
|
|
1806
|
-
} else {
|
|
1807
|
-
console.log(`[weaver] Task added: ${id}`);
|
|
1808
|
-
}
|
|
1816
|
+
const task = await store.create({ title: instruction, description: instruction, priority: 0, createdBy: 'user' });
|
|
1817
|
+
console.log(`[weaver] Task added: ${task.id}`);
|
|
1809
1818
|
break;
|
|
1810
1819
|
}
|
|
1811
1820
|
case 'list': {
|
|
1812
|
-
const tasks = await
|
|
1821
|
+
const tasks = await store.list();
|
|
1813
1822
|
if (opts.historyJson) {
|
|
1814
1823
|
console.log(JSON.stringify(tasks, null, 2));
|
|
1815
1824
|
} else if (tasks.length === 0) {
|
|
1816
1825
|
console.log('No tasks in queue.');
|
|
1817
1826
|
} else {
|
|
1818
|
-
console.log('ID'.padEnd(10) + 'STATUS'.padEnd(
|
|
1827
|
+
console.log('ID'.padEnd(10) + 'STATUS'.padEnd(14) + 'PRIORITY'.padEnd(10) + 'TITLE');
|
|
1819
1828
|
for (const t of tasks) {
|
|
1820
|
-
console.log(t.id.padEnd(10) + t.status.padEnd(
|
|
1829
|
+
console.log(t.id.padEnd(10) + t.status.padEnd(14) + String(t.priority).padEnd(10) + t.title.slice(0, 60));
|
|
1821
1830
|
}
|
|
1822
1831
|
}
|
|
1823
1832
|
break;
|
|
1824
1833
|
}
|
|
1825
1834
|
case 'clear': {
|
|
1826
|
-
const
|
|
1835
|
+
const tasks = await store.list();
|
|
1836
|
+
let count = 0;
|
|
1837
|
+
for (const t of tasks) {
|
|
1838
|
+
await store.update(t.id, { status: 'cancelled' });
|
|
1839
|
+
count++;
|
|
1840
|
+
}
|
|
1827
1841
|
console.log(`Cleared ${count} task(s).`);
|
|
1828
1842
|
break;
|
|
1829
1843
|
}
|
|
@@ -1833,19 +1847,30 @@ export async function handleQueue(opts: ParsedArgs): Promise<void> {
|
|
|
1833
1847
|
console.error('[weaver] Usage: flow-weaver weaver queue remove <id>');
|
|
1834
1848
|
process.exit(1);
|
|
1835
1849
|
}
|
|
1836
|
-
|
|
1837
|
-
|
|
1850
|
+
try {
|
|
1851
|
+
await store.update(id, { status: 'cancelled' });
|
|
1852
|
+
console.log(`Cancelled task ${id}.`);
|
|
1853
|
+
} catch {
|
|
1854
|
+
console.log(`No task found with id "${id}".`);
|
|
1855
|
+
}
|
|
1838
1856
|
break;
|
|
1839
1857
|
}
|
|
1840
1858
|
case 'retry': {
|
|
1841
1859
|
const id = opts.botFile;
|
|
1842
1860
|
if (id) {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1861
|
+
try {
|
|
1862
|
+
await store.update(id, { status: 'pending' });
|
|
1863
|
+
console.log(`Task ${id} reset to pending.`);
|
|
1864
|
+
} catch {
|
|
1865
|
+
console.log(`No task found with id "${id}".`);
|
|
1866
|
+
}
|
|
1846
1867
|
} else {
|
|
1847
|
-
|
|
1848
|
-
|
|
1868
|
+
const failed = await store.list({ status: 'failed' });
|
|
1869
|
+
let count = 0;
|
|
1870
|
+
for (const t of failed) {
|
|
1871
|
+
await store.update(t.id, { status: 'pending' });
|
|
1872
|
+
count++;
|
|
1873
|
+
}
|
|
1849
1874
|
console.log(`Reset ${count} failed task(s) to pending.`);
|
|
1850
1875
|
}
|
|
1851
1876
|
break;
|
|
@@ -1855,15 +1880,16 @@ export async function handleQueue(opts: ParsedArgs): Promise<void> {
|
|
|
1855
1880
|
|
|
1856
1881
|
export async function handleStatus(opts: ParsedArgs): Promise<void> {
|
|
1857
1882
|
const store = new RunStore();
|
|
1858
|
-
const {
|
|
1859
|
-
const
|
|
1883
|
+
const { TaskStore } = await import('./bot/task-store.js');
|
|
1884
|
+
const projectDir = process.env.WEAVER_PROJECT_DIR ?? process.cwd();
|
|
1885
|
+
const taskStore = new TaskStore(projectDir);
|
|
1860
1886
|
|
|
1861
1887
|
const orphans = store.checkOrphans();
|
|
1862
1888
|
const recentRuns = store.list({ limit: 5 });
|
|
1863
|
-
const tasks = await
|
|
1889
|
+
const tasks = await taskStore.list();
|
|
1864
1890
|
const pending = tasks.filter(t => t.status === 'pending').length;
|
|
1865
|
-
const running = tasks.filter(t => t.status === '
|
|
1866
|
-
const completed = tasks.filter(t => t.status === '
|
|
1891
|
+
const running = tasks.filter(t => t.status === 'in-progress').length;
|
|
1892
|
+
const completed = tasks.filter(t => t.status === 'done').length;
|
|
1867
1893
|
const failed = tasks.filter(t => t.status === 'failed').length;
|
|
1868
1894
|
|
|
1869
1895
|
if (opts.historyJson) {
|
|
@@ -2367,15 +2393,14 @@ export async function handleDoctor(opts: ParsedArgs): Promise<void> {
|
|
|
2367
2393
|
|
|
2368
2394
|
// Queue status
|
|
2369
2395
|
try {
|
|
2370
|
-
const {
|
|
2371
|
-
|
|
2372
|
-
const
|
|
2373
|
-
const tasks = await queue.list();
|
|
2396
|
+
const { TaskStore } = await import('./bot/task-store.js');
|
|
2397
|
+
const taskStore = new TaskStore(dir);
|
|
2398
|
+
const tasks = await taskStore.list();
|
|
2374
2399
|
const pending = tasks.filter(t => t.status === 'pending').length;
|
|
2375
|
-
const
|
|
2376
|
-
checks.push({ label: 'Queue', status: 'ok', detail: `${pending} pending, ${
|
|
2400
|
+
const inProgress = tasks.filter(t => t.status === 'in-progress').length;
|
|
2401
|
+
checks.push({ label: 'Queue', status: 'ok', detail: `${pending} pending, ${inProgress} in-progress` });
|
|
2377
2402
|
} catch {
|
|
2378
|
-
checks.push({ label: 'Queue', status: 'ok', detail: 'Empty (no
|
|
2403
|
+
checks.push({ label: 'Queue', status: 'ok', detail: 'Empty (no tasks file)' });
|
|
2379
2404
|
}
|
|
2380
2405
|
|
|
2381
2406
|
// Plan file
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
## Weaver Bot
|
|
1
|
+
## Weaver Bot (Swarm)
|
|
2
2
|
|
|
3
|
-
The Weaver bot is an autonomous AI agent that creates and modifies Flow Weaver workflows
|
|
3
|
+
The Weaver bot is an autonomous AI agent that creates and modifies Flow Weaver workflows. Tasks are executed via the swarm orchestrator, which routes work to the best available bot profile.
|
|
4
4
|
|
|
5
|
-
### Running
|
|
5
|
+
### Running tasks
|
|
6
6
|
|
|
7
|
-
Use `
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
7
|
+
Use `fw_weaver_task_create` to submit work:
|
|
8
|
+
- `title`: Short task title (required)
|
|
9
|
+
- `description`: Detailed instructions
|
|
10
|
+
- `assignedProfile`: Target a specific bot profile
|
|
11
|
+
- `complexity`: trivial, simple, moderate, complex
|
|
12
|
+
- `subtasks`: Inline subtask definitions with dependency chaining
|
|
13
|
+
|
|
14
|
+
Then start the swarm with `fw_weaver_swarm_start` to begin execution.
|
|
12
15
|
|
|
13
16
|
### Execution flow
|
|
14
17
|
|
|
15
|
-
1. **
|
|
16
|
-
2. **
|
|
17
|
-
3. **
|
|
18
|
-
4. **
|
|
19
|
-
5. **Execute + validate + retry** — runs steps, validates output, retries on errors (up to
|
|
18
|
+
1. **Create task** — `fw_weaver_task_create` adds task to the pool
|
|
19
|
+
2. **Orchestrator routes** — matches task to best bot profile via fast-path cascade (exact-match, capability-match, single-eligible, ai-routed, round-robin)
|
|
20
|
+
3. **Build context** — gathers project state, templates, and relevant files
|
|
21
|
+
4. **Plan** — AI generates a step-by-step execution plan
|
|
22
|
+
5. **Execute + validate + retry** — runs steps, validates output, retries on errors (up to maxAttempts)
|
|
20
23
|
6. **Git ops** — commits changes if successful
|
|
21
|
-
7. **Report** —
|
|
24
|
+
7. **Report** — task marked done/failed with run summary
|
|
22
25
|
|
|
23
26
|
### Steering a running bot
|
|
24
27
|
|
|
25
|
-
Use `fw_weaver_steer` to control execution:
|
|
28
|
+
Use `fw_weaver_steer` with a `botId` to control execution:
|
|
26
29
|
- `pause` — pause at next safe point
|
|
27
30
|
- `resume` — continue after pause
|
|
28
31
|
- `cancel` — abort execution
|
|
29
|
-
- `redirect` — change task mid-execution
|
|
30
|
-
- `queue` — add a follow-up task
|
|
31
32
|
|
|
32
33
|
### Checking status
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
- `fw_weaver_status` — quick swarm summary (active bots, tasks completed, budget)
|
|
36
|
+
- `fw_weaver_swarm_status` — full swarm state with per-instance details
|
|
37
|
+
- `fw_weaver_swarm_events` — live event stream
|
|
38
|
+
- `fw_weaver_orchestrator_status` — routing decisions, stats, active instances
|
|
39
|
+
|
|
40
|
+
### Profiles
|
|
41
|
+
|
|
42
|
+
Use `fw_weaver_profile_create` to create specialized bot profiles. Each profile defines:
|
|
43
|
+
|
|
44
|
+
- **capabilities** — free-form list of `{ name, description }` objects describing what the profile can do. Names are arbitrary strings (e.g. `code-generation`, `testing`, `deployment`). The orchestrator uses the description text to match tasks to profiles.
|
|
45
|
+
- **preferences** — intent-based settings that control profile behavior:
|
|
46
|
+
- `costStrategy` — `"economy"` (minimize cost), `"balanced"` (default), or `"quality"` (maximize quality regardless of cost)
|
|
47
|
+
- `requireApproval` — whether tasks routed to this profile need human approval before execution
|
|
48
|
+
- `instructions` — optional free-text instructions appended to the bot's system prompt
|
|
49
|
+
- **scaling** — `minInstances` and `maxInstances` control how many concurrent bots can run this profile
|
|
50
|
+
|
|
51
|
+
The orchestrator routes tasks to profiles based on `assignedProfile` or by matching task intent against profile capabilities.
|
|
@@ -4,6 +4,17 @@ The weaver bot runs workflows, executes tasks from natural language, and evolves
|
|
|
4
4
|
|
|
5
5
|
The bot has deep knowledge of the full flow-weaver ecosystem: annotation grammar, CLI tools, node patterns, error diagnosis, and the genesis protocol (loaded dynamically from `@synergenius/flow-weaver/doc-metadata`).
|
|
6
6
|
|
|
7
|
+
## Execution models
|
|
8
|
+
|
|
9
|
+
Weaver supports two execution models:
|
|
10
|
+
|
|
11
|
+
- **Single-run mode** — execute one workflow or natural-language task end-to-end via `flow-weaver weaver run` or `flow-weaver weaver bot`. Good for one-off tasks, CI pipelines, and simple automations.
|
|
12
|
+
- **Swarm/task model** — create tasks, define bot profiles with capabilities, and let the orchestrator route work to the best available bot instance. Multiple bots can run concurrently with budget controls and automatic retries.
|
|
13
|
+
|
|
14
|
+
The `.weaver.json` config applies to both models. Provider settings, approval gates, and notifications are shared. Swarm-specific settings (profiles, budgets, concurrency) are managed through the swarm control tools or the Studio UI.
|
|
15
|
+
|
|
16
|
+
> See [weaver-bot-usage.md](weaver-bot-usage.md) for full swarm documentation including profiles, orchestrator routing, and multi-bot workflows.
|
|
17
|
+
|
|
7
18
|
## Getting started
|
|
8
19
|
|
|
9
20
|
Run the bot directly via CLI:
|
|
@@ -16,6 +27,15 @@ flow-weaver weaver session
|
|
|
16
27
|
|
|
17
28
|
Or scaffold a project via `flow-weaver init` and select the "AI Workflow Runner" use case.
|
|
18
29
|
|
|
30
|
+
## Profiles and .weaver.json
|
|
31
|
+
|
|
32
|
+
Bot profiles define specialized bot types with free-form capabilities, intent-based preferences, and scaling limits. Profiles are created via `fw_weaver_profile_create` and stored in the `.weaver/` directory. The `.weaver.json` config provides the base provider and approval settings that profiles inherit unless overridden.
|
|
33
|
+
|
|
34
|
+
Each profile specifies:
|
|
35
|
+
- **capabilities** — an array of `{ name, description }` objects. Names are free-form strings (e.g. `code-generation`, `testing`, `deployment`). The orchestrator uses descriptions to match tasks to profiles.
|
|
36
|
+
- **preferences** — intent-based settings: `costStrategy` (`economy`, `balanced`, `quality`), `requireApproval` (boolean), and optional `instructions` (free-text appended to the bot system prompt).
|
|
37
|
+
- **scaling** — `minInstances` / `maxInstances` for concurrency control.
|
|
38
|
+
|
|
19
39
|
## .weaver.json
|
|
20
40
|
|
|
21
41
|
Place a `.weaver.json` in your project root to configure the weaver workflow:
|
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
## Task
|
|
1
|
+
## Task Management & Steering
|
|
2
2
|
|
|
3
|
-
Weaver
|
|
3
|
+
Weaver uses a swarm-based task system for background processing and real-time bot control.
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Creating tasks
|
|
6
6
|
|
|
7
|
-
Use `
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
7
|
+
Use `fw_weaver_task_create` to create tasks:
|
|
8
|
+
- `title` — short task title (required)
|
|
9
|
+
- `description` — detailed instructions
|
|
10
|
+
- `priority` — higher number = picked first (default 0)
|
|
11
|
+
- `assignedProfile` — route to a specific bot profile
|
|
12
|
+
- `complexity` — trivial, simple, moderate, complex
|
|
13
|
+
- `subtasks` — inline subtask definitions with `^prev` dependency shorthand
|
|
14
|
+
- `budgetTokens` / `budgetCost` — per-task budget limits
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
### Listing and managing tasks
|
|
17
|
+
|
|
18
|
+
- `fw_weaver_task_list` — list tasks (filter by status, parentId, botId)
|
|
19
|
+
- `fw_weaver_task_get` — get task details including subtasks
|
|
20
|
+
- `fw_weaver_task_update` — update task fields
|
|
21
|
+
- `fw_weaver_task_cancel` — cancel a pending or running task
|
|
22
|
+
- `fw_weaver_task_retry` — reset a failed task back to pending
|
|
14
23
|
|
|
15
24
|
### Steering commands
|
|
16
25
|
|
|
17
|
-
Use `fw_weaver_steer` to control a running bot:
|
|
26
|
+
Use `fw_weaver_steer` to control a running bot instance:
|
|
18
27
|
- `pause` — pause execution at the next safe point
|
|
19
28
|
- `resume` — continue after a pause
|
|
20
29
|
- `cancel` — abort the current task
|
|
21
|
-
- `redirect` — change the task instruction mid-execution (requires `payload` with new instruction)
|
|
22
|
-
- `queue` — add a follow-up task without interrupting the current one
|
|
23
30
|
|
|
24
|
-
###
|
|
31
|
+
### Swarm control
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
- `fw_weaver_swarm_start` — start the swarm (spawns bot loops that claim and execute tasks)
|
|
34
|
+
- `fw_weaver_swarm_pause` — pause all bot loops
|
|
35
|
+
- `fw_weaver_swarm_stop` — stop the swarm gracefully
|
|
36
|
+
- `fw_weaver_swarm_status` — full swarm state with per-bot details
|
|
37
|
+
- `fw_weaver_swarm_config` — configure max concurrency, budgets, auto-retry
|
|
38
|
+
- `fw_weaver_swarm_events` — stream swarm-level events for live updates
|
|
27
39
|
|
|
28
40
|
### Monitoring
|
|
29
41
|
|
|
30
|
-
Use `fw_weaver_status` to check the current
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
42
|
+
Use `fw_weaver_status` to check the current swarm state:
|
|
43
|
+
- Swarm phase (idle, running, paused, stopping)
|
|
44
|
+
- Active/total bot instances
|
|
45
|
+
- Tasks completed/failed
|
|
46
|
+
- Budget usage
|
package/src/index.ts
CHANGED
|
@@ -104,14 +104,15 @@ export { WebApprovalHandler } from './bot/index.js';
|
|
|
104
104
|
// Bot infrastructure
|
|
105
105
|
export {
|
|
106
106
|
SteeringController,
|
|
107
|
-
|
|
108
|
-
SessionStore,
|
|
107
|
+
TaskStore,
|
|
109
108
|
buildBotSystemPrompt,
|
|
110
109
|
} from './bot/index.js';
|
|
111
110
|
export type {
|
|
112
111
|
SteeringCommand,
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
Task,
|
|
113
|
+
TaskFilter,
|
|
114
|
+
CreateTaskInput,
|
|
115
|
+
TaskStatus,
|
|
115
116
|
BotTask,
|
|
116
117
|
BotPlan,
|
|
117
118
|
BotPlanStep,
|