dsh-talk-map 0.1.91 → 0.1.93

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": "b91 · 搜地图上的卡片(标题/正文)",
501
+ "global.searchPlaceholder": "b93 · 搜地图上的卡片(标题/正文)",
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": "b91 · Search cards on the map",
694
+ "global.searchPlaceholder": "b93 · Search cards on the map",
695
695
  "global.searchRun": "Search",
696
696
  "global.searchTitle": "Search the map",
697
697
  "font.group": "Text size",
@@ -16532,6 +16532,17 @@ function SidebarQueue() {
16532
16532
  statusStore === void 0 ? NO_SUBSCRIBE : (listener) => statusStore.subscribe(listener),
16533
16533
  statusStore === void 0 ? emptyStatus : () => statusStore.getSnapshot()
16534
16534
  );
16535
+ const workspaceStore = services2?.workspaces;
16536
+ const EMPTY_WORKSPACES = {};
16537
+ const emptyWorkspaces = () => EMPTY_WORKSPACES;
16538
+ const workspaceState = (0, import_react18.useSyncExternalStore)(
16539
+ workspaceStore?.subscribe === void 0 ? NO_SUBSCRIBE : (listener) => workspaceStore.subscribe(listener),
16540
+ workspaceStore?.getSnapshot === void 0 ? emptyWorkspaces : () => workspaceStore.getSnapshot()
16541
+ );
16542
+ const archivedSessionIds = (0, import_react18.useMemo)(
16543
+ () => new Set(workspaceState.archivedSessionIds ?? []),
16544
+ [workspaceState]
16545
+ );
16535
16546
  const alerts2 = (0, import_react18.useSyncExternalStore)(sessionAlerts.subscribe, sessionAlerts.getSnapshot);
16536
16547
  const finished2 = (0, import_react18.useSyncExternalStore)(sessionActivity.subscribe, sessionActivity.getSnapshot);
16537
16548
  const locale = (0, import_react18.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
@@ -16592,27 +16603,34 @@ function SidebarQueue() {
16592
16603
  });
16593
16604
  }, [opened, sessions, statusById, alerts2, finished2]);
16594
16605
  const rows = (0, import_react18.useMemo)(() => {
16595
- const out = [];
16606
+ const cardBySession = /* @__PURE__ */ new Map();
16596
16607
  for (const [cardId, card] of Object.entries(canvasState.cards)) {
16597
- if (card.boardId !== INBOX_BOARD_ID) continue;
16598
- const summary = sessions.byId[card.sessionId];
16599
- const lamp = lampOf(card.sessionId, statusById.get(card.sessionId), summary, alerts2, finished2);
16600
- const draftText = drafts[card.sessionId];
16608
+ if (card.boardId === INBOX_BOARD_ID) cardBySession.set(card.sessionId, cardId);
16609
+ }
16610
+ const out = [];
16611
+ for (const sessionId of sessions.ids) {
16612
+ const summary = sessions.byId[sessionId];
16613
+ if (summary === void 0) continue;
16614
+ if (summary.blank === true) continue;
16615
+ if (summary.origin === "subagent") continue;
16616
+ if (archivedSessionIds.has(sessionId)) continue;
16617
+ const lamp = lampOf(sessionId, statusById.get(sessionId), summary, alerts2, finished2);
16618
+ const draftText = drafts[sessionId];
16601
16619
  const hasDraft = draftText !== void 0 && draftText.trim() !== "";
16602
16620
  if (lamp === void 0 && !hasDraft) continue;
16603
- if (lamp === "done" && opened.has(card.sessionId)) continue;
16621
+ if (lamp === "done" && opened.has(sessionId)) continue;
16604
16622
  const draftOnly = lamp === void 0;
16605
16623
  out.push({
16606
- cardId,
16607
- sessionId: card.sessionId,
16608
- title: summary?.displayTitle ?? card.sessionId,
16624
+ cardId: cardBySession.get(sessionId) ?? sessionId,
16625
+ sessionId,
16626
+ title: summary.displayTitle ?? sessionId,
16609
16627
  ...draftOnly ? { draft: true } : { lamp },
16610
16628
  ...draftText !== void 0 ? { draftText } : {},
16611
- ...summary?.updatedAt !== void 0 ? { updatedAt: summary.updatedAt } : {}
16629
+ ...summary.updatedAt !== void 0 ? { updatedAt: summary.updatedAt } : {}
16612
16630
  });
16613
16631
  }
16614
16632
  return sortQueueRows(out);
16615
- }, [canvasState.cards, sessions, statusById, alerts2, finished2, drafts, opened]);
16633
+ }, [canvasState.cards, sessions, statusById, alerts2, finished2, drafts, opened, archivedSessionIds]);
16616
16634
  (0, import_react18.useEffect)(() => {
16617
16635
  const wanted = rows.slice(0, PREVIEW_LIMIT).map((row) => row.sessionId).filter((id2) => !askedRef.current.has(id2));
16618
16636
  if (wanted.length === 0) return;
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.91",
3
+ "version": "0.1.93",
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",