@lynn123411/dsh-web-auth-url 0.1.0 → 0.1.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/README.md CHANGED
@@ -16,4 +16,3 @@ DSH Web GUI 的访问鉴权补位:把当前实例**带 token 的访问地址**
16
16
  dsh plugin --profile web add @lynn123411/dsh-web-auth-url
17
17
  ```
18
18
 
19
- 本地开发按仓库规则用 `link:`——`cd ~/.dsh/profiles/web && pnpm add "link:/Users/tny/Desktop/work/my-dsh/plugins/dsh-web-auth-url" --offline`,并在 profile `package.json` 的 `dsh.profile.bundles` 里登记本包(`dsh plugin add` 会自动登记,手工 link 不会)。宿主半边只在 DSH 启动时装载,改完须重启实例;自检 `npm test` 跑 `scripts/smoke-host.mjs`。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynn123411/dsh-web-auth-url",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "把当前 Web 实例的带 token 访问地址交给模型与 shell:托管 DSH_WEB_AUTH_URL(每次 shell 调用即时解析,跟随重启后的 token 轮换),并贡献一段紧随 web-surface 的提示词说明 cookie jar 用法,secret 不进提示词与 transcript。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -45,6 +45,7 @@
45
45
  }
46
46
  },
47
47
  "engines": {
48
+ "dsh": "0.1.6-alpha.2",
48
49
  "node": "^22.19 || >=24"
49
50
  },
50
51
  "publishConfig": {
@@ -6,7 +6,28 @@
6
6
  */
7
7
 
8
8
  import assert from 'node:assert/strict';
9
- import { apply, Config, inject, name } from '../lib/index.js';
9
+ import { registerHooks } from 'node:module';
10
+ import { existsSync } from 'node:fs';
11
+ import { homedir } from 'node:os';
12
+ import { join } from 'node:path';
13
+ import { pathToFileURL } from 'node:url';
14
+
15
+ // lib/index.js 依赖 @deepseek-ai/schemastery;仓库检出里没有 node_modules,而 DSH 运行目录带一份。
16
+ // 把该名字路由到运行目录里的真实实现——自检要真跑 schema 校验,不能用桩件假造它的行为。
17
+ const dshHome = process.env.DSH_HOME ?? join(homedir(), '.dsh');
18
+ const schemasteryEntry = join(dshHome, 'profiles', 'node_modules', '@deepseek-ai', 'schemastery', 'lib', 'index.mjs');
19
+ if (!existsSync(schemasteryEntry)) {
20
+ throw new Error(`schemastery 未找到:${schemasteryEntry}(把 DSH_HOME 指向 DSH 主目录后重试)`);
21
+ }
22
+ const schemasteryUrl = pathToFileURL(schemasteryEntry).href;
23
+ registerHooks({
24
+ resolve(specifier, context, nextResolve) {
25
+ if (specifier === '@deepseek-ai/schemastery') return { url: schemasteryUrl, shortCircuit: true };
26
+ return nextResolve(specifier, context);
27
+ },
28
+ });
29
+
30
+ const { apply, Config, inject, name } = await import('../lib/index.js');
10
31
 
11
32
  const PORT = 3080;
12
33
  const TOKEN = 'launch-token-example';
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 lynn123411
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.