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/README_EN.md CHANGED
@@ -1,162 +1,194 @@
1
- # dsh-lcx-codex
1
+ <div align="center">
2
2
 
3
- [Chinese](README.md) | **English**
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
- [![npm version](https://img.shields.io/npm/v/dsh-lcx-codex.svg)](https://www.npmjs.com/package/dsh-lcx-codex)
6
- [![license](https://img.shields.io/npm/l/dsh-lcx-codex.svg)](LICENSE)
5
+ # DSH-LCX-CODEX
7
6
 
8
- A community-maintained DSH plugin that adds Hosted Web Search, Alpha Search, and Native V2 remote compaction to GPT models served through an OpenAI Responses/Codex-compatible API.
7
+ **OpenAI Responses / Codex-native capabilities for DeepSeek Harness.**
9
8
 
10
- > [!IMPORTANT]
11
- > Alpha Search currently has five supported deployment paths: a direct Sub2API connection, or one of four NewAPI channel types: `Sub2API`, `New API`, `ChatGPT Subscription (Codex)`, and `Advanced Custom`. A regular `OpenAI` channel does not support `/v1/alpha/search` and is rejected by NewAPI.
9
+ [![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)
11
+ ![DSH](https://img.shields.io/badge/DSH-0.1.1--rc.2-4ea8ff)
12
+ ![License](https://img.shields.io/badge/license-MIT-1677ff)
12
13
 
13
- This list comes from NewAPI's current [`AlphaSearchHelper`](https://github.com/QuantumNous/new-api/blob/f116414284162ad15d8925f7bca494c109b83e93/relay/alpha_search_handler.go). Other NewAPI versions may differ, so the capability probe remains authoritative for a specific deployment.
14
+ [简体中文](README.md) · **English**
14
15
 
15
- `LCX` is only the plugin name. It is not a service provider or protocol. The plugin supports GPT models served through:
16
+ </div>
16
17
 
17
- - A direct Sub2API reverse proxy.
18
- - A NewAPI relay, meaning a third-party relay whose upstream channel connects to Sub2API.
18
+ ---
19
19
 
20
- ```mermaid
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
- dsh_session([DSH GPT session]) --> resolve_route[Reuse provider, model, baseURL, and credential]
22
+ > `LCX` is only the project name. This project is not affiliated with OpenAI, DeepSeek, Sub2API or NewAPI.
26
23
 
27
- subgraph plugin_capabilities ["dsh-lcx-codex"]
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
- resolve_route --> hosted_search
36
- resolve_route --> alpha_gate
37
- resolve_route --> native_compact
38
- alpha_gate -->|Yes| alpha_search
39
- alpha_gate -->|No| alpha_disabled
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
- hosted_search --> transport[Controlled authentication, timeout, retry, and response size]
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
- transport --> deployment{Deployment path}
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
- upstream -.->|Compaction output| checkpoint[(Checkpoint v3)]
52
- checkpoint -->|Same route| opaque_replay[Opaque native replay]
53
- checkpoint -->|Route or model changed| portable_migration[Portable migration]
54
- opaque_replay --> transport
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
- This project is not affiliated with OpenAI and is not an official OpenAI plugin or OAuth client.
51
+ The settings-page model is now a **fallback** used only when no active Agent route is available.
59
52
 
60
- ## Features
53
+ Hosted Search also receives its own stable cache namespace:
61
54
 
62
- | Feature | Tool or protocol | Behavior |
63
- |---|---|---|
64
- | Hosted Web Search | `websearch_gpt` | Uses `/responses` with `web_search` and returns text, direct sources, and citations |
65
- | Alpha Search | `websearch_alpha` | Uses `/alpha/search` for search, image, open/find/click, PDF screenshot, finance, weather, sports, and time actions |
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
- Alpha is enabled only when a capability record matches the current endpoint, provider, model, and schema. Hosted and Alpha are separate protocols and never silently fall back to each other.
60
+ A search row with a low cache hit in NewAPI therefore does not imply conversation truncation.
69
61
 
70
- ## Installation
62
+ ## Native V2 Compaction
71
63
 
72
- Install from npm:
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
- ```powershell
75
- dsh plugin --profile web add dsh-lcx-codex
66
+ ```text
67
+ DSH compaction transaction
68
+ └─ purpose=compaction
69
+ └─ /responses + compaction_trigger
76
70
  ```
77
71
 
78
- You can also install a specific `.tgz` file from a GitHub Release:
72
+ Native success means zero basic-summary request. Basic summary runs only if Native fails and fallback is enabled.
79
73
 
80
- ```powershell
81
- dsh plugin --profile web add .\dsh-lcx-codex-0.3.2.tgz
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
- Start DSH after installation:
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
- ```powershell
87
- dsh web
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
- Open `Settings -> Plugins -> LCX / Codex capabilities` and enable Hosted, Alpha, or Native Compact as needed. The plugin is disabled by default.
96
+ Default behavior:
91
97
 
92
- ## Requirements
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
- - Node.js 20 or later
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
- The plugin reuses the active DSH model's provider, model, Responses URL, credential reference, headers, and retry policy. Normal plugin operation does not require a second `LCX_API_KEY` configuration.
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
- The endpoint and model fields in the plugin UI are defaults for cases without an active session route and for compatibility with the older direct-route configuration. An existing DSH provider configuration takes precedence.
127
+ ### `websearch_alpha`
102
128
 
103
- ## Alpha Probe
129
+ Stateful Codex/Alpha-style `search/open/find/click/screenshot`; registered only after a matching capability probe.
104
130
 
105
- Alpha capability is classified as `native`, `command-capable`, `emulated-search-only`, `unsupported`, or `unknown`. An HTTP 200 response alone does not prove that an action is native.
131
+ ## Installation
106
132
 
107
- The probe is a standalone Node.js script outside the DSH runtime, so it cannot use the DSH credentials service. It requires a local key file; normal plugin operation does not.
133
+ Stable channel:
108
134
 
109
135
  ```powershell
110
- $dshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE '.dsh' }
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
- To also probe image, finance, weather, sports, and time actions:
139
+ Pre-release channel (current rc.8):
117
140
 
118
141
  ```powershell
119
- $env:LCX_ALPHA_PROBE_STRUCTURED = '1'
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
- The probe does not print the key or full response bodies. Restart DSH, or disable and re-enable Alpha, after the probe completes.
124
-
125
- ## Data and Limits
145
+ Local RC:
126
146
 
127
- - The runtime network target is determined by the active DSH `openai-responses` provider's `baseURL`; it is not fixed to LCX or any other domain. The plugin only calls `/responses` and `/alpha/search` under that address.
128
- - The credential name comes from the same provider's `apiKeyEnv` and is resolved by the DSH credentials service. The plugin does not store API keys.
129
- - Checkpoints: `$DSH_HOME/storages/lcx-codex/checkpoints-v3.json`
130
- - Alpha capabilities: `$DSH_HOME/storages/lcx-codex/web-alpha-capabilities.json`
131
- - Alpha references: `$DSH_HOME/storages/lcx-codex/web-alpha-refs.json`
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
- Never commit API keys, OAuth tokens, Authorization headers, account IDs, session cookies, or runtime sidecars to GitHub.
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
- ## Update and Removal
155
+ ## Recommended settings
142
156
 
143
- ```powershell
144
- dsh plugin --profile web update dsh-lcx-codex
145
- dsh plugin --profile web remove dsh-lcx-codex
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
- Removal does not delete `$DSH_HOME/storages/lcx-codex/`. Do not delete a checkpoint sidecar by itself while a session still references its marker.
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
- ```powershell
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
- Real E2E tests and the Alpha probe must read test credentials only from ignored local files or environment variables.
190
+ See [ARCHITECTURE.md](ARCHITECTURE.md) and [CHANGELOG.md](CHANGELOG.md) for implementation details.
159
191
 
160
192
  ## License
161
193
 
162
- [MIT](LICENSE)
194
+ MIT
Binary file
package/cordis.patch.yml CHANGED
@@ -1,5 +1,7 @@
1
- # Adds optional search and compaction for Sub2API-proxied or NewAPI-relayed GPT
2
- # models without touching existing profiles or presets.
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
- compactTransport: native-v2
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