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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-inspiration-workbench",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Open many DeepSeek Harness sessions side by side as draggable, stackable cards on a free canvas.",
@@ -29,6 +29,8 @@ function formatElapsed(ms) {
29
29
  return Math.floor(seconds / 60) + 'm' + String(seconds % 60).padStart(2, '0') + 's';
30
30
  }
31
31
 
32
+
33
+
32
34
  export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
33
35
  const { appendMarkdownLite } = createMarkdown({ t });
34
36
  const state = {
@@ -1476,6 +1478,17 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1476
1478
  return dy > 0 ? 'top' : 'bottom';
1477
1479
  }
1478
1480
 
1481
+ /** Small arrow head just outside the target edge, pointing into the card. */
1482
+ function arrowPath(point, side) {
1483
+ const normal = EDGE_NORMAL[side] || EDGE_NORMAL.left;
1484
+ const perp = { x: -normal.y, y: normal.x };
1485
+ const tip = { x: point.x - normal.x * 1, y: point.y - normal.y * 1 };
1486
+ const base = { x: point.x + normal.x * 7, y: point.y + normal.y * 7 };
1487
+ const left = { x: base.x + perp.x * 3.2, y: base.y + perp.y * 3.2 };
1488
+ const right = { x: base.x - perp.x * 3.2, y: base.y - perp.y * 3.2 };
1489
+ return 'M ' + tip.x + ' ' + tip.y + ' L ' + left.x + ' ' + left.y + ' L ' + right.x + ' ' + right.y + ' Z';
1490
+ }
1491
+
1479
1492
  function linkPath(from, to, fromSide, toSide) {
1480
1493
  const distance = Math.hypot(to.x - from.x, to.y - from.y);
1481
1494
  const bend = Math.max(36, Math.min(140, distance * 0.42));
@@ -1506,9 +1519,12 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1506
1519
  });
1507
1520
  const path = document.createElementNS(SVG_NS, 'path');
1508
1521
  path.setAttribute('d', d);
1509
- path.setAttribute('class', 'iwb-link');
1522
+ path.setAttribute('class', 'iwb-link' + (card.running ? ' iwb-link-active' : ''));
1510
1523
  if (target.mode === 'draft') path.setAttribute('stroke-dasharray', '4 4');
1511
- linkLayer.append(hit, path);
1524
+ const arrow = document.createElementNS(SVG_NS, 'path');
1525
+ arrow.setAttribute('d', arrowPath(edgeAnchor(targetCard, toSide), toSide));
1526
+ arrow.setAttribute('class', 'iwb-link-arrow');
1527
+ linkLayer.append(hit, path, arrow);
1512
1528
  }
1513
1529
  }
1514
1530
  }
@@ -1889,6 +1905,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1889
1905
  }
1890
1906
 
1891
1907
  function markDirty(card) {
1908
+ hydratePending = false;
1892
1909
  if (disposed) return;
1893
1910
  dirty.add(card);
1894
1911
  if (frame) return;
@@ -2652,6 +2669,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
2652
2669
 
2653
2670
  function save() {
2654
2671
  if (disposed || suppressSave) return;
2672
+ if (hydratePending) return;
2655
2673
  try {
2656
2674
  const payload = layoutPayload();
2657
2675
  localUpdatedAt = payload.updatedAt;
@@ -2680,8 +2698,16 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
2680
2698
  }
2681
2699
  approvals?.setEnabled?.(state.settings.inlineApprovals);
2682
2700
  if (!saved || !Array.isArray(saved.cards)) {
2701
+ hydratePending = true;
2683
2702
  syncApprovalSessions();
2684
- void syncFromRemote().then(() => startRemoteSync());
2703
+ void syncFromRemote().then((applied) => {
2704
+ hydratePending = false;
2705
+ if (!applied && !saveTimer) {
2706
+ // Host had nothing (or was unreachable): the empty board is legitimately
2707
+ // ours now, so the next interaction may persist it.
2708
+ }
2709
+ startRemoteSync();
2710
+ });
2685
2711
  void loadCanvases();
2686
2712
  return false;
2687
2713
  }
@@ -2827,6 +2853,9 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
2827
2853
  let interactionActive = false;
2828
2854
  let remoteRev = 0;
2829
2855
  let localUpdatedAt = 0;
2856
+ // True between "no local cache" and the first Host sync: saving in that window
2857
+ // would push an empty board over the Host copy (real data loss).
2858
+ let hydratePending = false;
2830
2859
  let applyingRemote = false;
2831
2860
  let firstRemoteSync = true;
2832
2861
  // Own writes echo back over the event stream; the id lets us ignore them so a
@@ -221,6 +221,8 @@ function noticeOfTurnEnd(reason) {
221
221
  }
222
222
 
223
223
  /** Fold one loaded event window into flat transcript items. */
224
+
225
+
224
226
  function fold(entries) {
225
227
  const items = [];
226
228
  const tools = new Map();
@@ -373,9 +375,14 @@ function fold(entries) {
373
375
  // process row at the tail of its turn. The native conversation renders
374
376
  // [user bubble] → [process row] → [reply], so anchor each row right after the
375
377
  // last user message that precedes its own turn's first content.
378
+ // Each process row is moved at most once. Moving one row shifts the others,
379
+ // and recomputing an anchor after every move used to bounce the same row
380
+ // between two slots forever on long, steered transcripts (host freeze).
381
+ const placed = new Set();
376
382
  for (let index = 0; index < items.length; index += 1) {
377
383
  const entry = items[index];
378
- if (entry.k !== 'turnProcess') continue;
384
+ if (entry.k !== 'turnProcess' || placed.has(entry)) continue;
385
+ placed.add(entry);
379
386
  const first = items.findIndex((candidate) => candidate.k !== 'turnProcess' && candidate.turn === entry.turn);
380
387
  if (first < 0) continue;
381
388
  let anchor = first;
@@ -387,8 +394,10 @@ function fold(entries) {
387
394
  }
388
395
  if (anchor === index) continue;
389
396
  items.splice(index, 1);
390
- items.splice(index < anchor ? anchor - 1 : anchor, 0, entry);
391
- index = Math.max(0, (index < anchor ? anchor - 1 : anchor));
397
+ const insertAt = index < anchor ? anchor - 1 : anchor;
398
+ items.splice(insertAt, 0, entry);
399
+ // Resume scanning from the row we just placed; do not jump backwards past it.
400
+ index = Math.max(index, insertAt);
392
401
  }
393
402
 
394
403
  const truncated = items.length > MAX_ITEMS;
@@ -465,32 +465,62 @@
465
465
  overflow: visible; pointer-events: none; z-index: 1;
466
466
  }
467
467
  .iwb-links path.iwb-link {
468
- fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.6;
469
- opacity: .55; pointer-events: stroke; cursor: pointer;
468
+ fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.5;
469
+ stroke-linecap: round; opacity: .5; pointer-events: stroke; cursor: pointer;
470
+ transition: opacity .15s ease, stroke-width .15s ease;
470
471
  }
471
- .iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2; }
472
+ .iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2.2; }
472
473
  .iwb-links path.iwb-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
473
- .iwb-links path.iwb-link-temp { fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 2; stroke-dasharray: 5 4; opacity: .9; }
474
- /* Connection handles: one at the middle of each edge, always visible. */
474
+ .iwb-links path.iwb-link-temp {
475
+ fill: none; stroke: var(--dsw-alias-label-deep-diving); stroke-width: 1.8;
476
+ stroke-dasharray: 3 5; stroke-linecap: round; opacity: .75;
477
+ animation: iwb-flow 1s linear infinite;
478
+ }
479
+ .iwb-links path.iwb-link-arrow {
480
+ fill: var(--dsw-alias-label-deep-diving); opacity: .45; pointer-events: none;
481
+ }
482
+ .iwb-links path.iwb-link.iwb-link-active {
483
+ stroke-width: 2; opacity: .8;
484
+ stroke-dasharray: 7 7; animation: iwb-flow 1.1s linear infinite;
485
+ }
486
+ @keyframes iwb-flow { to { stroke-dashoffset: -28; } }
487
+ /* Connection handles: a whisper by default, a crisp ring on card hover. */
475
488
  .iwb-port {
476
- position: absolute; width: 16px; height: 16px; border-radius: 50%;
477
- border: 2px solid var(--dsw-alias-label-deep-diving);
478
- background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
479
- opacity: .62; transition: opacity .12s, transform .12s, background .12s; z-index: 3;
480
- box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 70%, transparent);
481
- }
482
- .iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port { opacity: .95; }
483
- .iwb-port:hover { opacity: 1; transform: scale(1.15); background: var(--dsw-alias-bg-layer-2); }
489
+ position: absolute; width: 10px; height: 10px; border-radius: 50%;
490
+ border: 0; background: var(--dsw-alias-label-deep-diving);
491
+ opacity: .38; transform: scale(.9); cursor: crosshair; z-index: 3;
492
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 55%, transparent);
493
+ transition: opacity .18s ease, transform .18s cubic-bezier(.2, .8, .3, 1.2), box-shadow .18s ease, background .18s ease;
494
+ }
495
+ .iwb-card:hover .iwb-port,
496
+ .iwb-card.iwb-focus .iwb-port {
497
+ width: 12px; height: 12px; opacity: .95; transform: scale(1);
498
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 16%, transparent);
499
+ }
500
+ .iwb-port:hover {
501
+ background: var(--dsw-alias-label-deep-diving);
502
+ transform: scale(1.25);
503
+ box-shadow: 0 0 0 4px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 20%, transparent);
504
+ }
484
505
  .iwb-port::after {
485
- content: "+"; position: absolute; inset: 0; display: grid; place-items: center;
486
- font-size: 11px; line-height: 1; font-weight: 500; color: var(--dsw-alias-label-deep-diving);
487
- }
488
- .iwb-port[data-side="right"] { right: -8px; top: calc(50% - 8px); }
489
- .iwb-port[data-side="left"] { left: -8px; top: calc(50% - 8px); }
490
- .iwb-port[data-side="top"] { top: -8px; left: calc(50% - 8px); }
491
- .iwb-port[data-side="bottom"] { bottom: -8px; left: calc(50% - 8px); }
492
- .iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
493
- .iwb-card-note.iwb-link-target { outline-style: solid; }
506
+ content: ""; position: absolute; inset: 0; border-radius: 50%;
507
+ box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent);
508
+ }
509
+ .iwb-port[data-side="right"] { right: -5px; top: calc(50% - 5px); }
510
+ .iwb-port[data-side="left"] { left: -5px; top: calc(50% - 5px); }
511
+ .iwb-port[data-side="top"] { top: -5px; left: calc(50% - 5px); }
512
+ .iwb-port[data-side="bottom"] { bottom: -5px; left: calc(50% - 5px); }
513
+ .iwb-card:hover .iwb-port[data-side="right"] { right: -6px; top: calc(50% - 6px); }
514
+ .iwb-card:hover .iwb-port[data-side="left"] { left: -6px; top: calc(50% - 6px); }
515
+ .iwb-card:hover .iwb-port[data-side="top"] { top: -6px; left: calc(50% - 6px); }
516
+ .iwb-card:hover .iwb-port[data-side="bottom"] { bottom: -6px; left: calc(50% - 6px); }
517
+
518
+ .iwb-card.iwb-link-target {
519
+ outline: 1.5px solid color-mix(in srgb, var(--dsw-alias-label-deep-diving) 60%, transparent);
520
+ outline-offset: 4px;
521
+ box-shadow: 0 0 0 8px color-mix(in srgb, var(--dsw-alias-label-deep-diving) 7%, transparent);
522
+ }
523
+ .iwb-card-note.iwb-link-target { outline-color: color-mix(in srgb, var(--dsw-alias-label-deep-diving) 55%, transparent); }
494
524
  .iwb-link-menu { min-width: 230px; }
495
525
  .iwb-link-remove .iwb-model-name { color: var(--dsw-alias-state-error-primary); }
496
526