@yemi33/minions 0.1.1 → 0.1.3
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/CHANGELOG.md +9 -0
- package/dashboard.html +11 -9
- package/dashboard.js +32 -34
- package/engine/lifecycle.js +1 -1
- package/package.json +1 -1
- package/routing.md +32 -0
package/CHANGELOG.md
CHANGED
package/dashboard.html
CHANGED
|
@@ -3675,9 +3675,17 @@ function renderPlans(plans) {
|
|
|
3675
3675
|
: (statusLabels[status] || status);
|
|
3676
3676
|
const needsAction = (status === 'awaiting-approval' || status === 'paused' || isPrdAwaitingApproval || isPrdPaused) && !isArchived;
|
|
3677
3677
|
const isRevision = status === 'revision-requested' && !isArchived;
|
|
3678
|
+
const isCompleted = status === 'completed';
|
|
3679
|
+
const isDraft = (p.format === 'draft' || status === 'draft') && !isCompleted;
|
|
3680
|
+
const isAwaitingApproval = status === 'awaiting-approval';
|
|
3681
|
+
const isPaused = status === 'paused';
|
|
3682
|
+
const isApproved = status === 'approved' || status === 'active';
|
|
3683
|
+
// For .md drafts: show Execute only if no PRD exists yet (not already executed)
|
|
3684
|
+
const prdFile = planToPrdFile[p.file] || (p.file.endsWith('.json') ? p.file : '');
|
|
3678
3685
|
|
|
3679
3686
|
let actions = '';
|
|
3680
|
-
|
|
3687
|
+
const resumeVisible = ((isPrdBlocked || isAwaitingApproval || isPaused) && prdFile && !isArchived);
|
|
3688
|
+
if (needsAction && !resumeVisible) {
|
|
3681
3689
|
actions = '<div class="plan-card-actions" onclick="event.stopPropagation()">' +
|
|
3682
3690
|
'<button class="plan-btn approve" onclick="planApprove(\'' + escHtml(p.file) + '\')">Approve</button>' +
|
|
3683
3691
|
'<button class="plan-btn" style="color:var(--blue);border-color:var(--blue)" onclick="planDiscuss(\'' + escHtml(p.file) + '\')">Discuss & Revise</button>' +
|
|
@@ -3694,13 +3702,6 @@ function renderPlans(plans) {
|
|
|
3694
3702
|
actions = '<div class="plan-card-meta" style="margin-top:6px;color:var(--purple,#a855f7)">Revision in progress: ' + escHtml((p.revisionFeedback || '').slice(0, 100)) + '</div>';
|
|
3695
3703
|
}
|
|
3696
3704
|
|
|
3697
|
-
const isCompleted = status === 'completed';
|
|
3698
|
-
const isDraft = (p.format === 'draft' || status === 'draft') && !isCompleted;
|
|
3699
|
-
const isAwaitingApproval = status === 'awaiting-approval';
|
|
3700
|
-
const isPaused = status === 'paused';
|
|
3701
|
-
const isApproved = status === 'approved' || status === 'active';
|
|
3702
|
-
// For .md drafts: show Execute only if no PRD exists yet (not already executed)
|
|
3703
|
-
const prdFile = planToPrdFile[p.file] || (p.file.endsWith('.json') ? p.file : '');
|
|
3704
3705
|
const executeBtn = isDraft && !isWorking && !isPrdBlocked && !isArchived && !prdFile ? '<button class="pr-pager-btn" style="font-size:9px;padding:2px 8px;color:var(--green);font-weight:600" ' +
|
|
3705
3706
|
'onclick="event.stopPropagation();planExecute(\'' + escHtml(p.file) + '\',\'' + escHtml(p.project) + '\',this)">Execute</button>' : '';
|
|
3706
3707
|
// Pause/Resume: target the PRD .json file if it exists, otherwise the plan itself
|
|
@@ -4061,7 +4062,8 @@ async function planView(file) {
|
|
|
4061
4062
|
const prdCompleted = wi.some(w => w.type === 'plan-to-prd' && w.status === 'done' && w.planFile === normalizedFile);
|
|
4062
4063
|
// Check if a PRD already exists for this plan (via plans list sourcePlan linkage)
|
|
4063
4064
|
const hasPrd = (window._lastStatus?.plans || []).some(p => p.sourcePlan === normalizedFile && p.format === 'prd');
|
|
4064
|
-
const
|
|
4065
|
+
const modalShowResume = isPaused;
|
|
4066
|
+
const modalExecuteBtn = isMdPlan && !modalShowResume && !hasActiveWork && !prdCompleted && !hasPrd ? '<button class="pr-pager-btn" style="font-size:10px;padding:2px 10px;color:var(--green);font-weight:600" ' +
|
|
4065
4067
|
'onclick="planExecute(\'' + escHtml(normalizedFile) + '\',\'\',this)">Execute</button>' : '';
|
|
4066
4068
|
const modalCompletedLabel = prdCompleted && !hasActiveWork ? '<span style="font-size:10px;color:var(--green);font-weight:600">Completed</span>' : '';
|
|
4067
4069
|
const modalInProgressLabel = hasActiveWork ? '<span style="font-size:10px;color:var(--blue)">In Progress</span>' : '';
|
package/dashboard.js
CHANGED
|
@@ -1477,7 +1477,7 @@ If nothing to do, return: { "duplicates": [], "reclassify": [], "remove": [] }`;
|
|
|
1477
1477
|
} catch (e) { return jsonReply(res, 400, { error: e.message }); }
|
|
1478
1478
|
}
|
|
1479
1479
|
|
|
1480
|
-
// POST /api/plans/pause — pause a plan (stops new item materialization +
|
|
1480
|
+
// POST /api/plans/pause — pause a plan (stops new item materialization + resets active items to pending)
|
|
1481
1481
|
if (req.method === 'POST' && req.url === '/api/plans/pause') {
|
|
1482
1482
|
try {
|
|
1483
1483
|
const body = await readBody(req);
|
|
@@ -1488,25 +1488,17 @@ If nothing to do, return: { "duplicates": [], "reclassify": [], "remove": [] }`;
|
|
|
1488
1488
|
plan.pausedAt = new Date().toISOString();
|
|
1489
1489
|
safeWrite(planPath, plan);
|
|
1490
1490
|
|
|
1491
|
-
// Propagate pause to materialized work items across all projects
|
|
1492
|
-
//
|
|
1493
|
-
let
|
|
1491
|
+
// Propagate pause to materialized work items across all projects:
|
|
1492
|
+
// kill any active agent process and reset non-completed items back to pending.
|
|
1493
|
+
let reset = 0;
|
|
1494
1494
|
const wiPaths = [path.join(MINIONS_DIR, 'work-items.json')];
|
|
1495
|
-
const allPrItemIds = new Set();
|
|
1496
1495
|
for (const proj of PROJECTS) {
|
|
1497
1496
|
wiPaths.push(shared.projectWorkItemsPath(proj));
|
|
1498
|
-
try {
|
|
1499
|
-
const prs = safeJson(shared.projectPrPath(proj)) || [];
|
|
1500
|
-
for (const pr of prs) {
|
|
1501
|
-
if (pr.status === 'active' && pr.prdItems?.length) {
|
|
1502
|
-
pr.prdItems.forEach(id => allPrItemIds.add(id));
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
} catch {}
|
|
1506
1497
|
}
|
|
1507
1498
|
const dispatchPath = path.join(MINIONS_DIR, 'engine', 'dispatch.json');
|
|
1508
1499
|
const dispatch = JSON.parse(safeRead(dispatchPath) || '{}');
|
|
1509
|
-
const killedAgents =
|
|
1500
|
+
const killedAgents = new Set();
|
|
1501
|
+
const resetItemIds = new Set();
|
|
1510
1502
|
|
|
1511
1503
|
for (const wiPath of wiPaths) {
|
|
1512
1504
|
try {
|
|
@@ -1515,17 +1507,12 @@ If nothing to do, return: { "duplicates": [], "reclassify": [], "remove": [] }`;
|
|
|
1515
1507
|
let changed = false;
|
|
1516
1508
|
for (const w of items) {
|
|
1517
1509
|
if (w.sourcePlan !== body.file) continue;
|
|
1518
|
-
//
|
|
1519
|
-
if (
|
|
1510
|
+
// Keep completed items as-is, reset everything else to pending.
|
|
1511
|
+
if (w.status === 'done' || w.status === 'implemented' || w.status === 'complete' || w.status === 'in-pr') continue;
|
|
1520
1512
|
|
|
1521
|
-
if (w.status === '
|
|
1522
|
-
|
|
1523
|
-
w.
|
|
1524
|
-
paused++;
|
|
1525
|
-
changed = true;
|
|
1526
|
-
} else if (w.status === 'dispatched') {
|
|
1527
|
-
// Kill the agent working on this item
|
|
1528
|
-
const activeEntry = (dispatch.active || []).find(d => d.meta?.dispatchKey?.includes(w.id));
|
|
1513
|
+
if (w.status === 'dispatched') {
|
|
1514
|
+
// Kill the agent working on this item, if any.
|
|
1515
|
+
const activeEntry = (dispatch.active || []).find(d => d.meta?.item?.id === w.id || d.meta?.dispatchKey?.includes(w.id));
|
|
1529
1516
|
if (activeEntry) {
|
|
1530
1517
|
const statusPath = path.join(MINIONS_DIR, 'agents', activeEntry.agent, 'status.json');
|
|
1531
1518
|
try {
|
|
@@ -1542,30 +1529,41 @@ If nothing to do, return: { "duplicates": [], "reclassify": [], "remove": [] }`;
|
|
|
1542
1529
|
delete agentStatus.dispatched;
|
|
1543
1530
|
safeWrite(statusPath, agentStatus);
|
|
1544
1531
|
} catch {}
|
|
1545
|
-
killedAgents.
|
|
1532
|
+
killedAgents.add(activeEntry.agent);
|
|
1546
1533
|
}
|
|
1547
|
-
w.status = 'paused';
|
|
1548
|
-
w._pausedBy = 'prd-pause';
|
|
1549
|
-
paused++;
|
|
1550
|
-
changed = true;
|
|
1551
1534
|
}
|
|
1535
|
+
|
|
1536
|
+
if (w.status !== 'pending') reset++;
|
|
1537
|
+
w.status = 'pending';
|
|
1538
|
+
delete w._pausedBy;
|
|
1539
|
+
delete w._resumedAt;
|
|
1540
|
+
delete w.dispatched_at;
|
|
1541
|
+
delete w.dispatched_to;
|
|
1542
|
+
delete w.failReason;
|
|
1543
|
+
delete w.failedAt;
|
|
1544
|
+
changed = true;
|
|
1545
|
+
if (w.id) resetItemIds.add(w.id);
|
|
1552
1546
|
}
|
|
1553
1547
|
if (changed) safeWrite(wiPath, items);
|
|
1554
1548
|
} catch {}
|
|
1555
1549
|
}
|
|
1556
1550
|
|
|
1557
|
-
// Remove
|
|
1558
|
-
if (killedAgents.
|
|
1559
|
-
const killedSet = new Set(killedAgents);
|
|
1551
|
+
// Remove dispatch active entries for reset items or killed agents.
|
|
1552
|
+
if (resetItemIds.size > 0 || killedAgents.size > 0) {
|
|
1560
1553
|
mutateJsonFileLocked(dispatchPath, (dp) => {
|
|
1561
1554
|
dp.active = Array.isArray(dp.active) ? dp.active : [];
|
|
1562
|
-
dp.active = dp.active.filter(d =>
|
|
1555
|
+
dp.active = dp.active.filter(d => {
|
|
1556
|
+
const itemId = d.meta?.item?.id;
|
|
1557
|
+
if (itemId && resetItemIds.has(itemId)) return false;
|
|
1558
|
+
if (killedAgents.has(d.agent)) return false;
|
|
1559
|
+
return true;
|
|
1560
|
+
});
|
|
1563
1561
|
return dp;
|
|
1564
1562
|
}, { defaultValue: { pending: [], active: [], completed: [] } });
|
|
1565
1563
|
}
|
|
1566
1564
|
|
|
1567
1565
|
invalidateStatusCache();
|
|
1568
|
-
return jsonReply(res, 200, { ok: true, status: 'paused',
|
|
1566
|
+
return jsonReply(res, 200, { ok: true, status: 'paused', resetWorkItems: reset });
|
|
1569
1567
|
} catch (e) { return jsonReply(res, 400, { error: e.message }); }
|
|
1570
1568
|
}
|
|
1571
1569
|
|
package/engine/lifecycle.js
CHANGED
|
@@ -519,7 +519,7 @@ function syncPrsFromOutput(output, agentId, meta, config) {
|
|
|
519
519
|
const resultText = parsed.result;
|
|
520
520
|
const createdPattern = /(?:created|opened|submitted|new PR|PR created)[^\n]*?(?:(?:visualstudio\.com|dev\.azure\.com)[^\s"]*?pullrequest\/(\d+)|github\.com\/[^\s"]*?\/pull\/(\d+))/gi;
|
|
521
521
|
while ((match = createdPattern.exec(resultText)) !== null) prMatches.add(match[1] || match[2]);
|
|
522
|
-
const createdIdPattern = /(?:created|opened|submitted|new)\s+PR[# -]*(\d{
|
|
522
|
+
const createdIdPattern = /(?:created|opened|submitted|new)\s+PR[# -]*(\d{1,})/gi;
|
|
523
523
|
while ((match = createdIdPattern.exec(resultText)) !== null) prMatches.add(match[1]);
|
|
524
524
|
}
|
|
525
525
|
} catch {}
|
package/package.json
CHANGED
package/routing.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Work Routing
|
|
2
|
+
|
|
3
|
+
How the engine decides who handles what. Parsed by engine.js — keep the table format exact.
|
|
4
|
+
|
|
5
|
+
## Routing Table
|
|
6
|
+
|
|
7
|
+
<!-- FORMAT: | work_type | preferred_agent | fallback | -->
|
|
8
|
+
| Work Type | Preferred | Fallback |
|
|
9
|
+
|-----------|-----------|----------|
|
|
10
|
+
| implement | dallas | ralph |
|
|
11
|
+
| implement:large | rebecca | dallas |
|
|
12
|
+
| review | ripley | lambert |
|
|
13
|
+
| fix | _author_ | dallas |
|
|
14
|
+
| plan | ripley | rebecca |
|
|
15
|
+
| plan-to-prd | lambert | rebecca |
|
|
16
|
+
| explore | ripley | rebecca |
|
|
17
|
+
| test | dallas | ralph |
|
|
18
|
+
| ask | ripley | rebecca |
|
|
19
|
+
| verify | dallas | ralph |
|
|
20
|
+
|
|
21
|
+
Notes:
|
|
22
|
+
- `_author_` means route to the PR author
|
|
23
|
+
- `implement:large` is for items with `estimated_complexity: "large"`
|
|
24
|
+
- Engine falls back to any idle agent if both preferred and fallback are busy
|
|
25
|
+
|
|
26
|
+
## Rules
|
|
27
|
+
|
|
28
|
+
1. **Eager by default** — spawn all agents who can start work, not one at a time
|
|
29
|
+
2. **No self-review** — author cannot review their own PR
|
|
30
|
+
3. **Exploration gates implementation** — when exploring, finish before implementing
|
|
31
|
+
4. **Implementation informs PRD** — Lambert reads build summaries before writing PRD
|
|
32
|
+
5. **All rules in `notes.md` apply** — engine injects them into every playbook
|