dsh-lcx-codex 0.4.0 → 0.4.1-pre.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1-pre.1 - Candidate QA pending / not published
4
+
5
+ - Integrates the accepted Alpha stateful continuation and fail-closed capability work from #20, #21, and #22.
6
+ - Includes accepted compatibility seam isolation (#24), typed protocol-core hardening (#25), unified conservative token budgeting (#26), and the installed-plugin settings lifecycle fix (#36).
7
+ - This is an unpublished candidate for #19 installed-candidate and cross-feature QA; no npm publication, tag, or release is implied.
8
+
3
9
  ## 0.4.0 - 2026-08-23
4
10
 
5
11
  ### Stable promotion
package/README.md CHANGED
@@ -1,211 +1,170 @@
1
1
  <div align="center">
2
2
 
3
- <img src="https://raw.githubusercontent.com/kk3ya03-star/dsh-lcx-codex/main/assets/dsh-lcx-codex-banner.jpg" alt="DSH-LCX-CODEX" width="100%" />
4
-
5
- # DSH-LCX-CODEX
6
-
7
- **给 DeepSeek Harness 补上 GPT Responses / Codex 原生能力。**
3
+ <img src="assets/dsh-lcx-codex-banner.png" alt="dsh-lcx-codex — 为 DSH 增加 GPT Hosted Search、Codex 风格网页操作与 Native V2 Compaction" width="100%" />
8
4
 
9
5
  [![npm](https://img.shields.io/npm/v/dsh-lcx-codex?color=1677ff&label=npm)](https://www.npmjs.com/package/dsh-lcx-codex)
10
- ![Node](https://img.shields.io/badge/Node-%3E%3D20-1677ff)
6
+ [![CI](https://github.com/kk3ya03-star/dsh-lcx-codex/actions/workflows/publish.yml/badge.svg)](https://github.com/kk3ya03-star/dsh-lcx-codex/actions/workflows/publish.yml)
11
7
  ![DSH](https://img.shields.io/badge/DSH-0.1.1--rc.2-4ea8ff)
12
- ![License](https://img.shields.io/badge/license-MIT-1677ff)
8
+ ![Node](https://img.shields.io/badge/Node-%3E%3D20-2f855a)
9
+ ![License](https://img.shields.io/badge/license-MIT-6b7280)
13
10
 
14
- **简体中文** · [English](README_EN.md)
11
+ **简体中文** · [English](README_EN.md) · [Architecture](ARCHITECTURE.md) · [Changelog](CHANGELOG.md)
15
12
 
16
13
  </div>
17
14
 
18
- ---
19
-
20
- `dsh-lcx-codex` 是一个社区维护的 DSH 插件,面向已经通过 `llm-pi-ai / openai-responses` 接入的 GPT 路由。它尽量复用 DSH 自己的 Agent、Web、Session 和 Compaction 架构,只在缺少 OpenAI/Codex 原生语义的地方补能力。
15
+ > **DSH 仍然是 host。LCX 只补齐 GPT Responses 路径缺失的原生能力,不修改 DSH 核心,也不替换 Agent / Session / Web / Compaction。**
21
16
 
22
- > `LCX` 只是项目名称。本项目不隶属于 OpenAI、DeepSeek、Sub2API 或 NewAPI。
17
+ ## 它解决什么
23
18
 
24
- - **最新版 DSH 图片管线**:Native V2 直接复用 `readImageRequest()` 和当前路由图片预算,避免压缩请求与普通 GPT 请求使用不同的图片版本。
19
+ 如果你的 DSH 已经有一个可工作的 GPT `openai-responses` route,`dsh-lcx-codex` 让这条 route 更完整地使用 GPT Responses 原生能力,同时尽量保持 DSH 原有入口和生命周期不变。
25
20
 
26
- ## 核心能力
21
+ | 场景 | DSH 原有入口 | LCX 增强后 |
22
+ |---|---|---|
23
+ | 普通联网搜索 | DSH `web_search` | **仍然使用同一个 `web_search`**,由 LCX SearchProvider 映射到当前 GPT Hosted Search |
24
+ | Hosted Search 高级参数 | 普通搜索入口保持简洁 | 按需增加 `websearch_gpt_advanced`,提供域名过滤、近似位置、search context、图片搜索等 |
25
+ | 连续网页 / PDF 浏览 | DSH 继续拥有 Web 生命周期 | 按需增加 Codex / Alpha Web Actions:`search → open → find/click → screenshot` |
26
+ | 长会话压缩 | DSH 继续负责 pressure、事务与 recovery | 在现有 compaction seam 上优先请求 Responses Native V2 checkpoint |
27
27
 
28
- | 能力 | 说明 | 默认 |
29
- |---|---|---:|
30
- | **DSH 原生 `web_search` → GPT Hosted Search** | 不新增重复的普通搜索工具;rc.7+ 自动跟随当前 Agent 的 GPT Responses 模型 | 可开启 |
31
- | **Advanced Hosted Search** | 域名过滤、location、search context、图片搜索等 OpenAI Hosted 参数 | 关闭 |
32
- | **Alpha Search** | `search/open/find/click/screenshot` 等 Codex/Alpha 风格命令;能力探针通过后才注册 | 关闭 |
33
- | **Native Remote Compaction V2** | 通过 Responses `compaction_trigger` 获取 provider-native opaque checkpoint | 可开启 |
34
- | **Conversation fidelity retention** | 显式保留 bounded user / assistant 可见事实,避免只记得“问过什么”却忘记“答了什么” | 内置 |
35
- | **Session-native checkpoint** | checkpoint 存在 DSH append-only session log,不再以 sidecar 作为新会话真相源 | 内置 |
36
- | **Native-first 自动压缩** | 90% 主动 Native V2,95% emergency 才允许 DSH prune;阈值可调 | 可开启 |
37
- | **长搜索超时** | DSH `web_search` 外层 timeout 默认提升到 240 秒,可调 30–600 秒 | 内置 |
28
+ **目标不是再造一套 Agent,而是让 DSH GPT route 用上它本来就应该拥有的原生能力。**
38
29
 
39
- ## rc.8:面向 DSH 0.1.1-rc.2
30
+ ## 三大能力
40
31
 
41
- rc.8 直接面向 **DSH 0.1.1-rc.2**。普通 `web_search` 继续跟随当前 Agent 模型,同时 Native V2 的图片输入改用新版 DSH `readImageRequest()` 管线,不再直接读取 attachment master bytes。
32
+ ### 1. GPT Hosted Search:普通搜索不换入口
42
33
 
43
- 搜索路由仍通过 **DSH `tools/execute` SearchProvider** 运行时上下文传递:
44
-
45
- ```text
46
- Agent: lcx / gpt-5.6-luna
47
-
48
- └─ DSH web_search
49
-
50
- └─ Hosted Search: lcx / gpt-5.6-luna
51
-
52
- Agent: lcx / gpt-5.6-sol
53
-
54
- └─ DSH web_search
55
-
56
- └─ Hosted Search: lcx / gpt-5.6-sol
57
- ```
34
+ 启用后,模型看到的普通搜索工具依然是 DSH 原生 `web_search`。LCX 替换的是 SearchProvider 路径,而不是再注册一个重复的“普通搜索”工具。
58
35
 
59
- 这不会修改模型看到的 `web_search` schema。
36
+ 需要更细控制时,再单独启用 `websearch_gpt_advanced`。
60
37
 
61
- 没有 Agent 上下文时,才使用设置页里的 **回退 Responses 地址 / 回退 GPT 模型**。
38
+ ### 2. Codex 风格 Web Actions:需要时再打开
62
39
 
63
- ### Search 与会话缓存隔离
64
-
65
- Hosted Search 是一笔独立 Responses 请求,不等于主会话推理。rc.8 继续给搜索使用独立 cache namespace:
40
+ `websearch_alpha` 面向连续浏览和结构化 Web action:
66
41
 
67
42
  ```text
68
- 主会话 replay: dsh-lcx:<route hash>
69
- Hosted Search: dsh-lcx-search:<route hash>
43
+ search open → find / click → screenshot
70
44
  ```
71
45
 
72
- 因此搜索不会故意与 Native replay 共用同一个 `prompt_cache_key`。NewAPI 后台仍可能看到搜索请求夹在主会话请求之间;它们是不同请求,搜索行本身 cache 较低并不代表 DSH session 被截断。
73
-
74
- ## Native V2 Compaction
46
+ 它默认关闭,并且只有当前 endpoint / provider / model / schema 通过 capability probe 后才注册。未知部署采用 **fail-closed**,不会被误报成“支持 Alpha”。
75
47
 
76
- DSH 本身已经负责:
48
+ ### 3. Native V2 Compaction:保留 DSH 会话语义
77
49
 
78
- - token pressure
79
- - compactable range selection;
80
- - tool-result pruning;
81
- - durable session transaction;
82
- - `/compact`;
83
- - context-overflow recovery。
50
+ LCX 不创建第二套 compaction engine。DSH 仍然拥有 pressure、compactable range、`/compact`、durable session transaction、tool-result pruning 与 overflow recoveryLCX 只在已有 compaction LLM seam 上请求 Responses Native V2。
84
51
 
85
- 本插件不再造第二套 compaction engine,而是在 DSH 的 `purpose: 'compaction'` LLM seam 上执行 Native V2:
52
+ 默认自动策略:
86
53
 
87
54
  ```text
88
- DSH compaction transaction
89
-
90
- └─ purpose=compaction
91
-
92
- └─ POST /responses
93
- x-codex-beta-features: remote_compaction_v2
94
- input: [...history, { type: "compaction_trigger" }]
55
+ 0% ─────────────────── 90% ───── 95% ───── 100%
56
+ normal Native emergency hard cap
57
+ V2 DSH prune
95
58
  ```
96
59
 
97
- Native 成功:不再额外运行 basic summary
98
-
99
- Native 失败且开启 fallback:才回到 DSH basic compaction。
100
-
101
- ## 为什么压缩后还能记住模型自己说过的话
60
+ - **90%**:优先尝试 Native V2
61
+ - **95%**:才允许 emergency DSH prune。
62
+ - provider-confirmed context overflow:继续使用 DSH 原有恢复逻辑。
63
+ - 手动 `/compact`:继续使用 DSH 原生会话事务。
102
64
 
103
- 单纯依赖 provider-native opaque compaction 是有损的。真实长会话测试发现,低显著性的 assistant-only 事实可能被压掉,例如:
65
+ 同一 source session 可以继续复用自己的 Native checkpoint;fork 或模型迁移不会跨 session 发送 parent 的 opaque state,而是走 portable migration;重启后从 DSH session log 恢复。
104
66
 
105
- - 模型随机生成的项目代号;
106
- - 搜索后模型给出的具体姓名;
107
- - 只在 assistant 最终回答里出现的数字。
67
+ ## 30 秒开始使用
108
68
 
109
- 因此当前 checkpoint 使用:
69
+ ### 1. 安装
110
70
 
111
- ```text
112
- bounded client-visible history
113
- + bounded assistant-visible answers
114
- + opaque Native V2 compaction item
71
+ ```powershell
72
+ dsh plugin --profile web add dsh-lcx-codex
73
+ dsh web
115
74
  ```
116
75
 
117
- 默认总 explicit retention 预算约 `64k` estimated tokens,其中 assistant-visible answer 最多预留约 `24k`,单条默认最多约 `3k`。不把 reasoning、巨大 tool result、完整搜索正文和运行 telemetry 全塞回来。
76
+ ### 2. DSH Settings 启用
118
77
 
119
- 目标不是“逐字无损”,而是:**删过程,保事实。**
78
+ 第一次使用建议从最小配置开始:
120
79
 
121
- ## 自动压缩策略
80
+ | 设置 | 建议 |
81
+ |---|---:|
82
+ | Enable plugin | **On** |
83
+ | Use GPT Hosted Search | 需要 GPT Hosted Search 时 **On** |
84
+ | Advanced Hosted Search | **Off**,需要高级参数再开 |
85
+ | Alpha Search | **Off**,确认当前 route 支持后再开 |
86
+ | Native V2 remote compaction | 上游实际支持 Native V2 时 **On** |
87
+ | Native-first auto compaction | 使用 Native V2 时 **On** |
122
88
 
123
- rc.8 延续 rc.6 的 Native-first pressure policy:
89
+ **前提条件**
124
90
 
125
- ```text
126
- 0% ─────────────────── 90% ───── 95% ───── 100%
127
- 正常使用 Native emergency hard cap
128
- V2 DSH prune
129
- ```
91
+ - Node.js `>=20`
92
+ - DSH 中已有可工作的 GPT `openai-responses` route
93
+ - 上游 endpoint 实际支持你准备启用的 Hosted Search / Native V2 / Alpha 能力
130
94
 
131
- 默认:
95
+ ### 3. 确认它真的生效
132
96
 
133
- - `< 90%`:不让 DSH 原来的 80% pressure prune 提前改写历史;
134
- - `90%–95%`:优先 Native V2;
135
- - `>= 95%`:允许 DSH replay-safe tool-result pruner 救场;
136
- - provider 明确返回 context overflow:仍保留 DSH 原生 recovery;
137
- - 手动 `/compact`:不受阈值影响。
97
+ 不要只看开关是否打开,按能力检查实际行为:
138
98
 
139
- 阈值可在插件设置页调整。
99
+ | 能力 | 应看到什么 |
100
+ |---|---|
101
+ | GPT Hosted Search | 普通工具入口仍是 DSH `web_search`,实际请求走当前 GPT Responses route |
102
+ | Advanced Hosted | 启用后出现 `websearch_gpt_advanced`,高级参数可以单独控制 |
103
+ | Alpha Web Actions | 只有 capability probe 通过时才出现 `websearch_alpha` |
104
+ | Native V2 | compact 时出现 provider-native checkpoint 路径;普通 Basic Compaction 不会被伪装成 Native V2 成功 |
140
105
 
141
- ## 关于“缓存突然断了”
106
+ ## 搜索工具怎么选
142
107
 
143
- 需要区分两件事:
108
+ 三个入口用途不同,**不需要全部开启**:
144
109
 
145
- ```text
146
- cacheRead = 0
147
-
148
- 会话历史被删除
149
- ```
110
+ | 你要做什么 | 使用入口 | 适合场景 |
111
+ |---|---|---|
112
+ | 普通联网搜索 | DSH `web_search` | 找资料、查网页、一般检索 |
113
+ | 控制 Hosted Search 参数 | `websearch_gpt_advanced` | 域名 allow/block、近似位置、search context、图片搜索等 |
114
+ | 连续浏览网页或 PDF | `websearch_alpha` | `search/open/find/click/screenshot` 与结构化 Web actions |
150
115
 
151
- 在真实 NewAPI 日志里,出现过:
116
+ ## 它如何接入 DSH
152
117
 
153
118
  ```text
154
- 某轮:155k uncached / cacheRead 0
155
- 下一轮:~1k new input / ~155k cacheRead
119
+ DSH Agent / Session / Web
120
+ ├─ web_search ──────────> LCX SearchProvider ──> GPT Hosted Search
121
+ ├─ Advanced / Alpha ────> LCX Web tools ───────> GPT Web actions
122
+ └─ compact / replay ────> LCX Native bridge ───> Responses Native V2
156
123
  ```
157
124
 
158
- 这说明上一轮只是 provider prompt-cache miss / eviction,完整上下文仍被重新发送,并没有发生 session compaction surface replacement。
125
+ **DSH host,LCX 是兼容扩展层。** 插件优先复用当前 DSH route `baseURL`、credential reference、headers、模型与 retry policy,而不是维护第二套账号配置。
159
126
 
160
- 真正会主动改变历史前缀的主要情况是:
127
+ checkpoint、canonical replay、Pi serializer、cache identity、fork safety 与 pressure coordination 等实现细节见 [ARCHITECTURE.md](ARCHITECTURE.md)。
161
128
 
162
- 1. `/compact` / 自动 Native compaction;
163
- 2. emergency tool-result pruning;
164
- 3. 换模型 / provider / baseURL;
165
- 4. DSH 自己发生其他 surface replacement。
129
+ ## 兼容性
166
130
 
167
- DSH 重启、长时间 idle、上游 cache TTL/eviction 也可能造成某一轮重新建 cache;插件无法保证第三方网关永不 evict KV cache。
131
+ 当前正式验证组合:
168
132
 
169
- ## 搜索分层
133
+ | Plugin | DSH | DSH host Pi | Plugin Pi | 状态 |
134
+ |---|---|---|---|---|
135
+ | `0.4.0` | `0.1.1-rc.2` | `0.82.1` | `0.82.1` | **VERIFIED** |
170
136
 
171
- ### 1. 普通搜索:`web_search`
137
+ 新的 DSH 版本**不会自动视为兼容**。项目会先检查受影响的 DSH / Pi seam,再按风险运行对应测试;Pi registry 单独出现新版本也不会自动升级插件依赖。
172
138
 
173
- 推荐默认使用。rc.8 会跟随当前 Agent 的 GPT Responses route。
139
+ <details>
140
+ <summary><strong>完整推荐设置</strong></summary>
174
141
 
175
- ### 2. 高级 Hosted:`websearch_gpt_advanced`
142
+ | 设置 | 推荐值 | 说明 |
143
+ |---|---:|---|
144
+ | Enable plugin | On | 启用插件 |
145
+ | Use GPT Hosted Search | 按需 | 让 DSH `web_search` 走 GPT Hosted Search |
146
+ | Advanced Hosted Search | Off | 需要高级 Hosted 参数时再开 |
147
+ | Alpha Search | Off | capability 验证后再开 |
148
+ | Native V2 remote compaction | On* | *上游 route 实际支持 Native V2 时 |
149
+ | Native-first auto compaction | On | 启用自动 pressure 策略 |
150
+ | Native threshold | 90% | 90% 开始优先 Native V2 |
151
+ | Emergency DSH prune | 95% | 95% 才允许 emergency prune |
152
+ | `web_search` timeout | 240 s | 避免长搜索被过早终止 |
176
153
 
177
- 仅在需要这些参数时开启:
154
+ 主要配置字段:`remoteCompaction`、`autoCompaction`、`fallbackToBasicCompaction`、`autoCompactionThresholdPercent`、`emergencyPruneThresholdPercent`、`webSearchTimeoutSeconds`、`advancedHostedSearch`、`alphaSearch`。
178
155
 
179
- - allowed / blocked domains;
180
- - approximate user location;
181
- - `search_context_size`;
182
- - image search;
183
- - external web access;
184
- - return token budget。
156
+ </details>
185
157
 
186
- 开启/关闭额外工具会改变 tool catalog,因此默认关闭以保持主会话 request schema 稳定。
158
+ <details>
159
+ <summary><strong>其他安装方式</strong></summary>
187
160
 
188
- ### 3. Alpha:`websearch_alpha`
189
-
190
- 面向 stateful Codex/Alpha 风格搜索:`search/open/find/click/screenshot` 等。只有 capability probe 与当前 endpoint/provider/model/schema 匹配后才注册。
191
-
192
- ## 安装
193
-
194
- ### npm
195
-
196
- 稳定版:
197
-
198
- ```powershell
199
- dsh plugin --profile web add dsh-lcx-codex
200
- ```
201
-
202
- 预发布版(当前 rc.8):
161
+ **预发布版**
203
162
 
204
163
  ```powershell
205
164
  dsh plugin --profile web add dsh-lcx-codex@next
206
165
  ```
207
166
 
208
- ### 本地 RC
167
+ **本地 tarball**
209
168
 
210
169
  ```powershell
211
170
  dsh plugin --profile web remove dsh-lcx-codex
@@ -213,49 +172,26 @@ dsh plugin --profile web add .\dsh-lcx-codex-0.4.0.tgz
213
172
  dsh web
214
173
  ```
215
174
 
216
- 不要为了升级删除 `$DSH_HOME/storages/lcx-codex/` 或旧 session。v3 sidecar 仍作为只读旧会话兼容层。
175
+ 升级插件时,不要为了“清理”删除 DSH session 或 `$DSH_HOME/storages/lcx-codex/`。旧会话可能仍引用历史兼容数据。
217
176
 
218
- ## 推荐设置
177
+ </details>
219
178
 
220
- ```text
221
- Enable plugin ✅
222
- Use GPT Hosted Search ✅
223
- Advanced Hosted Search ❌
224
- Alpha Search ❌
225
-
226
- Native V2 remote compaction ✅
227
- Native-first auto compaction ✅
228
- Native threshold 90%
229
- Emergency DSH prune 95%
230
- web_search timeout 240s
231
- ```
179
+ <details>
180
+ <summary><strong>常见情况</strong></summary>
232
181
 
233
- 调试 Native 时可以先关闭 fallback;稳定使用时是否开启 fallback 由你决定。
182
+ **`web_search` 没走 GPT Hosted Search**
183
+ 确认插件和 Hosted Search 已启用,并且当前 Agent 能解析到兼容的 GPT `openai-responses` route。
234
184
 
235
- ## 部署要求
185
+ **`websearch_alpha` 没出现**
186
+ 这是预期的 fail-closed 行为。Alpha 必须对当前 route/schema 完成可信 capability probe 后才注册。
236
187
 
237
- - Node.js `>=20`
238
- - DSH `0.1.1-rc.2`
239
- - DSH 中已经能正常使用的 GPT `openai-responses` route
240
- - upstream 实际支持你启用的 Hosted Search / Native V2 / Alpha 能力
241
-
242
- 典型路径:
243
-
244
- ```text
245
- DSH → llm-pi-ai/openai-responses → Sub2API
246
- DSH → llm-pi-ai/openai-responses → NewAPI → upstream
247
- ```
188
+ **Native V2 没有生效**
189
+ 确认当前 GPT Responses endpoint 实际支持 `remote_compaction_v2`。插件不会把普通 Basic Compaction 假装成 Native V2 成功。
248
190
 
249
- 插件优先复用 DSH route 的 `baseURL`、credential reference、headers 和 retry policy。
191
+ </details>
250
192
 
251
- ## 发布通道
252
-
253
- - npm stable:正式稳定版本
254
- - npm `next`:`0.4.0-rc.*` 预发布测试版本
255
-
256
- GitHub tag 与 `package.json` version 必须一致;Trusted Publishing workflow 会先跑测试再发布。
257
-
258
- ## 开发
193
+ <details>
194
+ <summary><strong>开发</strong></summary>
259
195
 
260
196
  ```bash
261
197
  npm test
@@ -263,8 +199,14 @@ npm run test:schema
263
199
  npm pack --ignore-scripts
264
200
  ```
265
201
 
266
- 关键设计说明见 [ARCHITECTURE.md](ARCHITECTURE.md),完整版本记录见 [CHANGELOG.md](CHANGELOG.md)。
202
+ - 设计与协议细节:[ARCHITECTURE.md](ARCHITECTURE.md)
203
+ - 版本变化:[CHANGELOG.md](CHANGELOG.md)
204
+ - npm:[`dsh-lcx-codex`](https://www.npmjs.com/package/dsh-lcx-codex)
205
+
206
+ </details>
267
207
 
268
208
  ## License
269
209
 
270
210
  MIT
211
+
212
+ > `LCX` 只是项目名称。本项目是社区项目,不隶属于 OpenAI、DeepSeek、Sub2API 或 NewAPI。