dsh-talk-map 0.1.92 → 0.1.94

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.
package/client/client.js CHANGED
@@ -498,7 +498,7 @@ var zh = {
498
498
  "digest.empty": "这条对话还没有摘要,先刷新摘要再来看。",
499
499
  "digest.copy": "复制",
500
500
  "digest.close": "关闭",
501
- "global.searchPlaceholder": "b92 · 搜地图上的卡片(标题/正文)",
501
+ "global.searchPlaceholder": "b94 · 搜地图上的卡片(标题/正文)",
502
502
  "global.searchRun": "搜索",
503
503
  "global.searchTitle": "搜索地图",
504
504
  "font.group": "文字大小",
@@ -691,7 +691,7 @@ var en = {
691
691
  "menu.noGroup": "Remove from group (free card)",
692
692
  "menu.open": "Open conversation",
693
693
  "menu.markUnread": "Mark as unread",
694
- "global.searchPlaceholder": "b92 · Search cards on the map",
694
+ "global.searchPlaceholder": "b94 · Search cards on the map",
695
695
  "global.searchRun": "Search",
696
696
  "global.searchTitle": "Search the map",
697
697
  "font.group": "Text size",
@@ -14156,7 +14156,8 @@ function StatusRail(props) {
14156
14156
  entry.preview !== void 0 && entry.preview !== "" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: talk_map_default["cardSummary"], children: entry.preview }) : null,
14157
14157
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: talk_map_default["cardFooter"], children: [
14158
14158
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: talk_map_default["cardTime"], children: relativeTime(entry.updatedAt) }),
14159
- entry.lamp === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default["cardChipDraft"]}`, children: t("card.draft") }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default[LAMP_CHIP[entry.lamp].className]}`, children: [
14159
+ entry.draft === true ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default["cardChipDraft"]}`, children: t("card.draft") }) : null,
14160
+ entry.lamp === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default[LAMP_CHIP[entry.lamp].className]}`, children: [
14160
14161
  LAMP_CHIP[entry.lamp].dot ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: talk_map_default["runningDot"] }) : null,
14161
14162
  t(LAMP_CHIP[entry.lamp].key)
14162
14163
  ] })
@@ -14903,6 +14904,8 @@ function CanvasInner(props) {
14903
14904
  sessionId: card.sessionId,
14904
14905
  title: renamedTitles[card.sessionId] ?? summary?.displayTitle ?? card.sessionId,
14905
14906
  lamp,
14907
+ // A lamped card can still hold unsent text: the footer shows both chips.
14908
+ ...(draftTexts[card.sessionId] ?? "").trim() !== "" ? { draft: true } : {},
14906
14909
  stamp: summary?.updatedAt ?? 0,
14907
14910
  ...summary?.updatedAt !== void 0 ? { updatedAt: summary.updatedAt } : {},
14908
14911
  ...previews[card.sessionId] !== void 0 ? { preview: previews[card.sessionId] } : {},
@@ -16625,6 +16628,7 @@ function SidebarQueue() {
16625
16628
  sessionId,
16626
16629
  title: summary.displayTitle ?? sessionId,
16627
16630
  ...draftOnly ? { draft: true } : { lamp },
16631
+ ...hasDraft ? { draft: true } : {},
16628
16632
  ...draftText !== void 0 ? { draftText } : {},
16629
16633
  ...summary.updatedAt !== void 0 ? { updatedAt: summary.updatedAt } : {}
16630
16634
  });
@@ -16729,9 +16733,10 @@ function SidebarQueue() {
16729
16733
  body !== void 0 && body.trim() !== "" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: talk_map_default["cardSummary"], children: body }) : null,
16730
16734
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: talk_map_default["cardFooter"], children: [
16731
16735
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: talk_map_default["cardTime"], children: relativeTime(row.updatedAt) }),
16732
- chip === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default["cardChipDraft"]}`, children: t("card.draft") }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default[chip.className]}`, children: [
16733
- chip.dot === true ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: talk_map_default["runningDot"] }) : null,
16734
- t(chip.key)
16736
+ row.draft === true ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default["cardChipDraft"]}`, children: t("card.draft") }) : null,
16737
+ row.lamp === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: `${talk_map_default["cardChip"]} ${talk_map_default[LAMP_CHIP[row.lamp].className]}`, children: [
16738
+ LAMP_CHIP[row.lamp].dot ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: talk_map_default["runningDot"] }) : null,
16739
+ t(LAMP_CHIP[row.lamp].key)
16735
16740
  ] })
16736
16741
  ] })
16737
16742
  ]
package/lib/index.js CHANGED
@@ -507,6 +507,34 @@ const TALK_MAP_SPEC = {
507
507
  digests: { valueSchema: digestSchema }
508
508
  }
509
509
  };
510
+ /**
511
+ * Drop digests that no longer have a card, then keep at most `cap` of the rest (oldest
512
+ * out). Digests are keyed by session id, so a card is what makes one reachable.
513
+ */
514
+ async function pruneDigests(store, cap = 400) {
515
+ const cardSessions = /* @__PURE__ */ new Set();
516
+ for (const [, card] of store.cards.entries()) cardSessions.add(card.sessionId);
517
+ const orphans = [];
518
+ const reachable = [];
519
+ for (const [key, digest] of store.digests.entries()) if (!cardSessions.has(key)) orphans.push(key);
520
+ else reachable.push({
521
+ key,
522
+ at: digest.generatedAt ?? 0
523
+ });
524
+ const overflow = [];
525
+ if (reachable.length > cap) {
526
+ reachable.sort((a, b) => a.at - b.at);
527
+ for (const row of reachable.slice(0, reachable.length - cap)) overflow.push(row.key);
528
+ }
529
+ for (const key of [...orphans, ...overflow]) try {
530
+ await store.digests.delete(key);
531
+ } catch {}
532
+ return {
533
+ orphans: orphans.length,
534
+ overflow: overflow.length,
535
+ kept: Math.min(reachable.length, cap)
536
+ };
537
+ }
510
538
  async function openTalkMapStore(storageDomain) {
511
539
  const domain = await storageDomain.open(TALK_MAP_SPEC);
512
540
  const store = {
@@ -1035,6 +1063,11 @@ function apply(ctx) {
1035
1063
  store = opened;
1036
1064
  resolveStore(opened);
1037
1065
  services.logger?.info?.("[dsh-talk-map] storage domain open, routes live at /talk-map/");
1066
+ pruneDigests(opened).then((result) => {
1067
+ if (result.orphans + result.overflow > 0) services.logger?.info?.(`[dsh-talk-map] pruned ${result.orphans} orphaned + ${result.overflow} over-cap digests, ${result.kept} kept`);
1068
+ }).catch((error) => {
1069
+ services.logger?.warn?.(`[dsh-talk-map] digest prune failed: ${String(error)}`);
1070
+ });
1038
1071
  }).catch((error) => {
1039
1072
  services.logger?.warn(`[dsh-talk-map] storage domain failed to open: ${String(error)}`);
1040
1073
  rejectStore(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.92",
3
+ "version": "0.1.94",
4
4
  "description": "Visual conversation map for DeepSeek Harness: an infinite whiteboard where every session is a card — drag to arrange, double-click to start a chat in place, draw an edge to fork a new session with injected context. Built for ADHD-friendly spatial memory. · DSH 可视化对话地图:会话即卡片,双击即聊,连线分叉带上下文的新对话。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",