From d33938d25ced97303bd48bae5d091251b9d9fbd7 Mon Sep 17 00:00:00 2001 From: Serge Alex Date: Sun, 1 Nov 2026 04:57:12 +0300 Subject: [PATCH] feat-indicator-blink-parse-exec-send-states --- content/content.js | 6 +++--- content/overlay.css | 2 +- content/panel.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/content/content.js b/content/content.js index 2a54551..395cfa1 100644 --- a/content/content.js +++ b/content/content.js @@ -179,7 +179,7 @@ processed.add(m); continue; } - var parsed = extractCalls(text, 3); + if (UI && UI.setDot) UI.setDot('busy'); var parsed = extractCalls(text, 3); if (!parsed) continue; if (!parsed.calls) continue; if (parsed.calls.length === 0) continue; @@ -188,7 +188,7 @@ rememberCallsHash(ch); processed.add(m); rememberHash(h); - for (k = 0; k < parsed.calls.length; k++) queue.push(parsed.calls[k]); + for (k = 0; k < parsed.calls.length; k++) queue.push(parsed.calls[k]); if (UI && UI.setDot) UI.setDot('ok-busy'); if (UI) UI.setPhase('executing'); } pump(); @@ -215,7 +215,7 @@ if (results.length > 0) { var payload = buildResultMessage(results); if (UI) UI.setPhase('sending'); - sendText(payload).then(function () { if (UI) UI.setPhase('idle'); }).catch(function (err) { console.warn('[dsh-memory] sendText failed', String(err)); if (UI) UI.setPhase('idle'); }); + var anyFail = results.some(function (r) { return !r || !r.ok; }); sendText(payload).then(function () { if (UI) { UI.setPhase('idle'); if (UI.setDot) UI.setDot(anyFail ? 'busy' : 'ok'); } }).catch(function (err) { console.warn('[dsh-memory] sendText failed', String(err)); if (UI) { UI.setPhase('idle'); if (UI.setDot) UI.setDot('busy'); } }); } else { if (UI) UI.setPhase('idle'); } return; } diff --git a/content/overlay.css b/content/overlay.css index 5d708fc..a643eb1 100644 --- a/content/overlay.css +++ b/content/overlay.css @@ -35,7 +35,7 @@ } .dshmem-dot.ok { background: #34c759; } .dshmem-dot.err { background: #ff5f57; } -.dshmem-dot.busy { background: #ffcc00; animation: dshmem-blink 1s infinite; } +.dshmem-dot.busy { background: #ffcc00; animation: dshmem-blink 1s infinite; } .dshmem-dot.ok-busy { background: #34c759; animation: dshmem-blink 1s infinite; } @keyframes dshmem-blink { 50% { opacity: 0.35; } } .dshmem-title { font-weight: 600; letter-spacing: 0.4px; } diff --git a/content/panel.js b/content/panel.js index 1f4e03c..da0aafa 100644 --- a/content/panel.js +++ b/content/panel.js @@ -7,7 +7,7 @@ connected: false, loopsLeft: 0, loopsMax: 0, dailyCount: 0, dailyMax: 0, - resetCbs: [], stopCbs: [], saveCbs: [], startCbs: [] + resetCbs: [], stopCbs: [], saveCbs: [], startCbs: [], dotMode: null }; var el = {}; function byId(id) { return document.getElementById(id); } @@ -74,7 +74,7 @@ } var API = { setPhase: function (p) { state.phase = p; if (el.phase) el.phase.textContent = p; }, - setConnected: function (b) { state.connected = !!b; if (el.dot) el.dot.className = 'dshmem-dot ' + (b ? 'ok' : 'err'); }, + setConnected: function (b) { state.connected = !!b; API._applyDot(); }, setDot: function (m) { state.dotMode = (m === 'ok') ? null : m; API._applyDot(); }, _applyDot: function () { if (!el.dot) return; var md = state.dotMode || (state.connected ? 'ok' : 'err'); var cls = 'dshmem-dot'; if (md === 'ok' || md === 'err' || md === 'busy' || md === 'ok-busy') cls += ' ' + md; el.dot.className = cls; }, setStartEnabled: function (b) { if (el.start) el.start.disabled = !b; }, setStats: function (ws, memN, skillN) { if (!el.stats) return; el.stats.textContent = 'WS: ' + (ws || '?') + ' mem: ' + (memN || 0) + ' skills: ' + (skillN || 0); }, setMetrics: function (m) { if (!el.metrics) return; if (!m) { el.metrics.textContent = 'metrics: —'; return; } el.metrics.textContent = 'acc: ' + m.accum + ' · turn: ' + m.delta + ' · msg: ' + m.chars + 'ch (~' + m.est_tok + 't) ctx ' + (m.ctx_tok || 0) + 't ' + (m.ctx_pct || 0) + 'pct'; }, log: function (m) { if (!el.log) return;