Merge pull request #5106 from deepseek-harness/fix/account-balance-timeout
fix(account): extend balance request timeout to 30 seconds
This commit is contained in:
commit
7e97c458ba
5 files changed
+6
-6
No files matched your search
@@ -15,8 +15,8 @@
|
||||
en: af856ba79fe31b8e
|
||||
zh: 15b7d1a5d1856de2
|
||||
/deepseek-ai-dsh-deepseek-account-platform/use-this-package:
|
||||
en: 631facc2455a31a3
|
||||
zh: 365a16f72f65f9a1
|
||||
en: ec9bb416eec2dcae
|
||||
zh: 15b9c498388be972
|
||||
/deepseek-ai-dsh-deepseek-account-platform/understand-the-implementation:
|
||||
en: 0a829b20071a01d4
|
||||
zh: 83f54ac08f3609f2
|
||||
|
||||
@@ -36,7 +36,7 @@ getProfile / getBalance sends the stored grant in the x-dsh-auth-token header to
|
||||
|
||||
getUnnotifiedBonuses reads GET /api/v0/users/get_unnotified_bonuses and ackBonusNotified posts POST /api/v0/users/ack_bonus_notified with a JSON body naming the order on the same origin, each sending the five client headers built from the caller's metadata. Both resolve the account identity for the captured grant first, so a signed-out or switched account yields null or false instead of acknowledging another account's bonus, and a read publishes only after the whole query settled under one credential lifetime. The Host forwards the bonus list in Platform order, maps each msg to message, and discards nothing else; malformed payloads, other HTTP failures and other business failures throw, while a credential rejection (HTTP 401 or response code `40003`) invalidates the current grant and yields null or false.
|
||||
|
||||
Balance requests use balanceTimeoutMs (2,000ms by default); timeout returns a failed outcome without clearing the account or manufacturing a zero balance. Configure platformOrigin, allowLoopbackHttp, requestTimeoutMs, balanceTimeoutMs, 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.
|
||||
Balance requests use balanceTimeoutMs (30,000ms by default); timeout returns a failed outcome without clearing the account or manufacturing a zero balance. Configure platformOrigin, allowLoopbackHttp, requestTimeoutMs, balanceTimeoutMs, 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.
|
||||
|
||||
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,7 +36,7 @@ getProfile / getBalance 将保存的授权 token 通过 x-dsh-auth-token 请求
|
||||
|
||||
getUnnotifiedBonuses 读取同一来源上的 GET /api/v0/users/get_unnotified_bonuses,ackBonusNotified 向 POST /api/v0/users/ack_bonus_notified 发送仅含订单号的 JSON 正文,两者都按调用方元数据组装这五个客户端请求头。二者都先为捕获到的授权解析账号身份,因此退登或切号时返回 null 或 false,而不会确认另一个账号的赠金;一次读取只有在同一凭证生命周期内全部结算后才发布。Host 按 Platform 返回顺序转发赠金列表,把每条的 msg 映射为 message,其余字段不额外丢弃;格式错误、其他 HTTP 失败和其他业务失败都会抛出,而凭据被拒绝(HTTP 401 或响应码 `40003`)会使当前授权失效并返回 null 或 false。
|
||||
|
||||
余额请求使用 balanceTimeoutMs(默认 2,000ms);超时返回失败结果,不清除账号,也不制造零余额。在插件行配置 platformOrigin、allowLoopbackHttp、requestTimeoutMs、balanceTimeoutMs 和 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 报告操作系统和架构。
|
||||
余额请求使用 balanceTimeoutMs(默认 30,000ms);超时返回失败结果,不清除账号,也不制造零余额。在插件行配置 platformOrigin、allowLoopbackHttp、requestTimeoutMs、balanceTimeoutMs 和 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 报告操作系统和架构。
|
||||
|
||||
开放平台 URL 统一由 `platformOrigin` 配置管理。授权请求、浏览器地址校验、完成跳转、用量和充值入口都使用该来源。将配置放在私有的 `$DSH_HOME/cordis.patch.yml`,部署地址不进入源码仓库。默认要求 HTTPS;只有本机 HTTP 可通过 `allowLoopbackHttp: true` 显式启用。模型及文件 token 的目标由独立的 `inferenceOrigin` 配置管理。
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export const Config = Schema.object({
|
||||
requestHeaders: Schema.dict(Schema.string().role('secret')).default({}),
|
||||
accountRequestHeaders: Schema.dict(Schema.string().role('secret')).default({}),
|
||||
requestTimeoutMs: Schema.number().min(1).max(120_000).default(30_000),
|
||||
balanceTimeoutMs: Schema.number().min(1).max(120_000).default(2_000),
|
||||
balanceTimeoutMs: Schema.number().min(1).max(120_000).default(30_000),
|
||||
logoutMaxRetries: Schema.number().min(0).max(5).step(1).default(5),
|
||||
logoutRetryDelayMs: Schema.number().min(1).max(60_000).default(1_000),
|
||||
attemptTimeoutMs: Schema.number().min(1).max(3_600_000).default(600_000),
|
||||
|
||||
@@ -34,7 +34,7 @@ async function fixture(
|
||||
beforeAccount?: (ctx: Context, origin: string) => Promise<void>,
|
||||
embeddedPageDist = '',
|
||||
desktopPlatform: 'darwin' | 'win32' | null = null,
|
||||
balanceTimeoutMs = 2_000,
|
||||
balanceTimeoutMs = 30_000,
|
||||
) {
|
||||
const home = await mkdtemp(join(tmpdir(), 'dsh-account-'))
|
||||
cleanups.push(() => rm(home, { recursive: true, force: true }))
|
||||
|
||||
Reference in new issue
Block a user