dsh-lcx-codex 0.3.4 → 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,164 +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 lets any DSH primary model call Hosted or Alpha Search through a separately configured GPT Responses route, and adds Native V2 remote compaction for compatible GPT primary models.
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: Hosted and Alpha can be called by any DSH primary model through a configured GPT openai-responses route. Enabling Hosted selects the plugin DSH search provider; disabling it restores the previous provider. Native V2 Compact applies only to the active compatible GPT route.
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([Any DSH primary model]) --> search_route[Use active compatible GPT route<br/>or configured GPT fallback route]
26
- gpt_session([Compatible GPT primary model]) --> compact_route[Reuse active provider, model, baseURL, and credential]
22
+ > `LCX` is only the project name. This project is not affiliated with OpenAI, DeepSeek, Sub2API or NewAPI.
27
23
 
28
- subgraph plugin_capabilities ["dsh-lcx-codex"]
29
- hosted_search[Hosted Search<br/>POST /responses + web_search]
30
- alpha_gate{Alpha capability matches?}
31
- alpha_search[Alpha Search<br/>POST /alpha/search]
32
- alpha_disabled([Alpha is not registered])
33
- native_compact[Native V2 Compact<br/>stream + compaction_trigger]
34
- 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.
35
25
 
36
- search_route --> hosted_search
37
- search_route --> alpha_gate
38
- compact_route --> native_compact
39
- alpha_gate -->|Yes| alpha_search
40
- 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
41
40
 
42
- hosted_search --> transport[Controlled authentication, timeout, retry, and response size]
43
- alpha_search --> transport
44
- 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.
45
42
 
46
- transport --> deployment{Deployment path}
47
- deployment -->|Direct| sub2api[Sub2API]
48
- deployment -->|Relay| newapi[Compatible NewAPI channel]
49
- sub2api --> upstream([OpenAI Responses/Codex-compatible upstream])
50
- newapi --> upstream
43
+ Search routing still crosses DSH's `tools/execute` → SearchProvider boundary without changing the model-visible `web_search` schema:
51
44
 
52
- upstream -.->|Compaction output| checkpoint[(Checkpoint v3)]
53
- checkpoint -->|Same route| opaque_replay[Opaque native replay]
54
- checkpoint -->|Route or model changed| portable_migration[Portable migration]
55
- opaque_replay --> transport
56
- portable_migration --> transport
45
+ ```text
46
+ Agent: lcx / gpt-5.6-luna
47
+ └─ DSH web_search
48
+ └─ Hosted Search: lcx / gpt-5.6-luna
57
49
  ```
58
50
 
59
- 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.
60
52
 
61
- ## Features
53
+ Hosted Search also receives its own stable cache namespace:
62
54
 
63
- | Feature | Tool or protocol | Behavior |
64
- |---|---|---|
65
- | Hosted Web Search | `websearch_gpt` | Callable by any primary model; uses a GPT Responses route for `/responses` with `web_search` and returns text, direct sources, and citations |
66
- | Alpha Search | `websearch_alpha` | Callable by any primary model; uses a verified GPT route for `/alpha/search` search, image, open/find/click, PDF screenshot, finance, weather, sports, and time actions |
67
- | 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
+ ```
68
59
 
69
- Alpha is enabled only when a capability record matches the search backend endpoint, provider, model, and schema. Hosted and Alpha are separate protocols and never silently fall back to each other. Enabling Hosted temporarily selects the plugin search provider, so the previous provider no longer handles search; disabling Hosted or removing the plugin restores the provider selected before activation.
60
+ A search row with a low cache hit in NewAPI therefore does not imply conversation truncation.
70
61
 
71
- ## Installation
62
+ ## Native V2 Compaction
72
63
 
73
- 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:
74
65
 
75
- ```powershell
76
- dsh plugin --profile web add dsh-lcx-codex
66
+ ```text
67
+ DSH compaction transaction
68
+ └─ purpose=compaction
69
+ └─ /responses + compaction_trigger
77
70
  ```
78
71
 
79
- 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.
80
73
 
81
- ```powershell
82
- dsh plugin --profile web add .\dsh-lcx-codex-0.3.4.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
83
82
  ```
84
83
 
85
- 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.
86
85
 
87
- ```powershell
88
- 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
89
94
  ```
90
95
 
91
- Open `Settings -> Plugins -> LCX / Codex capabilities` and enable Hosted, Alpha, or Native Compact as needed. The plugin is disabled by default.
96
+ Default behavior:
92
97
 
93
- ## 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.
94
122
 
95
- - Node.js 20 or later
96
- - DSH `0.1.0-rc.8` or a compatible release
97
- - A primary model already added to DSH and working in a normal conversation; the caller of Hosted or Alpha does not need to be GPT
98
- - A working GPT `openai-responses` provider for the Hosted/Alpha search backend; Native Compact requires the active primary model itself to use such a route
123
+ ### `websearch_gpt_advanced`
99
124
 
100
- Hosted and Alpha reuse the active route when the primary model already uses a compatible GPT Responses route; otherwise they use the GPT Responses route selected in the plugin settings. Native Compact only reuses the active GPT primary model's provider, model, Responses URL, credential reference, headers, and retry policy. Credentials are resolved by the DSH credentials service, so normal 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.
101
126
 
102
- The provider, endpoint, and model fields in the plugin UI define the search fallback route and preserve compatibility with the older direct-route configuration. Hosted and Alpha use this GPT route when the active primary model is not on a compatible GPT route. An existing DSH provider configuration takes precedence.
127
+ ### `websearch_alpha`
103
128
 
104
- ## Alpha Probe
129
+ Stateful Codex/Alpha-style `search/open/find/click/screenshot`; registered only after a matching capability probe.
105
130
 
106
- 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
107
132
 
108
- 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:
109
134
 
110
135
  ```powershell
111
- $dshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE '.dsh' }
112
- $env:LCX_API_KEY_FILE = 'C:\path\to\local-key.txt'
113
- $env:LCX_MODEL = 'the-exact-model-name'
114
- node (Join-Path $dshHome 'profiles\web\node_modules\dsh-lcx-codex\scripts\probe-alpha.mjs')
136
+ dsh plugin --profile web add dsh-lcx-codex
115
137
  ```
116
138
 
117
- To also probe image, finance, weather, sports, and time actions:
139
+ Pre-release channel (current rc.8):
118
140
 
119
141
  ```powershell
120
- $env:LCX_ALPHA_PROBE_STRUCTURED = '1'
121
- 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
122
143
  ```
123
144
 
124
- The probe does not print the key or full response bodies. Restart DSH, or disable and re-enable Alpha, after the probe completes.
125
-
126
- ## Data and Limits
145
+ Local RC:
127
146
 
128
- - The search network target prefers the active compatible DSH `openai-responses` provider and otherwise uses the GPT provider selected in the plugin settings. It is not fixed to LCX or any other domain, and the plugin only calls `/responses` and `/alpha/search` under that address.
129
- - The credential name comes from the selected GPT provider's `apiKeyEnv` and is resolved by the DSH credentials service. The plugin does not store API keys.
130
- - Enabling Hosted temporarily changes `ctx.web.searchProviderId` to the plugin search provider; disabling Hosted or removing the plugin restores the provider selected before activation.
131
- - Checkpoints: `$DSH_HOME/storages/lcx-codex/checkpoints-v3.json`
132
- - Alpha capabilities: `$DSH_HOME/storages/lcx-codex/web-alpha-capabilities.json`
133
- - Alpha references: `$DSH_HOME/storages/lcx-codex/web-alpha-refs.json`
134
- - Only Native remote-compaction V2 is supported; `/responses/compact` is never called.
135
- - 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.
136
- - 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.
137
- - Checkpoints never store raw image bytes or data URLs.
138
- - Opaque checkpoints are not replayed across an incompatible provider, model, base URL, session, or lineage.
139
- - 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
+ ```
140
152
 
141
- 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.
142
154
 
143
- ## Update and Removal
155
+ ## Recommended settings
144
156
 
145
- ```powershell
146
- dsh plugin --profile web update dsh-lcx-codex
147
- 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
148
167
  ```
149
168
 
150
- 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.
151
181
 
152
182
  ## Development
153
183
 
154
- ```powershell
155
- npm install
184
+ ```bash
156
185
  npm test
157
186
  npm run test:schema
187
+ npm pack --ignore-scripts
158
188
  ```
159
189
 
160
- 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.
161
191
 
162
192
  ## License
163
193
 
164
- [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