@yemi33/minions 0.1.982 → 0.1.984

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 CHANGED
@@ -1,8 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.982 (2026-04-15)
3
+ ## 0.1.984 (2026-04-15)
4
4
 
5
5
  ### Features
6
+ - fix misleading poll frequency field labels in settings modal (#1099)
7
+ - add Auto-complete PRs toggle to settings modal (#1095)
6
8
  - gate build failure auto-fix behind autoFixBuilds flag
7
9
  - free-form interval input + CC create-watch action
8
10
  - flush queued CC messages as single combined request
@@ -21,10 +23,11 @@
21
23
  - certificate-based auth for Teams integration (#1027)
22
24
  - Create render-utils.js with shared formatting helpers
23
25
  - add adoPollEnabled/ghPollEnabled engine settings
24
- - doc-chat abort kills LLM process + queued messages auto-process
25
- - add /api/work-items/reopen endpoint and reopen-work-item CC action (#982)
26
26
 
27
27
  ### Fixes
28
+ - fix syncPrsFromOutput skipping tool_result lines where PR URLs live (#1100)
29
+ - Remove autoReview flag — consolidate into evalLoop (#1093)
30
+ - link scheduled task notes back to originating item (#1090)
28
31
  - restore rereview and human-fix dispatch
29
32
  - build fix sets fixDispatched to block same-tick conflict fix
30
33
  - ENGINE_DEFAULTS undefined in tick + playbook empty-var false positives
@@ -42,9 +45,6 @@
42
45
  - skip orphaned LLM retry when client disconnected during CC stream
43
46
  - restore queue flush after abort — queued messages are user intent
44
47
  - CC stale lock auto-release + queue drain on abort
45
- - CC streaming 'tabId' TDZ error on new tab first message
46
- - fix tabId scope and close-event lock race in CC handlers
47
- - defer setCooldown to post-gating in discoverWork
48
48
 
49
49
  ### Other
50
50
  - refactor(watches): rename maxTriggers→stopAfter, add onNotMet per-poll action
@@ -51,12 +51,13 @@ async function openSettings() {
51
51
  settingsToggle('Auto-archive Plans', 'set-autoArchive', !!e.autoArchive, 'Automatically archive plans after verify completes (off = manual archive via dashboard)') +
52
52
  settingsToggle('Auto-fix Builds', 'set-autoFixBuilds', e.autoFixBuilds !== false, 'Auto-dispatch fix agents when a PR build fails') +
53
53
  settingsToggle('Auto-fix Conflicts', 'set-autoFixConflicts', e.autoFixConflicts !== false, 'Auto-dispatch fix agents when a PR has merge conflicts') +
54
+ settingsToggle('Auto-complete PRs', 'set-autoCompletePrs', !!e.autoCompletePrs, 'Auto-merge PRs when builds pass and review is approved (opt-in)') +
54
55
  settingsToggle('ADO Polling', 'set-adoPollEnabled', e.adoPollEnabled !== false, 'Poll ADO PR status and comments each tick (reconciliation always runs)') +
55
56
  settingsToggle('GitHub Polling', 'set-ghPollEnabled', e.ghPollEnabled !== false, 'Poll GitHub PR status and comments each tick (reconciliation always runs)') +
56
57
  '</div>' +
57
58
  '<div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:16px">' +
58
- settingsField('ADO Status Poll Frequency', 'set-adoPollStatusEvery', e.adoPollStatusEvery || 6, 'ticks', 'Poll ADO PR build/review/merge status every N ticks (~6 min at default tick rate)') +
59
- settingsField('ADO Comments Poll Frequency', 'set-adoPollCommentsEvery', e.adoPollCommentsEvery || 12, 'ticks', 'Poll ADO PR human comments every N ticks (~12 min at default tick rate)') +
59
+ settingsField('PR Status Poll Frequency', 'set-adoPollStatusEvery', e.adoPollStatusEvery || 6, 'ticks', 'Poll PR build/review/merge status every N ticks for both ADO and GitHub (~6 min at default tick rate)') +
60
+ settingsField('PR Comments Poll Frequency', 'set-adoPollCommentsEvery', e.adoPollCommentsEvery || 12, 'ticks', 'Poll PR human comments every N ticks for both ADO and GitHub (~12 min at default tick rate)') +
60
61
  '</div>' +
61
62
  '<div style="display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:16px">' +
62
63
  settingsField('Eval Max Iterations', 'set-evalMaxIterations', e.evalMaxIterations || 3, '', 'Max review→fix cycles before escalating (1-10)') +
@@ -242,6 +243,7 @@ async function saveSettings() {
242
243
  autoArchive: document.getElementById('set-autoArchive').checked,
243
244
  autoFixBuilds: document.getElementById('set-autoFixBuilds').checked,
244
245
  autoFixConflicts: document.getElementById('set-autoFixConflicts').checked,
246
+ autoCompletePrs: document.getElementById('set-autoCompletePrs').checked,
245
247
  adoPollEnabled: document.getElementById('set-adoPollEnabled').checked,
246
248
  ghPollEnabled: document.getElementById('set-ghPollEnabled').checked,
247
249
  adoPollStatusEvery: document.getElementById('set-adoPollStatusEvery').value,
package/dashboard.js CHANGED
@@ -395,7 +395,13 @@ function getStatus() {
395
395
  schedules: (() => {
396
396
  const scheds = CONFIG.schedules || [];
397
397
  const runs = shared.safeJson(path.join(MINIONS_DIR, 'engine', 'schedule-runs.json')) || {};
398
- return scheds.map(s => ({ ...s, _lastRun: runs[s.id] || null }));
398
+ return scheds.map(s => {
399
+ const runEntry = runs[s.id];
400
+ // Backward compat: runEntry can be a string (old format) or object (new format with back-references)
401
+ const _lastRun = typeof runEntry === 'string' ? runEntry : (runEntry?.lastRun || runEntry?.lastCompletedAt || null);
402
+ const extra = typeof runEntry === 'object' && runEntry ? { _lastWorkItemId: runEntry.lastWorkItemId, _lastResult: runEntry.lastResult, _lastCompletedAt: runEntry.lastCompletedAt } : {};
403
+ return { ...s, _lastRun, ...extra };
404
+ });
399
405
  })(),
400
406
  watches: watchesMod.getWatches(),
401
407
  meetings: (() => { try { return require('./engine/meeting').getMeetings(); } catch { return []; } })(),
@@ -3683,7 +3689,13 @@ What would you like to discuss or change? When you're happy, say "approve" and I
3683
3689
  reloadConfig();
3684
3690
  const schedules = CONFIG.schedules || [];
3685
3691
  const runs = shared.safeJson(path.join(MINIONS_DIR, 'engine', 'schedule-runs.json')) || {};
3686
- const result = schedules.map(s => ({ ...s, _lastRun: runs[s.id] || null }));
3692
+ const result = schedules.map(s => {
3693
+ const runEntry = runs[s.id];
3694
+ // Backward compat: runEntry can be a string (old format) or object (new format with back-references)
3695
+ const _lastRun = typeof runEntry === 'string' ? runEntry : (runEntry?.lastRun || runEntry?.lastCompletedAt || null);
3696
+ const extra = typeof runEntry === 'object' && runEntry ? { _lastWorkItemId: runEntry.lastWorkItemId, _lastResult: runEntry.lastResult, _lastCompletedAt: runEntry.lastCompletedAt } : {};
3697
+ return { ...s, _lastRun, ...extra };
3698
+ });
3687
3699
  return jsonReply(res, 200, { schedules: result });
3688
3700
  }
3689
3701
 
@@ -6,5 +6,13 @@
6
6
  "reason": "Consolidated into review + evalLoop config. No separate evaluate dispatch.",
7
7
  "locations": ["routing.md: evaluate row removed", "CLAUDE.md: evaluate references removed"],
8
8
  "cleanup": "Already cleaned — routing.md and CLAUDE.md updated 2026-04-02"
9
+ },
10
+ {
11
+ "id": "autoReview-flag",
12
+ "summary": "autoReview ENGINE_DEFAULT consolidated into evalLoop",
13
+ "deprecated": "2026-04-15",
14
+ "reason": "Redundant with evalLoop; evalLoop is the single gate for the review+fix cycle",
15
+ "locations": ["engine/shared.js ENGINE_DEFAULTS.autoReview", "engine.js discoverFromPrs autoReview variable"],
16
+ "cleanup": "Removed from ENGINE_DEFAULTS, removed autoReview variable from engine.js, replaced with reviewEnabled = evalLoopEnabled && pollEnabled"
9
17
  }
10
18
  ]
@@ -707,15 +707,14 @@ function syncPrsFromOutput(output, agentId, meta, config) {
707
707
  const lines = output.split('\n');
708
708
  for (const line of lines) {
709
709
  try {
710
- if (!line.includes('"type":"assistant"') && !line.includes('"type":"result"')) continue;
710
+ if (!line.includes('"type":"assistant"') && !line.includes('"type":"result"') && !line.includes('"type":"user"')) continue;
711
711
  const parsed = JSON.parse(line);
712
712
  const content = parsed.message?.content || [];
713
713
  for (const block of content) {
714
+ // Scan tool_result blocks in user messages for PR URLs (gh pr create output lands here)
714
715
  if (block.type === 'tool_result' && block.content) {
715
716
  const text = typeof block.content === 'string' ? block.content : JSON.stringify(block.content);
716
- if (text.includes('pullRequestId') || text.includes('create_pull_request')) {
717
- while ((match = urlPattern.exec(text)) !== null) prMatches.add(match[1] || match[2]);
718
- }
717
+ while ((match = urlPattern.exec(text)) !== null) prMatches.add(match[1] || match[2]);
719
718
  }
720
719
  // Also scan assistant text blocks for PR URLs and "PR created" patterns
721
720
  if (block.type === 'text' && block.text) {
@@ -1712,6 +1711,37 @@ async function runPostCompletionHooks(dispatchItem, agentId, code, stdout, confi
1712
1711
 
1713
1712
  // Archive is manual — user archives plans from the dashboard when ready
1714
1713
 
1714
+ // Scheduled task back-reference: update schedule-runs.json and write linked inbox note
1715
+ if (meta?.item?._scheduleId) {
1716
+ try {
1717
+ const scheduleId = meta.item._scheduleId;
1718
+ const itemId = meta.item.id;
1719
+ const schedRunsPath = path.join(ENGINE_DIR, 'schedule-runs.json');
1720
+ mutateJsonFileLocked(schedRunsPath, (runs) => {
1721
+ runs[scheduleId] = {
1722
+ lastRun: typeof runs[scheduleId] === 'string' ? runs[scheduleId] : (runs[scheduleId]?.lastRun || ts()),
1723
+ lastWorkItemId: itemId,
1724
+ lastResult: effectiveSuccess ? DISPATCH_RESULT.SUCCESS : DISPATCH_RESULT.ERROR,
1725
+ lastCompletedAt: ts(),
1726
+ };
1727
+ return runs;
1728
+ }, { defaultValue: {} });
1729
+ // Write a completion note to inbox with back-references
1730
+ const noteSlug = `sched-completion-${scheduleId}`;
1731
+ const status = effectiveSuccess ? 'succeeded' : 'failed';
1732
+ const noteContent = `# Scheduled Task ${status}: ${meta.item.title || scheduleId}\n\n` +
1733
+ `**Schedule:** \`${scheduleId}\`\n` +
1734
+ `**Work Item:** \`${itemId}\`\n` +
1735
+ `**Result:** ${status}\n` +
1736
+ (resultSummary ? `\n## Summary\n${resultSummary}\n` : '');
1737
+ shared.writeToInbox('engine', noteSlug, noteContent, null, {
1738
+ sourceItem: itemId,
1739
+ scheduleId,
1740
+ });
1741
+ log('info', `Scheduled task ${scheduleId} (${itemId}) → ${status}, back-reference written`);
1742
+ } catch (err) { log('warn', `Scheduled task back-reference: ${err.message}`); }
1743
+ }
1744
+
1715
1745
  // Clean up worktree for non-shared-branch tasks after completion
1716
1746
  if (meta?.branch && meta?.branchStrategy !== 'shared-branch') {
1717
1747
  try {
@@ -116,7 +116,9 @@ function discoverScheduledWork(config) {
116
116
  if (!sched.id || !sched.cron || !sched.title) continue;
117
117
  if (!sched.enabled) continue; // truthy check — matches dashboard UI badge behavior
118
118
 
119
- const lastRun = runs[sched.id] || null;
119
+ // Backward compat: runs[sched.id] can be a string (old format) or object (new format)
120
+ const runEntry = runs[sched.id] || null;
121
+ const lastRun = typeof runEntry === 'string' ? runEntry : (runEntry?.lastRun || null);
120
122
  if (!shouldRunNow(sched, lastRun)) continue;
121
123
 
122
124
  work.push({
@@ -133,8 +135,9 @@ function discoverScheduledWork(config) {
133
135
  _scheduleId: sched.id,
134
136
  });
135
137
 
136
- // Record run time inside the lock
137
- runs[sched.id] = ts();
138
+ // Record run time inside the lock — preserve existing fields (lastWorkItemId, lastResult, etc.)
139
+ const existing = typeof runs[sched.id] === 'object' && runs[sched.id] ? runs[sched.id] : {};
140
+ runs[sched.id] = { ...existing, lastRun: ts() };
138
141
  }
139
142
  }, { defaultValue: {} });
140
143
 
package/engine/shared.js CHANGED
@@ -295,18 +295,22 @@ function parseNoteId(content) {
295
295
  return m ? m[1] : null;
296
296
  }
297
297
 
298
- function writeToInbox(agentId, slug, content, _inboxDir) {
298
+ function writeToInbox(agentId, slug, content, _inboxDir, metadata) {
299
299
  try {
300
300
  const inboxDir = _inboxDir || path.join(MINIONS_DIR, 'notes', 'inbox');
301
301
  const prefix = `${agentId}-${slug}-${dateStamp()}`;
302
302
  const existing = safeReadDir(inboxDir).find(f => f.startsWith(prefix));
303
303
  if (existing) return false;
304
304
  const noteId = `NOTE-${uid()}`;
305
+ // Build optional metadata lines for frontmatter injection
306
+ const metaLines = (metadata && typeof metadata === 'object')
307
+ ? Object.entries(metadata).filter(([, v]) => v != null).map(([k, v]) => `${k}: ${v}`).join('\n')
308
+ : '';
305
309
  // Inject structured ID as YAML frontmatter if content doesn't already have it
306
310
  const hasFrontmatter = /^\s*---[\r\n]/.test(content);
307
311
  const tagged = hasFrontmatter
308
- ? content.replace(/^\s*---[\r\n]+/, `---\nid: ${noteId}\n`)
309
- : `---\nid: ${noteId}\nagent: ${agentId}\ndate: ${dateStamp()}\n---\n\n${content}`;
312
+ ? content.replace(/^\s*---[\r\n]+/, `---\nid: ${noteId}\n${metaLines ? metaLines + '\n' : ''}`)
313
+ : `---\nid: ${noteId}\nagent: ${agentId}\ndate: ${dateStamp()}\n${metaLines ? metaLines + '\n' : ''}---\n\n${content}`;
310
314
  const filePath = path.join(inboxDir, `${prefix}.md`);
311
315
  safeWrite(filePath, tagged);
312
316
  return noteId;
@@ -532,7 +536,6 @@ const ENGINE_DEFAULTS = {
532
536
  autoDecompose: true, // auto-decompose implement:large items into sub-tasks
533
537
  autoApprovePlans: false, // auto-approve PRDs without waiting for human approval
534
538
  autoArchive: false, // opt-in: auto-archive plans after verify completes (false = mark ready, user archives manually)
535
- autoReview: true, // auto-dispatch review agents for new PRs (disable for manual review workflow)
536
539
  autoFixConflicts: true, // auto-dispatch fix agents when a PR has merge conflicts
537
540
  autoFixBuilds: true, // auto-dispatch fix agents when a PR build fails
538
541
  meetingRoundTimeout: 600000, // 10min per meeting round before auto-advance
@@ -618,6 +621,12 @@ const PR_POLLABLE_STATUSES = new Set([PR_STATUS.ACTIVE, PR_STATUS.LINKED]);
618
621
  const WATCH_STATUS = { ACTIVE: 'active', PAUSED: 'paused', TRIGGERED: 'triggered', EXPIRED: 'expired' };
619
622
  const WATCH_TARGET_TYPE = { PR: 'pr', WORK_ITEM: 'work-item' };
620
623
  const WATCH_CONDITION = { MERGED: 'merged', BUILD_FAIL: 'build-fail', BUILD_PASS: 'build-pass', COMPLETED: 'completed', FAILED: 'failed', STATUS_CHANGE: 'status-change', ANY: 'any' };
624
+ // Absolute conditions auto-expire on first trigger when stopAfter=0 (fire-once semantics).
625
+ // Change-based conditions (status-change, any) run forever when stopAfter=0.
626
+ const WATCH_ABSOLUTE_CONDITIONS = new Set([
627
+ WATCH_CONDITION.MERGED, WATCH_CONDITION.BUILD_FAIL, WATCH_CONDITION.BUILD_PASS,
628
+ WATCH_CONDITION.COMPLETED, WATCH_CONDITION.FAILED,
629
+ ]);
621
630
 
622
631
  /** Update per-agent review metrics (prsApproved/prsRejected). Only writes for configured agents. */
623
632
  function trackReviewMetric(pr, newReviewStatus, config) {
@@ -1144,7 +1153,7 @@ module.exports = {
1144
1153
  classifyInboxItem,
1145
1154
  ENGINE_DEFAULTS,
1146
1155
  WI_STATUS, DONE_STATUSES, PLAN_TERMINAL_STATUSES, WORK_TYPE, PLAN_STATUS, PRD_ITEM_STATUS, PRD_MATERIALIZABLE, PR_STATUS, PR_POLLABLE_STATUSES, DISPATCH_RESULT, trackReviewMetric, queuePlanToPrd,
1147
- WATCH_STATUS, WATCH_TARGET_TYPE, WATCH_CONDITION,
1156
+ WATCH_STATUS, WATCH_TARGET_TYPE, WATCH_CONDITION, WATCH_ABSOLUTE_CONDITIONS,
1148
1157
  PIPELINE_STATUS, STAGE_TYPE, MEETING_STATUS, AGENT_STATUS,
1149
1158
  FAILURE_CLASS, ESCALATION_POLICY, COMPLETION_FIELDS,
1150
1159
  DEFAULT_AGENT_METRICS,
package/engine/watches.js CHANGED
@@ -11,7 +11,7 @@
11
11
  const path = require('path');
12
12
  const shared = require('./shared');
13
13
  const { safeJson, mutateJsonFileLocked, ts, uid, log, writeToInbox,
14
- WATCH_STATUS, WATCH_TARGET_TYPE, WATCH_CONDITION, WATCH_ABSOLUTE_CONDITIONS } = shared;
14
+ WATCH_STATUS, WATCH_TARGET_TYPE, WATCH_CONDITION } = shared;
15
15
 
16
16
  // Dynamic path — respects MINIONS_TEST_DIR for test isolation
17
17
  function _watchesPath() { return path.join(shared.MINIONS_DIR, 'engine', 'watches.json'); }
@@ -237,15 +237,11 @@ function checkWatches(config, state) {
237
237
  }
238
238
  log('info', `Watch triggered: ${watch.id} — ${result.message}`);
239
239
 
240
- // Expire: absolute conditions auto-expire when stopAfter is 0 (fire-once semantics),
241
- // change-based conditions (status-change, any) respect stopAfter literally (0 = run forever).
242
- const isAbsolute = WATCH_ABSOLUTE_CONDITIONS.has(watch.condition);
240
+ // Expire when stopAfter > 0 and trigger count reaches the limit.
241
+ // stopAfter: 0 means "run forever" for all condition types.
243
242
  if (watch.stopAfter > 0 && watch.triggerCount >= watch.stopAfter) {
244
243
  watch.status = WATCH_STATUS.EXPIRED;
245
244
  log('info', `Watch expired (stopAfter limit reached): ${watch.id}`);
246
- } else if (isAbsolute && watch.stopAfter === 0) {
247
- watch.status = WATCH_STATUS.EXPIRED;
248
- log('info', `Watch expired (absolute condition auto-expire): ${watch.id}`);
249
245
  }
250
246
  } else if (watch.onNotMet === 'notify' && watch.owner) {
251
247
  // Queue per-poll notification when condition is not yet met — unique key per poll
package/engine.js CHANGED
@@ -1898,6 +1898,13 @@ async function discoverFromPrs(config, project) {
1898
1898
 
1899
1899
  const projMeta = { name: project?.name, localPath: project?.localPath };
1900
1900
 
1901
+ // Resolve poll-enabled per project — stale reviewStatus is untrustworthy without poller
1902
+ const isAdoProject = project?.repoHost !== 'github';
1903
+ const pollEnabled = isAdoProject
1904
+ ? (config.engine?.adoPollEnabled ?? DEFAULTS.adoPollEnabled)
1905
+ : (config.engine?.ghPollEnabled ?? DEFAULTS.ghPollEnabled);
1906
+ const evalLoopEnabled = config.engine?.evalLoop !== false;
1907
+
1901
1908
  // Collect active PR dispatches to prevent simultaneous review+fix on same PR
1902
1909
  const dispatch = getDispatch();
1903
1910
  const activePrIds = new Set(
@@ -1945,10 +1952,10 @@ async function discoverFromPrs(config, project) {
1945
1952
  log('warn', `PR ${pr.id}: review→fix escalated after ${evalCycles} cycles — suspending auto-dispatch`);
1946
1953
  }
1947
1954
 
1948
- // PRs needing review: pending review status and not already reviewed without new commits
1949
- const autoReview = config.engine?.autoReview !== false;
1955
+ // PRs needing review: evalLoop gates the entire review+fix cycle; pollEnabled ensures reviewStatus is fresh
1956
+ const reviewEnabled = evalLoopEnabled && pollEnabled;
1950
1957
  const alreadyReviewed = pr.lastReviewedAt && (!pr.lastPushedAt || pr.lastPushedAt <= pr.lastReviewedAt);
1951
- const needsReview = autoReview && reviewStatus === 'pending' && !alreadyReviewed && !evalEscalated;
1958
+ const needsReview = reviewEnabled && reviewStatus === 'pending' && !alreadyReviewed && !evalEscalated;
1952
1959
  if (needsReview) {
1953
1960
  const key = `review-${project?.name || 'default'}-${pr.id}`;
1954
1961
  if (isAlreadyDispatched(key) || isOnCooldown(key, cooldownMs)) continue;
@@ -1972,7 +1979,7 @@ async function discoverFromPrs(config, project) {
1972
1979
  } catch {}
1973
1980
  continue;
1974
1981
  }
1975
- } catch (e) { log('warn', `Pre-dispatch vote check for ${pr.id}: ${e.message}`); }
1982
+ } catch (e) { log('warn', `Pre-dispatch vote check for ${pr.id}: ${e.message} — skipping dispatch`); continue; }
1976
1983
 
1977
1984
  const agentId = resolveAgent('review', config);
1978
1985
  if (!agentId) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.982",
3
+ "version": "0.1.984",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"