dsh-plugin-inspiration-workbench 0.8.0 → 0.10.0

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
@@ -38,9 +38,9 @@ DSH 一次只能打开一个会话:想同时看三条线的进展,只能来
38
38
  |---|---|
39
39
  | ![fanout](docs/screenshots/pipeline-fanout.png) | ![note target](docs/screenshots/pipeline-note.png) |
40
40
 
41
- | 端口在四边中点,随便哪个方向都能连 |
42
- |---|
43
- | ![ports](docs/screenshots/pipeline-ports.png) |
41
+ | 端口在四边中点,静止时是极淡的小点 | 悬停卡片后展开成带光环的把手 |
42
+ |---|---|
43
+ | ![ports](docs/screenshots/pipeline-ports-dark.png) | ![ports hover](docs/screenshots/pipeline-ports-hover.png) |
44
44
 
45
45
  | 便签投递带标题和时间戳 | 便签可设为「只保留最新」 |
46
46
  |---|---|
package/lib/client.js CHANGED
@@ -505,32 +505,62 @@ var styles_default = `/* Inspiration workbench \u2014 scoped to .iwb-root; colou
505
505
  overflow: visible; pointer-events: none; z-index: 1;
506
506
  }
507
507
  .iwb-links path.iwb-link {
508
- fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.6;
509
- opacity: .55; pointer-events: stroke; cursor: pointer;
508
+ fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.5;
509
+ stroke-linecap: round; opacity: .5; pointer-events: stroke; cursor: pointer;
510
+ transition: opacity .15s ease, stroke-width .15s ease;
510
511
  }
511
- .iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2; }
512
+ .iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2.2; }
512
513
  .iwb-links path.iwb-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
513
- .iwb-links path.iwb-link-temp { fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 2; stroke-dasharray: 5 4; opacity: .9; }
514
- /* Connection handles: one at the middle of each edge, always visible. */
514
+ .iwb-links path.iwb-link-temp {
515
+ fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.8;
516
+ stroke-dasharray: 3 5; stroke-linecap: round; opacity: .75;
517
+ animation: iwb-flow 1s linear infinite;
518
+ }
519
+ .iwb-links path.iwb-link-arrow {
520
+ fill: var(--dsw-alias-label-deep-diving); opacity: .45; pointer-events: none;
521
+ }
522
+ .iwb-links path.iwb-link.iwb-link-active {
523
+ stroke-width: 2; opacity: .8;
524
+ stroke-dasharray: 7 7; animation: iwb-flow 1.1s linear infinite;
525
+ }
526
+ @keyframes iwb-flow { to { stroke-dashoffset: -28; } }
527
+ /* Connection handles: a whisper by default, a crisp ring on card hover. */
515
528
  .iwb-port {
516
- position: absolute; width: 16px; height: 16px; border-radius: 50%;
517
- border: 2px solid var(--dsw-alias-label-deep-diving);
518
- background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
519
- opacity: .62; transition: opacity .12s, transform .12s, background .12s; z-index: 3;
520
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 70%, transparent);
521
- }
522
- .iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port { opacity: .95; }
523
- .iwb-port:hover { opacity: 1; transform: scale(1.15); background: var(--dsw-alias-bg-layer-2); }
529
+ position: absolute; width: 10px; height: 10px; border-radius: 50%;
530
+ border: 0; background: var(--dsw-alias-label-deep-diving);
531
+ opacity: .38; transform: scale(.9); cursor: crosshair; z-index: 3;
532
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 55%, transparent);
533
+ transition: opacity .18s ease, transform .18s cubic-bezier(.2, .8, .3, 1.2), box-shadow .18s ease, background .18s ease;
534
+ }
535
+ .iwb-card:hover .iwb-port,
536
+ .iwb-card.iwb-focus .iwb-port {
537
+ width: 12px; height: 12px; opacity: .95; transform: scale(1);
538
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 16%, transparent);
539
+ }
540
+ .iwb-port:hover {
541
+ background: var(--dsw-alias-label-deep-diving);
542
+ transform: scale(1.25);
543
+ box-shadow: 0 0 0 4px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 20%, transparent);
544
+ }
524
545
  .iwb-port::after {
525
- content: "+"; position: absolute; inset: 0; display: grid; place-items: center;
526
- font-size: 11px; line-height: 1; font-weight: 500; color: var(--dsw-alias-label-deep-diving);
527
- }
528
- .iwb-port[data-side="right"] { right: -8px; top: calc(50% - 8px); }
529
- .iwb-port[data-side="left"] { left: -8px; top: calc(50% - 8px); }
530
- .iwb-port[data-side="top"] { top: -8px; left: calc(50% - 8px); }
531
- .iwb-port[data-side="bottom"] { bottom: -8px; left: calc(50% - 8px); }
532
- .iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
533
- .iwb-card-note.iwb-link-target { outline-style: solid; }
546
+ content: ""; position: absolute; inset: 0; border-radius: 50%;
547
+ box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent);
548
+ }
549
+ .iwb-port[data-side="right"] { right: -5px; top: calc(50% - 5px); }
550
+ .iwb-port[data-side="left"] { left: -5px; top: calc(50% - 5px); }
551
+ .iwb-port[data-side="top"] { top: -5px; left: calc(50% - 5px); }
552
+ .iwb-port[data-side="bottom"] { bottom: -5px; left: calc(50% - 5px); }
553
+ .iwb-card:hover .iwb-port[data-side="right"] { right: -6px; top: calc(50% - 6px); }
554
+ .iwb-card:hover .iwb-port[data-side="left"] { left: -6px; top: calc(50% - 6px); }
555
+ .iwb-card:hover .iwb-port[data-side="top"] { top: -6px; left: calc(50% - 6px); }
556
+ .iwb-card:hover .iwb-port[data-side="bottom"] { bottom: -6px; left: calc(50% - 6px); }
557
+
558
+ .iwb-card.iwb-link-target {
559
+ outline: 1.5px solid color-mix(in srgb, var(--dsw-alias-label-deep-diving) 60%, transparent);
560
+ outline-offset: 4px;
561
+ box-shadow: 0 0 0 8px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 7%, transparent);
562
+ }
563
+ .iwb-card-note.iwb-link-target { outline-color: color-mix(in srgb, var(--dsw-alias-label-deep-diving) 55%, transparent); }
534
564
  .iwb-link-menu { min-width: 230px; }
535
565
  .iwb-link-remove .iwb-model-name { color: var(--dsw-alias-state-error-primary); }
536
566
 
@@ -3828,6 +3858,15 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3828
3858
  if (Math.abs(dx) >= Math.abs(dy)) return dx > 0 ? "left" : "right";
3829
3859
  return dy > 0 ? "top" : "bottom";
3830
3860
  }
3861
+ function arrowPath(point, side) {
3862
+ const normal = EDGE_NORMAL[side] || EDGE_NORMAL.left;
3863
+ const perp = { x: -normal.y, y: normal.x };
3864
+ const tip = { x: point.x - normal.x * 1, y: point.y - normal.y * 1 };
3865
+ const base = { x: point.x + normal.x * 7, y: point.y + normal.y * 7 };
3866
+ const left = { x: base.x + perp.x * 3.2, y: base.y + perp.y * 3.2 };
3867
+ const right = { x: base.x - perp.x * 3.2, y: base.y - perp.y * 3.2 };
3868
+ return "M " + tip.x + " " + tip.y + " L " + left.x + " " + left.y + " L " + right.x + " " + right.y + " Z";
3869
+ }
3831
3870
  function linkPath(from, to, fromSide, toSide) {
3832
3871
  const distance = Math.hypot(to.x - from.x, to.y - from.y);
3833
3872
  const bend = Math.max(36, Math.min(140, distance * 0.42));
@@ -3856,9 +3895,12 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
3856
3895
  });
3857
3896
  const path = document.createElementNS(SVG_NS, "path");
3858
3897
  path.setAttribute("d", d);
3859
- path.setAttribute("class", "iwb-link");
3898
+ path.setAttribute("class", "iwb-link" + (card.running ? " iwb-link-active" : ""));
3860
3899
  if (target.mode === "draft") path.setAttribute("stroke-dasharray", "4 4");
3861
- linkLayer.append(hit, path);
3900
+ const arrow = document.createElementNS(SVG_NS, "path");
3901
+ arrow.setAttribute("d", arrowPath(edgeAnchor(targetCard, toSide), toSide));
3902
+ arrow.setAttribute("class", "iwb-link-arrow");
3903
+ linkLayer.append(hit, path, arrow);
3862
3904
  }
3863
3905
  }
3864
3906
  }
@@ -4198,6 +4240,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
4198
4240
  saveSoon();
4199
4241
  }
4200
4242
  function markDirty(card) {
4243
+ hydratePending = false;
4201
4244
  if (disposed) return;
4202
4245
  dirty.add(card);
4203
4246
  if (frame) return;
@@ -4881,6 +4924,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
4881
4924
  }
4882
4925
  function save() {
4883
4926
  if (disposed || suppressSave) return;
4927
+ if (hydratePending) return;
4884
4928
  try {
4885
4929
  const payload = layoutPayload();
4886
4930
  localUpdatedAt = payload.updatedAt;
@@ -4907,8 +4951,14 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
4907
4951
  }
4908
4952
  approvals?.setEnabled?.(state.settings.inlineApprovals);
4909
4953
  if (!saved || !Array.isArray(saved.cards)) {
4954
+ hydratePending = true;
4910
4955
  syncApprovalSessions();
4911
- void syncFromRemote().then(() => startRemoteSync());
4956
+ void syncFromRemote().then((applied) => {
4957
+ hydratePending = false;
4958
+ if (!applied && !saveTimer) {
4959
+ }
4960
+ startRemoteSync();
4961
+ });
4912
4962
  void loadCanvases();
4913
4963
  return false;
4914
4964
  }
@@ -5042,6 +5092,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
5042
5092
  let interactionActive = false;
5043
5093
  let remoteRev = 0;
5044
5094
  let localUpdatedAt = 0;
5095
+ let hydratePending = false;
5045
5096
  let applyingRemote = false;
5046
5097
  let firstRemoteSync = true;
5047
5098
  const clientId = Math.random().toString(36).slice(2) + Date.now().toString(36);
@@ -5573,9 +5624,11 @@ function fold(entries) {
5573
5624
  }
5574
5625
  if (liveReasoning.trim()) push({ k: "reasoning", text: liveReasoning.trim() });
5575
5626
  if (liveText.trim()) push({ k: "assistant", text: liveText, live: true });
5627
+ const placed = /* @__PURE__ */ new Set();
5576
5628
  for (let index = 0; index < items.length; index += 1) {
5577
5629
  const entry = items[index];
5578
- if (entry.k !== "turnProcess") continue;
5630
+ if (entry.k !== "turnProcess" || placed.has(entry)) continue;
5631
+ placed.add(entry);
5579
5632
  const first = items.findIndex((candidate) => candidate.k !== "turnProcess" && candidate.turn === entry.turn);
5580
5633
  if (first < 0) continue;
5581
5634
  let anchor = first;
@@ -5587,8 +5640,9 @@ function fold(entries) {
5587
5640
  }
5588
5641
  if (anchor === index) continue;
5589
5642
  items.splice(index, 1);
5590
- items.splice(index < anchor ? anchor - 1 : anchor, 0, entry);
5591
- index = Math.max(0, index < anchor ? anchor - 1 : anchor);
5643
+ const insertAt = index < anchor ? anchor - 1 : anchor;
5644
+ items.splice(insertAt, 0, entry);
5645
+ index = Math.max(index, insertAt);
5592
5646
  }
5593
5647
  const truncated = items.length > MAX_ITEMS;
5594
5648
  return {