memindex 1.3.0 → 1.4.0

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.
Files changed (43) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.qoder-plugin/plugin.json +1 -1
  5. package/README.md +84 -41
  6. package/dist/bug-report/index.js +55 -55
  7. package/dist/npx-cli/index.js +392 -323
  8. package/dist/opencode-plugin/index.js +34 -34
  9. package/dist/pi-extension/index.js +6 -6
  10. package/integrations/dsh/lib/index.js +24 -24
  11. package/integrations/dsh/package.json +1 -1
  12. package/integrations/hermes/memindex/client.py +11 -6
  13. package/integrations/omp/hooks/memindex.ts +5 -1
  14. package/integrations/openclaw/TESTING.md +1 -1
  15. package/integrations/openclaw/dist/index.js +9 -9
  16. package/integrations/openclaw/e2e-verify.sh +8 -1
  17. package/integrations/openclaw/openclaw.plugin.json +1 -1
  18. package/integrations/openclaw/src/index.test.ts +3 -1
  19. package/integrations/openclaw/src/index.ts +15 -5
  20. package/package.json +1 -1
  21. package/plugin/.claude-plugin/plugin.json +1 -1
  22. package/plugin/.codex-plugin/plugin.json +1 -1
  23. package/plugin/.qoder-plugin/plugin.json +1 -1
  24. package/plugin/hooks.json +1 -13
  25. package/plugin/package.json +1 -1
  26. package/plugin/scripts/context-generator.cjs +48 -47
  27. package/plugin/scripts/context-generator.cjs.map +3 -3
  28. package/plugin/scripts/mcp-server.cjs +77 -77
  29. package/plugin/scripts/mcp-server.cjs.map +2 -2
  30. package/plugin/scripts/statusline.cjs +1 -0
  31. package/plugin/scripts/transcript-watcher.cjs +34 -34
  32. package/plugin/scripts/transcript-watcher.cjs.map +3 -3
  33. package/plugin/scripts/worker-service.cjs +561 -550
  34. package/plugin/scripts/worker-service.cjs.map +3 -3
  35. package/plugin/skills/cloud-sync/SKILL.md +5 -2
  36. package/plugin/skills/mode-creator/SKILL.md +1 -1
  37. package/plugin/skills/timeline-report/SKILL.md +8 -5
  38. package/plugin/skills/weekly-digests/SKILL.md +5 -2
  39. package/plugin/sqlite/SessionStore.js +93 -93
  40. package/plugin/sqlite/SessionStore.js.map +2 -2
  41. package/plugin/ui/tv.html +55 -28
  42. package/plugin/ui/viewer-bundle.js +22 -15
  43. package/plugin/ui/viewer.html +72 -0
package/plugin/ui/tv.html CHANGED
@@ -152,6 +152,13 @@
152
152
  // Shared secret for remote (non-loopback) access. Loopback never needs it.
153
153
  // Held by the bookmark only — deliberately never stored and never logged.
154
154
  const TOKEN = params.get('token') || '';
155
+ // On this machine the page is opened from MemIndex with the install secret in the link's
156
+ // fragment (never sent to a server). The worker wants it on every read.
157
+ const SECRET = (() => {
158
+ const found = new URLSearchParams(location.hash.slice(1)).get('worker-secret') || '';
159
+ return /^[a-f0-9]{64}$/.test(found) ? found : '';
160
+ })();
161
+ const READ_HEADERS = SECRET ? { 'X-Memindex-Secret': SECRET } : {};
155
162
 
156
163
  const els = {
157
164
  stage: document.getElementById('stage'),
@@ -297,7 +304,7 @@
297
304
  if (source) qs.set('platformSource', source);
298
305
  if (TOKEN) qs.set('token', TOKEN);
299
306
  try {
300
- const res = await fetch('/api/observations?' + qs.toString(), { cache: 'no-store' });
307
+ const res = await fetch('/api/observations?' + qs.toString(), { cache: 'no-store', headers: READ_HEADERS });
301
308
  if (!res.ok) return;
302
309
  const body = await res.json();
303
310
  // The API returns newest first; the TV plays oldest first so the backlog
@@ -308,34 +315,54 @@
308
315
  }
309
316
  }
310
317
 
311
- function connect() {
312
- // EventSource cannot set request headers, so a remote stream carries the
313
- // token in the query string.
314
- const es = new EventSource('/stream' + (TOKEN ? '?token=' + encodeURIComponent(TOKEN) : ''));
315
-
316
- es.onopen = () => els.dot.classList.add('live');
317
-
318
- es.onerror = () => {
319
- els.dot.classList.remove('live');
320
- es.close();
321
- setTimeout(connect, 3000);
322
- };
323
-
324
- es.onmessage = (event) => {
325
- let data;
326
- try {
327
- data = JSON.parse(event.data);
328
- } catch {
329
- return;
318
+ function handleStreamMessage(text) {
319
+ let data;
320
+ try {
321
+ data = JSON.parse(text);
322
+ } catch {
323
+ return;
324
+ }
325
+ if (data.type !== 'new_observation' || !data.observation) return;
326
+ if (!matchesFilter(data.observation)) return;
327
+ const item = normalize(data.observation);
328
+ if (!item) return;
329
+ live.push(item);
330
+ replay.push(item);
331
+ if (replay.length > 100) replay.shift();
332
+ }
333
+
334
+ // EventSource cannot send the install secret header, so the stream is read with fetch.
335
+ // A remote stream carries its token in the query string instead.
336
+ async function connect() {
337
+ try {
338
+ const res = await fetch('/stream' + (TOKEN ? '?token=' + encodeURIComponent(TOKEN) : ''), {
339
+ headers: { Accept: 'text/event-stream', ...READ_HEADERS },
340
+ });
341
+ if (!res.ok || !res.body) throw new Error('stream ' + res.status);
342
+ els.dot.classList.add('live');
343
+ const reader = res.body.getReader();
344
+ const decoder = new TextDecoder();
345
+ let buffer = '';
346
+ for (;;) {
347
+ const { done, value } = await reader.read();
348
+ if (done) break;
349
+ buffer += decoder.decode(value, { stream: true }).replace(/\r\n?/g, '\n');
350
+ let end = buffer.indexOf('\n\n');
351
+ while (end !== -1) {
352
+ const text = buffer.slice(0, end).split('\n')
353
+ .filter(line => line.startsWith('data:'))
354
+ .map(line => line.slice(5).replace(/^ /, ''))
355
+ .join('\n');
356
+ buffer = buffer.slice(end + 2);
357
+ if (text) handleStreamMessage(text);
358
+ end = buffer.indexOf('\n\n');
359
+ }
330
360
  }
331
- if (data.type !== 'new_observation' || !data.observation) return;
332
- if (!matchesFilter(data.observation)) return;
333
- const item = normalize(data.observation);
334
- if (!item) return;
335
- live.push(item);
336
- replay.push(item);
337
- if (replay.length > 100) replay.shift();
338
- };
361
+ } catch {
362
+ // Fall through to the reconnect below.
363
+ }
364
+ els.dot.classList.remove('live');
365
+ setTimeout(connect, 3000);
339
366
  }
340
367
 
341
368
  /* Picture-in-picture, two routes and no library. Document PiP (Chromium)