@deepseek-ai/dsh-deepseek-account-platform 0.1.7-alpha.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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +96 -0
- package/README.zh.md +96 -0
- package/lib/index.js +891 -0
- package/lib/types/details.d.ts +17 -0
- package/lib/types/details.js +55 -0
- package/lib/types/index.d.ts +132 -0
- package/lib/types/index.js +488 -0
- package/lib/types/logout.d.ts +17 -0
- package/lib/types/logout.js +34 -0
- package/lib/types/protocol.d.ts +78 -0
- package/lib/types/protocol.js +210 -0
- package/lib/types/types.d.ts +3 -0
- package/lib/types/types.js +2 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
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.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/credentials/deepseek-account-platform/README.md
|
|
5
|
+
README.md: 34da2313ea99b989ea3a0692d2cca050116b5b6a
|
|
6
|
+
README.zh.md: e24036ebf7a5c431ab34abdb1f01415b7b3a4f36
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Sign in through the system browser and keep the account credential in the existing local credential store. Local cancellation prevents late callbacks and exchange responses from signing the user in."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-deepseek-account-platform
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
New attempts map the caller’s UI language to Platform en_US or zh_CN; active attempts retain their initial language.
|
|
11
|
+
|
|
12
|
+
getPlatformSession exports the stored grant only when its issuer matches platformOrigin. This Host-only operation supports native Platform embedding without widening the model/file origin configured for resolveToken.
|
|
13
|
+
|
|
14
|
+
`desktopPlatform` defaults to `null`. The Desktop profile supplies `darwin` or `win32`; Host authorization, profile, balance, and logout requests then carry `x-client-platform: desktop-mac` or `desktop-win`, overriding that header in deployment configuration. Embedded Platform document and API requests receive the same platform header alongside their deployment headers, only at the configured origin. Other profiles omit the automatic header.
|
|
15
|
+
|
|
16
|
+
## Summary
|
|
17
|
+
|
|
18
|
+
Sign in through the system browser and keep the account credential in the existing local credential store. Local cancellation prevents late callbacks and exchange responses from signing the user in.
|
|
19
|
+
|
|
20
|
+
## Table of Contents
|
|
21
|
+
|
|
22
|
+
- [Use this package](#use-this-package)
|
|
23
|
+
- [Model Experience](#model-experience)
|
|
24
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
25
|
+
|
|
26
|
+
<a id="use-this-package"></a>
|
|
27
|
+
## Use this package
|
|
28
|
+
|
|
29
|
+
The profile projection maps `id_profile.picture` to `avatarUrl`, using null when no picture is configured.
|
|
30
|
+
|
|
31
|
+
getProfile / getBalance sends the stored grant in the x-dsh-auth-token header to GET /auth-api/v0/users/current and GET /api/v0/users/get_user_summary on platformOrigin. The grant issuer must match that origin. Host projects only the account UID, profile name, avatar URL, phone or email exactly as masked by Platform, and normal_wallets / bonus_wallets currency/balance strings; response tokens and other fields are discarded. Bonus wallets remain separate from recharge balances. Credential changes and disposal invalidate in-flight queries.
|
|
32
|
+
|
|
33
|
+
Configure platformOrigin, allowLoopbackHttp, requestTimeoutMs, and attemptTimeoutMs in the plugin row. HTTP is accepted only for explicitly enabled loopback development. The provider registers /oauth/callback on the existing Host webServer before auth_init, validates state, exchanges an S256 PKCE code once, and commits a grant before redirecting to auth_exchange.biz_data.authorized_url. Browser destinations default to the configured platform origin and always require the fixed /dsh/authorize or /dsh/authorized path. The completion URL sets `login_source` to the initiating client (`web` or `desktop`) and preserves other Platform-supplied query parameters. Device identity is a separate random UUID record shared by processes using the same credential store; device_model reports OS and architecture.
|
|
34
|
+
|
|
35
|
+
Platform URLs have one configuration owner: `platformOrigin`. Authorization requests, browser validation, completion redirects, usage, and top-up destinations all use that origin. Set it in a private `$DSH_HOME/cordis.patch.yml`; deployment addresses do not belong in source control. HTTPS is required except for loopback HTTP with `allowLoopbackHttp: true`. Model and file token destinations use the separate `inferenceOrigin` configuration.
|
|
36
|
+
|
|
37
|
+
`requestHeaders` adds Host-only headers to authorization, profile, balance, and logout requests on `platformOrigin`. Header values are secret configuration; they are excluded from account UI state. Authorization, X-DSH-Auth-Token, Host, Content-Type and connection/framing headers are reserved. Redirects fail without forwarding headers. Store deployment cookies in private configuration or environment variables; browser cookies are not collected automatically.
|
|
38
|
+
|
|
39
|
+
A private patch can read environment variables through Cordis expressions:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
- id: deepseek-account
|
|
43
|
+
config:
|
|
44
|
+
platformOrigin: !!js process.env.DSH_PLATFORM_ORIGIN
|
|
45
|
+
allowLoopbackHttp: !!js process.env.DSH_PLATFORM_ALLOW_LOOPBACK_HTTP === '1'
|
|
46
|
+
requestHeaders: !!js |
|
|
47
|
+
process.env.DSH_PLATFORM_COOKIE ? { Cookie: process.env.DSH_PLATFORM_COOKIE } : {}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The authenticated client supplies its browser-accessible callback origin, including the local SSH forwarding port, and its UI kind. The provider fixes the callback path and binds the resulting redirect_uri to both initialization and exchange. Callback requests use state and PKCE validation rather than RPC authentication. Completion, cancellation and disposal remove only the attempt route. Exchange failures publish failed state without retrying: Web closes its authorization tab and keeps the failure dialog in the original tab; the callback page attempts to close itself and offers a manual-close message. Desktop receives HTTP 204 and focuses its existing login UI through the account stream.
|
|
51
|
+
|
|
52
|
+
Host diagnostics use the `[deepseek-account]` prefix on standard output and in the Host inspector Console. They include endpoint paths, HTTP status, numeric response codes, failure stages, invalid field paths, received types and validation codes, and browser URL rejection rules; headers, request and response bodies, authorization URLs, and raw exceptions are excluded.
|
|
53
|
+
|
|
54
|
+
`rewriteBrowserOrigin` defaults to `false`, requiring same-origin browser URLs. A private development patch may set it to `true` to map authorization and completion URLs to `platformOrigin`, preserving their fixed paths and query strings. Source URLs must use HTTPS or already match the configured origin; user information, fragments and unexpected paths remain rejected. Shipped profiles retain strict same-origin validation.
|
|
55
|
+
|
|
56
|
+
inferenceOrigin defaults to `https://api.deepseek.com`. A private deployment patch may replace it with one exact HTTP(S) origin, including its port, for inference and file authentication through x-dsh-auth-token. Paths, URL credentials, queries and fragments are invalid configuration. Alternate origins require a grant issued by the configured platformOrigin; mock tokens remain excluded. Loopback grants cannot authenticate the official production API. Deployment addresses belong in private patches, not shipped configuration.
|
|
57
|
+
|
|
58
|
+
At provider initialization, a valid stored grant whose issuer differs from platformOrigin is deleted locally before consumers read account state. Startup continues signed out without a remote logout request; API keys and device identity remain stored. Storage failures remain explicit, and account HTTP or response-validation failures do not delete a matching grant.
|
|
59
|
+
|
|
60
|
+
<a id="understand-the-implementation"></a>
|
|
61
|
+
## Understand the implementation
|
|
62
|
+
|
|
63
|
+
No runtime invariant companion is published: account presence reads the credential store, and attempt state projects private state directly. There is no independently maintained account index to compare. Behavior tests verify asynchronous cancellation and commit ordering.
|
|
64
|
+
|
|
65
|
+
<a id="further-exploration"></a>
|
|
66
|
+
## Further Exploration
|
|
67
|
+
|
|
68
|
+
The [credentials subsystem](../../../docs/subsystems/credentials.md) owns storage APIs; the [architecture](../../../docs/architecture.md) explains application composition.
|
|
69
|
+
|
|
70
|
+
The attemptTimeoutMs limit includes initialization, browser waiting, and exchange. Initialization does not extend its absolute deadline; the server TTL may only shorten the remaining time. Credential persistence admitted before expiry completes without cancellation.
|
|
71
|
+
|
|
72
|
+
<a id="model-experience"></a>
|
|
73
|
+
## Model Experience
|
|
74
|
+
|
|
75
|
+
None, as account credentials affect HTTP authentication and never enter model prompts, Session logs, or tool results.
|
|
76
|
+
|
|
77
|
+
#### KV Cache effect
|
|
78
|
+
|
|
79
|
+
No model request prefix changes.
|
|
80
|
+
|
|
81
|
+
## Known Limitations and Deferred Work
|
|
82
|
+
|
|
83
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
84
|
+
|
|
85
|
+
- Browser sign-in requires the Host webServer. Only local access and SSH local forwarding through HTTP localhost, 127.0.0.1, or [::1] with an explicit port are supported; non-loopback reverse proxies are unsupported. Account tokens have no expiry or refresh flow; explicit DSH sign-out removes the local grant before calling POST /auth-api/v0/users/logout in the background. Remote failures never restore local login. The captured old token receives at most five additional attempts with exponential delays of 1, 2, 4, 8, and 16 seconds by default; logoutMaxRetries (0–5) and logoutRetryDelayMs configure that policy. Each request uses requestTimeoutMs. Provider shutdown aborts requests and waits, and pending revocations are not persisted. Local credential deletion failures remain visible to the caller. Authorization-attempt deadlines still apply before a token is issued. Cancellation or timeout after initialization sends one background POST /auth-api/v0/dsh/auth_cancel with the authorize_id from auth_init.biz_data and the original code_verifier, without account authorization. Local cancellation never waits for this request or reverses on failure; requestTimeoutMs bounds it, and provider shutdown aborts it. TODO(product-error-ui): Product must define localized copy and UI behavior for the supplied biz_code values. Until then, business failures use the existing generic retry message; other codes and HTTP errors use the same fallback. Development grants never authenticate production requests.
|
|
86
|
+
|
|
87
|
+
<a id="dev-note"></a>
|
|
88
|
+
### Dev Note
|
|
89
|
+
|
|
90
|
+
The [desktop login decision](../../../.agents/notes/implemented/architecture/2026-09-14-deepseek-account-login.md) records cancellation and storage ownership.
|
|
91
|
+
|
|
92
|
+
The first profile read after sign-in uses the sanitized user returned by auth_exchange. A null or malformed user falls back to current; subsequent refreshes and Host restarts also query current. Failed current requests retain the latest successful profile for the same credential in Host memory; credential changes and disposal clear it. Exchange registers the submitted device information.
|
|
93
|
+
|
|
94
|
+
accountRequestHeaders overlays requestHeaders for current, balance and embedded Platform page/API requests. Cookie pairs merge by name so routing overrides retain other deployment cookies. Authorization initialization, exchange, cancellation and logout keep requestHeaders. Both maps remain private to Host and Electron main; renderer bootstrap receives only origin and token.
|
|
95
|
+
|
|
96
|
+
The account provider’s `embeddedPageDist` configuration adds a `dist` query parameter to embedded Usage and Top-up URLs. Its default is empty; private frontend branch selectors belong in the local profile patch. It does not change API URLs or credential delivery.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "通过系统浏览器登录,并将账号凭证保存在现有本地凭证存储中。本地取消会阻止迟到的回调和兑换响应使用户登录。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-deepseek-account-platform
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
新申请将调用方的界面语言映射为平台的 en_US 或 zh_CN;进行中的申请保留发起时的语言。
|
|
11
|
+
|
|
12
|
+
getPlatformSession 仅在已存授权的 issuer 与 platformOrigin 一致时导出该授权。这个仅限 Host 的操作支持原生 Platform 内嵌,不扩大 resolveToken 配置的模型及文件请求来源。
|
|
13
|
+
|
|
14
|
+
`desktopPlatform` 默认为 `null`。Desktop profile 提供 `darwin` 或 `win32`,使 Host 的授权、资料、余额和退登请求携带 `x-client-platform: desktop-mac` 或 `desktop-win`,覆盖部署配置中的同名请求头。内嵌 Platform 的文档与 API 请求仅向配置来源发送相同的平台请求头,同时保留其他部署请求头;其他 profile 不自动添加平台请求头。
|
|
15
|
+
|
|
16
|
+
## 概述
|
|
17
|
+
|
|
18
|
+
通过系统浏览器登录,并将账号凭证保存在现有本地凭证存储中。本地取消会阻止迟到的回调和兑换响应使用户登录。
|
|
19
|
+
|
|
20
|
+
## 目录
|
|
21
|
+
|
|
22
|
+
- [使用此包](#use-this-package)
|
|
23
|
+
- [模型体验](#model-experience)
|
|
24
|
+
- [已知限制与后续工作](#known-limitations-and-deferred-work)
|
|
25
|
+
|
|
26
|
+
<a id="use-this-package"></a>
|
|
27
|
+
## 使用此包
|
|
28
|
+
|
|
29
|
+
账号资料投影将 `id_profile.picture` 映射为 `avatarUrl`,没有配置头像时返回 null。
|
|
30
|
+
|
|
31
|
+
getProfile / getBalance 将保存的授权 token 通过 x-dsh-auth-token 请求头,向 platformOrigin 上的 GET /auth-api/v0/users/current 和 GET /api/v0/users/get_user_summary 发起请求。授权签发来源必须与该来源一致。Host 只投影账号 UID、资料名称、头像 URL、由 Platform 脱敏的手机号或邮箱(原样保留),以及 normal_wallets / bonus_wallets 的币种和余额字符串,丢弃响应 token 与其他字段。赠送钱包不计入充值余额。凭证变化和销毁会使进行中的查询失效。
|
|
32
|
+
|
|
33
|
+
在插件行配置 platformOrigin、allowLoopbackHttp、requestTimeoutMs 和 attemptTimeoutMs。HTTP 仅用于显式启用的本机开发。提供者先在现有 Host webServer 注册 /oauth/callback,再调用 auth_init;校验 state、使用 S256 PKCE 授权码兑换一次,并在跳转 auth_exchange.biz_data.authorized_url 前提交授权记录。浏览器地址默认要求匹配配置的平台来源,并始终要求固定的 /dsh/authorize 或 /dsh/authorized 路径。完成页地址将 `login_source` 设为发起登录的客户端类型(`web` 或 `desktop`),并保留平台返回的其他查询参数。设备标识是独立的随机 UUID 记录,由使用同一凭证存储的进程共享;device_model 报告操作系统和架构。
|
|
34
|
+
|
|
35
|
+
开放平台 URL 统一由 `platformOrigin` 配置管理。授权请求、浏览器地址校验、完成跳转、用量和充值入口都使用该来源。将配置放在私有的 `$DSH_HOME/cordis.patch.yml`,部署地址不进入源码仓库。默认要求 HTTPS;只有本机 HTTP 可通过 `allowLoopbackHttp: true` 显式启用。模型及文件 token 的目标由独立的 `inferenceOrigin` 配置管理。
|
|
36
|
+
|
|
37
|
+
`requestHeaders` 为 `platformOrigin` 上的授权、资料、余额和退登请求添加仅 Host 使用的请求头。请求头值属于敏感配置,不包含在账号 UI 状态中。Authorization、X-DSH-Auth-Token、Host、Content-Type 及连接和消息分帧请求头由提供者保留。重定向会失败,不会转发请求头。开发环境 Cookie 应保存在私有配置或环境变量中;不会自动收集浏览器 Cookie。
|
|
38
|
+
|
|
39
|
+
私有 patch 也可通过 Cordis 表达式读取环境变量:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
- id: deepseek-account
|
|
43
|
+
config:
|
|
44
|
+
platformOrigin: !!js process.env.DSH_PLATFORM_ORIGIN
|
|
45
|
+
allowLoopbackHttp: !!js process.env.DSH_PLATFORM_ALLOW_LOOPBACK_HTTP === '1'
|
|
46
|
+
requestHeaders: !!js |
|
|
47
|
+
process.env.DSH_PLATFORM_COOKIE ? { Cookie: process.env.DSH_PLATFORM_COOKIE } : {}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
已鉴权客户端提供浏览器可访问的回调来源(含 SSH 本地转发端口)和 UI 类型。提供者固定回调路径,并在初始化与兑换时使用同一个 redirect_uri。回调请求使用 state 和 PKCE 校验,不要求 RPC 鉴权。完成、取消和卸载仅移除本次尝试的路由。兑换失败发布 failed 状态,不自动重试:Web 关闭授权标签页,原标签页显示失败弹窗;回调页尝试自行关闭,并提供手动关闭提示。Desktop 收到 HTTP 204,并通过账号状态流聚焦现有登录界面。
|
|
51
|
+
|
|
52
|
+
Host 诊断通过标准输出及 Host 调试器 Console 输出,前缀为 `[deepseek-account]`。日志包含接口路径、HTTP 状态、数值响应码、失败阶段、校验失败的字段路径、实际类型和校验码,以及浏览器 URL 拒绝规则,不包含请求头、请求和响应正文、授权 URL 或原始异常。
|
|
53
|
+
|
|
54
|
+
`rewriteBrowserOrigin` 默认为 `false`,要求浏览器地址同源。私有开发 patch 可设为 `true`,将授权页和完成页地址映射到 `platformOrigin`,保留固定路径和查询字符串。原地址必须使用 HTTPS 或已匹配配置来源;仍拒绝用户名密码、片段和非预期路径。发布的 profile 保持严格同源校验。
|
|
55
|
+
|
|
56
|
+
inferenceOrigin 默认为 `https://api.deepseek.com`。私有部署 patch 可将其替换为一个精确的 HTTP(S) 来源(含端口),让推理及文件请求通过 x-dsh-auth-token 认证。配置不得包含路径、URL 凭证、查询或片段。其他来源要求授权由配置的 platformOrigin 签发;仍拒绝 Mock token。本机授权不能认证官方生产 API。部署地址保存在私有 patch 中,不随默认配置发布。
|
|
57
|
+
|
|
58
|
+
提供者初始化时,若有效的已存授权 issuer 与 platformOrigin 不同,会在使用方读取账号状态前删除该本地授权,以未登录态继续启动,不发送远端退登请求;API Key 和设备标识保留。存储错误仍明确报错,账号 HTTP 或响应校验失败不会删除来源匹配的授权。
|
|
59
|
+
|
|
60
|
+
<a id="understand-the-implementation"></a>
|
|
61
|
+
## 理解实现
|
|
62
|
+
|
|
63
|
+
不发布运行时 invariant:账号是否存在直接读取凭证存储,尝试状态直接投影私有状态;不存在可与另一个独立索引比较的账号索引。异步取消和提交由行为测试验证。
|
|
64
|
+
|
|
65
|
+
<a id="further-exploration"></a>
|
|
66
|
+
## 深入探索
|
|
67
|
+
|
|
68
|
+
[凭证子系统](../../../docs/subsystems/credentials.zh.md)定义存储接口;[架构](../../../docs/architecture.zh.md)说明应用组合。
|
|
69
|
+
|
|
70
|
+
attemptTimeoutMs 包含初始化、等待浏览器和兑换的耗时。初始化不会延长绝对截止时间;服务端 TTL 只能缩短剩余时间。在到期前已获准的凭证持久化不再取消。
|
|
71
|
+
|
|
72
|
+
<a id="model-experience"></a>
|
|
73
|
+
## 模型体验
|
|
74
|
+
|
|
75
|
+
无,因为账号凭证只影响 HTTP 认证,不进入模型提示、Session 日志或工具结果。
|
|
76
|
+
|
|
77
|
+
#### KV Cache effect
|
|
78
|
+
|
|
79
|
+
不改变模型请求前缀。
|
|
80
|
+
|
|
81
|
+
## 已知限制与后续工作
|
|
82
|
+
|
|
83
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
84
|
+
|
|
85
|
+
- 浏览器登录需要 Host webServer,仅支持通过带显式端口的 HTTP localhost、127.0.0.1 或 [::1] 本机访问及 SSH 本地转发,不支持非本机域名的反向代理。账号 token 没有过期或刷新流程;用户主动在 DSH 退出登录时,先删除本地授权,再在后台调用 POST /auth-api/v0/users/logout。远程失败不会恢复本地登录态。默认仅针对捕获的旧 token 最多额外重试五次,指数退避间隔为 1、2、4、8、16 秒;logoutMaxRetries(0–5)和 logoutRetryDelayMs 可配置该策略。每次请求使用 requestTimeoutMs。提供者关闭时取消请求和等待,不持久化待撤销任务。本地凭证删除失败仍向调用者报错。签发 token 前的授权尝试仍有有效期。初始化后的取消或超时会在后台发送一次 POST /auth-api/v0/dsh/auth_cancel,携带 auth_init.biz_data 中的 authorize_id 和原始 code_verifier,不附带账号授权。本地取消不等待该请求,也不会因失败而恢复;requestTimeoutMs 限制请求时间,提供者关闭时中止请求。TODO(product-error-ui):产品需定义已给定 biz code 的本地化文案和交互表现。在此之前,业务失败沿用现有“操作失败,请重试”兜底;其他 code 和 HTTP 错误也使用该兜底。开发授权不能认证生产请求。
|
|
86
|
+
|
|
87
|
+
<a id="dev-note"></a>
|
|
88
|
+
### 开发备注
|
|
89
|
+
|
|
90
|
+
[桌面登录决策](../../../.agents/notes/implemented/architecture/2026-09-14-deepseek-account-login.zh.md)记录取消和存储的职责。
|
|
91
|
+
|
|
92
|
+
登录后首次读取资料使用 auth_exchange 返回并经筛选的 user。user 为 null 或格式无效时回退到 current;后续刷新及 Host 重启也查询 current。current 请求失败时保留 Host 内存中同一凭证最近一次成功的资料;凭证变更或提供者销毁时清空。exchange 负责登记提交的设备信息。
|
|
93
|
+
|
|
94
|
+
accountRequestHeaders 覆盖 requestHeaders,供 current、余额以及内嵌 Platform 页面/API 请求使用。Cookie 按名称合并,路由覆盖保留其他部署 Cookie。授权初始化、兑换、取消和退登保持使用 requestHeaders。两组请求头仅供 Host 和 Electron 主进程使用;渲染层 bootstrap 仅接收 origin 和 token。
|
|
95
|
+
|
|
96
|
+
账号提供者的 `embeddedPageDist` 配置为内嵌用量和充值页面 URL 添加 `dist` 查询参数。默认值为空;私有前端分支选择值应写在本地 profile patch 中。此配置不改变 API 地址或凭证传递方式。
|