dsh-plugin-inspiration-workbench 0.7.0 → 0.9.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.7.0",
3
+ "version": "0.9.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.",
@@ -624,7 +624,11 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
624
624
  node.dataset.sessionId = sessionId;
625
625
  card.el = node;
626
626
  world.appendChild(node);
627
- node.appendChild(el('span', 'iwb-port'));
627
+ for (const side of ['top', 'right', 'bottom', 'left']) {
628
+ const port = el('span', 'iwb-port');
629
+ port.dataset.side = side;
630
+ node.appendChild(port);
631
+ }
628
632
  node.querySelector('.iwb-card-title').textContent = card.title;
629
633
  const bodyRegion = node.querySelector('.iwb-body');
630
634
  bodyRegion.tabIndex = 0;
@@ -1438,28 +1442,59 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1438
1442
  return target?.id || '';
1439
1443
  }
1440
1444
 
1441
- function addPipeTarget(card, targetCard) {
1445
+ function addPipeTarget(card, targetCard, fromSide) {
1442
1446
  const kind = targetCard.kind === 'note' ? 'note' : 'session';
1443
1447
  const id = kind === 'note' ? targetCard.id : targetCard.sessionId;
1444
1448
  if (!id || targetCard === card) return false;
1445
1449
  const targets = pipeTargets(card).filter((target) => !(target.kind === kind && target.id === id));
1446
1450
  const expanded = targets.length !== pipeTargets(card).length;
1447
- targets.push({ kind, id, mode: 'send' });
1451
+ targets.push({ kind, id, mode: 'send', from: fromSide || 'right' });
1448
1452
  setPipeTargets(card, targets);
1449
1453
  return !expanded;
1450
1454
  }
1451
1455
 
1452
- function portAnchor(card) {
1453
- return { x: card.x + card.w, y: card.y + 30 };
1456
+ const EDGE_NORMAL = {
1457
+ left: { x: -1, y: 0 },
1458
+ right: { x: 1, y: 0 },
1459
+ top: { x: 0, y: -1 },
1460
+ bottom: { x: 0, y: 1 },
1461
+ };
1462
+
1463
+ /** Anchor at the middle of one card edge. */
1464
+ function edgeAnchor(card, side) {
1465
+ if (side === 'left') return { x: card.x, y: card.y + card.h / 2 };
1466
+ if (side === 'top') return { x: card.x + card.w / 2, y: card.y };
1467
+ if (side === 'bottom') return { x: card.x + card.w / 2, y: card.y + card.h };
1468
+ return { x: card.x + card.w, y: card.y + card.h / 2 };
1454
1469
  }
1455
1470
 
1456
- function targetAnchor(card) {
1457
- return { x: card.x, y: card.y + 30 };
1471
+ /** Which edge of the target faces the source anchor. */
1472
+ function sideFacing(fromPoint, target) {
1473
+ const dx = target.x + target.w / 2 - fromPoint.x;
1474
+ const dy = target.y + target.h / 2 - fromPoint.y;
1475
+ if (Math.abs(dx) >= Math.abs(dy)) return dx > 0 ? 'left' : 'right';
1476
+ return dy > 0 ? 'top' : 'bottom';
1458
1477
  }
1459
1478
 
1460
- function linkPath(from, to) {
1461
- const dx = Math.max(40, Math.abs(to.x - from.x) * 0.45);
1462
- return 'M ' + from.x + ' ' + from.y + ' C ' + (from.x + dx) + ' ' + from.y + ', ' + (to.x - dx) + ' ' + to.y + ', ' + to.x + ' ' + to.y;
1479
+ /** Small arrow head just outside the target edge, pointing into the card. */
1480
+ function arrowPath(point, side) {
1481
+ const normal = EDGE_NORMAL[side] || EDGE_NORMAL.left;
1482
+ const perp = { x: -normal.y, y: normal.x };
1483
+ const tip = { x: point.x - normal.x * 1, y: point.y - normal.y * 1 };
1484
+ const base = { x: point.x + normal.x * 7, y: point.y + normal.y * 7 };
1485
+ const left = { x: base.x + perp.x * 3.2, y: base.y + perp.y * 3.2 };
1486
+ const right = { x: base.x - perp.x * 3.2, y: base.y - perp.y * 3.2 };
1487
+ return 'M ' + tip.x + ' ' + tip.y + ' L ' + left.x + ' ' + left.y + ' L ' + right.x + ' ' + right.y + ' Z';
1488
+ }
1489
+
1490
+ function linkPath(from, to, fromSide, toSide) {
1491
+ const distance = Math.hypot(to.x - from.x, to.y - from.y);
1492
+ const bend = Math.max(36, Math.min(140, distance * 0.42));
1493
+ const fromNormal = EDGE_NORMAL[fromSide] || EDGE_NORMAL.right;
1494
+ const toNormal = EDGE_NORMAL[toSide] || EDGE_NORMAL.left;
1495
+ const c1 = { x: from.x + fromNormal.x * bend, y: from.y + fromNormal.y * bend };
1496
+ const c2 = { x: to.x + toNormal.x * bend, y: to.y + toNormal.y * bend };
1497
+ return 'M ' + from.x + ' ' + from.y + ' C ' + c1.x + ' ' + c1.y + ', ' + c2.x + ' ' + c2.y + ', ' + to.x + ' ' + to.y;
1463
1498
  }
1464
1499
 
1465
1500
  /** Draw one curve per pipeline target, plus a fat invisible hit area each. */
@@ -1469,7 +1504,10 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1469
1504
  for (const target of pipeTargets(card)) {
1470
1505
  const targetCard = cardOfPipeTarget(target);
1471
1506
  if (!targetCard || targetCard === card) continue;
1472
- const d = linkPath(portAnchor(card), targetAnchor(targetCard));
1507
+ const fromSide = target.from || 'right';
1508
+ const fromPoint = edgeAnchor(card, fromSide);
1509
+ const toSide = sideFacing(fromPoint, targetCard);
1510
+ const d = linkPath(fromPoint, edgeAnchor(targetCard, toSide), fromSide, toSide);
1473
1511
  const hit = document.createElementNS(SVG_NS, 'path');
1474
1512
  hit.setAttribute('d', d);
1475
1513
  hit.setAttribute('class', 'iwb-link-hit');
@@ -1479,9 +1517,12 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1479
1517
  });
1480
1518
  const path = document.createElementNS(SVG_NS, 'path');
1481
1519
  path.setAttribute('d', d);
1482
- path.setAttribute('class', 'iwb-link');
1520
+ path.setAttribute('class', 'iwb-link' + (card.running ? ' iwb-link-active' : ''));
1483
1521
  if (target.mode === 'draft') path.setAttribute('stroke-dasharray', '4 4');
1484
- linkLayer.append(hit, path);
1522
+ const arrow = document.createElementNS(SVG_NS, 'path');
1523
+ arrow.setAttribute('d', arrowPath(edgeAnchor(targetCard, toSide), toSide));
1524
+ arrow.setAttribute('class', 'iwb-link-arrow');
1525
+ linkLayer.append(hit, path, arrow);
1485
1526
  }
1486
1527
  }
1487
1528
  }
@@ -1497,8 +1538,11 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1497
1538
 
1498
1539
  /** Drag from a card's port to another card (session or note) to wire it up. */
1499
1540
  function bindPort(card) {
1500
- const port = card.el.querySelector('.iwb-port');
1501
- if (!port) return;
1541
+ const ports = [...card.el.querySelectorAll('.iwb-port')];
1542
+ for (const port of ports) bindOnePort(card, port);
1543
+ }
1544
+
1545
+ function bindOnePort(card, port) {
1502
1546
  port.setAttribute('title', t('pipe.port'));
1503
1547
  port.setAttribute('aria-label', t('pipe.port'));
1504
1548
  port.addEventListener('pointerdown', (event) => {
@@ -1509,12 +1553,15 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1509
1553
  x: (clientX - canvasRect.left - state.pan.x) / state.zoom,
1510
1554
  y: (clientY - canvasRect.top - state.pan.y) / state.zoom,
1511
1555
  });
1556
+ const fromSide = port.dataset.side || 'right';
1557
+ const fromPoint = edgeAnchor(card, fromSide);
1512
1558
  const temp = document.createElementNS(SVG_NS, 'path');
1513
1559
  temp.setAttribute('class', 'iwb-link-temp');
1514
1560
  linkLayer.appendChild(temp);
1515
1561
  let hovered = null;
1516
1562
  const draw = (clientX, clientY) => {
1517
- temp.setAttribute('d', linkPath(portAnchor(card), point(clientX, clientY)));
1563
+ const to = point(clientX, clientY);
1564
+ temp.setAttribute('d', linkPath(fromPoint, to, fromSide, sideFacing(fromPoint, { x: to.x, y: to.y, w: 0, h: 0 })));
1518
1565
  };
1519
1566
  draw(event.clientX, event.clientY);
1520
1567
  try {
@@ -1545,7 +1592,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1545
1592
  temp.remove();
1546
1593
  if (hovered) {
1547
1594
  hovered.el.classList.remove('iwb-link-target');
1548
- const created = addPipeTarget(card, hovered);
1595
+ const created = addPipeTarget(card, hovered, fromSide);
1549
1596
  renderPipeBadge(card);
1550
1597
  schedulePipelines();
1551
1598
  saveSoon();
@@ -139,7 +139,7 @@ const zh = {
139
139
  'pipe.modeReplace': '便签:只保留最新一段',
140
140
  'pipe.notedReplaced': '已覆盖便签「{name}」为最新结果',
141
141
  'pipe.removeNote': '删除这条便签流水线',
142
- 'pipe.port': '拖这条线到另一张卡,建立流水线',
142
+ 'pipe.port': '按住拖动到另一张卡上,建立流水线',
143
143
  'pipe.created': '流水线已连到「{name}」',
144
144
  'pipe.needTarget': '拖到另一张卡(会话卡或便签)上才算连线',
145
145
  'pipe.remove': '删除这条流水线',
@@ -439,7 +439,7 @@ const en = {
439
439
  'pipe.modeReplace': 'Note: keep only the latest',
440
440
  'pipe.notedReplaced': 'Note “{name}” replaced with the latest result',
441
441
  'pipe.removeNote': 'Remove this note pipeline',
442
- 'pipe.port': 'Drag this line onto another card to wire a pipeline',
442
+ 'pipe.port': 'Drag onto another card to wire a pipeline',
443
443
  'pipe.created': 'Pipeline wired to “{name}”',
444
444
  'pipe.needTarget': 'Drop it on another card (session or note) to connect',
445
445
  'pipe.remove': 'Remove this pipeline',
@@ -465,25 +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
+ .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. */
474
488
  .iwb-port {
475
- position: absolute; right: -5px; top: 33px; width: 12px; height: 12px;
476
- border-radius: 50%; border: 1.5px solid var(--dsw-alias-label-deep-diving);
477
- background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
478
- opacity: .55; transition: opacity .12s, transform .12s; z-index: 3;
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);
479
504
  }
480
- .iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port, .iwb-port:hover { opacity: 1; }
481
505
  .iwb-port::after {
482
- content: "→"; position: absolute; inset: 0; display: grid; place-items: center;
483
- font-size: 8px; line-height: 1; color: var(--dsw-alias-label-deep-diving);
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);
484
522
  }
485
- .iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
486
- .iwb-card-note.iwb-link-target { outline-style: solid; }
523
+ .iwb-card-note.iwb-link-target { outline-color: color-mix(in srgb, var(--dsw-alias-label-deep-diving) 55%, transparent); }
487
524
  .iwb-link-menu { min-width: 230px; }
488
525
  .iwb-link-remove .iwb-model-name { color: var(--dsw-alias-state-error-primary); }
489
526