@yemi33/minions 0.1.2031 → 0.1.2033

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.
@@ -121,12 +121,21 @@ function _formatCcDrawerLabel(autoMode) {
121
121
  }
122
122
 
123
123
  function _processStatusUpdate(data) {
124
- // Detect fresh install — clear stale browser state if install ID changed
124
+ // Detect fresh install — clear stale browser state AND reload so module-scoped
125
+ // JS caches (_sectionCache, _prevCounts, _kbRefreshCount, _managedProcessesLastItems,
126
+ // _pipelinePollHash, _meetingPollHash, etc.) reinitialise against the new install's
127
+ // data shape. localStorage.clear() alone leaves those caches stale after a
128
+ // MINIONS_HOME swap that doesn't restart the dashboard (F11 / W-mpgcijjo000ce878).
125
129
  if (data.installId) {
126
130
  const prev = localStorage.getItem('minions-install-id');
127
131
  if (prev && prev !== data.installId) {
128
132
  localStorage.clear();
129
- console.log('Minions: fresh install detected, cleared browser state');
133
+ // Write the new install-id BEFORE reload the post-reload poll must see
134
+ // a matching id so it stops looping. clear() above wiped it, so set it again.
135
+ localStorage.setItem('minions-install-id', data.installId);
136
+ console.log('Minions: fresh install detected, reloading to reset module caches');
137
+ location.reload();
138
+ return;
130
139
  }
131
140
  localStorage.setItem('minions-install-id', data.installId);
132
141
  }
@@ -145,17 +154,35 @@ function _processStatusUpdate(data) {
145
154
  const threshEl = document.getElementById('inbox-threshold');
146
155
  if (threshEl && data.autoMode?.inboxThreshold) threshEl.textContent = data.autoMode.inboxThreshold;
147
156
 
148
- // Publish window._last* snapshots BEFORE any renderer runs. Several renderers
149
- // (renderProjects, renderPrd, renderPrs, refreshPlans, and others) read
150
- // window._lastStatus / window._lastWorkItems / window._lastDispatch during
151
- // their render path. If we assign these after the renderer calls, every tick
152
- // consumes the PREVIOUS tick's globals a one-tick (~4 s) staleness lag
153
- // baked into the polling loop (W-mpgb0x81000cf8df, audit F4). No renderer in
154
- // this function mutates `data`, so hoisting is safe.
157
+ // Publish window._last* snapshots BEFORE any renderer runs. Several
158
+ // renderers (renderPrd, renderPrs, derivePlanStatus inside refreshPlans,
159
+ // and the projectChipRemove/optimisticallyAddProject paths off
160
+ // renderProjects) read window._lastStatus / window._lastWorkItems /
161
+ // window._lastDispatch synchronously during their render path. When the
162
+ // assignments lived AFTER the renderer calls (the pre-fix layout in
163
+ // refresh.js:106-108), every tick consumed the PREVIOUS tick's globals —
164
+ // a one-tick (~4 s) staleness lag baked into the polling loop on top of
165
+ // the natural poll interval.
166
+ //
167
+ // See dashboard-refresh-audit.md finding F4 (W-mpgb0x81000cf8df / PR #2753
168
+ // landed the initial hoist; W-mpgbzpn9000390ae extends it with the
169
+ // render-agents / render-work-items invariants below). No renderer below
170
+ // mutates `data`, so hoisting the publish is safe; the renderers
171
+ // themselves still take their slice as a direct argument.
172
+ //
173
+ // Locking-in note (W-mpgbzpn9000390ae): renderAgents
174
+ // (render-agents.js:38) and renderWorkItems (render-work-items.js:98) —
175
+ // the two surfaces the user explicitly called out on /home and /work —
176
+ // take their data slice via argument and DO NOT read window._last*.
177
+ // Hoisting the publish here additionally guarantees that any future
178
+ // refactor that adds a window._last* read to those renderers will see
179
+ // fresh data on the same tick, not the previous one. Covered by
180
+ // dashboard-resilience.test.js source-inspection assertions.
155
181
  window._lastDispatch = data.dispatch;
156
182
  window._lastWorkItems = data.workItems || [];
157
183
  window._lastStatus = data;
158
184
 
185
+
159
186
  // Render only changed sections
160
187
  if (_changed('agents', data.agents)) { renderAgents(data.agents); cmdUpdateAgentList(data.agents); }
161
188
  if (_changed('prdProgress', data.prdProgress) || _changed('prdPrs', data.pullRequests?.length)) { renderPrdProgress(data.prdProgress); _cachePrdItems(data.prdProgress); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2031",
3
+ "version": "0.1.2033",
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"