Files
deepseek-harness/packages/storage/storage
Turtle 38c7a9fbf4 feat(release): publish package source, declaration maps, and documentation (#5884)
* 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
2026-11-05 00:22:36 +08:00
..

description, kind
description kind
Storage hub (ctx.storage) for compositions and maintainers choosing, mounting, or debugging named storage backends and data-form facilities. package-reference

@deepseek-ai/dsh-storage

English | 中文

Summary

Use dsh-storage to keep typed application data durable without adding it to session history. Mount it with a supported storage medium and domain configuration, then callers can access records through the public ctx.storageDomain API. Choose it for workspace records, session sidecars, or other application state that must survive restarts without becoming session events. It is available only to host code and has no model-visible effect; compositions that do not need such data can omit it.

Table of Contents


Use this package

Use this package to give a composition durable, non-session storage: mount it together with backend and domain-form packages, and host-side packages read and write validated records through ctx.storageDomain. The hub itself adds nothing observable — it is the meeting point that makes the family work, and everything below is what a composition gets from it.

When to use it

Mount the hub whenever any package in the composition persists data that is not a session event log — workspace records, session sidecars. It is required by the domain form and both shipped backends, so the storage rows of a composition are storage plus a backend plus storage-domain. Skip the whole group when nothing stores such data; the agent loop never needs it.

A minimal composition

- name: '@deepseek-ai/dsh-storage'
- name: '@deepseek-ai/dsh-storage-json'
  config:
    root: /var/lib/dsh/data
- name: '@deepseek-ai/dsh-storage-domain'
  config:
    backend: json

With these rows, the json backend registers itself and the domain data form mounts; a consumer such as dsh-workspace then opens its domain over the routed backend and reads and writes records through ctx.storageDomain. Several backends can stay mounted side by side; which backend serves which domain is the domain form's configuration, never a hub-wide choice.

What you get

  • A mounted backend resolves by name, so a composition with both shipped backends can route each domain to either medium by configuration.
  • A mounted data form resolves as ctx.storage.<form>; the domain form is additionally served directly as ctx.storageDomain.
  • Misconfiguration fails loud with a stable StorageError code instead of silently deferring: an unknown backend name, a form read before its owner mounts, or a duplicate registration all throw.

Failures and recovery

  • backend-not-found — the domain form routes to a backend that is not mounted; add the backend package. The form waits for every configured backend to register, so row order is not a failure mode.
  • form-not-mounted — a consumer reads ctx.storage.domain before dsh-storage-domain loads; mount the domain row before the consumer.
  • duplicate-backend / duplicate-mount — the same name or form registers twice; that is a composition bug and fails loud.

Understand the implementation

Implementation internals — click to expand

The hub is a pure registration table with two faces, designed so backends and data forms stay replaceable without the hub knowing their internals.

Design concept

  • Backends own media, data forms own semantics. The hub never performs IO; it only holds the name → backend table and the form-name → facility map. Backend packages register their medium owner, data-form packages mount their facility, and neither needs the other's details.
  • Multiple backends stay side by side. Which backend serves which consumer is the consumer's configuration (the domain form's route table), never a hub-global either-or.
  • Registration and mounting are effects. register() and mount() return disposers; disposal removes only that registration's contribution, and does not close the backend — the owning plugin closes it after unregistering.
  • Activation cannot race registration. Each backend plugin also publishes a lifecycle-only service key (storage.backend.<name>); form providers inject those keys, so the domain form activates only after every configured backend registers, while callers still resolve backends by name through the hub.

The backend contract

src/backend.ts is the normative contract for backend implementers; the shared conformance suite in tests/contract.ts checks whole-unit behavior on both shipped backends. A backend owns exactly one medium and exposes optional data-shape facets; kv is the only facet. Opening a unit yields a handle for opaque JSON values whose atomicity and durability follow the selected layout. Unit and table names must match UNIT_NAME_RE. Whole-unit keys stay opaque; JSON per-record keys become path-safe file segments. The caller orders concurrent writes. Reads accept the current or declared compatibleVersions; unsupported unit stamps reject version-mismatch, while unsupported JSON per-record documents read as absent. Mutations atomically stamp the current version with their data; a missing-key delete does not restamp. Domains own value conversion, and backend implementers must preserve these semantics; see domain versioning for mixed values, failure recovery, and upgrades.

Source map

File Role
src/index.ts Plugin entry: Storage service, form mounting, StorageForms map
src/registry.ts BackendRegistry: name → backend table, registration disposers
src/backend.ts The backend contract: facets, units, UNIT_NAME_RE
src/error.ts StorageError codes shared by the hub and every backend
tests/contract.ts The shared conformance suite run against each backend

Further Exploration

Read these pages when the hub's view is not enough: the subsystem reference is the authoritative contract, and the Agent Note records the family design and its deferred work.


Model Experience

Backend and form registrations

What the model sees

Nothing. ctx.storage is a host-side registration table: the hub registers no tools, injects no prompts, and writes no session events, so no request field ever carries this package's data.

Token effect

Zero direct tokens on every request.

KV Cache effect

Independent of live requests: the hub never touches a request prefix, so it cannot invalidate provider cache reuse.

Known Limitations and Deferred Work

These limits define what the hub cannot do. They are current package constraints, not a task backlog.

  • kv is the only data shape — a backend implements one facet; the log facet for session event logs is deferred to the session-backend migration (Agent Note).
  • Forms resolve lazily — reading ctx.storage.domain before the domain plugin mounts throws form-not-mounted; assemblies order plugins accordingly rather than silently deferring.

Dev Note

Working context for maintainers — click to expand

None.