@edge-sky/dsh-oauth-adapter 0.1.2-beta.1 → 0.1.2-dev.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.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: c4642ceaea18fbc2482a1a121893d9e5ee2662c4
4
- README.zh.md: 7641d4bdcd89a0bfa9a247a4dc59013c0614e434
3
+ README.md: f3e3243d02440749e53038872e3fdca91f516468
4
+ README.zh.md: 31a969685a57a6919b8544e24a7e09c2a4b77303
package/README.md CHANGED
@@ -2,49 +2,57 @@
2
2
 
3
3
  English | [中文](README.zh.md)
4
4
 
5
- An OAuth account page for the DSH Web profile. It supports:
6
-
7
- | Provider | pi-ai sign-in path |
8
- | --- | --- |
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
- | Radius | Browser PKCE callback or device code |
15
- | xAI | Device code |
16
-
17
- 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.
18
-
19
- The adapter has only been tested with DSH `0.1.1-rc.2`; compatibility with future versions is not guaranteed.
5
+ OAuth sign-in and account model management for the DSH Web profile. The validation baseline is DSH `0.1.2-rc.1`, with an exact plugin dependency on pi-ai `0.84.4`. Synchronizing models never installs or upgrades packages.
20
6
 
21
7
  ## Install
22
8
 
23
9
  ```sh
24
10
  dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
11
+ dsh web
25
12
  ```
26
13
 
27
- or
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.
28
15
 
29
- ```sh
30
- npx @deepseek-ai/dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
31
- ```
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.
32
17
 
33
- Start DSH:
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 |
34
25
 
35
- ```sh
36
- npx @deepseek-ai/dsh web
37
- ```
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
29
+
30
+ Discovery uses each provider's authenticated endpoint, including Copilot's OAuth-resolved API host, Codex's account header, Anthropic cursor pagination and OpenRouter's account-filtered offset pagination. OpenRouter's public catalog is not used as a substitute. An unsupported endpoint or insufficient OAuth scope is reported and manual configuration remains available. Endpoint details and references are in [migration and operation](docs/oauth-models.md).
31
+
32
+ Only exact IDs within the same provider inherit pi-ai's full model metadata. No display-name matching or undocumented alias inference selects a protocol. Unknown IDs remain **Needs configuration**. Successful synchronization replaces automatic entries with the complete remote result, including a genuinely empty result. Manual entries survive and merge by ID with explicit user fields winning. Errors retain the last successful result. Before any successful discovery, the previous configured or built-in list remains available and is labeled unverified. Reconnection to a different or unidentifiable account clears the old account's automatic results before discovery.
38
33
 
39
- <img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/78a59190-8029-4c60-bc50-b763312540f7" />
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.
40
35
 
41
- <img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/e0cc6591-73a4-4e87-9ef6-68950126b290" />
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.
42
37
 
38
+ ## Configuration
43
39
 
44
- ## How it works
40
+ The optional Host plugin configuration accepts:
45
41
 
46
- 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.
42
+ | Field | Default | Meaning |
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 |
47
49
 
48
- Because DSH does not currently mount the `ctx.authorization` service, this plugin also mounts it manually.
50
+ ## Development and verification
51
+
52
+ ```sh
53
+ pnpm install
54
+ pnpm run typecheck
55
+ pnpm test
56
+ ```
49
57
 
50
- 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.
58
+ Tests cover provider responses, matching, retained results, revisions, migration recovery, cancellation, actual rc adapter requests with network interception, and published rc model-page bundles in a DOM environment with replayable snapshots. WebSocket tests bind a loopback port. All test credentials are synthetic; these checks do not establish live-account discovery or inference success for any provider. DSH source changes are not required.
package/README.zh.md CHANGED
@@ -2,49 +2,57 @@
2
2
 
3
3
  [English](README.md) | 中文
4
4
 
5
- 为 DSH Web profile 提供独立的 OAuth 账户页面。当前支持:
6
-
7
- | 提供商 | pi-ai 登录路径 |
8
- | --- | --- |
9
- | OpenAI Codex | 浏览器回调或设备码 |
10
- | GitHub Copilot | GitHub 或 GitHub Enterprise 设备码 |
11
- | Anthropic | 浏览器回调,并支持手工粘贴授权码/重定向地址 |
12
- | Kimi For Coding | 设备码 |
13
- | OpenRouter | 浏览器 PKCE 回调 |
14
- | Radius | 浏览器 PKCE 回调或设备码 |
15
- | xAI | 设备码 |
16
-
17
- 只有当当前安装的 `@deepseek-ai/dsh-llm-pi-ai` 确实注册了对应 OAuth 流程时,账户才会显示为可用。这样旧版或采用不同 pi-ai bundle 的 DSH 会安全地禁用登录按钮,而不会暴露无法完成的流程。
18
-
19
- 当前仅对 DSH`0.1.1-rc.2`进行了测试,不保证未来版本的兼容性
5
+ 为 DSH Web profile 提供 OAuth 登录和账号模型管理。验证基线为 DSH `0.1.2-rc.1`,插件精确依赖 pi-ai `0.84.4`。同步模型不会安装或升级依赖。
20
6
 
21
7
  ## 安装
22
8
 
23
9
  ```sh
24
10
  dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
11
+ dsh web
25
12
  ```
26
13
 
27
- 或
14
+ 在 **设置 → OAuth 账户** 连接或重新连接账号。授权成功后自动同步模型。授权和同步分别报告结果:发现失败不会撤销成功的登录。
28
15
 
29
- ```sh
30
- npx @deepseek-ai/dsh plugin --profile web add @edge-sky/dsh-oauth-adapter
31
- ```
16
+ 在 **设置 → 模型** 的 **OAuth 模型** 区域同步已连接账号、补充待配置模型,以及添加、编辑或删除手动模型。该区域使用公开的 `settings.models.footer` 插槽,不增加独立模型设置页面。
32
17
 
33
- 启动 DSH:
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 |
34
25
 
35
- ```sh
36
- npx @deepseek-ai/dsh web
37
- ```
26
+ 模型 ID 必填,显示名称留空时使用 ID。固定协议供应商不显示协议选择器,后端也拒绝协议覆盖。未知模型采用供应商配置的默认容量、文本输入,不根据名称推断思考能力。保存后可尝试发送请求,但不代表已验证模型存在、账号可调用或全部模型能力。
27
+
28
+ ## 同步行为
29
+
30
+ 发现使用各供应商的认证端点,包括 Copilot 经 OAuth 解析的 API 主机、Codex 账号请求头、Anthropic 游标分页及 OpenRouter 账号过滤列表的偏移分页。不会使用 OpenRouter 公开总目录代替账号列表。端点不支持或 OAuth 权限不足时明确报错,仍可手动配置。端点和依据见[迁移与运行说明](docs/oauth-models.zh.md)。
31
+
32
+ 只有同一供应商内精确匹配的 ID 才继承 pi-ai 的完整模型描述。不通过显示名称或未经证实的别名推断调用协议。未知 ID 保持为**待配置**。成功同步使用完整远端结果替换自动项,包括真正的空列表;手动项始终保留,同 ID 合并,用户明确填写的字段优先。失败保留最近成功结果。首次成功发现前,保留原配置或内置列表并标明未经验证。重新连接至不同或无法识别的账号时,先清除旧账号的自动结果,再进行发现。
38
33
 
39
- <img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/134ec856-e17b-4800-bb87-069851986d3e" />
34
+ 插件使用 `oauth-models` 保存版本、迁移备份、远端 ID 缓存和手动项。凭据始终通过 DSH credentials 服务保存在 `llm-pi-ai/<provider>`。公开 pi-ai 认证能力负责 token 刷新,token 不进入模型设置或浏览器消息。后续升级插件依赖时,已保存的远端 ID 会与新加载的目录重新匹配。
40
35
 
41
- <img width="2270" height="1524" alt="image" src="https://github.com/user-attachments/assets/8007002a-a036-4cf4-b015-d4e50eff25d9" />
36
+ 既有供应商 ID 和会话引用保持不变。旧插件生成的简单配置自动迁移;自定义配置需要在模型页预览确认。API-key 引用、组合基础层配置和其他适配器占用的路由不会被覆盖。升级自定义安装前请阅读[迁移与恢复](docs/oauth-models.zh.md#迁移与恢复)。
42
37
 
38
+ ## 配置
43
39
 
44
- ## 工作原理
40
+ Host 插件接受以下可选配置:
45
41
 
46
- DSH 通过 `@deepseek-ai/dsh-llm-pi-ai` 适配器接入 pi-ai,但并没有提供 OAuth 的入口。`@edge-sky/dsh-oauth-adapter` 通过 DSH Authorization Service 暴露 pi-ai 已有的 provider 登录流程。浏览器链接、设备码、文本与密码输入、登录方式选择、取消和撤回提示均通过同一套 provider-neutral 传输完成。
42
+ | 字段 | 默认值 | 含义 |
43
+ | --- | --- | --- |
44
+ | `debug` | `false` | 连接生命周期诊断 |
45
+ | `modelSyncTimeoutMs` | `30000` | 模型发现及旧路由释放的超时 |
46
+ | `modelSyncMaxResponseBytes` | `4194304` | 每页远端响应的最大字节数 |
47
+ | `modelSyncMaxPages` | `100` | 一次同步的最大页数 |
48
+ | `codexClientVersion` | `0.149.0` | Codex 发现端点所接收的客户端版本 |
47
49
 
48
- 由于 DSH 目前并没有挂载`ctx.authorization`服务,因此该插件同时手动对其进行了挂载
50
+ ## 开发与验证
51
+
52
+ ```sh
53
+ pnpm install
54
+ pnpm run typecheck
55
+ pnpm test
56
+ ```
49
57
 
50
- 插件本身并不承担 OAuth 凭证管理与维持登录态的职责,或许将来 DSH 会官方支持这一登录方式,但至少现在你可以通过这个插件体验它
58
+ 测试覆盖供应商响应、匹配、失败保留、revision 冲突、迁移恢复、取消、经过网络拦截的真实 rc 适配器请求,以及 DOM 环境中加载已发布 rc 模型页产物的可重放快照。WebSocket 测试需要绑定回环端口。测试凭据全部为合成数据,这些验证不代表任何供应商的真实账号发现或推理调用已经通过。无需修改 DSH 源码。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@edge-sky/dsh-oauth-adapter",
3
3
  "description": "Web OAuth account surface for official DSH authorization flows",
4
- "version": "0.1.2-beta.1",
4
+ "version": "0.1.2-dev.1",
5
5
  "author": {
6
6
  "name": "edge-sky",
7
7
  "url": "https://github.com/edge-sky"
@@ -59,27 +59,30 @@
59
59
  },
60
60
  "client": {
61
61
  "inject": [
62
- "@deepseek-ai/dsh-client-runtime",
63
62
  "@deepseek-ai/dsh-client-ui-settings",
64
- "@deepseek-ai/dsh-client-locale"
63
+ "@deepseek-ai/dsh-client-locale",
64
+ "@deepseek-ai/dsh-client-ui-settings-models"
65
65
  ],
66
66
  "platform": "web"
67
67
  }
68
68
  },
69
69
  "peerDependencies": {
70
- "@deepseek-ai/cordis": ">=4.0.1",
71
- "@deepseek-ai/dsh-authorization": ">=0.1.1-rc.2 <0.2.0-0",
72
- "@deepseek-ai/dsh-client-locale": ">=0.1.1-rc.2 <0.2.0-0",
73
- "@deepseek-ai/dsh-client-runtime": ">=0.1.1-rc.2 <0.2.0-0",
74
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.1-rc.2 <0.2.0-0",
75
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.1-rc.2 <0.2.0-0",
76
- "@deepseek-ai/dsh-credentials": ">=0.1.1-rc.2 <0.2.0-0",
77
- "@deepseek-ai/dsh-host-webserver": ">=0.1.1-rc.2 <0.2.0-0",
78
- "@deepseek-ai/dsh-invariants": ">=0.1.1-rc.2 <0.2.0-0",
79
- "@deepseek-ai/dsh-llm": ">=0.1.1-rc.2 <0.2.0-0",
80
- "@deepseek-ai/dsh-llm-pi-ai": ">=0.1.1-rc.2 <0.2.0-0",
81
- "@deepseek-ai/dsh-settings": ">=0.1.1-rc.2 <0.2.0-0",
82
- "react": ">=18.2.0"
70
+ "@deepseek-ai/cordis": ">=4.0.2",
71
+ "@deepseek-ai/dsh-authorization": ">=0.1.2-rc.1 <0.2.0-0",
72
+ "@deepseek-ai/dsh-client-locale": ">=0.1.2-rc.1 <0.2.0-0",
73
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.2-rc.1 <0.2.0-0",
74
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.2-rc.1 <0.2.0-0",
75
+ "@deepseek-ai/dsh-credentials": ">=0.1.2-rc.1 <0.2.0-0",
76
+ "@deepseek-ai/dsh-host-webserver": ">=0.1.2-rc.1 <0.2.0-0",
77
+ "@deepseek-ai/dsh-invariants": ">=0.1.2-rc.1 <0.2.0-0",
78
+ "@deepseek-ai/dsh-llm": ">=0.1.2-rc.1 <0.2.0-0",
79
+ "@deepseek-ai/dsh-llm-pi-ai": ">=0.1.2-rc.1 <0.2.0-0",
80
+ "@deepseek-ai/dsh-settings": ">=0.1.2-rc.1 <0.2.0-0",
81
+ "react": ">=18.2.0",
82
+ "@deepseek-ai/dsh-client-ui-settings-models": ">=0.1.2-rc.1 <0.2.0-0",
83
+ "@deepseek-ai/dsh-attachment": ">=0.1.2-rc.1 <0.2.0-0",
84
+ "@deepseek-ai/dsh-fs": ">=0.1.2-rc.1 <0.2.0-0",
85
+ "@deepseek-ai/dsh-client-ui-renderer": ">=0.1.2-rc.1 <0.2.0-0"
83
86
  },
84
87
  "peerDependenciesMeta": {
85
88
  "@deepseek-ai/cordis": {
@@ -88,9 +91,6 @@
88
91
  "@deepseek-ai/dsh-client-locale": {
89
92
  "optional": true
90
93
  },
91
- "@deepseek-ai/dsh-client-runtime": {
92
- "optional": true
93
- },
94
94
  "@deepseek-ai/dsh-client-ui-settings": {
95
95
  "optional": true
96
96
  },
@@ -117,25 +117,37 @@
117
117
  },
118
118
  "react": {
119
119
  "optional": true
120
+ },
121
+ "@deepseek-ai/dsh-client-ui-settings-models": {
122
+ "optional": true
123
+ },
124
+ "@deepseek-ai/dsh-attachment": {
125
+ "optional": true
126
+ },
127
+ "@deepseek-ai/dsh-fs": {
128
+ "optional": true
129
+ },
130
+ "@deepseek-ai/dsh-client-ui-renderer": {
131
+ "optional": true
120
132
  }
121
133
  },
122
134
  "dependencies": {
123
- "@deepseek-ai/schemastery": "^3.18.1",
124
- "ws": "^8.18.3"
135
+ "@deepseek-ai/schemastery": "^3.18.2",
136
+ "ws": "^8.18.3",
137
+ "@earendil-works/pi-ai": "0.84.4"
125
138
  },
126
139
  "devDependencies": {
127
- "@deepseek-ai/cordis": "^4.0.1",
128
- "@deepseek-ai/dsh-authorization": "0.1.1-rc.2",
129
- "@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
130
- "@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
131
- "@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
132
- "@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
133
- "@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
134
- "@deepseek-ai/dsh-host-webserver": "0.1.1-rc.2",
135
- "@deepseek-ai/dsh-invariants": "0.1.1-rc.2",
136
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
137
- "@deepseek-ai/dsh-llm-pi-ai": "0.1.1-rc.2",
138
- "@deepseek-ai/dsh-settings": "0.1.1-rc.2",
140
+ "@deepseek-ai/cordis": "^4.0.2",
141
+ "@deepseek-ai/dsh-authorization": "0.1.2-rc.1",
142
+ "@deepseek-ai/dsh-client-locale": "0.1.2-rc.1",
143
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.2-rc.1",
144
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.2-rc.1",
145
+ "@deepseek-ai/dsh-credentials": "0.1.2-rc.1",
146
+ "@deepseek-ai/dsh-host-webserver": "0.1.2-rc.1",
147
+ "@deepseek-ai/dsh-invariants": "0.1.2-rc.1",
148
+ "@deepseek-ai/dsh-llm": "0.1.2-rc.1",
149
+ "@deepseek-ai/dsh-llm-pi-ai": "0.1.2-rc.1",
150
+ "@deepseek-ai/dsh-settings": "0.1.2-rc.1",
139
151
  "@types/node": "^22.20.0",
140
152
  "@types/react": "~18.3.1",
141
153
  "@types/react-dom": "~18.3.1",
@@ -144,6 +156,20 @@
144
156
  "react-dom": "^18.2.0",
145
157
  "tsdown": "^0.22.2",
146
158
  "typescript": "^6.0.3",
147
- "vitest": "^4.1.8"
159
+ "vitest": "^4.1.8",
160
+ "@deepseek-ai/dsh-client-ui-settings-models": "0.1.2-rc.1",
161
+ "@deepseek-ai/dsh-attachment": "0.1.2-rc.1",
162
+ "@deepseek-ai/dsh-fs": "0.1.2-rc.1",
163
+ "@deepseek-ai/dsh-settings-file": "0.1.2-rc.1",
164
+ "@deepseek-ai/dsh-credentials-local": "0.1.2-rc.1",
165
+ "@deepseek-ai/dsh-client-ui-renderer": "0.1.2-rc.1",
166
+ "jsdom": "^26.1.0",
167
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.2-rc.1",
168
+ "@deepseek-ai/dsh-client-store": "0.1.2-rc.1",
169
+ "@deepseek-ai/dsh-atomic-write": "0.1.2-rc.1",
170
+ "@deepseek-ai/dsh-home-paths": "0.1.2-rc.1",
171
+ "@deepseek-ai/dsh-launch-environment": "0.1.2-rc.1",
172
+ "@deepseek-ai/dsh-session": "0.1.2-rc.1",
173
+ "@deepseek-ai/dsh-scope": "0.1.2-rc.1"
148
174
  }
149
175
  }