@yemi33/minions 0.1.2298 → 0.1.2299

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/dashboard.js CHANGED
@@ -11444,25 +11444,19 @@ What would you like to discuss or change? When you're happy, say "approve" and I
11444
11444
 
11445
11445
  // W-mq03l6zh0006f0a1-d — read-only diagnostics surface for the per-org ADO
11446
11446
  // throttle tracker. Returns { orgs: { [orgBase]: { throttled, retryAfter,
11447
- // consecutiveHits } } }. Prefers the per-org getter ado.getAdoThrottleStateAll
11448
- // when present (introduced by W-mq03l6zh0006f0a1-b). Falls back to the
11449
- // process-global ado.getAdoThrottleState() under the synthetic key `global`
11450
- // when the per-org getter is not present, so the endpoint stays live across
11451
- // the staged rollout of the per-org isolation work.
11447
+ // consecutiveHits } } }. Uses getAdoThrottleState().perOrg, the per-org map
11448
+ // exposed by the aggregate getter (W-mq03l6zh0006f0a1-b).
11452
11449
  async function handleDiagnosticsAdoThrottle(req, res) {
11453
11450
  try {
11454
11451
  let orgs = {};
11455
- if (typeof ado.getAdoThrottleStateAll === 'function') {
11456
- const all = ado.getAdoThrottleStateAll() || {};
11452
+ if (typeof ado.getAdoThrottleState === 'function') {
11453
+ const all = ado.getAdoThrottleState().perOrg || {};
11457
11454
  // Defensive copy — handler must never expose internal mutable state.
11458
11455
  for (const [k, v] of Object.entries(all)) {
11459
11456
  if (v && typeof v === 'object') {
11460
11457
  orgs[k] = { throttled: !!v.throttled, retryAfter: Number(v.retryAfter) || 0, consecutiveHits: Number(v.consecutiveHits) || 0 };
11461
11458
  }
11462
11459
  }
11463
- } else if (typeof ado.getAdoThrottleState === 'function') {
11464
- const v = ado.getAdoThrottleState() || {};
11465
- orgs.global = { throttled: !!v.throttled, retryAfter: Number(v.retryAfter) || 0, consecutiveHits: Number(v.consecutiveHits) || 0 };
11466
11460
  }
11467
11461
  return jsonReply(res, 200, { orgs });
11468
11462
  } catch (e) { return jsonReply(res, e.statusCode || 500, { error: e.message }); }
package/engine/ado.js CHANGED
@@ -2683,14 +2683,6 @@ const getAdoThrottleState = (orgBase) => {
2683
2683
  return { throttled, retryAfter, consecutiveHits, perOrg };
2684
2684
  };
2685
2685
 
2686
- /** Returns the per-org tracker state map keyed by canonical orgBase. */
2687
- const getAdoThrottleStateAll = () => {
2688
- const out = {};
2689
- for (const [key, tracker] of _adoThrottlesByOrg) {
2690
- out[key] = tracker.getState();
2691
- }
2692
- return out;
2693
- };
2694
2686
 
2695
2687
  /**
2696
2688
  * Query ADO for an open PR on a specific branch.
@@ -2955,7 +2947,6 @@ module.exports = {
2955
2947
  _setAdoTokenAuthNoteWriterForTest, // exported for testing
2956
2948
  isAdoThrottled,
2957
2949
  getAdoThrottleState,
2958
- getAdoThrottleStateAll,
2959
2950
  fetchAdoPrMetadata,
2960
2951
  prExists, // issue #246 — confirm a loose ref points at a PR (not a work item) before stamping
2961
2952
  fetchSinglePrBuildStatus,
@@ -3607,24 +3607,25 @@ function extractSkillsFromOutput(output, agentId, dispatchItem, config, runtimeN
3607
3607
  function updateAgentHistory(agentId, dispatchItem, result) {
3608
3608
 
3609
3609
  const historyPath = path.join(AGENTS_DIR, agentId, 'history.md');
3610
- let history = safeRead(historyPath) || '# Agent History\n\n';
3611
3610
  const entry = `### ${ts()} — ${result}\n` +
3612
3611
  `- **Task:** ${dispatchItem.task}\n` +
3613
3612
  `- **Type:** ${dispatchItem.type}\n` +
3614
3613
  `- **Project:** ${dispatchItem.meta?.project?.name || 'central'}\n` +
3615
3614
  `- **Branch:** ${dispatchItem.meta?.branch || 'none'}\n` +
3616
3615
  `- **Dispatch ID:** ${dispatchItem.id}\n\n`;
3617
- const headerEnd = history.indexOf('\n\n');
3618
- if (headerEnd >= 0) {
3619
- history = history.slice(0, headerEnd + 2) + entry + history.slice(headerEnd + 2);
3620
- } else {
3621
- history += entry;
3622
- }
3623
- const entries = history.split('### ').filter(Boolean);
3624
- const header = entries[0].startsWith('#') ? entries.shift() : '# Agent History\n\n';
3625
- const trimmed = entries.slice(0, 20);
3626
- history = header + trimmed.map(e => '### ' + e).join('');
3627
- shared.safeWrite(historyPath, history);
3616
+ shared.mutateTextFileLocked(historyPath, (history) => {
3617
+ history = history || '# Agent History\n\n';
3618
+ const headerEnd = history.indexOf('\n\n');
3619
+ if (headerEnd >= 0) {
3620
+ history = history.slice(0, headerEnd + 2) + entry + history.slice(headerEnd + 2);
3621
+ } else {
3622
+ history += entry;
3623
+ }
3624
+ const entries = history.split('### ').filter(Boolean);
3625
+ const header = entries[0].startsWith('#') ? entries.shift() : '# Agent History\n\n';
3626
+ const trimmed = entries.slice(0, 20);
3627
+ return header + trimmed.map(e => '### ' + e).join('');
3628
+ }, { defaultValue: '# Agent History\n\n' });
3628
3629
  log('info', `Updated history for ${agentId}`);
3629
3630
  }
3630
3631
 
package/engine.js CHANGED
@@ -5661,7 +5661,7 @@ function reconcileItemsWithPrs(items, allPrs, { onlyIds } = {}) {
5661
5661
  // ─── Inbox Consolidation (extracted to engine/consolidation.js) ──────────────
5662
5662
 
5663
5663
  const { consolidateInbox } = require('./engine/consolidation');
5664
- const { pollPrStatus, pollPrHumanComments, reconcilePrs, checkLiveReviewStatus: adoCheckLiveReview, checkLiveBuildAndConflict: adoCheckLiveBuildAndConflict, needsAdoPollRetry, getAdoToken, isAdoThrottled, getAdoThrottleStateAll } = require('./engine/ado');
5664
+ const { pollPrStatus, pollPrHumanComments, reconcilePrs, checkLiveReviewStatus: adoCheckLiveReview, checkLiveBuildAndConflict: adoCheckLiveBuildAndConflict, needsAdoPollRetry, getAdoToken, isAdoThrottled, getAdoThrottleState } = require('./engine/ado');
5665
5665
  const { pollPrStatus: ghPollPrStatus, pollPrHumanComments: ghPollPrHumanComments, reconcilePrs: ghReconcilePrs, checkLiveReviewStatus: ghCheckLiveReview, checkLiveBuildAndConflict: ghCheckLiveBuildAndConflict, isGhThrottled } = require('./engine/github');
5666
5666
  const { reconcileSharedBranchPrs } = require('./engine/shared-branch-pr-reconcile');
5667
5667
 
@@ -9770,7 +9770,7 @@ async function tickInner() {
9770
9770
  // Per-org throttle skip happens inside forEachActivePr (one log line per skipped project).
9771
9771
  // Top-level short-circuit: when every known ADO org is throttled, skip the whole phase
9772
9772
  // with one log line to avoid the per-project iteration cost.
9773
- const adoThrottleStates = getAdoThrottleStateAll() || {};
9773
+ const adoThrottleStates = getAdoThrottleState().perOrg || {};
9774
9774
  const adoOrgCount = Object.keys(adoThrottleStates).length;
9775
9775
  const allAdoThrottled = adoOrgCount > 0 && Object.values(adoThrottleStates).every(s => s && s.throttled);
9776
9776
  if (allAdoThrottled) {
@@ -9850,7 +9850,7 @@ async function tickInner() {
9850
9850
  // Per-org throttle skip happens inside forEachActivePr (one log line per skipped project).
9851
9851
  // Top-level short-circuit: when every known ADO org is throttled, skip the whole phase
9852
9852
  // with one log line to avoid the per-project iteration cost.
9853
- const adoThrottleStates = getAdoThrottleStateAll() || {};
9853
+ const adoThrottleStates = getAdoThrottleState().perOrg || {};
9854
9854
  const adoOrgCount = Object.keys(adoThrottleStates).length;
9855
9855
  const allAdoThrottled = adoOrgCount > 0 && Object.values(adoThrottleStates).every(s => s && s.throttled);
9856
9856
  if (allAdoThrottled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2298",
3
+ "version": "0.1.2299",
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"