@yemi33/minions 0.1.2183 → 0.1.2185

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/engine/cli.js CHANGED
@@ -2170,7 +2170,6 @@ module.exports = {
2170
2170
  _parseRuntimeFlags,
2171
2171
  _modelLooksIncompatible,
2172
2172
  _applyRuntimeFlags,
2173
- _createControlOwner: createControlOwner,
2174
2173
  _controlBelongsToOwner: controlBelongsToOwner,
2175
2174
  _markControlStoppingForOwner: markControlStoppingForOwner,
2176
2175
  _markControlStoppedForOwner: markControlStoppedForOwner,
@@ -141,14 +141,6 @@ function getLastTerminalForAgent(agentId) {
141
141
  return null;
142
142
  }
143
143
 
144
- function getLastTerminalForDispatch(dispatchId) {
145
- if (!dispatchId) return null;
146
- const events = readRecentEvents();
147
- for (let i = events.length - 1; i >= 0; i--) {
148
- if (events[i].dispatchId === dispatchId) return events[i];
149
- }
150
- return null;
151
- }
152
144
 
153
145
  /**
154
146
  * Build the terminal event payload from a freshly-completed dispatch entry +
@@ -245,7 +237,6 @@ module.exports = {
245
237
  onDispatchTerminal,
246
238
  readRecentEvents,
247
239
  getLastTerminalForAgent,
248
- getLastTerminalForDispatch,
249
240
  buildTerminalEvent,
250
241
  // dispatch.started (W-mq1m1wo5000nd78d)
251
242
  emitDispatchStarted,
@@ -298,17 +298,10 @@ function _mirrorJsonFromSql() {
298
298
  }
299
299
  }
300
300
 
301
- // Test seam — clear the dispatches table. Production code never calls this.
302
- function _resetDispatchTableForTest() {
303
- const { getDb } = require('./db');
304
- try { getDb().exec('DELETE FROM dispatches'); } catch { /* not initialized */ }
305
- }
306
-
307
301
  module.exports = {
308
302
  readDispatchSectioned,
309
303
  applyDispatchMutation,
310
304
  _readDispatchSectionedFull,
311
305
  _computeDispatchDiff,
312
306
  _mirrorJsonFromSql,
313
- _resetDispatchTableForTest,
314
307
  };
package/engine/github.js CHANGED
@@ -400,26 +400,16 @@ async function ghApi(endpoint, slug, opts = {}) {
400
400
  }
401
401
  }
402
402
 
403
- /**
404
- * Run a `gh api` call with per-slug backoff tracking. Returns null on failure.
405
- * On success, resets the slug's backoff. On failure, increments it.
406
- */
407
- async function ghApiWithBackoff(endpoint, slug) {
408
- const result = await ghApi(endpoint, slug);
409
- if (result === null) {
410
- recordSlugFailure(slug);
411
- } else {
412
- resetSlugBackoff(slug);
413
- }
414
- return result;
415
- }
416
-
417
403
  const BUILD_ERROR_LOG_MAX_LINES = 150;
418
404
 
419
405
  /**
420
406
  * Fetch actual build/compiler error logs from GitHub when a check run fails.
421
407
  * Tries annotations first (structured error messages), then falls back to the
422
408
  * Actions job log. Returns truncated log text or null if unavailable.
409
+ *
410
+ * NOTE: counterpart to ado.js#fetchAdoBuildErrorLog (W-mnp8iyqe0ogn), which IS
411
+ * wired into the ADO poller. This GitHub variant has source-inspection test
412
+ * coverage but is not yet called from the GitHub PR poller path.
423
413
  */
424
414
  async function fetchGhBuildErrorLog(slug, failedRuns) {
425
415
  try {
@@ -10,7 +10,6 @@ const shared = require('./shared');
10
10
  const { safeRead, safeJson, safeJsonArr, safeJsonNoRestore, safeWrite, mutateJsonFileLocked, mutateWorkItems, execAsync, projectPrPath, getPrLinks,
11
11
  log, ts, dateStamp, WI_STATUS, DONE_STATUSES, PLAN_TERMINAL_STATUSES, WORK_TYPE, PLAN_STATUS, PRD_ITEM_STATUS, PR_STATUS, REVIEW_STATUS, RETRY_DELAY_MS, DISPATCH_RESULT,
12
12
  ENGINE_DEFAULTS, DEFAULT_AGENT_METRICS, FAILURE_CLASS } = shared;
13
- const { trackEngineUsage } = require('./llm');
14
13
  const { resolveRuntime } = require('./runtimes');
15
14
  const adoGitAuth = require('./ado-git-auth');
16
15
  const queries = require('./queries');
@@ -13,16 +13,15 @@
13
13
  //
14
14
  // The resolved value is cached in module state. The cache is intentionally
15
15
  // process-lifetime: `minions restart` re-resolves; the per-tick dispatch hot
16
- // path does not. Test helpers expose cache reset + exec/os.username injection
17
- // so unit tests stay hermetic.
16
+ // path does not. `_resetOperatorLoginCacheForTest` clears the cache when the
17
+ // Settings override changes.
18
18
 
19
19
  const { execSync } = require('child_process');
20
20
  const os = require('os');
21
21
 
22
22
  let _cached = null;
23
23
 
24
- // Test seams. The default impls shell out; tests inject pure functions.
25
- let _execImpl = (cmd) => {
24
+ function _execImpl(cmd) {
26
25
  try {
27
26
  return String(execSync(cmd, {
28
27
  encoding: 'utf8',
@@ -32,12 +31,9 @@ let _execImpl = (cmd) => {
32
31
  } catch {
33
32
  return '';
34
33
  }
35
- };
36
-
37
- let _osUsernameOverride = null; // null = call real os.userInfo()
34
+ }
38
35
 
39
36
  function _osUsername() {
40
- if (_osUsernameOverride !== null) return _osUsernameOverride;
41
37
  try {
42
38
  const u = os.userInfo().username;
43
39
  return u ? String(u) : '';
@@ -76,29 +72,11 @@ function resolveOperatorLogin(config, { force = false } = {}) {
76
72
  return _cached;
77
73
  }
78
74
 
79
- // ── Test helpers (not part of the public API) ────────────────────────────────
80
-
75
+ // Clear the process-lifetime cache. Called by the dashboard when the operator
76
+ // login override changes in Settings so the next resolve picks up the new value.
81
77
  function _resetOperatorLoginCacheForTest() { _cached = null; }
82
- function _setExecImplForTest(fn) { _execImpl = typeof fn === 'function' ? fn : _execImpl; }
83
- function _resetExecImplForTest() {
84
- _execImpl = (cmd) => {
85
- try {
86
- return String(execSync(cmd, {
87
- encoding: 'utf8',
88
- stdio: ['ignore', 'pipe', 'ignore'],
89
- timeout: 5000,
90
- })).trim();
91
- } catch {
92
- return '';
93
- }
94
- };
95
- }
96
- function _setOsUsernameForTest(value) { _osUsernameOverride = value; }
97
78
 
98
79
  module.exports = {
99
80
  resolveOperatorLogin,
100
81
  _resetOperatorLoginCacheForTest,
101
- _setExecImplForTest,
102
- _resetExecImplForTest,
103
- _setOsUsernameForTest,
104
82
  };
@@ -11,7 +11,7 @@ const queries = require('./queries');
11
11
  const { safeJson, safeJsonNoRestore, safeWrite, safeRead, safeReadDir, uid, log, ts, dateStamp, mutateJsonFileLocked, mutateWorkItems, mutatePipelineRuns, slugify, formatTranscriptEntry, WI_STATUS, WORK_TYPE, PLAN_STATUS, PR_STATUS, PIPELINE_STATUS, STAGE_TYPE, MEETING_STATUS, READ_ONLY_ROOT_TASK_TYPES, ENGINE_DEFAULTS, MINIONS_DIR } = shared;
12
12
  const routing = require('./routing');
13
13
  const http = require('http');
14
- const { parseCronExpr, shouldRunNow } = require('./scheduler');
14
+ const { shouldRunNow } = require('./scheduler');
15
15
 
16
16
  // All module-relative paths flow through MINIONS_DIR so MINIONS_TEST_DIR
17
17
  // (set by test/unit.test.js createTestMinionsDir) consistently redirects
@@ -440,46 +440,6 @@ function executeTaskStage(stage, stageState, run, config, pipeline = {}) {
440
440
  return { status: PIPELINE_STATUS.RUNNING, artifacts };
441
441
  }
442
442
 
443
- function executeTaskStageLegacy(stage, stageState, run, config) {
444
- const items = stage.items || [{ title: stage.title, description: stage.description || '', type: stage.taskType || 'explore', agent: stage.agent }];
445
- const count = stage.count || items.length;
446
- const wiPath = CENTRAL_WI_PATH;
447
- const createdIds = [];
448
-
449
- mutateWorkItems(wiPath, workItems => {
450
- for (let i = 0; i < count; i++) {
451
- const item = items[i % items.length];
452
- const id = `PL-${run.runId.slice(4, 12)}-${stage.id}-${i}`;
453
- if (workItems.some(w => w.id === id)) { createdIds.push(id); continue; }
454
- const wiType = routing.normalizeWorkType(item.type || stage.taskType, WORK_TYPE.EXPLORE);
455
- // W-mp8ho6w500034a58: read-only stages don't commit, so the branch
456
- // label is meaningless — omit it so dispatch takes the read-only path
457
- // without recomputing a worktree placement that will never be used.
458
- const wiBranch = READ_ONLY_ROOT_TASK_TYPES.has(wiType)
459
- ? null
460
- : `pipeline/${run.pipelineId}/${stage.id}`;
461
- workItems.push({
462
- id,
463
- title: item.title || stage.title,
464
- description: item.description || stage.description || '',
465
- type: wiType,
466
- priority: item.priority || stage.priority || 'medium',
467
- // Agent is a soft routing hint unless agentLock/hardAgent is set.
468
- ...(item.agent || stage.agent ? { agent: item.agent || stage.agent } : {}),
469
- ...(item.agentLock === true || stage.agentLock === true || item.hardAgent === true || stage.hardAgent === true ? { agentLock: true } : {}),
470
- status: WI_STATUS.PENDING,
471
- created: ts(),
472
- createdBy: 'pipeline:' + run.pipelineId,
473
- ...(wiBranch ? { branch: wiBranch } : {}),
474
- _pipelineRun: run.runId,
475
- _pipelineStage: stage.id,
476
- });
477
- createdIds.push(id);
478
- }
479
- });
480
- return { status: PIPELINE_STATUS.RUNNING, artifacts: { workItems: createdIds } };
481
- }
482
-
483
443
  function executeMeetingStage(stage, stageState, run, config) {
484
444
  const { createMeeting } = require('./meeting');
485
445
  const agents = config.agents || {};
@@ -299,11 +299,6 @@ function _mirrorJsonFromSql(scope, filePath) {
299
299
  }
300
300
  }
301
301
 
302
- function _resetPullRequestsTableForTest() {
303
- const { getDb } = require('./db');
304
- try { getDb().exec('DELETE FROM pull_requests'); } catch { /* not initialized */ }
305
- }
306
-
307
302
  function dropScope(scope) {
308
303
  try {
309
304
  const { getDb } = require('./db');
@@ -320,5 +315,4 @@ module.exports = {
320
315
  dropScope,
321
316
  _filePathForScope,
322
317
  _mirrorJsonFromSql,
323
- _resetPullRequestsTableForTest,
324
318
  };
@@ -833,22 +833,6 @@ function _summarizeTarget(target) {
833
833
  }
834
834
  }
835
835
 
836
- /**
837
- * W-mpq6xqzj000606d0 — Back-compat shim: return the canonical projects[]
838
- * array for a session, regardless of whether the record was written under
839
- * the legacy single-`project` schema or the new `projects[]` schema. Returns
840
- * `[]` for "central" sessions (no project) so callers can simply check
841
- * `length > 1` for multi-project mode.
842
- */
843
- function _resolveSessionProjects(session) {
844
- if (!session || typeof session !== 'object') return [];
845
- const fromArr = session.spec && Array.isArray(session.spec.projects) ? session.spec.projects : null;
846
- if (fromArr && fromArr.length > 0) return fromArr.slice();
847
- const fromStr = session.spec && typeof session.spec.project === 'string' && session.spec.project.length > 0
848
- ? session.spec.project
849
- : null;
850
- return fromStr ? [fromStr] : [];
851
- }
852
836
 
853
837
  // ── Cross-WI dispatch chain helpers ─────────────────────────────────────────
854
838
  //
@@ -1359,5 +1343,4 @@ module.exports = {
1359
1343
  summarizeSessionsForStatus,
1360
1344
  // Internals (exposed for tests)
1361
1345
  _isSafeSessionId,
1362
- _resolveSessionProjects,
1363
1346
  };
package/engine/queries.js CHANGED
@@ -2702,13 +2702,6 @@ function _mtimePathsCacheKey(config) {
2702
2702
  const projects = getProjects(config).map(p => (p.name || '') + '|' + (p.localPath || ''));
2703
2703
  return projects.join(';');
2704
2704
  }
2705
- function _invalidateMtimePathsCache() {
2706
- _fastMtimePathsCache = null;
2707
- _fastMtimePathsCacheKey = null;
2708
- _slowMtimePathsCache = null;
2709
- _slowMtimePathsCacheKey = null;
2710
- }
2711
-
2712
2705
  function getStatusFastStateMtimePaths(config) {
2713
2706
  // Issue #2949 — /api/status was slimmed to just engine/throttle state +
2714
2707
  // skills/mcp/projects/version. dispatch.json, work-items.json,
package/engine/shared.js CHANGED
@@ -7975,7 +7975,6 @@ module.exports = {
7975
7975
  writeDashboardPortFile,
7976
7976
  clearDashboardPortFile,
7977
7977
  resolveDashboardPort,
7978
- currentLogPath: _currentLogPath,
7979
7978
  ts,
7980
7979
  normalizeIsoTimestamp, // F6 (P-f6commentedit)
7981
7980
  buildEditsSeen, // F6 (P-f6commentedit)
@@ -1351,37 +1351,6 @@ function _mirrorDocSessionsJson(filePath) {
1351
1351
  } catch { /* mirror best-effort */ }
1352
1352
  }
1353
1353
 
1354
- // ─── Test seam ─────────────────────────────────────────────────────────────
1355
-
1356
- function _resetAllForTest() {
1357
- const { getDb } = require('./db');
1358
- try {
1359
- const db = getDb();
1360
- db.exec('DELETE FROM schedule_runs');
1361
- db.exec('DELETE FROM pipeline_runs');
1362
- db.exec('DELETE FROM managed_processes');
1363
- db.exec('DELETE FROM worktree_pool');
1364
- try { db.exec('DELETE FROM qa_runs'); } catch { /* migration not applied */ }
1365
- try { db.exec('DELETE FROM qa_sessions'); } catch { /* migration not applied */ }
1366
- try { db.exec('DELETE FROM pr_links'); } catch { /* migration not applied */ }
1367
- try { db.exec('DELETE FROM cooldowns'); } catch { /* migration not applied */ }
1368
- try { db.exec('DELETE FROM pending_rebases'); } catch { /* migration not applied */ }
1369
- try { db.exec('DELETE FROM cc_sessions'); } catch { /* migration not applied */ }
1370
- try { db.exec('DELETE FROM doc_sessions'); } catch { /* migration not applied */ }
1371
- } catch { /* not initialized */ }
1372
- _scheduleRunsHash = null;
1373
- _pipelineRunsHash = null;
1374
- _managedProcessesHash = null;
1375
- _worktreePoolHash = null;
1376
- _qaRunsHash = null;
1377
- _qaSessionsHash = null;
1378
- _prLinksHash = null;
1379
- _cooldownsHash = null;
1380
- _pendingRebasesHash = null;
1381
- _ccSessionsHash = null;
1382
- _docSessionsHash = null;
1383
- }
1384
-
1385
1354
  module.exports = {
1386
1355
  // schedule_runs
1387
1356
  readScheduleRuns,
@@ -1427,6 +1396,4 @@ module.exports = {
1427
1396
  readDocSessions,
1428
1397
  applyDocSessionsMutation,
1429
1398
  _mirrorDocSessionsJson,
1430
- // test seam
1431
- _resetAllForTest,
1432
1399
  };
@@ -1189,5 +1189,4 @@ module.exports = {
1189
1189
  validateAction,
1190
1190
  computeWatchDedupKey, // exported for testing (BUG-H10)
1191
1191
  WATCH_DEDUP_ACTIVE_STATUSES, // exported for testing (BUG-H10)
1192
- _ACTION_TYPES: ACTION_TYPES, // exported for testing
1193
1192
  };
@@ -245,15 +245,8 @@ function _mirrorJsonFromSql(filePath) {
245
245
  }
246
246
  }
247
247
 
248
- function _resetWatchesTableForTest() {
249
- const { getDb } = require('./db');
250
- try { getDb().exec('DELETE FROM watches'); } catch { /* not initialized */ }
251
- _lastMirrorHash = null;
252
- }
253
-
254
248
  module.exports = {
255
249
  readWatches,
256
250
  applyWatchesMutation,
257
251
  _mirrorJsonFromSql,
258
- _resetWatchesTableForTest,
259
252
  };
@@ -357,12 +357,6 @@ function _mirrorJsonFromSql(scope, filePath) {
357
357
  }
358
358
  }
359
359
 
360
- // Test seam.
361
- function _resetWorkItemsTableForTest() {
362
- const { getDb } = require('./db');
363
- try { getDb().exec('DELETE FROM work_items'); } catch { /* not initialized */ }
364
- }
365
-
366
360
  // Drop every SQL row for `scope` and forget its mirror-hash. Called by
367
361
  // removeProject after the JSON file is archived so safeJson shim reads no
368
362
  // longer surface the removed project's records.
@@ -382,5 +376,4 @@ module.exports = {
382
376
  dropScope,
383
377
  _filePathForScope,
384
378
  _mirrorJsonFromSql,
385
- _resetWorkItemsTableForTest,
386
379
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2183",
3
+ "version": "0.1.2185",
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"