dsh-coding-subscription-oauth 0.6.3 → 0.6.5

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/CONTRIBUTING.md +13 -4
  3. package/INSTALL.md +7 -5
  4. package/README.de.md +6 -6
  5. package/README.es.md +6 -6
  6. package/README.fr.md +6 -6
  7. package/README.ja.md +6 -6
  8. package/README.ko.md +6 -6
  9. package/README.md +6 -6
  10. package/README.pt-BR.md +6 -6
  11. package/README.ru.md +6 -6
  12. package/README.zh-CN.md +6 -6
  13. package/docs/00-project-rules.md +4 -4
  14. package/docs/02-architecture.md +7 -3
  15. package/docs/02-architecture.zh-CN.md +7 -3
  16. package/lib/bin.js +1333 -569
  17. package/lib/bin.js.map +4 -4
  18. package/lib/client.js +1 -1
  19. package/lib/client.js.map +2 -2
  20. package/lib/gateway-protocol.d.ts +3 -46
  21. package/lib/gateway-protocol.d.ts.map +1 -1
  22. package/lib/gateway-routes.d.ts.map +1 -1
  23. package/lib/grok-errors.d.ts +2 -12
  24. package/lib/grok-errors.d.ts.map +1 -1
  25. package/lib/grok-imagine/client.d.ts +73 -0
  26. package/lib/grok-imagine/client.d.ts.map +1 -0
  27. package/lib/grok-imagine/index.d.ts +8 -0
  28. package/lib/grok-imagine/index.d.ts.map +1 -0
  29. package/lib/grok-imagine/net.d.ts +10 -0
  30. package/lib/grok-imagine/net.d.ts.map +1 -0
  31. package/lib/grok-imagine/parse.d.ts +20 -0
  32. package/lib/grok-imagine/parse.d.ts.map +1 -0
  33. package/lib/grok-imagine/types.d.ts +191 -0
  34. package/lib/grok-imagine/types.d.ts.map +1 -0
  35. package/lib/grok-imagine.d.ts +3 -263
  36. package/lib/grok-imagine.d.ts.map +1 -1
  37. package/lib/http-json.d.ts +2 -9
  38. package/lib/http-json.d.ts.map +1 -1
  39. package/lib/index.js +1395 -26178
  40. package/lib/index.js.map +4 -4
  41. package/lib/kimi-errors.d.ts +2 -12
  42. package/lib/kimi-errors.d.ts.map +1 -1
  43. package/lib/runtime/gateway-protocol.d.ts +47 -0
  44. package/lib/runtime/gateway-protocol.d.ts.map +1 -0
  45. package/lib/runtime/grok-errors.d.ts +13 -0
  46. package/lib/runtime/grok-errors.d.ts.map +1 -0
  47. package/lib/runtime/http-json.d.ts +10 -0
  48. package/lib/runtime/http-json.d.ts.map +1 -0
  49. package/lib/runtime/kimi-errors.d.ts +13 -0
  50. package/lib/runtime/kimi-errors.d.ts.map +1 -0
  51. package/package.json +12 -7
  52. package/scripts/release.mjs +1 -0
  53. package/src/adapter.ts +0 -348
  54. package/src/alias-adapter.ts +0 -147
  55. package/src/auth-routes.ts +0 -921
  56. package/src/auth.ts +0 -67
  57. package/src/bin.ts +0 -350
  58. package/src/capability-routes.ts +0 -279
  59. package/src/capability-runtime.ts +0 -314
  60. package/src/capability-settings.ts +0 -671
  61. package/src/capability-tools.ts +0 -685
  62. package/src/catalog.ts +0 -271
  63. package/src/client/GrokBuildSettings.tsx +0 -771
  64. package/src/client/api.ts +0 -88
  65. package/src/client/components/AboutTab.tsx +0 -30
  66. package/src/client/components/AccountsTab.tsx +0 -241
  67. package/src/client/components/Badge.tsx +0 -33
  68. package/src/client/components/CapabilitiesTab.tsx +0 -265
  69. package/src/client/components/CliPullPreview.tsx +0 -116
  70. package/src/client/components/CopyButton.tsx +0 -57
  71. package/src/client/components/GatewayTab.tsx +0 -469
  72. package/src/client/components/NoticeBanner.tsx +0 -46
  73. package/src/client/components/ProgressBar.tsx +0 -53
  74. package/src/client/components/ProviderCard.tsx +0 -606
  75. package/src/client/components/SettingsTabs.tsx +0 -75
  76. package/src/client/components/ToggleSwitch.tsx +0 -71
  77. package/src/client/constants.ts +0 -230
  78. package/src/client/display.ts +0 -61
  79. package/src/client/dshClientAdapter.ts +0 -127
  80. package/src/client/gatewaySnippets.ts +0 -37
  81. package/src/client/index.tsx +0 -156
  82. package/src/client/locales.ts +0 -540
  83. package/src/client/microStyles.ts +0 -52
  84. package/src/client/parsers.ts +0 -398
  85. package/src/client/styles.ts +0 -325
  86. package/src/client/types.ts +0 -199
  87. package/src/codex-http.ts +0 -447
  88. package/src/codex-images.ts +0 -503
  89. package/src/codex-model-capabilities.ts +0 -320
  90. package/src/codex-search.ts +0 -245
  91. package/src/codex-usage.ts +0 -263
  92. package/src/compatibility.ts +0 -55
  93. package/src/dsh-host-adapter.ts +0 -173
  94. package/src/gateway-anthropic-messages.ts +0 -84
  95. package/src/gateway-auth.ts +0 -102
  96. package/src/gateway-backend.ts +0 -274
  97. package/src/gateway-body.ts +0 -49
  98. package/src/gateway-config.ts +0 -76
  99. package/src/gateway-http.ts +0 -104
  100. package/src/gateway-openai-chat.ts +0 -124
  101. package/src/gateway-openai-responses.ts +0 -53
  102. package/src/gateway-parse.ts +0 -224
  103. package/src/gateway-protocol.ts +0 -52
  104. package/src/gateway-routes.ts +0 -158
  105. package/src/gateway.ts +0 -258
  106. package/src/grok-errors.ts +0 -24
  107. package/src/grok-imagine.ts +0 -1627
  108. package/src/grok-import.ts +0 -151
  109. package/src/http-json.ts +0 -82
  110. package/src/ids.ts +0 -59
  111. package/src/imagine-routes.ts +0 -463
  112. package/src/index.ts +0 -735
  113. package/src/invariant.ts +0 -17
  114. package/src/kimi-errors.ts +0 -26
  115. package/src/media-store.ts +0 -927
  116. package/src/oauth-import-routes.ts +0 -324
  117. package/src/oauth-providers.ts +0 -152
  118. package/src/oauth-session.ts +0 -183
  119. package/src/oauth-sources.ts +0 -1104
  120. package/src/oauth.ts +0 -620
  121. package/src/provider.ts +0 -128
  122. package/src/proxy.ts +0 -11
  123. package/src/redact.ts +0 -72
  124. package/src/session.ts +0 -218
  125. package/src/store.ts +0 -217
  126. package/src/web-origin.ts +0 -296
  127. package/src/web-routes.ts +0 -38
package/README.zh-CN.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # 🔐 dsh-coding-subscription-oauth
6
6
 
7
- **v0.6.3** · 原名 `dsh-grok-build`
7
+ **v0.6.5** · 原名 `dsh-grok-build`
8
8
 
9
9
  **面向 [DeepSeek Harness](https://github.com/deepseek-ai/dsh) 的编码订阅 OAuth 插件。** 把 SuperGrok / X Premium(Grok Build)、ChatGPT Plus/Pro(Codex)、Kimi Code、Claude Pro/Max 和 Google Antigravity 接到 DSH——不必再开一份按量 API-key,**也不要把 token 粘贴进聊天。**
10
10
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  ---
19
19
 
20
- > **升级:** 按 [`INSTALL.md`](INSTALL.md) 的版本化步骤操作。`0.6.3` 包含严格 Cordis 注入启动修复并正式支持 DSH `0.1.1-rc.2`;保留 profile、配置和凭据文件,更新后再重启一次现有 DSH Web 进程。`dsh-coding-oauth-core@0.1.0` 仍是共享 npm 依赖,不是需要单独安装的 DSH 插件。
20
+ > **升级:** 按 [`INSTALL.md`](INSTALL.md) 的版本化步骤操作。`0.6.5` 继续将共享 dispatcher runtime 固定为 `dsh-coding-oauth-core@0.1.1` 与 `undici@7.29.0`,并将 Gateway key 的 reveal/rotate 限制为 loopback 访问;无需迁移配置、凭据、数据或路由。Grok Imagine 保留显式 pinned dispatcher。`0.6.2` 及之后版本已包含严格 Cordis 注入启动修复并正式支持 DSH `0.1.1-rc.2`;保留 profile、配置和凭据文件,更新后再重启一次现有 DSH Web 进程。
21
21
 
22
22
  ---
23
23
 
@@ -27,7 +27,7 @@
27
27
 
28
28
  | | 请用这个 | 仍然可用 |
29
29
  |---|---|---|
30
- | npm(推荐) | 当前版本是 `0.6.3`:`dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3` | 没有发布过旧 npm 包 |
30
+ | npm(推荐) | 当前版本是 `0.6.5`:`dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.5` | 没有发布过旧 npm 包 |
31
31
  | GitHub / 开发安装 | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | 旧仓库 `dsh-grok-build` 已删除 |
32
32
  | CLI | `dsh-coding-oauth` | `dsh-grok-build` |
33
33
  | Cordis 插件 id | `llm-grok-build-oauth` | 不变 |
@@ -79,7 +79,7 @@
79
79
 
80
80
  ```bash
81
81
  # 1. 安装当前 npm 发布版到 web profile
82
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3
82
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.5
83
83
 
84
84
  # 2. 可选 —— Google Antigravity(固定审核过的版本)
85
85
  dsh plugin --profile web add dsh-agy@0.1.2
@@ -120,7 +120,7 @@ dsh plugin --profile web add dsh-agy@0.1.2
120
120
 
121
121
  ```bash
122
122
  # 当前 npm 版本
123
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3
123
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.5
124
124
 
125
125
  # 开发 / 备用:从 GitHub 安装
126
126
  dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
@@ -182,7 +182,7 @@ DSH 主机在远端时优先使用设备码。浏览器/PKCE 登录会打开供
182
182
 
183
183
  ## 可选能力
184
184
 
185
- 八项开关默认全部**关闭**,打开后**立即生效**(无需重启):`codexSearch`、`codexImages`、`codexImageEdits`、`codexImagesAnyModel`、`codexUsage`、`codexFast`、`grokImagineImage`、`grokImagineVideo`。数值控制为 `searchResults`(1–20,默认 5)、`imageCount`(1–4,默认 1)、`videoArtifactTtlMs`(1 小时–7 天,默认 7 天;界面以 1–168 小时显示)。降低视频保留时间会立即缩短并清理已有产物;提高只影响之后生成的产物。管理员也可在插件配置的 `capabilities` 下提供不含秘密的 composition 默认值;`coding-subscription-oauth` 设置区中的用户值会覆盖这层 base,省略时所有开关仍保持关闭。
185
+ 八项开关默认全部**关闭**,打开后**立即生效**(无需重启):`codexSearch`、`codexImages`、`codexImageEdits`、`codexImagesAnyModel`、`codexUsage`、`codexFast`、`grokImagineImage`、`grokImagineVideo`。`codexImagesAnyModel` 仅放宽调用模型路由限制;仍要求已登录 Codex、开启 `codexImages`(编辑还需 edits 开关),并保留当前会话附件归属和编辑授权检查。数值控制为 `searchResults`(1–20,默认 5)、`imageCount`(1–4,默认 1)、`videoArtifactTtlMs`(1 小时–7 天,默认 7 天;界面以 1–168 小时显示)。降低视频保留时间会立即缩短并清理已有产物;提高只影响之后生成的产物。管理员也可在插件配置的 `capabilities` 下提供不含秘密的 composition 默认值;`coding-subscription-oauth` 设置区中的用户值会覆盖这层 base,省略时所有开关仍保持关闭。
186
186
 
187
187
  `codex-oauth-fast` 仅在**最新一次 live catalog** 标明至少有一个 `priority` 可用模型后才会出现。请求会发送 `service_tier: priority` 和路由提示。界面写的是 **已请求 Fast**,不保证延迟,也不保证上游会兑现。
188
188
 
@@ -98,7 +98,7 @@ CHANGELOG.md updated (entry added under the matching release)
98
98
  README.md synced (new capability / new doc entry / new command / new notes)
99
99
 
100
100
 
101
- pnpm run check passes in the Docker sandbox
101
+ pnpm run check passes (Cursor Cloud / isolated checkout; Docker optional)
102
102
 
103
103
 
104
104
  version bumped (package.json + built artifact metadata, see §4)
@@ -143,7 +143,7 @@ node scripts/release.mjs --pack
143
143
 
144
144
  For every release candidate, the assistant must proactively hand the maintainer an exact PowerShell command before any registry write. The handoff must name the verified candidate `.tgz`, include its expected SHA-256, use the public npm registry, and include a post-publish `npm view` check. The assistant must not run `npm publish`, `npm login`, or copy npm credentials.
145
145
 
146
- The maintainer runs the handoff command, reports the resulting published version and `latest` dist-tag, and only then does the assistant continue with registry verification, PR merge, annotated tag/GitHub Release work, and issue evidence replies. A failed or ambiguous publish keeps the release and issues open. The exact release gate still requires a clean tree, successful Docker verification, a maintainer decision, and explicit maintainer release approval; publishing an unverified or dirty candidate is prohibited.
146
+ The maintainer runs the handoff command, reports the resulting published version and `latest` dist-tag, and only then does the assistant continue with registry verification, PR merge, annotated tag/GitHub Release work, and issue evidence replies. A failed or ambiguous publish keeps the release and issues open. The exact release gate still requires a clean tree, successful `pnpm run check` (Cursor Cloud / isolated `DSH_HOME` primary; Docker optional), a maintainer decision, and explicit maintainer release approval; publishing an unverified or dirty candidate is prohibited.
147
147
 
148
148
  The standard handoff shape is:
149
149
 
@@ -193,8 +193,8 @@ Contributor-facing wording lives in `CONTRIBUTING.md`. This section is the sourc
193
193
 
194
194
  - Messages follow [Conventional Commits](https://www.conventionalcommits.org/): `type(optional-scope): summary` in the imperative (`feat:`, `fix:`, `docs:`, `test:`, `refactor:`, `build:`, `ci:`, `chore:`). Optional scopes such as `M1` / `M3` or a module name are fine.
195
195
  - **One coherent concern per commit.** Never mix documentation, build/toolchain and feature/fix changes unless they cannot be reviewed or built separately (a capability that is meaningless without its README/changelog note, or a source change that must ship with the `lib/` it generated).
196
- - Build the tracked Dockerfile's `check` and `verify` targets before the commit. Do not install dependencies, typecheck, lint, test, build, or pack this plugin directly on a shared developer host. The build context is filtered by `.dockerignore`; dependencies download in their own stage, while all project-code `RUN` steps use `--network=none`. Never use privileged mode, credential mounts, the Docker socket, or host-directory bind mounts. Host networking is prohibited except for the narrow, explicitly authorized preview fallback below. Commit that passing slice promptly — do not leave a finished, verified change sitting uncommitted next to later work, and do not commit a red tree.
197
- - **Host DSH boundary:** unless the maintainer explicitly requests it for the current operation, never install into, modify, stop, restart, or run validation against a DSH instance already installed on the shared host. Development checks and interactive Web previews use a dedicated Docker DSH instance with an isolated home/profile. A preview may publish an explicitly selected high host port on `0.0.0.0` for remote review, must not reuse the host DSH port or state directories, and must remain resource-limited and individually removable. Host networking is prohibited by default; it is allowed only after ordinary Docker port publishing has been proven unavailable and the maintainer explicitly authorizes that specific run. An authorized host-network preview must bind only pre-checked high ports, keep its DSH backend on a separate loopback high port, and never bind or probe the host DSH port.
196
+ - Run `pnpm run check` on Node matching `.nvmrc` before the commit (Cursor Cloud or an isolated checkout is the primary path). Do not install dependencies, typecheck, lint, test, build, or pack this plugin against a shared operator DSH profile. Docker `check` / `verify` targets remain optional for CI and hermetic reproduction: the build context is filtered by `.dockerignore`; dependencies download in their own stage, while all project-code `RUN` steps use `--network=none`. Never use privileged mode, credential mounts, the Docker socket, or host-directory bind mounts. Host networking is prohibited except for the narrow, explicitly authorized preview fallback below. Commit that passing slice promptly — do not leave a finished, verified change sitting uncommitted next to later work, and do not commit a red tree.
197
+ - **Host DSH boundary:** unless the maintainer explicitly requests it for the current operation, never install into, modify, stop, restart, or run validation against a DSH instance already installed on the shared host. Development checks and interactive Web previews use an isolated `DSH_HOME` (for example `$HOME/.dsh-cloud` or `/tmp/dsh-verify-*`) or a dedicated Docker DSH instance never the operator's real profile. A Docker preview may publish an explicitly selected high host port on `0.0.0.0` for remote review, must not reuse the host DSH port or state directories, and must remain resource-limited and individually removable. Host networking is prohibited by default; it is allowed only after ordinary Docker port publishing has been proven unavailable and the maintainer explicitly authorizes that specific run. An authorized host-network preview must bind only pre-checked high ports, keep its DSH backend on a separate loopback high port, and never bind or probe the host DSH port.
198
198
  - Generated `lib/` is a committed release artifact (git installs and the CI `git diff --exit-code -- lib` drift gate). Rebuild it and include it in the **same** commit as the `src/` or build-script change that produced it. Do not land stale `lib/` against newer source, and do not land a `lib/`-only commit unless the only change is a verified rebuild with no source delta.
199
199
  - Secrets, credentials, tokens, private keys, `.env` files, host aliases, absolute machine paths, and local-only notes (`docs/local/`, `reference/`) never enter git (§0.3).
200
200
 
@@ -61,7 +61,7 @@ ctx.llm route
61
61
  - `oauth-sources.ts`: allowlisted official Grok/Codex/Kimi/Claude CLI discovery; hardened lstat/`O_NOFOLLOW`/owner/mode/regular-file/size reads; one-use preview tickets (five minutes, max 32); never writes official CLI files.
62
62
  - `oauth-import-routes.ts`: same-origin Pull HTTP API (discover → preview → commit/cancel) into the destination store lock.
63
63
  - `alias-adapter.ts`: translates Harness routes, does not modify pi-ai `model.provider`, and runs a credential gate before `listModels()`; unauthenticated or unreadable credentials return an empty catalog, and the provider group name is `(OAuth)`. On an AUTH finish it invalidates the stored token so the harness retry can refresh first. The finish pipeline also remaps Kimi misclassified AUTH context overflow and xAI capacity wording → `RATE_LIMIT`.
64
- - `grok-errors.ts`: detects xAI “at capacity / high demand / priority processing / overloaded” messages and rewrites them to `RATE_LIMIT` so they are not skipped as `PI_AI_ERROR`.
64
+ - `grok-errors.ts` / `src/runtime/grok-errors.ts`: detects xAI “at capacity / high demand / priority processing / overloaded” messages and rewrites them to `RATE_LIMIT` so they are not skipped as `PI_AI_ERROR`.
65
65
  - `adapter.ts`: composes Grok with the three subscription profiles; asks pi-ai for a 60 s remaining-validity floor and registers a retry policy that includes AUTH plus transient codes (default 5 retries, 5 s → 80 s stacked exponential). Optionally wraps `codex-oauth-fast` as **Fast requested**.
66
66
  - `auth-routes.ts`: legacy Grok API + the unified `/plugins/dsh-grok-build/oauth/*`; JSON writes use a 64 KiB bounded reader and return 400/413 for malformed/oversized bodies.
67
67
  - `capability-settings.ts`: default-off live flags and limits (search 1–20, image count 1–4, artifact TTL 1 h–7 d).
@@ -122,7 +122,7 @@ This project does not replicate the private Google Antigravity protocol. The pro
122
122
 
123
123
  ## 6. Compatibility
124
124
 
125
- The canonical package and repository name is **`dsh-coding-subscription-oauth`**. The previous GitHub URL still resolves to the same `main`, so old `dsh plugin add github:lninghaha/dsh-grok-build` commands continue to install the renamed package. The first public npm/GitHub Release was **`0.4.1`**. The current release is **`0.6.3`** (`dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3`), verified against DSH **`0.1.1-rc.2`**. GitHub and local tarball installs remain valid.
125
+ The canonical package and repository name is **`dsh-coding-subscription-oauth`**. The previous GitHub URL still resolves to the same `main`, so old `dsh plugin add github:lninghaha/dsh-grok-build` commands continue to install the renamed package. The first public npm/GitHub Release was **`0.4.1`**. The current release is **`0.6.5`** (`dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.5`), verified against DSH **`0.1.1-rc.2`**. GitHub and local tarball installs remain valid.
126
126
 
127
127
  Stable on-disk / in-process identifiers (do not rename without a migration):
128
128
 
@@ -135,4 +135,8 @@ Stable on-disk / in-process identifiers (do not rename without a migration):
135
135
 
136
136
  New routes use the `*-oauth` alias and do not occupy `openai`, `xai` or `kimi-coding`. In v0.3.0 the `grok-build` fallback/default advances to `grok-4.6`; saved user defaults still win.
137
137
 
138
- Hub and this standalone participant pin the same `dsh-coding-oauth-core@0.1.0`. The core owns root-scoped owner election, reference-counted proxy policy, atomic registration helpers, provider/route/credential identifiers, the capability namespace, Gateway state filename, and all legacy/current management paths. Hub has priority while installed; this participant remains standby and resumes without renaming routes or resetting credentials after Hub unloads.
138
+ Hub and this standalone participant pin the same `dsh-coding-oauth-core@0.1.1` and `undici@7.29.0`. The core owns root-scoped owner election, reference-counted proxy policy, atomic registration helpers, provider/route/credential identifiers, the capability namespace, Gateway state filename, and all legacy/current management paths. Hub has priority while installed; this participant remains standby and resumes without renaming routes or resetting credentials after Hub unloads. Grok Imagine keeps its explicit pinned dispatcher and does not use the shared proxy lease.
139
+
140
+ ### Shared runtime extract (first slice)
141
+
142
+ Hub’s vendored core already carries four pure helpers that were previously duplicated here: `http-json`, `grok-errors`, `kimi-errors`, and `gateway-protocol`. Until the next **published** `dsh-coding-oauth-core` release absorbs that slice, this package keeps a byte-identical local mirror under `vendor/runtime-slice/` (with build copies in `src/runtime/` and thin facades at the historical `src/*.ts` paths). `pnpm run assert:runtime-slice` checks `vendor/runtime-slice` ↔ `src/runtime` ↔ `SYNC_HASHES.json`, and also compares live Hub `vendor/dsh-coding-oauth-core/src` when a Hub checkout is available. After that core release ships, Subscription will drop the local mirror and import the helpers from npm core directly.
@@ -61,7 +61,7 @@ ctx.llm route
61
61
  - `oauth-sources.ts`:白名单官方 Grok/Codex/Kimi/Claude CLI 发现;加固的 lstat/`O_NOFOLLOW`/属主/权限/普通文件/大小读取;一次性预览票据(五分钟、最多 32 张);从不写入官方 CLI 文件。
62
62
  - `oauth-import-routes.ts`:同源拉取 HTTP API(发现 → 预览 → 提交/取消),写入发生在目标 store 锁内。
63
63
  - `alias-adapter.ts`:转换 Harness route、不修改 pi-ai model.provider,并在 `listModels()` 前执行 credential gate;未认证或凭据读取失败返回空目录,provider group 名使用 `(OAuth)`。AUTH finish 时作废本地令牌,让 harness 重试先刷新。finish 管道还会重映射 Kimi 误标 AUTH 的上下文溢出,以及 xAI capacity 文案 → `RATE_LIMIT`。
64
- - `grok-errors.ts`:识别 xAI「at capacity / high demand / priority processing / overloaded」并改为 `RATE_LIMIT`,避免 `PI_AI_ERROR` 跳过退避。
64
+ - `grok-errors.ts` / `src/runtime/grok-errors.ts`:识别 xAI「at capacity / high demand / priority processing / overloaded」并改为 `RATE_LIMIT`,避免 `PI_AI_ERROR` 跳过退避。
65
65
  - `adapter.ts`:组合 Grok 与三个 subscription profile;向 pi-ai 要求至少 60 秒剩余有效期,并注册包含 AUTH 与瞬时故障码的 retryPolicy(默认 5 次,5 s → 80 s 指数叠加)。可选包装 `codex-oauth-fast`,显示为 **已请求 Fast**。
66
66
  - `auth-routes.ts`:旧 Grok API + 新统一 `/plugins/dsh-grok-build/oauth/*`;JSON 写请求使用 64 KiB 有界读取器,无效/超限 body 分别返回 400/413。
67
67
  - `capability-settings.ts`:默认关闭、立即生效的开关与限制(搜索 1–20、图像 1–4、产物 TTL 1 小时–7 天)。
@@ -122,7 +122,7 @@ POST /plugins/dsh-grok-build/gateway/rotate
122
122
 
123
123
  ## 6. 兼容性
124
124
 
125
- 正式包名与仓库名是 **`dsh-coding-subscription-oauth`**。旧 GitHub 地址仍指向同一条 `main`,因此旧的 `dsh plugin add github:lninghaha/dsh-grok-build` 仍会安装更名后的包。第一次公开 npm / GitHub Release 是 **`0.4.1`**。当前版本是 **`0.6.3`**(`dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3`),精确验证 DSH **`0.1.1-rc.2`**。GitHub 与本地 tarball 安装仍然有效。
125
+ 正式包名与仓库名是 **`dsh-coding-subscription-oauth`**。旧 GitHub 地址仍指向同一条 `main`,因此旧的 `dsh plugin add github:lninghaha/dsh-grok-build` 仍会安装更名后的包。第一次公开 npm / GitHub Release 是 **`0.4.1`**。当前版本是 **`0.6.5`**(`dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.5`),精确验证 DSH **`0.1.1-rc.2`**。GitHub 与本地 tarball 安装仍然有效。
126
126
 
127
127
  以下标识保持稳定(无迁移方案前不要改名):
128
128
 
@@ -135,4 +135,8 @@ POST /plugins/dsh-grok-build/gateway/rotate
135
135
 
136
136
  新 route 使用 `*-oauth` alias,不占用 `openai`、`xai`、`kimi-coding`。v0.3.0 将 `grok-build` fallback/default 更新为 `grok-4.6`,已有用户默认设置仍优先。
137
137
 
138
- Hub 与本独立 participant 精确依赖同一个 `dsh-coding-oauth-core@0.1.0`。核心统一管理 root-scoped owner 选举、引用计数代理策略、原子注册、provider/route/credential 标识、能力设置命名空间、Gateway 状态文件名,以及全部新旧管理路径。Hub 安装时优先成为 owner;Hub 卸载后本插件从 standby 自动接管,不改路由名,也不重置凭据。
138
+ Hub 与本独立 participant 精确依赖同一个 `dsh-coding-oauth-core@0.1.1` 与 `undici@7.29.0`。核心统一管理 root-scoped owner 选举、引用计数代理策略、原子注册、provider/route/credential 标识、能力设置命名空间、Gateway 状态文件名,以及全部新旧管理路径。Hub 安装时优先成为 owner;Hub 卸载后本插件从 standby 自动接管,不改路由名,也不重置凭据。Grok Imagine 保留显式 pinned dispatcher,不使用共享 proxy lease。
139
+
140
+ ### 共享运行时抽取(第一刀)
141
+
142
+ Hub 的 vendored core 已收录此前两边重复的四个纯辅助模块:`http-json`、`grok-errors`、`kimi-errors`、`gateway-protocol`。在下一版**已发布**的 `dsh-coding-oauth-core` 吸收该切片之前,本包在 `vendor/runtime-slice/` 保留字节级镜像(构建副本在 `src/runtime/`,历史路径 `src/*.ts` 为薄 re-export)。`pnpm run assert:runtime-slice` 会校验 `vendor/runtime-slice` ↔ `src/runtime` ↔ `SYNC_HASHES.json`;若本机有 Hub 检出则再与 Hub 的 `vendor/dsh-coding-oauth-core/src` 比对。该 core 发版后,Subscription 将删除本地镜像并直接从 npm core 导入。