diff --git a/content/content.js b/content/content.js index 9aaa4b5..af484f4 100644 --- a/content/content.js +++ b/content/content.js @@ -15,7 +15,7 @@ var CALL_HASH_CAP = 100; if (UI) { UI.onResetLoops(function () { queue.length = 0; pending.clear(); seenHashes.clear(); pumping = false; if (UI) UI.log('loops reset'); }); - UI.onStop(function () { queue.length = 0; if (UI) UI.log('stopped'); }); + UI.onStop(function () { queue.length = 0; started = false; try { obs.disconnect(); } catch (e) {} if (UI) { UI.setPhase('off'); UI.setStartEnabled(true); UI.log('stopped'); } }); UI.onSaveToken(function (v) { chrome.storage.local.set({ 'dshmem-bridge-token': v }, function () { if (UI) UI.log('token saved, reload page'); }); }); } if (UI) { UI.onStart(function () { if (!canStart) { if (UI.setStartEnabled) UI.setStartEnabled(true); return; } started = true; markExistingAsProcessed(); obs.observe(document.documentElement, { childList: true, subtree: true, characterData: true }); UI.setPhase('idle'); UI.setConnected(true); UI.log('started'); }); } @@ -292,7 +292,7 @@ characterData: true }); console.log("[dsh-memory] content.js active"); - if (UI) { UI.setPhase('idle'); UI.setConnected(true); canStart = true; UI.log('active'); } __refreshStats(); + if (UI) { UI.setPhase('off'); UI.setConnected(true); canStart = true; UI.log('ready, press Start'); } __refreshStats(); }); }); function __refreshStats() { try { var SB = globalThis.STORAGE_BRIDGE; if (!SB || !UI || !UI.setStats) return; SB.getState().then(function (st) { var mN = st && st.memories ? Object.keys(st.memories).length : 0; var sN = st && st.skills && st.skills.length ? st.skills.length : 0; return SB.authHeaders().then(function (h) { return fetch(SB.BU + '/health', { headers: h }); }).then(function (r) { return r.json(); }).then(function (j) { UI.setStats((j && j.workspace) || '?', mN, sN); }); }).catch(function () { UI.setStats('?', 0, 0); }); } catch (e) { console.warn('[dsh-memory] stats ' + String(e)); } } diff --git a/content/panel.js b/content/panel.js index 2af2898..23bf878 100644 --- a/content/panel.js +++ b/content/panel.js @@ -67,7 +67,7 @@ el.save.addEventListener('click', function () { var v = el.token.value || ''; state.saveCbs.forEach(function (cb) { try { cb(v); } catch (e) {} }); }); el.health.addEventListener('click', function () { try { globalThis.DSH_BRIDGE.health().then(function (r) { - if (r && r.ok) { API.setConnected(true); API.setPhase('Ready'); API.log('health ok'); } + if (r && r.ok) { API.setConnected(true); API.log('health ok, bridge up'); } else { API.setConnected(false); API.log('health fail: ' + ((r && r.error && r.error.message) || '?')); } }); } catch (e) { API.log('health throw: ' + String(e)); } }); diff --git a/memory/state.json b/memory/state.json index 6fd6d58..5a45ac2 100644 --- a/memory/state.json +++ b/memory/state.json @@ -1,6 +1,6 @@ { "version": 1, - "updatedAt": "2026-10-31T22:42:50.200Z", + "updatedAt": "2026-10-31T23:00:28.584Z", "memories": {}, "skills": [] } \ No newline at end of file