dsh-talk-map 0.1.64 → 0.1.65

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 +48 -13
  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": "b65 · 搜地图上的卡片(标题/正文)",
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": "b65 · 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) {
@@ -15456,10 +15476,25 @@ function CanvasInner(props) {
15456
15476
  const deleteWorkspace = async (groupId) => {
15457
15477
  const sessionIds = (membersByGroup.get(groupId) ?? []).map((cardId) => visibleCards[cardId]?.sessionId).filter((sessionId) => sessionId !== void 0);
15458
15478
  try {
15459
- if (sessionIds.length > 0) await deleteSessionsDirect(sessionIds);
15460
- await deleteWorkspaceRegistration(groupId);
15479
+ const bin = await recycleBinReady();
15480
+ if (sessionIds.length > 0) {
15481
+ if (bin) {
15482
+ try {
15483
+ await trashSessions(sessionIds, () => {
15484
+ showToast(t("toast.stopping"));
15485
+ });
15486
+ } catch (error) {
15487
+ if (!/HTTP (404|405)|未注册|not found/i.test(String(error.message))) throw error;
15488
+ await deleteSessionsDirect(sessionIds);
15489
+ await deleteWorkspaceRegistration(groupId);
15490
+ }
15491
+ } else {
15492
+ await deleteSessionsDirect(sessionIds);
15493
+ await deleteWorkspaceRegistration(groupId);
15494
+ }
15495
+ }
15461
15496
  removeGroup(groupId);
15462
- showToast(t("toast.workspaceTrashed", { n: String(sessionIds.length) }));
15497
+ showToast(t(bin ? "toast.workspaceTrashed" : "toast.workspaceDeleted", { n: String(sessionIds.length) }));
15463
15498
  } catch (error) {
15464
15499
  showToast(String(error?.message ?? error));
15465
15500
  }
@@ -15897,7 +15932,7 @@ function CanvasInner(props) {
15897
15932
  },
15898
15933
  children: [
15899
15934
  /* @__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) }) }),
15935
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: talk_map_default["dangerBody"], children: t(confirmRemove.bin ? "confirm.removeGroup.body" : "confirm.removeGroup.bodyHard", { n: String(confirmRemove.count) }) }),
15901
15936
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: talk_map_default["dangerActions"], children: [
15902
15937
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: talk_map_default["dangerCancel"], onClick: () => {
15903
15938
  setConfirmRemove(null);
@@ -15911,7 +15946,7 @@ function CanvasInner(props) {
15911
15946
  void deleteWorkspace(confirmRemove.groupId);
15912
15947
  setConfirmRemove(null);
15913
15948
  },
15914
- children: t("confirm.removeGroup.ok")
15949
+ children: t(confirmRemove.bin ? "confirm.removeGroup.ok" : "confirm.removeGroup.okHard")
15915
15950
  }
15916
15951
  )
15917
15952
  ] })
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.65",
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",