This guide covers building, testing, packaging, and installing dsh-plugin-message-edit.
dsh-plugin-message-edit/
├── lib/
│ ├── index.js # Host-side Cordis plugin (routes, session log processing)
│ ├── tree-logic.js # Pure tree algorithms (shared with client and tests)
│ └── client.js # Generated client bundle (wrapped from plugin.client.js)
├── plugin.client.js # Source client-side UI and React components
├── scripts/
│ └── build-client.mjs # Build script wrapping plugin.client.js into lib/client.js
├── test/
│ └── tree.test.mjs # Automated test suite (36+ unit tests)
├── cordis.patch.yml # Service dependencies and injection metadata
├── docs/ # Technical architecture and data model documentation
└── package.json
The client component plugin.client.js is written in browser-compatible JavaScript. Before distribution or testing, it is wrapped with a Cordis module preamble into lib/client.js.
npm run buildExecutes node scripts/build-client.mjs to regenerate lib/client.js.
node scripts/build-client.mjs --checkExits with code 1 if lib/client.js is out of date relative to plugin.client.js.
The project includes an automated test suite verifying tree construction, sibling fan-out, ghost recovery, active path calculation, and ring index calculation.
npm testAutomatically builds the client first, checks that it matches the source, then
runs the Node test runner. Install development dependencies with npm ci on a
fresh checkout before running tests (Node 22.19+ or Node 24; official DSH 0.2.2-rc.1 host acceptance requires Node >=24.9.0).
test/tree.test.mjs: 36 assertions covering branch and version-tree behavior.test/client-images.test.mjs: loads the generated client through its module loader, mounts its registered user-message component using React and jsdom, and checks image delegation, multiple/image-only messages, old-host fallback, text-only messages, Quote text-interaction source marking, and entering/cancelling an edit. Host services and the image gallery are test doubles; these are not full DSH integration tests.test/client-locale.test.mjs: exercises the generated client against the published@deepseek-ai/dsh-client-localeruntime (test/fixtures/locale-runtime.mjs), checking 45-key parity, placeholder parity, Russian lookup and interpolation, language-catalog registration (Русский),ru-RUbrowser detection, English fallback, preloaded language-pack respect, and disposal cleanup.test/client-registration.test.mjs: checks module dependencies and visible failures when services or registrations are unavailable.test/client-sidebar.test.mjs: checks opt-in sidebar grouping, nested/orphan lineage, immutable catalog projections, selected/running and subagent activity state, side conversations kept out of families, the grouped row staying selected while a subagent or side conversation of a hidden version is open, actionable status priority (approval/plan-review/questionand unread completion), the three open-a-conversation modes and migration from the former remember switch, family renames through the native rename dialog, archive-filter search deduplication and target routing, and restoration on plugin unload.test/session-record.test.mjsandtest/host-compatibility.test.mjs: cover legacy/current session shapes, live/resumed edit requests, retained images, retry ancestry, nested version markers, cache invalidation, refusing a version whose history and prompt exceed the model window (with compaction before and inside the edited turn) while allowing one below it whatever output the request reserves, checking that before stop-on-edit cancels anything, side and subagent sessions outside version families, and carrying a user rename into new versions.
GitHub Actions runs these checks for pull requests and branch pushes, on
Linux (Node 22 and 24) and Windows (Node 22), plus official DSH host acceptance
(0.2.0-rc.2, 0.2.1-rc.2, 0.2.1-rc.5, 0.2.2-rc.1, 0.2.2-rc.3, 0.2.2-rc.4, 0.2.2-rc.5, 0.2.3-alpha.2, and 0.2.3-alpha.3 on Linux and Windows with Node ^24.22.3; both alphas also run the SQLite store). It also runs:
npm run check:packageThis creates a real npm archive in a temporary directory, verifies that runtime
entry points are present and development-only directories are absent, checks
the host entry's syntax, and removes the temporary archive. npm pack and
npm publish now build the client automatically through prepack, preventing
an old or missing generated client from being shipped.
The workflow needs to be pushed to GitHub to run there. Making its checks mandatory before merging is a separate repository ruleset/branch-protection setting; adding the workflow alone does not block the Merge button.
Before accepting an image-rendering change, also check it in a running DSH: send text with one/multiple images and an image-only message, open an image in the native viewer, enter/cancel an edit, then verify the original attachments survive an edit submission. CI's gallery double cannot verify native image loading, lightbox behavior, or compatibility with DSH's module injection.
To add new tests, edit test/tree.test.mjs.
test/fixtures/dsh-acceptance.mjs is an offline model adapter and live/cold
session fixture for the official hosts in the CI matrix above and 0.2.3-alpha.1.
DSH 0.2.3-alpha.2 and 0.2.3-alpha.3 require Node ^24.22.3 || >=26.13.1. The listed 0.2.2
hosts and 0.2.3-alpha.1 require Node >=24.9.0. Earlier hosts support Node
22.19+ or Node 24. Build 0.2.3-alpha.1 from its tag because its npm package
fails at startup. Mount the fixture only in a new temporary home whose name
contains message-edit-dsh-qa-.
Set DSH_HOME to that home and DSH_QA_MODULES to the official runtime's
node_modules directory. Use a separate Web profile with the base/Web bundles,
a built copy of this plugin, and a loader entry for the fixture. Never point
this fixture at an existing user's DSH home.
Once the isolated server prints its URL, run:
node scripts/verify-dsh-acceptance.mjs http://127.0.0.1:61587 fresh "<printed launch URL>"Since DSH 0.2.3-alpha.1 the Web server authenticates plugin routes; the
verifier exchanges the printed launch URL's token for the host's session cookie.
The verifier exercises real HTTP edit/retry operations, local model execution,
image retention, unchanged source messages, and nested branch markers. On hosts
with Agent Team mode (rc.3 and later), it turns the mode on for the live source
and requires every branch to keep its source's mode, including a branch resumed
after restart. Restart
the same isolated server and repeat to exercise persisted branches. The fixture
adds /qa/state, /qa/followup and /qa/team endpoints solely for this disposable test.
Browser acceptance additionally checks the settings entry, version switcher,
thumbnails, and native original-image viewer. On rc.3, rc.4 and rc.5, verify-dsh-browser.mjs
also uses the import dialog and checks imported file cards, images, editing,
sidebar grouping, the version tree, and version switching. No remote API key is needed.
For an automated fresh-boot and restart run, set DSH_QA_MODULES to the
official runtime's node_modules directory and run:
node scripts/run-dsh-acceptance.mjsSet DSH_QA_STORAGE_BACKEND=sqlite to replace the JSONL session store with
DSH's opt-in SQLite provider (0.2.3-alpha.1 and later).
The runner owns and removes a unique temporary home, boots the official CLI
on an OS-selected port, runs the verifier, restarts the host, and repeats.
The restart pass explicitly resumes and retries an already seeded branch.
When the host includes the chat-import bundle (rc.3, rc.4 and rc.5), the runner also uploads a
synthetic DeepSeek ZIP through the owner-authenticated import route and repeats
headerless edit/retry after restart, before any native model turn. This covers
the selected export path, stored images, synthetic file references, web-search
tool results, error-ended turns, workspace attachment, inherited seed boundaries,
and temporary source-agent release. Each imported child must record the default
standard preset and offer its tools (including read and web_fetch) in the
actual model request, so a successful reply from a bare agent cannot pass.
The fixture uses an offline default model;
remote model services and real personal exports are not required.
CI runs this on Linux and Windows in addition to the regression suite.
npm run build
npm packThis produces a tarball: dsh-plugin-message-edit-1.6.0.tgz.
To install into the DSH Desktop profile:
dsh plugin --profile desktop add file:/path/to/dsh-plugin-message-edit-1.6.0.tgzOr sync files directly into ~/.dsh/profiles/desktop/node_modules/dsh-plugin-message-edit/.
Restart DSH Desktop to reload the host-side plugin in the server process and mount the updated client interface.
Before announcing a release, follow the release procedure
and run npm run check:release -- VERSION. Publishing to npm alone does not
create the GitHub tag or downloadable release archive.