dsh-keys-manager 0.2.4 → 0.2.6
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/CHANGELOG.md +38 -0
- package/README.md +86 -4
- package/README.zh-CN.md +35 -4
- package/lib/client/types.d.ts +2 -0
- package/lib/client.js +103 -15
- package/lib/domain.d.ts +14 -1
- package/lib/host-types.d.ts +12 -3
- package/lib/index.d.ts +102 -4
- package/lib/index.js +457 -66
- package/lib/index.js.map +1 -1
- package/lib/oauth/adapter.d.ts +59 -0
- package/lib/oauth/adapter.js +47 -0
- package/lib/oauth/adapter.js.map +1 -0
- package/lib/oauth/providers.d.ts +31 -0
- package/lib/oauth/providers.js +34 -0
- package/lib/oauth/providers.js.map +1 -0
- package/lib/oauth/signin.d.ts +58 -0
- package/lib/oauth/signin.js +112 -0
- package/lib/oauth/signin.js.map +1 -0
- package/lib/omp-oauth/oauth.mjs +1785 -0
- package/locale/en.json +5 -1
- package/locale/zh.json +5 -1
- package/package.json +9 -4
- package/scripts/verify-dist.mjs +18 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to dsh-keys-manager are documented here. Assembled from `.changes/unreleased/` fragments by the release-prep workflow.
|
|
4
4
|
|
|
5
|
+
## [0.2.6] - 2026-10-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Add the bundled `lib/omp/google.mjs` artifact: omp's Gemini Cloud Code Assist provider, shared by the `google-gemini-cli` and `google-antigravity` routes and dispatching on `model.provider`, with a manifest entry, pinned source hashes and a calibrated size ceiling.
|
|
10
|
+
- Add the generated Google model tables (`google-gemini-cli`, `google-antigravity`) and their `googleGeminiCliCatalogModels()` / `googleAntigravityCatalogModels()` projections for host-side model pickers.
|
|
11
|
+
- Add the `google-gemini-cli` and `google-antigravity` sign-in flows: a loopback listener on `127.0.0.1` (port fallback to an ephemeral port, five-minute bounded wait, abort-safe), a paste fallback, Cloud Code Assist project discovery and a single-window token refresh that preserves the project and an un-rotated refresh token.
|
|
12
|
+
- Register both Google routes: configurable `providers.google-gemini-cli` / `providers.google-antigravity` allow-lists, catalog-model exports for host pickers, and lazy loading of the shared `lib/omp/google.mjs` artifact (a missing build reaches the request as `TRANSPORT_UNAVAILABLE`, never a failed start).
|
|
13
|
+
- Project the transport package's model catalogs into the Keys Manager model picker for the `google-gemini-cli`, `google-antigravity` and `factory-droid` routes, each from its own catalog export.
|
|
14
|
+
- A transport build that registers one of these routes without shipping its catalog reports the missing catalog in the picker's response instead of showing an unexplained empty model list.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Fix the Cursor route's file and shell tools: DSH tools whose names collide with Cursor's native exec channel (`read`, `bash`, `write`, `delete`, `ls`, `grep`, `todo`) are advertised as `dsh_<name>` so the transport keeps them in its MCP tool list; the event stream restores the DSH name on the tool call, while history replay keeps the advertised `dsh_<name>` alias so the follow-up request matches. The seven `dsh_<native>` names are reserved: declaring a DSH tool under one fails the request with `TOOL_ALIAS_COLLISION` instead of being silently resolved.
|
|
19
|
+
|
|
20
|
+
## [0.2.5] - 2026-10-23
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Sign in to Kilo and Z.AI (GLM Coding Plan) from Keys Manager: Kilo polls a device-code page, Z.AI opens a browser URL and accepts the pasted redirect URL or code.
|
|
25
|
+
- Both sign-ins mint a static credential stored as an ordinary key row (`signin:kilo` / `signin:zai-coding-plan`); Sign in again replaces that row's literal in place.
|
|
26
|
+
- The first Kilo sign-in creates its plugin route and first key; Z.AI joins an adopted route as one more pool row, and neither writes a `llm-pi-ai` grant.
|
|
27
|
+
- Add the `devin` transport route: a second omp-backed artifact (`lib/omp/devin.mjs`) speaking Devin's Connect-framed chat protocol, with its own generated catalog (`swe-1-6`, `swe-1-6-fast`), manifest entry, drift gate and calibrated size ceiling.
|
|
28
|
+
- Add the `llm-omp-transports/devin` sign-in flow: PKCE authorize page plus a paste-the-callback prompt (the pinned loopback listener is Bun-only), a token exchange and a static bearer with a derived `expires`; there is no refresh.
|
|
29
|
+
- Register the Devin adapter, its Models-page profile, `providers.devin.models` allow-list and provider info beside Cursor's, sharing one route-parameterised adapter and projection.
|
|
30
|
+
- Fill DSH attribution headers only where a request left them absent, so Devin's chat call keeps its required `connect-go` client identity while the header-less `GetUserJwt` handshake still carries the harness `user-agent`.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Document the `devin` transport route in the root README (EN/ZH): paste-only sign-in, no refresh token, unverified endpoints, and the corrected "one grant per route" wording.
|
|
35
|
+
- Root known limits now name Kilo and Z.AI Coding Plan as in-process sign-in routes and state the transport `expires` contract per resolver.
|
|
36
|
+
- The sign-in dialog masks a pasted authorization code (Z.AI and Devin) behind a reveal toggle, resets the reveal on every new prompt, and uses `autocomplete="new-password"` so a saved password is never filled in.
|
|
37
|
+
- A transport grant with a usable token and no `expires` stays `active` on the Devin route with no expiry cell, while the Cursor route (which needs a dated grant) reports `needs-reauth`.
|
|
38
|
+
- A transport route whose installed build ships no model catalog now reports it once in the state warnings instead of showing an empty model list without explanation.
|
|
39
|
+
- Signing in to Kilo seeds the route from the plugin catalog instead of waiting for endpoint model discovery before the key row appears.
|
|
40
|
+
- The model picker explains an empty catalog instead of rendering a bare empty list when the installed transport build ships no catalog for the route; Save is off until the catalog exists.
|
|
41
|
+
- Adopting a catalog route that has no Models profile now creates one from the installed catalog, so the connection test and the Models page can select the route's models instead of refusing with "no settings profile yet".
|
|
42
|
+
|
|
5
43
|
## [0.2.4] - 2026-10-22
|
|
6
44
|
|
|
7
45
|
### Fixed
|
package/README.md
CHANGED
|
@@ -24,7 +24,9 @@ manager.
|
|
|
24
24
|
- OAuth account sign-in for seven pi-ai-backed providers, stored beside
|
|
25
25
|
the API keys.
|
|
26
26
|
- A companion transport component for providers the vendored pi-ai cannot
|
|
27
|
-
speak — Cursor (`cursor`)
|
|
27
|
+
speak — four routes: Cursor (`cursor`), Devin (`devin`), Google Gemini CLI
|
|
28
|
+
(`google-gemini-cli`) and Google Antigravity (`google-antigravity`) —
|
|
29
|
+
installed with the plugin.
|
|
28
30
|
|
|
29
31
|
### Extra providers
|
|
30
32
|
|
|
@@ -101,7 +103,8 @@ Installing `dsh-keys-manager` installs two bundle components. The published
|
|
|
101
103
|
package depends on `dsh-llm-omp-transports`, so one install resolves both npm
|
|
102
104
|
packages, and the plugin page lists both `dsh-keys-manager` and
|
|
103
105
|
`llm-omp-transports`. Enable both: the manager owns credentials and routing,
|
|
104
|
-
the transport component owns the
|
|
106
|
+
the transport component owns the wire protocols of its four routes (Cursor,
|
|
107
|
+
Devin, and the two Google routes).
|
|
105
108
|
|
|
106
109
|
### Install — local checkout
|
|
107
110
|
|
|
@@ -172,6 +175,36 @@ credential store, behind the account's `grantRef`; the manager state keeps
|
|
|
172
175
|
the reference plus non-sensitive metadata (email, account id, expiry) — the
|
|
173
176
|
same secret-free layout as API keys.
|
|
174
177
|
|
|
178
|
+
### Sign-in providers (Kilo, Z.AI Coding Plan)
|
|
179
|
+
|
|
180
|
+
Two more routes sign in from Keys Manager through this plugin's own bundled
|
|
181
|
+
clients instead of the `llm-pi-ai` seam:
|
|
182
|
+
|
|
183
|
+
- **Kilo** (`kilo`, installed as a plugin extra route): a device-code page
|
|
184
|
+
plus a poll. The first successful sign-in creates the route and its first
|
|
185
|
+
pool row; later sign-ins append rows.
|
|
186
|
+
- **Z.AI (GLM Coding Plan)** (`zai`, a shipped pi-ai route): adopt it first.
|
|
187
|
+
The flow opens a browser page and asks you to paste the final redirect URL
|
|
188
|
+
(a `zcode://` URL) or just the authorization code back into the dialog.
|
|
189
|
+
|
|
190
|
+
Both mint a **static** credential — a token or an `id.secret` key — stored as
|
|
191
|
+
an ordinary pool row tagged `signin:kilo` / `signin:zai-coding-plan`. They are
|
|
192
|
+
not refreshable grants, so the row menu's **Sign in again** is the only way to
|
|
193
|
+
renew one; it replaces that row's literal in place and keeps its id and
|
|
194
|
+
position. Nothing is written to `llm-pi-ai/<provider>` for these routes.
|
|
195
|
+
|
|
196
|
+
**A login flow is not a transport.** These two routes serve through the normal
|
|
197
|
+
pi-ai key pool and take part in sticky selection, round-robin, retry failover
|
|
198
|
+
and cooldowns. The `llm-omp-transports` surface described below is the other
|
|
199
|
+
thing entirely: one grant per route, each with its own section.
|
|
200
|
+
|
|
201
|
+
**`muse-code` needs no transport.** It is already served by the vendored pi-ai
|
|
202
|
+
`meta` route (`openai-responses` against `https://api.meta.ai/v1`, catalog key
|
|
203
|
+
`meta`), so it is managed through the ordinary pi-ai provider path. The check
|
|
204
|
+
that the catalog entry and the provider agree on that route and credential
|
|
205
|
+
shape was static; no live request was made. The first live call is a manual
|
|
206
|
+
smoke check, as described in [Known limits](docs/known-limits.md).
|
|
207
|
+
|
|
175
208
|
### Cursor transport
|
|
176
209
|
|
|
177
210
|
Cursor is served by the companion `dsh-llm-omp-transports` component on its
|
|
@@ -191,6 +224,55 @@ automatically on the credential seam.
|
|
|
191
224
|
identity. Read the [transports package docs](packages/llm-omp/README.md)
|
|
192
225
|
before relying on it; the risks and limits are listed there.
|
|
193
226
|
|
|
227
|
+
### Devin transport
|
|
228
|
+
|
|
229
|
+
Devin is the second route served by the same `dsh-llm-omp-transports`
|
|
230
|
+
component, on its own `devin` route with the same one-grant record at
|
|
231
|
+
`llm-omp-transports/devin`.
|
|
232
|
+
|
|
233
|
+
- Sign in from the **Transport accounts** section. omp finishes this login
|
|
234
|
+
through a loopback listener that only Bun provides, so this plugin opens the
|
|
235
|
+
authorize page and asks you to paste back the address the browser landed on
|
|
236
|
+
(the full URL or `code#state`). Nothing listens on the redirect port, so the
|
|
237
|
+
page itself fails to load and the code stays in the address bar.
|
|
238
|
+
- **There is no refresh.** The record is a static bearer whose expiry is
|
|
239
|
+
derived from the token (JWT `exp` minus five minutes, else one year). A
|
|
240
|
+
grant with no `expires` is served as a static bearer and reported `active`
|
|
241
|
+
with no expiry cell; once a readable expiry passes, sign in again by hand.
|
|
242
|
+
- Models come from the pinned catalog (two rows, `swe-1-6` and `swe-1-6-fast`)
|
|
243
|
+
generated into the transport at build time.
|
|
244
|
+
- The client is unofficial and presents the released Devin CLI identity; the
|
|
245
|
+
real endpoints and protocol behavior are unverified. Read the
|
|
246
|
+
[transports package known limits](packages/llm-omp/docs/known-limits.md)
|
|
247
|
+
before relying on it.
|
|
248
|
+
|
|
249
|
+
### Google transports
|
|
250
|
+
|
|
251
|
+
Two Google routes are served by the same `dsh-llm-omp-transports` component.
|
|
252
|
+
They share one generated `lib/omp/google.mjs` artifact and the provider inside
|
|
253
|
+
it dispatches on the model, but each route is separate everywhere else:
|
|
254
|
+
`google-gemini-cli` and `google-antigravity`, each with its own one-grant
|
|
255
|
+
record at `llm-omp-transports/<route>`, its own account row and its own model
|
|
256
|
+
catalog.
|
|
257
|
+
|
|
258
|
+
- Sign in from the **Transport accounts** section. This login finishes in the
|
|
259
|
+
plugin itself: a `node:http` listener on `127.0.0.1` receives the browser
|
|
260
|
+
redirect (`8085` `/oauth2callback` for `google-gemini-cli`, `51121`
|
|
261
|
+
`/oauth-callback` for `google-antigravity`, with a free-port fallback when
|
|
262
|
+
the default is taken). The same dialog always offers the paste path — the
|
|
263
|
+
full address the browser landed on, or `code#state` — for a browser that
|
|
264
|
+
cannot reach the listener.
|
|
265
|
+
- The grant is `{access, refresh, expires, projectId, email?}` and refreshes
|
|
266
|
+
on the credential seam, so an expired token is renewed without re-login
|
|
267
|
+
while the refresh token stays valid. Sign-in also resolves the Google Cloud
|
|
268
|
+
project the route bills and sends.
|
|
269
|
+
- Models come from the pinned catalog at build time: seven rows for
|
|
270
|
+
`google-gemini-cli`, 22 for `google-antigravity`.
|
|
271
|
+
- The clients are unofficial and present vendor-internal OAuth identities; the
|
|
272
|
+
first live turn on either route is a manual smoke check. Read the
|
|
273
|
+
[Known limits](docs/known-limits.md) for the listener, the antigravity
|
|
274
|
+
version read and the 401/403 posture before relying on them.
|
|
275
|
+
|
|
194
276
|
### Selection and failure policy
|
|
195
277
|
|
|
196
278
|
- **Sticky session**: the first request of a session selects a key and binds
|
|
@@ -269,7 +351,7 @@ This repository is a pnpm workspace with two published packages:
|
|
|
269
351
|
| Path | npm package | Role |
|
|
270
352
|
|---|---|---|
|
|
271
353
|
| root | `dsh-keys-manager` | Host plugin, Keys Manager Web client, bundle patch |
|
|
272
|
-
| `packages/llm-omp` | `dsh-llm-omp-transports` | Cursor
|
|
354
|
+
| `packages/llm-omp` | `dsh-llm-omp-transports` | Cursor, Devin and Google transport component |
|
|
273
355
|
|
|
274
356
|
The root package declares the transports package as a dependency, so the
|
|
275
357
|
published Keys Manager tarball pulls the transport in rather than vendoring
|
|
@@ -283,7 +365,7 @@ it. Both packages are released together and carry the same version; see
|
|
|
283
365
|
| [Development](docs/development.md) | build and dev workflow, repository layout |
|
|
284
366
|
| [Release](docs/release.md) | CI checks and the npm release flow |
|
|
285
367
|
| [Known limits](docs/known-limits.md) | current design boundaries, including deferred providers |
|
|
286
|
-
| [Transports package](packages/llm-omp/README.md) |
|
|
368
|
+
| [Transports package](packages/llm-omp/README.md) | Transport routes: support status, risks, build/test, release |
|
|
287
369
|
|
|
288
370
|
Chinese versions: [README.zh-CN.md](README.zh-CN.md) and the `*.zh-CN.md`
|
|
289
371
|
files in `docs/` — [开发](docs/development.zh-CN.md) ·
|
package/README.zh-CN.md
CHANGED
|
@@ -19,7 +19,7 @@ DSH Keys Manager 是一个 DeepSeek Harness 插件,把一个提供商 API key
|
|
|
19
19
|
- 既有 Models 提供商卡片内出现"由 Keys Manager 托管"徽标。
|
|
20
20
|
- 额外内置提供商以普通 `llm-pi-ai` 路由安装。
|
|
21
21
|
- 七家 pi-ai 覆盖的提供商支持 OAuth 账户登录,凭据与 API key 并存管理。
|
|
22
|
-
- 随插件附带一个传输组件,服务随附 pi-ai
|
|
22
|
+
- 随插件附带一个传输组件,服务随附 pi-ai 无法支持的提供商——共四条路由:Cursor(`cursor`)、Devin(`devin`)、Google Gemini CLI(`google-gemini-cli`)与 Google Antigravity(`google-antigravity`)。
|
|
23
23
|
|
|
24
24
|
### 额外提供商
|
|
25
25
|
|
|
@@ -87,7 +87,7 @@ CoreWeave Serverless Inference 还需在添加前把 `COREWEAVE_PROJECT=<team>/<
|
|
|
87
87
|
dsh plugin --profile web add dsh-keys-manager
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
安装 `dsh-keys-manager` 会安装两个 bundle 组件。已发布包依赖 `dsh-llm-omp-transports`,因此一次安装会解析两个 npm 包,插件页面会同时列出 `dsh-keys-manager` 与 `llm-omp-transports
|
|
90
|
+
安装 `dsh-keys-manager` 会安装两个 bundle 组件。已发布包依赖 `dsh-llm-omp-transports`,因此一次安装会解析两个 npm 包,插件页面会同时列出 `dsh-keys-manager` 与 `llm-omp-transports`。两者都要启用:管理器负责凭据与路由,传输组件负责其四条路由(Cursor、Devin 与两条 Google 路由)的线协议。
|
|
91
91
|
|
|
92
92
|
### 安装 —— 本地检出
|
|
93
93
|
|
|
@@ -122,6 +122,19 @@ dsh plugin --profile web link .
|
|
|
122
122
|
|
|
123
123
|
添加账户只把提供商签发的授权存进 Harness 凭据存储(挂在账户的 `grantRef` 之下);管理器状态里只存引用与非敏感元数据(邮箱、账户 ID、过期时间)——与 API key 相同的无明文布局。
|
|
124
124
|
|
|
125
|
+
### 内置登录提供商(Kilo、Z.AI Coding Plan)
|
|
126
|
+
|
|
127
|
+
另有两条路由通过本插件自带的登录客户端,而不是 `llm-pi-ai` seam 登录:
|
|
128
|
+
|
|
129
|
+
- **Kilo**(`kilo`,以插件内置扩展路由的形式安装):设备码页面加轮询。首次登录成功会创建该路由及其第一把 key 行;之后再登录则追加行。
|
|
130
|
+
- **Z.AI (GLM Coding Plan)**(`zai`,DSH 随附的 pi-ai 路由):需要先接管。流程会打开浏览器页面,并要求你把最终跳转 URL(`zcode://` 链接)或授权码粘贴回对话框。
|
|
131
|
+
|
|
132
|
+
两者签发的都是**静态凭据**——一个 token 或一个 `id.secret` key——以普通的 key 行存入同一个池,标记为 `signin:kilo` / `signin:zai-coding-plan`。它们不是可刷新的授权,因此行菜单里的**重新登录**是唯一的续期方式:它会就地替换该行的字面量,保留行 ID 与位置。这两条路由不会向 `llm-pi-ai/<provider>` 写入任何内容。
|
|
133
|
+
|
|
134
|
+
**登录流程不等于传输。** 这两条路由走常规 pi-ai key 池,参与会话粘滞、轮询、重试切换与冷却。下面描述的 `llm-omp-transports` 是另一套机制:每条路由一条授权,各自独立区块。
|
|
135
|
+
|
|
136
|
+
**`muse-code` 不需要传输。** 它已由随附 pi-ai 的 `meta` 路由提供(`openai-responses` 走 `https://api.meta.ai/v1`,目录键为 `meta`),因此按普通 pi-ai 提供商的路径管理即可。证明目录条目与提供商在该路由形态和凭据形态上一致的检查是静态的,没有发起真实请求;首次真实调用属于手动冒烟检查,详见[已知限制](docs/known-limits.zh-CN.md)。
|
|
137
|
+
|
|
125
138
|
### Cursor 传输
|
|
126
139
|
|
|
127
140
|
Cursor 由随附的 `dsh-llm-omp-transports` 组件在独立 `cursor` 路由上提供。它不经过 pi-ai key 池:该路由在 `llm-omp-transports/cursor` 只保留一条授权,并在凭据 seam 上自动刷新。
|
|
@@ -131,6 +144,24 @@ Cursor 由随附的 `dsh-llm-omp-transports` 组件在独立 `cursor` 路由上
|
|
|
131
144
|
- 暂不转发图片。路由按纯文本宣告输入,遇到图片块以类型化错误拒绝,而不是静默丢弃。
|
|
132
145
|
- 该客户端是非官方实现,会呈现 Cursor 厂商内部的 OAuth 身份。依赖它之前请阅读[传输包文档](packages/llm-omp/README.md),风险与限制列在那里。
|
|
133
146
|
|
|
147
|
+
### Devin 传输
|
|
148
|
+
|
|
149
|
+
Devin 是同一个 `dsh-llm-omp-transports` 组件服务的第二条路由:独立 `devin` 路由,同样在 `llm-omp-transports/devin` 只保留一条授权。
|
|
150
|
+
|
|
151
|
+
- 在 **传输账户**(`Transport accounts`)区块登录。omp 完成该登录需要一个只有 Bun 才提供的本地回环监听器,因此本插件打开授权页面后,要求你粘贴浏览器最终落到的地址(完整 URL 或 `code#state`)。重定向端口上没有任何监听,页面本身打不开,授权码会留在地址栏里供你复制。
|
|
152
|
+
- **没有刷新。** 该记录是静态 bearer,其有效期由令牌推导(JWT `exp` 减五分钟,否则一年)。没有 `expires` 的授权按静态 bearer 服务,状态显示为 `active`,不显示有效期;可读的有效期一旦过期,需要手动重新登录。
|
|
153
|
+
- 模型来自固定的目录(两行:`swe-1-6` 与 `swe-1-6-fast`),构建时生成进传输包。
|
|
154
|
+
- 该客户端是非官方实现,呈现已发布的 Devin CLI 身份;真实端点与协议行为均未验证。依赖它之前请阅读[传输包的已知限制](packages/llm-omp/docs/known-limits.md)。
|
|
155
|
+
|
|
156
|
+
### Google 传输
|
|
157
|
+
|
|
158
|
+
两条 Google 路由由同一个 `dsh-llm-omp-transports` 组件提供。它们共用一份生成的 `lib/omp/google.mjs` 产物,由产物内的提供商按模型分派;除此之外两者彼此独立:`google-gemini-cli` 与 `google-antigravity` 各自在 `llm-omp-transports/<route>` 保留一条授权,各有独立的账户行与模型目录。
|
|
159
|
+
|
|
160
|
+
- 在 **传输账户**(`Transport accounts`)区块登录。该登录由插件自身完成:`127.0.0.1` 上的 `node:http` 监听器接收浏览器重定向(`google-gemini-cli` 用 `8085` 的 `/oauth2callback`,`google-antigravity` 用 `51121` 的 `/oauth-callback`;默认端口被占用时回落到其它空闲端口)。同一个对话框始终提供粘贴路径——粘贴浏览器最终落到的完整地址,或 `code#state`——用于浏览器无法访问该监听器的情形。
|
|
161
|
+
- 授权内容为 `{access, refresh, expires, projectId, email?}`,在凭据 seam 上刷新:刷新令牌仍有效时,过期的 access 令牌会自动续期而无需重新登录。登录过程还会解析该路由计费与请求所用的 Google Cloud 项目。
|
|
162
|
+
- 模型来自构建时固定的目录:`google-gemini-cli` 七行,`google-antigravity` 22 行。
|
|
163
|
+
- 两个客户端都是非官方实现,会呈现厂商内部的 OAuth 身份;两条路由的首次真实请求都是手动冒烟检查。依赖它们之前请阅读[已知限制](docs/known-limits.zh-CN.md),其中说明了监听器、antigravity 的版本读取以及 401/403 姿态。
|
|
164
|
+
|
|
134
165
|
### 选择与故障策略
|
|
135
166
|
|
|
136
167
|
- **会话粘滞**:会话的首次请求选出一把 key 并为该会话/提供商对绑定,后续请求复用。
|
|
@@ -183,7 +214,7 @@ $DSH_HOME/keys-manager/state.json
|
|
|
183
214
|
| 路径 | npm 包 | 职责 |
|
|
184
215
|
|---|---|---|
|
|
185
216
|
| 根目录 | `dsh-keys-manager` | Host 插件、Keys Manager Web 客户端、bundle patch |
|
|
186
|
-
| `packages/llm-omp` | `dsh-llm-omp-transports` | Cursor
|
|
217
|
+
| `packages/llm-omp` | `dsh-llm-omp-transports` | Cursor、Devin 与 Google 传输组件 |
|
|
187
218
|
|
|
188
219
|
根包把传输包声明为依赖,因此已发布的 Keys Manager tarball 会拉取传输包,而不是把它 vendor 进来。两个包一起发布且版本号一致,详见[发布](docs/release.zh-CN.md)。
|
|
189
220
|
|
|
@@ -194,7 +225,7 @@ $DSH_HOME/keys-manager/state.json
|
|
|
194
225
|
| [开发](docs/development.zh-CN.md) | 构建与开发工作流、仓库布局 |
|
|
195
226
|
| [发布](docs/release.zh-CN.md) | CI 检查与 npm 发布流程 |
|
|
196
227
|
| [已知限制](docs/known-limits.zh-CN.md) | 当前设计边界,含延后提供商 |
|
|
197
|
-
| [传输包(英文)](packages/llm-omp/README.md) |
|
|
228
|
+
| [传输包(英文)](packages/llm-omp/README.md) | 传输路由:支持状态、风险、构建/测试与发布 |
|
|
198
229
|
|
|
199
230
|
英文版本:[README.md](README.md) 及 `docs/` 下的 `*.md` —— [Development](docs/development.md) · [Release](docs/release.md) · [Known limits](docs/known-limits.md)。当前设计边界速览:[已知限制](docs/known-limits.zh-CN.md)。
|
|
200
231
|
|
package/lib/client/types.d.ts
CHANGED
|
@@ -95,6 +95,8 @@ export interface ClientStore {
|
|
|
95
95
|
beginAccountLogin(provider: string, alias?: string, targetAccountId?: string): Promise<AccountAttemptResult>;
|
|
96
96
|
/** Resolve the attempt's parked prompt with the human's answer. */
|
|
97
97
|
answerAccountPrompt(attemptId: string, value: string): Promise<AckResult>;
|
|
98
|
+
/** Cancel an in-process attempt (the seam owns its own attempts). */
|
|
99
|
+
cancelAccountLogin(attemptId: string): Promise<AckResult>;
|
|
98
100
|
/** Poll one attempt's state; read-only, never sets the busy flag. */
|
|
99
101
|
accountAttempt(attemptId: string): Promise<AccountAttemptResult>;
|
|
100
102
|
/** List every known attempt, newest first (page reload recovery). */
|
package/lib/client.js
CHANGED
|
@@ -186,6 +186,7 @@ var zh = {
|
|
|
186
186
|
accountProjected: "\u670D\u52A1\u4E2D",
|
|
187
187
|
accountReauth: "\u91CD\u65B0\u8BA4\u8BC1",
|
|
188
188
|
accountActivate: "\u8BBE\u4E3A\u5F53\u524D",
|
|
189
|
+
signInAgain: "\u91CD\u65B0\u767B\u5F55",
|
|
189
190
|
testKey: "\u6D4B\u8BD5\u8FDE\u63A5",
|
|
190
191
|
testRunning: "\u6D4B\u8BD5\u4E2D\u2026",
|
|
191
192
|
testPassed: "\u8FDE\u63A5\u6B63\u5E38 \xB7 {ms} ms",
|
|
@@ -197,6 +198,8 @@ var zh = {
|
|
|
197
198
|
loginBrowserOpen: "\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00",
|
|
198
199
|
loginPromptTitle: "\u5B8C\u6210\u767B\u5F55",
|
|
199
200
|
loginPromptSubmit: "\u63D0\u4EA4",
|
|
201
|
+
loginPasteHint: "\u4ECE\u6D4F\u89C8\u5668\u5730\u5740\u680F\u590D\u5236\u5B8C\u6574 URL\uFF0C\u6216\u53EA\u7C98\u8D34\u6388\u6743\u7801\u3002",
|
|
202
|
+
loginReveal: "\u663E\u793A\u7C98\u8D34\u7684\u5185\u5BB9",
|
|
200
203
|
loginFailed: "\u767B\u5F55\u5931\u8D25",
|
|
201
204
|
loginFlowEnded: "\u672C\u6B21\u767B\u5F55\u6D41\u7A0B\u5DF2\u7ED3\u675F\uFF0C\u8BF7\u5173\u95ED\u7A97\u53E3\u540E\u91CD\u65B0\u5F00\u59CB\u3002",
|
|
202
205
|
loginReady: "\u767B\u5F55\u6210\u529F\u3002",
|
|
@@ -222,7 +225,8 @@ var zh = {
|
|
|
222
225
|
transportModelsSelected: "\u5DF2\u9009 {n}/{total}",
|
|
223
226
|
transportModelsLoading: "\u6B63\u5728\u52A0\u8F7D\u6A21\u578B\u2026",
|
|
224
227
|
transportModelsClear: "\u6E05\u9664\u9009\u62E9",
|
|
225
|
-
transportModelsHint: "\u4E0D\u52FE\u9009\u4EFB\u4F55\u6A21\u578B\u8868\u793A\u4F7F\u7528\u5168\u90E8\u6A21\u578B\uFF1B\u4FDD\u5B58\u540E\u8BE5\u8DEF\u7531\u7684\u6A21\u578B\u5217\u8868\u968F\u4E4B\u6536\u7A84\u3002"
|
|
228
|
+
transportModelsHint: "\u4E0D\u52FE\u9009\u4EFB\u4F55\u6A21\u578B\u8868\u793A\u4F7F\u7528\u5168\u90E8\u6A21\u578B\uFF1B\u4FDD\u5B58\u540E\u8BE5\u8DEF\u7531\u7684\u6A21\u578B\u5217\u8868\u968F\u4E4B\u6536\u7A84\u3002",
|
|
229
|
+
transportModelsMissingCatalog: "\u5DF2\u5B89\u88C5\u7684\u4F20\u8F93\u6784\u5EFA\u6CA1\u6709\u4E3A\u8BE5\u8DEF\u7531\u63D0\u4F9B\u6A21\u578B\u76EE\u5F55\uFF1B\u5217\u8868\u4F1A\u4E00\u76F4\u4E3A\u7A7A\uFF0C\u76F4\u5230\u91CD\u65B0\u6784\u5EFA\u6216\u5347\u7EA7 dsh-llm-omp-transports\u3002"
|
|
226
230
|
};
|
|
227
231
|
var en = {
|
|
228
232
|
nav: "Keys Manager",
|
|
@@ -369,6 +373,7 @@ var en = {
|
|
|
369
373
|
accountProjected: "Serving provider",
|
|
370
374
|
accountReauth: "Re-authenticate",
|
|
371
375
|
accountActivate: "Set active",
|
|
376
|
+
signInAgain: "Sign in again",
|
|
372
377
|
testKey: "Test",
|
|
373
378
|
testRunning: "Testing\u2026",
|
|
374
379
|
testPassed: "Test passed \xB7 {ms} ms",
|
|
@@ -380,6 +385,8 @@ var en = {
|
|
|
380
385
|
loginBrowserOpen: "Open in browser",
|
|
381
386
|
loginPromptTitle: "Complete sign-in",
|
|
382
387
|
loginPromptSubmit: "Submit",
|
|
388
|
+
loginPasteHint: "Paste the full URL from your browser address bar, or just the authorization code.",
|
|
389
|
+
loginReveal: "Show pasted code",
|
|
383
390
|
loginFailed: "Login failed",
|
|
384
391
|
loginFlowEnded: "This sign-in session has ended. Close the dialog and start again.",
|
|
385
392
|
loginReady: "Signed in.",
|
|
@@ -404,7 +411,8 @@ var en = {
|
|
|
404
411
|
transportModelsSelected: "{n} of {total} selected",
|
|
405
412
|
transportModelsLoading: "Loading models\u2026",
|
|
406
413
|
transportModelsClear: "Clear selection",
|
|
407
|
-
transportModelsHint: "Leave every model unchecked to use the full catalog; saving narrows the list this route advertises."
|
|
414
|
+
transportModelsHint: "Leave every model unchecked to use the full catalog; saving narrows the list this route advertises.",
|
|
415
|
+
transportModelsMissingCatalog: "The installed transport build ships no model catalog for this route; the list stays empty until dsh-llm-omp-transports is rebuilt or upgraded."
|
|
408
416
|
};
|
|
409
417
|
var LOCALE_DICTS = { zh, en };
|
|
410
418
|
|
|
@@ -696,7 +704,8 @@ function shapeTransportModels(value) {
|
|
|
696
704
|
}
|
|
697
705
|
}
|
|
698
706
|
const models = Array.isArray(record.models) ? record.models.filter((id) => typeof id === "string") : [];
|
|
699
|
-
|
|
707
|
+
const warning = typeof record.warning === "string" && record.warning.length > 0 ? record.warning : void 0;
|
|
708
|
+
return warning === void 0 ? { catalog, models } : { catalog, models, warning };
|
|
700
709
|
}
|
|
701
710
|
function modelPickerRows(view) {
|
|
702
711
|
const selected = new Set(view.models);
|
|
@@ -847,6 +856,9 @@ function createStore(ctx) {
|
|
|
847
856
|
answerAccountPrompt(attemptId, value) {
|
|
848
857
|
return send("answerAccountPrompt", { attemptId, value }, () => ({ ok: true, value: null }));
|
|
849
858
|
},
|
|
859
|
+
cancelAccountLogin(attemptId) {
|
|
860
|
+
return send("cancelAccountLogin", { attemptId }, () => ({ ok: true, value: null }));
|
|
861
|
+
},
|
|
850
862
|
async accountAttempt(attemptId) {
|
|
851
863
|
const result = await rpcRead("accountAttempt", { attemptId });
|
|
852
864
|
if (!result.ok) return { ok: false, error: result.error.message };
|
|
@@ -955,7 +967,8 @@ function providerInitial(provider) {
|
|
|
955
967
|
return source.length === 0 ? "?" : source.slice(0, 1).toUpperCase();
|
|
956
968
|
}
|
|
957
969
|
function oauthCapable(provider) {
|
|
958
|
-
|
|
970
|
+
if (provider.accountSupported !== void 0) return provider.accountSupported;
|
|
971
|
+
return provider.nativeAuth?.oauth === true;
|
|
959
972
|
}
|
|
960
973
|
function originOf(provider) {
|
|
961
974
|
return provider.origin ?? (provider.extra ? "plugin" : "dsh");
|
|
@@ -1124,6 +1137,7 @@ function Modal({ title, children, onClose, footer, busy }) {
|
|
|
1124
1137
|
onCloseRef.current = onClose;
|
|
1125
1138
|
busyRef.current = busy;
|
|
1126
1139
|
import_react2.default.useEffect(() => {
|
|
1140
|
+
if (typeof document === "undefined") return void 0;
|
|
1127
1141
|
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
1128
1142
|
const dialog = dialogRef.current;
|
|
1129
1143
|
const inerted = [];
|
|
@@ -1316,7 +1330,7 @@ function testLine(test, t) {
|
|
|
1316
1330
|
const detail = test.error !== void 0 && test.error.length > 0 ? test.error : test.timedOut === true ? t("testTimedOut") : t("testFailedUnknown");
|
|
1317
1331
|
return h("div", { className: "km-key-time km-warn", role: "status", style: ROW_TEST_STYLE }, t("testFailed", { error: detail }));
|
|
1318
1332
|
}
|
|
1319
|
-
function KeyRow({ provider, keyRecord, now }) {
|
|
1333
|
+
function KeyRow({ provider, keyRecord, now, onReauthenticate }) {
|
|
1320
1334
|
const key = keyRecord;
|
|
1321
1335
|
const runtime = useRuntime();
|
|
1322
1336
|
const t = useT();
|
|
@@ -1447,6 +1461,17 @@ function KeyRow({ provider, keyRecord, now }) {
|
|
|
1447
1461
|
menu ? h(
|
|
1448
1462
|
"div",
|
|
1449
1463
|
{ className: "km-menu", role: "menu" },
|
|
1464
|
+
// A row this plugin signed in for can be refreshed the same way it was
|
|
1465
|
+
// created; a hand-entered key has nothing to re-authenticate.
|
|
1466
|
+
key.importedFrom?.startsWith("signin:") === true && onReauthenticate !== void 0 ? h(
|
|
1467
|
+
"button",
|
|
1468
|
+
{ type: "button", className: "km-menu-item", role: "menuitem", onClick: () => {
|
|
1469
|
+
setMenu(false);
|
|
1470
|
+
onReauthenticate();
|
|
1471
|
+
}, disabled: busy },
|
|
1472
|
+
h(Icon, { name: "user", size: 15 }),
|
|
1473
|
+
t("signInAgain")
|
|
1474
|
+
) : null,
|
|
1450
1475
|
h("button", { type: "button", className: "km-menu-item", role: "menuitem", onClick: () => {
|
|
1451
1476
|
setMenu(false);
|
|
1452
1477
|
setEditing(true);
|
|
@@ -1716,10 +1741,12 @@ function TransportAccountRow({ account }) {
|
|
|
1716
1741
|
),
|
|
1717
1742
|
// The expiry column stays a clock, not a countdown: the route's adapter
|
|
1718
1743
|
// renews the grant itself, so "expired" here means "renews on next use".
|
|
1719
|
-
|
|
1744
|
+
// A static-bearer row advertises no expiry, but the cell stays in the grid
|
|
1745
|
+
// so its actions line up with dated rows; nothing is announced.
|
|
1746
|
+
account.expiresAt === void 0 ? h("div", { className: "km-key-last", "aria-hidden": true }) : h(
|
|
1720
1747
|
"div",
|
|
1721
1748
|
{ className: "km-key-last" },
|
|
1722
|
-
|
|
1749
|
+
h("div", { className: "km-key-time" }, t("transportExpires", { time: formatClock(account.expiresAt, locale, t) }))
|
|
1723
1750
|
),
|
|
1724
1751
|
h(
|
|
1725
1752
|
"div",
|
|
@@ -1811,6 +1838,8 @@ function TransportModels({ route }) {
|
|
|
1811
1838
|
setDraft(new Set(result.value.models));
|
|
1812
1839
|
}
|
|
1813
1840
|
const rows = view === null ? [] : modelPickerRows(view);
|
|
1841
|
+
const emptyCatalog = view !== null && view.catalog.length === 0;
|
|
1842
|
+
const warning = view === null ? void 0 : view.warning;
|
|
1814
1843
|
const errorLine = error === null ? null : h("div", { className: "km-inline-error", role: "alert" }, error);
|
|
1815
1844
|
return h(
|
|
1816
1845
|
"div",
|
|
@@ -1855,12 +1884,17 @@ function TransportModels({ route }) {
|
|
|
1855
1884
|
}),
|
|
1856
1885
|
h("span", null, row.name)
|
|
1857
1886
|
))),
|
|
1887
|
+
// An empty grid is also the all-models state: only the host's report of
|
|
1888
|
+
// a missing catalog explains it.
|
|
1889
|
+
emptyCatalog && warning !== void 0 ? h("div", { className: "km-field-hint", role: "status" }, t("transportModelsMissingCatalog")) : null,
|
|
1858
1890
|
h(
|
|
1859
1891
|
"div",
|
|
1860
1892
|
{ className: "km-models-actions" },
|
|
1893
|
+
// Save cannot fix a route the host has no catalog for; clicking it
|
|
1894
|
+
// would only surface the un-localized "no model list" error.
|
|
1861
1895
|
h(
|
|
1862
1896
|
Button,
|
|
1863
|
-
{ size: "small", variant: "primary", onClick: () => void save(), disabled: busy || view === null },
|
|
1897
|
+
{ size: "small", variant: "primary", onClick: () => void save(), disabled: busy || view === null || emptyCatalog },
|
|
1864
1898
|
busy ? t("saving") : t("save")
|
|
1865
1899
|
),
|
|
1866
1900
|
h(Button, {
|
|
@@ -1931,7 +1965,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
1931
1965
|
if (result.value !== null) setLogin({ attemptId: result.value.id });
|
|
1932
1966
|
}
|
|
1933
1967
|
async function adoptThenLogin() {
|
|
1934
|
-
if (provider.managed) {
|
|
1968
|
+
if (provider.managed || signInCreatesRoute) {
|
|
1935
1969
|
await openLogin();
|
|
1936
1970
|
return;
|
|
1937
1971
|
}
|
|
@@ -1947,6 +1981,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
1947
1981
|
}
|
|
1948
1982
|
const accountAdoptable = oauthCapable(provider);
|
|
1949
1983
|
const adoptable = provider.supported || accountAdoptable;
|
|
1984
|
+
const signInCreatesRoute = provider.extra === true && accountAdoptable;
|
|
1950
1985
|
return h(
|
|
1951
1986
|
"div",
|
|
1952
1987
|
{ className: cx("km-card", "km-provider", expanded && "km-provider-open", (managed || transport) && "km-provider-managed") },
|
|
@@ -2028,7 +2063,21 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
2028
2063
|
provider.baseURL !== null ? h("div", { className: "km-meta-line" }, h("span", { className: "km-muted" }, `${t("baseUrl")}:`), h("span", { className: "km-mono km-truncate" }, provider.baseURL)) : null,
|
|
2029
2064
|
provider.models.length > 0 ? h("div", { className: "km-meta-line" }, h("span", { className: "km-muted" }, `${t("models")}:`), h("span", null, t("countModels", { n: provider.models.length }))) : null
|
|
2030
2065
|
),
|
|
2031
|
-
isExtra ? h(
|
|
2066
|
+
isExtra ? h(
|
|
2067
|
+
import_react2.default.Fragment,
|
|
2068
|
+
null,
|
|
2069
|
+
signInCreatesRoute ? h(
|
|
2070
|
+
"div",
|
|
2071
|
+
{ className: "km-adopt-actions" },
|
|
2072
|
+
h(
|
|
2073
|
+
Button,
|
|
2074
|
+
{ variant: "secondary", onClick: () => void adoptThenLogin(), disabled: adopting || startingLogin },
|
|
2075
|
+
startingLogin ? h(Icon, { name: "refresh", size: 14, className: "km-spin" }) : h(Icon, { name: "user", size: 14 }),
|
|
2076
|
+
h("span", null, startingLogin ? t("adopting") : t("addAccount"))
|
|
2077
|
+
)
|
|
2078
|
+
) : null,
|
|
2079
|
+
h(KeyForm, { provider, autoFocus: true })
|
|
2080
|
+
) : h(
|
|
2032
2081
|
"div",
|
|
2033
2082
|
{ className: "km-adopt-actions" },
|
|
2034
2083
|
h(
|
|
@@ -2086,7 +2135,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
2086
2135
|
{ className: "km-empty-keys" },
|
|
2087
2136
|
h("div", null, provider.supported ? t("noKeys") : oauthCapable(provider) ? t("noKeysAccount") : t("unsupported")),
|
|
2088
2137
|
!provider.supported && provider.reason !== void 0 ? h("div", { className: "km-muted" }, provider.reason) : null
|
|
2089
|
-
) : h("div", { className: "km-keys" }, provider.keys.map((key) => key.kind === "oauth" ? h(AccountRow, { key: key.id, provider, keyRecord: key, now, onReauthenticate: () => void openLogin(key.id, key.alias) }) : h(KeyRow, { key: key.id, provider, keyRecord: key, now })))
|
|
2138
|
+
) : h("div", { className: "km-keys" }, provider.keys.map((key) => key.kind === "oauth" ? h(AccountRow, { key: key.id, provider, keyRecord: key, now, onReauthenticate: () => void openLogin(key.id, key.alias) }) : h(KeyRow, { key: key.id, provider, keyRecord: key, now, onReauthenticate: () => void openLogin(key.id, key.alias) })))
|
|
2090
2139
|
),
|
|
2091
2140
|
h(
|
|
2092
2141
|
"div",
|
|
@@ -2107,6 +2156,7 @@ function ProviderCard({ provider, expanded, onToggle, now, transportAccount }) {
|
|
|
2107
2156
|
login !== null ? h(LoginDialog, {
|
|
2108
2157
|
provider,
|
|
2109
2158
|
attemptId: login.attemptId,
|
|
2159
|
+
cancellable: oauthCapable(provider) && provider.nativeAuth?.oauth !== true,
|
|
2110
2160
|
onClose: () => setLogin(null)
|
|
2111
2161
|
}) : null
|
|
2112
2162
|
);
|
|
@@ -2122,21 +2172,24 @@ function safeNoticeUrl(url) {
|
|
|
2122
2172
|
}
|
|
2123
2173
|
}
|
|
2124
2174
|
var LOGIN_POLL_FAILURE_LIMIT = 3;
|
|
2125
|
-
function LoginDialog({ provider, attemptId, onClose }) {
|
|
2175
|
+
function LoginDialog({ provider, attemptId, cancellable = false, onClose }) {
|
|
2126
2176
|
const runtime = useRuntime();
|
|
2127
2177
|
const t = useT();
|
|
2128
2178
|
const [attempt, setAttempt] = import_react2.default.useState(null);
|
|
2129
2179
|
const [flowEnded, setFlowEnded] = import_react2.default.useState(false);
|
|
2130
2180
|
const [pollError, setPollError] = import_react2.default.useState(null);
|
|
2131
2181
|
const [answer, setAnswer] = import_react2.default.useState("");
|
|
2182
|
+
const [revealed, setRevealed] = import_react2.default.useState(false);
|
|
2132
2183
|
const [answering, setAnswering] = import_react2.default.useState(false);
|
|
2133
2184
|
const [error, setError] = import_react2.default.useState(null);
|
|
2185
|
+
const [cancelling, setCancelling] = import_react2.default.useState(false);
|
|
2134
2186
|
const pollNowRef = import_react2.default.useRef(null);
|
|
2135
2187
|
const onCloseRef = import_react2.default.useRef(onClose);
|
|
2136
2188
|
onCloseRef.current = onClose;
|
|
2137
2189
|
const prompt = attempt?.prompt;
|
|
2138
2190
|
const promptKey = prompt === void 0 ? "" : `${prompt.kind}\0${prompt.message}\0${(prompt.options ?? []).map((option) => option.id).join("\0")}`;
|
|
2139
2191
|
import_react2.default.useEffect(() => {
|
|
2192
|
+
setRevealed(false);
|
|
2140
2193
|
const options = prompt !== void 0 && prompt.kind === "select" ? prompt.options : void 0;
|
|
2141
2194
|
if (options !== void 0 && options.length > 0) {
|
|
2142
2195
|
setAnswer((current) => options.some((option) => option.id === current) ? current : options[0].id);
|
|
@@ -2222,6 +2275,20 @@ function LoginDialog({ provider, attemptId, onClose }) {
|
|
|
2222
2275
|
return;
|
|
2223
2276
|
}
|
|
2224
2277
|
setAnswer("");
|
|
2278
|
+
setRevealed(false);
|
|
2279
|
+
pollNowRef.current?.();
|
|
2280
|
+
}
|
|
2281
|
+
const inProcess = cancellable;
|
|
2282
|
+
async function cancel() {
|
|
2283
|
+
if (cancelling) return;
|
|
2284
|
+
setCancelling(true);
|
|
2285
|
+
setError(null);
|
|
2286
|
+
const result = await runtime.store.cancelAccountLogin(attemptId);
|
|
2287
|
+
setCancelling(false);
|
|
2288
|
+
if (!result.ok) {
|
|
2289
|
+
setError(result.error);
|
|
2290
|
+
return;
|
|
2291
|
+
}
|
|
2225
2292
|
pollNowRef.current?.();
|
|
2226
2293
|
}
|
|
2227
2294
|
const lastNotice = attempt !== null && attempt.notices.length > 0 ? attempt.notices[attempt.notices.length - 1] : null;
|
|
@@ -2266,6 +2333,7 @@ function LoginDialog({ provider, attemptId, onClose }) {
|
|
|
2266
2333
|
"div",
|
|
2267
2334
|
{ className: "km-field" },
|
|
2268
2335
|
h("span", { className: "km-field-label" }, prompt.message),
|
|
2336
|
+
prompt.kind === "manual-code" ? h("span", { className: "km-muted" }, t("loginPasteHint")) : null,
|
|
2269
2337
|
prompt.kind === "select" && prompt.options !== void 0 ? h("select", {
|
|
2270
2338
|
className: "km-input",
|
|
2271
2339
|
value: answer,
|
|
@@ -2274,14 +2342,31 @@ function LoginDialog({ provider, attemptId, onClose }) {
|
|
|
2274
2342
|
autoFocus: true
|
|
2275
2343
|
}, prompt.options.map((option) => h("option", { key: option.id, value: option.id }, option.label))) : h("input", {
|
|
2276
2344
|
className: "km-input",
|
|
2277
|
-
|
|
2345
|
+
// A pasted code is the only secret in the exchange (Z.AI's flow
|
|
2346
|
+
// has no PKCE, the Devin flow sends none back), so it is masked
|
|
2347
|
+
// exactly like `secret` prompts.
|
|
2348
|
+
type: (prompt.kind === "secret" || prompt.kind === "manual-code") && !revealed ? "password" : "text",
|
|
2278
2349
|
value: answer,
|
|
2279
2350
|
onChange: (event) => setAnswer(event.target.value),
|
|
2280
2351
|
placeholder: prompt.placeholder,
|
|
2281
2352
|
spellCheck: false,
|
|
2353
|
+
// The repo's convention for a field the browser must never fill
|
|
2354
|
+
// from a saved password; `off` is ignored on password inputs.
|
|
2355
|
+
autoComplete: prompt.kind === "secret" || prompt.kind === "manual-code" ? "new-password" : "off",
|
|
2282
2356
|
disabled: answering,
|
|
2283
2357
|
autoFocus: true
|
|
2284
|
-
})
|
|
2358
|
+
}),
|
|
2359
|
+
prompt.kind === "manual-code" ? h(
|
|
2360
|
+
"label",
|
|
2361
|
+
{ className: "km-muted" },
|
|
2362
|
+
h("input", {
|
|
2363
|
+
type: "checkbox",
|
|
2364
|
+
checked: revealed,
|
|
2365
|
+
onChange: (event) => setRevealed(event.target.checked),
|
|
2366
|
+
disabled: answering
|
|
2367
|
+
}),
|
|
2368
|
+
h("span", null, t("loginReveal"))
|
|
2369
|
+
) : null
|
|
2285
2370
|
),
|
|
2286
2371
|
error !== null ? h("div", { className: "km-inline-error", role: "alert" }, error) : null,
|
|
2287
2372
|
h(
|
|
@@ -2301,7 +2386,10 @@ function LoginDialog({ provider, attemptId, onClose }) {
|
|
|
2301
2386
|
title: t("loginTitle"),
|
|
2302
2387
|
onClose,
|
|
2303
2388
|
busy: false,
|
|
2304
|
-
footer:
|
|
2389
|
+
footer: [
|
|
2390
|
+
...inProcess ? [h(Button, { key: "cancel", onClick: () => void cancel(), disabled: answering || cancelling }, cancelling ? t("loginPending") : t("cancel"))] : [],
|
|
2391
|
+
h(Button, { key: "close", onClick: onClose, disabled: answering || cancelling }, t("close"))
|
|
2392
|
+
]
|
|
2305
2393
|
}, body);
|
|
2306
2394
|
}
|
|
2307
2395
|
function SettingsCard() {
|
package/lib/domain.d.ts
CHANGED
|
@@ -239,6 +239,13 @@ export interface TransportCatalogModel {
|
|
|
239
239
|
export interface TransportModelsView {
|
|
240
240
|
catalog: TransportCatalogModel[];
|
|
241
241
|
models: string[];
|
|
242
|
+
/**
|
|
243
|
+
* Why the catalog is empty. Rides every read whose catalog accessor is
|
|
244
|
+
* missing, so a remounted or reloaded picker still explains the empty list;
|
|
245
|
+
* absent for every route that does ship a catalog. The one-shot part of this
|
|
246
|
+
* report is the {@link StateView.warnings} entry, not this field.
|
|
247
|
+
*/
|
|
248
|
+
warning?: string;
|
|
242
249
|
}
|
|
243
250
|
/** Complete manager snapshot the UI renders. */
|
|
244
251
|
export interface StateView {
|
|
@@ -295,7 +302,13 @@ export interface AccountAttemptNotice {
|
|
|
295
302
|
}
|
|
296
303
|
/** Serializable prompt parked on an interactive sign-in attempt. */
|
|
297
304
|
export interface AccountAttemptPrompt {
|
|
298
|
-
|
|
305
|
+
/**
|
|
306
|
+
* `manual-code` is the out-of-band paste step an OAuth-code flow parks on
|
|
307
|
+
* (a `zcode://` redirect, or the Devin callback address): the dialog masks
|
|
308
|
+
* the field like a `secret`, offers a reveal toggle and carries the paste
|
|
309
|
+
* guidance, unlike a generic `text` prompt.
|
|
310
|
+
*/
|
|
311
|
+
kind: 'text' | 'secret' | 'select' | 'manual-code';
|
|
299
312
|
message: string;
|
|
300
313
|
placeholder?: string;
|
|
301
314
|
options?: ReadonlyArray<{
|
package/lib/host-types.d.ts
CHANGED
|
@@ -91,7 +91,12 @@ export interface AuthorizationInteractionLike {
|
|
|
91
91
|
code?: string;
|
|
92
92
|
}): void;
|
|
93
93
|
prompt(prompt: {
|
|
94
|
-
|
|
94
|
+
/**
|
|
95
|
+
* The seam itself only ever sends the three pi-ai kinds. `manual-code` is
|
|
96
|
+
* this plugin's own extension: the out-of-band paste step an OAuth-code
|
|
97
|
+
* driver parks on, which the dialog renders with paste guidance.
|
|
98
|
+
*/
|
|
99
|
+
kind?: 'text' | 'secret' | 'select' | 'manual-code';
|
|
95
100
|
message: string;
|
|
96
101
|
placeholder?: string;
|
|
97
102
|
options?: ReadonlyArray<{
|
|
@@ -150,8 +155,12 @@ export interface TransportGrantLike {
|
|
|
150
155
|
access: string;
|
|
151
156
|
/** Refresh token; absent on a grant that cannot be renewed. */
|
|
152
157
|
refresh?: string;
|
|
153
|
-
/**
|
|
154
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Epoch ms when the access token expires. Absent on a record the transport
|
|
160
|
+
* resolver accepts as a static bearer; no shipped flow writes one today —
|
|
161
|
+
* the Devin flow always commits a derived expiry.
|
|
162
|
+
*/
|
|
163
|
+
expires?: number;
|
|
155
164
|
email?: string;
|
|
156
165
|
accountId?: string;
|
|
157
166
|
}
|