dsh-plugin-inspiration-workbench 0.6.0 → 0.8.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.6.0",
3
+ "version": "0.8.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,48 @@ 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
+ function linkPath(from, to, fromSide, toSide) {
1480
+ const distance = Math.hypot(to.x - from.x, to.y - from.y);
1481
+ const bend = Math.max(36, Math.min(140, distance * 0.42));
1482
+ const fromNormal = EDGE_NORMAL[fromSide] || EDGE_NORMAL.right;
1483
+ const toNormal = EDGE_NORMAL[toSide] || EDGE_NORMAL.left;
1484
+ const c1 = { x: from.x + fromNormal.x * bend, y: from.y + fromNormal.y * bend };
1485
+ const c2 = { x: to.x + toNormal.x * bend, y: to.y + toNormal.y * bend };
1486
+ return 'M ' + from.x + ' ' + from.y + ' C ' + c1.x + ' ' + c1.y + ', ' + c2.x + ' ' + c2.y + ', ' + to.x + ' ' + to.y;
1463
1487
  }
1464
1488
 
1465
1489
  /** Draw one curve per pipeline target, plus a fat invisible hit area each. */
@@ -1469,7 +1493,10 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1469
1493
  for (const target of pipeTargets(card)) {
1470
1494
  const targetCard = cardOfPipeTarget(target);
1471
1495
  if (!targetCard || targetCard === card) continue;
1472
- const d = linkPath(portAnchor(card), targetAnchor(targetCard));
1496
+ const fromSide = target.from || 'right';
1497
+ const fromPoint = edgeAnchor(card, fromSide);
1498
+ const toSide = sideFacing(fromPoint, targetCard);
1499
+ const d = linkPath(fromPoint, edgeAnchor(targetCard, toSide), fromSide, toSide);
1473
1500
  const hit = document.createElementNS(SVG_NS, 'path');
1474
1501
  hit.setAttribute('d', d);
1475
1502
  hit.setAttribute('class', 'iwb-link-hit');
@@ -1497,8 +1524,11 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1497
1524
 
1498
1525
  /** Drag from a card's port to another card (session or note) to wire it up. */
1499
1526
  function bindPort(card) {
1500
- const port = card.el.querySelector('.iwb-port');
1501
- if (!port) return;
1527
+ const ports = [...card.el.querySelectorAll('.iwb-port')];
1528
+ for (const port of ports) bindOnePort(card, port);
1529
+ }
1530
+
1531
+ function bindOnePort(card, port) {
1502
1532
  port.setAttribute('title', t('pipe.port'));
1503
1533
  port.setAttribute('aria-label', t('pipe.port'));
1504
1534
  port.addEventListener('pointerdown', (event) => {
@@ -1509,12 +1539,15 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1509
1539
  x: (clientX - canvasRect.left - state.pan.x) / state.zoom,
1510
1540
  y: (clientY - canvasRect.top - state.pan.y) / state.zoom,
1511
1541
  });
1542
+ const fromSide = port.dataset.side || 'right';
1543
+ const fromPoint = edgeAnchor(card, fromSide);
1512
1544
  const temp = document.createElementNS(SVG_NS, 'path');
1513
1545
  temp.setAttribute('class', 'iwb-link-temp');
1514
1546
  linkLayer.appendChild(temp);
1515
1547
  let hovered = null;
1516
1548
  const draw = (clientX, clientY) => {
1517
- temp.setAttribute('d', linkPath(portAnchor(card), point(clientX, clientY)));
1549
+ const to = point(clientX, clientY);
1550
+ temp.setAttribute('d', linkPath(fromPoint, to, fromSide, sideFacing(fromPoint, { x: to.x, y: to.y, w: 0, h: 0 })));
1518
1551
  };
1519
1552
  draw(event.clientX, event.clientY);
1520
1553
  try {
@@ -1545,7 +1578,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
1545
1578
  temp.remove();
1546
1579
  if (hovered) {
1547
1580
  hovered.el.classList.remove('iwb-link-target');
1548
- const created = addPipeTarget(card, hovered);
1581
+ const created = addPipeTarget(card, hovered, fromSide);
1549
1582
  renderPipeBadge(card);
1550
1583
  schedulePipelines();
1551
1584
  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',
@@ -102,7 +102,7 @@
102
102
  @keyframes iwb-sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
103
103
 
104
104
  .iwb-head {
105
- flex: 0 0 auto; height: 40px; display: flex; align-items: center; gap: 7px; padding: 0 6px 0 11px;
105
+ flex: 0 0 auto; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px;
106
106
  border-bottom: .5px solid var(--dsw-alias-border-l1); cursor: grab; user-select: none;
107
107
  }
108
108
  .iwb-dragging .iwb-head { cursor: grabbing; }
@@ -159,7 +159,7 @@
159
159
  }
160
160
  .iwb-dot.waiting { background: var(--dsw-alias-state-warn-primary); box-shadow: none; }
161
161
  .iwb-card-workspace {
162
- flex: 0 0 auto; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
162
+ flex: 0 1 auto; max-width: 78px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
163
163
  font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 5px;
164
164
  color: var(--dsw-alias-label-tertiary); background: var(--dsw-alias-bg-layer-2);
165
165
  border: .5px solid var(--dsw-alias-border-l2);
@@ -197,12 +197,15 @@
197
197
  .iwb-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
198
198
  .iwb-model-desc { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
199
199
  .iwb-check { flex: 0 0 auto; font-size: 11px; color: var(--dsw-alias-label-deep-diving); width: 12px; }
200
- .iwb-elapsed { font-size: 10px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
200
+ .iwb-elapsed { font-size: 10px; color: var(--dsw-alias-label-caption); font-variant-numeric: tabular-nums; flex: 0 0 auto; opacity: .85; }
201
201
  .iwb-stack-badge {
202
202
  font-size: 10px; line-height: 15px; padding: 0 4px; flex: 0 0 auto; color: var(--dsw-alias-label-secondary);
203
203
  background: var(--dsw-alias-bg-layer-2); border: .5px solid var(--dsw-alias-border-l2); border-radius: 5px;
204
204
  }
205
- .iwb-actions { display: flex; gap: 0; flex: 0 0 auto; opacity: .92; transition: opacity .12s; }
205
+ .iwb-actions {
206
+ display: flex; gap: 4px; flex: 0 0 auto; opacity: .92; transition: opacity .12s;
207
+ margin-left: 1px; padding-left: 6px; border-left: .5px solid var(--dsw-alias-border-l1);
208
+ }
206
209
  .iwb-card:hover .iwb-actions,
207
210
  .iwb-card:focus-within .iwb-actions,
208
211
  .iwb-card.iwb-focus .iwb-actions { opacity: 1; }
@@ -216,6 +219,7 @@
216
219
  color: var(--dsw-alias-label-secondary); background: none; border: 0; cursor: pointer;
217
220
  }
218
221
  .iwb-actions button:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
222
+ .iwb-actions svg { width: 15px; height: 15px; }
219
223
  .iwb-actions button:focus-visible { outline: 2px solid var(--dsw-alias-label-deep-diving); outline-offset: -1px; }
220
224
 
221
225
  .iwb-body {
@@ -467,17 +471,24 @@
467
471
  .iwb-links path.iwb-link:hover { opacity: .95; stroke-width: 2; }
468
472
  .iwb-links path.iwb-link-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
469
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. */
470
475
  .iwb-port {
471
- position: absolute; right: -7px; top: 30px; width: 14px; height: 14px;
472
- border-radius: 50%; border: 1.5px solid var(--dsw-alias-label-deep-diving);
476
+ position: absolute; width: 16px; height: 16px; border-radius: 50%;
477
+ border: 2px solid var(--dsw-alias-label-deep-diving);
473
478
  background: var(--dsw-alias-bg-layer-1); cursor: crosshair;
474
- opacity: .55; transition: opacity .12s, transform .12s; z-index: 3;
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);
475
481
  }
476
- .iwb-card:hover .iwb-port, .iwb-card.iwb-focus .iwb-port, .iwb-port:hover { opacity: 1; }
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); }
477
484
  .iwb-port::after {
478
- content: "→"; position: absolute; inset: 0; display: grid; place-items: center;
479
- font-size: 9px; line-height: 1; color: var(--dsw-alias-label-deep-diving);
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);
480
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); }
481
492
  .iwb-card.iwb-link-target { outline: 2px dashed var(--dsw-alias-label-deep-diving); outline-offset: 3px; }
482
493
  .iwb-card-note.iwb-link-target { outline-style: solid; }
483
494
  .iwb-link-menu { min-width: 230px; }
@@ -528,6 +539,21 @@
528
539
  .iwb-card.iwb-selected .iwb-head { border-bottom-color: color-mix(in srgb, var(--dsw-alias-label-deep-diving) 55%, transparent); }
529
540
  .iwb-arrange { min-width: 190px; }
530
541
 
542
+ /* ── narrow cards: keep the header breathable ─────────────────────── */
543
+ .iwb-card { container-type: inline-size; }
544
+ @container (max-width: 430px) {
545
+ .iwb-head { gap: 6px; padding-right: 6px; }
546
+ .iwb-card-workspace { display: none; }
547
+ .iwb-meta { max-width: 96px; }
548
+ .iwb-pipe-badge { max-width: 68px; }
549
+ .iwb-actions { gap: 3px; padding-left: 4px; }
550
+ }
551
+ @container (max-width: 355px) {
552
+ .iwb-elapsed { display: none; }
553
+ .iwb-meta { max-width: 78px; }
554
+ .iwb-actions button { width: 21px; height: 21px; }
555
+ }
556
+
531
557
  /* ── keyboard focus ───────────────────────────────────────────────── */
532
558
  .iwb-card { outline: none; }
533
559
  .iwb-card.iwb-focus,