@iasiv5/dsh-skip-browser-auth 0.2.2 → 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.
@@ -14,6 +14,7 @@ export const COMPATIBILITY_PROFILES = [
14
14
  hostAdapter: 'legacy-web',
15
15
  clientVariant: 'rc12',
16
16
  requiresRecoveryGlobal: false,
17
+ browserAuthSemantics: 'root',
17
18
  status: 'active',
18
19
  },
19
20
  {
@@ -29,10 +30,38 @@ export const COMPATIBILITY_PROFILES = [
29
30
  hostAdapter: 'carrier-neutral',
30
31
  clientVariant: 'rc15',
31
32
  requiresRecoveryGlobal: true,
33
+ browserAuthSemantics: 'root',
32
34
  // Promoted after the carrier-neutral host/client adapter and fixture path
33
35
  // are implemented; real deployment validation remains documented separately.
34
36
  status: 'active',
35
37
  },
38
+ {
39
+ // 0.1.7 is a real contract change from 0.1.5, not a republish: the shared /api
40
+ // route admits through the new OperatorPeer (`admit()`) and wraps the
41
+ // bridge in the `connection/request` waterfall; BrowserAuth consumption
42
+ // becomes mount-preserving; the browser client bundle is rewritten. Audited
43
+ // package-by-package in docs/COMPATIBILITY.md §5.4.
44
+ //
45
+ // 0.1.7-rc.1 joined this generation after a byte-level audit (§5.5): every
46
+ // package the replacement touches (dsh-client-connection lib/+client/,
47
+ // dsh-host-webserver, dsh-scope, dsh-host-frontend-static) ships rc.2-identical
48
+ // code, the web-app patch's connection row is field-identical, and the runtime
49
+ // diff is chunk-hash renames plus diagnostics-only boot changes. The rc17
50
+ // client variant therefore serves both pairs, selected by this one profile id.
51
+ id: 'carrier-neutral-v3',
52
+ pairs: [
53
+ { runtime: '0.1.7-rc.1', connection: '0.1.7-rc.1' },
54
+ { runtime: '0.1.7-rc.2', connection: '0.1.7-rc.2' },
55
+ ],
56
+ hostAdapter: 'carrier-neutral-017',
57
+ clientVariant: 'rc17',
58
+ requiresRecoveryGlobal: true,
59
+ browserAuthSemantics: 'mount-preserving',
60
+ // Promoted together with the adapter/client implementation; the fixture
61
+ // composition suite and the real 0.1.7-rc.2 deployment checklist are the
62
+ // promotion evidence (docs/COMPATIBILITY.md §5.4, docs/DESIGN.md).
63
+ status: 'active',
64
+ },
36
65
  ];
37
66
  /** All exact versions represented by profiles, for diagnostics and fixtures. */
38
67
  export const GATE_VERSIONS = [...new Set(COMPATIBILITY_PROFILES.flatMap((profile) => profile.pairs.flatMap((pair) => [pair.runtime, pair.connection])))];
package/lib/host.js CHANGED
@@ -2,8 +2,9 @@
2
2
  * @iasiv5/dsh-skip-browser-auth host half:trusted-network Connection Replacement。
3
3
  *
4
4
  * 兼容性按 profile 分代:0.1.2 使用 legacy-web adapter,0.1.5 使用
5
- * carrier-neutral adapter。公共 apply 只负责 profile/backstop、信任配置、
6
- * 生命周期和固定 warning;版本差异藏在 adapter 与 runtime connection loader。
5
+ * carrier-neutral adapter,0.1.7 使用 carrier-neutral-017 adapter。公共 apply
6
+ * 只负责 profile/backstop、信任配置、生命周期和固定 warning;版本差异藏在
7
+ * adapter 与 runtime connection loader。
7
8
  */
8
9
  import { readFileSync } from 'node:fs';
9
10
  import { fileURLToPath } from 'node:url';
@@ -13,6 +14,7 @@ import { COMPATIBILITY_PROFILES } from './compatibility.js';
13
14
  import { loadRuntimeConnectionModule } from './connection-runtime.js';
14
15
  import { createLegacyWebRuntime } from './adapters/legacy-web.js';
15
16
  import { createCarrierNeutralRuntime } from './adapters/carrier-neutral.js';
17
+ import { createCarrierNeutral017Runtime } from './adapters/carrier-neutral-017.js';
16
18
  import { assertTrustedAuthority } from './trust-fence.js';
17
19
  import { createTrustedAuth } from './trusted-auth.js';
18
20
  import { DEFAULT_MAX_REQUEST_BODY_BYTES } from './bridge.js';
@@ -137,6 +139,8 @@ function createHostRuntime(profile, input) {
137
139
  return createLegacyWebRuntime(input);
138
140
  case 'carrier-neutral':
139
141
  return createCarrierNeutralRuntime(input);
142
+ case 'carrier-neutral-017':
143
+ return createCarrierNeutral017Runtime(input);
140
144
  default:
141
145
  throw new Error('@iasiv5/dsh-skip-browser-auth: unsupported host adapter');
142
146
  }
@@ -154,7 +158,7 @@ export async function apply(ctx, config) {
154
158
  assertImageBodyCapacity(ctx, maxRequestBodyBytes);
155
159
  const profile = assertGateBackstop(ctx, config?.compatibilityProfile) ?? directProfile(config?.compatibilityProfile);
156
160
  const module = await loadRuntimeConnectionModule(ctx);
157
- const auth = createTrustedAuth(trustedHosts);
161
+ const auth = createTrustedAuth(trustedHosts, profile.browserAuthSemantics);
158
162
  const runtime = createHostRuntime(profile, {
159
163
  ctx,
160
164
  module,
@@ -12,11 +12,17 @@ const TOKEN_QUERY = 'token';
12
12
  /**
13
13
  * Create the three-method stub consumed by the official HostConnectionService.
14
14
  * @param trustedHosts - non-loopback authorities this deployment serves: exact `host:port`, or port-less `host` matching any port.
15
+ * @param semantics - the host generation's BrowserAuth URL contract: `root`
16
+ * (0.1.2/0.1.5, app at `/`) or `mount-preserving` (0.1.7, app may mount at a
17
+ * sub-path). Selected by the compatibility profile, never guessed.
15
18
  * @returns authentication owner with trusted-network semantics for all three methods.
16
19
  */
17
- export function createTrustedAuth(trustedHosts) {
20
+ export function createTrustedAuth(trustedHosts, semantics = 'root') {
21
+ // mount-preserving:官方 0.1.7 的清理重定向目标是目录相对 `./`,
22
+ // 应用可以挂在子路径上;root:官方 0.1.2/0.1.5 一律回到 `/`。
23
+ const cleanLocation = semantics === 'mount-preserving' ? './' : '/';
18
24
  return {
19
- // 请求已通过 /api 侧的 requestRejection 信任栅栏;此处恒真,
25
+ // 请求已通过 /api 侧的 requestRejection/admit 信任栅栏;此处恒真,
20
26
  // 使官方 service 不再叠加 401 身份层。
21
27
  isAuthenticated(_request) {
22
28
  return true;
@@ -37,7 +43,7 @@ export function createTrustedAuth(trustedHosts) {
37
43
  if (url.searchParams.has(TOKEN_QUERY) && req.method === 'GET' && url.pathname === '/') {
38
44
  res.writeHead(303, {
39
45
  'cache-control': 'no-store',
40
- 'location': '/',
46
+ 'location': cleanLocation,
41
47
  'referrer-policy': 'no-referrer',
42
48
  });
43
49
  res.end();
@@ -45,10 +51,13 @@ export function createTrustedAuth(trustedHosts) {
45
51
  }
46
52
  return true;
47
53
  },
48
- // 无身份层:返回干净的应用根 URL,不附加任何 token。
54
+ // 无身份层:返回干净的应用 URL,不附加任何 token。
55
+ // root:官方 0.1.2/0.1.5 语义,重写到应用根 `/`;
56
+ // mount-preserving:官方 0.1.7 语义,保留调用方的 mount,仅去掉 query/hash。
49
57
  authenticatedUrl(baseUrl) {
50
58
  const url = new URL(baseUrl);
51
- url.pathname = '/';
59
+ if (semantics !== 'mount-preserving')
60
+ url.pathname = '/';
52
61
  url.search = '';
53
62
  url.hash = '';
54
63
  return url.href;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iasiv5/dsh-skip-browser-auth",
3
- "version": "0.2.2",
4
- "description": "替换官方 Connection 提供方跳过 BrowserAuth,免输 Token;已适配 0.1.2-rc.1 与 0.1.5-rc.1/rc.2,详见仓库。",
3
+ "version": "0.3.1",
4
+ "description": "替换官方 Connection 提供方跳过 BrowserAuth,免输 Token;已适配 0.1.2-rc.1、0.1.5-rc.1/rc.2 与 0.1.7-rc.1/rc.2,详见仓库。",
5
5
  "keywords": [
6
6
  "dsh",
7
7
  "deepseek-harness",
@@ -41,7 +41,8 @@
41
41
  "test": "node --test tests/*.test.mjs tests/composition/*.test.mjs",
42
42
  "test:rc2-fixture": "node scripts/install-rc2-fixture.mjs",
43
43
  "test:rc15-fixture": "node scripts/install-rc15-fixture.mjs",
44
- "test:all": "npm run test:rc2-fixture && npm run test:rc15-fixture && npm run build && npm run typecheck && npm test",
44
+ "test:rc17-fixture": "node scripts/install-rc17-fixture.mjs",
45
+ "test:all": "npm run test:rc2-fixture && npm run test:rc15-fixture && npm run test:rc17-fixture && npm run build && npm run typecheck && npm test",
45
46
  "prepare": "npm run build"
46
47
  },
47
48
  "dsh": {
@@ -59,13 +60,17 @@
59
60
  "@deepseek-ai/schemastery": "*"
60
61
  },
61
62
  "devDependencies": {
62
- "@deepseek-ai/cordis": "4.0.2",
63
+ "@deepseek-ai/cordis": "4.0.4",
63
64
  "@deepseek-ai/cordis-plugin-include": "1.0.7",
64
65
  "@deepseek-ai/cordis-plugin-loader": "1.0.3",
66
+ "@deepseek-ai/dsh-atomic-write": "0.1.2-rc.1",
65
67
  "@deepseek-ai/dsh-client-connection": "0.1.2-rc.1",
66
68
  "dsh-client-connection-rc15": "npm:@deepseek-ai/dsh-client-connection@0.1.5-rc.1",
69
+ "dsh-client-connection-rc17": "npm:@deepseek-ai/dsh-client-connection@0.1.7-rc.2",
67
70
  "@deepseek-ai/dsh-credentials": "0.1.2-rc.1",
68
71
  "@deepseek-ai/dsh-credentials-local": "0.1.2-rc.1",
72
+ "@deepseek-ai/dsh-home-paths": "0.1.2-rc.1",
73
+ "@deepseek-ai/dsh-launch-environment": "0.1.2-rc.1",
69
74
  "@deepseek-ai/dsh-host-frontend-static": "0.1.2-rc.1",
70
75
  "@deepseek-ai/dsh-host-webserver": "0.1.2-rc.1",
71
76
  "@deepseek-ai/schemastery": "^3.18.2",