dsh-remote-local-plugin 0.8.8 → 0.8.9

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/README.md CHANGED
@@ -7,7 +7,7 @@ Remote development that appears as ordinary local sessions.
7
7
  This plugin targets the official **DSH Desktop** application. Tested/supported versions:
8
8
 
9
9
  - [DSH Desktop](https://github.com/deepseek-ai/deepseek-harness) [`0.2.1-rc.2`](https://github.com/deepseek-ai/deepseek-harness/releases/tag/dsh-v0.2.1-rc.2)
10
- - Plugin [`0.8.8`](https://www.npmjs.com/package/dsh-remote-local-plugin)
10
+ - Plugin [`0.8.9`](https://www.npmjs.com/package/dsh-remote-local-plugin)
11
11
  - Remote DSH [`0.2.1-rc.2`](https://github.com/deepseek-ai/deepseek-harness/releases/tag/dsh-v0.2.1-rc.2)
12
12
  - Remote [Node.js `22.19+`](https://nodejs.org/en/download) on Linux/macOS
13
13
 
package/lib/client.js CHANGED
@@ -672,27 +672,50 @@ function installNativeWorkspaceRouting(ctx, api) {
672
672
  original(workspaceId, options);
673
673
  return;
674
674
  }
675
- void route(api, String(workspaceId)).then((routed) => {
676
- if (!routed) original(workspaceId, options);
677
- }).catch(() => {
678
- original(workspaceId, options);
675
+ void route(api, String(workspaceId)).then((result) => {
676
+ if (result === "local") {
677
+ original(workspaceId, options);
678
+ return;
679
+ }
680
+ if (result === "blocked") {
681
+ showToast("\u8FDC\u7AEF\u5DE5\u4F5C\u533A\u5F53\u524D\u4E0D\u53EF\u7528\uFF0C\u672A\u521B\u5EFA\u672C\u5730\u4F1A\u8BDD\u3002\u8BF7\u5148\u6062\u590D\u8FDC\u7AEF\u8FDE\u63A5\u3002");
682
+ }
683
+ }).catch((error) => {
684
+ showToast(`\u65E0\u6CD5\u5728\u8FDC\u7AEF\u5DE5\u4F5C\u533A\u521B\u5EFA\u4F1A\u8BDD\uFF1A${error instanceof Error ? error.message : String(error)}`);
679
685
  });
680
686
  };
681
687
  }
682
688
  async function route(api, localWorkspaceId) {
683
689
  const state = await api.state();
690
+ const mirrored = Array.isArray(state.mirroredWorkspaceIds) ? state.mirroredWorkspaceIds : [];
691
+ if (!mirrored.includes(localWorkspaceId)) return "local";
684
692
  for (const host of state.hosts) {
685
693
  if (host.phase !== "connected") continue;
686
- const result = await api.workspaces(host.id);
694
+ let result;
695
+ try {
696
+ result = await api.workspaces(host.id);
697
+ } catch {
698
+ continue;
699
+ }
687
700
  const workspace = result.workspaces.find((item) => item.localWorkspaceId === localWorkspaceId);
688
701
  if (workspace === void 0) continue;
689
702
  const created = await api.createSession(host.id, { workspaceId: workspace.workspaceId });
690
703
  if (created.localSessionId !== void 0) {
691
704
  api.openSession(created.localSessionId);
692
- return true;
705
+ return "handled";
693
706
  }
707
+ return "blocked";
694
708
  }
695
- return false;
709
+ return "blocked";
710
+ }
711
+ function showToast(text) {
712
+ const toast = document.createElement("div");
713
+ toast.textContent = text;
714
+ toast.style.cssText = "position:fixed;z-index:9999;left:50%;bottom:28px;transform:translateX(-50%);max-width:min(560px,90vw);padding:10px 14px;border-radius:10px;background:rgba(30,30,32,.96);color:#fff;font:13px/1.5 system-ui,-apple-system,sans-serif;box-shadow:0 8px 30px rgba(0,0,0,.35)";
715
+ document.body.append(toast);
716
+ window.setTimeout(() => {
717
+ toast.remove();
718
+ }, 6e3);
696
719
  }
697
720
 
698
721
  // src/client/remote-files.ts
@@ -1183,7 +1206,7 @@ async function openCreateDialog(flow, anchor) {
1183
1206
  });
1184
1207
  return;
1185
1208
  }
1186
- const initial = destination.host.hostInfo?.home ?? "~";
1209
+ const initial = "~";
1187
1210
  openDirectoryBrowser(flow, destination, initial, (path) => {
1188
1211
  selectedPath = path;
1189
1212
  update();
@@ -1393,13 +1416,13 @@ async function openDirectoryBrowser(flow, destination, initialPath, onPick) {
1393
1416
  list.append(item);
1394
1417
  }
1395
1418
  };
1396
- const load = async (path) => {
1419
+ const load = async (path, preserveInput = false) => {
1397
1420
  const listing = await fetchListing(path);
1398
1421
  if (listing === void 0) return;
1399
1422
  current = listing.path;
1400
1423
  parent = listing.parent;
1401
1424
  currentEntries = listing.entries;
1402
- pathInput.value = listing.path;
1425
+ if (!preserveInput) pathInput.value = listing.path;
1403
1426
  status.textContent = flow.t("dialog.selectFolder");
1404
1427
  render(listing.entries);
1405
1428
  };
@@ -1409,7 +1432,7 @@ async function openDirectoryBrowser(flow, destination, initialPath, onPick) {
1409
1432
  const dir = slash < 0 ? current : raw.slice(0, slash + 1) || "/";
1410
1433
  const query = slash < 0 ? raw : raw.slice(slash + 1);
1411
1434
  if (query === "") {
1412
- await load(raw);
1435
+ await load(raw, true);
1413
1436
  return;
1414
1437
  }
1415
1438
  const normalizedCurrent = current.replace(/\/+$/u, "") || "/";