dsh-talk-map 0.1.84 → 0.1.86

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/client/client.js +42 -8
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -497,7 +497,7 @@ var zh = {
497
497
  "digest.empty": "这条对话还没有摘要,先刷新摘要再来看。",
498
498
  "digest.copy": "复制",
499
499
  "digest.close": "关闭",
500
- "global.searchPlaceholder": "b84 · 搜地图上的卡片(标题/正文)",
500
+ "global.searchPlaceholder": "b86 · 搜地图上的卡片(标题/正文)",
501
501
  "global.searchRun": "搜索",
502
502
  "global.searchTitle": "搜索地图",
503
503
  "font.group": "文字大小",
@@ -689,7 +689,7 @@ var en = {
689
689
  "menu.noGroup": "Remove from group (free card)",
690
690
  "menu.open": "Open conversation",
691
691
  "menu.markUnread": "Mark as unread",
692
- "global.searchPlaceholder": "b84 · Search cards on the map",
692
+ "global.searchPlaceholder": "b86 · Search cards on the map",
693
693
  "global.searchRun": "Search",
694
694
  "global.searchTitle": "Search the map",
695
695
  "font.group": "Text size",
@@ -16437,9 +16437,11 @@ var import_react19 = require("react");
16437
16437
  var import_react18 = require("react");
16438
16438
  var import_jsx_runtime19 = require("react/jsx-runtime");
16439
16439
  var EMPTY_SESSIONS = { ids: [], byId: {} };
16440
+ var EMPTY_STATUS = /* @__PURE__ */ new Map();
16440
16441
  var NO_SUBSCRIBE = () => () => {
16441
16442
  };
16442
16443
  var emptySnapshot = () => EMPTY_SESSIONS;
16444
+ var emptyStatus = () => EMPTY_STATUS;
16443
16445
  var HEIGHT_KEY = "dsh.talk-map.queueHeight";
16444
16446
  var MIN_HEIGHT = 76;
16445
16447
  function clampHeight(value) {
@@ -16457,11 +16459,12 @@ function storedHeight() {
16457
16459
  }
16458
16460
  }
16459
16461
  var PREVIEW_LIMIT = 14;
16460
- function lampOf(sessionId, summary, alerts2, finished2) {
16462
+ function lampOf(sessionId, status, summary, alerts2, finished2) {
16461
16463
  if (alerts2.has(sessionId)) return "error";
16462
- if (summary?.pendingInteraction !== void 0) return "waiting";
16463
- if (summary?.running === true) return "running";
16464
- if (summary?.completed === true || finished2.has(sessionId)) return "done";
16464
+ if (status?.pendingInteraction !== void 0) return "waiting";
16465
+ if (status?.running === true || summary?.running === true) return "running";
16466
+ const isMain = (summary?.retainedBy?.mainView ?? 0) > 0;
16467
+ if (!isMain && (status?.completionUnread === true || finished2.has(sessionId))) return "done";
16465
16468
  return void 0;
16466
16469
  }
16467
16470
  function SidebarQueue() {
@@ -16472,6 +16475,11 @@ function SidebarQueue() {
16472
16475
  list === void 0 ? NO_SUBSCRIBE : (listener) => list.subscribe(listener),
16473
16476
  list === void 0 ? emptySnapshot : () => list.getSnapshot()
16474
16477
  );
16478
+ const statusStore = services2?.ctx?.get?.("uiSession")?.sessionStatus;
16479
+ const statusById = (0, import_react18.useSyncExternalStore)(
16480
+ statusStore === void 0 ? NO_SUBSCRIBE : (listener) => statusStore.subscribe(listener),
16481
+ statusStore === void 0 ? emptyStatus : () => statusStore.getSnapshot()
16482
+ );
16475
16483
  const alerts2 = (0, import_react18.useSyncExternalStore)(sessionAlerts.subscribe, sessionAlerts.getSnapshot);
16476
16484
  const finished2 = (0, import_react18.useSyncExternalStore)(sessionActivity.subscribe, sessionActivity.getSnapshot);
16477
16485
  const locale = (0, import_react18.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
@@ -16479,6 +16487,7 @@ function SidebarQueue() {
16479
16487
  const [previews, setPreviews] = (0, import_react18.useState)({});
16480
16488
  const [height, setHeight] = (0, import_react18.useState)(() => storedHeight());
16481
16489
  const drag = (0, import_react18.useRef)(null);
16490
+ const [opened, setOpened] = (0, import_react18.useState)(() => /* @__PURE__ */ new Set());
16482
16491
  const askedRef = (0, import_react18.useRef)(/* @__PURE__ */ new Set());
16483
16492
  (0, import_react18.useEffect)(() => {
16484
16493
  const timer4 = setInterval(() => {
@@ -16510,13 +16519,34 @@ function SidebarQueue() {
16510
16519
  } catch {
16511
16520
  }
16512
16521
  };
16522
+ (0, import_react18.useEffect)(() => {
16523
+ for (const sessionId of finished2) {
16524
+ const summary = sessions.byId[sessionId];
16525
+ if ((summary?.retainedBy?.mainView ?? 0) > 0) sessionActivity.forget(sessionId);
16526
+ }
16527
+ }, [finished2, sessions]);
16528
+ (0, import_react18.useEffect)(() => {
16529
+ if (opened.size === 0) return;
16530
+ const stale = [...opened].filter((sessionId) => {
16531
+ const summary = sessions.byId[sessionId];
16532
+ const lamp = lampOf(sessionId, statusById.get(sessionId), summary, alerts2, finished2);
16533
+ return lamp !== "done";
16534
+ });
16535
+ if (stale.length === 0) return;
16536
+ setOpened((current) => {
16537
+ const next = new Set(current);
16538
+ for (const id2 of stale) next.delete(id2);
16539
+ return next;
16540
+ });
16541
+ }, [opened, sessions, statusById, alerts2, finished2]);
16513
16542
  const rows = (0, import_react18.useMemo)(() => {
16514
16543
  const out = [];
16515
16544
  for (const [cardId, card] of Object.entries(canvasState.cards)) {
16516
16545
  if (card.boardId !== INBOX_BOARD_ID) continue;
16517
16546
  const summary = sessions.byId[card.sessionId];
16518
- const lamp = lampOf(card.sessionId, summary, alerts2, finished2);
16547
+ const lamp = lampOf(card.sessionId, statusById.get(card.sessionId), summary, alerts2, finished2);
16519
16548
  if (lamp === void 0) continue;
16549
+ if (lamp === "done" && opened.has(card.sessionId)) continue;
16520
16550
  out.push({
16521
16551
  cardId,
16522
16552
  sessionId: card.sessionId,
@@ -16528,7 +16558,7 @@ function SidebarQueue() {
16528
16558
  }
16529
16559
  out.sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0));
16530
16560
  return out;
16531
- }, [canvasState.cards, sessions, alerts2, finished2, drafts]);
16561
+ }, [canvasState.cards, sessions, statusById, alerts2, finished2, drafts, opened]);
16532
16562
  (0, import_react18.useEffect)(() => {
16533
16563
  const wanted = rows.slice(0, PREVIEW_LIMIT).map((row) => row.sessionId).filter((id2) => !askedRef.current.has(id2));
16534
16564
  if (wanted.length === 0) return;
@@ -16609,12 +16639,16 @@ function SidebarQueue() {
16609
16639
  role: "button",
16610
16640
  tabIndex: 0,
16611
16641
  onClick: () => {
16642
+ sessionActivity.forget(row.sessionId);
16643
+ setOpened((current) => new Set(current).add(row.sessionId));
16612
16644
  closeMapPanel();
16613
16645
  openSessionInUi(row.sessionId);
16614
16646
  },
16615
16647
  onKeyDown: (event) => {
16616
16648
  if (event.key !== "Enter" && event.key !== " ") return;
16617
16649
  event.preventDefault();
16650
+ sessionActivity.forget(row.sessionId);
16651
+ setOpened((current) => new Set(current).add(row.sessionId));
16618
16652
  closeMapPanel();
16619
16653
  openSessionInUi(row.sessionId);
16620
16654
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
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",