dsh-talk-map 0.1.64 → 0.1.66

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 +50 -56
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -328,10 +328,13 @@ var zh = {
328
328
  "map.empty": "地图是空的 —— 右键导入工作区或对话;双击空白直接开新对话",
329
329
  "statusRail.title": "队列中的任务",
330
330
  "confirm.removeGroup.title": "删除这个分组?",
331
- "confirm.removeGroup.body": "分组里的 {n} 个会话会被直接删除(不经过回收站,无法恢复),卡片和分组框同时从地图上移除。",
332
- "confirm.removeGroup.ok": "直接删除",
331
+ "confirm.removeGroup.body": "分组里的 {n} 个会话会被移入回收站(可在回收站恢复),卡片和分组框同时从地图上移除。仍在运行的会话会先被停止。",
332
+ "confirm.removeGroup.bodyHard": "这里没有回收站插件,{n} 个会话会被直接删除(无法恢复),卡片和分组框同时从地图上移除。",
333
+ "confirm.removeGroup.ok": "移入回收站",
334
+ "confirm.removeGroup.okHard": "直接删除",
333
335
  "confirm.cancel": "取消",
334
- "toast.workspaceTrashed": "已删除 {n} 个会话,分组已从地图移除",
336
+ "toast.workspaceTrashed": "已把 {n} 个会话移入回收站,分组已从地图移除",
337
+ "toast.workspaceDeleted": "已直接删除 {n} 个会话,分组已从地图移除",
335
338
  "statusRail.open": "展开状态栏",
336
339
  "statusRail.close": "收起状态栏",
337
340
  "statusRail.empty": "暂时没有带状态的卡片",
@@ -461,7 +464,7 @@ var zh = {
461
464
  "digest.empty": "这条对话还没有摘要,先刷新摘要再来看。",
462
465
  "digest.copy": "复制",
463
466
  "digest.close": "关闭",
464
- "global.searchPlaceholder": "b64 · 搜地图上的卡片(标题/正文)",
467
+ "global.searchPlaceholder": "b66 · 搜地图上的卡片(标题/正文)",
465
468
  "global.searchRun": "搜索",
466
469
  "global.searchTitle": "搜索地图",
467
470
  "font.group": "文字大小",
@@ -499,10 +502,13 @@ var en = {
499
502
  "map.empty": "The map is empty — right-click to import a workspace or conversation; double-click to start a chat",
500
503
  "statusRail.title": "Tasks in the queue",
501
504
  "confirm.removeGroup.title": "Delete this group?",
502
- "confirm.removeGroup.body": "Its {n} conversations are deleted outright (no recycle bin, no undo) and the cards and frame leave the map.",
503
- "confirm.removeGroup.ok": "Delete for good",
505
+ "confirm.removeGroup.body": "Its {n} conversations go to the recycle bin (restorable from there) and the cards and frame leave the map. Anything still running is stopped first.",
506
+ "confirm.removeGroup.bodyHard": "No recycle bin plugin answers here, so its {n} conversations are deleted outright (no undo) and the cards and frame leave the map.",
507
+ "confirm.removeGroup.ok": "Move to recycle bin",
508
+ "confirm.removeGroup.okHard": "Delete for good",
504
509
  "confirm.cancel": "Cancel",
505
- "toast.workspaceTrashed": "Deleted {n} conversations; the group is off the map",
510
+ "toast.workspaceTrashed": "Moved {n} conversations to the recycle bin; the group is off the map",
511
+ "toast.workspaceDeleted": "Deleted {n} conversations outright; the group is off the map",
506
512
  "statusRail.open": "Open the status rail",
507
513
  "statusRail.close": "Close the status rail",
508
514
  "statusRail.empty": "No card carries a status right now",
@@ -625,7 +631,7 @@ var en = {
625
631
  "menu.noGroup": "Remove from group (free card)",
626
632
  "menu.open": "Open conversation",
627
633
  "menu.markUnread": "Mark as unread",
628
- "global.searchPlaceholder": "b64 · Search cards on the map",
634
+ "global.searchPlaceholder": "b66 · Search cards on the map",
629
635
  "global.searchRun": "Search",
630
636
  "global.searchTitle": "Search the map",
631
637
  "font.group": "Text size",
@@ -10985,6 +10991,20 @@ async function postRecycleBin(body) {
10985
10991
  if (payload.ok !== true) throw new Error(payload.message ?? `回收站拒绝了请求(HTTP ${response.status})`);
10986
10992
  return payload;
10987
10993
  }
10994
+ async function recycleBinReady() {
10995
+ try {
10996
+ const path = new URL(RECYCLE_BIN_ROUTE, document.baseURI).pathname;
10997
+ const response = await fetch(path, {
10998
+ method: "POST",
10999
+ headers: { "content-type": "application/json" },
11000
+ body: JSON.stringify({ action: "list" }),
11001
+ cache: "no-store"
11002
+ });
11003
+ return response.status !== 404 && response.status !== 405;
11004
+ } catch {
11005
+ return false;
11006
+ }
11007
+ }
10988
11008
  var STOP_RETRIES = 10;
10989
11009
  var STOP_RETRY_DELAY_MS = 400;
10990
11010
  function isBusyRefusal(error) {
@@ -14176,7 +14196,6 @@ function CanvasInner(props) {
14176
14196
  } catch {
14177
14197
  }
14178
14198
  };
14179
- const [confirmRemove, setConfirmRemove] = (0, import_react13.useState)(null);
14180
14199
  const [renameTarget, setRenameTarget] = (0, import_react13.useState)(null);
14181
14200
  const [renamedTitles, setRenamedTitles] = (0, import_react13.useState)({});
14182
14201
  const [renamedWorkspaces, setRenamedWorkspaces] = (0, import_react13.useState)({});
@@ -15456,10 +15475,25 @@ function CanvasInner(props) {
15456
15475
  const deleteWorkspace = async (groupId) => {
15457
15476
  const sessionIds = (membersByGroup.get(groupId) ?? []).map((cardId) => visibleCards[cardId]?.sessionId).filter((sessionId) => sessionId !== void 0);
15458
15477
  try {
15459
- if (sessionIds.length > 0) await deleteSessionsDirect(sessionIds);
15460
- await deleteWorkspaceRegistration(groupId);
15478
+ const bin = await recycleBinReady();
15479
+ if (sessionIds.length > 0) {
15480
+ if (bin) {
15481
+ try {
15482
+ await trashSessions(sessionIds, () => {
15483
+ showToast(t("toast.stopping"));
15484
+ });
15485
+ } catch (error) {
15486
+ if (!/HTTP (404|405)|未注册|not found/i.test(String(error.message))) throw error;
15487
+ await deleteSessionsDirect(sessionIds);
15488
+ await deleteWorkspaceRegistration(groupId);
15489
+ }
15490
+ } else {
15491
+ await deleteSessionsDirect(sessionIds);
15492
+ await deleteWorkspaceRegistration(groupId);
15493
+ }
15494
+ }
15461
15495
  removeGroup(groupId);
15462
- showToast(t("toast.workspaceTrashed", { n: String(sessionIds.length) }));
15496
+ showToast(t(bin ? "toast.workspaceTrashed" : "toast.workspaceDeleted", { n: String(sessionIds.length) }));
15463
15497
  } catch (error) {
15464
15498
  showToast(String(error?.message ?? error));
15465
15499
  }
@@ -15742,9 +15776,12 @@ function CanvasInner(props) {
15742
15776
  key: "remove-group",
15743
15777
  icon: "delete",
15744
15778
  label: t("menu.removeGroup"),
15779
+ // Red row and no dialog: the colour is the confirmation. Clicking deletes now —
15780
+ // into the recycle bin when one answers, through the Host's own delete otherwise.
15781
+ danger: true,
15745
15782
  onPick: () => {
15746
- removeGroup(groupId);
15747
15783
  close();
15784
+ void deleteWorkspace(groupId);
15748
15785
  }
15749
15786
  });
15750
15787
  }
@@ -15877,49 +15914,6 @@ function CanvasInner(props) {
15877
15914
  }
15878
15915
  ) : null,
15879
15916
  hasContent ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: talk_map_default["emptyHint"], children: t("map.empty") }),
15880
- confirmRemove !== null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
15881
- "div",
15882
- {
15883
- className: talk_map_default["dangerBackdrop"],
15884
- role: "presentation",
15885
- onClick: () => {
15886
- setConfirmRemove(null);
15887
- },
15888
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
15889
- "div",
15890
- {
15891
- className: talk_map_default["dangerDialog"],
15892
- role: "dialog",
15893
- "aria-modal": "true",
15894
- "aria-label": t("confirm.removeGroup.title"),
15895
- onClick: (event) => {
15896
- event.stopPropagation();
15897
- },
15898
- children: [
15899
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: talk_map_default["dangerTitle"], children: t("confirm.removeGroup.title") }),
15900
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: talk_map_default["dangerBody"], children: t("confirm.removeGroup.body", { n: String(confirmRemove.count) }) }),
15901
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: talk_map_default["dangerActions"], children: [
15902
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: talk_map_default["dangerCancel"], onClick: () => {
15903
- setConfirmRemove(null);
15904
- }, children: t("confirm.cancel") }),
15905
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
15906
- "button",
15907
- {
15908
- type: "button",
15909
- className: talk_map_default["dangerOk"],
15910
- onClick: () => {
15911
- void deleteWorkspace(confirmRemove.groupId);
15912
- setConfirmRemove(null);
15913
- },
15914
- children: t("confirm.removeGroup.ok")
15915
- }
15916
- )
15917
- ] })
15918
- ]
15919
- }
15920
- )
15921
- }
15922
- ) : null,
15923
15917
  menuState !== null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ContextMenu, { menu: menuState, onClose: () => {
15924
15918
  setMenu(null);
15925
15919
  } }, menu?.view ?? "root") : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.64",
3
+ "version": "0.1.66",
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",