@young1lin/dsh-gpt-sub 0.1.1 → 0.1.3

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 CHANGED
@@ -3,6 +3,32 @@
3
3
  记录用户可感知的变化;格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。
4
4
  版本号见 `package.json`。
5
5
 
6
+ ## [0.1.3] - 2026-10-08
7
+
8
+ ### 新增
9
+
10
+ - Codex 设置面板接入 DSH 中英文语言服务,按钮、提示、倒计时、文件浏览、确认与重置结果跟随语言切换;有效期按所选语言格式化。
11
+
12
+ ### 调整
13
+
14
+ - 设置导航统一命名为「Codex」,使用跟随主题的 Codex 图标替代默认齿轮,插件卸载时还原宿主图标。
15
+ - 改善重置条目的标题和状态/有效期排版,避免操作按钮挤压换行,并适配窄面板布局。
16
+ - 重置次数列表改为点击懒加载:打开/重开面板、切换语言、后台轮询与普通配额刷新不查询列表;首次点击「查询重置次数」后才读取,后续仅显式刷新或确认使用后更新。
17
+
18
+ ### 修复
19
+
20
+ - 保留使用重置次数后的结果提示,避免随列表刷新立即清空;已显示的提示可随语言更新。
21
+
22
+ ## [0.1.2] - 2026-10-05
23
+
24
+ ### 新增
25
+
26
+ - 接管 `openai-codex` 路由的自动压力、上下文溢出及手动 `/compact` 压缩,使用所选模型的 Codex 原生 `compaction_trigger` 协议。
27
+ - 将加密 checkpoint 持久化到 Session,支持恢复、后续对话和连续压缩;原生请求失败时保留原历史,其他提供方继续使用 DSH basic 压缩。
28
+ - 增加原生请求超时、响应大小和保留用户消息预算配置。原生压缩需要宿主 `dsh-llm-pi-ai` 提供 `llm-pi-ai/stream` 扩展;缺失时 `openai-codex` 自动回退 DSH basic 压缩,其余功能不受影响。已压缩的 Session 必须使用同一模型。
29
+ - 增加本地 Web profile 的压缩后端包映射,使现有预设加载原生后端;普通 `dsh web` 启动使用本地构建。
30
+ - 开发依赖改为 registry 版本(DSH `0.2.1-alpha.1` 系列),CI 无需本地 Harness 源码检出即可安装、构建、测试与发布。
31
+
6
32
  ## [0.1.1] - 2026-10-01
7
33
 
8
34
  ### 修复
package/README.md CHANGED
@@ -4,15 +4,7 @@ Direct ChatGPT/Codex subscription access for DeepSeek Harness (DSH).
4
4
 
5
5
  Published on npm as **`@young1lin/dsh-gpt-sub`** (public, MIT).
6
6
 
7
- This plugin owns no transport. pi-ai already ships an `openai-codex` provider
8
- that speaks the Codex wire format — it sets `store`, derives
9
- `chatgpt-account-id` from the access token's own JWT claim, and speaks the
10
- codex-responses protocol — but it authenticates only through OAuth, and
11
- `dsh-llm-pi-ai` runs no login flow and holds no OAuth store. Naming a
12
- credential on the route grafts an api-key method beside the provider's own,
13
- and that credential is the seam this plugin fills: it keeps a live Codex
14
- access token in the harness credential store, refreshing it from
15
- `~/.codex/auth.json` before it expires.
7
+ The plugin refreshes the Codex CLI subscription token, routes Codex egress, and uses Codex native context compaction for the `openai-codex` provider. Normal conversation requests use pi-ai; native encrypted checkpoints are stored in the Session and restored into subsequent Responses requests.
16
8
 
17
9
  The result needs no loopback port, no shared local key, and no external proxy
18
10
  binary. The `codex` CLI still owns the login.
@@ -40,7 +32,7 @@ into the profile and mounts the bundled `cordis.patch.yml` automatically — no
40
32
  manual yml editing:
41
33
 
42
34
  ```powershell
43
- # Prereqs: Node ≥ 22.13 (the pnpm-managed toolchain needs 22.13+), dsh 0.2.0-rc.2 or compatible 0.2.x (required by this release's DSH peers),
35
+ # Prereqs: Node ≥ 22.19, DSH 0.2.1-alpha.1 with the llm-pi-ai/stream extension,
44
36
  # pnpm on PATH (corepack enable or npm i -g pnpm)
45
37
  dsh plugin --profile web add @young1lin/dsh-gpt-sub
46
38
  dsh web # restart the host (the host half is module code)
@@ -67,13 +59,15 @@ into the profile and list it in `dsh.profile.bundles`:
67
59
 
68
60
  The bundle ships its own `cordis.patch.yml` with two rows:
69
61
 
70
- - an **insert** for the `gpt-sub` plugin itself (token sync, proxy routing, quota panel), and
62
+ - an **insert** for the `gpt-sub` plugin itself (token sync, proxy routing, quota panel),
71
63
  - an **edit** (no `insert:`) of the dormant `llm-pi-ai` row `@deepseek-ai/dsh-base` mounts,
72
- seeding the provider route:
64
+ seeding the provider route.
65
+
66
+ The token plugin's configuration is:
73
67
 
74
68
  ```yaml
75
- - id: llm-pi-ai
76
- name: '@deepseek-ai/dsh-llm-pi-ai'
69
+ - id: gpt-sub
70
+ name: '@young1lin/dsh-gpt-sub'
77
71
  config:
78
72
  proxyUrl: http://127.0.0.1:7890
79
73
  authFile: ~/.codex/auth.json
@@ -144,6 +138,19 @@ provider knows the Codex backend itself.
144
138
  | `syncIntervalMinutes` | `10` | How often to re-read auth.json and republish the token. |
145
139
  | `bootstrapRetries` | `3` | Connection-level retries per request when the link to the proxy drops. |
146
140
  | `stateFile` | `~/.dsh/gpt-sub.json` | Persisted panel overrides (`proxyUrl`, `authFile`); a field present in the file wins over the config's. |
141
+ | `nativeCompactionTimeoutMs` | `300000` | Maximum duration of one native compaction request. |
142
+ | `nativeRetainTokens` | `64000` | Estimated token budget for recent user messages retained beside the encrypted checkpoint; `0` retains none. |
143
+ | `nativeResponseMaxBytes` | `16777216` | Maximum streamed compaction response bytes. |
144
+
145
+ ## Native context compaction
146
+
147
+ Select `@young1lin/dsh-gpt-sub/compaction` as the backend inside the existing preset's compaction group. This backend uses native compaction for Codex Subscription (`openai-codex`) models, including Luna. Automatic pressure, context overflow, and `/compact` send the actual selected model's full balanced history, current instructions, and tools to the Codex Responses endpoint with a final `compaction_trigger` input item. The backend requires one encrypted `compaction` output item and a completed response; an upstream rejection or cancellation preserves the existing history and reports the failure without switching to text summarization.
148
+
149
+ The Session stores a replacement message containing the retained user items, opaque checkpoint, exact provider/model identity, and token count. Subsequent requests expand that replacement into native Responses input, including after restoration and before a second compaction. Ciphertext length does not determine automatic compaction pressure. Other providers use DSH basic compaction and its existing configuration.
150
+
151
+ Native compaction activates only when the host's `dsh-llm-pi-ai` provides the `llm-pi-ai/stream` extension. On adapters without it the plugin loads normally, `openai-codex` keeps DSH basic compaction, and every other feature is unchanged — no companion checkout required. After a native checkpoint is created, keep the same provider and model in that Session; start a new Session to switch models. Keep the plugin enabled when resuming these Sessions.
152
+
153
+ For a local trial, build the plugin with `pnpm install`, `pnpm run typecheck`, `pnpm test`, and `pnpm run build`. Link the plugin, companion adapter, and `local/compaction-provider` into the Web profile as described in `LOCAL-TRIAL.md`; ordinary `dsh web` then loads these builds in existing presets. The local provider alias re-exports basic compaction's named API and selects the native backend as its default plugin. Cordis patch `name` fields assert existing module names and cannot rename them. Choose either configured Luna model, let a conversation grow, and run `/compact`. A successful request logs `Codex native compaction (<selected-model>)`; send another message to exercise encrypted-context replay.
147
154
 
148
155
  ## Why `bootstrapRetries` exists
149
156
 
@@ -185,13 +192,29 @@ provider route never reads a stale token.
185
192
 
186
193
  ## Settings panel diagnostics
187
194
 
188
- The `Codex 配额` settings section does more than render the usage bars. It shows
195
+ The **Codex** section follows the language selected in Settings →
196
+ General (English or Chinese), using DSH's locale service like `dsh-mcp-adapter`.
197
+ Buttons, placeholders, countdowns, file browsing, confirmations, and existing
198
+ action feedback follow locale updates. While the panel remains mounted, a
199
+ locale update preserves an edited path or proxy URL; navigating to another
200
+ settings section unmounts the panel and discards unsaved edits.
201
+ Credit expiration dates use the selected language too; upstream diagnostic
202
+ messages, file paths, and account-provided titles remain unchanged.
203
+
204
+ The navigation row uses the [Codex mark from Lobe Icons](https://unpkg.com/@lobehub/icons-static-svg@1.95.1/icons/codex.svg)
205
+ (MIT, attribution included in [the client bundle](client.js)), not the shell's
206
+ default gear. Its monochrome SVG follows the theme and is restored on plugin
207
+ unload. Since the settings shell currently has no public icon slot, this uses
208
+ the same narrowly scoped, disposable DOM adaptation as `dsh-mcp-adapter`.
209
+ If a future shell changes its markup, the icon adaptation safely does nothing.
210
+
211
+ The section does more than render the usage bars. It shows
189
212
  one bar per rate-limit window the account reports — the 5-hour rolling window
190
213
  and the weekly window — each drawn Codex-style as the percent **remaining**: a
191
214
  full bar at 100% that drains toward 0% as the allowance is spent, with its own
192
- reset countdown. The countdown is exact, not rounded to one unit: `4h22m后重置`,
193
- `10m22s后重置` under an hour (seconds only appear there, where they still change
194
- fast enough to read), `2d5h后重置` past a day, and a zero component is dropped
215
+ reset countdown. The countdown is exact, not rounded to one unit: `Resets in 4h22m`
216
+ (or `4小时22分后重置` in Chinese), `10m22s` under an hour (seconds only appear there,
217
+ where they still change fast enough to read), `2d5h` past a day, and a zero component is dropped
195
218
  rather than padded — `4h`, never `4h0m`. An account with no 5-hour limit (pro
196
219
  accounts currently report only a weekly window) shows a note where that bar
197
220
  would be, so the absence reads as a fact about the plan rather than a broken
@@ -222,6 +245,13 @@ a capped window without waiting out its timer. Below the bars the panel shows:
222
245
  means direct. The line under the input notes whether the current value comes
223
246
  from cordis config or a page override.
224
247
 
248
+ Reset credit details are lazy-loaded: opening/reopening the panel, switching
249
+ languages, and background quota/status polling do not query the credit list.
250
+ Click **Check reset credits / 查询重置次数** for the first read; after that, only
251
+ the credit list's **Refresh / 刷新** button or a confirmed consumption refreshes
252
+ it. The header badge simply reuses the ordinary quota response, with no extra
253
+ credit-list request.
254
+
225
255
  Rate-limit reset credits (the codex CLI's `rate-limit-reset-credits` wham API): `GET /gpt-sub/reset-credits` lists the account's redeemable credits, `POST /gpt-sub/reset-credits/consume` (body `{ "creditId": "..." }`, optional) consumes one. The host mints a fresh `redeem_request_id` per click, and the panel asks for confirmation first because consuming is destructive.
226
256
 
227
257
  Host endpoints behind the panel: `GET /gpt-sub/quota` (the bars), `GET /gpt-sub/status`,