dsh-lcx-codex 0.3.3 → 0.4.0-rc.13
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/ARCHITECTURE.md +93 -0
- package/CHANGELOG.md +143 -41
- package/README.md +208 -100
- package/README_EN.md +133 -101
- package/assets/dsh-lcx-codex-banner.jpg +0 -0
- package/cordis.patch.yml +10 -4
- package/lib/client.js +117 -194
- package/lib/compact-v2.js +124 -273
- package/lib/dsh-responses.js +299 -0
- package/lib/index.js +548 -1593
- package/lib/json-store.js +34 -0
- package/lib/legacy-v3.js +20 -0
- package/lib/native-checkpoint.js +93 -0
- package/lib/responses-replay.js +281 -0
- package/lib/route.js +222 -0
- package/lib/service-mutex.js +72 -0
- package/lib/transport.js +59 -380
- package/lib/web-run-output.js +13 -152
- package/lib/web-search-alpha.js +26 -448
- package/lib/web-search-capability.js +8 -10
- package/lib/web-search-hosted.js +22 -372
- package/lib/web-search-ref-store.js +7 -7
- package/package.json +20 -14
- package/scripts/probe-alpha.mjs +28 -76
- package/scripts/validate-dsh-schema.mjs +31 -0
- package/lib/checkpoint-store-v3.js +0 -459
- package/lib/compact.js +0 -752
- package/lib/dsh-pi-responses.js +0 -339
- package/lib/private-file.js +0 -18
- package/lib/session-lease.js +0 -70
- package/lib/web-search-store.js +0 -181
package/README_EN.md
CHANGED
|
@@ -1,162 +1,194 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
|
|
6
|
-
[](LICENSE)
|
|
5
|
+
# DSH-LCX-CODEX
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
**OpenAI Responses / Codex-native capabilities for DeepSeek Harness.**
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/dsh-lcx-codex)
|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
[简体中文](README.md) · **English**
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
</div>
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
- A NewAPI relay, meaning a third-party relay whose upstream channel connects to Sub2API.
|
|
18
|
+
---
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
flowchart LR
|
|
22
|
-
accTitle: dsh-lcx-codex architecture
|
|
23
|
-
accDescr: The plugin reuses the active DSH openai-responses model route and credential, then sends Hosted Search, capability-gated Alpha Search, and Native V2 Compact requests through a controlled transport to a direct Sub2API or NewAPI relay deployment.
|
|
20
|
+
`dsh-lcx-codex` is a community DSH plugin for GPT routes already configured through `llm-pi-ai / openai-responses`. It keeps DSH's Agent, Web, Session and Compaction ownership intact and fills the provider-native gaps.
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
> `LCX` is only the project name. This project is not affiliated with OpenAI, DeepSeek, Sub2API or NewAPI.
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
hosted_search[Hosted Search<br/>POST /responses + web_search]
|
|
29
|
-
alpha_gate{Alpha capability matches?}
|
|
30
|
-
alpha_search[Alpha Search<br/>POST /alpha/search]
|
|
31
|
-
alpha_disabled([Alpha is not registered])
|
|
32
|
-
native_compact[Native V2 Compact<br/>stream + compaction_trigger]
|
|
33
|
-
end
|
|
24
|
+
- **Current DSH image pipeline**: Native V2 reuses `readImageRequest()` and the active route image budgets, so compaction and ordinary GPT requests see the same deterministic image variants.
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
| Capability | What it does | Default |
|
|
29
|
+
|---|---|---:|
|
|
30
|
+
| **DSH `web_search` → GPT Hosted Search** | Uses DSH's existing ordinary search tool; rc.7+ follows the active Agent GPT Responses model | opt-in |
|
|
31
|
+
| **Advanced Hosted Search** | Native domain/location/context/image search controls | off |
|
|
32
|
+
| **Alpha Search** | Stateful `search/open/find/click/screenshot`-style commands, capability-gated | off |
|
|
33
|
+
| **Native Remote Compaction V2** | Uses Responses `compaction_trigger` and provider-native opaque state | opt-in |
|
|
34
|
+
| **Conversation fidelity retention** | Bounded user + assistant-visible history protects low-salience facts | built-in |
|
|
35
|
+
| **Session-native checkpoints** | Durable state lives in the DSH append-only session log | built-in |
|
|
36
|
+
| **Native-first auto compaction** | 90% Native V2, 95% emergency DSH pruning; configurable | opt-in |
|
|
37
|
+
| **Long web timeout** | DSH `web_search` deadline defaults to 240s, configurable 30–600s | built-in |
|
|
38
|
+
|
|
39
|
+
## rc.8: DSH 0.1.1-rc.2 native alignment
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
alpha_search --> transport
|
|
43
|
-
native_compact --> transport
|
|
41
|
+
rc.8 targets **DSH 0.1.1-rc.2** directly. Ordinary Hosted Search still follows the active Agent route, while Native V2 image serialization now uses DSH's `readImageRequest()` request-version pipeline instead of reading attachment master bytes.
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
deployment -->|Direct| sub2api[Sub2API]
|
|
47
|
-
deployment -->|Relay| newapi[Compatible NewAPI channel]
|
|
48
|
-
sub2api --> upstream([OpenAI Responses/Codex-compatible upstream])
|
|
49
|
-
newapi --> upstream
|
|
43
|
+
Search routing still crosses DSH's `tools/execute` → SearchProvider boundary without changing the model-visible `web_search` schema:
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
portable_migration --> transport
|
|
45
|
+
```text
|
|
46
|
+
Agent: lcx / gpt-5.6-luna
|
|
47
|
+
└─ DSH web_search
|
|
48
|
+
└─ Hosted Search: lcx / gpt-5.6-luna
|
|
56
49
|
```
|
|
57
50
|
|
|
58
|
-
|
|
51
|
+
The settings-page model is now a **fallback** used only when no active Agent route is available.
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
Hosted Search also receives its own stable cache namespace:
|
|
61
54
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
| Native V2 Compact | `/responses` with `compaction_trigger` | Stores checkpoint v3 and supports same-route replay, model migration, fork/tree sessions, restart recovery, and image attachments |
|
|
55
|
+
```text
|
|
56
|
+
conversation replay: dsh-lcx:<route hash>
|
|
57
|
+
hosted search: dsh-lcx-search:<route hash>
|
|
58
|
+
```
|
|
67
59
|
|
|
68
|
-
|
|
60
|
+
A search row with a low cache hit in NewAPI therefore does not imply conversation truncation.
|
|
69
61
|
|
|
70
|
-
##
|
|
62
|
+
## Native V2 Compaction
|
|
71
63
|
|
|
72
|
-
|
|
64
|
+
DSH continues to own pressure, range selection, pruning, durable replacement, `/compact`, and overflow recovery. The plugin replaces only the `purpose: compaction` summarizer transport with Native V2:
|
|
73
65
|
|
|
74
|
-
```
|
|
75
|
-
|
|
66
|
+
```text
|
|
67
|
+
DSH compaction transaction
|
|
68
|
+
└─ purpose=compaction
|
|
69
|
+
└─ /responses + compaction_trigger
|
|
76
70
|
```
|
|
77
71
|
|
|
78
|
-
|
|
72
|
+
Native success means zero basic-summary request. Basic summary runs only if Native fails and fallback is enabled.
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
## Conversation fidelity layer
|
|
75
|
+
|
|
76
|
+
Provider-native opaque compaction is intentionally lossy. Real long-session tests showed that assistant-only details can disappear even when the opaque checkpoint itself is valid. The current checkpoint therefore keeps:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
bounded client-visible history
|
|
80
|
+
+ bounded assistant-visible final answers
|
|
81
|
+
+ opaque Native V2 compaction item
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
The explicit prefix is bounded at roughly 64k estimated tokens, with up to about 24k reserved for assistant answers and about 3k per retained assistant answer. Reasoning, raw tool traces, large search payloads and telemetry are not copied back into the prompt.
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
The goal is not byte-for-byte replay. It is **drop process noise, retain conversation facts**.
|
|
87
|
+
|
|
88
|
+
## Automatic compaction
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
0% -------------------- 90% ----- 95% ----- 100%
|
|
92
|
+
normal Native emergency hard cap
|
|
93
|
+
V2 DSH prune
|
|
88
94
|
```
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
Default behavior:
|
|
91
97
|
|
|
92
|
-
|
|
98
|
+
- below 90%: suppress stock 80% pressure pruning for compatible Native sessions;
|
|
99
|
+
- 90–95%: Native V2 first;
|
|
100
|
+
- 95%+: DSH's replay-safe tool-result pruning may run as an emergency guard;
|
|
101
|
+
- provider-confirmed context overflow keeps DSH's normal recovery path;
|
|
102
|
+
- manual `/compact` is unaffected.
|
|
103
|
+
|
|
104
|
+
## Cache behavior
|
|
105
|
+
|
|
106
|
+
A provider cache miss is not the same thing as DSH deleting history.
|
|
107
|
+
|
|
108
|
+
Observed real-world pattern:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
turn N: ~155k uncached, cacheRead 0
|
|
112
|
+
turn N+1: ~1k new input, ~155k cacheRead
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
That means the full context was resent and cached again. Prefix-changing operations include compaction, emergency pruning, route/model changes, and other DSH surface replacement. Restart/idle/provider cache TTL may also force a cold request independently of this plugin.
|
|
116
|
+
|
|
117
|
+
## Search modes
|
|
118
|
+
|
|
119
|
+
### Ordinary `web_search`
|
|
120
|
+
|
|
121
|
+
Recommended default. It follows the current Agent GPT Responses route.
|
|
93
122
|
|
|
94
|
-
|
|
95
|
-
- DSH `0.1.0-rc.8` or a compatible release
|
|
96
|
-
- A GPT model already added to DSH and working in a normal conversation
|
|
97
|
-
- The model must use the `openai-responses` provider from `llm-pi-ai`
|
|
123
|
+
### `websearch_gpt_advanced`
|
|
98
124
|
|
|
99
|
-
|
|
125
|
+
Opt in only for Hosted-only parameters such as domain filters, approximate location, search-context size and image search. Keeping it disabled avoids unnecessary tool-catalog churn.
|
|
100
126
|
|
|
101
|
-
|
|
127
|
+
### `websearch_alpha`
|
|
102
128
|
|
|
103
|
-
|
|
129
|
+
Stateful Codex/Alpha-style `search/open/find/click/screenshot`; registered only after a matching capability probe.
|
|
104
130
|
|
|
105
|
-
|
|
131
|
+
## Installation
|
|
106
132
|
|
|
107
|
-
|
|
133
|
+
Stable channel:
|
|
108
134
|
|
|
109
135
|
```powershell
|
|
110
|
-
|
|
111
|
-
$env:LCX_API_KEY_FILE = 'C:\path\to\local-key.txt'
|
|
112
|
-
$env:LCX_MODEL = 'the-exact-model-name'
|
|
113
|
-
node (Join-Path $dshHome 'profiles\web\node_modules\dsh-lcx-codex\scripts\probe-alpha.mjs')
|
|
136
|
+
dsh plugin --profile web add dsh-lcx-codex
|
|
114
137
|
```
|
|
115
138
|
|
|
116
|
-
|
|
139
|
+
Pre-release channel (current rc.8):
|
|
117
140
|
|
|
118
141
|
```powershell
|
|
119
|
-
|
|
120
|
-
node (Join-Path $dshHome 'profiles\web\node_modules\dsh-lcx-codex\scripts\probe-alpha.mjs')
|
|
142
|
+
dsh plugin --profile web add dsh-lcx-codex@next
|
|
121
143
|
```
|
|
122
144
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
## Data and Limits
|
|
145
|
+
Local RC:
|
|
126
146
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- Only Native remote-compaction V2 is supported; `/responses/compact` is never called.
|
|
133
|
-
- Same-route replay reuses the DSH session `prompt_cache_key` and preserves the existing request prefix. A single cold request can still occur after the short-lived upstream cache expires, so the cumulative session hit rate is not evidence that the plugin changed the prefix.
|
|
134
|
-
- Sub2API strips the unsupported `prompt_cache_retention` field on its Codex OAuth path, so requesting `24h` does not extend cache lifetime on that route. Use the `cached_tokens` reported by consecutive real requests as the authoritative signal.
|
|
135
|
-
- Checkpoints never store raw image bytes or data URLs.
|
|
136
|
-
- Opaque checkpoints are not replayed across an incompatible provider, model, base URL, session, or lineage.
|
|
137
|
-
- Image generation is not included.
|
|
147
|
+
```powershell
|
|
148
|
+
dsh plugin --profile web remove dsh-lcx-codex
|
|
149
|
+
dsh plugin --profile web add .\dsh-lcx-codex-0.4.0-rc.8.tgz
|
|
150
|
+
dsh web
|
|
151
|
+
```
|
|
138
152
|
|
|
139
|
-
|
|
153
|
+
Do not delete existing sessions or `$DSH_HOME/storages/lcx-codex/` just to upgrade. The legacy v3 sidecar remains read-only compatibility state.
|
|
140
154
|
|
|
141
|
-
##
|
|
155
|
+
## Recommended settings
|
|
142
156
|
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
|
|
157
|
+
```text
|
|
158
|
+
Enable plugin on
|
|
159
|
+
GPT Hosted Search on
|
|
160
|
+
Advanced Hosted Search off
|
|
161
|
+
Alpha Search off
|
|
162
|
+
Native V2 remote compaction on
|
|
163
|
+
Native-first auto compaction on
|
|
164
|
+
Native threshold 90%
|
|
165
|
+
Emergency DSH prune 95%
|
|
166
|
+
web_search timeout 240s
|
|
146
167
|
```
|
|
147
168
|
|
|
148
|
-
|
|
169
|
+
## Requirements
|
|
170
|
+
|
|
171
|
+
- Node.js >= 20
|
|
172
|
+
- DSH 0.1.1-rc.2
|
|
173
|
+
- a working GPT `openai-responses` route in DSH
|
|
174
|
+
- an upstream that actually supports the enabled Hosted Search / Native V2 / Alpha capabilities
|
|
175
|
+
|
|
176
|
+
Typical paths include direct Sub2API and NewAPI-relayed Responses routes.
|
|
177
|
+
|
|
178
|
+
## Release channels
|
|
179
|
+
|
|
180
|
+
Stable releases use npm's `latest` tag. `0.4.0-rc.*` builds publish to npm's `next` tag. GitHub tags must match `package.json`; Trusted Publishing runs tests before publishing.
|
|
149
181
|
|
|
150
182
|
## Development
|
|
151
183
|
|
|
152
|
-
```
|
|
153
|
-
npm install
|
|
184
|
+
```bash
|
|
154
185
|
npm test
|
|
155
186
|
npm run test:schema
|
|
187
|
+
npm pack --ignore-scripts
|
|
156
188
|
```
|
|
157
189
|
|
|
158
|
-
|
|
190
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) and [CHANGELOG.md](CHANGELOG.md) for implementation details.
|
|
159
191
|
|
|
160
192
|
## License
|
|
161
193
|
|
|
162
|
-
|
|
194
|
+
MIT
|
|
Binary file
|
package/cordis.patch.yml
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
1
|
+
# Optional Responses/Codex capabilities for GPT routes already configured in llm-pi-ai.
|
|
2
|
+
# This does not replace DSH's compaction service. Native V2 is installed as the
|
|
3
|
+
# documented purpose=compaction llm/stream override, leaving compaction policy,
|
|
4
|
+
# range selection, pruning, transactions and /compact owned by DSH.
|
|
3
5
|
- insert:
|
|
4
6
|
- id: lcx-codex
|
|
5
7
|
name: dsh-lcx-codex
|
|
@@ -8,11 +10,15 @@
|
|
|
8
10
|
baseURL: https://api.lcxbot.com/v1
|
|
9
11
|
apiKeyEnv: LCX_API_KEY
|
|
10
12
|
model: gpt-5.6-sol
|
|
11
|
-
|
|
12
|
-
checkpointPath: !!js dshHomePath('storages/lcx-codex/checkpoints-v3.json')
|
|
13
|
+
legacyCheckpointPath: !!js dshHomePath('storages/lcx-codex/checkpoints-v3.json')
|
|
13
14
|
alphaCapabilityPath: !!js dshHomePath('storages/lcx-codex/web-alpha-capabilities.json')
|
|
14
15
|
alphaRefPath: !!js dshHomePath('storages/lcx-codex/web-alpha-refs.json')
|
|
15
16
|
webSearchProvider: lcx-responses
|
|
16
17
|
webMaxResults: 8
|
|
17
18
|
timeoutMs: 300000
|
|
18
19
|
maxAttempts: 3
|
|
20
|
+
requestImagePixelBudget: 4194304
|
|
21
|
+
requestImageMaxBytes: 1048576
|
|
22
|
+
webSearchTimeoutMs: 240000
|
|
23
|
+
autoCompactionThresholdPercent: 90
|
|
24
|
+
emergencyPruneThresholdPercent: 95
|