@edge-sky/dsh-oauth-adapter 0.1.2-dev.2 → 0.1.3-beta.3
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 +33 -58
- package/README.zh.md +33 -57
- package/lib/client.js +242 -162
- package/lib/index.d.ts +5 -2
- package/lib/index.js +11 -2
- package/lib/model-catalog.js +5 -4
- package/lib/model-service.d.ts +7 -5
- package/lib/model-service.js +19 -15
- package/lib/model-types.d.ts +2 -0
- package/lib/protocol.js +2 -2
- package/lib/types/client/locales.d.ts +4 -3
- package/lib/types/client/store.d.ts +1 -1
- package/lib/types/client/styles.d.ts +1 -1
- package/lib/types/model-types.d.ts +2 -0
- package/package.json +64 -43
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: 643064b672859791cce2551254d03f3154647f20
|
|
4
|
+
README.zh.md: d1f28dc87675dd408f84eb495a67da58a7065b33
|
package/README.md
CHANGED
|
@@ -1,85 +1,60 @@
|
|
|
1
1
|
# dsh-oauth-adapter
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@edge-sky/dsh-oauth-adapter)
|
|
4
|
+
[](https://www.npmjs.com/package/@edge-sky/dsh-oauth-adapter)
|
|
5
|
+
[](https://www.npmjs.com/package/@edge-sky/dsh-oauth-adapter)
|
|
6
|
+
|
|
3
7
|
English | [中文](README.zh.md)
|
|
4
8
|
|
|
5
|
-
OAuth
|
|
9
|
+
An OAuth account page for the DSH Web profile. It supports:
|
|
10
|
+
|
|
11
|
+
| Provider | pi-ai sign-in path |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| OpenAI Codex | Browser callback or device code |
|
|
14
|
+
| GitHub Copilot | GitHub or GitHub Enterprise device code |
|
|
15
|
+
| Anthropic | Browser callback with manual code/redirect fallback |
|
|
16
|
+
| Kimi For Coding | Device code |
|
|
17
|
+
| OpenRouter | Browser PKCE callback |
|
|
18
|
+
| xAI | Device code |
|
|
19
|
+
|
|
20
|
+
This checkout targets DSH `0.2.0-rc.2`. Once an adapter release with the DSH 0.2 peer range is published, install that release. Earlier DSH releases require an earlier adapter release.
|
|
6
21
|
|
|
7
22
|
## Install
|
|
8
23
|
|
|
24
|
+
For DSH `0.2.0-rc.2`, after the compatible adapter release is published:
|
|
25
|
+
|
|
9
26
|
```sh
|
|
10
27
|
dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
11
|
-
dsh web
|
|
12
28
|
```
|
|
13
29
|
|
|
14
|
-
|
|
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 |
|
|
19
|
-
| --- | --- |
|
|
20
|
-
| GitHub Copilot | Select Chat Completions, Responses or Anthropic Messages per model |
|
|
21
|
-
| OpenRouter | Select Chat Completions or Anthropic Messages per model |
|
|
22
|
-
| OpenAI Codex | Codex Responses |
|
|
23
|
-
| xAI | OpenAI Responses |
|
|
24
|
-
| Anthropic, Kimi Coding | Anthropic Messages |
|
|
30
|
+
Or for the official desktop, use `@edge-sky/dsh-oauth-adapter`
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
For DSH `0.1.2-rc.1` through `0.1.5-rc.1`, use an adapter release from the `0.1.3` series. For DSH `0.1.1-rc.2`, use `@edge-sky/dsh-oauth-adapter@0.1.2-rc.0`.
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
Start DSH:
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
```sh
|
|
37
|
+
npx @deepseek-ai/dsh web
|
|
38
|
+
```
|
|
31
39
|
|
|
32
|
-
|
|
40
|
+
<img width="2940" height="1766" alt="image" src="https://github.com/user-attachments/assets/cbd98703-ee7a-491b-aa2f-02e42b99f6b9" />
|
|
33
41
|
|
|
34
|
-
The plugin stores model settings in `oauth-models`, including a version, migration backup, cached remote IDs and manual entries. Credentials remain exclusively at `llm-pi-ai/<provider>` through DSH's credentials service. Public pi-ai authentication handles token refresh; tokens never enter model settings or browser messages. A future plugin dependency upgrade rematches cached IDs against the newly loaded catalog.
|
|
35
42
|
|
|
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.
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
<img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/e0cc6591-73a4-4e87-9ef6-68950126b290" />
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
For models not explicitly listed as supported by the built-in pi-ai, you can add them manually (availability needs to be verified on your own).
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
| --- | --- | --- |
|
|
44
|
-
| `debug` | `false` | Transport lifecycle diagnostics |
|
|
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 |
|
|
48
|
+
<img width="774" height="724" alt="PixPin_2026-09-10_11-08-26" src="https://github.com/user-attachments/assets/e3adc9fc-36e6-414f-ae5b-1748ff5e8f70" />
|
|
49
49
|
|
|
50
|
-
## Development and verification
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
pnpm install
|
|
54
|
-
pnpm run typecheck
|
|
55
|
-
pnpm test
|
|
56
|
-
```
|
|
51
|
+
## How it works
|
|
57
52
|
|
|
58
|
-
|
|
53
|
+
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.
|
|
59
54
|
|
|
60
|
-
|
|
55
|
+
The profile patch mounts an authorization fallback when the host does not provide `ctx.authorization`.
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
DSH owns OAuth credentials and login state. This adapter stores model configuration in `dsh-oauth-adapter.modelStore`; see [model migration and recovery](docs/oauth-models.md).
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```sh
|
|
67
|
-
pnpm install --frozen-lockfile
|
|
68
|
-
artifact_dir=$(mktemp -d)
|
|
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
|
-
```
|
|
59
|
+
If this plugins is has helped you, please give a star for me, or create issues if you have any suggestion~
|
|
84
60
|
|
|
85
|
-
After stopping the server, run `unset DSH_HOME` to restore the default directory. The test profile explicitly skips installation scripts for these two dependencies; the plugin repository's policy does not propagate to consumers. New users still need to configure this policy in their own profiles. Successful startup verifies plugin loading; real-account login, model discovery, and inference need separate verification.
|
package/README.zh.md
CHANGED
|
@@ -1,85 +1,61 @@
|
|
|
1
1
|
# dsh-oauth-adapter
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@edge-sky/dsh-oauth-adapter)
|
|
4
|
+
[](https://www.npmjs.com/package/@edge-sky/dsh-oauth-adapter)
|
|
5
|
+
[](https://www.npmjs.com/package/@edge-sky/dsh-oauth-adapter)
|
|
6
|
+
|
|
3
7
|
[English](README.md) | 中文
|
|
4
8
|
|
|
5
|
-
为 DSH Web profile
|
|
9
|
+
为 DSH Web profile 提供独立的 OAuth 账户页面。当前支持:
|
|
10
|
+
|
|
11
|
+
| 提供商 | pi-ai 登录路径 |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| OpenAI Codex | 浏览器回调或设备码 |
|
|
14
|
+
| GitHub Copilot | GitHub 或 GitHub Enterprise 设备码 |
|
|
15
|
+
| Anthropic | 浏览器回调,并支持手工粘贴授权码/重定向地址 |
|
|
16
|
+
| Kimi For Coding | 设备码 |
|
|
17
|
+
| OpenRouter | 浏览器 PKCE 回调 |
|
|
18
|
+
| xAI | 设备码 |
|
|
19
|
+
|
|
20
|
+
当前源码面向 DSH `0.2.0-rc.2`。发布声明 DSH 0.2 peer 依赖范围的适配器版本后,请安装该版本。较早的 DSH 版本需使用对应的适配器旧版本。
|
|
6
21
|
|
|
7
22
|
## 安装
|
|
8
23
|
|
|
24
|
+
对于 DSH `0.2.0-rc.2`:
|
|
25
|
+
|
|
9
26
|
```sh
|
|
10
27
|
dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
|
|
11
|
-
dsh web
|
|
12
28
|
```
|
|
13
29
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
在 **设置 → 模型** 的 **OAuth 模型** 区域同步已连接账号、补充待配置模型,以及添加、编辑或删除手动模型。该区域使用公开的 `settings.models.footer` 插槽,不增加独立模型设置页面。
|
|
17
|
-
|
|
18
|
-
| 供应商 | 模型协议 |
|
|
19
|
-
| --- | --- |
|
|
20
|
-
| GitHub Copilot | 每个模型选择 Chat Completions、Responses 或 Anthropic Messages |
|
|
21
|
-
| OpenRouter | 每个模型选择 Chat Completions 或 Anthropic Messages |
|
|
22
|
-
| OpenAI Codex | Codex Responses |
|
|
23
|
-
| xAI | OpenAI Responses |
|
|
24
|
-
| Anthropic、Kimi Coding | Anthropic Messages |
|
|
30
|
+
或使用于官方桌面端 `@edge-sky/dsh-oauth-adapter`
|
|
25
31
|
|
|
26
|
-
模型 ID 必填,显示名称留空时使用 ID。固定协议供应商不显示协议选择器,后端也拒绝协议覆盖。未知模型采用供应商配置的默认容量、文本输入,不根据名称推断思考能力。保存后可尝试发送请求,但不代表已验证模型存在、账号可调用或全部模型能力。
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
对于 DSH `0.1.2-rc.1` 至 `0.1.5-rc.1`,请使用适配器 `0.1.3` 系列;对于 DSH `0.1.1-rc.2`,请使用 `@edge-sky/dsh-oauth-adapter@0.1.2-rc.0`。
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
启动 DSH:
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
```sh
|
|
38
|
+
npx @deepseek-ai/dsh web
|
|
39
|
+
```
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
<img width="2940" height="1766" alt="image" src="https://github.com/user-attachments/assets/7f1dc846-9cea-468c-8a1e-27f4fa34a4fe" />
|
|
35
42
|
|
|
36
|
-
既有供应商 ID 和会话引用保持不变。旧插件生成的简单配置自动迁移;自定义配置需要在模型页预览确认。API-key 引用、组合基础层配置和其他适配器占用的路由不会被覆盖。升级自定义安装前请阅读[迁移与恢复](docs/oauth-models.zh.md#迁移与恢复)。
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
<img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/8007002a-a036-4cf4-b015-d4e50eff25d9" />
|
|
39
45
|
|
|
40
|
-
Host 插件接受以下可选配置:
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
| --- | --- | --- |
|
|
44
|
-
| `debug` | `false` | 连接生命周期诊断 |
|
|
45
|
-
| `modelSyncTimeoutMs` | `30000` | 模型发现及旧路由释放的超时 |
|
|
46
|
-
| `modelSyncMaxResponseBytes` | `4194304` | 每页远端响应的最大字节数 |
|
|
47
|
-
| `modelSyncMaxPages` | `100` | 一次同步的最大页数 |
|
|
48
|
-
| `codexClientVersion` | `0.149.0` | Codex 发现端点所接收的客户端版本 |
|
|
47
|
+
对于内置 pi-ai 未写明支持的模型,支持手动添加(可用性需自行验证)
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
<img width="778" height="723" alt="PixPin_2026-09-10_11-02-42" src="https://github.com/user-attachments/assets/e6b10f86-591d-4801-a758-c8b56c83a18d" />
|
|
51
50
|
|
|
52
|
-
```sh
|
|
53
|
-
pnpm install
|
|
54
|
-
pnpm run typecheck
|
|
55
|
-
pnpm test
|
|
56
|
-
```
|
|
57
51
|
|
|
58
|
-
测试覆盖供应商响应、匹配、失败保留、revision 冲突、迁移恢复、取消、经过网络拦截的真实 rc 适配器请求,以及 DOM 环境中加载已发布 rc 模型页产物的可重放快照。WebSocket 测试需要绑定回环端口。测试凭据全部为合成数据,这些验证不代表任何供应商的真实账号发现或推理调用已经通过。无需修改 DSH 源码。
|
|
59
52
|
|
|
60
|
-
##
|
|
53
|
+
## 工作原理
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
DSH 通过 `@deepseek-ai/dsh-llm-pi-ai` 适配器接入 pi-ai,但并没有提供 OAuth 的入口。`@edge-sky/dsh-oauth-adapter` 通过 DSH Authorization Service 暴露 pi-ai 已有的 provider 登录流程。浏览器链接、设备码、文本与密码输入、登录方式选择、取消和撤回提示均通过同一套 provider-neutral 传输完成。
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
当宿主未提供 `ctx.authorization` 时,profile patch 会挂载授权服务后备实现。
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
pnpm install --frozen-lockfile
|
|
68
|
-
artifact_dir=$(mktemp -d)
|
|
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
|
-
```
|
|
59
|
+
OAuth 凭据和登录状态由 DSH 管理。适配器将模型配置保存在 `dsh-oauth-adapter.modelStore`;参见[模型迁移与恢复](docs/oauth-models.zh.md)。
|
|
84
60
|
|
|
85
|
-
|
|
61
|
+
如果这个插件帮到了你,还请留下你的小星星,如果有任何建议,欢迎 issues~
|