@yemi33/minions 0.1.543 → 0.1.545

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,13 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.543 (2026-04-07)
3
+ ## 0.1.545 (2026-04-07)
4
+
5
+ ### Features
6
+ - add DEFAULT_AGENT_METRICS constant to shared.js (#464)
7
+ - remove inline require('fs') calls from engine/shared.js (#463)
4
8
 
5
9
  ### Fixes
10
+ - make discoverFromPrs/discoverWork async to match await usage
6
11
  - await checkLiveReviewStatus in pre-dispatch vote check (closes #462) (#469)
7
12
 
8
13
  ## 0.1.542 (2026-04-07)
package/engine/github.js CHANGED
@@ -170,10 +170,11 @@ async function forEachActiveGhPr(config, callback) {
170
170
  const updated = await callback(null, pr, prNum, slug);
171
171
  if (updated) {
172
172
  // Also update title/author/branch if still placeholder
173
- if (pr.title.includes('polling...') || pr.agent === 'human') {
173
+ if (pr.title.includes('polling...') || pr.agent === 'human' || pr.description === undefined) {
174
174
  const prData = await ghApi(`/pulls/${prNum}`, slug);
175
175
  if (prData) {
176
176
  if (pr.title.includes('polling...')) pr.title = (prData.title || pr.title).slice(0, 120);
177
+ if (pr.description === undefined) pr.description = (prData.body || '').slice(0, 500);
177
178
  if (pr.agent === 'human' && prData.user?.login) pr.agent = prData.user.login;
178
179
  if (!pr.branch && prData.head?.ref) pr.branch = prData.head.ref;
179
180
  }
@@ -9,7 +9,7 @@ const os = require('os');
9
9
  const shared = require('./shared');
10
10
  const { safeRead, safeJson, safeWrite, mutateJsonFileLocked, mutateWorkItems, execSilent, projectPrPath, getPrLinks, addPrLink,
11
11
  log, ts, dateStamp, WI_STATUS, DONE_STATUSES, WORK_TYPE, PLAN_STATUS, PR_STATUS, DISPATCH_RESULT,
12
- ENGINE_DEFAULTS } = shared;
12
+ ENGINE_DEFAULTS, DEFAULT_AGENT_METRICS } = shared;
13
13
  const { trackEngineUsage } = require('./llm');
14
14
  const queries = require('./queries');
15
15
  const { getConfig, getInboxFiles, getNotes, getPrs, getDispatch,
@@ -734,8 +734,8 @@ async function updatePrAfterReview(agentId, pr, project, config) {
734
734
  const authorAgentId = (pr.agent || '').toLowerCase();
735
735
  if (authorAgentId && config.agents?.[authorAgentId]) {
736
736
  shared.mutateJsonFileLocked(path.join(ENGINE_DIR, 'metrics.json'), (metrics) => {
737
- if (!metrics[authorAgentId]) metrics[authorAgentId] = { tasksCompleted:0, tasksErrored:0, prsCreated:0, prsApproved:0, prsRejected:0, reviewsDone:0, lastTask:null, lastCompleted:null };
738
- if (!metrics[agentId]) metrics[agentId] = { tasksCompleted:0, tasksErrored:0, prsCreated:0, prsApproved:0, prsRejected:0, reviewsDone:0, lastTask:null, lastCompleted:null };
737
+ if (!metrics[authorAgentId]) metrics[authorAgentId] = { ...DEFAULT_AGENT_METRICS };
738
+ if (!metrics[agentId]) metrics[agentId] = { ...DEFAULT_AGENT_METRICS };
739
739
  metrics[agentId].reviewsDone = (metrics[agentId].reviewsDone || 0) + 1;
740
740
  return metrics;
741
741
  }, { defaultValue: {} });
@@ -847,7 +847,7 @@ async function handlePostMerge(pr, project, config, newStatus) {
847
847
  if (agentId && config.agents?.[agentId]) {
848
848
  const metricsPath = path.join(ENGINE_DIR, 'metrics.json');
849
849
  mutateJsonFileLocked(metricsPath, (metrics) => {
850
- if (!metrics[agentId]) metrics[agentId] = { tasksCompleted:0, tasksErrored:0, prsCreated:0, prsApproved:0, prsRejected:0, prsMerged:0, reviewsDone:0, lastTask:null, lastCompleted:null };
850
+ if (!metrics[agentId]) metrics[agentId] = { ...DEFAULT_AGENT_METRICS };
851
851
  metrics[agentId].prsMerged = (metrics[agentId].prsMerged || 0) + 1;
852
852
  return metrics;
853
853
  });
@@ -1010,8 +1010,7 @@ function updateMetrics(agentId, dispatchItem, result, taskUsage, prsCreatedCount
1010
1010
  mutateJsonFileLocked(metricsPath, metrics => {
1011
1011
  metrics = metrics || {};
1012
1012
  if (!metrics[agentId]) {
1013
- metrics[agentId] = { tasksCompleted: 0, tasksErrored: 0, prsCreated: 0, prsApproved: 0, prsRejected: 0,
1014
- reviewsDone: 0, lastTask: null, lastCompleted: null, totalCostUsd: 0, totalInputTokens: 0, totalOutputTokens: 0, totalCacheRead: 0 };
1013
+ metrics[agentId] = { ...DEFAULT_AGENT_METRICS };
1015
1014
  }
1016
1015
  const m = metrics[agentId];
1017
1016
  m.lastTask = dispatchItem.task;
package/engine/shared.js CHANGED
@@ -562,6 +562,14 @@ const MEETING_STATUS = {
562
562
  COMPLETED: 'completed', ARCHIVED: 'archived',
563
563
  };
564
564
 
565
+ const DEFAULT_AGENT_METRICS = {
566
+ tasksCompleted: 0, tasksErrored: 0,
567
+ prsCreated: 0, prsApproved: 0, prsRejected: 0, prsMerged: 0,
568
+ reviewsDone: 0,
569
+ lastTask: null, lastCompleted: null,
570
+ totalCostUsd: 0, totalInputTokens: 0, totalOutputTokens: 0, totalCacheRead: 0,
571
+ };
572
+
565
573
  const DEFAULT_AGENTS = {
566
574
  ripley: { name: 'Ripley', emoji: '\u{1F3D7}\uFE0F', role: 'Lead / Explorer', skills: ['architecture', 'codebase-exploration', 'design-review'] },
567
575
  dallas: { name: 'Dallas', emoji: '\u{1F527}', role: 'Engineer', skills: ['implementation', 'typescript', 'docker', 'testing'] },
@@ -600,7 +608,7 @@ function projectRoot(project) {
600
608
  function projectStateDir(project) {
601
609
  const name = project.name || path.basename(project.localPath);
602
610
  const dir = path.join(MINIONS_DIR, 'projects', name);
603
- if (!require('fs').existsSync(dir)) require('fs').mkdirSync(dir, { recursive: true });
611
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
604
612
  return dir;
605
613
  }
606
614
 
@@ -705,7 +713,6 @@ function getPrLinks() {
705
713
  // Primary source: derive from all projects/*/pull-requests.json prdItems
706
714
  const projectsDir = path.join(MINIONS_DIR, 'projects');
707
715
  try {
708
- const fs = require('fs');
709
716
  for (const d of fs.readdirSync(projectsDir, { withFileTypes: true })) {
710
717
  if (!d.isDirectory()) continue;
711
718
  try {
@@ -721,7 +728,7 @@ function getPrLinks() {
721
728
  } catch { /* projects dir missing */ }
722
729
  // Fallback: static pr-links.json for entries not covered above
723
730
  try {
724
- const static_ = JSON.parse(require('fs').readFileSync(PR_LINKS_PATH, 'utf8'));
731
+ const static_ = JSON.parse(fs.readFileSync(PR_LINKS_PATH, 'utf8'));
725
732
  for (const [k, v] of Object.entries(static_)) {
726
733
  if (!links[k]) links[k] = v;
727
734
  }
@@ -825,6 +832,7 @@ module.exports = {
825
832
  ENGINE_DEFAULTS,
826
833
  WI_STATUS, DONE_STATUSES, WORK_TYPE, PLAN_STATUS, PR_STATUS, DISPATCH_RESULT,
827
834
  PIPELINE_STATUS, STAGE_TYPE, MEETING_STATUS,
835
+ DEFAULT_AGENT_METRICS,
828
836
  DEFAULT_AGENTS,
829
837
  DEFAULT_CLAUDE,
830
838
  getProjects,
package/engine.js CHANGED
@@ -1350,7 +1350,7 @@ function clearPendingHumanFeedbackFlag(projectMeta, prId) {
1350
1350
  /**
1351
1351
  * Scan pull-requests.json for PRs needing review or fixes
1352
1352
  */
1353
- function discoverFromPrs(config, project) {
1353
+ async function discoverFromPrs(config, project) {
1354
1354
  const src = project?.workSources?.pullRequests || config.workSources?.pullRequests;
1355
1355
  if (!src?.enabled) return [];
1356
1356
 
@@ -2226,7 +2226,7 @@ function discoverCentralWorkItems(config) {
2226
2226
  * Run all work discovery sources and queue new items
2227
2227
  * Priority: fix (0) > ask (1) > review (1) > implement (2) > work-items (3) > central (4)
2228
2228
  */
2229
- function discoverWork(config) {
2229
+ async function discoverWork(config) {
2230
2230
  resetClaimedAgents(); // Reset per-tick agent claims for fair distribution
2231
2231
  const projects = getProjects(config);
2232
2232
  let allFixes = [], allReviews = [], allWorkItems = [];
@@ -2240,7 +2240,7 @@ function discoverWork(config) {
2240
2240
  if (!root || !fs.existsSync(root)) continue;
2241
2241
 
2242
2242
  // Source 1: Pull Requests → fixes, reviews, build-test
2243
- const prWork = discoverFromPrs(config, project);
2243
+ const prWork = await discoverFromPrs(config, project);
2244
2244
  allFixes.push(...prWork.filter(w => w.type === WORK_TYPE.FIX));
2245
2245
  allReviews.push(...prWork.filter(w => w.type === WORK_TYPE.REVIEW));
2246
2246
  allWorkItems.push(...prWork.filter(w => w.type === WORK_TYPE.TEST));
@@ -2550,7 +2550,7 @@ async function tickInner() {
2550
2550
 
2551
2551
  // 3. Discover new work from sources
2552
2552
  let discoveryOk = true;
2553
- try { discoverWork(config); } catch (e) { log('warn', 'discoverWork: ' + e.message); discoveryOk = false; }
2553
+ try { await discoverWork(config); } catch (e) { log('warn', 'discoverWork: ' + e.message); discoveryOk = false; }
2554
2554
 
2555
2555
  // 4. Update snapshot
2556
2556
  safe('updateSnapshot', () => updateSnapshot(config));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.543",
3
+ "version": "0.1.545",
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"