@edge-sky/dsh-oauth-adapter 0.1.2-dev.2 → 0.1.2-rc.0
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.i18n.yaml +2 -2
- package/README.md +27 -63
- package/README.zh.md +27 -63
- package/lib/client.js +7 -500
- package/lib/index.d.ts +3 -7
- package/lib/index.js +78 -82
- package/lib/protocol.d.ts +2 -3
- package/lib/protocol.js +0 -27
- package/lib/types/client/index.d.ts +2 -2
- package/lib/types/client/locales.d.ts +0 -34
- package/lib/types/client/store.d.ts +0 -17
- package/lib/types/client/styles.d.ts +1 -1
- package/lib/types/protocol.d.ts +2 -3
- package/package.json +35 -62
- package/lib/model-auth.d.ts +0 -8
- package/lib/model-auth.js +0 -48
- package/lib/model-catalog.d.ts +0 -27
- package/lib/model-catalog.js +0 -145
- package/lib/model-discovery.d.ts +0 -22
- package/lib/model-discovery.js +0 -147
- package/lib/model-service.d.ts +0 -64
- package/lib/model-service.js +0 -371
- package/lib/model-types.d.ts +0 -92
- package/lib/model-types.js +0 -25
- package/lib/types/client/OAuthModelsSection.d.ts +0 -11
- package/lib/types/model-types.d.ts +0 -92
package/README.i18n.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Bilingual-pair consistency record: the git blob hash of each side as of the
|
|
2
2
|
# last confirmed-consistent state. Both languages carry equal authority.
|
|
3
|
-
README.md:
|
|
4
|
-
README.zh.md:
|
|
3
|
+
README.md: 6e18cc90e25e581abecfbf502af2022922b408d8
|
|
4
|
+
README.zh.md: 807ae07ac4b6d42bee91ceac3c874406ecc32ab0
|
package/README.md
CHANGED
|
@@ -2,84 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
OAuth
|
|
5
|
+
An OAuth account page for the DSH Web profile. It supports:
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
11
|
-
dsh web
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Use **Settings → OAuth Accounts** to connect or reconnect an account. Successful authorization automatically synchronizes its models. Authorization and synchronization have separate results: a discovery failure does not undo successful sign-in.
|
|
15
|
-
|
|
16
|
-
Use the **OAuth models** area of **Settings → Models** to synchronize an existing connection, configure unmatched models, and add, edit or delete manual entries. This area occupies the public `settings.models.footer` slot. No additional model settings page is installed.
|
|
17
|
-
|
|
18
|
-
| Provider | Model protocol |
|
|
7
|
+
| Provider | pi-ai sign-in path |
|
|
19
8
|
| --- | --- |
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
Model ID is required; a blank display name uses the ID. Fixed-protocol providers have no protocol selector and reject protocol overrides on the server. An unknown model receives the provider's configured default capacities, text input and no inferred reasoning capability. Saving permits an attempted request; it does not prove the model exists, that the account can call it, or that all capabilities are known.
|
|
27
|
-
|
|
28
|
-
## Synchronization
|
|
9
|
+
| OpenAI Codex | Browser callback or device code |
|
|
10
|
+
| GitHub Copilot | GitHub or GitHub Enterprise device code |
|
|
11
|
+
| Anthropic | Browser callback with manual code/redirect fallback |
|
|
12
|
+
| Kimi For Coding | Device code |
|
|
13
|
+
| OpenRouter | Browser PKCE callback |
|
|
14
|
+
| xAI | Device code |
|
|
29
15
|
|
|
30
|
-
|
|
16
|
+
Each account is shown only as available when the installed `@deepseek-ai/dsh-llm-pi-ai` actually registers its OAuth flow. This keeps older or differently bundled pi-ai versions fail-closed instead of exposing a login button that cannot work.
|
|
31
17
|
|
|
32
|
-
|
|
18
|
+
The adapter has only been tested with DSH `0.1.1-rc.2`; compatibility with future versions is not guaranteed.
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Existing provider IDs and session references remain unchanged. Simple profiles generated by earlier plugin versions migrate automatically; custom profiles require a preview in Models. API-key references, composition-owned profiles and competing adapters are not overwritten. See [migration and recovery](docs/oauth-models.md#migration-and-recovery) before upgrading a customized installation.
|
|
20
|
+
## Install
|
|
37
21
|
|
|
38
|
-
|
|
22
|
+
```sh
|
|
23
|
+
dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
24
|
+
```
|
|
39
25
|
|
|
40
|
-
|
|
26
|
+
or
|
|
41
27
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| `modelSyncTimeoutMs` | `30000` | Discovery and route-release timeout |
|
|
46
|
-
| `modelSyncMaxResponseBytes` | `4194304` | Maximum bytes per remote page |
|
|
47
|
-
| `modelSyncMaxPages` | `100` | Maximum pages per synchronization |
|
|
48
|
-
| `codexClientVersion` | `0.149.0` | Version sent to the Codex discovery endpoint |
|
|
28
|
+
```sh
|
|
29
|
+
npx @deepseek-ai/dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
30
|
+
```
|
|
49
31
|
|
|
50
|
-
|
|
32
|
+
Start DSH:
|
|
51
33
|
|
|
52
34
|
```sh
|
|
53
|
-
|
|
54
|
-
pnpm run typecheck
|
|
55
|
-
pnpm test
|
|
35
|
+
npx @deepseek-ai/dsh web
|
|
56
36
|
```
|
|
57
37
|
|
|
58
|
-
|
|
38
|
+
<img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/78a59190-8029-4c60-bc50-b763312540f7" />
|
|
59
39
|
|
|
60
|
-
|
|
40
|
+
<img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/e0cc6591-73a4-4e87-9ef6-68950126b290" />
|
|
61
41
|
|
|
62
|
-
`npm pack` and `npm publish` from the package directory run type checking, a fresh build, and tests through `prepack`; a failure stops packaging. Do not bypass this check with `--ignore-scripts`. Published versions cannot be overwritten, so a fixed release needs a new version number.
|
|
63
42
|
|
|
64
|
-
|
|
43
|
+
## How it works
|
|
65
44
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
npm pack --pack-destination "$artifact_dir"
|
|
70
|
-
export DSH_HOME=$(mktemp -d)
|
|
71
|
-
mkdir -p "$DSH_HOME/profiles/web"
|
|
72
|
-
cat > "$DSH_HOME/profiles/web/pnpm-workspace.yaml" <<'YAML'
|
|
73
|
-
packages:
|
|
74
|
-
- .
|
|
75
|
-
nodeLinker: hoisted
|
|
76
|
-
autoInstallPeers: false
|
|
77
|
-
allowBuilds:
|
|
78
|
-
'@google/genai': false
|
|
79
|
-
protobufjs: false
|
|
80
|
-
YAML
|
|
81
|
-
npx @deepseek-ai/dsh@0.1.2-rc.1 plugin --profile web add "$artifact_dir"/*.tgz
|
|
82
|
-
npx @deepseek-ai/dsh@0.1.2-rc.1 web --no-open
|
|
83
|
-
```
|
|
45
|
+
DSH integrates pi-ai through the `@deepseek-ai/dsh-llm-pi-ai` adapter, but does not provide an OAuth entry point. `@edge-sky/dsh-oauth-adapter` exposes pi-ai's existing provider login flows through the DSH Authorization Service. Browser links, device codes, text and secret input, method selection, cancellation, and withdrawn prompts all use the same provider-neutral transport.
|
|
46
|
+
|
|
47
|
+
Because DSH does not currently mount the `ctx.authorization` service, this plugin also mounts it manually.
|
|
84
48
|
|
|
85
|
-
|
|
49
|
+
The plugin itself does not manage OAuth credentials or maintain login state. Maybe DSH support this sign-in method in the future; but for now, this plugin lets you enjoy it.
|
package/README.zh.md
CHANGED
|
@@ -2,84 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
为 DSH Web profile
|
|
5
|
+
为 DSH Web profile 提供独立的 OAuth 账户页面。当前支持:
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
11
|
-
dsh web
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
在 **设置 → OAuth 账户** 连接或重新连接账号。授权成功后自动同步模型。授权和同步分别报告结果:发现失败不会撤销成功的登录。
|
|
15
|
-
|
|
16
|
-
在 **设置 → 模型** 的 **OAuth 模型** 区域同步已连接账号、补充待配置模型,以及添加、编辑或删除手动模型。该区域使用公开的 `settings.models.footer` 插槽,不增加独立模型设置页面。
|
|
17
|
-
|
|
18
|
-
| 供应商 | 模型协议 |
|
|
7
|
+
| 提供商 | pi-ai 登录路径 |
|
|
19
8
|
| --- | --- |
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
模型 ID 必填,显示名称留空时使用 ID。固定协议供应商不显示协议选择器,后端也拒绝协议覆盖。未知模型采用供应商配置的默认容量、文本输入,不根据名称推断思考能力。保存后可尝试发送请求,但不代表已验证模型存在、账号可调用或全部模型能力。
|
|
27
|
-
|
|
28
|
-
## 同步行为
|
|
9
|
+
| OpenAI Codex | 浏览器回调或设备码 |
|
|
10
|
+
| GitHub Copilot | GitHub 或 GitHub Enterprise 设备码 |
|
|
11
|
+
| Anthropic | 浏览器回调,并支持手工粘贴授权码/重定向地址 |
|
|
12
|
+
| Kimi For Coding | 设备码 |
|
|
13
|
+
| OpenRouter | 浏览器 PKCE 回调 |
|
|
14
|
+
| xAI | 设备码 |
|
|
29
15
|
|
|
30
|
-
|
|
16
|
+
只有当当前安装的 `@deepseek-ai/dsh-llm-pi-ai` 确实注册了对应 OAuth 流程时,账户才会显示为可用。这样旧版或采用不同 pi-ai bundle 的 DSH 会安全地禁用登录按钮,而不会暴露无法完成的流程。
|
|
31
17
|
|
|
32
|
-
|
|
18
|
+
当前仅对 DSH`0.1.1-rc.2`进行了测试,不保证未来版本的兼容性
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
既有供应商 ID 和会话引用保持不变。旧插件生成的简单配置自动迁移;自定义配置需要在模型页预览确认。API-key 引用、组合基础层配置和其他适配器占用的路由不会被覆盖。升级自定义安装前请阅读[迁移与恢复](docs/oauth-models.zh.md#迁移与恢复)。
|
|
20
|
+
## 安装
|
|
37
21
|
|
|
38
|
-
|
|
22
|
+
```sh
|
|
23
|
+
dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
24
|
+
```
|
|
39
25
|
|
|
40
|
-
|
|
26
|
+
或
|
|
41
27
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| `modelSyncTimeoutMs` | `30000` | 模型发现及旧路由释放的超时 |
|
|
46
|
-
| `modelSyncMaxResponseBytes` | `4194304` | 每页远端响应的最大字节数 |
|
|
47
|
-
| `modelSyncMaxPages` | `100` | 一次同步的最大页数 |
|
|
48
|
-
| `codexClientVersion` | `0.149.0` | Codex 发现端点所接收的客户端版本 |
|
|
28
|
+
```sh
|
|
29
|
+
npx @deepseek-ai/dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
30
|
+
```
|
|
49
31
|
|
|
50
|
-
|
|
32
|
+
启动 DSH:
|
|
51
33
|
|
|
52
34
|
```sh
|
|
53
|
-
|
|
54
|
-
pnpm run typecheck
|
|
55
|
-
pnpm test
|
|
35
|
+
npx @deepseek-ai/dsh web
|
|
56
36
|
```
|
|
57
37
|
|
|
58
|
-
|
|
38
|
+
<img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/134ec856-e17b-4800-bb87-069851986d3e" />
|
|
59
39
|
|
|
60
|
-
|
|
40
|
+
<img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/8007002a-a036-4cf4-b015-d4e50eff25d9" />
|
|
61
41
|
|
|
62
|
-
`npm pack` 和从目录执行的 `npm publish` 通过 `prepack` 运行类型检查、重新构建和测试;任何一步失败都会终止打包。不要使用 `--ignore-scripts` 跳过该检查。已发布版本不能覆盖,修复后发布必须使用新版本号。
|
|
63
42
|
|
|
64
|
-
|
|
43
|
+
## 工作原理
|
|
65
44
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
npm pack --pack-destination "$artifact_dir"
|
|
70
|
-
export DSH_HOME=$(mktemp -d)
|
|
71
|
-
mkdir -p "$DSH_HOME/profiles/web"
|
|
72
|
-
cat > "$DSH_HOME/profiles/web/pnpm-workspace.yaml" <<'YAML'
|
|
73
|
-
packages:
|
|
74
|
-
- .
|
|
75
|
-
nodeLinker: hoisted
|
|
76
|
-
autoInstallPeers: false
|
|
77
|
-
allowBuilds:
|
|
78
|
-
'@google/genai': false
|
|
79
|
-
protobufjs: false
|
|
80
|
-
YAML
|
|
81
|
-
npx @deepseek-ai/dsh@0.1.2-rc.1 plugin --profile web add "$artifact_dir"/*.tgz
|
|
82
|
-
npx @deepseek-ai/dsh@0.1.2-rc.1 web --no-open
|
|
83
|
-
```
|
|
45
|
+
DSH 通过 `@deepseek-ai/dsh-llm-pi-ai` 适配器接入 pi-ai,但并没有提供 OAuth 的入口。`@edge-sky/dsh-oauth-adapter` 通过 DSH Authorization Service 暴露 pi-ai 已有的 provider 登录流程。浏览器链接、设备码、文本与密码输入、登录方式选择、取消和撤回提示均通过同一套 provider-neutral 传输完成。
|
|
46
|
+
|
|
47
|
+
由于 DSH 目前并没有挂载`ctx.authorization`服务,因此该插件同时手动对其进行了挂载
|
|
84
48
|
|
|
85
|
-
|
|
49
|
+
插件本身并不承担 OAuth 凭证管理与维持登录态的职责,或许将来 DSH 会官方支持这一登录方式,但至少现在你可以通过这个插件体验它
|