dsh-talk-map 0.1.4 → 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.
Files changed (2) hide show
  1. package/client/client.js +432 -141
  2. package/package.json +1 -1
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.4",
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",