dsh-openai-server-compaction
Native DeepSeek Harness bundle for OpenAI's Responses API and Codex-style server compaction. It uses an OpenAI API key; OAuth and the ChatGPT Codex backend are not implemented.
What it does
- Registers the
openai-responsesDSH provider. Normal agent turns usePOST /v1/responses. - Replaces
compaction-basicwith a compatible engine./compact, token-pressure compaction, and context-overflow recovery call the official standalonePOST /v1/responses/compactendpoint. - Persists the endpoint's complete canonical
outputoutside the session JSONL and replays it unchanged after restart for the exact provider/model that created it. The output is never reduced to only its compaction item. - Writes a portable text checkpoint into normal DSH history. Other models and providers receive this summary instead of opaque provider state.
- Preserves native Responses output in DSH
ReplayEnvelopemetadata. A server-generated compaction item in an ordinary response also becomes the next request's history root.
There is no silent chat-completions fallback. Missing credentials, malformed Responses streams, missing state, and unsupported content fail explicitly.
Install
dsh plugin --profile web add dsh-openai-server-compaction
For a git checkout:
dsh plugin --profile web add https://github.com/ylxmf2005/dsh-openai-server-compaction.git
If pnpm reports ERR_PNPM_ADDING_TO_ROOT for a workspace-style profile, repeat the same command with -w immediately after add.
Set OPENAI_API_KEY in the DSH credential store or in the environment inherited by DSH. Select provider openai-responses and a Responses model.
Native Models settings
After installation, open DSH Settings -> Models -> OpenAI Server Compaction. The native provider editor uses the plugin's llm-openai-server-compaction settings schema and credentials service; no custom frontend is bundled. It supports:
- OpenAI API key (stored through DSH credentials; the settings document contains only
apiKeyEnv) - Responses API base URL
- One or more model entries with model ID, display name, context window, and max output tokens
- automatic compaction, threshold ratio, retention, and the other exposed compaction policy fields
The settings section is deliberately marked restart required. Saving updates $DSH_HOME/settings.yaml, and the next DSH start applies the new endpoint, model catalog, context capacities, and compaction policy together. The current process keeps its boot-time configuration; it never reports a partial hot update. API key values are separate credential records and can be rotated without placing secrets in the settings file.
The bundle defaults to https://api.openai.com/v1. Override its patch in the profile's cordis.patch.yml when a different direct OpenAI Responses endpoint, model catalog, or state path is required.
Persistence model
DSH's compaction contract replaces old surface nodes with a portable user-role checkpoint; it has no public field for an adapter-private opaque compaction item. This plugin therefore stores encrypted provider state in the configured stateFile and embeds only a UUID marker in the checkpoint. The default bundle path is:
$DSH_HOME/openai-server-compaction/state.json
Keep that file with the DSH session store. If it is lost, a compatible OpenAI replay fails explicitly. The portable summary remains usable by another provider. The state file contains opaque encrypted provider data and is created with owner-only permissions; treat it as private application data.
Opaque state is model-bound. Changing the model or provider uses the portable checkpoint. Changing back to the exact original route restores opaque replay as long as the state file remains present.
Configuration
The bundle patch accepts the normal compaction-basic fields plus:
| Field | Default | Purpose |
|---|---|---|
provider |
openai-responses |
DSH provider route owned by the adapter |
apiKeyEnv |
OPENAI_API_KEY |
DSH credential reference / environment variable |
baseURL |
https://api.openai.com/v1 |
Direct Responses API base URL |
stateFile |
under $DSH_HOME |
Durable opaque-state document |
models |
gpt-5.6 (1050000 context) |
Optional model picker metadata |
defaultContextWindow |
1050000 |
Pressure threshold capacity for uncatalogued models |
defaultMaxTokens |
32768 |
Output cap for uncatalogued models |
The equivalent settings document section is:
llm-openai-server-compaction:
baseURL: https://api.openai.com/v1
apiKeyEnv: OPENAI_API_KEY
auto: true
thresholdRatio: 0.8
models:
- id: gpt-5.6
name: GPT-5.6
contextWindow: 1050000
maxTokens: 128000
Model catalog entries are advisory. The adapter accepts unlisted model IDs.
Development
npm install
npm test
npm run check
npm run build
npm pack --dry-run
The test suite never calls a paid API. The live smoke is explicit and billable:
OPENAI_API_KEY=... OPENAI_MODEL=... npm run smoke:live
Marketplace
docs/marketplace-entry.yml is a draft for awesome-dsh-plugin. A registry submission still requires the repository-age, commit-count, and GitHub dsh-plugin topic rules. This repository is not automatically published or submitted by the build.
License
MIT
No comments yet. Be the first to write one.