dsh-talk-map 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -4,22 +4,28 @@ English | [中文](README.zh.md)
4
4
 
5
5
  A visual conversation map plugin for DeepSeek Harness (dsh): every session becomes a card on an infinite whiteboard.
6
6
 
7
+ ![Workspaces, pinned cards and live status](https://raw.githubusercontent.com/Da0Mine/dsh-talk-map/main/docs/screenshots/workspaces-and-pins.png)
8
+
9
+ ![Cards connected by links, with running / waiting / unread lamps](https://raw.githubusercontent.com/Da0Mine/dsh-talk-map/main/docs/screenshots/cards-and-links.png)
10
+
7
11
  - **Spatial memory instead of working memory**: free placement + grid snapping, and nothing ever rearranges your cards — if you remember "that conversation was bottom-left", it stays bottom-left. Designed for ADHD users, useful for everyone.
12
+ - **Folders stay readable**: a workspace becomes a frame that auto-expands or folds its overflow into a stack cell you can open as a drawer; pinned cards stay in front.
8
13
  - **Double-click to chat**: double-click empty canvas to start a new session; the card is born exactly where you clicked.
9
14
  - **Draw an edge to fork**: drag a line from a card onto empty space, preview (and edit) the context digest to inject, confirm — a new session starts *knowing* the old conversation.
10
- - **Card front = resume surface**: title, the digest's "next step", relative time, running state. One glance tells you what to do next.
11
- - **Automatic digests**: after a session goes idle, a three-field digest (summary / key findings / next step) is generated with your deployment's default model; hit ⟳ on a card to regenerate manually.
12
- - **Bilingual interface**: the map's own copy renders in Chinese or English. The pill in the map header cycles Auto → 中文 → English; Auto follows dsh's own language, and the choice is remembered across restarts. (Digests stay in the language of the conversation they summarise.)
13
- - **Provenance visible**: dsh's native fork/subagent lineage renders as dashed edges; your injection edges are solid.
15
+ - **Card front = resume surface**: title, the last thing you said, relative time and a status lamp (running / finished / unread / waiting / interrupted). One glance tells you what to do next.
16
+ - **Lines mean something**: a link whose context is still up to date disappears; one that has fallen behind stays visible as a dashed line with an arrow. Fork lineage is always drawn.
17
+ - **Automatic digests**: a three-field digest (summary / key findings / next step) is generated on demand through your deployment's default model; hit ⟳ on a card to regenerate.
18
+ - **Bilingual interface**: the map's own copy renders in Chinese or English. The pill in the map header cycles Auto → 中文 → English; Auto follows dsh's own language, and the choice is remembered across restarts.
14
19
 
15
20
  ## Install
16
21
 
17
22
  ```sh
18
- # GitHub (built artifacts are committed — no build step, no allowBuilds needed)
19
- dsh plugin --profile web add github:Tasihi89/dsh-talk-map
20
- ```
23
+ # npm (recommended)
24
+ dsh plugin add dsh-talk-map
21
25
 
22
- npm package (`dsh plugin --profile web add dsh-talk-map`) coming soon.
26
+ # or straight from GitHub — built artifacts are committed, so there is no build step
27
+ dsh plugin add github:Da0Mine/dsh-talk-map
28
+ ```
23
29
 
24
30
  Restart `dsh web`; a map button appears at the sidebar foot.
25
31
 
@@ -31,8 +37,10 @@ Restart `dsh web`; a map button appears at the sidebar foot.
31
37
  | Drag a card | place it (16px grid snap, persisted) |
32
38
  | Double-click empty space | create a session there and enter it |
33
39
  | Double-click a card | open that session |
34
- | Drag from a card's right handle to empty space | preview injection → fork a new session |
40
+ | Drag from a card handle to empty space | preview injection → fork a new session |
41
+ | Click a stack cell | open the drawer listing the folded conversations |
35
42
  | ⟳ on a card | regenerate the digest |
43
+ | Right-click a card / a line / a folder | pin, rename, mark unread, archive, delete, push switch, delete line |
36
44
  | Language pill in the map header | cycle Auto → 中文 → English |
37
45
 
38
46
  ## Where data lives
@@ -43,19 +51,19 @@ Restart `dsh web`; a map button appears at the sidebar foot.
43
51
 
44
52
  ## Compatibility
45
53
 
46
- Built against deepseek-harness `0.1.0-rc.6` (rc-stage APIs may drift). The structural contracts live in `src/client/dsh.ts` and `src/host/dsh-host.ts` — start there when upgrading.
54
+ Built and tested against DeepSeek Harness `0.2.1-rc.3`. The structural contracts live in `src/client/dsh.ts` and `src/host/dsh-host.ts` — start there when upgrading.
47
55
 
48
56
  ## Roadmap
49
57
 
50
- Multi-board shelf (project = board, WIP limit) · whole-board archive/shelve · timeline view (camera fly-back) · alias cards · multi-parent merge UI · selection-level injection · quick-ask on card · two-week fade.
58
+ Multi-board shelf (project = board, WIP limit) · whole-board archive/shelve · timeline view (camera fly-back) · alias cards · multi-parent merge UI · selection-level injection · quick-ask on card.
51
59
 
52
60
  ## Development
53
61
 
54
62
  ```sh
55
63
  pnpm install
56
64
  pnpm run build # host → lib/, client → client/client.js
65
+ pnpm run probe # headless end-to-end probe (150 checks)
57
66
  dsh plugin --profile dev add /abs/path/dsh-talk-map
58
- dsh --profile dev # add a profile patch to change the port and coexist with your main instance
59
67
  ```
60
68
 
61
69
  MIT License.
package/README.zh.md CHANGED
@@ -4,58 +4,62 @@
4
4
 
5
5
  DeepSeek Harness(dsh)的可视化对话地图插件:把你的每一个会话变成白板上的一张卡片。
6
6
 
7
- - **空间记忆代替脑内记忆**:卡片自由摆放 + 网格吸附,位置永远不会被自动打乱——你记得"那个对话在左下角",它就一直在左下角。为 ADHD 用户设计,对所有人有效。
7
+ ![工作区分组、置顶卡片与状态灯](https://raw.githubusercontent.com/Da0Mine/dsh-talk-map/main/docs/screenshots/workspaces-and-pins.png)
8
+
9
+ ![卡片之间的连线,以及运行中 / 等你回复 / 待查看的指示灯](https://raw.githubusercontent.com/Da0Mine/dsh-talk-map/main/docs/screenshots/cards-and-links.png)
10
+
11
+ - **空间记忆代替脑内记忆**:卡片自由摆放 + 网格吸附,位置永远不会被自动打乱——你记得「那个对话在左下角」,它就一直在左下角。为 ADHD 用户设计,对所有人有效。
12
+ - **工作区是收纳盒**:一个工作区就是一块框,装不下时把多出来的会话折进一个堆叠格,点开是抽屉;置顶的卡片永远排在最前。
8
13
  - **双击即聊**:双击白板空白处,就地新建一个会话,卡片出生在你点的位置。
9
- - **连线分叉**:从一张卡拉一根线到空白处,预览(可编辑)将要注入的上下文摘要,确认后开一个"带着旧对话记忆"的新会话。
10
- - **卡片正面 = 恢复现场**:标题、摘要的"下一步"、相对时间、运行状态。回来扫一眼就知道该干嘛。
11
- - **自动摘要**:会话空闲后自动生成三字段摘要(概要 / 关键结论 / 下一步),用你部署里的默认模型;卡片上的 ⟳ 可手动重生成。
12
- - **中英双语界面**:地图自己的文案可以选中文或英文。地图顶栏那颗药丸按钮循环切换 自动 → 中文 → English,「自动」跟随 dsh 本身的语言,选择会记住,重启也在。(摘要仍然跟随被摘要的那段对话的语言。)
13
- - **血缘可见**:dsh 原生的 fork/子代理血缘自动画成虚线,你拉的注入线是实线。
14
+ - **连线分叉**:从一张卡的接口拉一根线到空白处,预览(可编辑)将要注入的上下文摘要,确认后开一个「带着旧对话记忆」的新会话。
15
+ - **卡片正面 = 恢复现场**:标题、你最后说的那句话、相对时间,以及状态灯(运行中 / 已完成 / 待查看 / 等你回复 / 已中断)。回来扫一眼就知道该干嘛。
16
+ - **连线的含义**:上下文已经同步过去的线自动隐去;落后了的线是带箭头的虚线;分叉血缘始终画出来。线会自动选面,两张卡贴太近时绕到上下边走,不会挤成一截看不见的短墩。
17
+ - **按需摘要**:三字段摘要(概要 / 关键结论 / 下一步)用你部署里的默认模型生成,卡片上的 ⟳ 可手动重生成。
18
+ - **中英双语界面**:地图顶栏那颗药丸按钮循环切换 自动 → 中文 → English,「自动」跟随 dsh 本身的语言,选择会记住。
14
19
 
15
20
  ## 安装
16
21
 
17
22
  ```sh
18
- # GitHub(构建产物已随仓库提交,免构建、无需 allowBuilds)
19
- dsh plugin --profile web add github:Tasihi89/dsh-talk-map
20
- ```
23
+ # npm(推荐)
24
+ dsh plugin add dsh-talk-map
21
25
 
22
- npm 包(`dsh plugin --profile web add dsh-talk-map`)待发布。
26
+ # 或直接从 GitHub 装——构建产物已随仓库提交,免构建
27
+ dsh plugin add github:Da0Mine/dsh-talk-map
28
+ ```
23
29
 
24
30
  重启 `dsh web`,侧栏底部出现地图按钮。
25
31
 
26
- ## 使用
32
+ ## 用法
27
33
 
28
- | 动作 | 效果 |
34
+ | 操作 | 效果 |
29
35
  |---|---|
30
- | 点侧栏地图按钮 / Esc | 开关地图 |
31
- | 拖动卡片 | 摆放(16px 网格吸附,位置持久化) |
32
- | 双击空白 | 在该位置新建会话并进入 |
33
- | 双击卡片 | 打开该会话 |
34
- | 从卡片右侧拉线到空白 | 预览注入上下文 → 开分叉会话 |
35
- | 卡片上的 ⟳ | 手动重新生成摘要 |
36
- | 地图顶栏的语言按钮 | 循环切换 自动 → 中文 → English |
37
-
38
- ## 数据存哪
39
-
40
- - 画布数据(卡片位置、连线、摘要):`$DSH_HOME/storages/talk_map.json`,走 dsh 官方 storage-domain,原子落盘。
41
- - 会话本身:完全归 dsh 管,本插件只读会话、只在分叉时通过官方 API 创建新会话。
42
- - 摘要生成用你配置的默认模型,走本地 dsh 的 LLM 通道;除此之外无任何外部请求。
36
+ | 侧栏地图按钮 / Esc | 打开或收起地图 |
37
+ | 拖卡片 | 摆放(16px 网格吸附,会保存) |
38
+ | 双击空白处 | 在那里新建会话并进入 |
39
+ | 双击卡片 | 打开那个会话 |
40
+ | 从卡片接口拖到空白处 | 预览注入内容 → 分叉出新会话 |
41
+ | 点堆叠格 | 打开抽屉,列出被折叠的会话 |
42
+ | 卡片上的 ⟳ | 重新生成摘要 |
43
+ | 右键卡片 / 连线 / 工作区 | 置顶、重命名、标为未读、查看摘要、归档、删除、推送开关、删除连线 |
44
+ | 顶栏语言药丸 | 循环 自动 → 中文 → English |
45
+
46
+ ## 数据放在哪
47
+
48
+ - 画布数据(位置、连线、摘要):`$DSH_HOME/storages/talk_map.json`,走 dsh 官方 storage-domain,原子写入。
49
+ - 会话本身完全归 dsh 所有——本插件只读它们,只有分叉时才通过官方 API 新建。
50
+ - 摘要走 dsh 本地 LLM 通道使用你配置的默认模型,没有其他外部请求。
43
51
 
44
52
  ## 兼容性
45
53
 
46
- 针对 deepseek-harness `0.1.0-rc.6` 开发(rc 阶段 API 可能漂移)。结构化契约集中在 `src/client/dsh.ts` 与 `src/host/dsh-host.ts`,升级排查从这两个文件开始。
47
-
48
- ## Roadmap(第三刀)
49
-
50
- 多板架子(项目=白板,WIP 上限)· 整板归档/搁置 · 时间视图(镜头飞回)· 替身卡 · 多父合并注入 UI · 选段注入 · 卡上速问 · 两周未动变暗。
54
+ 在 DeepSeek Harness `0.2.1-rc.3` 上构建与验证。结构契约在 `src/client/dsh.ts` 与 `src/host/dsh-host.ts`,升级时从这两处入手。
51
55
 
52
56
  ## 开发
53
57
 
54
58
  ```sh
55
59
  pnpm install
56
- pnpm run build # host → lib/,client → client/client.js
57
- dsh plugin --profile dev add /绝对路径/dsh-talk-map
58
- dsh --profile dev # 配一份 profile patch 换端口即可与主实例共存
60
+ pnpm run build # 宿主 → lib/,客户端 → client/client.js
61
+ pnpm run probe # 无头端到端探针(150 项)
62
+ dsh plugin --profile dev add /abs/path/dsh-talk-map
59
63
  ```
60
64
 
61
65
  MIT License.
package/client/client.js CHANGED
@@ -1245,7 +1245,7 @@ function allCards() {
1245
1245
  }
1246
1246
 
1247
1247
  // src/client/MapOverlay.tsx
1248
- var import_react15 = require("react");
1248
+ var import_react14 = require("react");
1249
1249
 
1250
1250
  // src/client/font-scale.ts
1251
1251
  var STORAGE_KEY = "dsh.talk-map.font-step";
@@ -1651,7 +1651,7 @@ function GlobalSearch(props) {
1651
1651
  }
1652
1652
 
1653
1653
  // src/client/MapCanvas.tsx
1654
- var import_react13 = require("react");
1654
+ var import_react12 = require("react");
1655
1655
 
1656
1656
  // node_modules/@xyflow/react/dist/esm/index.js
1657
1657
  var import_jsx_runtime4 = require("react/jsx-runtime");
@@ -10844,6 +10844,275 @@ function pickFaces(from, to, obstacles, options) {
10844
10844
  return { fromHandle: fromSide, toHandle: toSide };
10845
10845
  }
10846
10846
 
10847
+ // src/client/edge-route.ts
10848
+ var DEFAULTS = { margin: 10, stub: 14, minCorridor: 28 };
10849
+ function anchorOf(rect, face) {
10850
+ switch (face) {
10851
+ case "r":
10852
+ return { x: rect.x + rect.w, y: rect.y + rect.h / 2 };
10853
+ case "l":
10854
+ return { x: rect.x, y: rect.y + rect.h / 2 };
10855
+ case "t":
10856
+ return { x: rect.x + rect.w / 2, y: rect.y };
10857
+ default:
10858
+ return { x: rect.x + rect.w / 2, y: rect.y + rect.h };
10859
+ }
10860
+ }
10861
+ function normalOf(face) {
10862
+ switch (face) {
10863
+ case "r":
10864
+ return { x: 1, y: 0 };
10865
+ case "l":
10866
+ return { x: -1, y: 0 };
10867
+ case "t":
10868
+ return { x: 0, y: -1 };
10869
+ default:
10870
+ return { x: 0, y: 1 };
10871
+ }
10872
+ }
10873
+ function expand(rect, by) {
10874
+ return { x: rect.x - by, y: rect.y - by, w: rect.w + by * 2, h: rect.h + by * 2 };
10875
+ }
10876
+ function insideStrict(rect, point) {
10877
+ return point.x > rect.x && point.x < rect.x + rect.w && point.y > rect.y && point.y < rect.y + rect.h;
10878
+ }
10879
+ function hitsHorizontal(rects, y, x1, x2) {
10880
+ const lo = Math.min(x1, x2);
10881
+ const hi = Math.max(x1, x2);
10882
+ for (const rect of rects) {
10883
+ if (y <= rect.y || y >= rect.y + rect.h) continue;
10884
+ if (hi <= rect.x || lo >= rect.x + rect.w) continue;
10885
+ return true;
10886
+ }
10887
+ return false;
10888
+ }
10889
+ function hitsVertical(rects, x, y1, y2) {
10890
+ const lo = Math.min(y1, y2);
10891
+ const hi = Math.max(y1, y2);
10892
+ for (const rect of rects) {
10893
+ if (x <= rect.x || x >= rect.x + rect.w) continue;
10894
+ if (hi <= rect.y || lo >= rect.y + rect.h) continue;
10895
+ return true;
10896
+ }
10897
+ return false;
10898
+ }
10899
+ function bands(rects, axis) {
10900
+ const spans = rects.map((rect) => axis === "x" ? { start: rect.x, end: rect.x + rect.w } : { start: rect.y, end: rect.y + rect.h }).sort((a, b) => a.start - b.start);
10901
+ const out = [];
10902
+ for (const span of spans) {
10903
+ const last = out[out.length - 1];
10904
+ if (last !== void 0 && span.start <= last.end) {
10905
+ last.end = Math.max(last.end, span.end);
10906
+ } else {
10907
+ out.push({ ...span });
10908
+ }
10909
+ }
10910
+ return out;
10911
+ }
10912
+ function corridors(rects, axis, minCorridor) {
10913
+ const merged = bands(rects, axis);
10914
+ const out = [];
10915
+ for (let index2 = 1; index2 < merged.length; index2 += 1) {
10916
+ const gap = merged[index2].start - merged[index2 - 1].end;
10917
+ if (gap >= minCorridor) out.push((merged[index2 - 1].end + merged[index2].start) / 2);
10918
+ }
10919
+ return out;
10920
+ }
10921
+ function outerLines(rects, axis, clearance) {
10922
+ const merged = bands(rects, axis);
10923
+ const out = [];
10924
+ for (const band of merged) {
10925
+ out.push(band.start - clearance, band.end + clearance);
10926
+ }
10927
+ return out;
10928
+ }
10929
+ var Heap = class {
10930
+ items = [];
10931
+ push(cost, key, node) {
10932
+ this.items.push({ cost, key, node });
10933
+ let index2 = this.items.length - 1;
10934
+ while (index2 > 0) {
10935
+ const parent = index2 - 1 >> 1;
10936
+ if (this.items[parent].cost <= this.items[index2].cost) break;
10937
+ const tmp = this.items[parent];
10938
+ this.items[parent] = this.items[index2];
10939
+ this.items[index2] = tmp;
10940
+ index2 = parent;
10941
+ }
10942
+ }
10943
+ pop() {
10944
+ if (this.items.length === 0) return void 0;
10945
+ const top = this.items[0];
10946
+ const last = this.items.pop();
10947
+ if (this.items.length > 0) {
10948
+ this.items[0] = last;
10949
+ let index2 = 0;
10950
+ for (; ; ) {
10951
+ const left = index2 * 2 + 1;
10952
+ const right = left + 1;
10953
+ let smallest = index2;
10954
+ if (left < this.items.length && this.items[left].cost < this.items[smallest].cost) smallest = left;
10955
+ if (right < this.items.length && this.items[right].cost < this.items[smallest].cost) smallest = right;
10956
+ if (smallest === index2) break;
10957
+ const tmp = this.items[smallest];
10958
+ this.items[smallest] = this.items[index2];
10959
+ this.items[index2] = tmp;
10960
+ index2 = smallest;
10961
+ }
10962
+ }
10963
+ return { key: top.key, node: top.node };
10964
+ }
10965
+ get size() {
10966
+ return this.items.length;
10967
+ }
10968
+ };
10969
+ function dedupe(values, epsilon = 0.5) {
10970
+ const sorted = [...values].sort((a, b) => a - b);
10971
+ const out = [];
10972
+ for (const value of sorted) {
10973
+ if (out.length === 0 || Math.abs(value - out[out.length - 1]) > epsilon) out.push(value);
10974
+ }
10975
+ return out;
10976
+ }
10977
+ function simplify(points) {
10978
+ const out = [];
10979
+ for (const point of points) {
10980
+ const last = out[out.length - 1];
10981
+ if (last !== void 0 && Math.abs(last.x - point.x) < 0.5 && Math.abs(last.y - point.y) < 0.5) continue;
10982
+ out.push(point);
10983
+ }
10984
+ for (let index2 = 1; index2 < out.length - 1; ) {
10985
+ const a = out[index2 - 1];
10986
+ const b = out[index2];
10987
+ const c = out[index2 + 1];
10988
+ const collinear = Math.abs(a.x - b.x) < 0.5 && Math.abs(b.x - c.x) < 0.5 || Math.abs(a.y - b.y) < 0.5 && Math.abs(b.y - c.y) < 0.5;
10989
+ if (collinear) out.splice(index2, 1);
10990
+ else index2 += 1;
10991
+ }
10992
+ return out;
10993
+ }
10994
+ function routeEdge(from, to, fromFace, toFace, obstacles, options = {}) {
10995
+ const margin = options.margin ?? DEFAULTS.margin;
10996
+ const stub = options.stub ?? DEFAULTS.stub;
10997
+ const minCorridor = options.minCorridor ?? DEFAULTS.minCorridor;
10998
+ const start2 = anchorOf(from, fromFace);
10999
+ const end = anchorOf(to, toFace);
11000
+ const startNormal = normalOf(fromFace);
11001
+ const endNormal = normalOf(toFace);
11002
+ const startStub = { x: start2.x + startNormal.x * stub, y: start2.y + startNormal.y * stub };
11003
+ const endStub = { x: end.x + endNormal.x * stub, y: end.y + endNormal.y * stub };
11004
+ const blocked = obstacles.filter((rect) => rect !== from && rect !== to).map((rect) => expand(rect, margin));
11005
+ const fallback = simplify([start2, startStub, { x: endStub.x, y: startStub.y }, endStub, end]);
11006
+ const xs = corridors(obstacles, "x", minCorridor);
11007
+ const ys = corridors(obstacles, "y", minCorridor);
11008
+ const xOuter = outerLines(obstacles, "x", margin + 6);
11009
+ const yOuter = outerLines(obstacles, "y", margin + 6);
11010
+ const xCands = dedupe([start2.x, end.x, startStub.x, endStub.x, ...xs, ...xOuter]);
11011
+ const yCands = dedupe([start2.y, end.y, startStub.y, endStub.y, ...ys, ...yOuter]);
11012
+ if (xCands.length > 60 || yCands.length > 60) return fallback;
11013
+ const corridorX = new Set(xs.map((value) => Math.round(value)));
11014
+ const corridorY = new Set(ys.map((value) => Math.round(value)));
11015
+ const nodeId = (ix, iy) => `${ix},${iy}`;
11016
+ const pointAt = (id2) => {
11017
+ const [ix, iy] = id2.split(",").map(Number);
11018
+ return { x: xCands[ix], y: yCands[iy] };
11019
+ };
11020
+ const startIndex = { x: xCands.findIndex((value) => Math.abs(value - startStub.x) < 0.5), y: yCands.findIndex((value) => Math.abs(value - startStub.y) < 0.5) };
11021
+ const endIndex = { x: xCands.findIndex((value) => Math.abs(value - endStub.x) < 0.5), y: yCands.findIndex((value) => Math.abs(value - endStub.y) < 0.5) };
11022
+ if (startIndex.x < 0 || startIndex.y < 0 || endIndex.x < 0 || endIndex.y < 0) return fallback;
11023
+ const goal = { x: endStub.x, y: endStub.y };
11024
+ const startNode = nodeId(startIndex.x, startIndex.y);
11025
+ const goalNode = nodeId(endIndex.x, endIndex.y);
11026
+ const best = /* @__PURE__ */ new Map();
11027
+ const cameFrom = /* @__PURE__ */ new Map();
11028
+ const heap = new Heap();
11029
+ const withDir = (node, dir) => `${node}|${dir}`;
11030
+ best.set(withDir(startNode, "x"), 0);
11031
+ heap.push(0, 0, withDir(startNode, "x"));
11032
+ const estimate = (point) => Math.abs(point.x - goal.x) + Math.abs(point.y - goal.y);
11033
+ while (heap.size > 0) {
11034
+ const popped = heap.pop();
11035
+ const state3 = popped.node;
11036
+ const [node, dir] = state3.split("|");
11037
+ const cost = best.get(state3);
11038
+ if (cost === void 0) continue;
11039
+ if (node === goalNode) {
11040
+ const path = [];
11041
+ let cursor = state3;
11042
+ while (cursor !== void 0) {
11043
+ const [cell] = cursor.split("|");
11044
+ path.push(pointAt(cell));
11045
+ cursor = cameFrom.get(cursor);
11046
+ }
11047
+ path.reverse();
11048
+ return simplify([start2, startStub, ...path.slice(1), endStub, end]);
11049
+ }
11050
+ const [ix, iy] = node.split(",").map(Number);
11051
+ const here = pointAt(node);
11052
+ const steps = [
11053
+ { dx: 1, dy: 0, axis: "x" },
11054
+ { dx: -1, dy: 0, axis: "x" },
11055
+ { dx: 0, dy: 1, axis: "y" },
11056
+ { dx: 0, dy: -1, axis: "y" }
11057
+ ];
11058
+ for (const step2 of steps) {
11059
+ const nx = ix + step2.dx;
11060
+ const ny = iy + step2.dy;
11061
+ if (nx < 0 || ny < 0 || nx >= xCands.length || ny >= yCands.length) continue;
11062
+ const next = { x: xCands[nx], y: yCands[ny] };
11063
+ const nextNode = nodeId(nx, ny);
11064
+ if (nextNode !== goalNode && blocked.some((rect) => insideStrict(rect, next))) continue;
11065
+ const clear = step2.axis === "x" ? !hitsHorizontal(blocked, here.y, here.x, next.x) : !hitsVertical(blocked, here.x, here.y, next.y);
11066
+ if (!clear) continue;
11067
+ const distance2 = Math.abs(next.x - here.x) + Math.abs(next.y - here.y);
11068
+ const onCorridor = step2.axis === "x" ? corridorY.has(Math.round(here.y)) : corridorX.has(Math.round(here.x));
11069
+ const turn = dir === step2.axis ? 0 : 18;
11070
+ const prefer = onCorridor ? 0 : 6;
11071
+ const nextCost = cost + distance2 + turn + prefer;
11072
+ const nextState = withDir(nextNode, step2.axis);
11073
+ const known = best.get(nextState);
11074
+ if (known !== void 0 && known <= nextCost) continue;
11075
+ best.set(nextState, nextCost);
11076
+ cameFrom.set(nextState, state3);
11077
+ heap.push(nextCost + estimate(next), nextCost, nextState);
11078
+ }
11079
+ }
11080
+ return fallback;
11081
+ }
11082
+ function roundedPath(points, radius = 10) {
11083
+ if (points.length === 0) return "";
11084
+ if (points.length === 1) return `M ${round(points[0].x)} ${round(points[0].y)}`;
11085
+ const parts = [`M ${round(points[0].x)} ${round(points[0].y)}`];
11086
+ for (let index2 = 1; index2 < points.length - 1; index2 += 1) {
11087
+ const prev = points[index2 - 1];
11088
+ const here = points[index2];
11089
+ const next = points[index2 + 1];
11090
+ const inLength = Math.hypot(here.x - prev.x, here.y - prev.y);
11091
+ const outLength = Math.hypot(next.x - here.x, next.y - here.y);
11092
+ const corner = Math.min(radius, inLength / 2, outLength / 2);
11093
+ if (corner < 0.5) {
11094
+ parts.push(`L ${round(here.x)} ${round(here.y)}`);
11095
+ continue;
11096
+ }
11097
+ const enter = {
11098
+ x: here.x + (prev.x - here.x) / (inLength || 1) * corner,
11099
+ y: here.y + (prev.y - here.y) / (inLength || 1) * corner
11100
+ };
11101
+ const leave = {
11102
+ x: here.x + (next.x - here.x) / (outLength || 1) * corner,
11103
+ y: here.y + (next.y - here.y) / (outLength || 1) * corner
11104
+ };
11105
+ parts.push(`L ${round(enter.x)} ${round(enter.y)}`);
11106
+ parts.push(`Q ${round(here.x)} ${round(here.y)} ${round(leave.x)} ${round(leave.y)}`);
11107
+ }
11108
+ const last = points[points.length - 1];
11109
+ parts.push(`L ${round(last.x)} ${round(last.y)}`);
11110
+ return parts.join(" ");
11111
+ }
11112
+ function round(value) {
11113
+ return Math.round(value * 100) / 100;
11114
+ }
11115
+
10847
11116
  // src/client/push-log.ts
10848
11117
  var KEY = "dsh.talk-map.push-log.v1";
10849
11118
  function pairKey(fromCardId, toCardId) {
@@ -11008,7 +11277,7 @@ async function trashSessions(sessionIds, onStopping) {
11008
11277
  onStopping?.();
11009
11278
  await stopWork(ids);
11010
11279
  let last = error;
11011
- for (let round = 0; round < STOP_RETRIES; round += 1) {
11280
+ for (let round2 = 0; round2 < STOP_RETRIES; round2 += 1) {
11012
11281
  await new Promise((resolve) => setTimeout(resolve, STOP_RETRY_DELAY_MS));
11013
11282
  try {
11014
11283
  return await attempt();
@@ -11744,7 +12013,9 @@ function TalkMapEdge(props) {
11744
12013
  const data = props.data ?? {};
11745
12014
  const synced = data.sync === "synced";
11746
12015
  const hidden = synced && data.structural !== true;
11747
- const [path] = getSmoothStepPath({
12016
+ const route = data.route;
12017
+ const routed = route !== void 0 && route.length > 1;
12018
+ const [smoothPath] = getSmoothStepPath({
11748
12019
  sourceX: props.sourceX,
11749
12020
  sourceY: props.sourceY,
11750
12021
  sourcePosition: props.sourcePosition,
@@ -11752,7 +12023,16 @@ function TalkMapEdge(props) {
11752
12023
  targetY: props.targetY,
11753
12024
  targetPosition: props.targetPosition
11754
12025
  });
12026
+ const path = routed ? roundedPath(route, 10) : smoothPath;
11755
12027
  const arrowAngle = (() => {
12028
+ if (routed) {
12029
+ const end = route[route.length - 1];
12030
+ const before = route[route.length - 2];
12031
+ const dx = end.x - before.x;
12032
+ const dy = end.y - before.y;
12033
+ if (Math.abs(dx) >= Math.abs(dy)) return dx >= 0 ? 0 : 180;
12034
+ return dy >= 0 ? 90 : -90;
12035
+ }
11756
12036
  const position = String(props.targetPosition ?? "left");
11757
12037
  if (position === "right") return 180;
11758
12038
  if (position === "top") return 90;
@@ -12406,59 +12686,43 @@ function StackDrawer(props) {
12406
12686
  rect.height
12407
12687
  );
12408
12688
  };
12689
+ const cardsInDrawer = [...scroller.querySelectorAll("[data-card-id]")].map((element) => {
12690
+ const box = element.getBoundingClientRect();
12691
+ const base = scroller.getBoundingClientRect();
12692
+ return {
12693
+ id: element.getAttribute("data-card-id") ?? "",
12694
+ x: box.left - base.left + scroller.scrollLeft,
12695
+ y: box.top - base.top + scroller.scrollTop,
12696
+ w: box.width,
12697
+ h: box.height
12698
+ };
12699
+ });
12409
12700
  const next = [];
12410
12701
  for (const link2 of links) {
12411
12702
  const from = boxOf(link2.from);
12412
12703
  const to = boxOf(link2.to);
12413
12704
  if (from === null || to === null) continue;
12414
- const fromCx = from.x + from.width / 2;
12415
- const fromCy = from.y + from.height / 2;
12416
- const toCx = to.x + to.width / 2;
12417
- const toCy = to.y + to.height / 2;
12418
- const dx = toCx - fromCx;
12419
- const dy = toCy - fromCy;
12420
- const gapX = Math.abs(dx) - (from.width + to.width) / 2;
12421
- const gapY = Math.abs(dy) - (from.height + to.height) / 2;
12422
- const MIN_SPAN = 96;
12423
- const horizontalDominant = Math.abs(dx) >= Math.abs(dy);
12424
- let sourceX = fromCx;
12425
- let sourceY = fromCy;
12426
- let targetX = toCx;
12427
- let targetY = toCy;
12428
- let sourcePosition = Position.Right;
12429
- let targetPosition = Position.Left;
12430
- if (horizontalDominant && gapX >= MIN_SPAN) {
12431
- const right = dx >= 0;
12432
- sourceX = right ? from.x + from.width : from.x;
12433
- targetX = right ? to.x : to.x + to.width;
12434
- sourcePosition = right ? Position.Right : Position.Left;
12435
- targetPosition = right ? Position.Left : Position.Right;
12436
- targetY = toCy;
12437
- } else if (!horizontalDominant && gapY >= MIN_SPAN) {
12438
- const down = dy >= 0;
12439
- sourceY = down ? from.y + from.height : from.y;
12440
- targetY = down ? to.y : to.y + to.height;
12441
- sourcePosition = down ? Position.Bottom : Position.Top;
12442
- targetPosition = down ? Position.Top : Position.Bottom;
12443
- targetX = toCx;
12444
- } else {
12445
- const down = from.y + from.height <= to.y + to.height;
12446
- sourceY = down ? from.y + from.height : from.y;
12447
- targetY = down ? to.y + to.height : to.y;
12448
- sourcePosition = down ? Position.Bottom : Position.Top;
12449
- targetPosition = down ? Position.Bottom : Position.Top;
12450
- }
12451
- const [wirePath] = getSmoothStepPath({
12452
- sourceX,
12453
- sourceY,
12454
- sourcePosition,
12455
- targetX,
12456
- targetY,
12457
- targetPosition,
12458
- borderRadius: 8
12459
- });
12460
- const angle = targetPosition === Position.Left ? 0 : targetPosition === Position.Right ? 180 : targetPosition === Position.Top ? 90 : -90;
12461
- next.push({ d: wirePath, ax: targetX, ay: targetY, angle });
12705
+ const rectOf = (box) => ({ x: box.x, y: box.y, w: box.width, h: box.height });
12706
+ const fromRect = rectOf(from);
12707
+ const toRect = rectOf(to);
12708
+ const obstacles = cardsInDrawer.filter((card) => card.id !== link2.from && card.id !== link2.to).map(rectOf);
12709
+ const faces = pickFaces(
12710
+ { id: link2.from, x: fromRect.x, y: fromRect.y },
12711
+ { id: link2.to, x: toRect.x, y: toRect.y },
12712
+ cardsInDrawer.map((card) => ({ id: card.id, x: card.x, y: card.y })),
12713
+ { cardWidth: fromRect.w, cardHeight: fromRect.h }
12714
+ );
12715
+ const points = routeEdge(
12716
+ fromRect,
12717
+ toRect,
12718
+ faces.fromHandle,
12719
+ faces.toHandle,
12720
+ [fromRect, toRect, ...obstacles]
12721
+ );
12722
+ const tip = points[points.length - 1];
12723
+ const prev = points[points.length - 2];
12724
+ const angle = Math.abs(tip.x - prev.x) >= Math.abs(tip.y - prev.y) ? tip.x >= prev.x ? 0 : 180 : tip.y >= prev.y ? 90 : -90;
12725
+ next.push({ d: roundedPath(points, 8), ax: tip.x, ay: tip.y, angle });
12462
12726
  }
12463
12727
  setWires((current) => {
12464
12728
  if (current.length === next.length && current.every((wire, index2) => wire.d === next[index2]?.d)) {
@@ -12825,7 +13089,7 @@ function StackNode(props) {
12825
13089
  }
12826
13090
 
12827
13091
  // src/client/use-dark.ts
12828
- var import_react12 = require("react");
13092
+ var import_react11 = require("react");
12829
13093
  var DARK_ATTRIBUTE = "data-ds-dark-theme";
12830
13094
  function subscribe(listener) {
12831
13095
  if (typeof document === "undefined") return () => {
@@ -12841,7 +13105,7 @@ function getSnapshot() {
12841
13105
  return document.body.hasAttribute(DARK_ATTRIBUTE);
12842
13106
  }
12843
13107
  function useDsDarkTheme() {
12844
- return (0, import_react12.useSyncExternalStore)(subscribe, getSnapshot);
13108
+ return (0, import_react11.useSyncExternalStore)(subscribe, getSnapshot);
12845
13109
  }
12846
13110
 
12847
13111
  // src/client/MapCanvas.tsx
@@ -12900,14 +13164,14 @@ function fitRect(members) {
12900
13164
  }
12901
13165
  function CanvasInner(props) {
12902
13166
  const dark = useDsDarkTheme();
12903
- const canvasState = (0, import_react13.useSyncExternalStore)(canvas.subscribe, canvas.get);
13167
+ const canvasState = (0, import_react12.useSyncExternalStore)(canvas.subscribe, canvas.get);
12904
13168
  const sessions = props.useSessions((state3) => state3);
12905
13169
  const workspaces = props.useWorkspaces((state3) => state3);
12906
13170
  const statusById = typeof props.useSessionStatus === "function" ? props.useSessionStatus((status) => status) : EMPTY_SESSION_STATUS;
12907
- const alertById = (0, import_react13.useSyncExternalStore)(sessionAlerts.subscribe, sessionAlerts.getSnapshot);
12908
- const finishedById = (0, import_react13.useSyncExternalStore)(sessionActivity.subscribe, sessionActivity.getSnapshot);
12909
- const interruptedById = (0, import_react13.useSyncExternalStore)(sessionActivity.subscribe, sessionActivity.getInterrupted);
12910
- (0, import_react13.useEffect)(() => {
13171
+ const alertById = (0, import_react12.useSyncExternalStore)(sessionAlerts.subscribe, sessionAlerts.getSnapshot);
13172
+ const finishedById = (0, import_react12.useSyncExternalStore)(sessionActivity.subscribe, sessionActivity.getSnapshot);
13173
+ const interruptedById = (0, import_react12.useSyncExternalStore)(sessionActivity.subscribe, sessionActivity.getInterrupted);
13174
+ (0, import_react12.useEffect)(() => {
12911
13175
  const onUnload = () => {
12912
13176
  sessionActivity.recordShutdown(statusById, sessions.byId);
12913
13177
  };
@@ -12916,14 +13180,14 @@ function CanvasInner(props) {
12916
13180
  window.removeEventListener("beforeunload", onUnload);
12917
13181
  };
12918
13182
  }, [statusById, sessions]);
12919
- (0, import_react13.useEffect)(() => {
13183
+ (0, import_react12.useEffect)(() => {
12920
13184
  sessionActivity.beginPanelSession();
12921
13185
  }, []);
12922
- (0, import_react13.useEffect)(() => {
13186
+ (0, import_react12.useEffect)(() => {
12923
13187
  sessionActivity.observe(statusById, sessions.byId);
12924
13188
  }, [statusById, sessions]);
12925
- const draftSessions = (0, import_react13.useSyncExternalStore)(draftWatch.subscribe, draftWatch.getSnapshot);
12926
- (0, import_react13.useEffect)(() => {
13189
+ const draftSessions = (0, import_react12.useSyncExternalStore)(draftWatch.subscribe, draftWatch.getSnapshot);
13190
+ (0, import_react12.useEffect)(() => {
12927
13191
  draftWatch.refresh();
12928
13192
  const timer4 = setInterval(() => {
12929
13193
  draftWatch.refresh();
@@ -12932,22 +13196,22 @@ function CanvasInner(props) {
12932
13196
  clearInterval(timer4);
12933
13197
  };
12934
13198
  }, []);
12935
- const [previews, setPreviews] = (0, import_react13.useState)(readPreviewTexts);
12936
- const previewStamp = (0, import_react13.useRef)(
13199
+ const [previews, setPreviews] = (0, import_react12.useState)(readPreviewTexts);
13200
+ const previewStamp = (0, import_react12.useRef)(
12937
13201
  // Only entries that still make a usable body count as cached: a rule fix that
12938
13202
  // empties an old entry must trigger a refetch, not leave a blank card.
12939
13203
  new Map(Object.entries(loadPreviewCache()).filter(([, entry]) => typeof entry?.text === "string" && cleanPreviewText(entry.text) !== "").map(([sessionId, entry]) => [sessionId, entry.stamp]))
12940
13204
  );
12941
13205
  const { screenToFlowPosition, zoomTo, setNodes } = useReactFlow();
12942
- const [selectedIds, setSelectedIds] = (0, import_react13.useState)(/* @__PURE__ */ new Set());
12943
- const [selectedEdgeIds, setSelectedEdgeIds] = (0, import_react13.useState)(/* @__PURE__ */ new Set());
12944
- const [connecting, setConnecting] = (0, import_react13.useState)(false);
12945
- const connectCancelledRef = (0, import_react13.useRef)(false);
12946
- const [toast, setToast] = (0, import_react13.useState)(null);
12947
- const toastTimer = (0, import_react13.useRef)(void 0);
12948
- const [pendingSpawn, setPendingSpawn] = (0, import_react13.useState)(null);
12949
- const [menu, setMenu] = (0, import_react13.useState)(null);
12950
- const [drawer, setDrawer] = (0, import_react13.useState)(() => {
13206
+ const [selectedIds, setSelectedIds] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
13207
+ const [selectedEdgeIds, setSelectedEdgeIds] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
13208
+ const [connecting, setConnecting] = (0, import_react12.useState)(false);
13209
+ const connectCancelledRef = (0, import_react12.useRef)(false);
13210
+ const [toast, setToast] = (0, import_react12.useState)(null);
13211
+ const toastTimer = (0, import_react12.useRef)(void 0);
13212
+ const [pendingSpawn, setPendingSpawn] = (0, import_react12.useState)(null);
13213
+ const [menu, setMenu] = (0, import_react12.useState)(null);
13214
+ const [drawer, setDrawer] = (0, import_react12.useState)(() => {
12951
13215
  const remembered = drawerState.readGroup();
12952
13216
  return remembered === null ? null : { groupId: remembered };
12953
13217
  });
@@ -12955,11 +13219,11 @@ function CanvasInner(props) {
12955
13219
  setDrawer(null);
12956
13220
  drawerState.clear();
12957
13221
  };
12958
- const [digestTarget, setDigestTarget] = (0, import_react13.useState)(null);
12959
- const [pushEpoch, setPushEpoch] = (0, import_react13.useState)(0);
13222
+ const [digestTarget, setDigestTarget] = (0, import_react12.useState)(null);
13223
+ const [pushEpoch, setPushEpoch] = (0, import_react12.useState)(0);
12960
13224
  const LINEAGE_KEY = "dsh.talk-map.lineage-hidden.v1";
12961
13225
  const LINEAGE_CUT_KEY = "dsh.talk-map.lineage-cut.v1";
12962
- const [lineageCut, setLineageCut] = (0, import_react13.useState)(() => {
13226
+ const [lineageCut, setLineageCut] = (0, import_react12.useState)(() => {
12963
13227
  try {
12964
13228
  const raw = window.localStorage.getItem(LINEAGE_CUT_KEY);
12965
13229
  const parsed = raw === null ? [] : JSON.parse(raw);
@@ -12980,7 +13244,7 @@ function CanvasInner(props) {
12980
13244
  return next;
12981
13245
  });
12982
13246
  };
12983
- const [lineageHidden, setLineageHiddenState] = (0, import_react13.useState)(() => {
13247
+ const [lineageHidden, setLineageHiddenState] = (0, import_react12.useState)(() => {
12984
13248
  try {
12985
13249
  return localStorage.getItem("dsh.talk-map.lineage-hidden.v1") === "1";
12986
13250
  } catch {
@@ -12994,34 +13258,34 @@ function CanvasInner(props) {
12994
13258
  } catch {
12995
13259
  }
12996
13260
  };
12997
- const [renameTarget, setRenameTarget] = (0, import_react13.useState)(null);
12998
- const [renamedTitles, setRenamedTitles] = (0, import_react13.useState)({});
12999
- const [renamedWorkspaces, setRenamedWorkspaces] = (0, import_react13.useState)({});
13000
- const [batchMode, setBatchMode] = (0, import_react13.useState)(false);
13001
- const [batchPicks, setBatchPicks] = (0, import_react13.useState)(/* @__PURE__ */ new Set());
13002
- const [batchBusy, setBatchBusy] = (0, import_react13.useState)(false);
13003
- const wrapperRef = (0, import_react13.useRef)(null);
13004
- const [draggingCardId, setDraggingCardId] = (0, import_react13.useState)(null);
13005
- const [liveFrame, setLiveFrame] = (0, import_react13.useState)(null);
13006
- const [blockedFrame, setBlockedFrame] = (0, import_react13.useState)(null);
13007
- const [dragCenter, setDragCenter] = (0, import_react13.useState)(null);
13008
- const [isSelecting, setIsSelecting] = (0, import_react13.useState)(false);
13009
- const frozenRef = (0, import_react13.useRef)(null);
13010
- const locale = (0, import_react13.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
13011
- const sessionWs = (0, import_react13.useMemo)(() => sessionWorkspaceIndex(workspaces), [workspaces]);
13012
- const wsTitles = (0, import_react13.useMemo)(
13261
+ const [renameTarget, setRenameTarget] = (0, import_react12.useState)(null);
13262
+ const [renamedTitles, setRenamedTitles] = (0, import_react12.useState)({});
13263
+ const [renamedWorkspaces, setRenamedWorkspaces] = (0, import_react12.useState)({});
13264
+ const [batchMode, setBatchMode] = (0, import_react12.useState)(false);
13265
+ const [batchPicks, setBatchPicks] = (0, import_react12.useState)(/* @__PURE__ */ new Set());
13266
+ const [batchBusy, setBatchBusy] = (0, import_react12.useState)(false);
13267
+ const wrapperRef = (0, import_react12.useRef)(null);
13268
+ const [draggingCardId, setDraggingCardId] = (0, import_react12.useState)(null);
13269
+ const [liveFrame, setLiveFrame] = (0, import_react12.useState)(null);
13270
+ const [blockedFrame, setBlockedFrame] = (0, import_react12.useState)(null);
13271
+ const [dragCenter, setDragCenter] = (0, import_react12.useState)(null);
13272
+ const [isSelecting, setIsSelecting] = (0, import_react12.useState)(false);
13273
+ const frozenRef = (0, import_react12.useRef)(null);
13274
+ const locale = (0, import_react12.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
13275
+ const sessionWs = (0, import_react12.useMemo)(() => sessionWorkspaceIndex(workspaces), [workspaces]);
13276
+ const wsTitles = (0, import_react12.useMemo)(
13013
13277
  () => new Map(workspaces.items.map((item) => [item.workspaceId, item.title])),
13014
13278
  [workspaces]
13015
13279
  );
13016
13280
  const workspacesReady = workspaces.baselinesReady !== false;
13017
- const pinnedSessions = (0, import_react13.useMemo)(() => new Set(workspaces.pinnedSessionIds ?? []), [workspaces]);
13018
- const boardSessionIds = (0, import_react13.useMemo)(
13281
+ const pinnedSessions = (0, import_react12.useMemo)(() => new Set(workspaces.pinnedSessionIds ?? []), [workspaces]);
13282
+ const boardSessionIds = (0, import_react12.useMemo)(
13019
13283
  () => new Set(Object.values(canvasState.cards).map((card) => card.sessionId)),
13020
13284
  [canvasState.cards]
13021
13285
  );
13022
13286
  const wsFrames = canvasState.global?.wsFrames ?? {};
13023
13287
  const layoutVersion = canvasState.global?.layoutVersion ?? 1;
13024
- (0, import_react13.useEffect)(() => {
13288
+ (0, import_react12.useEffect)(() => {
13025
13289
  if (canvasState.phase !== "ready" || layoutVersion >= LAYOUT_VERSION || !workspacesReady) return;
13026
13290
  const byGroup = /* @__PURE__ */ new Map();
13027
13291
  for (const card of Object.values(canvasState.cards)) {
@@ -13040,7 +13304,7 @@ function CanvasInner(props) {
13040
13304
  }
13041
13305
  canvas.patchGlobalNow({ layoutVersion: LAYOUT_VERSION, wsFrames: framesNext });
13042
13306
  }, [canvasState.phase, layoutVersion, workspacesReady, canvasState.cards, canvasState.global, sessionWs]);
13043
- const visibleCards = (0, import_react13.useMemo)(() => {
13307
+ const visibleCards = (0, import_react12.useMemo)(() => {
13044
13308
  const out = {};
13045
13309
  for (const [cardId, card] of Object.entries(canvasState.cards)) {
13046
13310
  if (sessions.byId[card.sessionId]?.blank === true) continue;
@@ -13048,11 +13312,11 @@ function CanvasInner(props) {
13048
13312
  }
13049
13313
  return out;
13050
13314
  }, [canvasState.cards, sessions]);
13051
- const previewInputs = (0, import_react13.useRef)({ cards: visibleCards, sessions });
13315
+ const previewInputs = (0, import_react12.useRef)({ cards: visibleCards, sessions });
13052
13316
  previewInputs.current = { cards: visibleCards, sessions };
13053
- const previewTick = (0, import_react13.useRef)(() => {
13317
+ const previewTick = (0, import_react12.useRef)(() => {
13054
13318
  });
13055
- (0, import_react13.useEffect)(() => {
13319
+ (0, import_react12.useEffect)(() => {
13056
13320
  const tick = () => {
13057
13321
  const { cards, sessions: latest } = previewInputs.current;
13058
13322
  const pending = [];
@@ -13084,10 +13348,10 @@ function CanvasInner(props) {
13084
13348
  clearInterval(timer4);
13085
13349
  };
13086
13350
  }, []);
13087
- (0, import_react13.useEffect)(() => {
13351
+ (0, import_react12.useEffect)(() => {
13088
13352
  previewTick.current();
13089
13353
  }, [visibleCards]);
13090
- const membersByGroup = (0, import_react13.useMemo)(() => {
13354
+ const membersByGroup = (0, import_react12.useMemo)(() => {
13091
13355
  const index2 = /* @__PURE__ */ new Map();
13092
13356
  for (const [cardId, card] of Object.entries(visibleCards)) {
13093
13357
  const groupId = sessionWs.get(card.sessionId);
@@ -13096,7 +13360,7 @@ function CanvasInner(props) {
13096
13360
  }
13097
13361
  return index2;
13098
13362
  }, [visibleCards, sessionWs]);
13099
- const frameRects = (0, import_react13.useMemo)(() => {
13363
+ const frameRects = (0, import_react12.useMemo)(() => {
13100
13364
  const out = {};
13101
13365
  for (const [groupId, stored] of Object.entries(wsFrames)) {
13102
13366
  const base = liveFrame !== null && liveFrame.groupId === groupId ? liveFrame.rect : stored;
@@ -13104,7 +13368,7 @@ function CanvasInner(props) {
13104
13368
  }
13105
13369
  return out;
13106
13370
  }, [wsFrames, liveFrame]);
13107
- const folderLayouts = (0, import_react13.useMemo)(() => {
13371
+ const folderLayouts = (0, import_react12.useMemo)(() => {
13108
13372
  const out = {};
13109
13373
  for (const [groupId, rect] of Object.entries(frameRects)) {
13110
13374
  const members = (membersByGroup.get(groupId) ?? []).map((cardId) => {
@@ -13136,21 +13400,21 @@ function CanvasInner(props) {
13136
13400
  }
13137
13401
  return out;
13138
13402
  }, [frameRects, membersByGroup, visibleCards, pinnedSessions, draggingCardId, dragCenter]);
13139
- const cardLayout = (0, import_react13.useMemo)(() => {
13403
+ const cardLayout = (0, import_react12.useMemo)(() => {
13140
13404
  const out = {};
13141
13405
  for (const layout of Object.values(folderLayouts)) {
13142
13406
  Object.assign(out, layoutFor(layout.rect, layout.ordered));
13143
13407
  }
13144
13408
  return out;
13145
13409
  }, [folderLayouts]);
13146
- const foldedCards = (0, import_react13.useMemo)(() => {
13410
+ const foldedCards = (0, import_react12.useMemo)(() => {
13147
13411
  const out = {};
13148
13412
  for (const [groupId, layout] of Object.entries(folderLayouts)) {
13149
13413
  if (layout.folded.length > 0) out[groupId] = layout.folded;
13150
13414
  }
13151
13415
  return out;
13152
13416
  }, [folderLayouts]);
13153
- (0, import_react13.useEffect)(() => {
13417
+ (0, import_react12.useEffect)(() => {
13154
13418
  if (canvasState.phase !== "ready") return;
13155
13419
  if (draggingCardId !== null || liveFrame !== null) return;
13156
13420
  const stale = {};
@@ -13161,8 +13425,8 @@ function CanvasInner(props) {
13161
13425
  }
13162
13426
  if (Object.keys(stale).length > 0) canvas.moveCards(stale);
13163
13427
  }, [cardLayout, canvasState.cards, canvasState.phase, draggingCardId, liveFrame]);
13164
- const foldedSet = (0, import_react13.useMemo)(() => new Set(Object.values(foldedCards).flat()), [foldedCards]);
13165
- (0, import_react13.useEffect)(() => {
13428
+ const foldedSet = (0, import_react12.useMemo)(() => new Set(Object.values(foldedCards).flat()), [foldedCards]);
13429
+ (0, import_react12.useEffect)(() => {
13166
13430
  if (canvasState.phase !== "ready") return;
13167
13431
  if (draggingCardId !== null || liveFrame !== null) return;
13168
13432
  const seen = lastActivitySeen;
@@ -13197,8 +13461,8 @@ function CanvasInner(props) {
13197
13461
  for (const [sessionId, stamp] of stamps) seen.set(sessionId, stamp);
13198
13462
  if (Object.keys(promoted).length > 0) canvas.moveCards(promoted);
13199
13463
  }, [canvasState.phase, visibleCards, sessions, folderLayouts, draggingCardId, liveFrame, pinnedSessions]);
13200
- const autoSyncedRef = (0, import_react13.useRef)(false);
13201
- (0, import_react13.useEffect)(() => {
13464
+ const autoSyncedRef = (0, import_react12.useRef)(false);
13465
+ (0, import_react12.useEffect)(() => {
13202
13466
  if (canvasState.phase !== "ready" || !workspacesReady || autoSyncedRef.current) return;
13203
13467
  autoSyncedRef.current = true;
13204
13468
  const remembered = canvasState.global?.layoutMemory ?? {};
@@ -13258,7 +13522,7 @@ function CanvasInner(props) {
13258
13522
  }
13259
13523
  if (Object.keys(added).length > 0) canvas.addCards(added);
13260
13524
  }, [canvasState.phase, canvasState.cards, canvasState.global, workspacesReady, wsFrames, frameRects, membersByGroup, sessions, sessionWs, boardSessionIds]);
13261
- (0, import_react13.useEffect)(() => {
13525
+ (0, import_react12.useEffect)(() => {
13262
13526
  if (!connecting) return;
13263
13527
  const release = mapUi.claimEscape("connecting");
13264
13528
  const onKeyDown = (event) => {
@@ -13279,7 +13543,7 @@ function CanvasInner(props) {
13279
13543
  release();
13280
13544
  };
13281
13545
  }, [connecting]);
13282
- (0, import_react13.useEffect)(() => {
13546
+ (0, import_react12.useEffect)(() => {
13283
13547
  const onKeyDown = (event) => {
13284
13548
  if (!(event.metaKey || event.ctrlKey) || event.code !== "KeyZ") return;
13285
13549
  const target = event.target;
@@ -13294,7 +13558,7 @@ function CanvasInner(props) {
13294
13558
  window.removeEventListener("keydown", onKeyDown, { capture: true });
13295
13559
  };
13296
13560
  }, []);
13297
- const liveSelectedIds = (0, import_react13.useMemo)(() => {
13561
+ const liveSelectedIds = (0, import_react12.useMemo)(() => {
13298
13562
  const next = /* @__PURE__ */ new Set();
13299
13563
  for (const id2 of selectedIds) {
13300
13564
  if (id2.startsWith("frame-")) {
@@ -13305,7 +13569,7 @@ function CanvasInner(props) {
13305
13569
  }
13306
13570
  return next;
13307
13571
  }, [selectedIds, visibleCards, wsFrames]);
13308
- const liveSelectedEdgeIds = (0, import_react13.useMemo)(() => {
13572
+ const liveSelectedEdgeIds = (0, import_react12.useMemo)(() => {
13309
13573
  const next = /* @__PURE__ */ new Set();
13310
13574
  for (const id2 of selectedEdgeIds) {
13311
13575
  if (canvasState.edges[id2] !== void 0) next.add(id2);
@@ -13313,7 +13577,7 @@ function CanvasInner(props) {
13313
13577
  return next;
13314
13578
  }, [selectedEdgeIds, canvasState.edges]);
13315
13579
  const hasSelection = liveSelectedIds.size > 0 || liveSelectedEdgeIds.size > 0;
13316
- (0, import_react13.useEffect)(() => {
13580
+ (0, import_react12.useEffect)(() => {
13317
13581
  if (!hasSelection) return;
13318
13582
  const release = mapUi.claimEscape("selection");
13319
13583
  const onKeyDown = (event) => {
@@ -13342,7 +13606,7 @@ function CanvasInner(props) {
13342
13606
  release();
13343
13607
  };
13344
13608
  });
13345
- (0, import_react13.useEffect)(() => {
13609
+ (0, import_react12.useEffect)(() => {
13346
13610
  if (!batchMode) return;
13347
13611
  const release = mapUi.claimEscape("batch-mode");
13348
13612
  const onKeyDown = (event) => {
@@ -13435,7 +13699,7 @@ function CanvasInner(props) {
13435
13699
  if (status?.completionUnread === true || finishedById.has(sessionId)) return "done";
13436
13700
  return void 0;
13437
13701
  };
13438
- const liveNodes = (0, import_react13.useMemo)(() => {
13702
+ const liveNodes = (0, import_react12.useMemo)(() => {
13439
13703
  const wsColors = canvasState.global?.wsColors ?? {};
13440
13704
  const frameNodes = Object.entries(frameRects).map(([groupId, rect]) => {
13441
13705
  const members = membersByGroup.get(groupId) ?? [];
@@ -13546,7 +13810,7 @@ function CanvasInner(props) {
13546
13810
  });
13547
13811
  return [...frameNodes, ...cardNodes, ...stackNodes];
13548
13812
  }, [frameRects, folderLayouts, foldedCards, foldedSet, cardLayout, draggingCardId, membersByGroup, wsTitles, visibleCards, canvasState.digests, canvasState.global, sessions, statusById, alertById, finishedById, interruptedById, draftSessions, previews, pinnedSessions, renamedTitles, renamedWorkspaces, liveSelectedIds, batchMode, batchPicks, locale]);
13549
- const sessionIdToCardId = (0, import_react13.useMemo)(() => {
13813
+ const sessionIdToCardId = (0, import_react12.useMemo)(() => {
13550
13814
  const index2 = /* @__PURE__ */ new Map();
13551
13815
  for (const [cardId, card] of Object.entries(visibleCards)) {
13552
13816
  if (!index2.has(card.sessionId)) index2.set(card.sessionId, cardId);
@@ -13565,6 +13829,22 @@ function CanvasInner(props) {
13565
13829
  if (card === void 0) return void 0;
13566
13830
  return sessions.byId[card.sessionId]?.updatedAt;
13567
13831
  };
13832
+ const routeFor = (fromCardId, toCardId) => {
13833
+ const fromCard = canvasState.cards[fromCardId];
13834
+ const toCard = canvasState.cards[toCardId];
13835
+ if (fromCard === void 0 || toCard === void 0) return [];
13836
+ const faces = sideHandles(fromCardId, toCardId);
13837
+ const fromRect = { x: fromCard.x, y: fromCard.y, w: CARD_W, h: CARD_H };
13838
+ const toRect = { x: toCard.x, y: toCard.y, w: CARD_W, h: CARD_H };
13839
+ const others = Object.entries(canvasState.cards).filter(([id2]) => id2 !== fromCardId && id2 !== toCardId).filter(([id2]) => !foldedSet.has(id2)).map(([, card]) => ({ x: card.x, y: card.y, w: CARD_W, h: CARD_H }));
13840
+ return routeEdge(
13841
+ fromRect,
13842
+ toRect,
13843
+ faces.fromHandle,
13844
+ faces.toHandle,
13845
+ [fromRect, toRect, ...others]
13846
+ );
13847
+ };
13568
13848
  const routingObstacles = () => Object.entries(canvasState.cards).map(([id2, card]) => ({
13569
13849
  id: id2,
13570
13850
  x: card.x,
@@ -13589,7 +13869,7 @@ function CanvasInner(props) {
13589
13869
  const picked = sideHandles(fromCardId, toCardId);
13590
13870
  return { sourceHandle: picked.fromHandle, targetHandle: picked.toHandle };
13591
13871
  };
13592
- const liveEdges = (0, import_react13.useMemo)(() => {
13872
+ const liveEdges = (0, import_react12.useMemo)(() => {
13593
13873
  const out = [];
13594
13874
  const present = new Set(Object.keys(visibleCards).filter((cardId) => !foldedSet.has(cardId)));
13595
13875
  const explicitPairs = /* @__PURE__ */ new Set();
@@ -13614,7 +13894,12 @@ function CanvasInner(props) {
13614
13894
  selected: liveSelectedEdgeIds.has(edgeId),
13615
13895
  // Endpoints ride along for the edge context menu (id parsing would
13616
13896
  // be ambiguous — card ids contain dashes); `sync` drives the look.
13617
- data: { fromCardId: edge.fromCardId, toCardId: edge.toCardId, sync },
13897
+ data: {
13898
+ fromCardId: edge.fromCardId,
13899
+ toCardId: edge.toCardId,
13900
+ sync,
13901
+ route: routeFor(edge.fromCardId, edge.toCardId)
13902
+ },
13618
13903
  // Every line carries its direction now: 「推送摘要」 always travels
13619
13904
  // source → target, so a link edge gets a lighter arrow instead of none.
13620
13905
  markerEnd: {
@@ -13663,7 +13948,13 @@ function CanvasInner(props) {
13663
13948
  // Same two looks as any other line.
13664
13949
  // structural: a fork link is part of the map, not a transfer, so it
13665
13950
  // stays visible even when the pair is in sync.
13666
- data: { fromCardId: parentCardId, toCardId: cardId, sync: lineageSync, structural: true },
13951
+ data: {
13952
+ fromCardId: parentCardId,
13953
+ toCardId: cardId,
13954
+ sync: lineageSync,
13955
+ structural: true,
13956
+ route: routeFor(parentCardId, cardId)
13957
+ },
13667
13958
  // No inline stroke: inline style beats everything the renderer draws.
13668
13959
  style: { opacity: 0.85 }
13669
13960
  });
@@ -13671,7 +13962,7 @@ function CanvasInner(props) {
13671
13962
  }
13672
13963
  return out;
13673
13964
  }, [visibleCards, canvasState.edges, sessions, sessionIdToCardId, liveSelectedEdgeIds, foldedSet, locale, pushEpoch, lineageHidden]);
13674
- const drawerWireLinks = (0, import_react13.useMemo)(() => {
13965
+ const drawerWireLinks = (0, import_react12.useMemo)(() => {
13675
13966
  if (drawer === null) return [];
13676
13967
  const layout = folderLayouts[drawer.groupId];
13677
13968
  const inFolder = new Set(layout === void 0 ? [] : [...layout.shown, ...layout.folded]);
@@ -13801,8 +14092,8 @@ function CanvasInner(props) {
13801
14092
  }
13802
14093
  if (removedIds.length > 0) canvas.removeEdges(removedIds);
13803
14094
  };
13804
- const mountedRef = (0, import_react13.useRef)(true);
13805
- (0, import_react13.useEffect)(() => {
14095
+ const mountedRef = (0, import_react12.useRef)(true);
14096
+ (0, import_react12.useEffect)(() => {
13806
14097
  mountedRef.current = true;
13807
14098
  return () => {
13808
14099
  mountedRef.current = false;
@@ -13958,7 +14249,7 @@ function CanvasInner(props) {
13958
14249
  agent: hit.agent,
13959
14250
  depth: hit.depth
13960
14251
  });
13961
- (0, import_react13.useEffect)(() => {
14252
+ (0, import_react12.useEffect)(() => {
13962
14253
  setTitleResolver((sessionId) => renamedTitles[sessionId] ?? sessions.byId[sessionId]?.displayTitle);
13963
14254
  setCardTable(Object.entries(canvasState.cards).map(([cardId, card]) => ({
13964
14255
  cardId,
@@ -14068,11 +14359,11 @@ function CanvasInner(props) {
14068
14359
  canvas.moveCard(id2, point.x, point.y);
14069
14360
  });
14070
14361
  };
14071
- const selectedCardIds = (0, import_react13.useMemo)(
14362
+ const selectedCardIds = (0, import_react12.useMemo)(
14072
14363
  () => [...batchPicks].filter((id2) => visibleCards[id2] !== void 0),
14073
14364
  [batchPicks, visibleCards]
14074
14365
  );
14075
- const selectedFrameWs = (0, import_react13.useMemo)(
14366
+ const selectedFrameWs = (0, import_react12.useMemo)(
14076
14367
  () => [...liveSelectedIds].filter((id2) => id2.startsWith("frame-")).map((id2) => id2.slice("frame-".length)),
14077
14368
  [liveSelectedIds]
14078
14369
  );
@@ -14209,7 +14500,7 @@ function CanvasInner(props) {
14209
14500
  view: "root"
14210
14501
  });
14211
14502
  };
14212
- const menuState = (0, import_react13.useMemo)(() => {
14503
+ const menuState = (0, import_react12.useMemo)(() => {
14213
14504
  if (menu === null) return null;
14214
14505
  const close = () => {
14215
14506
  setMenu(null);
@@ -14734,8 +15025,8 @@ function BatchBar(props) {
14734
15025
  ] });
14735
15026
  }
14736
15027
  function MapCanvas(props) {
14737
- const canvasState = (0, import_react13.useSyncExternalStore)(canvas.subscribe, canvas.get);
14738
- (0, import_react13.useEffect)(() => {
15028
+ const canvasState = (0, import_react12.useSyncExternalStore)(canvas.subscribe, canvas.get);
15029
+ (0, import_react12.useEffect)(() => {
14739
15030
  canvas.ensureLoaded();
14740
15031
  canvas.refresh();
14741
15032
  return canvas.connect();
@@ -14768,7 +15059,7 @@ function MapCanvas(props) {
14768
15059
  // src/client/MapOverlay.tsx
14769
15060
  var import_jsx_runtime16 = require("react/jsx-runtime");
14770
15061
  function FontSizeButtons() {
14771
- const step2 = (0, import_react15.useSyncExternalStore)(fontScale.subscribe, fontScale.getSnapshot);
15062
+ const step2 = (0, import_react14.useSyncExternalStore)(fontScale.subscribe, fontScale.getSnapshot);
14772
15063
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: talk_map_default["fontGroup"], role: "group", "aria-label": t("font.group"), children: [
14773
15064
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
14774
15065
  "button",
@@ -14827,9 +15118,9 @@ function CloseIcon() {
14827
15118
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M6 6l12 12M18 6L6 18" }) });
14828
15119
  }
14829
15120
  function MapOverlay(props) {
14830
- (0, import_react15.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
14831
- const fontStep = (0, import_react15.useSyncExternalStore)(fontScale.subscribe, fontScale.getSnapshot);
14832
- (0, import_react15.useEffect)(() => {
15121
+ (0, import_react14.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
15122
+ const fontStep = (0, import_react14.useSyncExternalStore)(fontScale.subscribe, fontScale.getSnapshot);
15123
+ (0, import_react14.useEffect)(() => {
14833
15124
  mapUi.setOpen(true);
14834
15125
  hideSidebarForMap();
14835
15126
  return () => {
@@ -14837,7 +15128,7 @@ function MapOverlay(props) {
14837
15128
  restoreSidebarAfterMap();
14838
15129
  };
14839
15130
  }, []);
14840
- (0, import_react15.useEffect)(() => {
15131
+ (0, import_react14.useEffect)(() => {
14841
15132
  const onKeyDown = (event) => {
14842
15133
  if (event.key !== "Escape") return;
14843
15134
  if (mapUi.escapeClaimed()) return;
@@ -14897,7 +15188,7 @@ function MapOverlay(props) {
14897
15188
  }
14898
15189
 
14899
15190
  // src/client/MapToggleButton.tsx
14900
- var import_react16 = require("react");
15191
+ var import_react15 = require("react");
14901
15192
  var import_jsx_runtime17 = require("react/jsx-runtime");
14902
15193
  function MapIcon() {
14903
15194
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { className: talk_map_default["toggleIcon"], viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
@@ -14907,10 +15198,10 @@ function MapIcon() {
14907
15198
  ] });
14908
15199
  }
14909
15200
  function MapToggleButton(props) {
14910
- const open = (0, import_react16.useSyncExternalStore)(mapUi.subscribe, () => mapUi.get().open);
14911
- const locale = (0, import_react16.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
15201
+ const open = (0, import_react15.useSyncExternalStore)(mapUi.subscribe, () => mapUi.get().open);
15202
+ const locale = (0, import_react15.useSyncExternalStore)(subscribeLocale, activeLocale, activeLocale);
14912
15203
  const wide = props.wide;
14913
- (0, import_react16.useEffect)(() => {
15204
+ (0, import_react15.useEffect)(() => {
14914
15205
  reportSidebarWide(wide);
14915
15206
  }, [wide]);
14916
15207
  const classNames = [wide ? talk_map_default["toggleRow"] : talk_map_default["toggleButton"]];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
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",
@@ -10,14 +10,13 @@
10
10
  "url": "git+https://github.com/Da0Mine/dsh-talk-map.git"
11
11
  },
12
12
  "keywords": [
13
- "deepseek",
14
- "harness",
15
13
  "dsh",
16
14
  "dsh-plugin",
17
- "canvas",
18
- "whiteboard",
15
+ "deepseek-harness",
16
+ "talk-map",
19
17
  "conversation-map",
20
- "adhd"
18
+ "whiteboard",
19
+ "session-manager"
21
20
  ],
22
21
  "scripts": {
23
22
  "build": "tsdown && node scripts/normalize-client-banner.mjs",
@@ -74,7 +73,8 @@
74
73
  "typescript": "^7.0.2"
75
74
  },
76
75
  "engines": {
77
- "node": ">=22.19.0"
76
+ "node": ">=22.19.0",
77
+ "dsh": ">=0.2.1-rc.1 <0.3.0-0"
78
78
  },
79
79
  "publishConfig": {
80
80
  "registry": "https://registry.npmjs.org/",