dsh-auth-remote 0.2.0 → 0.3.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.
package/dist/index.js CHANGED
@@ -11,12 +11,14 @@ import WebServer from "@deepseek-ai/dsh-host-webserver";
11
11
  import semver from "semver";
12
12
  var WEB_SERVER_PACKAGE = "@deepseek-ai/dsh-host-webserver";
13
13
  var CONNECTION_PACKAGE = "@deepseek-ai/dsh-client-connection";
14
- var SUPPORTED_DSH_RANGE = ">=0.1.7-rc.1";
14
+ var SUPPORTED_DSH_RANGE = ">=0.2.1-alpha.3";
15
15
  function packageManifest(packageName, anchor) {
16
16
  const path = realpathSync(createRequire(anchor).resolve(`${packageName}/package.json`));
17
17
  const manifest = JSON.parse(readFileSync(path, "utf8"));
18
18
  if (manifest.name !== packageName || !semver.satisfies(manifest.version, SUPPORTED_DSH_RANGE, { includePrerelease: true })) {
19
- throw new Error(`auth-remote: unsupported ${packageName} version ${manifest.version}`);
19
+ throw new Error(
20
+ `auth-remote: unsupported ${packageName} version ${manifest.version}; minimum DSH 0.2.1-alpha.3. Upgrade to DSH 0.2.1-rc.4; last supported plugin for older DSH: 0.2.0. See README.md and docs/support-history.md.`
21
+ );
20
22
  }
21
23
  return { path, manifest };
22
24
  }
@@ -237,7 +239,6 @@ function startupLines(profile, config) {
237
239
 
238
240
  // src/adapters/dsh/runtime-capabilities.ts
239
241
  import * as NativeWebServer from "@deepseek-ai/dsh-host-webserver";
240
- import { isIP as isIP2 } from "node:net";
241
242
  import semver2 from "semver";
242
243
 
243
244
  // src/adapters/dsh/public-url.ts
@@ -456,25 +457,15 @@ function listenerPublicUrl(host, port, protocol) {
456
457
  }
457
458
 
458
459
  // src/adapters/dsh/runtime-capabilities.ts
459
- function getRuntimeCapabilities(version) {
460
+ function assertRuntimeVersion(version) {
460
461
  if (!semver2.satisfies(version, SUPPORTED_DSH_RANGE, { includePrerelease: true }))
461
- throw new Error(`auth-remote: unsupported DSH version ${version}`);
462
- return Object.freeze({
463
- version,
464
- publicUrl: semver2.gte(version, "0.2.1-alpha.1"),
465
- nativeTransport: semver2.gte(version, "0.2.1-alpha.2")
466
- });
462
+ throw new Error(
463
+ `auth-remote: unsupported DSH version ${version}; minimum DSH 0.2.1-alpha.3. Upgrade to DSH 0.2.1-rc.4; last supported plugin for older DSH: 0.2.0. See README.md and docs/support-history.md.`
464
+ );
467
465
  }
468
- function validateListenerConfig(capabilities, config, native = NativeWebServer) {
466
+ function validateListenerConfig(config, native = NativeWebServer) {
469
467
  if (!Number.isInteger(config.port) || config.port < 0 || config.port > 65535)
470
468
  throw new Error("auth-remote: invalid web listener port");
471
- if (!capabilities.nativeTransport) {
472
- if (config.tls) throw new Error("auth-remote: this DSH version does not support TLS");
473
- if (isIP2(config.host) !== 4)
474
- throw new Error("auth-remote: this DSH version supports only concrete IPv4, not IPv6");
475
- if (config.host === "0.0.0.0") throw new Error("auth-remote: wildcard binding is not supported");
476
- return { ...config, compression: config.compression ?? "none" };
477
- }
478
469
  if (typeof native.default.Config !== "function" || typeof Object.getOwnPropertyDescriptor(native.default.prototype, "protocol")?.get !== "function" || typeof native.isLoopbackHost !== "function" || typeof native.isWildcardHost !== "function" || typeof native.normalizeBindAddress !== "function")
479
470
  throw new Error("auth-remote: DSH lacks native transport capabilities");
480
471
  return native.default.Config({
@@ -482,22 +473,17 @@ function validateListenerConfig(capabilities, config, native = NativeWebServer)
482
473
  compression: config.compression ?? "none"
483
474
  });
484
475
  }
485
- function listenerProtocol(server, capabilities) {
486
- if (!capabilities.nativeTransport) return "http:";
476
+ function listenerProtocol(server) {
487
477
  if (server.protocol !== "http:" && server.protocol !== "https:")
488
478
  throw new Error("auth-remote: DSH listener lacks a valid native protocol");
489
479
  return server.protocol;
490
480
  }
491
- function listenerTransport(actual, capabilities) {
492
- const loopback = capabilities.nativeTransport ? NativeWebServer.isLoopbackHost(actual.host) : isIP2(actual.host) === 4 && actual.host.startsWith("127.");
493
- const host = capabilities.nativeTransport ? loopback ? NativeWebServer.normalizeBindAddress(actual.host) : (
481
+ function listenerTransport(actual) {
482
+ const loopback = NativeWebServer.isLoopbackHost(actual.host);
483
+ const host = loopback ? NativeWebServer.normalizeBindAddress(actual.host) : (
494
484
  // Connection compares the bind literal through WHATWG URL, retaining mapped IPv6.
495
485
  // A zone selects an interface and is excluded by its authority comparison.
496
486
  actual.host.split("%", 1)[0]
497
- ) : (
498
- // Older Connection cannot recognize a concrete non-loopback bind authority.
499
- // Preserve its existing server-side loopback bridge without changing the listener.
500
- "127.0.0.1"
501
487
  );
502
488
  const url = new URL(listenerPublicUrl(host, actual.port, actual.protocol));
503
489
  return {
@@ -1626,7 +1612,7 @@ var AuthService = class {
1626
1612
 
1627
1613
  // src/config.ts
1628
1614
  import z from "@deepseek-ai/schemastery";
1629
- import { isIP as isIP3 } from "node:net";
1615
+ import { isIP as isIP2 } from "node:net";
1630
1616
  import { resolve } from "node:path";
1631
1617
  var DEFAULT_REQUIRE_TOTP = false;
1632
1618
  var DEFAULT_SESSION_HOURS = 168;
@@ -1675,7 +1661,7 @@ function resolveStartupConfig(input, startup, context) {
1675
1661
  } else {
1676
1662
  manualAccountLogin = ManualAccountLoginConfig(manual);
1677
1663
  }
1678
- const capabilities = getRuntimeCapabilities(context.version);
1664
+ assertRuntimeVersion(context.version);
1679
1665
  let publicUrl;
1680
1666
  let publicUrlSource = "derived";
1681
1667
  if (explicitUrl) {
@@ -1708,7 +1694,7 @@ function resolveStartupConfig(input, startup, context) {
1708
1694
  keyFile: resolve(context.profileDir, config.tlsKey)
1709
1695
  };
1710
1696
  }
1711
- const listener = validateListenerConfig(capabilities, {
1697
+ const listener = validateListenerConfig({
1712
1698
  host: startup.host ?? (Object.hasOwn(input, "host") ? config.host : DEFAULT_WEB_HOST),
1713
1699
  port: startup.port ?? (Object.hasOwn(input, "port") ? config.port : DEFAULT_WEB_PORT),
1714
1700
  ...tls ? { tls } : {},
@@ -1728,7 +1714,7 @@ function resolveStartupConfig(input, startup, context) {
1728
1714
  }
1729
1715
  return {
1730
1716
  ...listener,
1731
- capabilities,
1717
+ version: context.version,
1732
1718
  publicUrl,
1733
1719
  publicUrlSource,
1734
1720
  tlsSource,
@@ -1740,9 +1726,9 @@ function resolveStartupConfig(input, startup, context) {
1740
1726
  };
1741
1727
  }
1742
1728
  function finalizeAuthConfig(pending, actual) {
1743
- if (!Number.isInteger(actual.port) || actual.port < 1 || actual.port > 65535 || isIP3(actual.host) === 0)
1729
+ if (!Number.isInteger(actual.port) || actual.port < 1 || actual.port > 65535 || isIP2(actual.host) === 0)
1744
1730
  throw new Error("auth-remote: invalid actual listener host or port");
1745
- const transport = listenerTransport(actual, pending.capabilities);
1731
+ const transport = listenerTransport(actual);
1746
1732
  let listenerUrl;
1747
1733
  if (actual.host.includes("%")) {
1748
1734
  if (transport.loopback) listenerUrl = `${transport.origin}/`;
@@ -2651,7 +2637,6 @@ var ManualAccountLogin = class {
2651
2637
  this.version = version;
2652
2638
  this.enabled = enabled;
2653
2639
  this.unsubscribe = store.subscribe((_before, after) => this.reconcile(after));
2654
- if (!supportsManualAccountLogin(version)) return;
2655
2640
  ctx.inject(["deepseekAccount"], (accountCtx) => {
2656
2641
  const provider = accountCtx.get("deepseekAccount");
2657
2642
  accountCtx.effect(() => {
@@ -2674,7 +2659,7 @@ var ManualAccountLogin = class {
2674
2659
  currentProvider;
2675
2660
  disposal;
2676
2661
  install(server) {
2677
- if (supportsManualAccountLogin(this.version)) server.installAccountCallbackBridge(this.bridge);
2662
+ server.installAccountCallbackBridge(this.bridge);
2678
2663
  for (const action of ["state", "start", "submit", "cancel"])
2679
2664
  server.register({
2680
2665
  kind: "exact",
@@ -2911,21 +2896,32 @@ function legacy(version, windowDays, eligibleRetirement) {
2911
2896
  return {
2912
2897
  state: "legacy",
2913
2898
  version,
2914
- legacySince: "2026-10-19",
2899
+ legacySince: "2026-10-28",
2915
2900
  windowDays,
2916
2901
  eligibleRetirement,
2917
- migrationTarget: "0.2.1-rc.2"
2902
+ migrationTarget: "0.2.1-rc.4"
2918
2903
  };
2919
2904
  }
2920
2905
  var LEGACY_DSH_RELEASES = [
2921
- legacy("0.1.7-rc.1", 14, "2026-11-02"),
2922
- legacy("0.1.7-rc.2", 14, "2026-11-02"),
2923
- legacy("0.2.0-rc.1", 21, "2026-11-09"),
2924
- legacy("0.2.0-rc.2", 21, "2026-11-09"),
2925
- legacy("0.2.1-alpha.1", 21, "2026-11-09"),
2926
- legacy("0.2.1-alpha.2", 21, "2026-11-09")
2906
+ legacy("0.2.1-alpha.3", 14, "2026-11-11"),
2907
+ legacy("0.2.1-alpha.4", 14, "2026-11-11"),
2908
+ legacy("0.2.1-alpha.5", 14, "2026-11-11")
2927
2909
  ];
2928
- var RETIRED_DSH_RELEASES = [];
2910
+ var RETIRED_DSH_RELEASES = [
2911
+ "0.1.7-rc.1",
2912
+ "0.1.7-rc.2",
2913
+ "0.2.0-rc.1",
2914
+ "0.2.0-rc.2",
2915
+ "0.2.1-alpha.1",
2916
+ "0.2.1-alpha.2"
2917
+ ].map((version) => ({
2918
+ state: "retired",
2919
+ version,
2920
+ retiredOn: "2026-10-28",
2921
+ effectivePlugin: "0.3.1",
2922
+ lastSupportedPlugin: "0.2.0",
2923
+ migrationTarget: "0.2.1-rc.4"
2924
+ }));
2929
2925
  var lifecycle = [...LEGACY_DSH_RELEASES, ...RETIRED_DSH_RELEASES];
2930
2926
  function classifyDshSupport(version, declared, records = lifecycle) {
2931
2927
  if (declared.has(version)) {
@@ -2940,7 +2936,7 @@ function classifyDshSupport(version, declared, records = lifecycle) {
2940
2936
  return record2 ? { state: "retired", version, record: record2 } : { state: "unverified", version };
2941
2937
  }
2942
2938
  function dshSupportWarning(support) {
2943
- const guides = "See docs/support-policy.md and docs/support-history.md.";
2939
+ const guides = "See README.md and docs/support-history.md.";
2944
2940
  if (support.state === "supported") return;
2945
2941
  if (support.state === "legacy") {
2946
2942
  const record2 = support.record;
@@ -3005,8 +3001,8 @@ var AuthRemoteWebServer = class extends GuardedWebServer {
3005
3001
  super(ctx, config, gate);
3006
3002
  this.pending = config;
3007
3003
  this.switchGate = gate;
3008
- warnDshSupport(classifyDshSupport(config.capabilities.version, declaredDshReleases));
3009
- installAuthenticatedHostCapability(ctx, config.capabilities.version);
3004
+ warnDshSupport(classifyDshSupport(config.version, declaredDshReleases));
3005
+ installAuthenticatedHostCapability(ctx, config.version);
3010
3006
  if (config.legacyWarning)
3011
3007
  console.warn("auth-remote: allowedOrigins is deprecated; use publicUrl with one root URL");
3012
3008
  }
@@ -3041,7 +3037,7 @@ var AuthRemoteWebServer = class extends GuardedWebServer {
3041
3037
  this.resolvedConfig = finalizeAuthConfig(this.pending, {
3042
3038
  host: this.host,
3043
3039
  port,
3044
- protocol: listenerProtocol(this, this.pending.capabilities)
3040
+ protocol: listenerProtocol(this)
3045
3041
  });
3046
3042
  this.setOriginPolicy(this.resolved.originPolicy);
3047
3043
  connections = new AuthConnections(store, auth);
@@ -3054,7 +3050,7 @@ var AuthRemoteWebServer = class extends GuardedWebServer {
3054
3050
  this.ctx,
3055
3051
  auth,
3056
3052
  store,
3057
- this.pending.capabilities.version,
3053
+ this.pending.version,
3058
3054
  () => this.pending.manualAccountLogin.get()
3059
3055
  );
3060
3056
  accountLogin.install(this);