dsh-local-link 1.2.4 → 1.2.6

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/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
2
  import { Context } from "@deepseek-ai/cordis";
3
- //#region src/config.d.ts
4
3
  type AccessMode = 'pairing' | 'trusted-lan';
5
4
  interface PluginConfig {
6
5
  listenHost?: string;
@@ -15,8 +14,6 @@ interface PluginConfig {
15
14
  stateFile: string;
16
15
  }
17
16
  declare const Config: z<PluginConfig>;
18
- //#endregion
19
- //#region src/plugin.d.ts
20
17
  interface LocalLinkGatewayService {
21
18
  readonly trustedHosts: readonly string[];
22
19
  }
@@ -28,6 +25,5 @@ declare module '@deepseek-ai/cordis' {
28
25
  declare const name = "dsh-local-link";
29
26
  declare const inject: string[];
30
27
  declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
31
- //#endregion
32
28
  export { type AccessMode, Config, type PluginConfig, apply, inject, name };
33
29
  //# sourceMappingURL=index.d.mts.map
package/lib/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { networkInterfaces } from "node:os";
6
6
  import { createServer, request } from "node:http";
7
7
  import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
8
8
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
9
- //#region src/network.ts
9
+ // src/network.ts
10
10
  function normalizeAddress(address) {
11
11
  const zone = address.indexOf("%");
12
12
  return zone < 0 ? address : address.slice(0, zone);
@@ -60,8 +60,7 @@ function allowedGatewayHost(value, listenHost, listenPort, addresses) {
60
60
  if (parsed === void 0 || parsed.port !== listenPort) return false;
61
61
  return (listenHost === "0.0.0.0" ? addresses : [listenHost]).includes(parsed.hostname);
62
62
  }
63
- //#endregion
64
- //#region src/config.ts
63
+ // src/config.ts
65
64
  const Config = z.object({
66
65
  listenHost: z.string().default("0.0.0.0"),
67
66
  listenPort: z.natural().max(65535).default(3088),
@@ -103,8 +102,7 @@ function parseConfig(value) {
103
102
  stateFile
104
103
  });
105
104
  }
106
- //#endregion
107
- //#region src/gateway/admin-auth.ts
105
+ // src/gateway/admin-auth.ts
108
106
  function loopbackHostname(value) {
109
107
  const hostname = value.toLowerCase().replace(/^\[|\]$/gu, "");
110
108
  if (hostname === "localhost" || hostname === "::1") return true;
@@ -138,8 +136,7 @@ function isLoopbackAdminSource(remoteAddress, host, origin) {
138
136
  const remote = remoteAddress?.replace(/^::ffff:/u, "");
139
137
  return (remote === "127.0.0.1" || remote === "::1") && loopbackAuthority(host) && loopbackOrigin(origin);
140
138
  }
141
- //#endregion
142
- //#region src/auth/device-store.ts
139
+ // src/auth/device-store.ts
143
140
  function hashToken(token) {
144
141
  return createHash("sha256").update(token, "utf8").digest();
145
142
  }
@@ -278,8 +275,7 @@ var DeviceStore = class {
278
275
  return write;
279
276
  }
280
277
  };
281
- //#endregion
282
- //#region src/auth/pairing.ts
278
+ // src/auth/pairing.ts
283
279
  var PairingTokens = class {
284
280
  ttlMs;
285
281
  current;
@@ -319,8 +315,7 @@ var PairingTokens = class {
319
315
  return this.current.status;
320
316
  }
321
317
  };
322
- //#endregion
323
- //#region src/diagnostics.ts
318
+ // src/diagnostics.ts
324
319
  const SAFE_CONTEXT_KEYS = /* @__PURE__ */ new Set([
325
320
  "reason",
326
321
  "method",
@@ -447,10 +442,13 @@ var DiagnosticStore = class {
447
442
  return write;
448
443
  }
449
444
  };
450
- //#endregion
451
- //#region src/gateway/html.ts
445
+ // src/gateway/html.ts
452
446
  const CLIENT_ID = "dsh-local-link";
453
- const HOST_DIRECTORY_PICKER_IDS = /* @__PURE__ */ new Set(["@deepseek-ai/dsh-client-ui-directory-picker-native", "@deepseek-ai/dsh-client-ui-directory-picker-browse"]);
447
+ const HOST_ONLY_CLIENT_IDS = /* @__PURE__ */ new Set([
448
+ "@deepseek-ai/dsh-client-ui-directory-picker-native",
449
+ "@deepseek-ai/dsh-client-ui-directory-picker-browse",
450
+ "@deepseek-ai/dsh-client-ui-open-in-app"
451
+ ]);
454
452
  const RANDOM_UUID_POLYFILL = `if(!window.crypto.randomUUID){window.crypto.randomUUID=function(){const b=new Uint8Array(16);window.crypto.getRandomValues(b);b[6]=(b[6]&15)|64;b[8]=(b[8]&63)|128;const h=Array.from(b,value=>value.toString(16).padStart(2,'0'));return h.slice(0,4).join('')+'-'+h.slice(4,6).join('')+'-'+h.slice(6,8).join('')+'-'+h.slice(8,10).join('')+'-'+h.slice(10).join('')}};`;
455
453
  function ensureResponsiveViewport(html) {
456
454
  const match = /<meta\b(?=[^>]*\bname\s*=\s*["']viewport["'])[^>]*>/iu.exec(html);
@@ -465,11 +463,11 @@ function ensureResponsiveViewport(html) {
465
463
  const replacement = content.test(match[0]) ? match[0].replace(content, (_whole, quote, value) => `content=${quote}${value},viewport-fit=cover${quote}`) : match[0].replace(/\s*\/?>$/u, " content=\"width=device-width,initial-scale=1,viewport-fit=cover\">");
466
464
  return `${html.slice(0, match.index)}${replacement}${html.slice(match.index + match[0].length)}`;
467
465
  }
468
- function removeHostDirectoryPickers(manifest, entries) {
466
+ function removeHostOnlyCapabilities(manifest, entries) {
469
467
  const removed = /* @__PURE__ */ new Set();
470
468
  for (let index = entries.length - 1; index >= 0; index -= 1) {
471
469
  const id = String(entries[index]?.id);
472
- if (!HOST_DIRECTORY_PICKER_IDS.has(id)) continue;
470
+ if (!HOST_ONLY_CLIENT_IDS.has(id)) continue;
473
471
  removed.add(id);
474
472
  entries.splice(index, 1);
475
473
  }
@@ -482,7 +480,7 @@ function removeHostDirectoryPickers(manifest, entries) {
482
480
  }
483
481
  /**
484
482
  * Keep the shipped Harness root and every dynamic child slot. The gateway only
485
- * removes Host-side directory picker capabilities from remote browsers and
483
+ * removes Host-side directory picker and native app capabilities from remote browsers and
486
484
  * adds the secure-context polyfill required by the stock browser transport.
487
485
  */
488
486
  function rewriteAuthenticatedIndex(html) {
@@ -496,11 +494,10 @@ function rewriteAuthenticatedIndex(html) {
496
494
  if (!Array.isArray(manifest.entries)) throw new Error("DSH boot manifest has no entries");
497
495
  const entries = manifest.entries;
498
496
  if (!entries.some((entry) => entry.id === CLIENT_ID)) throw new Error("dsh-local-link client is absent from DSH boot manifest");
499
- removeHostDirectoryPickers(manifest, entries);
497
+ removeHostOnlyCapabilities(manifest, entries);
500
498
  return ensureResponsiveViewport(`${html.slice(0, assignment.index)}${RANDOM_UUID_POLYFILL}${assignment[0]}${JSON.stringify(manifest)};${html.slice(scriptEnd)}`);
501
499
  }
502
- //#endregion
503
- //#region src/locales/en.json
500
+ // src/locales/en.json
504
501
  var pair_title$1 = "Connecting to DeepSeek Harness";
505
502
  var pair_connecting$1 = "Connecting this device…";
506
503
  var pair_incomplete$1 = "This connection link is incomplete.";
@@ -508,8 +505,7 @@ var pair_expired$1 = "This QR code expired or was already used.";
508
505
  var pair_failed$1 = "Could not connect this device.";
509
506
  var pair_unreachable$1 = "Could not reach this computer. Check the local network and try again.";
510
507
  var pair_timeout$1 = "Connection timed out. Generate a new code and try again.";
511
- //#endregion
512
- //#region src/locales/zh.json
508
+ // src/locales/zh.json
513
509
  var pair_title = "正在连接 DeepSeek Harness";
514
510
  var pair_connecting = "正在连接此设备…";
515
511
  var pair_incomplete = "此连接链接不完整。";
@@ -517,8 +513,7 @@ var pair_expired = "此二维码已过期或已被使用。";
517
513
  var pair_failed = "无法连接此设备。";
518
514
  var pair_unreachable = "无法访问此计算机。请检查本地网络后重试。";
519
515
  var pair_timeout = "连接超时。请生成新二维码后重试。";
520
- //#endregion
521
- //#region src/gateway/pair-page.ts
516
+ // src/gateway/pair-page.ts
522
517
  const PAIR_PATH = "/__dsh-local-link/pair";
523
518
  const CONNECT_PATH = "/__dsh-local-link/connect";
524
519
  const pairCopies = {
@@ -585,8 +580,7 @@ const PAIR_PAGE = `<!doctype html>
585
580
  }catch(error){stop(error instanceof Error?error.message:copy.failed);}})();
586
581
  <\/script>
587
582
  </html>`;
588
- //#endregion
589
- //#region src/gateway/local-gateway.ts
583
+ // src/gateway/local-gateway.ts
590
584
  const COOKIE_NAME = "dsh_local_link_device";
591
585
  const MAX_PAIR_BODY = 4096;
592
586
  const STREAM_PATHS = /* @__PURE__ */ new Set([
@@ -710,7 +704,16 @@ function supportedWebSocketTarget(target) {
710
704
  function isLoopbackOnlyRpcTarget(target) {
711
705
  if (!target.pathname.startsWith("/api/")) return false;
712
706
  try {
713
- return LOOPBACK_ONLY_RPC_METHODS.has(decodeURIComponent(target.pathname.slice(5)));
707
+ const method = decodeURIComponent(target.pathname.slice(5)).replaceAll("/", ".").replace(/^agentPresets\./u, "agentPreset.");
708
+ return LOOPBACK_ONLY_RPC_METHODS.has(method);
709
+ } catch {
710
+ return true;
711
+ }
712
+ }
713
+ function isLoopbackOnlyNativeTarget(target) {
714
+ try {
715
+ const pathname = decodeURIComponent(target.pathname);
716
+ return pathname === "/open-in-app" || pathname.startsWith("/open-in-app/");
714
717
  } catch {
715
718
  return true;
716
719
  }
@@ -897,7 +900,7 @@ var LocalGateway = class {
897
900
  }
898
901
  return;
899
902
  }
900
- if (isLoopbackOnlyRpcTarget(url)) {
903
+ if (isLoopbackOnlyRpcTarget(url) || isLoopbackOnlyNativeTarget(url)) {
901
904
  this.diagnostics.record("warn", "REQUEST_REJECTED", { reason: "loopback_only_rpc" });
902
905
  send(response, 403, "This DeepSeek Harness action is available only on the host computer.");
903
906
  return;
@@ -998,8 +1001,7 @@ var LocalGateway = class {
998
1001
  });
999
1002
  }
1000
1003
  };
1001
- //#endregion
1002
- //#region src/plugin.ts
1004
+ // src/plugin.ts
1003
1005
  const name = "dsh-local-link";
1004
1006
  const inject = ["webServer"];
1005
1007
  const ADMIN_PREFIX = "/__dsh-local-link/admin";
@@ -1130,7 +1132,6 @@ async function apply(ctx, config) {
1130
1132
  };
1131
1133
  }, "dsh-local-link: local authenticated mobile gateway");
1132
1134
  }
1133
- //#endregion
1134
1135
  export { Config, apply, inject, name };
1135
1136
 
1136
1137
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-local-link",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "DeepSeek Harness plugin for lightweight LAN access to the current Web UI from phones, tablets, and other computers.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "engines": {
68
68
  "node": "^22.19.0 || >=24.0.0",
69
- "dsh": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-rc.2"
69
+ "dsh": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-rc.2 || 0.2.1-rc.5 || 0.2.2-rc.1"
70
70
  },
71
71
  "keywords": [
72
72
  "deepseek",
@@ -90,7 +90,7 @@
90
90
  "author": "DoNotEatMe",
91
91
  "peerDependencies": {
92
92
  "@deepseek-ai/cordis": "^4.0.2",
93
- "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-rc.2",
93
+ "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-alpha.2 || 0.2.1-rc.2 || 0.2.1-rc.5 || 0.2.2-rc.1",
94
94
  "react": "^18.2.0"
95
95
  },
96
96
  "peerDependenciesMeta": {
@@ -105,49 +105,49 @@
105
105
  }
106
106
  },
107
107
  "dependencies": {
108
- "@deepseek-ai/schemastery": "^3.18.5",
108
+ "@deepseek-ai/schemastery": "~3.19.0",
109
109
  "qrcode": "^1.5.4"
110
110
  },
111
111
  "devDependencies": {
112
- "@deepseek-ai/cordis": "^4.0.5",
113
- "@deepseek-ai/cordis-plugin-include": "1.0.10",
114
- "@deepseek-ai/dsh-agent": "0.2.1-rc.2",
115
- "@deepseek-ai/dsh-agent-default-model": "0.2.1-rc.2",
116
- "@deepseek-ai/dsh-api-gateway": "0.2.1-rc.2",
117
- "@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.2",
118
- "@deepseek-ai/dsh-atomic-write": "0.2.1-rc.2",
119
- "@deepseek-ai/dsh-attachment": "0.2.1-rc.2",
120
- "@deepseek-ai/dsh-client-connection": "0.2.1-rc.2",
121
- "@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
122
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
123
- "@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.2",
124
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
125
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
126
- "@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.2",
127
- "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.2",
128
- "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.2",
129
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
130
- "@deepseek-ai/dsh-client-ui-theme": "0.2.1-rc.2",
131
- "@deepseek-ai/dsh-file-reference": "0.2.1-rc.2",
132
- "@deepseek-ai/dsh-home-paths": "0.2.1-rc.2",
133
- "@deepseek-ai/dsh-host-webserver": "0.2.1-rc.2",
134
- "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
135
- "@deepseek-ai/dsh-native-command": "0.2.1-rc.2",
136
- "@deepseek-ai/dsh-sandbox": "0.2.1-rc.2",
137
- "@deepseek-ai/dsh-scope": "0.2.1-rc.2",
138
- "@deepseek-ai/dsh-session": "0.2.1-rc.2",
139
- "@deepseek-ai/dsh-session-log-export": "0.2.1-rc.2",
140
- "@deepseek-ai/dsh-session-persistence": "0.2.1-rc.2",
141
- "@deepseek-ai/dsh-session-projection": "0.2.1-rc.2",
142
- "@deepseek-ai/dsh-session-query": "0.2.1-rc.2",
143
- "@deepseek-ai/dsh-session-title": "0.2.1-rc.2",
144
- "@deepseek-ai/dsh-settings": "0.2.1-rc.2",
145
- "@deepseek-ai/dsh-skill": "0.2.1-rc.2",
146
- "@deepseek-ai/dsh-storage": "0.2.1-rc.2",
147
- "@deepseek-ai/dsh-storage-domain": "0.2.1-rc.2",
148
- "@deepseek-ai/dsh-subagent": "0.2.1-rc.2",
149
- "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
150
- "@deepseek-ai/dsh-timeout": "0.2.1-rc.2",
112
+ "@deepseek-ai/cordis": "~4.1.0",
113
+ "@deepseek-ai/cordis-plugin-include": "~1.1.0",
114
+ "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
115
+ "@deepseek-ai/dsh-agent-default-model": "0.2.2-rc.1",
116
+ "@deepseek-ai/dsh-api-gateway": "0.2.2-rc.1",
117
+ "@deepseek-ai/dsh-api-session-controller": "0.2.2-rc.1",
118
+ "@deepseek-ai/dsh-atomic-write": "0.2.2-rc.1",
119
+ "@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
120
+ "@deepseek-ai/dsh-client-connection": "0.2.2-rc.1",
121
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.1",
122
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.2-rc.1",
123
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.2-rc.1",
124
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.1",
125
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.1",
126
+ "@deepseek-ai/dsh-client-ui-session": "0.2.2-rc.1",
127
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.1",
128
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.2-rc.1",
129
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.1",
130
+ "@deepseek-ai/dsh-client-ui-theme": "0.2.2-rc.1",
131
+ "@deepseek-ai/dsh-file-reference": "0.2.2-rc.1",
132
+ "@deepseek-ai/dsh-home-paths": "0.2.2-rc.1",
133
+ "@deepseek-ai/dsh-host-webserver": "0.2.2-rc.1",
134
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
135
+ "@deepseek-ai/dsh-native-command": "0.2.2-rc.1",
136
+ "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
137
+ "@deepseek-ai/dsh-scope": "0.2.2-rc.1",
138
+ "@deepseek-ai/dsh-session": "0.2.2-rc.1",
139
+ "@deepseek-ai/dsh-session-log-export": "0.2.2-rc.1",
140
+ "@deepseek-ai/dsh-session-persistence": "0.2.2-rc.1",
141
+ "@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
142
+ "@deepseek-ai/dsh-session-query": "0.2.2-rc.1",
143
+ "@deepseek-ai/dsh-session-title": "0.2.2-rc.1",
144
+ "@deepseek-ai/dsh-settings": "0.2.2-rc.1",
145
+ "@deepseek-ai/dsh-skill": "0.2.2-rc.1",
146
+ "@deepseek-ai/dsh-storage": "0.2.2-rc.1",
147
+ "@deepseek-ai/dsh-storage-domain": "0.2.2-rc.1",
148
+ "@deepseek-ai/dsh-subagent": "0.2.2-rc.1",
149
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
150
+ "@deepseek-ai/dsh-timeout": "0.2.2-rc.1",
151
151
  "@types/node": "^24.3.0",
152
152
  "@types/qrcode": "^1.5.5",
153
153
  "@types/react": "~18.3.1",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file