dsh-linked-workspace 0.11.0 → 0.13.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/lib/client.js CHANGED
@@ -2126,6 +2126,19 @@ function attributeViolation(name, value, tagName) {
2126
2126
  var ZH = {
2127
2127
  settingsNav: '联动工作区',
2128
2128
  title: '联动&远程工作区',
2129
+ welcomeEyebrow: 'DSH-LINKED-WORKSPACE',
2130
+ welcomeTitle: '欢迎使用联动工作区插件',
2131
+ welcomeLead: '把 SSH 主机上的远端目录接进 DSH:既能和本地目录配对成联动工作区,也能让会话直接运行在远端目录。会话里的模型可以读写远端代码。',
2132
+ welcomeCreate: '创建联动或远程工作区',
2133
+ welcomeCreateWhere: '设置 →「联动工作区」,或左侧工作区栏的「添加工作区」',
2134
+ welcomeBrowse: '在右侧栏浏览远端文件',
2135
+ welcomeBrowseWhere: '标签栏「+」→「联动工作区目录」或「远程工作区目录」',
2136
+ welcomeTools: '让模型读写远端代码',
2137
+ welcomeToolsWhere: '直接在会话里提需求,模型会用 linked_workspace 工具',
2138
+ welcomePassword: '不用装 SSH Manager 也能连',
2139
+ welcomePasswordWhere: '添加工作区时直接填 SSH 密码,只保存在本机',
2140
+ welcomeStar: '★ 点个 Star',
2141
+ welcomeDone: '知道了',
2129
2142
  intro: '把 SSH 连接变成工作区:联动工作区把本地目录与远端目录配对,远程工作区让会话直接运行在远端目录。会话都能读取、搜索和编辑远端文件。',
2130
2143
  addWorkspace: '添加工作区',
2131
2144
  addLinked: '添加联动工作区',
@@ -2195,11 +2208,14 @@ function attributeViolation(name, value, tagName) {
2195
2208
  csvTruncated: '仅显示前 1000 行',
2196
2209
  moveTitle: '移动到…',
2197
2210
  moveMessage: '选择「{{name}}」要移动到的目录',
2211
+ moveMessageMany: '选择这 {{count}} 项要移动到的目录',
2198
2212
  moveDone: '已移动',
2213
+ moveDoneCount: '已移动 {{count}} 项',
2199
2214
  moveDirty: '该文件有未保存修改,请先保存或关闭后再移动',
2200
2215
  moveFailed: '移动失败',
2201
2216
  moveHint: '进入目标文件夹后点击「使用此目录」',
2202
2217
  ctxMove: '移动到…',
2218
+ ctxMoveSelected: '移动所选的 {{count}} 项…',
2203
2219
  noWorkspace: '远程工作区不存在,请重新添加。',
2204
2220
  noTarget: '没有可浏览的工作区。先在设置 → 连接中创建,或点击左侧「添加工作区」。',
2205
2221
  treeEmpty: '空目录',
@@ -2261,6 +2277,18 @@ function attributeViolation(name, value, tagName) {
2261
2277
  sheetTruncated: '仅显示前 {{rows}} 行 × {{cols}} 列',
2262
2278
  sheetMore: '工作表较多,仅显示前 20 个',
2263
2279
  noCredential: '缺少凭据',
2280
+ needPassword: '需要密码',
2281
+ sshPassword: 'SSH 密码',
2282
+ sshPasswordPlaceholder: '输入这台主机的密码',
2283
+ sshPasswordHint: '密码只保存在本机(DSH 数据目录的 ssh-credentials.json),只有本插件读取;不需要安装 SSH Manager 插件。',
2284
+ sshPasswordStored: '已保存密码,留空则保持不变',
2285
+ sshPasswordStoredHint: '已保存密码。想更换就重新输入,留空则继续使用原密码。',
2286
+ sshPasswordRequired: '请先在下面填写这台 SSH 主机的密码',
2287
+ sshVerify: '验证密码',
2288
+ sshVerifying: '验证中…',
2289
+ sshPasswordOk: '密码可用,可以继续创建。',
2290
+ sshPasswordFailed: '验证失败:',
2291
+ staleHost: 'DSH 的插件进程仍在运行旧版代码,请完全退出并重启 DSH 后再试',
2264
2292
  sourceManagerShort: 'SSH',
2265
2293
  linkedGroup: '联动工作区',
2266
2294
  linkedEmpty: '还没有联动工作区。联动工作区会把本地目录与远端目录配对,会话可直接编辑远端文件。',
@@ -2530,6 +2558,19 @@ function attributeViolation(name, value, tagName) {
2530
2558
  var EN = {
2531
2559
  settingsNav: 'Linked workspaces',
2532
2560
  title: 'Linked & remote workspaces',
2561
+ welcomeEyebrow: 'DSH-LINKED-WORKSPACE',
2562
+ welcomeTitle: 'Welcome to the linked-workspaces plugin',
2563
+ welcomeLead: 'Bring a folder on an SSH host into DSH: pair it with a local folder as a linked workspace, or run sessions straight inside the remote folder. Sessions can read and edit the remote code.',
2564
+ welcomeCreate: 'Create a linked or remote workspace',
2565
+ welcomeCreateWhere: 'Settings → “Linked workspaces”, or “Add workspace” in the left column',
2566
+ welcomeBrowse: 'Browse remote files in the right sidebar',
2567
+ welcomeBrowseWhere: 'Tab bar “+” → “Linked workspace directory” or “Remote workspace directory”',
2568
+ welcomeTools: 'Let the model read and write remote code',
2569
+ welcomeToolsWhere: 'Just ask in a session; the model uses the linked_workspace tool',
2570
+ welcomePassword: 'No SSH Manager needed',
2571
+ welcomePasswordWhere: 'Type the SSH password when adding a workspace; it stays on this machine',
2572
+ welcomeStar: '★ Star the repo',
2573
+ welcomeDone: 'Got it',
2533
2574
  intro: 'Turn an SSH connection into a workspace: a linked workspace pairs a local folder with a remote folder, and a remote workspace runs sessions directly inside the remote folder. Either way sessions can read, search and edit remote files.',
2534
2575
  addWorkspace: 'Add workspace',
2535
2576
  addRemoteDir: 'Add remote directory',
@@ -2600,11 +2641,14 @@ function attributeViolation(name, value, tagName) {
2600
2641
  csvTruncated: 'Showing the first 1000 rows',
2601
2642
  moveTitle: 'Move to…',
2602
2643
  moveMessage: 'Choose the destination folder for "{{name}}"',
2644
+ moveMessageMany: 'Choose the destination folder for these {{count}} items',
2603
2645
  moveDone: 'Moved',
2646
+ moveDoneCount: 'Moved {{count}} items',
2604
2647
  moveDirty: 'This file has unsaved changes; save or close it before moving',
2605
2648
  moveFailed: 'Move failed',
2606
2649
  moveHint: 'Open the destination folder, then click “Use this directory”',
2607
2650
  ctxMove: 'Move to…',
2651
+ ctxMoveSelected: 'Move selected ({{count}})…',
2608
2652
  noWorkspace: 'This remote workspace no longer exists. Add it again.',
2609
2653
  noTarget: 'No workspace to browse. Create one in Settings → Connections, or click “Add workspace” on the left.',
2610
2654
  treeEmpty: 'Empty directory',
@@ -2666,6 +2710,18 @@ function attributeViolation(name, value, tagName) {
2666
2710
  sheetTruncated: 'Showing the first {{rows}} rows × {{cols}} columns',
2667
2711
  sheetMore: 'Showing the first 20 worksheets only',
2668
2712
  noCredential: 'No credentials',
2713
+ needPassword: 'Password needed',
2714
+ sshPassword: 'SSH password',
2715
+ sshPasswordPlaceholder: 'Enter the password for this host',
2716
+ sshPasswordHint: 'Stored on this machine only (ssh-credentials.json in the DSH data directory) and read by this plugin. The SSH Manager plugin is not required.',
2717
+ sshPasswordStored: 'Password stored — leave empty to keep it',
2718
+ sshPasswordStoredHint: 'A password is already stored. Type a new one to replace it, or leave empty to keep it.',
2719
+ sshPasswordRequired: 'Enter the password for this SSH host below first',
2720
+ sshVerify: 'Check password',
2721
+ sshVerifying: 'Checking…',
2722
+ sshPasswordOk: 'The password works — you can create the workspace now.',
2723
+ sshPasswordFailed: 'Check failed:',
2724
+ staleHost: 'The plugin host is still running older code; quit and restart DSH, then retry',
2669
2725
  sourceManagerShort: 'SSH',
2670
2726
  linkedGroup: 'Linked workspaces',
2671
2727
  linkedEmpty: 'No linked workspaces yet. A linked workspace pairs a local folder with a remote folder so sessions can edit remote files directly.',
@@ -3038,9 +3094,19 @@ function attributeViolation(name, value, tagName) {
3038
3094
 
3039
3095
  function messageOf(error, t, locale) {
3040
3096
  if (!error) return '';
3097
+ // `unknown method` means the page is newer than the Host process: the
3098
+ // plugin's server half only changes on restart.
3099
+ if (typeof error.message === 'string' && error.message.indexOf('unknown method:') === 0) {
3100
+ return t('staleHost') + ' (' + error.message + ')';
3101
+ }
3041
3102
  var known = error.code ? (locale === 'zh' ? CODE_TEXT.zh : CODE_TEXT.en)[error.code] : '';
3042
- if (known) return error.code === 'BAD_REQUEST' && error.message ? error.message : known;
3043
- return error.message || String(error);
3103
+ if (!known) return error.message || String(error);
3104
+ if (error.code === 'BAD_REQUEST' && error.message) return error.message;
3105
+ // Keep the server's own wording: "All configured authentication methods
3106
+ // failed" tells the user far more than the generic code text alone.
3107
+ var detail = typeof error.message === 'string' ? error.message.trim() : '';
3108
+ if (!detail || detail === known) return known;
3109
+ return known + (locale === 'zh' ? ':' : ': ') + detail;
3044
3110
  }
3045
3111
 
3046
3112
  function documentKindOf(path) {
@@ -3310,9 +3376,9 @@ function attributeViolation(name, value, tagName) {
3310
3376
  '.rw-path{font-family:ui-monospace,"Cascadia Code",Consolas,monospace;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);word-break:break-all}',
3311
3377
  // Injected into the host's workspace hover preview, which always paints on
3312
3378
  // a fixed dark card, so these colours cannot follow the theme tokens.
3313
- '.rw-hover-status{margin:1px 0 0;font-size:12px;line-height:18px;color:rgb(207,211,214)}',
3314
- '.rw-hover-status.is-on{color:#3fb950}',
3315
- '.rw-hover-status.is-off{color:#f85149}',
3379
+ '.rw-hover-host{margin:1px 0 0;font-size:12px;line-height:18px;color:rgb(207,211,214)}',
3380
+ '.rw-hover-host.is-on{color:#3fb950}',
3381
+ '.rw-hover-host.is-off{color:#f85149}',
3316
3382
  '.rw-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}',
3317
3383
  '.rw-meta-text{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
3318
3384
  '.rw-pair{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px}',
@@ -3585,6 +3651,21 @@ function attributeViolation(name, value, tagName) {
3585
3651
  '.rw-dialog-input{width:100%;box-sizing:border-box;padding:6px 9px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;outline:none}',
3586
3652
  '.rw-dialog-actions{display:flex;justify-content:flex-end;gap:7px;margin-top:12px}',
3587
3653
  '.rw-dialog-message{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}',
3654
+ // First-run welcome card: sits in shell.overlay, so the backdrop is its own.
3655
+ '.rw-welcome-backdrop{position:fixed;inset:0;z-index:2000;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(0,0,0,.42)}',
3656
+ '.rw-welcome{position:relative;width:min(470px,100%);max-height:min(86vh,700px);overflow:auto;box-sizing:border-box;padding:22px 22px 18px;border:1px solid var(--dsw-alias-border-l2);border-radius:18px;background:var(--dsw-alias-bg-layer-2);box-shadow:0 26px 70px rgba(0,0,0,.42);color:var(--dsw-alias-label-primary)}',
3657
+ '.rw-welcome-x{position:absolute;top:12px;right:12px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer}',
3658
+ '.rw-welcome-x:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.14))}',
3659
+ '.rw-welcome-eyebrow{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--dsw-alias-label-tertiary)}',
3660
+ '.rw-welcome-dot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-brand-primary)}',
3661
+ '.rw-welcome-title{margin:8px 0 0;font-size:19px;line-height:26px;font-weight:650}',
3662
+ '.rw-welcome-lead{margin:8px 0 0;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary)}',
3663
+ '.rw-welcome-rows{display:flex;flex-direction:column;gap:8px;margin:16px 0 0}',
3664
+ '.rw-welcome-row{padding:10px 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:11px;background:var(--dsw-alias-bg-base)}',
3665
+ '.rw-welcome-row-main{font-size:13px;line-height:19px;font-weight:600}',
3666
+ '.rw-welcome-row-where{margin-top:2px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}',
3667
+ '.rw-welcome-foot{display:flex;align-items:center;gap:10px;margin-top:18px}',
3668
+ '.rw-welcome-foot .rw-btn{height:32px;padding:0 16px;text-decoration:none}',
3588
3669
  '.rw-props{display:grid;grid-template-columns:70px minmax(0,1fr);gap:5px 9px;font-size:12px;line-height:18px}',
3589
3670
  '.rw-props-key{color:var(--dsw-alias-label-tertiary)}',
3590
3671
  '.rw-props-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
@@ -3648,6 +3729,18 @@ function attributeViolation(name, value, tagName) {
3648
3729
  'M262.4 224h243.2a38.4 38.4 0 1 1 0 76.8H351.808L586.24 535.168a38.4 38.4 0 0 1 4.032 49.536l-4.032 4.736-4.736 4.032a38.4 38.4 0 0 1-49.6-4.032L300.8 358.272 300.8 505.6a38.4 38.4 0 0 1-76.8 0V262.4a38.4 38.4 0 0 1 38.4-38.4z',
3649
3730
  ];
3650
3731
 
3732
+ // Settings-nav glyph: a stack of sheets (the linked / remote pairing sits on
3733
+ // top of the plain local workspace). Registered through the host's
3734
+ // `settings.section.icon` seat so the settings list shows it instead of the
3735
+ // default gear.
3736
+ var SETTINGS_ICON_PATHS = [
3737
+ 'M20.66204445 509.34044445l475.70488888 256.27306667A35.10044445 35.10044445 0 0 0 542.72 753.6896a31.07271111 31.07271111 0 0 0-10.71786667-42.60977778c-0.63715555-0.38684445-1.29706667-0.73955555-1.96835555-1.08088888L54.35164445 453.72586667a35.11182222 35.11182222 0 0 0-46.31893334 11.91253333 31.08408889 31.08408889 0 0 0 10.68373334 42.63253334c0.62577778 0.37546667 1.28568889 0.73955555 1.9456 1.06951111z',
3738
+ 'M972.07182222 453.72586667l-475.70488889 256.27306667a31.07271111 31.07271111 0 0 0-13.65333333 41.75644444c0.34133333 0.65991111 0.69404445 1.30844445 1.06951111 1.93422222 9.29564445 15.38275555 30.04871111 20.69617778 46.31893334 11.92391112L1005.79555555 509.34044445a31.07271111 31.07271111 0 0 0 13.76711112-41.73368889c-0.32995555-0.67128889-0.69404445-1.31982222-1.13777778-1.96835556a35.10044445 35.10044445 0 0 0-46.35306667-11.91253333z',
3739
+ 'M20.66204445 701.54524445l475.70488888 256.27306667A35.10044445 35.10044445 0 0 0 542.72 945.84888889a31.07271111 31.07271111 0 0 0-10.71786667-42.60977777c-0.63715555-0.38684445-1.29706667-0.75093333-1.96835555-1.13777778L54.35164445 645.93066667a35.11182222 35.11182222 0 0 0-46.31893334 11.91253333 31.08408889 31.08408889 0 0 0 10.68373334 42.63253334c0.62577778 0.37546667 1.28568889 0.75093333 1.9456 1.06951111z',
3740
+ 'M972.07182222 645.93066667l-475.70488889 256.27306667a31.07271111 31.07271111 0 0 0-13.65333333 41.75644444c0.34133333 0.65991111 0.69404445 1.30844445 1.06951111 1.93422222 9.29564445 15.38275555 30.04871111 20.69617778 46.31893334 11.92391112L1005.79555555 701.54524445a31.07271111 31.07271111 0 0 0 13.76711112-41.73368889c-0.32995555-0.67128889-0.69404445-1.31982222-1.13777778-1.96835556a35.10044445 35.10044445 0 0 0-46.35306667-11.91253333z',
3741
+ 'M500.62222222 122.496L142.32462222 291.62666667 512 509.34044445l357.48977778-196.36906667z m3.77742223-70.54222222l483.04355555 249.42364444a13.75573333 13.75573333 0 0 1 6.53084445 17.80622223 12.12871111 12.12871111 0 0 1-5.12 5.50684444L520.64711111 581.76a13.23235555 13.23235555 0 0 1-13.07306666-0.38684444L23.54062222 296.24604445a13.65333333 13.65333333 0 0 1-5.44995555-18.20444445 12.25386667 12.25386667 0 0 1 5.44995555-5.13137778l469.17404445-221.27502222a13.18684445 13.18684445 0 0 1 11.71911111 0.31857778z',
3742
+ ];
3743
+
3651
3744
  var ICON_DISCONNECTED_COLOR = '#f85149';
3652
3745
  var ICON_BUSY_COLOR = '#2f81f7';
3653
3746
 
@@ -3768,13 +3861,16 @@ function attributeViolation(name, value, tagName) {
3768
3861
  var remote = record.remotePath;
3769
3862
  var local = record.localPath || '';
3770
3863
 
3771
- var status = document.createElement('div');
3772
- status.className = 'rw-hover-status' + (record.disconnected ? ' is-off' : record.connected ? ' is-on' : '');
3773
- status.setAttribute(HOVER_LINE_ATTR, '1');
3774
- status.textContent = record.status;
3864
+ // Second line: the SSH host that backs this workspace plus its live
3865
+ // connection state, e.g. "RTX-PRO-6000-1 · 已连接". Both pieces come from
3866
+ // the same record, so a host without a name still shows the state alone.
3867
+ var stateLine = document.createElement('div');
3868
+ stateLine.className = 'rw-hover-host' + (record.disconnected ? ' is-off' : record.connected ? ' is-on' : '');
3869
+ stateLine.setAttribute(HOVER_LINE_ATTR, '1');
3870
+ stateLine.textContent = record.host ? record.host + ' · ' + record.status : record.status;
3775
3871
  var titleEl = card.querySelector('[class*="hoverTitle"]');
3776
3872
  var anchor = titleEl || pathEl;
3777
- anchor.parentNode.insertBefore(status, anchor.nextSibling);
3873
+ anchor.parentNode.insertBefore(stateLine, anchor.nextSibling);
3778
3874
 
3779
3875
  if (record.kind === 'linked' && local !== '') {
3780
3876
  pathEl.textContent = t('pathRemoteShort') + ' ' + remote;
@@ -3841,6 +3937,7 @@ function attributeViolation(name, value, tagName) {
3841
3937
  records[key] = {
3842
3938
  kind: entry.kind,
3843
3939
  name: item.name,
3940
+ host: item.hostName || item.host || '',
3844
3941
  remotePath: item.remotePath || '',
3845
3942
  localPath: linked ? (item.localPath || '') : '',
3846
3943
  status: statusLabel(t, item),
@@ -3923,6 +4020,10 @@ function attributeViolation(name, value, tagName) {
3923
4020
  return solidIcon(size || 14, REMOTE_ICON_PATHS);
3924
4021
  }
3925
4022
 
4023
+ function IconSettingsNav(size) {
4024
+ return solidIcon(size || 16, SETTINGS_ICON_PATHS);
4025
+ }
4026
+
3926
4027
  function IconChevron(size) {
3927
4028
  return svg(size || 14, h('path', {
3928
4029
  d: 'm6 3 5 5-5 5', stroke: 'currentColor', strokeWidth: 1.6,
@@ -5772,6 +5873,90 @@ function attributeViolation(name, value, tagName) {
5772
5873
  }, items.map(renderItem)));
5773
5874
  }
5774
5875
 
5876
+ // ── first-run welcome card ──────────────────────────────────────────────
5877
+
5878
+ // Shown once per browser profile: the flag lives in localStorage so the
5879
+ // dialog never reopens on refresh, and a fresh DSH install opens it again.
5880
+ var WELCOME_KEY = 'dsh-linked-workspace:welcome';
5881
+
5882
+ function welcomeSeen() {
5883
+ try {
5884
+ if (typeof window === 'undefined' || !window.localStorage) return true;
5885
+ return window.localStorage.getItem(WELCOME_KEY) === '1';
5886
+ } catch (error) {
5887
+ return true;
5888
+ }
5889
+ }
5890
+
5891
+ function welcomeRemember() {
5892
+ try {
5893
+ if (typeof window !== 'undefined' && window.localStorage) window.localStorage.setItem(WELCOME_KEY, '1');
5894
+ } catch (error) { /* storage unavailable: the card simply shows again */ }
5895
+ }
5896
+
5897
+ function WelcomeRow(props) {
5898
+ return h('div', { className: 'rw-welcome-row' },
5899
+ h('div', { className: 'rw-welcome-row-main' }, props.main),
5900
+ h('div', { className: 'rw-welcome-row-where' }, props.where));
5901
+ }
5902
+
5903
+ function WelcomeCard(props) {
5904
+ var locale = useLocale(props.ctx);
5905
+ var t = useMemo(function () { return makeT(locale); }, [locale]);
5906
+ var state = useState(function () { return !welcomeSeen(); });
5907
+ var open = state[0];
5908
+ var setOpen = state[1];
5909
+ function close() { welcomeRemember(); setOpen(false); }
5910
+ useEffect(function () {
5911
+ if (!open) return undefined;
5912
+ function onKey(event) {
5913
+ if (event.key !== 'Escape') return;
5914
+ event.preventDefault();
5915
+ event.stopPropagation();
5916
+ welcomeRemember();
5917
+ setOpen(false);
5918
+ }
5919
+ window.addEventListener('keydown', onKey, true);
5920
+ return function () { window.removeEventListener('keydown', onKey, true); };
5921
+ }, [open]);
5922
+ if (!open) return null;
5923
+ var rows = [
5924
+ { main: t('welcomeCreate'), where: t('welcomeCreateWhere') },
5925
+ { main: t('welcomeBrowse'), where: t('welcomeBrowseWhere') },
5926
+ { main: t('welcomeTools'), where: t('welcomeToolsWhere') },
5927
+ { main: t('welcomePassword'), where: t('welcomePasswordWhere') },
5928
+ ];
5929
+ return h('div', {
5930
+ className: 'rw-welcome-backdrop',
5931
+ onMouseDown: function (event) { if (event.target === event.currentTarget) close(); },
5932
+ }, h('div', {
5933
+ className: 'rw-welcome',
5934
+ role: 'dialog',
5935
+ 'aria-modal': 'true',
5936
+ 'aria-label': t('welcomeTitle'),
5937
+ },
5938
+ h('button', {
5939
+ type: 'button',
5940
+ className: 'rw-welcome-x',
5941
+ 'aria-label': t('close'),
5942
+ onClick: close,
5943
+ }, IconClose(14)),
5944
+ h('div', { className: 'rw-welcome-eyebrow' }, h('span', { className: 'rw-welcome-dot' }), t('welcomeEyebrow')),
5945
+ h('div', { className: 'rw-welcome-title' }, t('welcomeTitle')),
5946
+ h('div', { className: 'rw-welcome-lead' }, t('welcomeLead')),
5947
+ h('div', { className: 'rw-welcome-rows' }, rows.map(function (row, index) {
5948
+ return h(WelcomeRow, { key: String(index), main: row.main, where: row.where });
5949
+ })),
5950
+ h('div', { className: 'rw-welcome-foot' },
5951
+ h('a', {
5952
+ className: 'rw-btn rw-btn-primary',
5953
+ href: 'https://github.com/jiahui-huang1/dsh-linked-workspace',
5954
+ target: '_blank',
5955
+ rel: 'noreferrer',
5956
+ }, t('welcomeStar')),
5957
+ h('button', { type: 'button', className: 'rw-btn', onClick: close }, t('welcomeDone')))));
5958
+ }
5959
+
5775
5960
  function DialogShell(props) {
5776
5961
  return h('div', {
5777
5962
  className: 'rw-dialog-backdrop',
@@ -6961,11 +7146,21 @@ function attributeViolation(name, value, tagName) {
6961
7146
 
6962
7147
  function beginDragRow(side, event, info) {
6963
7148
  if (!event.dataTransfer || !info) return;
7149
+ // Dragging one row of a multi-selection carries the whole selection, so
7150
+ // a single gesture can move or copy several entries at once.
7151
+ var picked = selectionFor(side).filter(function (item) {
7152
+ return item && typeof item.path === 'string';
7153
+ });
7154
+ var containsDragged = picked.some(function (item) { return item.path === info.path; });
7155
+ var entries = (containsDragged && picked.length > 1 ? picked : [{ path: info.path, name: info.name, isDir: Boolean(info.isDir) }])
7156
+ .map(function (item) {
7157
+ return { path: item.path, name: item.name, isDir: Boolean(item.isDir) };
7158
+ });
6964
7159
  try {
6965
7160
  event.dataTransfer.setData(DRAG_MIME, JSON.stringify({
6966
- side: side, path: info.path, name: info.name, isDir: Boolean(info.isDir),
7161
+ side: side, path: info.path, name: info.name, isDir: Boolean(info.isDir), entries: entries,
6967
7162
  }));
6968
- event.dataTransfer.effectAllowed = 'copy';
7163
+ event.dataTransfer.effectAllowed = 'copyMove';
6969
7164
  } catch (error) { /* drag payload unsupported */ }
6970
7165
  }
6971
7166
 
@@ -7026,41 +7221,142 @@ function attributeViolation(name, value, tagName) {
7026
7221
  var raw = '';
7027
7222
  try { raw = transfer.getData(DRAG_MIME); } catch (error) { raw = ''; }
7028
7223
  if (!raw) return;
7029
- var entry;
7030
- try { entry = JSON.parse(raw); } catch (error) { return; }
7031
- if (!entry || typeof entry.path !== 'string') return;
7032
- if (entry.side === side) {
7033
- showNotice('error', t('dropSameSide'));
7224
+ var payload;
7225
+ try { payload = JSON.parse(raw); } catch (error) { return; }
7226
+ if (!payload || typeof payload.path !== 'string') return;
7227
+ var entries = Array.isArray(payload.entries)
7228
+ ? payload.entries.filter(function (item) { return item && typeof item.path === 'string'; })
7229
+ : [];
7230
+ if (entries.length === 0) entries = [{ path: payload.path, name: payload.name, isDir: Boolean(payload.isDir) }];
7231
+ if (payload.side === side) {
7232
+ moveEntries(side, entries, targetDir);
7034
7233
  return;
7035
7234
  }
7036
- if (entry.side === 'remote') {
7037
- if (entry.isDir) {
7038
- showNotice('error', t('dropDirUnsupported'));
7039
- return;
7235
+ if (payload.side === 'remote') {
7236
+ var files = entries.filter(function (item) { return !item.isDir; });
7237
+ if (files.length < entries.length) showNotice('error', t('dropDirUnsupported'));
7238
+ if (files.length > 0) pullEntries(files, targetDir);
7239
+ return;
7240
+ }
7241
+ var localFiles = entries.filter(function (item) { return !item.isDir; });
7242
+ if (localFiles.length < entries.length) showNotice('error', t('dropLocalDirUnsupported'));
7243
+ if (localFiles.length > 0) pushEntries(localFiles, targetDir);
7244
+ }
7245
+
7246
+ // Batch transfer: one request per entry, so a conflict is still answered
7247
+ // per file and a partial batch reports how many files actually landed.
7248
+ function pullEntries(entries, targetDir) {
7249
+ var done = 0;
7250
+ function settled() {
7251
+ if (done > 0) {
7252
+ showNotice('success', t('dropImported', { count: done }));
7253
+ refreshTree();
7040
7254
  }
7041
- var pullParams = Object.assign({ path: entry.path, targetDir: targetDir }, scopeParams(scopeRef));
7042
- apiCall('fs.pullToLocal', pullParams).then(function () {
7043
- showNotice('success', t('dropImported', { count: 1 }));
7255
+ }
7256
+ function step(index) {
7257
+ if (index >= entries.length) { settled(); return; }
7258
+ var params = Object.assign({ path: entries[index].path, targetDir: targetDir }, scopeParams(scopeRef));
7259
+ apiCall('fs.pullToLocal', params).then(function () {
7260
+ done += 1;
7261
+ step(index + 1);
7262
+ }).catch(function (error) {
7263
+ if (openConflict(error, 'fs.pullToLocal', params)) return;
7264
+ settled();
7265
+ noticeError(error);
7266
+ });
7267
+ }
7268
+ step(0);
7269
+ }
7270
+
7271
+ function pushEntries(entries, targetDir) {
7272
+ var done = 0;
7273
+ var skipped = 0;
7274
+ function settled() {
7275
+ if (done > 0) {
7276
+ showNotice('success', t('dropImported', { count: done }));
7044
7277
  refreshTree();
7278
+ }
7279
+ if (skipped > 0) showNotice('warn', t('dropSkipped', { count: skipped }));
7280
+ }
7281
+ function step(index) {
7282
+ if (index >= entries.length) { settled(); return; }
7283
+ var params = Object.assign({ path: targetDir, paths: [entries[index].path] }, scopeParams(scopeRef));
7284
+ apiCall('fs.upload', params).then(function (result) {
7285
+ if (Number(result && result.skipped) > 0) skipped += Number(result.skipped);
7286
+ else done += 1;
7287
+ step(index + 1);
7045
7288
  }).catch(function (error) {
7046
- if (openConflict(error, 'fs.pullToLocal', pullParams)) return;
7289
+ if (openConflict(error, 'fs.upload', params)) return;
7290
+ settled();
7047
7291
  noticeError(error);
7048
7292
  });
7049
- return;
7050
7293
  }
7051
- if (entry.isDir) {
7052
- showNotice('error', t('dropLocalDirUnsupported'));
7294
+ step(0);
7295
+ }
7296
+
7297
+ // Moves several entries into one directory (same side). Items already in
7298
+ // the target folder and folders dropped onto themselves are skipped.
7299
+ function moveEntries(side, entries, targetDir) {
7300
+ if (typeof targetDir !== 'string' || targetDir === '') return;
7301
+ var moving = entries.filter(function (entry) {
7302
+ if (!entry || typeof entry.path !== 'string' || entry.path === '') return false;
7303
+ if (entry.path === targetDir) return false;
7304
+ if (entry.isDir && pathUnder(targetDir, entry.path)) return false;
7305
+ return parentPathOf(entry.path, side) !== targetDir;
7306
+ });
7307
+ if (moving.length === 0) return;
7308
+ var blocked = openFiles.some(function (file) {
7309
+ if (file.side !== side || !fileDirty[file.key]) return false;
7310
+ return moving.some(function (entry) { return pathUnder(file.path, entry.path); });
7311
+ });
7312
+ if (blocked) {
7313
+ showNotice('error', t('moveDirty'));
7053
7314
  return;
7054
7315
  }
7055
- var pushParams = Object.assign({ path: targetDir, paths: [entry.path] }, scopeParams(scopeRef));
7056
- apiCall('fs.upload', pushParams).then(function (result) {
7057
- if (Number(result.skipped) > 0) showNotice('warn', t('dropSkipped', { count: result.skipped }));
7058
- else showNotice('success', t('dropImported', { count: Number(result.files) || 1 }));
7059
- refreshTree();
7060
- }).catch(function (error) {
7061
- if (openConflict(error, 'fs.upload', pushParams)) return;
7062
- noticeError(error);
7063
- });
7316
+ var movedPaths = [];
7317
+ var firstError = null;
7318
+ function finish() {
7319
+ if (movedPaths.length > 0) {
7320
+ var keep = openFiles.filter(function (file) {
7321
+ return !(file.side === side && movedPaths.some(function (moved) { return pathUnder(file.path, moved); }));
7322
+ });
7323
+ setOpenFiles(keep);
7324
+ setActiveFileKey(function (activeKey) {
7325
+ var stillOpen = keep.some(function (file) { return file.key === activeKey; });
7326
+ if (stillOpen) return activeKey;
7327
+ return keep.length > 0 ? keep[keep.length - 1].key : null;
7328
+ });
7329
+ setFileDirty(function (previous) {
7330
+ var next = Object.assign({}, previous);
7331
+ openFiles.forEach(function (file) {
7332
+ if (file.side !== side) return;
7333
+ if (movedPaths.some(function (moved) { return pathUnder(file.path, moved); })) delete next[file.key];
7334
+ });
7335
+ return next;
7336
+ });
7337
+ setMulti([]);
7338
+ setDialog(null);
7339
+ refreshTree();
7340
+ showNotice('success', movedPaths.length === 1 ? t('moveDone') : t('moveDoneCount', { count: movedPaths.length }));
7341
+ }
7342
+ if (firstError) noticeError(firstError);
7343
+ }
7344
+ function step(index) {
7345
+ if (index >= moving.length) { finish(); return; }
7346
+ var entry = moving[index];
7347
+ var method = side === 'remote' ? 'fs.move' : 'local.move';
7348
+ var params = side === 'remote'
7349
+ ? Object.assign({ path: entry.path, targetDir: targetDir }, scopeParams(scopeRef))
7350
+ : { path: entry.path, targetDir: targetDir, root: selected.localPath };
7351
+ apiCall(method, params).then(function (result) {
7352
+ movedPaths.push(result && result.path ? result.path : entry.path);
7353
+ step(index + 1);
7354
+ }).catch(function (error) {
7355
+ if (!firstError) firstError = error;
7356
+ step(index + 1);
7357
+ });
7358
+ }
7359
+ step(0);
7064
7360
  }
7065
7361
 
7066
7362
  function submitRenamed(side, oldPath, name) {
@@ -7083,49 +7379,6 @@ function attributeViolation(name, value, tagName) {
7083
7379
  return normalized === parent || normalized.indexOf(parent + '/') === 0 || normalized.indexOf(parent + '\\') === 0;
7084
7380
  }
7085
7381
 
7086
- function moveEntry(side, oldPath, targetDir) {
7087
- var blocked = openFiles.some(function (file) {
7088
- return file.side === side && pathUnder(file.path, oldPath) && fileDirty[file.key];
7089
- });
7090
- if (blocked) {
7091
- showNotice('error', t('moveDirty'));
7092
- return;
7093
- }
7094
- var method = side === 'remote' ? 'fs.move' : 'local.move';
7095
- var params = side === 'remote'
7096
- ? Object.assign({ path: oldPath, targetDir: targetDir }, scopeParams(scopeRef))
7097
- : { path: oldPath, targetDir: targetDir, root: selected.localPath };
7098
- apiCall(method, params).then(function (result) {
7099
- var nextPath = result && result.path ? result.path : oldPath;
7100
- setOpenFiles(function (previous) {
7101
- return previous.filter(function (file) {
7102
- return !(file.side === side && pathUnder(file.path, oldPath));
7103
- });
7104
- });
7105
- setActiveFileKey(function (activeKey) {
7106
- var stillOpen = openFiles.filter(function (file) {
7107
- return file.key === activeKey && !(file.side === side && pathUnder(file.path, oldPath));
7108
- });
7109
- if (stillOpen.length > 0) return activeKey;
7110
- var remaining = openFiles.filter(function (file) {
7111
- return !(file.side === side && pathUnder(file.path, oldPath));
7112
- });
7113
- return remaining.length > 0 ? remaining[remaining.length - 1].key : null;
7114
- });
7115
- setFileDirty(function (previous) {
7116
- var next = Object.assign({}, previous);
7117
- openFiles.forEach(function (file) {
7118
- if (file.side === side && pathUnder(file.path, oldPath)) delete next[file.key];
7119
- });
7120
- return next;
7121
- });
7122
- setDialog(null);
7123
- showNotice('success', t('moveDone'));
7124
- refreshTree();
7125
- if (nextPath !== oldPath) refreshTree();
7126
- }).catch(noticeError);
7127
- }
7128
-
7129
7382
  function submitNew(side, dirPath, name, isDir) {
7130
7383
  var request = newEntryRequest(side, dirPath, name, isDir, scopeParams(scopeRef));
7131
7384
  return apiCall(request.method, request.params).then(function () {
@@ -7174,6 +7427,14 @@ function attributeViolation(name, value, tagName) {
7174
7427
  batch.forEach(function (item) { enqueueTransfer(item.side, item.path, item.name); });
7175
7428
  } });
7176
7429
  items.push({ label: t('ctxDeleteSelected', { count: batch.length }), onSelect: deleteSelection });
7430
+ if (batch.some(function (item) { return item.path === menu.path; })) {
7431
+ items.push({ label: t('ctxMoveSelected', { count: batch.length }), onSelect: function () {
7432
+ setDialog({
7433
+ kind: 'move', side: menu.side, entries: batch, name: menu.name, isDir: true,
7434
+ initialPath: parentPathOf(menu.path, menu.side),
7435
+ });
7436
+ } });
7437
+ }
7177
7438
  items.push({ separator: true });
7178
7439
  }
7179
7440
  if (isRemote) {
@@ -7316,16 +7577,21 @@ function attributeViolation(name, value, tagName) {
7316
7577
  h('button', { type: 'button', className: 'rw-btn rw-btn-sm rw-btn-danger', onClick: function () { resolveConflict('overwrite'); } }, t('conflictOverwrite'))));
7317
7578
  }
7318
7579
  if (dialog.kind === 'move') {
7580
+ var moveTargets = Array.isArray(dialog.entries) && dialog.entries.length > 0
7581
+ ? dialog.entries
7582
+ : [{ path: dialog.path, name: dialog.name, isDir: dialog.isDir }];
7319
7583
  return h(MoveDialog, {
7320
7584
  t: t, locale: locale,
7321
7585
  title: t('moveTitle'),
7322
- message: t('moveMessage', { name: dialog.name }),
7586
+ message: moveTargets.length > 1
7587
+ ? t('moveMessageMany', { count: moveTargets.length })
7588
+ : t('moveMessage', { name: dialog.name }),
7323
7589
  side: dialog.side,
7324
7590
  scope: dialog.side === 'remote' ? sourceScopeOf(selected) : null,
7325
7591
  root: dialog.side === 'remote' ? selected.remotePath : selected.localPath,
7326
7592
  initialPath: dialog.initialPath,
7327
7593
  onClose: function () { setDialog(null); },
7328
- onPick: function (targetDir) { moveEntry(dialog.side, dialog.path, targetDir); },
7594
+ onPick: function (targetDir) { moveEntries(dialog.side, moveTargets, targetDir); },
7329
7595
  });
7330
7596
  }
7331
7597
  if (dialog.kind === 'closeDirty') {
@@ -8036,10 +8302,9 @@ function attributeViolation(name, value, tagName) {
8036
8302
  type: 'button',
8037
8303
  role: 'option',
8038
8304
  'aria-selected': on,
8039
- disabled: !usable,
8040
- title: usable ? host.name : t('noCredential'),
8305
+ title: host.name,
8041
8306
  className: 'rw-host' + (on ? ' is-on' : ''),
8042
- onClick: function () { if (usable && props.onSelect) props.onSelect(host); },
8307
+ onClick: function () { if (props.onSelect) props.onSelect(host); },
8043
8308
  },
8044
8309
  h('span', { className: 'rw-file-icon', style: { color: on ? 'var(--dsw-alias-brand-primary)' : undefined } }, IconServer(16)),
8045
8310
  h('span', { className: 'rw-host-main' },
@@ -8047,12 +8312,74 @@ function attributeViolation(name, value, tagName) {
8047
8312
  h('span', { className: 'rw-host-meta' }, host.username + '@' + host.host + ':' + host.port)),
8048
8313
  usable
8049
8314
  ? h('span', { className: 'rw-chip' }, host.source === 'ssh-config' ? t('sourceConfig') : t('sourceManager'))
8050
- : h('span', { className: 'rw-chip', style: { color: 'var(--dsw-alias-state-warn-primary)' } }, t('noCredential')));
8315
+ : h('span', { className: 'rw-chip', style: { color: 'var(--dsw-alias-state-warn-primary)' } }, t('needPassword')));
8051
8316
  }));
8052
8317
  }
8053
8318
 
8054
- function AddWorkspaceFlow(props) {
8055
- var ctx = props.ctx;
8319
+ // Password field for a host that has no usable key. The plugin keeps the
8320
+ // secret itself, so this works without the optional `dsh-ssh-tunnel` plugin.
8321
+ function SshCredentialField(props) {
8322
+ var t = props.t;
8323
+ var host = props.host;
8324
+ if (!host) return null;
8325
+ var stored = host.hasStoredPassword === true;
8326
+ var needed = host.hasCredential === false || host.authType === 'password';
8327
+ if (!needed && !stored) return null;
8328
+ var checkState = useState({ busy: false, ok: false, message: '' });
8329
+ var check = checkState[0];
8330
+ var setCheck = checkState[1];
8331
+ var inputRef = useRef(null);
8332
+ // Selecting a host that still needs a secret should put the cursor in the
8333
+ // password box, so the dialog asks for it instead of leaving the user to
8334
+ // find the field.
8335
+ useEffect(function () {
8336
+ if (!needed && !stored) return;
8337
+ var node = inputRef.current;
8338
+ if (node && typeof node.focus === 'function') node.focus();
8339
+ }, [host.id, needed, stored]);
8340
+ function verify() {
8341
+ if (check.busy || props.busy) return;
8342
+ var value = props.value || '';
8343
+ if (value === '') { setCheck({ busy: false, ok: false, message: t('sshPasswordRequired') }); return; }
8344
+ setCheck({ busy: true, ok: false, message: '' });
8345
+ apiCall('hosts.credentials', { hostId: host.id, password: value })
8346
+ .then(function () { return apiCall('hosts.browse', { hostId: host.id, path: '' }); })
8347
+ .then(function () {
8348
+ setCheck({ busy: false, ok: true, message: t('sshPasswordOk') });
8349
+ if (props.onVerified) props.onVerified();
8350
+ })
8351
+ .catch(function (err) {
8352
+ setCheck({ busy: false, ok: false, message: t('sshPasswordFailed') + ' ' + messageOf(err, t, props.locale) });
8353
+ if (props.onVerified) props.onVerified();
8354
+ });
8355
+ }
8356
+ return h('div', { className: 'rw-field' },
8357
+ h('div', { className: 'rw-label' }, t('sshPassword')),
8358
+ h('div', { className: 'rw-inline' },
8359
+ h('input', {
8360
+ className: 'rw-input',
8361
+ type: 'password',
8362
+ ref: inputRef,
8363
+ value: props.value || '',
8364
+ placeholder: stored ? t('sshPasswordStored') : t('sshPasswordPlaceholder'),
8365
+ autoComplete: 'new-password',
8366
+ spellCheck: false,
8367
+ disabled: props.busy,
8368
+ onChange: function (event) { props.onChange(event.currentTarget.value); },
8369
+ onKeyDown: function (event) { if (event.key === 'Enter' && props.onSubmit) props.onSubmit(); },
8370
+ }),
8371
+ h('button', {
8372
+ type: 'button',
8373
+ className: 'rw-btn rw-btn-sm',
8374
+ disabled: check.busy || props.busy,
8375
+ onClick: verify,
8376
+ }, check.busy ? t('sshVerifying') : t('sshVerify'))),
8377
+ check.message
8378
+ ? h('div', { className: 'rw-hint', style: check.ok ? { color: '#3fb950' } : { color: '#f85149' } }, check.message)
8379
+ : h('div', { className: 'rw-hint' }, needed && !stored ? t('sshPasswordHint') : t('sshPasswordStoredHint')));
8380
+ }
8381
+
8382
+ function AddWorkspaceFlow(props) { var ctx = props.ctx;
8056
8383
  var t = props.t;
8057
8384
  var locale = props.locale;
8058
8385
  var onDone = props.onDone;
@@ -8088,6 +8415,9 @@ function attributeViolation(name, value, tagName) {
8088
8415
  var localOpenState = useState(false);
8089
8416
  var localOpen = localOpenState[0];
8090
8417
  var setLocalOpen = localOpenState[1];
8418
+ var passwordState = useState('');
8419
+ var password = passwordState[0];
8420
+ var setPassword = passwordState[1];
8091
8421
 
8092
8422
  var loadHosts = useCallback(function () {
8093
8423
  setHostData(function (previous) { return { loading: previous.hosts.length === 0, hosts: previous.hosts, error: null }; });
@@ -8106,6 +8436,7 @@ function attributeViolation(name, value, tagName) {
8106
8436
 
8107
8437
  function chooseHost(host) {
8108
8438
  setSelectedHostId(host.id);
8439
+ setPassword('');
8109
8440
  setError('');
8110
8441
  setRemoteOpen(false);
8111
8442
  if (remotePath.trim() === '' && host && host.hasCredential !== false) {
@@ -8115,6 +8446,16 @@ function attributeViolation(name, value, tagName) {
8115
8446
  }
8116
8447
  }
8117
8448
 
8449
+ function selectedHost() {
8450
+ return hostData.hosts.filter(function (item) { return item.id === selectedHostId; })[0] || null;
8451
+ }
8452
+
8453
+ function needsPassword(host) {
8454
+ if (!host) return false;
8455
+ if (host.hasCredential === false) return true;
8456
+ return host.authType === 'password' && host.hasStoredPassword !== true;
8457
+ }
8458
+
8118
8459
  function submit() {
8119
8460
  if (busy) return;
8120
8461
  if (!selectedHostId) { setError(t('stepHost')); return; }
@@ -8122,14 +8463,21 @@ function attributeViolation(name, value, tagName) {
8122
8463
  if (trimmedRemote === '') { setError(t('stepPath')); return; }
8123
8464
  var trimmedLocal = localPath.trim();
8124
8465
  if (trimmedLocal === '') { setBusy(false); setError(t('stepLocalPath')); return; }
8466
+ var typedPassword = password;
8467
+ if (needsPassword(selectedHost()) && typedPassword === '') { setError(t('sshPasswordRequired')); return; }
8125
8468
  setBusy(true);
8126
8469
  setError('');
8127
- apiCall('linked.create', {
8128
- hostId: selectedHostId,
8129
- remotePath: trimmedRemote,
8130
- localPath: trimmedLocal,
8131
- name: name.trim(),
8132
- mirror: mirror,
8470
+ var stored = typedPassword === ''
8471
+ ? Promise.resolve()
8472
+ : apiCall('hosts.credentials', { hostId: selectedHostId, password: typedPassword }).then(loadHosts);
8473
+ stored.then(function () {
8474
+ return apiCall('linked.create', {
8475
+ hostId: selectedHostId,
8476
+ remotePath: trimmedRemote,
8477
+ localPath: trimmedLocal,
8478
+ name: name.trim(),
8479
+ mirror: mirror,
8480
+ });
8133
8481
  }).then(function () {
8134
8482
  setBusy(false);
8135
8483
  bus.emit();
@@ -8149,6 +8497,10 @@ function attributeViolation(name, value, tagName) {
8149
8497
  h('div', { className: 'rw-label' }, t('stepHost')),
8150
8498
  h(HostList, { t: t, hosts: hostData.hosts, loading: hostData.loading, selectedId: selectedHostId, onSelect: chooseHost }),
8151
8499
  hostData.error ? h(Banner, { kind: 'error' }, t('hostsFailed') + ':' + messageOf(hostData.error, t, locale)) : null),
8500
+ h(SshCredentialField, {
8501
+ t: t, locale: locale, host: selectedHost(), value: password, busy: busy,
8502
+ onChange: setPassword, onSubmit: submit, onVerified: loadHosts,
8503
+ }),
8152
8504
  h('div', { className: 'rw-field' },
8153
8505
  h('div', { className: 'rw-label' }, t('stepPath')),
8154
8506
  h('div', { className: 'rw-input-row' },
@@ -8250,6 +8602,9 @@ function attributeViolation(name, value, tagName) {
8250
8602
  var remoteOpenState = useState(false);
8251
8603
  var remoteOpen = remoteOpenState[0];
8252
8604
  var setRemoteOpen = remoteOpenState[1];
8605
+ var passwordState = useState('');
8606
+ var password = passwordState[0];
8607
+ var setPassword = passwordState[1];
8253
8608
 
8254
8609
  var loadHosts = useCallback(function () {
8255
8610
  setHostData(function (previous) { return { loading: previous.hosts.length === 0, hosts: previous.hosts, error: null }; });
@@ -8268,6 +8623,7 @@ function attributeViolation(name, value, tagName) {
8268
8623
 
8269
8624
  function chooseHost(host) {
8270
8625
  setSelectedHostId(host.id);
8626
+ setPassword('');
8271
8627
  setError('');
8272
8628
  setRemoteOpen(false);
8273
8629
  if (remotePath.trim() === '' && host && host.hasCredential !== false) {
@@ -8277,17 +8633,34 @@ function attributeViolation(name, value, tagName) {
8277
8633
  }
8278
8634
  }
8279
8635
 
8636
+ function selectedHost() {
8637
+ return hostData.hosts.filter(function (item) { return item.id === selectedHostId; })[0] || null;
8638
+ }
8639
+
8640
+ function needsPassword(host) {
8641
+ if (!host) return false;
8642
+ if (host.hasCredential === false) return true;
8643
+ return host.authType === 'password' && host.hasStoredPassword !== true;
8644
+ }
8645
+
8280
8646
  function submit() {
8281
8647
  if (busy) return;
8282
8648
  if (!selectedHostId) { setError(t('stepHost')); return; }
8283
8649
  var trimmedRemote = remotePath.trim();
8284
8650
  if (trimmedRemote === '') { setError(t('stepPath')); return; }
8651
+ var typedPassword = password;
8652
+ if (needsPassword(selectedHost()) && typedPassword === '') { setError(t('sshPasswordRequired')); return; }
8285
8653
  setBusy(true);
8286
8654
  setError('');
8287
- apiCall('remote_workspaces.create', {
8288
- hostId: selectedHostId,
8289
- remotePath: trimmedRemote,
8290
- name: name.trim(),
8655
+ var stored = typedPassword === ''
8656
+ ? Promise.resolve()
8657
+ : apiCall('hosts.credentials', { hostId: selectedHostId, password: typedPassword }).then(loadHosts);
8658
+ stored.then(function () {
8659
+ return apiCall('remote_workspaces.create', {
8660
+ hostId: selectedHostId,
8661
+ remotePath: trimmedRemote,
8662
+ name: name.trim(),
8663
+ });
8291
8664
  }).then(function () {
8292
8665
  setBusy(false);
8293
8666
  bus.emit();
@@ -8308,6 +8681,10 @@ function attributeViolation(name, value, tagName) {
8308
8681
  h('div', { className: 'rw-label' }, t('stepHost')),
8309
8682
  h(HostList, { t: t, hosts: hostData.hosts, loading: hostData.loading, selectedId: selectedHostId, onSelect: chooseHost }),
8310
8683
  hostData.error ? h(Banner, { kind: 'error' }, t('hostsFailed') + ':' + messageOf(hostData.error, t, locale)) : null),
8684
+ h(SshCredentialField, {
8685
+ t: t, locale: locale, host: selectedHost(), value: password, busy: busy,
8686
+ onChange: setPassword, onSubmit: submit, onVerified: loadHosts,
8687
+ }),
8311
8688
  h('div', { className: 'rw-field' },
8312
8689
  h('div', { className: 'rw-label' }, t('stepPath')),
8313
8690
  h('div', { className: 'rw-input-row' },
@@ -8416,6 +8793,50 @@ function attributeViolation(name, value, tagName) {
8416
8793
  if (target && typeof target.focus === 'function') target.focus();
8417
8794
  }, [props.open, flow]);
8418
8795
 
8796
+ // The app shell listens for wheel gestures on the document root and moves
8797
+ // the conversation behind the dialog, so a wheel over the host list (or
8798
+ // anywhere else in the dialog) never reaches the dialog's own scroll
8799
+ // areas. Take the gesture in the capture phase: scroll the innermost
8800
+ // scrollable element inside the dialog, chain to the next one at the
8801
+ // edges, and never let the page behind move while the dialog is open.
8802
+ useEffect(function () {
8803
+ if (!props.open) return undefined;
8804
+ var node = modalRef.current;
8805
+ if (!node) return undefined;
8806
+ var overlay = node.closest ? (node.closest('.rw-modal-backdrop') || node) : node;
8807
+
8808
+ function firstScrollable(start) {
8809
+ var el = start;
8810
+ while (el && el !== overlay) {
8811
+ if (el.scrollHeight > el.clientHeight + 1) {
8812
+ var overflow = getComputedStyle(el).overflowY;
8813
+ if (overflow === 'auto' || overflow === 'scroll') return el;
8814
+ }
8815
+ el = el.parentElement;
8816
+ }
8817
+ return null;
8818
+ }
8819
+
8820
+ function onWheel(event) {
8821
+ if (!event.deltaY) return;
8822
+ if (!overlay.contains(event.target)) return;
8823
+ event.preventDefault();
8824
+ event.stopPropagation();
8825
+ if (event.stopImmediatePropagation) event.stopImmediatePropagation();
8826
+ var step = event.deltaY * (event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? 400 : 1);
8827
+ var el = firstScrollable(event.target && event.target.nodeType === 1 ? event.target : overlay);
8828
+ while (el) {
8829
+ var before = el.scrollTop;
8830
+ el.scrollTop = before + step;
8831
+ if (el.scrollTop !== before) return;
8832
+ el = firstScrollable(el.parentElement);
8833
+ }
8834
+ }
8835
+
8836
+ window.addEventListener('wheel', onWheel, { passive: false, capture: true });
8837
+ return function () { window.removeEventListener('wheel', onWheel, { capture: true }); };
8838
+ }, [props.open]);
8839
+
8419
8840
  function onModalKeyDown(event) {
8420
8841
  if (event.key === 'Escape') {
8421
8842
  event.preventDefault();
@@ -9153,6 +9574,40 @@ function attributeViolation(name, value, tagName) {
9153
9574
  };
9154
9575
  }, 'dsh-linked-workspace: workspace row icons');
9155
9576
 
9577
+ // The settings list draws a default glyph unless a plugin claims the icon
9578
+ // seat; the id has to match the section id above.
9579
+ try {
9580
+ ctx.slots.inject('settings.section.icon', function () {
9581
+ return ctx.slots.register({
9582
+ name: 'settings.section.icon',
9583
+ id: 'linked-workspaces',
9584
+ order: 52,
9585
+ label: function () { return makeT(readLocale(ctx))('settingsNav'); },
9586
+ }, function (props) {
9587
+ return IconSettingsNav(props && props.size ? props.size : 16);
9588
+ });
9589
+ });
9590
+ } catch (error) {
9591
+ console.error('[dsh-linked-workspace] settings icon registration failed', error && error.message ? error.message : error);
9592
+ }
9593
+
9594
+ // First-run welcome card: shell.overlay is the frame-wide floating layer,
9595
+ // so the card lands above every column without touching any panel.
9596
+ try {
9597
+ ctx.slots.inject('shell.overlay', function () {
9598
+ return ctx.slots.register({
9599
+ name: 'shell.overlay',
9600
+ id: 'linked-workspace-welcome',
9601
+ order: 80,
9602
+ label: function () { return makeT(readLocale(ctx))('welcomeTitle'); },
9603
+ }, function (props) {
9604
+ return h(WelcomeCard, Object.assign({}, props, { ctx: ctx }));
9605
+ });
9606
+ });
9607
+ } catch (error) {
9608
+ console.error('[dsh-linked-workspace] welcome card registration failed', error && error.message ? error.message : error);
9609
+ }
9610
+
9156
9611
  try {
9157
9612
  ctx.slots.inject('settings.section', function () {
9158
9613
  return ctx.slots.register({