* feat(release): publish package source, declaration maps, and documentation Every release member publishes its TypeScript source and the declaration maps that resolve into it, and @deepseek-ai/dsh publishes the repository Markdown documentation staged from docs/ at prepack time. The ./src/* export most members already declared now resolves for an installed consumer, and a consumer editor follows a declaration to the implementation. Bundled JavaScript maps stay unpublished; the vendored family and the Desktop runtime file policy are unchanged. Rationale: .agents/notes/implemented/process/2026-10-08-published-source-and-docs.md * feat(release): publish JavaScript maps and compress bundles Every emitted JavaScript map ships beside the bundle it describes, and the workspace build and the client preset compress bundles without mangling identifiers. The documentation payload now mirrors the website publication manifest and is removed again by `postpack`; Desktop and the Python executable exclude the published source, documentation, and maps; `clean` removes a staged copy. Typert's publication contract gains the Remote declaration map. * fix(release): keep node bundles readable for the worker image The browser worker image lowers `yield*` only as a whole statement and rewrites `for await` loops by their source layout, so compressed node-side entries either fail that lowering or lower to unparseable code. Only the browser bundles keep compression, which removes about a third of their text. The bundle-purity assertion now matches the module-loader call regardless of the quote style compression picks, and the release-pack fixture exercises the installed package's new documentation requirement. * feat(release): publish the whole documentation tree `@deepseek-ai/dsh` copies `docs/` in full instead of the website's page set: the maintainer documents, the generated migration records, the translation guidelines, and the `*.i18n.yaml` consistency records ship with the installed package, so the documentation's own links resolve without a checkout. * feat(release): publish the upgrade guides with the documentation The staged documentation keeps the website's page set and adds every `docs/upgrade-guide/` document, which is what an installed reader consults when a released change breaks something. The rest of the maintainer tree stays out. * test(release): expect source and maps in master's new payload cases * feat(release): keep installed docs and source readable in Desktop Desktop keeps the published src/ and docs/ trees inside app.asar, and every model shell call receives DSH_INSTALL_DIR and DSH_NODE_EXECUTABLE so an agent can read them through Electron's Node mode. Staging also generates docs/upgrade-guide/README.md, an index of the upgrade guides grouped by the release they upgrade from. Minified client bundles print string literals with backticks: the worker image packer now recognizes those chunk requests, client license banners are prepended after minification so their text survives, and the affected artifact tests accept either quote. * test(desktop): read archived docs through the Windows PowerShell form Regenerate the config catalog for the shifted shell-env source line. * test(desktop): wait for the GUI-subsystem Electron process from PowerShell * build(release): publish source and maps from the message-quotes package * build(release): publish source and maps from packages new on master * build(release): publish source and maps from the tool-office package
description, kind
| description | kind |
|---|---|
| The on-demand /compact command for interactive compositions: what it does, what you see, and how to mount it. | package-reference |
@deepseek-ai/dsh-command-compact
English | 中文
Summary
dsh-command-compact adds a /compact command to chat UIs: type it and the conversation condenses on demand — the older history is replaced by one summary even before automatic pressure triggers. The command works with any condensation backend and does not consume a model turn; after it finishes you see how many history items were condensed and the estimated tokens saved. While the agent is mid-turn or condensation is already running, it tells you condensation is unavailable. Prompts you send while it runs stay queued and start after it finishes.
Table of Contents
- Use this package
- Understand the implementation
- Further Exploration
- Model Experience
- Known Limitations and Deferred Work
- Dev Note
Use this package
Type /compact in a chat UI when the conversation has grown long and you want to condense it immediately. The shipped dsh base mounts the command next to the default backend, so it is usually already available.
Using the command
| Input | Result |
|---|---|
/compact |
Condense one useful balanced older span even below automatic pressure, then report the replaced history-item count and estimated tokens. |
/compact with no compactable history |
No compactable history yet. — nothing changes. |
/compact <anything> |
Usage: /compact (no arguments) — the command takes no arguments. |
What you see
The command turns each expected failure into a stable message you can show directly; the situation on the left is what produced the message on the right.
| Situation | Message you see |
|---|---|
| Compaction already running, or the agent is mid-turn | Compaction is unavailable because this process has an active compaction, or the agent is not idle. |
| The history changed while condensing | The history selected for compaction changed before it could be replaced. The attempt is recorded in the session log. |
| No useful summary could be produced | Compaction could not produce a useful summary. The attempt is recorded in the session log. |
| Condensation did not finish cleanly | Compaction did not finish cleanly; some session history may have changed. Inspect the current session state before retrying. |
| The conversation could not be saved | Compaction finished, but the session could not be saved. |
Cancelling the command stops the wait: the backend finishes its required cleanup, and the command settles as Compaction cancelled. while the UI stops waiting. Failures other than these expected cases surface as errors rather than being silently converted.
Composing the command
Mount the command registry, one condensation backend, and this plugin:
- id: commands
name: '@deepseek-ai/dsh-commands'
- id: compaction-basic
name: '@deepseek-ai/dsh-compaction-basic'
- id: command-compact
name: '@deepseek-ai/dsh-command-compact'
The shipped dsh base mounts it beside the default backend, and the Web client provides the command adapter. Automation surfaces that compose no command adapter keep automatic condensation only.
What happens to the conversation
When the command succeeds, the selected older span is replaced by one summary and the recent history is untouched; the command reports the number of condensed items and estimated tokens. Prompts you submit while condensation runs are accepted and start only after it finishes — they are not lost or reordered. The command lifecycle is recorded in the session log but never enters model history.
Understand the implementation
Implementation internals — click to expand
This section explains the design decisions behind the command; the observable behavior is fully covered in Use this package.
Design philosophy
The command is built on three commitments:
- Backend-independent control. The handler depends only on
compactNow(agent, signal), so it works with anyCompactionEngineimplementation. The invoking agent is the exact target, and the dispatching UI's cancellation signal is forwarded through the seam. - The command lifecycle stays out of model history.
command/runandcommand/doneare log-only events;sourceEventSeqcorrelates the successful result with thecompaction/summaryevent without relying on text or row adjacency. - Quiescent teardown. The lifecycle effect unregisters
/compactbefore draining already-started handlers, so an aborted command's close and flush work settles before root disposal completes.
Lifecycle and correlation
Every resolved invocation records the executor-owned log-only pair command/run / command/done; neither event joins model history. On success, command/done.sourceEventSeq names the transaction's compaction/summary event so a presentation can fold the command lifecycle into its checkpoint without parsing result text or assuming adjacent rows. The busy outcome is intentionally process-scoped: a live unmatched marker blocks, while a marker older than the newest session/end-seed is stale and does not. The plugin tracks each real handler promise and unregisters /compact before draining handlers that already started, so root teardown cannot pass an aborted command's close or flush boundary. Prompts submitted while compaction runs remain accepted in the agent's ordinary FIFO and start only after the compaction's explicit durability checkpoint and admission release; idle injected context may sit between compaction/start and compaction/end and stays visible after the checkpoint.
Source map
| File | Role |
|---|---|
src/index.ts |
Plugin entry: /compact registration, argument rejection, error-code mapping, lifecycle drain |
Further Exploration
Read these pages when the package-level contract is not enough; they move from the command to the seam, the shipped backend, and the design decisions.
- Compaction seam — the condensation contract this command triggers.
- Compaction basic backend — the shipped backend that condenses automatically and on demand.
- Commands package — the registry and dispatch contract behind chat commands.
- Compaction subsystem reference — the condensation vocabulary, results, and service behavior.
- Queued manual compaction reference — how on-demand condensation serializes against running turns.
Model Experience
Human /compact control
What the model sees
The slash input and direct result never enter a model request. An accepted compaction separately replaces an older span with the backend's user-role checkpoint inside a standalone compaction/* { turn: null } bracket.
Token effect
The command lifecycle adds no model tokens. A successful compaction reduces later requests by replacing the selected span with one framed summary; summarization itself is one auxiliary request.
KV Cache effect
Discovery and command bookkeeping do not affect the cache. The accepted surface replacement invalidates reuse from the first shadowed history token.
Known Limitations and Deferred Work
These limits define when the command is a poor fit; they are the current package constraints.
- Idle-only —
/compactreports that condensation is unavailable when a turn or already accepted waking prompt has right of way; the command itself is not queued. - No range or policy arguments — the argument-free form keeps behavior stable across command adapters. Explicit ranges remain the programmatic
compactRegion()path. - Command adapters only — surfaces without
ctx.commandscannot invoke it and rely on automatic pressure compaction.
Dev Note
Working context for maintainers — click to expand
This Dev Note is working context for maintainers and is explicitly non-authoritative; shipped behavior lives in the sections above, the package code, and the linked Agent Notes.
- Queued commands, undecided — a
/compactsubmitted while a turn has right of way reportsbusy; queuing the request instead of rejecting it remains an open direction. - Range and policy arguments, undecided — argument-free stability is deliberate; adding arguments would need a shared grammar across every command adapter.