@ephemushroom/opencode-claude-mem 0.4.1 → 0.4.2

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 (2) hide show
  1. package/dist/tui.js +32 -7
  2. package/package.json +2 -2
package/dist/tui.js CHANGED
@@ -519,6 +519,17 @@ async function readMemView(project, collapsed) {
519
519
  recentObservations
520
520
  };
521
521
  }
522
+ async function loadSolidCore() {
523
+ try {
524
+ const mod = await import("solid-js");
525
+ if (typeof mod === "object" && mod !== null && typeof mod.createSignal === "function") {
526
+ return mod;
527
+ }
528
+ return null;
529
+ } catch {
530
+ return null;
531
+ }
532
+ }
522
533
  function materializeNode(node, solid) {
523
534
  const element = solid.createElement(node.kind);
524
535
  for (const [name, value] of Object.entries(node.props)) {
@@ -550,31 +561,45 @@ var tuiModule = {
550
561
  if (!solid) {
551
562
  return;
552
563
  }
564
+ const solidCore = await loadSolidCore();
565
+ const signal = (value) => {
566
+ if (solidCore) {
567
+ return solidCore.createSignal(value);
568
+ }
569
+ let current = value;
570
+ return [
571
+ () => current,
572
+ (next) => {
573
+ current = next;
574
+ }
575
+ ];
576
+ };
553
577
  const project = projectNameFromDirectory(String(api.state?.path?.directory ?? ""));
554
- let collapsed = true;
555
- let currentView = await readMemView(project, collapsed);
556
- let currentKey = viewKey(currentView);
578
+ const initialView = await readMemView(project, true);
579
+ const [collapsed, setCollapsed] = signal(true);
580
+ const [view, setView] = signal(initialView);
581
+ let currentKey = viewKey(initialView);
557
582
  let disposed = false;
558
583
  let inFlight = false;
559
584
  let timer = null;
560
585
  const refresh = async () => {
561
- const nextView = await readMemView(project, collapsed);
586
+ const nextView = await readMemView(project, collapsed());
562
587
  const nextKey = viewKey(nextView);
563
588
  if (nextKey !== currentKey) {
564
- currentView = nextView;
565
589
  currentKey = nextKey;
590
+ setView(nextView);
566
591
  api.renderer.requestRender();
567
592
  }
568
593
  };
569
594
  const onToggle = () => {
570
- collapsed = !collapsed;
595
+ setCollapsed(!collapsed());
571
596
  api.renderer.requestRender();
572
597
  refresh().catch(() => {});
573
598
  };
574
599
  api.slots.register({
575
600
  order: 910,
576
601
  slots: {
577
- sidebar_content: () => materialize(buildMemNodes(currentView, api.theme.current, collapsed, onToggle), solid)
602
+ sidebar_content: () => materialize(buildMemNodes(view(), api.theme.current, collapsed(), onToggle), solid)
578
603
  }
579
604
  });
580
605
  api.renderer.requestRender();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ephemushroom/opencode-claude-mem",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "OpenCode plugin for Claude-Mem persistent memory system",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  }
24
24
  },
25
25
  "scripts": {
26
- "build": "bun build src/index.ts --outfile dist/index.js --target bun --format esm && bun build src/tui.ts --outfile dist/tui.js --target bun --format esm --external @opentui/solid && tsc -p tsconfig.build.json --emitDeclarationOnly",
26
+ "build": "bun build src/index.ts --outfile dist/index.js --target bun --format esm && bun build src/tui.ts --outfile dist/tui.js --target bun --format esm --external @opentui/solid --external solid-js && tsc -p tsconfig.build.json --emitDeclarationOnly",
27
27
  "dev": "tsc --watch",
28
28
  "clean": "rm -rf dist",
29
29
  "lint": "oxlint",