dsh-workflow-canvas 1.2.0 → 1.2.1

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.js +40 -19
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -106,7 +106,7 @@ window.__ModuleLoader__.load({
106
106
  addAgent: '+ 子代理', addLead: '+ Lead', addCond: '+ 条件', undo: '↶ 撤销', sync: '↥ 同步',
107
107
  enabled: '● 已启用', disabled: '○ 已禁用', presetName: '预设名', save: '☆ 保存',
108
108
  presets: '☰ 预设', unsaved: '有未同步改动', synced: '已同步',
109
- pickModel: '选择模型', defaultEffort: '默认',
109
+ pickModel: '选择模型', loadingModels: '加载中…', defaultEffort: '默认',
110
110
  leadThis: 'Lead(本对话)',
111
111
  tipSocketOut: '通用输入口(接收 prompt / structured / session / 条件分支);拖出可断开最近一条连线',
112
112
  tipSocketIn: '从这里拖出连线 / 也可以把输入口拖到这里',
@@ -250,7 +250,7 @@ window.__ModuleLoader__.load({
250
250
  addAgent: '+ Subagent', addLead: '+ Lead', addCond: '+ Condition', undo: '↶ Undo', sync: '↥ Sync',
251
251
  enabled: '● ON', disabled: '○ OFF', presetName: 'Preset name', save: '☆ Save',
252
252
  presets: '☰ Presets', unsaved: 'Unsaved changes', synced: 'Synced',
253
- pickModel: 'Pick a model', defaultEffort: 'default',
253
+ pickModel: 'Pick a model', loadingModels: 'Loading…', defaultEffort: 'default',
254
254
  leadThis: 'Lead (this chat)',
255
255
  tipSocketOut: 'Universal input (accepts prompt / structured / session / branch); drag away to detach latest link',
256
256
  tipSocketIn: 'Drag out to link, or drop an input here',
@@ -411,7 +411,9 @@ window.__ModuleLoader__.load({
411
411
  dim: 'var(--dsw-alias-label-tertiary, rgba(140,140,140,0.95))',
412
412
  border: 'var(--dsw-alias-border-l2, rgba(128,128,128,0.4))',
413
413
  raised: 'var(--dsw-alias-bg-layer-1, rgba(128,128,128,0.10))',
414
- elevated: 'var(--dsw-alias-bg-elevated, #2a2b2f)',
414
+ // Chain through host surface tokens before falling back to CSS Canvas so popups
415
+ // stay readable in both light and dark themes (never hardcode a dark hex fallback).
416
+ elevated: 'var(--dsw-alias-bg-elevated, var(--dsw-alias-bg-popover, var(--dsw-alias-bg-layer-2, var(--dsw-alias-bg-base, Canvas))))',
415
417
  base: 'var(--dsw-alias-bg-base, transparent)',
416
418
  hover: 'var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,0.18))',
417
419
  accent: 'var(--dsw-alias-brand-primary, #2f81f7)',
@@ -473,8 +475,8 @@ window.__ModuleLoader__.load({
473
475
  moreBar: { position: 'relative', flex: '0 0 auto' },
474
476
  moreMenu: {
475
477
  position: 'absolute', right: 0, top: '100%', marginTop: '4px', minWidth: '190px',
476
- background: C.elevated, border: '1px solid ' + C.border, borderRadius: '6px',
477
- zIndex: 80, padding: '4px', boxShadow: '0 10px 26px rgba(0,0,0,0.45)',
478
+ background: C.elevated, color: C.text, border: '1px solid ' + C.border, borderRadius: '6px',
479
+ zIndex: 80, padding: '4px', boxShadow: '0 10px 26px rgba(0,0,0,0.28)',
478
480
  },
479
481
  moreRow: {
480
482
  padding: '5px 8px', borderRadius: '4px', fontSize: '11px', cursor: 'pointer',
@@ -482,8 +484,8 @@ window.__ModuleLoader__.load({
482
484
  },
483
485
  addMenu: {
484
486
  position: 'absolute', minWidth: '164px',
485
- background: C.elevated, border: '1px solid ' + C.border, borderRadius: '7px',
486
- zIndex: 85, padding: '4px', boxShadow: '0 12px 30px rgba(0,0,0,0.5)',
487
+ background: C.elevated, color: C.text, border: '1px solid ' + C.border, borderRadius: '7px',
488
+ zIndex: 85, padding: '4px', boxShadow: '0 12px 30px rgba(0,0,0,0.28)',
487
489
  },
488
490
  addMenuHead: {
489
491
  padding: '4px 8px 3px', fontSize: '10px', color: C.dim,
@@ -506,8 +508,8 @@ window.__ModuleLoader__.load({
506
508
  },
507
509
  helpCard: {
508
510
  width: '100%', maxWidth: '420px', maxHeight: '100%', overflow: 'auto',
509
- background: C.elevated, border: '1px solid ' + C.border, borderRadius: '8px',
510
- boxShadow: '0 16px 40px rgba(0,0,0,0.5)', padding: '12px',
511
+ background: C.elevated, color: C.text, border: '1px solid ' + C.border, borderRadius: '8px',
512
+ boxShadow: '0 16px 40px rgba(0,0,0,0.32)', padding: '12px',
511
513
  },
512
514
  helpHead: { display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '8px' },
513
515
  helpTitle: { flex: '1 1 auto', fontSize: '13px', fontWeight: 600, color: C.text },
@@ -520,9 +522,9 @@ window.__ModuleLoader__.load({
520
522
  presetRowTop: { display: 'flex', alignItems: 'center', gap: '5px' },
521
523
  presetMenu: {
522
524
  position: 'absolute', right: 0, top: '100%', marginTop: '4px', minWidth: '236px',
523
- maxHeight: '320px', overflowY: 'auto', background: C.elevated,
525
+ maxHeight: '320px', overflowY: 'auto', background: C.elevated, color: C.text,
524
526
  border: '1px solid ' + C.border, borderRadius: '6px', zIndex: 60, padding: '6px',
525
- boxShadow: '0 8px 24px rgba(0,0,0,0.4)',
527
+ boxShadow: '0 8px 24px rgba(0,0,0,0.28)',
526
528
  },
527
529
  presetSaveBox: {
528
530
  padding: '2px 2px 8px', marginBottom: '6px',
@@ -649,8 +651,8 @@ window.__ModuleLoader__.load({
649
651
  },
650
652
  rolePopover: {
651
653
  position: 'absolute', left: '100%', top: '0', marginLeft: '8px', width: '280px',
652
- background: C.elevated, border: '1px solid ' + C.border, borderRadius: '8px',
653
- boxShadow: '0 10px 26px rgba(0,0,0,0.45)', padding: '8px', zIndex: 70,
654
+ background: C.elevated, color: C.text, border: '1px solid ' + C.border, borderRadius: '8px',
655
+ boxShadow: '0 10px 26px rgba(0,0,0,0.28)', padding: '8px', zIndex: 70,
654
656
  },
655
657
  roleArea: {
656
658
  width: '100%', height: '150px', boxSizing: 'border-box', resize: 'vertical',
@@ -732,13 +734,13 @@ window.__ModuleLoader__.load({
732
734
  caret: { flex: '0 0 auto', color: C.dim, fontSize: '9px' },
733
735
  menu: {
734
736
  position: 'absolute', left: 0, right: 0, top: '100%', marginTop: '4px',
735
- maxHeight: '220px', overflowY: 'auto', background: C.elevated,
737
+ maxHeight: '220px', overflowY: 'auto', background: C.elevated, color: C.text,
736
738
  border: '1px solid ' + C.border, borderRadius: '6px',
737
- boxShadow: '0 8px 24px rgba(0,0,0,0.4)', zIndex: 50, padding: '4px',
739
+ boxShadow: '0 8px 24px rgba(0,0,0,0.28)', zIndex: 50, padding: '4px',
738
740
  },
739
741
  menuRow: {
740
742
  padding: '3px 7px', borderRadius: '4px', fontSize: '10px', cursor: 'pointer',
741
- overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
743
+ color: C.text, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
742
744
  },
743
745
  menuHead: { padding: '6px 8px 2px', fontSize: '10px', color: C.dim, textTransform: 'uppercase', letterSpacing: '0.04em' },
744
746
 
@@ -784,6 +786,7 @@ window.__ModuleLoader__.load({
784
786
  };
785
787
 
786
788
  let hostCtx = null;
789
+ let cachedModels = [];
787
790
 
788
791
  function socketCenterY(i) {
789
792
  return SOCKET_BAND_TOP + i * ROW_H + ROW_H / 2;
@@ -1687,7 +1690,8 @@ window.__ModuleLoader__.load({
1687
1690
  const cutHits = useRef(new Set());
1688
1691
  const [pending, setPending] = useState(null);
1689
1692
  const [status, setStatus] = useState('');
1690
- const [models, setModels] = useState([]);
1693
+ const [models, setModels] = useState(() => cachedModels);
1694
+ const [modelsLoading, setModelsLoading] = useState(() => cachedModels.length === 0);
1691
1695
  const [openModelFor, setOpenModelFor] = useState(null);
1692
1696
  const [enabled, setEnabled] = useState(() => Boolean(initial && initial.enabled));
1693
1697
 
@@ -1782,7 +1786,10 @@ window.__ModuleLoader__.load({
1782
1786
  useEffect(() => {
1783
1787
  let alive = true;
1784
1788
  const remote = hostCtx && hostCtx.remote && hostCtx.remote.session;
1785
- if (!remote || typeof remote.modelCatalog !== 'function') return undefined;
1789
+ if (!remote || typeof remote.modelCatalog !== 'function') {
1790
+ setModelsLoading(false);
1791
+ return undefined;
1792
+ }
1786
1793
  remote.modelCatalog().then((res) => {
1787
1794
  if (!alive || !res || !res.ok) return;
1788
1795
  const flat = [];
@@ -1798,8 +1805,11 @@ window.__ModuleLoader__.load({
1798
1805
  });
1799
1806
  }
1800
1807
  }
1808
+ cachedModels = flat;
1801
1809
  setModels(flat);
1802
- }).catch(() => {});
1810
+ }).catch(() => {}).finally(() => {
1811
+ if (alive) setModelsLoading(false);
1812
+ });
1803
1813
  return () => { alive = false; };
1804
1814
  }, []);
1805
1815
 
@@ -3404,6 +3414,17 @@ window.__ModuleLoader__.load({
3404
3414
 
3405
3415
  const modelControl = (node) => {
3406
3416
  if (!models.length) {
3417
+ if (modelsLoading) {
3418
+ return h('button', {
3419
+ type: 'button',
3420
+ disabled: true,
3421
+ style: { ...S.selectBtn, color: C.dim, cursor: 'default' },
3422
+ onMouseDown: (e) => e.stopPropagation(),
3423
+ },
3424
+ h('span', { style: S.selectText }, node.model || t('loadingModels')),
3425
+ h('span', { style: S.caret }, '▾'),
3426
+ );
3427
+ }
3407
3428
  return h('input', {
3408
3429
  style: S.input,
3409
3430
  value: node.model || '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workflow-canvas",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A visual subagent-workflow canvas for DeepSeek Harness, docked in the sidebar.",
5
5
  "type": "module",
6
6
  "main": "index.js",