dsh-lcx-codex 0.4.2 → 0.4.3-pre.2

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.
Files changed (47) hide show
  1. package/README.md +116 -202
  2. package/cordis.patch.yml +3 -20
  3. package/lib/client.js +273 -146
  4. package/lib/compact-v2.js +218 -199
  5. package/lib/dsh-compat.js +227 -100
  6. package/lib/dsh-responses.js +445 -277
  7. package/lib/index.js +851 -757
  8. package/lib/json-store.js +50 -31
  9. package/lib/native-checkpoint.js +520 -194
  10. package/lib/responses-request.js +106 -121
  11. package/lib/responses-stream.js +972 -443
  12. package/lib/route.js +229 -355
  13. package/lib/service-mutex.js +73 -64
  14. package/lib/token-budget.js +176 -108
  15. package/lib/transport.js +277 -67
  16. package/lib/types/client/index.d.ts +6 -0
  17. package/lib/types/compact-v2.d.ts +104 -0
  18. package/lib/types/dsh-compat.d.ts +78 -0
  19. package/lib/types/dsh-responses.d.ts +82 -0
  20. package/lib/types/index.d.ts +83 -0
  21. package/lib/types/json-store.d.ts +10 -0
  22. package/lib/types/native-checkpoint.d.ts +213 -0
  23. package/lib/types/responses-request.d.ts +58 -0
  24. package/lib/types/responses-stream.d.ts +51 -0
  25. package/lib/types/route.d.ts +132 -0
  26. package/lib/types/service-mutex.d.ts +14 -0
  27. package/lib/types/token-budget.d.ts +50 -0
  28. package/lib/types/transport.d.ts +20 -0
  29. package/lib/types/web-run-output.d.ts +29 -0
  30. package/lib/types/web-search-alpha.d.ts +286 -0
  31. package/lib/types/web-search-capability.d.ts +26 -0
  32. package/lib/types/web-search-hosted.d.ts +246 -0
  33. package/lib/types/web-search-ref-store.d.ts +22 -0
  34. package/lib/web-run-output.js +167 -18
  35. package/lib/web-search-alpha.js +865 -163
  36. package/lib/web-search-capability.js +55 -65
  37. package/lib/web-search-hosted.js +210 -32
  38. package/lib/web-search-ref-store.js +63 -59
  39. package/package.json +79 -27
  40. package/ARCHITECTURE.md +0 -117
  41. package/CHANGELOG.md +0 -224
  42. package/README_EN.md +0 -277
  43. package/assets/dsh-lcx-codex-banner.jpg +0 -0
  44. package/lib/legacy-v3.js +0 -20
  45. package/lib/responses-replay.js +0 -68
  46. package/scripts/probe-alpha.mjs +0 -43
  47. package/scripts/validate-dsh-schema.mjs +0 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-lcx-codex",
3
- "version": "0.4.2",
3
+ "version": "0.4.3-pre.2",
4
4
  "description": "DSH GPT Responses lifecycle owner with Native V2 compaction/replay and Hosted/Alpha Search capabilities",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -23,11 +23,14 @@
23
23
  },
24
24
  "type": "module",
25
25
  "main": "lib/index.js",
26
+ "types": "lib/types/index.d.ts",
26
27
  "exports": {
27
28
  ".": {
29
+ "types": "./lib/types/index.d.ts",
28
30
  "default": "./lib/index.js"
29
31
  },
30
32
  "./client": {
33
+ "types": "./lib/types/client/index.d.ts",
31
34
  "default": "./lib/client.js"
32
35
  },
33
36
  "./cordis.patch.yml": "./cordis.patch.yml",
@@ -35,50 +38,99 @@
35
38
  },
36
39
  "files": [
37
40
  "lib/*.js",
38
- "scripts/*.mjs",
39
- "assets/*.jpg",
40
- "cordis.patch.yml",
41
- "LICENSE",
42
- "README.md",
43
- "README_EN.md",
44
- "ARCHITECTURE.md",
45
- "CHANGELOG.md"
41
+ "lib/types/**/*.d.ts",
42
+ "cordis.patch.yml"
46
43
  ],
47
44
  "dsh": {
48
45
  "bundle": {
49
46
  "patch": "./cordis.patch.yml"
50
47
  },
51
48
  "client": {
52
- "platform": "web"
49
+ "platform": "web",
50
+ "inject": [
51
+ "@deepseek-ai/dsh-client-ui-settings-plugins"
52
+ ]
53
53
  }
54
54
  },
55
55
  "dependencies": {
56
- "@earendil-works/pi-ai": "0.84.3"
56
+ "@earendil-works/pi-ai": "0.85.1"
57
57
  },
58
58
  "devDependencies": {
59
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
60
- "@deepseek-ai/dsh-settings": "0.1.1-rc.2",
61
- "@deepseek-ai/dsh-tools": "0.1.1-rc.2",
62
- "@deepseek-ai/schemastery": "^3.18.1",
59
+ "@deepseek-ai/schemastery": "^3.18.2",
60
+ "@types/node": "^22.20.0",
61
+ "@types/react": "~18.3.1",
62
+ "esbuild": "^0.28.2",
63
63
  "typescript": "7.0.2"
64
64
  },
65
65
  "peerDependencies": {
66
- "@deepseek-ai/cordis": "^4.0.1",
67
- "@deepseek-ai/dsh-attachment": "^0.1.1-rc.2",
68
- "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
69
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2",
70
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
71
- "@deepseek-ai/dsh-credentials": "^0.1.1-rc.2",
72
- "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
73
- "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
74
- "@deepseek-ai/dsh-settings": "^0.1.1-rc.2",
75
- "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
76
- "@deepseek-ai/schemastery": "^3.18.1",
66
+ "@deepseek-ai/cordis": "^4.0.2",
67
+ "@deepseek-ai/dsh-agent": "0.1.3-alpha.2",
68
+ "@deepseek-ai/dsh-attachment": "0.1.3-alpha.2",
69
+ "@deepseek-ai/dsh-client-locale": "0.1.3-alpha.2",
70
+ "@deepseek-ai/dsh-client-modules": "0.1.3-alpha.2",
71
+ "@deepseek-ai/dsh-client-store": "0.1.3-alpha.2",
72
+ "@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.3-alpha.2",
73
+ "@deepseek-ai/dsh-compaction": "0.1.3-alpha.2",
74
+ "@deepseek-ai/dsh-credentials": "0.1.3-alpha.2",
75
+ "@deepseek-ai/dsh-fs": "0.1.3-alpha.2",
76
+ "@deepseek-ai/dsh-llm": "0.1.3-alpha.2",
77
+ "@deepseek-ai/dsh-session": "0.1.3-alpha.2",
78
+ "@deepseek-ai/dsh-settings": "0.1.3-alpha.2",
79
+ "@deepseek-ai/dsh-tools": "0.1.3-alpha.2",
80
+ "@deepseek-ai/dsh-web": "0.1.3-alpha.2",
81
+ "@deepseek-ai/schemastery": "^3.18.2",
77
82
  "react": "^18.2.0"
78
83
  },
84
+ "peerDependenciesMeta": {
85
+ "@deepseek-ai/dsh-client-locale": {
86
+ "optional": true
87
+ },
88
+ "@deepseek-ai/dsh-agent": {
89
+ "optional": true
90
+ },
91
+ "@deepseek-ai/dsh-attachment": {
92
+ "optional": true
93
+ },
94
+ "@deepseek-ai/dsh-client-modules": {
95
+ "optional": true
96
+ },
97
+ "@deepseek-ai/dsh-client-store": {
98
+ "optional": true
99
+ },
100
+ "@deepseek-ai/dsh-client-ui-settings-plugins": {
101
+ "optional": true
102
+ },
103
+ "@deepseek-ai/dsh-compaction": {
104
+ "optional": true
105
+ },
106
+ "@deepseek-ai/dsh-credentials": {
107
+ "optional": true
108
+ },
109
+ "@deepseek-ai/dsh-fs": {
110
+ "optional": true
111
+ },
112
+ "@deepseek-ai/dsh-llm": {
113
+ "optional": true
114
+ },
115
+ "@deepseek-ai/dsh-session": {
116
+ "optional": true
117
+ },
118
+ "@deepseek-ai/dsh-settings": {
119
+ "optional": true
120
+ },
121
+ "@deepseek-ai/dsh-tools": {
122
+ "optional": true
123
+ },
124
+ "@deepseek-ai/dsh-web": {
125
+ "optional": true
126
+ }
127
+ },
79
128
  "scripts": {
129
+ "build": "npm run build:host && npm run build:client",
130
+ "build:host": "tsc -p tsconfig.json",
131
+ "build:client": "tsc -p tsconfig.client.json && node scripts/build-client.mjs",
80
132
  "test": "node --test tests/*.test.mjs",
81
- "typecheck": "tsc -p tsconfig.typed-core.json",
133
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.client.json --noEmit",
82
134
  "probe:alpha": "node scripts/probe-alpha.mjs",
83
135
  "pack:local": "npm pack --ignore-scripts",
84
136
  "test:schema": "node scripts/validate-dsh-schema.mjs"
package/ARCHITECTURE.md DELETED
@@ -1,117 +0,0 @@
1
- # GPT Responses full-lifecycle ownership — 0.4.2-pre.1
2
-
3
- ## Product contract
4
-
5
- `LCX OFF` leaves every LLM request on the native DSH adapter path. `LCX ON` is the ownership switch for the selected GPT Responses conversation: LCX owns the final Responses wire from the first ordinary turn through tool loops, Native V2 compaction, native replay, portable model migration, and restart/resume. Users turn LCX off before selecting a non-GPT model; DSH model switching itself remains hot and requires no restart.
6
-
7
- ## Responsibility boundary
8
-
9
- - **DSH** remains the Agent, Session, request assembly, model/settings/credential, tool-execution, attachment, pressure-policy and compaction-transaction owner.
10
- - **The rc.2 compatibility seam** projects DSH `GenerateOptions` and durable replay content into Pi's provider-neutral `Context`. It exists only because DSH 0.1.1-rc.2 does not publish `toPiContext()` / `toStreamChunks()` as stable package APIs.
11
- - **Plugin Pi 0.84.3** owns canonical Responses message/tool serialization and stream semantics: reasoning, IDs, custom tools, strict/grammar tools, `additional_tools`, `tool_search`, namespace, cache semantics and event parsing.
12
- - **LCX** owns the final body, HTTP/SSE wire, safe error normalization, ordinary/compact/replay orchestration, Remote V2 opaque state and checkpoint compatibility.
13
-
14
- ## Unified request path
15
-
16
- `serializeNativeAware()` is the shared history compiler. With no checkpoint it serializes ordinary history; with a compatible checkpoint it injects retained native history plus the opaque compaction item; with an incompatible GPT model/route it reconstructs portable DSH history. All three representations continue through one standard LCX request builder and one LCX transport/parser bridge. Compact is the standard request plus `compaction_trigger` and the Remote V2 feature header; native replay is the standard request plus opaque history. Portable migration never recursively bypasses LCX back to `PiAiAdapter`.
17
-
18
- Ordinary and replay requests perform one provider attempt and emit DSH terminal failure chunks using the host taxonomy, leaving visible retries to DSH's `agent/request-error` policy. Native compaction retains its bounded idempotent retry and first-checkpoint Basic fallback. Genuine upstream tool namespace is stored only in adapter-private replay metadata because DSH rc.2's visible ToolCall block has no namespace field.
19
-
20
- ## Gateway continuity
21
-
22
- The stable DSH session id drives Pi-compatible prompt-cache/session-affinity fields. Sub2API v0.1.183 accepts `session_id`, `session-id`, and `x-client-request-id` for Codex account stickiness and repairs recovered custom-tool/tool-search item ID prefixes. Runtime acceptance therefore verifies both LCX wire continuity and gateway account continuity; release prose is not treated as the wire contract.
23
-
24
- ---
25
-
26
- ## rc.6 pressure coordination
27
-
28
- DSH 0.1.1-rc.2 `compaction-basic` defaults to a `0.8` pressure threshold and, once pressure qualifies, runs `toolResultPruner` before summary compaction. Real long-session traces showed that a large prune can reduce the measured surface below 80%, preventing the Native summarizer from running while still rewriting an old request prefix and invalidating cache. rc.6 coordinates the existing engine instead of replacing it:
29
-
30
- - for a compatible GPT Responses route with Native auto-compaction enabled, `compactIfNeeded(..., "pressure")` returns `null` below the configured Native threshold (default 90%), so the stock 80% path does not mutate history;
31
- - from 90% up to the emergency threshold, the existing engine still owns range selection and the durable transaction, but `toolResultPruner.pruneSession()` is temporarily suppressed for that call; the engine's summary transport therefore reaches the existing `purpose=compaction` Native V2 override first;
32
- - at the emergency threshold (default 95%) or above, the pruner is no longer suppressed and DSH may shrink oversized tool results before attempting summary compaction;
33
- - provider-confirmed context overflow continues to use DSH's original `context-overflow` recovery unchanged;
34
- - manual `/compact` remains unchanged.
35
-
36
- Agent presets may isolate `compaction` and `toolResultPruner` inside entry-local Cordis realms. DSH 0.1.1-rc.2 explicitly documents that these preset services are invisible to both the host and ordinary `agent.ctx`; host-side code must address them through `agentPresets.serviceFor(agent, name)`. LCX therefore observes agent lifecycle events globally, resolves each Agent's real preset-local compaction/pruner through that public resolver, and patches the concrete compaction instance. A root `ctx.inject(['compaction'], ...)` hook remains only for non-preset/non-isolated deployments. Concrete Cordis service identity is used for de-duplication. DSH's own pre-step listener dynamically dispatches `this.compactIfNeeded()` at event time, and the wrapper is restored on plugin cleanup.
37
-
38
- ## rc.6 search timeout coordination
39
-
40
- `dsh-tool-web` stores the cooperative search deadline only in `ToolDefinition.timeoutMs`; timeout metadata is explicitly not sent to the model. rc.6 adjusts the visible `web_search` definition's timeout to 240 seconds by default and restores the original value on cleanup. This avoids the observed 60-second false timeout while leaving the model-visible tool schema byte-stable.
41
-
42
- # Architecture Notes — 0.4 Native Session Refactor / rc.6 Pressure Coordination
43
-
44
- ## rc.11 Native cache identity
45
-
46
- Native compaction and same-route replay reuse the active DSH/Pi conversation cache identity: the clamped session id is the `prompt_cache_key`, provider `cacheRetention` is respected, and `long` may emit `prompt_cache_retention: 24h` when supported. `cacheRetention: none` omits Native prompt-cache/session affinity. Ordinary Hosted Search remains intentionally isolated under `dsh-lcx-search:<route hash>` so search traffic cannot share the main conversation request/cache namespace.
47
-
48
- ## Design invariants
49
-
50
- 1. **DSH owns compaction policy.** LCX never independently decides threshold, compact range, pruning, transaction boundaries or overflow retries.
51
- 2. **Native success performs one compaction model request.** Basic summary is a failure fallback, not a parallel portable-copy generator.
52
- 3. **DSH session log is the new checkpoint source of truth.** Opaque Native V2 state lives in `compaction/summary.rawOutput`; v3 sidecar access is legacy read-only.
53
- 4. **Opaque state is same-session only.** Provider, model, base URL and exact `sourceSessionId === currentSessionId` gate Native opaque replay. Verified parent/child ancestry authorizes portable migration only; a fork never sends the parent's opaque checkpoint state.
54
- 5. **Route migration is transparent and transient.** Reconstruct shadowed DSH messages and hand them to the normal adapter; do not persist a second portable history copy.
55
- 6. **Ordinary search has one model tool.** `web_search` is ordinary search; `websearch_gpt_advanced` exists only for parameters absent from `WebSearchRequest`; Alpha remains its own stateful protocol.
56
- 7. **Provider-native wire code is isolated.** Direct `/responses` SSE code is limited to Native V2 compaction/replay and Hosted Search protocol calls.
57
-
58
- ## Why not subclass `BasicCompactionEngine`
59
-
60
- `BasicCompactionEngine.summarize()` is the intended subclass customization hook, but a subclass is a new `ctx.compaction` service provider. The shipped DSH profile already mounts `dsh-compaction-basic`; mounting a second engine would duplicate service ownership/listeners unless the profile explicitly replaces the existing row.
61
-
62
- The stock summarizer already routes through `ctx.llm.stream({ purpose: 'compaction' })`. For an out-of-tree optional plugin that must install without rewriting the base profile, narrowly intercepting that purpose is the less invasive integration.
63
-
64
- If DSH later adds a public **summarizer provider registry** (distinct from the compaction engine service), LCX should migrate to it.
65
-
66
- ## Why not inline opaque JSON in checkpoint text
67
-
68
- Inlining `encrypted_content` makes the session self-contained, but also exposes a large opaque string to DSH's visible surface/token accounting. Using a non-text block in `compaction/summary.rawOutput` keeps the session self-contained without turning provider state into prompt text.
69
-
70
- ## Remaining deliberate low-level seams
71
-
72
- ### Native Responses replay
73
-
74
- Generic DSH/Pi messages do not expose an input type for OpenAI `compaction` items. Same-route resume therefore builds the Responses request directly. This is a bounded compatibility adapter, not a second general LLM stack.
75
-
76
- ### Runtime Web SearchProvider selection
77
-
78
- DSH 0.1.1-rc.2 pins `deepseek-official` and has no public live setter. LCX uses an isolated compatibility write to the 0.1.1-rc.2 runtime field so the settings toggle works without restart. A future DSH public setter/configuration hook should replace this shim.
79
-
80
- ## Cache expectations
81
-
82
- - Stable ordinary tool schema improves prefix stability versus exposing two ordinary search tools.
83
- - Enabling/disabling Advanced or Alpha changes tools and may reset provider prefix cache.
84
- - Compaction necessarily changes visible history and therefore starts a new post-checkpoint prefix.
85
- - `prompt_cache_key` remains stable per exact route/session across Native compaction and native replay.
86
- - Remote-first avoids an otherwise redundant large-prefix local summary call.
87
-
88
- ## Native V2 retained-history invariant
89
-
90
- Current Codex V2 retains selected client messages and appends the opaque compaction item. Real DSH testing showed an additional product-level fidelity problem: a low-salience fact that existed only in an assistant answer can be omitted by the opaque state. LCX rc.5 therefore keeps the Native ordering but adds a bounded assistant-visible protection layer:
91
-
92
- ```text
93
- selected user/developer/system message items
94
- + selected assistant visible output_text items
95
- → opaque compaction item
96
- → later DSH-retained / post-compaction messages
97
- ```
98
-
99
- The fidelity prefix is capped at an estimated 64k tokens total. Up to 24k is reserved for assistant-visible answers; each retained assistant answer is capped at about 3k tokens. Assistant copies deliberately exclude reasoning, response IDs, tool calls, tool outputs, and provider-private state. The opaque item remains the only durable representation of those process details.
100
-
101
- The DSH surface still stores only the short checkpoint marker. The retained wire items and opaque compaction state remain log-only in `compaction/summary.rawOutput`, so they do not inflate DSH's visible token-meter surface. They do, intentionally, increase the post-compaction provider request relative to an opaque-only checkpoint; the total explicit retention ceiling prevents this protection from defeating compaction.
102
-
103
- Compatibility:
104
-
105
- - `0.4.0-rc.3`: v4 checkpoint could contain only the opaque item.
106
- - `0.4.0-rc.4`: v4 checkpoint retained client messages but not assistant-visible answers.
107
- - `0.4.0-rc.5`: writes `lcx-native-compaction-v5`; when replaying a v4 checkpoint it reconstructs the shadowed DSH transcript and derives the v5 fidelity prefix before reusing the original opaque state.
108
-
109
-
110
-
111
- ## rc.7 active-Agent Hosted Search routing
112
-
113
- DSH intentionally keeps `SearchProvider.search()` small: the provider receives the normalized search request and cancellation signal, not the calling Agent. Ordinary Hosted Search still needs the exact active GPT Responses route, especially when a user switches between Sol/Luna or multiple proxy routes.
114
-
115
- rc.7 therefore captures route identity at the model-facing `tools/execute` boundary for `web_search` and propagates it through Node `AsyncLocalStorage` only for the lifetime of that tool execution. `LcxResponsesSearchProvider.search()` resolves the route from that async context and falls back to the plugin-configured route only when no compatible active Agent route exists. No fields are added to the DSH `web_search` schema.
116
-
117
- Hosted Search uses a dedicated stable cache namespace (`dsh-lcx-search:<route fingerprint>`) rather than the Native replay namespace (`dsh-lcx:<route fingerprint>`). The two requests have different prefixes and should not be intentionally co-routed under one prompt-cache key.
package/CHANGELOG.md DELETED
@@ -1,224 +0,0 @@
1
- # Changelog
2
-
3
- ## 0.4.2-pre.1 - candidate under runtime acceptance
4
-
5
- ### Architecture
6
-
7
- - Make the LCX master switch the GPT Responses lifecycle ownership switch: when enabled, the first ordinary Agent turn, tools, Native V2 compaction, native replay and portable GPT-model migration share one LCX final-wire path.
8
- - Upgrade only the plugin's direct Pi dependency to `0.84.3`; DSH 0.1.1-rc.2 and its host Pi 0.82.x remain isolated and unchanged.
9
- - Reuse Pi 0.84 canonical Responses serializers and stream semantics for strict/grammar/custom tools, deferred `additional_tools` / `tool_search`, namespace, reasoning, IDs and cache behavior.
10
- - Add one standard Responses request builder and shared LCX HTTP/SSE transport/parser bridge; remove the old portable recursive bypass back to the DSH adapter.
11
- - Preserve checkpoint v5, DSH compaction transactions, Native-first pressure coordination, first-checkpoint Basic fallback, restart/resume and Search/#20 architecture.
12
- - Normalize ordinary/replay failures into DSH terminal taxonomy and keep DSH as the visible retry owner.
13
-
14
- ### Validation state
15
-
16
- - Engineering gates pass on the private work branch; exact commit-bound DSH + Sub2API runtime acceptance remains mandatory before integration, publication or a `VERIFIED` compatibility claim.
17
-
18
- ## 0.4.1 - 2026-08-25
19
-
20
- ### Stable promotion
21
-
22
- - Promote the fully QA-passed `0.4.1-pre.1` runtime to stable `0.4.1` with **zero functional/runtime code changes**.
23
- - Make Alpha stateful continuation/fail-closed fixes, DSH compatibility-seam isolation, typed protocol hardening, conservative token budgeting, and the installed Settings lifecycle fix part of the default stable line.
24
- - Publish stable `0.4.1` to npm dist-tag `latest`; the prior `prelatest=0.4.1-pre.1` remains historical prerelease state.
25
-
26
- ### Validation basis
27
-
28
- - `0.4.1-pre.1` passed Installed Candidate + Cross-feature QA before publication.
29
- - Public promotion preserved runtime/source parity with the frozen prerelease candidate.
30
- - Stable promotion requires package/version, typecheck, tests, schema, package/import boundary and zero-runtime-diff checks before publication.
31
-
32
- ## 0.4.1-pre.1 - 2026-08-25
33
-
34
- ### Released prerelease
35
-
36
- - Published as `dsh-lcx-codex@0.4.1-pre.1` on npm dist-tag `prelatest`; stable `latest` remained `0.4.0` at prerelease publication time.
37
- - Integrates the accepted Alpha stateful continuation and fail-closed capability work from #20, #21, and #22.
38
- - Includes accepted compatibility seam isolation (#24), typed protocol-core hardening (#25), unified conservative token budgeting (#26), and the installed-plugin settings lifecycle fix (#36).
39
- - Passed installed-candidate and cross-feature QA before publication, including ordinary/Advanced Hosted Search, Native compaction/replay, restart/resume, model continuation, fork isolation, and fail-closed Alpha behavior where unsupported.
40
- - Public promotion preserved source/runtime parity with the frozen private candidate; package, schema, typecheck, import, install-chain, and publication gates passed.
41
- - Post-release registry installation and Loader/client/settings-chain verification passed. The final provider-gated ordinary `web_search` recheck was not covered because the temporary authorized upstream credential returned HTTP 401; this was recorded as an external-auth verification gap rather than a package/source/runtime defect.
42
- - Superseded as the recommended release by stable `0.4.1` after zero-functional-change promotion.
43
-
44
- ## 0.4.0 - 2026-08-23
45
-
46
- ### Stable promotion
47
-
48
- - Promote the fully validated `0.4.0-rc.13` runtime to the stable `0.4.0` line with no functional/runtime code changes.
49
- - Make the rc.13 Native V2 hardening, canonical Responses replay/serialization fixes, session isolation, cache continuity, and concurrency/lifecycle fixes the recommended stable release.
50
- - Preserve `0.3.4` only as historical stable state; `0.4.0` becomes the default npm `latest` after publication.
51
-
52
- ### Validation
53
-
54
- - Runtime-sensitive source is required to remain content-identical to the already live-tested rc.13 release.
55
- - Full suite: 58/58 passed; DSH schema validation: 4/4 passed.
56
- - Real rc.13 DSH acceptance already covers automatic Native pressure Compact, replay/cache re-warm, restart/resume, real GUI `/compact`, parent/child opaque isolation, and dual-session same-preset ServiceMutex failure cleanup.
57
- - Stable promotion adds no new runtime behavior; publication is a version/documentation promotion only.
58
-
59
- ## 0.4.0-rc.13 - 2026-08-23
60
-
61
- ### Fixed
62
-
63
- - Restrict opaque Native checkpoint replay to the exact source DSH session. Parent/child ancestry remains valid only for portable migration, so a fork never sends the parent session's opaque Native state.
64
- - Reconcile Responses replay deltas and terminal output by stable item/call identity instead of `output_index` alone, preventing changed-index duplicate/empty text blocks and keeping terminal-only function calls balanced.
65
- - Replace the simplified Native message/tool serializer with the public `@earendil-works/pi-ai@0.82.1` OpenAI Responses converters, preserving reasoning/message identities, tool linkage, constrained-tool semantics, deferred-tool transcript semantics, and DSH image boundaries.
66
- - Match ordinary Pi `openai-responses` system-prompt placement: Native compact/replay now carries the developer/system prelude inside the canonical input prefix rather than introducing a separate top-level `instructions` prefix difference.
67
- - Restore strict validation of DSH Pi replay-state envelopes before reusing native signatures; mismatched replay metadata degrades to a portable foreign-assistant projection instead of injecting stale provider-native identity.
68
- - Treat Pi canonical role-only developer/user items as durable retained history and keep image persistence on `dsh_image_attachment` references rather than request image payloads.
69
- - Use Pi/model or explicitly configured DSH Responses compatibility only; unknown custom routes no longer assume strict tools, grammar tools, or tool-search support.
70
- - Mirror DSH/OpenAI Responses generation controls into Native compact/replay (`reasoning` + encrypted-reasoning include, temperature, and max output tokens), preventing the real Terra `xhigh` compact path from dropping the envelope used by ordinary Pi requests.
71
- - Source automatic-compaction generation controls from the matching session request header rather than the Basic compaction summarizer request, so the selected conversation effort (for example Terra `xhigh`) reaches the Native provider request.
72
- - Declare the DSH `sessions` service as an explicit Cordis runtime injection because checkpoint/replay and automatic-compaction generation parity read the live session/request header.
73
- - Maintain a deterministic per-session request-header cache from DSH `session/event`; `compaction/start` synchronously refreshes it from the live Session before the Native request, avoiding reliance on async-context propagation for generation parity.
74
- - Register that cross-session `session/event` observer with Cordis `{ global: true }`, matching DSH system-wide observers so Agent-carrier session events reach the standing plugin scope.
75
- - Snapshot the exact `agentArg.session.requestHeader()` inside the Native-first pressure wrapper immediately before delegating to Basic compaction; this is the deterministic pressure-path source of generation controls, with the global session-event cache retained only as a secondary path.
76
- - Seed the request-header cache from already-live sessions at plugin installation, seed newly announced resume/fork sessions, and evict disposed session entries so manual/non-pressure compaction remains restart-safe without retaining stale headers.
77
- - Match the explicit Remote V2 tool-control contract used by current Codex and mature Responses compaction implementations: Native compact/replay send `tool_choice: "auto"` and `parallel_tool_calls: true` on the plain `openai-responses` route.
78
- - Preserve only bounded provider machine diagnostics (`code`, `type`, `param`) from `response.failed`; the safe identifiers are included in the generic failure message/log so DSH compaction history can diagnose failures, while provider messages/bodies remain excluded.
79
- - Persist Pi replay envelope v2 on successful Native replay finish so DSH retains response id/stop reason plus text/reasoning native metadata across post-compact turns.
80
- - Preserve normal Pi OpenAI function-call identity as `call_id|item_id` for replay deltas and completed tool-call blocks, preventing loss of the provider `fc_*` item id on the next canonical request.
81
- - Treat the session header `config` as the effective ordinary-request envelope even when DSH marks a value in `adapterDefaults`; those materialized defaults (for example Terra `xhigh` and `maxTokens`) are still sent by normal Pi and therefore must be mirrored by Native compact/replay.
82
-
83
- ### Validation
84
-
85
- - `tests/rc13-regressions.test.mjs`: 15/15 passed.
86
- - Full local suite: 58/58 passed; DSH schema validation: 4/4 passed; `git diff --check` passed.
87
- - Installed DSH/NewAPI acceptance passed on Terra xhigh: automatic 90% Native V2 compact, continuous replay/cache re-warm, DSH Web restart/resume, real GUI `/compact` plus continuation, and parent→child fork portable isolation all completed without pre-Native stock prune or cross-session opaque replay.
88
- - This remains a local release candidate only; no npm/GitHub publication or tag is implied.
89
-
90
- ## 0.4.0-rc.12 - 2026-08-22
91
-
92
- ### Fixed
93
-
94
- - Serialize every `compactIfNeeded()` call per concrete preset compaction service so same-generation sessions cannot observe each other’s temporary Native-first pruner/config state; queued calls are abortable and plugin cleanup drains active owners before restoring the original method.
95
- - Align Native `openai-responses` session affinity with the active Pi adapter: default OpenAI-format routes use `session_id` plus `x-client-request-id`, while OpenRouter-format routes use `x-session-id`; explicit affinity headers remain authoritative.
96
- - Restrict Basic fallback to allowlisted retryable first-checkpoint failures and fail closed once a Native/legacy checkpoint already exists.
97
- - Require a real `response.completed` terminal event with `status=completed` for Native compaction/replay and reject orphan `function_call_output` items.
98
- - Set credential-bearing fetches to `redirect: error` and keep provider response bodies/messages out of surfaced/logged transport errors.
99
-
100
- ## 0.4.0-rc.11 - 2026-08-22
101
-
102
- ### Fixed
103
-
104
- - Restore ERR-051 cache/session affinity semantics that regressed in the rc.8 refactor: Native V2 compaction and same-route replay now use the DSH/Pi conversation session id as the clamped `prompt_cache_key` instead of a route fingerprint, inherit the active provider `cacheRetention`, emit `prompt_cache_retention: 24h` only for supported `long` retention, and omit Native cache affinity when retention is `none`.
105
- - Keep ordinary Hosted Search on its intentionally separate `dsh-lcx-search:<route hash>` namespace.
106
-
107
- ## 0.4.0-rc.10 - 2026-08-22
108
-
109
- ### Fixed
110
-
111
- - Fix Native-first pressure coordination for DSH 0.1.1-rc.2 Agent presets by using the public `agentPresets.serviceFor(agent, name)` resolver for preset-local `compaction` and `toolResultPruner` instances. This replaces the rc.9 assumption that ordinary `agent.ctx` lookup could see entry-local isolated services.
112
-
113
- ## 0.4.0-rc.9 - 2026-08-22
114
-
115
- ### Fixed
116
-
117
- - Restore the Alpha capability/ref-store interfaces consumed by `lib/index.js`; the rc.8 release package could pass its unit tests but fail immediately at module import with missing `AlphaCapabilityStore` / `AlphaRefStore` exports.
118
- - Add package-entry import regression coverage so CI fails when the server entry point and internal module exports drift out of sync.
119
- - Restore Native-first pressure coordination for isolated agent presets using DSH 0.1.1-rc.2's public `agentPresets.serviceFor(agent, name)` resolver. Preset-local `compaction` / `toolResultPruner` services are not visible through ordinary host or `agent.ctx` lookup; the plugin now addresses the actual per-Agent instances before applying the 90% Native / 95% emergency policy. A root service-lifecycle hook remains for non-preset deployments.
120
-
121
- ## 0.4.0-rc.8
122
-
123
- - Rebase the plugin on DSH `0.1.1-rc.2`; older DSH releases are no longer a supported runtime target.
124
- - Native V2 compaction image replay now uses DSH `attachments.readImageRequest()` with the active `llm-pi-ai` route's request-image pixel/byte policy instead of reading normalized master bytes directly.
125
- - Native image requests use DSH's deterministic `offloadRequestImagesWithPolicy()` projection before serialization, matching the current request-size behavior for long image-heavy sessions.
126
- - Keep rc.7 active-Agent Hosted Search routing, isolated search cache namespace, 240s search timeout, rc.5 conversation-fidelity checkpointing, and rc.6 90% Native-first / 95% emergency pressure policy unchanged.
127
- - CI installs against current declared DSH packages instead of enforcing the stale rc.8 lockfile.
128
-
129
- ## 0.4.0-rc.7 - 2026-08-22
130
-
131
- ### Fixed
132
-
133
- - Ordinary DSH `web_search` now follows the active Agent `provider/model` instead of always using the plugin fallback GPT model. A Luna conversation now searches with Luna; a Sol conversation now searches with Sol.
134
- - Added an AsyncLocalStorage route bridge at the DSH `tools/execute` boundary so the provider-only `ctx.web.search()` seam can receive Agent route context without changing the model-visible `web_search` schema.
135
- - Hosted Search now uses a separate stable `dsh-lcx-search:<route hash>` `prompt_cache_key`, avoiding intentional cache-key sharing with Native conversation replay.
136
- - The settings UI now labels the configured Responses endpoint/model as **fallback** values, matching their actual rc.7 role.
137
-
138
- ### Kept from rc.6
139
-
140
- - 240-second default DSH `web_search` deadline.
141
- - Native-first automatic pressure policy: 90% Native V2, 95% emergency DSH prune.
142
- - rc.5 conversation-fidelity checkpoints and restart-safe DSH session-log persistence.
143
-
144
- ### Docs / release
145
-
146
- - Reworked the README around the current architecture and real cache observations.
147
- - Added a blue/white DSH-LCX-CODEX hero banner for GitHub/npm.
148
- - GitHub trusted publishing is wired through `.github/workflows/publish.yml`: pre-release tags publish to npm dist-tag `next`; stable tags publish to `latest`.
149
-
150
- ## 0.4.0-rc.6
151
-
152
- - Added Native-first automatic pressure coordination for GPT Responses sessions: below the configured Native threshold the plugin suppresses DSH's stock 80% pressure compaction/prune path; at the default 90% threshold it lets compaction proceed while temporarily suppressing tool-result pruning so Native V2 runs first.
153
- - Added a separate emergency prune threshold (default 95%). At or above this zone, DSH's replay-safe tool-result pruner is allowed to run before compaction as overflow protection.
154
- - Added adjustable `web_search` tool deadline, default 240 seconds (30–600s). This mutates only DSH's non-model-visible `ToolDefinition.timeoutMs`, so the model tool schema and prompt-cache prefix do not change.
155
- - Added Settings UI controls for automatic compaction, Native threshold, emergency prune threshold, and web search timeout.
156
- - Kept the rc.5 checkpoint/fidelity format unchanged (`lcx-native-compaction-v5`); rc.6 is a pressure/timeout coordination release, not another checkpoint migration.
157
-
158
- ## 0.4.0-rc.5
159
-
160
- - Adds a bounded conversation-fidelity layer after real DSH testing showed assistant-only facts could be lost by opaque Native V2 compaction.
161
- - New `lcx-native-compaction-v5` checkpoints retain selected user/developer/system messages plus user-visible assistant final answers before the opaque compaction item.
162
- - Keeps explicit retained history within an estimated 64k-token ceiling; defaults reserve at most 24k for assistant answers and cap one retained assistant answer at about 3k tokens.
163
- - Does not copy reasoning, tool calls/results, raw search payloads, or telemetry into the fidelity prefix.
164
- - Repairs rc.3/rc.4 v4 checkpoints from append-only `shadowedSeqs`, including assistant-visible answers when the original DSH events still exist.
165
- - Stores only the single opaque compaction output item, ignoring unrelated terminal output items from nonstandard proxies.
166
- - Route compatibility now accepts both native checkpoint versions 4 and 5.
167
- - Adds regression coverage for the exact assistant-only anchor failure (`Cobalt-Sparrow-604` / `81736`) and the 64k retention ceiling.
168
-
169
- ## 0.4.0-rc.4
170
-
171
- - Fixes a Native V2 replay fidelity bug found by real DSH session-log testing.
172
- - Native checkpoints now persist the retained client-authored Responses messages before the opaque `compaction` item, matching current OpenAI Codex remote-compaction V2 replacement-history semantics.
173
- - Existing rc.3 opaque-only v4 checkpoints are repaired on replay by reconstructing the missing shadowed user history from the DSH append-only session log.
174
- - Adds replay/retention regression coverage and an explicit Native success diagnostic.
175
- - Keeps the rc.3 search-provider, remote-first fallback, and session-log-native checkpoint architecture unchanged.
176
-
177
- ## 0.4.0-rc.3
178
-
179
- - Fix Cordis external-package loading: all `ctx.web`/`ctx.llm` service access now occurs inside an explicit `ctx.inject(['llm', 'web'], ...)` scope.
180
- - This fixes `cannot get property "web" without inject` when DSH loads the plugin from a profile-installed `.tgz`.
181
- - No protocol or checkpoint-format changes from rc.2.
182
-
183
- ## 0.4.0-rc.2 - 2026-08-21
184
-
185
- - Packaging-only fix over rc.1: remove unnecessary `@deepseek-ai/dsh-compaction-basic` and `@deepseek-ai/dsh-web` peer declarations.
186
- - The plugin consumes DSH runtime services through injected `ctx.*` seams and does not import or mount either package directly.
187
- - Avoids misleading pnpm "missing peer" warnings and, importantly, avoids encouraging users to install a second compaction backend.
188
-
189
- ## 0.4.0-rc.1 - 2026-08-21
190
-
191
- ### Architecture
192
-
193
- - Keep DSH `compaction-basic` as the sole compaction service owner; use only its documented/interceptable `purpose=compaction` `llm/stream` summarizer seam.
194
- - Replace parallel local+remote compaction with remote-first fallback.
195
- - Persist new Native V2 opaque state in DSH `compaction/summary.rawOutput` using `lcx-native-compaction-v4`; the model-visible replacement stays short.
196
- - Remove new-checkpoint writes to the v3 JSON sidecar. The v3 sidecar is now read-only compatibility for old sessions.
197
- - Reconstruct portable history for route migration from DSH append-only `shadowedSeqs` instead of duplicating every checkpoint's portable history.
198
- - Preserve same-route fork replay through DSH session ancestry.
199
- - Centralize the remaining direct Responses-native transport in `compact-v2.js` and `responses-replay.js`.
200
-
201
- ### Search
202
-
203
- - Make `ctx.web` / DSH `web_search` the ordinary Hosted Search entry point.
204
- - Remove the ambiguous ordinary `websearch_gpt` tool.
205
- - Add opt-in `websearch_gpt_advanced` for Hosted-only controls that DSH `WebSearchRequest` cannot express.
206
- - Keep `websearch_alpha` independent and capability-gated.
207
- - Isolate the DSH rc.8 runtime SearchProvider-selection compatibility shim.
208
-
209
- ### Reliability
210
-
211
- - Rehydrate DSH image attachment references when replaying legacy v3 checkpoints.
212
- - Resolve startup settings into runtime route config immediately instead of waiting for the first settings change.
213
- - Do not assume `events[seq]` is always the event whose `event.seq === seq`; use a safe fallback lookup.
214
- - Add protocol, session persistence, migration and architecture regression tests.
215
-
216
- ### Compatibility
217
-
218
- - Node.js >= 20.
219
- - Target DSH `0.1.1-rc.2` only.
220
- - Existing 0.3.x v3 marker sessions remain best-effort readable through the old sidecar.
221
-
222
- ## 0.3.1
223
-
224
- - Previous Hosted/Alpha Search and Native V2 checkpoint-v3 implementation.