@yemi33/minions 0.1.519 → 0.1.520

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,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.520 (2026-04-07)
4
+
5
+ ### Other
6
+ - perf: reduce curl timeout to 5s, cache getDispatch() reads
7
+
3
8
  ## 0.1.519 (2026-04-07)
4
9
 
5
10
  ### Other
package/engine/ado.js CHANGED
@@ -495,7 +495,7 @@ function checkLiveReviewStatus(pr, project) {
495
495
  const orgBase = shared.getAdoOrgBase(project);
496
496
  const prNum = (pr.id || '').replace(/^PR-/, '');
497
497
  const url = `${orgBase}/${project.adoProject}/_apis/git/repositories/${project.repositoryId}/pullrequests/${prNum}?api-version=7.1`;
498
- const result = exec(`curl -s -H "Authorization: Bearer ${token}" "${url}"`, { encoding: 'utf-8', timeout: 15000, windowsHide: true });
498
+ const result = exec(`curl -s --max-time 4 -H "Authorization: Bearer ${token}" "${url}"`, { encoding: 'utf-8', timeout: 5000, windowsHide: true });
499
499
  const prData = JSON.parse(result);
500
500
  const votes = (prData.reviewers || []).map(r => r.vote).filter(v => v !== undefined);
501
501
  if (votes.length === 0) return 'pending';
@@ -24,12 +24,15 @@ function lifecycle() { if (!_lifecycle) _lifecycle = require('./lifecycle'); ret
24
24
 
25
25
  function mutateDispatch(mutator) {
26
26
  const defaultDispatch = { pending: [], active: [], completed: [] };
27
- return mutateJsonFileLocked(DISPATCH_PATH, (dispatch) => {
27
+ const result = mutateJsonFileLocked(DISPATCH_PATH, (dispatch) => {
28
28
  dispatch.pending = Array.isArray(dispatch.pending) ? dispatch.pending : [];
29
29
  dispatch.active = Array.isArray(dispatch.active) ? dispatch.active : [];
30
30
  dispatch.completed = Array.isArray(dispatch.completed) ? dispatch.completed : [];
31
31
  return mutator(dispatch) || dispatch;
32
32
  }, { defaultValue: defaultDispatch });
33
+ // Invalidate the read cache so next getDispatch() sees fresh data
34
+ try { require('./queries').invalidateDispatchCache(); } catch {}
35
+ return result;
33
36
  }
34
37
 
35
38
  // ─── Add to Dispatch ─────────────────────────────────────────────────────────
package/engine/queries.js CHANGED
@@ -79,9 +79,17 @@ function getControl() {
79
79
  return safeJson(CONTROL_PATH) || { state: 'stopped', pid: null };
80
80
  }
81
81
 
82
+ let _dispatchCache = null;
83
+ let _dispatchCacheAt = 0;
82
84
  function getDispatch() {
83
- return safeJson(DISPATCH_PATH) || { pending: [], active: [], completed: [] };
85
+ // Short-lived cache dispatch.json is read 10+ times per tick but only changes on mutateDispatch
86
+ const now = Date.now();
87
+ if (_dispatchCache && (now - _dispatchCacheAt) < 2000) return _dispatchCache;
88
+ _dispatchCache = safeJson(DISPATCH_PATH) || { pending: [], active: [], completed: [] };
89
+ _dispatchCacheAt = now;
90
+ return _dispatchCache;
84
91
  }
92
+ function invalidateDispatchCache() { _dispatchCache = null; _dispatchCacheAt = 0; }
85
93
 
86
94
  function getDispatchQueue() {
87
95
  const d = getDispatch();
@@ -874,7 +882,7 @@ module.exports = {
874
882
  resetPrdInfoCache,
875
883
 
876
884
  // Core state
877
- getConfig, getControl, getDispatch, getDispatchQueue,
885
+ getConfig, getControl, getDispatch, getDispatchQueue, invalidateDispatchCache,
878
886
  getNotes, getNotesWithMeta, getEngineLog, getMetrics,
879
887
 
880
888
  // Inbox
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.519",
3
+ "version": "0.1.520",
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"