@codemem/server 0.33.0 → 0.34.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.
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/routes/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,WAAW,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAmN5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,WAAW,8EA0HtD"}
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/routes/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGN,KAAK,WAAW,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAsR5B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,WAAW,8EAqItD"}
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/routes/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAKX,WAAW,EAIX,MAAM,eAAe,CAAC;AAuFvB,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AACtC,KAAK,iBAAiB,GAAG;IACxB,KAAK,EACF,UAAU,GACV,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,IAAI,CAAC;IACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAoBF,UAAU,wBAAwB;IACjC,cAAc,CAAC,EAAE;QAChB,OAAO,EAAE,0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UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,8EAkrErD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemem/server",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  "drizzle-orm": "^0.45.2",
20
20
  "hono": "^4.12.21",
21
21
  "limiter": "^3.0.0",
22
- "@codemem/core": "^0.33.0"
22
+ "@codemem/core": "^0.34.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/better-sqlite3": "^7.6.13",
package/static/app.js CHANGED
@@ -3146,11 +3146,11 @@
3146
3146
  const controller = new AbortController();
3147
3147
  const timeoutId = window.setTimeout(() => controller.abort(), timeoutMs);
3148
3148
  try {
3149
- const resp = await fetch("/api/stats", {
3149
+ const resp = await fetch("/api/runtime", {
3150
3150
  cache: "no-store",
3151
3151
  signal: controller.signal
3152
3152
  });
3153
- if (!resp.ok) throw new Error(`/api/stats: ${resp.status} ${resp.statusText}`);
3153
+ if (!resp.ok) throw new Error(`/api/runtime: ${resp.status} ${resp.statusText}`);
3154
3154
  } finally {
3155
3155
  window.clearTimeout(timeoutId);
3156
3156
  }
@@ -10374,7 +10374,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10374
10374
  if (!scopeId) return;
10375
10375
  if (!await openSyncConfirmDialog({
10376
10376
  title: spaceRevokeMemberTitle(scope, displayName, deviceId),
10377
- description: "Revocation only blocks future sync for this Space. Data already copied to that device can remain there.",
10377
+ description: "Revocation blocks future sync for this Space. It does not remove data already copied to the revoked device; offline devices, backups, copied databases, malicious peers, or old versions may retain data.",
10378
10378
  confirmLabel: "Revoke membership",
10379
10379
  cancelLabel: "Keep membership",
10380
10380
  tone: "danger"
@@ -18732,6 +18732,24 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18732
18732
  }
18733
18733
  //#endregion
18734
18734
  //#region src/tabs/sync/diagnostics/render/sync-status.ts
18735
+ function numeric(value) {
18736
+ const parsed = Number(value ?? 0);
18737
+ return Number.isFinite(parsed) ? parsed : 0;
18738
+ }
18739
+ function cleanupDiagnosticLabel(cleanup) {
18740
+ const state = String(cleanup?.state ?? "clear");
18741
+ const stale = cleanup?.stale_peer_rows ?? {};
18742
+ const ops = cleanup?.access_cleanup_ops ?? {};
18743
+ const wouldRemove = numeric(stale.would_remove);
18744
+ const ambiguous = numeric(stale.ambiguous);
18745
+ const applied = numeric(ops.applied);
18746
+ const sourceAuthored = numeric(ops.source_authored);
18747
+ if (state === "cleanup_pending" || wouldRemove > 0) return `${wouldRemove} pending removal`;
18748
+ if (state === "needs_review" || ambiguous > 0) return `${ambiguous} needs review`;
18749
+ if (state === "cleanup_applied" || applied > 0) return `${applied} applied`;
18750
+ if (state === "cleanup_announced" || sourceAuthored > 0) return `${sourceAuthored} announced`;
18751
+ return "Clear";
18752
+ }
18735
18753
  function renderSyncStatus() {
18736
18754
  const syncStatusGrid = document.getElementById("syncStatusGrid");
18737
18755
  const syncMeta = document.getElementById("syncMeta");
@@ -18756,6 +18774,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18756
18774
  const daemonDetail = String(status.daemon_detail || "");
18757
18775
  const daemonState = String(status.daemon_state || "unknown");
18758
18776
  const retention = status.retention || {};
18777
+ const cleanup = status.cleanup_diagnostics;
18778
+ const cleanupStale = cleanup?.stale_peer_rows ?? {};
18779
+ const cleanupWouldRemove = numeric(cleanupStale.would_remove);
18780
+ const cleanupAmbiguous = numeric(cleanupStale.ambiguous);
18759
18781
  const retentionEnabled = retention.enabled === true;
18760
18782
  const retentionDeleted = Number(retention.last_deleted_ops || 0);
18761
18783
  const retentionLastRunAt = retention.last_run_at || null;
@@ -18774,6 +18796,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18774
18796
  if (daemonDetail && daemonState === "stopped") parts.push(`Detail: ${daemonDetail}`);
18775
18797
  if (daemonDetail && (daemonState === "needs_attention" || daemonState === "rebootstrapping")) parts.push(`Detail: ${daemonDetail}`);
18776
18798
  if (retentionEnabled) parts.push(retentionLastRunAt ? `Retention last ran ${formatAgeShort(secondsSince(retentionLastRunAt))} ago (approx oldest-first)` : "Retention enabled");
18799
+ if (cleanupWouldRemove > 0) parts.push(`${cleanupWouldRemove.toLocaleString()} stale peer rows pending cleanup`);
18800
+ else if (cleanupAmbiguous > 0) parts.push(`${cleanupAmbiguous.toLocaleString()} stale peer rows retained because safe cleanup could not be proven`);
18777
18801
  syncMeta.textContent = parts.join(" · ");
18778
18802
  }
18779
18803
  const items = syncDisabled ? [
@@ -18848,6 +18872,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18848
18872
  label: retentionLastError,
18849
18873
  value: "Retention"
18850
18874
  });
18875
+ if (!syncDisabled && !syncNoPeers && cleanup) items.push({
18876
+ label: "Cleanup",
18877
+ value: cleanupDiagnosticLabel(cleanup)
18878
+ });
18851
18879
  renderDiagnosticsGrid(syncStatusGrid, items);
18852
18880
  const actions = [];
18853
18881
  if (syncNoPeers) {} else if (daemonState === "offline-peers") {} else if (daemonState === "stopped") {
@@ -18880,6 +18908,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18880
18908
  label: "Pending sync work detected. Run one pass now.",
18881
18909
  command: "codemem sync once"
18882
18910
  });
18911
+ if (!syncDisabled && cleanupAmbiguous > 0) actions.push({
18912
+ label: "Some stale peer rows were retained because cleanup was ambiguous.",
18913
+ command: "codemem sync doctor"
18914
+ });
18915
+ else if (!syncDisabled && cleanupWouldRemove > 0) actions.push({
18916
+ label: "Stale peer rows are eligible for cleanup. Run one sync pass now.",
18917
+ command: "codemem sync once"
18918
+ });
18883
18919
  renderActionList(syncActions, actions);
18884
18920
  }
18885
18921
  //#endregion
@@ -21469,7 +21505,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
21469
21505
  }),
21470
21506
  /* @__PURE__ */ u("div", {
21471
21507
  className: "peer-meta legacy-review-warning",
21472
- children: "Nothing moves automatically. Reassignment changes future sync authorization; it does not erase copies peers already received."
21508
+ children: "Fix peer-owned projects on their source device. Reassignment updates future sync authorization; online compatible peers should converge after syncing, but offline devices, backups, copied databases, malicious peers, or old versions may retain old copies."
21473
21509
  })
21474
21510
  ] }), /* @__PURE__ */ u("div", {
21475
21511
  className: "actor-actions",
@@ -21570,7 +21606,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
21570
21606
  }),
21571
21607
  !canReassignLegacyGroup(group) ? /* @__PURE__ */ u("div", {
21572
21608
  className: "legacy-review-cleanup-note",
21573
- children: "Peer-owned only. These older memories were received from another device, so this device cannot reassign them to a Space."
21609
+ children: "Peer-owned only. These older memories were received from another device, so this device cannot reassign them to a Space. Assign this project to a Space on the source device; after sync, this review should clear here."
21574
21610
  }) : group.peerOwnedMemoryCount ? /* @__PURE__ */ u("div", {
21575
21611
  className: "legacy-review-cleanup-note",
21576
21612
  children: [
@@ -21960,7 +21996,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
21960
21996
  try {
21961
21997
  const runtime = await loadRuntimeInfo();
21962
21998
  if (!runtime?.version) return;
21963
- setRuntimeLabel(runtime.version, "c329fa8");
21999
+ setRuntimeLabel(runtime.version, "36573e4");
21964
22000
  } catch {}
21965
22001
  }
21966
22002
  var lastAnnouncedRefreshState = null;