dsh-compressor
已验证dsh-compressor · v0.1.0 · Apache-2.0
In-process DeepSeek Harness context compression bundle
安装
dsh plugin add dsh-compressor 用 dsh --profile default --dump-config 确认 layer 已生效 —— 参见安装指南。
源码
标签
作者
说明文档
dsh-compressor
DeepSeek Harness bundle. Compresses long tool results in-process and restores them with compressor_retrieve.
On 20 redacted real DSH sessions, Session.deriveMessages() JSON shrank by up to 20%. Official spill left verbatim. Reproduce: node scripts/measure-sessions.mjs.
Install into a DSH profile
dsh plugin forwards to pnpm in $DSH_HOME/profiles/<name>. Relative paths are resolved from the directory you run dsh in.
Local checkout
dsh plugin --profile web add ./plugins/dsh-compressor
GitHub subdirectory (plugin is not the repo root)
dsh plugin --profile web add github:lifeodyssey/dsh-compressor#path:plugins/dsh-compressor
npm (after npm publish from this directory)
dsh plugin --profile web add dsh-compressor
Confirm the layer:
dsh --profile web --dump-config
You should see # == dsh-compressor and id: dsh-compressor.
pnpm must be on PATH. Git-hosted installs may ask you to allow a prepare/build script under the profile’s pnpm-workspace.yaml (allowBuilds). This package ships prebuilt native/*.node and compiled lib/; it should not need rustc on the user’s machine.
Behavior
Hooks:
agent/pre-step— rewrite eligibletool/resultnodes on the session surface soSession.deriveMessages()sees the crushed formtools/post-execute— crush a new tool result as it is accepted
Originals: $DSH_HOME/dsh-compressor/<sha256>. Retrieve: compressor_retrieve with <<compressor:64hex>> or the bare hash.
Crushers: official Headroom Rust Log / Smart / Text / Search / Diff via napi (darwin-arm64, linux-x64-gnu). Code-aware off. Kompress off. CCR retrieve is not the user protocol.
Official DSH spill (preview + filesystem path + read/grep) is left alone.
Develop / test
pnpm install
pnpm test
pnpm typecheck
Rebuild JS after source edits: pnpm build. Rebuild the native addon only if you change Rust crushers: pnpm build:native (needs the repo’s Cargo workspace).
Publish to npm
The npm name dsh-compressor is currently free. Publish this directory, not the repository root.
pnpm install
pnpm build
# confirm files: lib/, native/*.node, cordis.patch.yml
npm publish --access public
Then users install with dsh plugin --profile web add dsh-compressor. Bump version in package.json for each release.
Requires an npm account with publish rights. Do not commit .npmrc tokens.