@sqnb/dsh-gpt-remote-compaction
中文 | English
Adds remote compaction for GPT routes in DSH. The plugin subclasses DSH's BasicCompactionEngine and replaces only summary generation, leaving native pressure policy, /compact, tool-pairing checks, durable replacement, and replay behavior in DSH.
Install
dsh plugin --profile web add https://codeload.github.com/UABULAJIQL/dsh-gpt-remote-compaction/tar.gz/refs/heads/mainFully stop and restart dsh web after installation. A browser refresh does not load a new profile bundle.
When installing from a local checkout, use the file: protocol:
dsh plugin --profile web add file:C:/path/to/dsh_plugin/gpt-remote-compactionDo not pass a local directory bare. pnpm treats that form as link:, which links the source without installing the plugin's runtime dependencies; dsh web then fails while loading the profile because @deepseek-ai/dsh-compaction-basic cannot be resolved.
Behavior
- Only routes whose model id contains a
gpt-orchatgpt-marker use remote summarization, includinggpt-5andopenai/gpt-4o; other routes retain DSH's base summarizer. - It runs automatically when DSH
BasicCompactionEnginereaches its context-pressure threshold, during context-overflow recovery, or through manual/compact. - Unless
DSH_GPT_COMPACTION_MODELis set, the remote request uses the GPT model actually routed for the current session. - Remote requests do not inherit the conversation's
reasoning_effort; the remote endpoint and model apply their own default reasoning policy. - DSH owns history selection, retained-tail policy, tool-pairing checks, durable checkpoints, and replay; this plugin only replaces the remote summary request.
Remote endpoint
Defaults: https://api.openai.com/v1/responses, credential reference OPENAI_API_KEY, the current GPT conversation model, and an 8192-token summary output cap.
Environment overrides:
- DSH_GPT_COMPACTION_ENDPOINT: OpenAI-compatible Responses or Chat Completions endpoint
- DSH_GPT_COMPACTION_API_KEY_ENV: DSH credential reference, default OPENAI_API_KEY
- DSH_GPT_COMPACTION_MODEL: dedicated remote compaction model
- DSH_GPT_COMPACTION_MAX_OUTPUT_TOKENS: positive integer output cap
Credentials are resolved from DSH ctx.credentials by reference, with a process-environment fallback. An endpoint containing /chat/completions automatically receives the Chat Completions request shape.
Scope and limitation
Remote summarization applies only to model ids containing a gpt- or chatgpt- marker, including qualified ids such as openai/gpt-4o. Other routes use the base DSH LLM summarizer. OpenAI's native /responses/compact endpoint returns encrypted compaction items, which cannot be represented as a portable text summary in DSH; the plugin fails clearly rather than storing unusable ciphertext.
License
MIT
Copyright (c) 2026 sqnb