dsh-auth-remote 0.1.10 → 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/CHANGELOG.md +31 -0
- package/CHANGELOG.zh-CN.md +31 -0
- package/CONTRIBUTING.md +5 -1
- package/CONTRIBUTING.zh-CN.md +5 -1
- package/README.md +22 -24
- package/README.zh-CN.md +22 -24
- package/cordis.patch.yml +2 -2
- package/dist/client.js +2 -2
- package/dist/client.js.map +1 -1
- package/dist/index.js +102 -38
- package/dist/index.js.map +4 -4
- package/dist/types/adapters/dsh/compatibility.d.ts +1 -1
- package/dist/types/adapters/dsh/compatibility.d.ts.map +1 -1
- package/dist/types/adapters/dsh/runtime-capabilities.d.ts +6 -11
- package/dist/types/adapters/dsh/runtime-capabilities.d.ts.map +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/http/account-login.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/shared/dsh-support.d.ts +38 -0
- package/dist/types/shared/dsh-support.d.ts.map +1 -0
- package/docs/deployment.md +25 -21
- package/docs/deployment.zh-CN.md +25 -21
- package/docs/development.md +80 -23
- package/docs/development.zh-CN.md +80 -23
- package/docs/legacy-compatibility.md +106 -79
- package/docs/legacy-compatibility.zh-CN.md +106 -79
- package/docs/releasing.md +46 -10
- package/docs/releasing.zh-CN.md +46 -10
- package/docs/reverse-proxy.md +2 -2
- package/docs/reverse-proxy.zh-CN.md +2 -2
- package/docs/support-history.md +103 -0
- package/docs/support-history.zh-CN.md +103 -0
- package/docs/support-policy.md +87 -0
- package/docs/support-policy.zh-CN.md +87 -0
- package/examples/web-profile-auth-remote.patch.yml +3 -2
- package/package.json +26 -23
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { Service } from "@deepseek-ai/cordis";
|
|
3
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
4
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
3
5
|
import { basename } from "node:path";
|
|
4
6
|
|
|
5
7
|
// src/adapters/dsh/compatibility.ts
|
|
@@ -9,12 +11,14 @@ import WebServer from "@deepseek-ai/dsh-host-webserver";
|
|
|
9
11
|
import semver from "semver";
|
|
10
12
|
var WEB_SERVER_PACKAGE = "@deepseek-ai/dsh-host-webserver";
|
|
11
13
|
var CONNECTION_PACKAGE = "@deepseek-ai/dsh-client-connection";
|
|
12
|
-
var SUPPORTED_DSH_RANGE = ">=0.1
|
|
14
|
+
var SUPPORTED_DSH_RANGE = ">=0.2.1-alpha.3";
|
|
13
15
|
function packageManifest(packageName, anchor) {
|
|
14
16
|
const path = realpathSync(createRequire(anchor).resolve(`${packageName}/package.json`));
|
|
15
17
|
const manifest = JSON.parse(readFileSync(path, "utf8"));
|
|
16
18
|
if (manifest.name !== packageName || !semver.satisfies(manifest.version, SUPPORTED_DSH_RANGE, { includePrerelease: true })) {
|
|
17
|
-
throw new Error(
|
|
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
|
+
);
|
|
18
22
|
}
|
|
19
23
|
return { path, manifest };
|
|
20
24
|
}
|
|
@@ -235,7 +239,6 @@ function startupLines(profile, config) {
|
|
|
235
239
|
|
|
236
240
|
// src/adapters/dsh/runtime-capabilities.ts
|
|
237
241
|
import * as NativeWebServer from "@deepseek-ai/dsh-host-webserver";
|
|
238
|
-
import { isIP as isIP2 } from "node:net";
|
|
239
242
|
import semver2 from "semver";
|
|
240
243
|
|
|
241
244
|
// src/adapters/dsh/public-url.ts
|
|
@@ -454,25 +457,15 @@ function listenerPublicUrl(host, port, protocol) {
|
|
|
454
457
|
}
|
|
455
458
|
|
|
456
459
|
// src/adapters/dsh/runtime-capabilities.ts
|
|
457
|
-
function
|
|
460
|
+
function assertRuntimeVersion(version) {
|
|
458
461
|
if (!semver2.satisfies(version, SUPPORTED_DSH_RANGE, { includePrerelease: true }))
|
|
459
|
-
throw new Error(
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
publicUrl: semver2.gte(version, "0.2.1-alpha.1"),
|
|
463
|
-
nativeTransport: semver2.gte(version, "0.2.1-alpha.2")
|
|
464
|
-
});
|
|
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
|
+
);
|
|
465
465
|
}
|
|
466
|
-
function validateListenerConfig(
|
|
466
|
+
function validateListenerConfig(config, native = NativeWebServer) {
|
|
467
467
|
if (!Number.isInteger(config.port) || config.port < 0 || config.port > 65535)
|
|
468
468
|
throw new Error("auth-remote: invalid web listener port");
|
|
469
|
-
if (!capabilities.nativeTransport) {
|
|
470
|
-
if (config.tls) throw new Error("auth-remote: this DSH version does not support TLS");
|
|
471
|
-
if (isIP2(config.host) !== 4)
|
|
472
|
-
throw new Error("auth-remote: this DSH version supports only concrete IPv4, not IPv6");
|
|
473
|
-
if (config.host === "0.0.0.0") throw new Error("auth-remote: wildcard binding is not supported");
|
|
474
|
-
return { ...config, compression: config.compression ?? "none" };
|
|
475
|
-
}
|
|
476
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")
|
|
477
470
|
throw new Error("auth-remote: DSH lacks native transport capabilities");
|
|
478
471
|
return native.default.Config({
|
|
@@ -480,22 +473,17 @@ function validateListenerConfig(capabilities, config, native = NativeWebServer)
|
|
|
480
473
|
compression: config.compression ?? "none"
|
|
481
474
|
});
|
|
482
475
|
}
|
|
483
|
-
function listenerProtocol(server
|
|
484
|
-
if (!capabilities.nativeTransport) return "http:";
|
|
476
|
+
function listenerProtocol(server) {
|
|
485
477
|
if (server.protocol !== "http:" && server.protocol !== "https:")
|
|
486
478
|
throw new Error("auth-remote: DSH listener lacks a valid native protocol");
|
|
487
479
|
return server.protocol;
|
|
488
480
|
}
|
|
489
|
-
function listenerTransport(actual
|
|
490
|
-
const loopback =
|
|
491
|
-
const host =
|
|
481
|
+
function listenerTransport(actual) {
|
|
482
|
+
const loopback = NativeWebServer.isLoopbackHost(actual.host);
|
|
483
|
+
const host = loopback ? NativeWebServer.normalizeBindAddress(actual.host) : (
|
|
492
484
|
// Connection compares the bind literal through WHATWG URL, retaining mapped IPv6.
|
|
493
485
|
// A zone selects an interface and is excluded by its authority comparison.
|
|
494
486
|
actual.host.split("%", 1)[0]
|
|
495
|
-
) : (
|
|
496
|
-
// Older Connection cannot recognize a concrete non-loopback bind authority.
|
|
497
|
-
// Preserve its existing server-side loopback bridge without changing the listener.
|
|
498
|
-
"127.0.0.1"
|
|
499
487
|
);
|
|
500
488
|
const url = new URL(listenerPublicUrl(host, actual.port, actual.protocol));
|
|
501
489
|
return {
|
|
@@ -1624,7 +1612,7 @@ var AuthService = class {
|
|
|
1624
1612
|
|
|
1625
1613
|
// src/config.ts
|
|
1626
1614
|
import z from "@deepseek-ai/schemastery";
|
|
1627
|
-
import { isIP as
|
|
1615
|
+
import { isIP as isIP2 } from "node:net";
|
|
1628
1616
|
import { resolve } from "node:path";
|
|
1629
1617
|
var DEFAULT_REQUIRE_TOTP = false;
|
|
1630
1618
|
var DEFAULT_SESSION_HOURS = 168;
|
|
@@ -1673,7 +1661,7 @@ function resolveStartupConfig(input, startup, context) {
|
|
|
1673
1661
|
} else {
|
|
1674
1662
|
manualAccountLogin = ManualAccountLoginConfig(manual);
|
|
1675
1663
|
}
|
|
1676
|
-
|
|
1664
|
+
assertRuntimeVersion(context.version);
|
|
1677
1665
|
let publicUrl;
|
|
1678
1666
|
let publicUrlSource = "derived";
|
|
1679
1667
|
if (explicitUrl) {
|
|
@@ -1706,7 +1694,7 @@ function resolveStartupConfig(input, startup, context) {
|
|
|
1706
1694
|
keyFile: resolve(context.profileDir, config.tlsKey)
|
|
1707
1695
|
};
|
|
1708
1696
|
}
|
|
1709
|
-
const listener = validateListenerConfig(
|
|
1697
|
+
const listener = validateListenerConfig({
|
|
1710
1698
|
host: startup.host ?? (Object.hasOwn(input, "host") ? config.host : DEFAULT_WEB_HOST),
|
|
1711
1699
|
port: startup.port ?? (Object.hasOwn(input, "port") ? config.port : DEFAULT_WEB_PORT),
|
|
1712
1700
|
...tls ? { tls } : {},
|
|
@@ -1726,7 +1714,7 @@ function resolveStartupConfig(input, startup, context) {
|
|
|
1726
1714
|
}
|
|
1727
1715
|
return {
|
|
1728
1716
|
...listener,
|
|
1729
|
-
|
|
1717
|
+
version: context.version,
|
|
1730
1718
|
publicUrl,
|
|
1731
1719
|
publicUrlSource,
|
|
1732
1720
|
tlsSource,
|
|
@@ -1738,9 +1726,9 @@ function resolveStartupConfig(input, startup, context) {
|
|
|
1738
1726
|
};
|
|
1739
1727
|
}
|
|
1740
1728
|
function finalizeAuthConfig(pending, actual) {
|
|
1741
|
-
if (!Number.isInteger(actual.port) || actual.port < 1 || actual.port > 65535 ||
|
|
1729
|
+
if (!Number.isInteger(actual.port) || actual.port < 1 || actual.port > 65535 || isIP2(actual.host) === 0)
|
|
1742
1730
|
throw new Error("auth-remote: invalid actual listener host or port");
|
|
1743
|
-
const transport = listenerTransport(actual
|
|
1731
|
+
const transport = listenerTransport(actual);
|
|
1744
1732
|
let listenerUrl;
|
|
1745
1733
|
if (actual.host.includes("%")) {
|
|
1746
1734
|
if (transport.loopback) listenerUrl = `${transport.origin}/`;
|
|
@@ -2649,7 +2637,6 @@ var ManualAccountLogin = class {
|
|
|
2649
2637
|
this.version = version;
|
|
2650
2638
|
this.enabled = enabled;
|
|
2651
2639
|
this.unsubscribe = store.subscribe((_before, after) => this.reconcile(after));
|
|
2652
|
-
if (!supportsManualAccountLogin(version)) return;
|
|
2653
2640
|
ctx.inject(["deepseekAccount"], (accountCtx) => {
|
|
2654
2641
|
const provider = accountCtx.get("deepseekAccount");
|
|
2655
2642
|
accountCtx.effect(() => {
|
|
@@ -2672,7 +2659,7 @@ var ManualAccountLogin = class {
|
|
|
2672
2659
|
currentProvider;
|
|
2673
2660
|
disposal;
|
|
2674
2661
|
install(server) {
|
|
2675
|
-
|
|
2662
|
+
server.installAccountCallbackBridge(this.bridge);
|
|
2676
2663
|
for (const action of ["state", "start", "submit", "cancel"])
|
|
2677
2664
|
server.register({
|
|
2678
2665
|
kind: "exact",
|
|
@@ -2904,7 +2891,83 @@ var ManualAccountLogin = class {
|
|
|
2904
2891
|
}
|
|
2905
2892
|
};
|
|
2906
2893
|
|
|
2894
|
+
// src/shared/dsh-support.ts
|
|
2895
|
+
function legacy(version, windowDays, eligibleRetirement) {
|
|
2896
|
+
return {
|
|
2897
|
+
state: "legacy",
|
|
2898
|
+
version,
|
|
2899
|
+
legacySince: "2026-10-28",
|
|
2900
|
+
windowDays,
|
|
2901
|
+
eligibleRetirement,
|
|
2902
|
+
migrationTarget: "0.2.1-rc.4"
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
var LEGACY_DSH_RELEASES = [
|
|
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")
|
|
2909
|
+
];
|
|
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
|
+
}));
|
|
2925
|
+
var lifecycle = [...LEGACY_DSH_RELEASES, ...RETIRED_DSH_RELEASES];
|
|
2926
|
+
function classifyDshSupport(version, declared, records = lifecycle) {
|
|
2927
|
+
if (declared.has(version)) {
|
|
2928
|
+
const record3 = records.find(
|
|
2929
|
+
(item) => item.version === version && item.state === "legacy"
|
|
2930
|
+
);
|
|
2931
|
+
return record3 ? { state: "legacy", version, record: record3 } : { state: "supported", version };
|
|
2932
|
+
}
|
|
2933
|
+
const record2 = records.find(
|
|
2934
|
+
(item) => item.version === version && item.state === "retired"
|
|
2935
|
+
);
|
|
2936
|
+
return record2 ? { state: "retired", version, record: record2 } : { state: "unverified", version };
|
|
2937
|
+
}
|
|
2938
|
+
function dshSupportWarning(support) {
|
|
2939
|
+
const guides = "See README.md and docs/support-history.md.";
|
|
2940
|
+
if (support.state === "supported") return;
|
|
2941
|
+
if (support.state === "legacy") {
|
|
2942
|
+
const record2 = support.record;
|
|
2943
|
+
return `auth-remote: DSH ${support.version} is legacy since ${record2.legacySince}; earliest eligible retirement ${record2.eligibleRetirement} (Asia/Shanghai, ${record2.windowDays} calendar days). Support continues until an explicit retirement release. Migrate to DSH ${record2.migrationTarget} with a supporting plugin release. ${guides}`;
|
|
2944
|
+
}
|
|
2945
|
+
if (support.state === "retired") {
|
|
2946
|
+
const record2 = support.record;
|
|
2947
|
+
return `auth-remote: DSH ${support.version} retired on ${record2.retiredOn} in plugin ${record2.effectivePlugin}; last supported plugin ${record2.lastSupportedPlugin}. No current compatibility commitment; technical checks still apply. Upgrade to DSH ${record2.migrationTarget} with a supporting plugin release, or consult the historical installation guidance. ${guides}`;
|
|
2948
|
+
}
|
|
2949
|
+
return `auth-remote: DSH ${support.version} has no current exact-version support commitment. Technical admission does not establish verified compatibility. Select a declared DSH release and a supporting plugin release. ${guides}`;
|
|
2950
|
+
}
|
|
2951
|
+
var warningKey = /* @__PURE__ */ Symbol.for("dsh-auth-remote.support-warnings");
|
|
2952
|
+
function warnDshSupport(support, write = console.warn) {
|
|
2953
|
+
const message = dshSupportWarning(support);
|
|
2954
|
+
if (!message) return false;
|
|
2955
|
+
const processState = globalThis;
|
|
2956
|
+
const warned = processState[warningKey] ??= /* @__PURE__ */ new Set();
|
|
2957
|
+
const key = `${support.version}:${support.state}`;
|
|
2958
|
+
if (warned.has(key)) return false;
|
|
2959
|
+
warned.add(key);
|
|
2960
|
+
write(message);
|
|
2961
|
+
return true;
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2907
2964
|
// src/index.ts
|
|
2965
|
+
var ownManifest = JSON.parse(
|
|
2966
|
+
readFileSync3(createRequire2(import.meta.url).resolve("dsh-auth-remote/package.json"), "utf8")
|
|
2967
|
+
);
|
|
2968
|
+
var declaredDshReleases = new Set(
|
|
2969
|
+
Object.entries(ownManifest.dsh.compatibility.dshReleases).filter(([, state]) => state === "compatible").map(([version]) => version)
|
|
2970
|
+
);
|
|
2908
2971
|
var name = "auth-remote";
|
|
2909
2972
|
async function disposeResources(disposers) {
|
|
2910
2973
|
const errors = [];
|
|
@@ -2938,7 +3001,8 @@ var AuthRemoteWebServer = class extends GuardedWebServer {
|
|
|
2938
3001
|
super(ctx, config, gate);
|
|
2939
3002
|
this.pending = config;
|
|
2940
3003
|
this.switchGate = gate;
|
|
2941
|
-
|
|
3004
|
+
warnDshSupport(classifyDshSupport(config.version, declaredDshReleases));
|
|
3005
|
+
installAuthenticatedHostCapability(ctx, config.version);
|
|
2942
3006
|
if (config.legacyWarning)
|
|
2943
3007
|
console.warn("auth-remote: allowedOrigins is deprecated; use publicUrl with one root URL");
|
|
2944
3008
|
}
|
|
@@ -2973,7 +3037,7 @@ var AuthRemoteWebServer = class extends GuardedWebServer {
|
|
|
2973
3037
|
this.resolvedConfig = finalizeAuthConfig(this.pending, {
|
|
2974
3038
|
host: this.host,
|
|
2975
3039
|
port,
|
|
2976
|
-
protocol: listenerProtocol(this
|
|
3040
|
+
protocol: listenerProtocol(this)
|
|
2977
3041
|
});
|
|
2978
3042
|
this.setOriginPolicy(this.resolved.originPolicy);
|
|
2979
3043
|
connections = new AuthConnections(store, auth);
|
|
@@ -2986,7 +3050,7 @@ var AuthRemoteWebServer = class extends GuardedWebServer {
|
|
|
2986
3050
|
this.ctx,
|
|
2987
3051
|
auth,
|
|
2988
3052
|
store,
|
|
2989
|
-
this.pending.
|
|
3053
|
+
this.pending.version,
|
|
2990
3054
|
() => this.pending.manualAccountLogin.get()
|
|
2991
3055
|
);
|
|
2992
3056
|
accountLogin.install(this);
|