@yemi33/minions 0.1.1995 → 0.1.1997

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.
@@ -150,9 +150,31 @@ function _processStatusUpdate(data) {
150
150
  }
151
151
 
152
152
  let _knownDashboardStartId = null;
153
+ // /api/status ETag cache (W-mpehsyhv0017085a). The dashboard polls every 4 s
154
+ // but the server-side cache only changes every 10–60 s. Sending If-None-Match
155
+ // lets the server short-circuit ~60 %+ of polls into a 304 with no body —
156
+ // drops the 7.7 MB JSON.stringify + gzipSync off the dashboard event loop on
157
+ // the hot path. Falls back to the cached payload on 304; transparent to all
158
+ // downstream consumers of `data`.
159
+ let _lastStatusEtag = null;
160
+ let _lastStatusData = null;
153
161
  async function refresh() {
154
162
  try {
155
- const data = await safeFetch('/api/status').then(r => r.json());
163
+ const headers = {};
164
+ if (_lastStatusEtag) headers['If-None-Match'] = _lastStatusEtag;
165
+ const res = await safeFetch('/api/status', { headers });
166
+ let data;
167
+ if (res.status === 304 && _lastStatusData) {
168
+ // Cache hit — reuse last payload, skip parsing entirely.
169
+ data = _lastStatusData;
170
+ } else {
171
+ data = await res.json();
172
+ const etag = res.headers && (res.headers.get ? res.headers.get('etag') : null);
173
+ if (etag) {
174
+ _lastStatusEtag = etag;
175
+ _lastStatusData = data;
176
+ }
177
+ }
156
178
  // Auto-reload when dashboard restarts (stale connections cause "Failed to fetch" on CC/doc-chat)
157
179
  const dashId = (data.version && data.version.dashboardStartedAt) || null;
158
180
  if (dashId && _knownDashboardStartId && dashId !== _knownDashboardStartId) {
@@ -87,6 +87,7 @@ async function openSettings() {
87
87
  settingsField('Shutdown Timeout', 'set-shutdownTimeout', e.shutdownTimeout || 300000, 'ms', 'Max wait for agents during graceful shutdown') +
88
88
  settingsField('Restart Grace Period', 'set-restartGracePeriod', e.restartGracePeriod || 1200000, 'ms', 'Grace period before orphan detection on restart') +
89
89
  settingsField('Meeting Round Timeout', 'set-meetingRoundTimeout', e.meetingRoundTimeout || 900000, 'ms', 'Auto-advance meeting round after this') +
90
+ settingsField('Operator login (used in branch names)', 'set-operatorLogin', e.operatorLogin || '', '', 'Override the human operator login used in user/<loginname>/<wi-id>-<slug> branches. Empty = auto-resolve via gh / git email / OS username (currently resolves to: ' + (e._resolvedOperatorLogin || 'unknown') + ')') +
90
91
  '</div>' +
91
92
  '<h3 style="font-size:13px;color:var(--blue);margin-bottom:8px">Automation</h3>' +
92
93
  '<div style="display:flex;flex-direction:column;gap:6px;margin-bottom:16px">' +
@@ -564,6 +565,7 @@ async function saveSettings() {
564
565
  shutdownTimeout: document.getElementById('set-shutdownTimeout').value,
565
566
  restartGracePeriod: document.getElementById('set-restartGracePeriod').value,
566
567
  meetingRoundTimeout: document.getElementById('set-meetingRoundTimeout').value,
568
+ operatorLogin: (document.getElementById('set-operatorLogin')?.value ?? '').trim(),
567
569
  autoApprovePlans: document.getElementById('set-autoApprovePlans').checked,
568
570
  evalLoop: document.getElementById('set-evalLoop').checked,
569
571
  autoDecompose: document.getElementById('set-autoDecompose').checked,