Files
deepseek-harness/apps/cli
Yudong Han c72724b42e feat(office): add experimental office preview by frame forwarding bundle (#8441)
* feat(office): add frame-forwarded preview and bundle integration

* feat(office): present document and slideshow frames with video

* test(office): simulate video frame cloning across preview sessions

* fix(frame-forwarding): preserve document proportions during resize

* fix(office-preview): resume frames after tab switches and restore margin dragging

* refactor(office-preview): share submitted geometry and simplify fixture cleanup

* refactor(office): remove obsolete viewport discard comparison

* refactor(office): take shared textures from the dsh-shared-texture services

The Office preview spec helper imported the bridge and lease types from the removed @deepseek-ai/dsh-shared-texture-client-types package, passed frame forwarding the failureSource() adapter that its Client service no longer declares, and the specs stubbed globalThis.dshDesktop, which frame forwarding no longer reads.

The helper imports the types from @deepseek-ai/dsh-shared-texture/client and drops the adapter, and the specs stop stubbing dshDesktop. The shared-texture Agent Note drops the PR citation from its NodeNext declaration check sentence, and the README model-experience registry rewords the dsh-shared-texture entry.

* fix(office-preview): take the React 19 ref types

The client moved to React 19, whose types require an initial value for `useRef` and type a DOM ref created with `null`
as `RefObject<T | null>`. Refs that start empty now pass `undefined`, the surface takes its element refs as
`RefObject<HTMLDivElement | null>`, and `RefObject` replaces the deprecated `MutableRefObject`, as the rest of the client
does.

* fix(office-preview): align the producer and receiver tests on Kit 0.2.4

* chore(office-preview): refresh the client slot catalog

* fix(office-preview): drain document releases and handle slideshow frame failures

* refactor(office): expose Kit discovery and editor opening on officeKit

* fix(office-preview): preserve slideshows across same-client event reconnects

* refactor(frame-forwarding): use single-producer channels and retain Office slide previews

* fix(plugins): show native Office preview only in Desktop

* fix(office-preview): reconcile slideshow and document lifetimes on reconnect and refresh

* fix(office-preview): simplify slideshow recovery and retain hidden fallback views

* refactor(office-preview): type document operations and detach playback before refresh

* feat(office-preview): lease documents by tab and reopen expired previews

* fix(office-preview): retire slideshow mounts without blocking channel recovery

* fix(office-preview): restore the last shown slide on channel reconnect

* fix(office-preview): preserve channel loss while waiting for the first viewport

* fix(office-preview): cancel slideshow readiness when playback stops

* test(web): exclude desktop-only bundles in plugin-config e2e

* fix(office): cancel retired viewport waits and count successful redraws

* fix(office-preview): await timed-out open cleanup on plugin disposal
2026-11-27 16:10:38 +00:00
..

@deepseek-ai/dsh

English | 中文

The dsh command is the sole supported Node application launcher: profiles are ordered stacks of plugin-bundle patch layers under the user's own overrides. SDK and ACP are profiles, not separate public bins. The Python runtime wheel packages this same command; the SDK defaults to sdk, and the minimal example selects sdk-minimal. src/args.ts owns the command grammar, and src/bin.ts loads only the selected runner. Invalid commands, options from another mode, and fatal configuration or boot failures exit nonzero.

Entry modes

Command Purpose
dsh <name> / dsh --profile <name> Boot the named profile under $DSH_HOME/profiles/<name>.
dsh --profile <name> --from-default-profile <template> Replace a custom profile with a fresh copy of a shipped template, then boot it.
dsh --profile acp Serve automation clients over ACP stdio until disconnect.
dsh --profile headless "job" Run one fresh persisted session, print the final answer, and exit.
dsh --profile sdk Serve SDK clients over JSON-RPC stdio until shutdown or disconnect.
dsh --profile sdk-minimal Serve SDK clients with the standalone minimal agent tree.
dsh web Boot the Web profile.
dsh plugin --profile <name> <pnpm args> Manage a profile's plugins by forwarding to pnpm in the profile directory.

The invoking directory is the default workspace root. The web, headless, sdk, sdk-minimal, and acp profiles auto-initialize on first use from shipped templates. Create or reset another profile at a non-shipped name with --from-default-profile, or initialize a base-backed profile through dsh plugin. The desktop name is reserved for the Electron-owned profile, so the CLI rejects boot and config-dump requests for it. The npm CLI also rejects its plugin-management requests; the Desktop-installed command can manage the initialized Desktop profile using that installation’s runtime.

App arguments

The launcher parses only its own flags and hands everything after them to the booted profile, where any injected app plugin may parse the shared immutable snapshot (dsh-cmdline). The first token the launcher does not recognize starts the app's arguments:

dsh --profile web --port 8080       # --port belongs to the web app
dsh --profile tui --resume <id>     # example, assuming the tui profile is installed; --resume belongs to the terminal app
dsh --profile headless "run the tests"
dsh --profile web --help            # the web app's flags, not the launcher's
dsh --help                          # the launcher's own help

Profiles

A profile directory holds a package.json (out-of-tree plugin dependencies plus the profile manifest dsh.profile with its ordered bundles list) and a cordis.patch.yml (the user's own patch layer). dsh-hmr, when enabled in YAML, watches the profile manifest, the profile and home patch files, and every --patch overlay file, then recomposes all layers through one serialized reload. Without HMR, changes apply on restart, except that a Config Editor save applies the current contents of every patch and overlay file. Edits arriving during watcher registration use the same nonfatal reload reporting as later edits. Plugin Manager shares package operations and the profile write lock with dsh plugin; package updates retain disabled bundle selections. CLI package commands inherit authentication variables and terminal descriptors, including interactive build approval; service calls retain their scrubbed environment and captured diagnostics.

Installation and profile startup enforce the declared engines.dsh range, or DSH peer ranges when it is absent, against the same runtime version shown by dsh --version. Incompatible plugins require an explicitly acknowledged exact-version exemption. The plugin manager's compatibility reference documents version-exemptions, allow-version, revoke-version, persistence, and risks.

The tree composes over an empty root:

  • each bundle's patch in dsh.profile.bundles order
  • then the profile's cordis.patch.yml, then the home-level $DSH_HOME/cordis.patch.yml
  • then --patch overlays

Bundles named in dsh.profile.bundles resolve from the dsh installation first (@deepseek-ai/dsh-base, @deepseek-ai/dsh-web-app, @deepseek-ai/dsh-headless, @deepseek-ai/dsh-sdk-app, @deepseek-ai/dsh-sdk-minimal, @deepseek-ai/dsh-acp-app), then from the profile's own node_modules, where pnpm installs out-of-tree plugins.

Use --dump-default-config and --dump-config to inspect the composed tree without booting it. --dump-config-schema imports the composed tree's declared plugin schemas and prints JSON Schema for entries and patches instead of configuration values; read the schema-dump safety and scope before inspecting untrusted plugins.

The CLI behavior reference owns exact layer precedence, flags, shutdown behavior, deployment defaults, and source execution. The startup and reload failure table compares optional and required plugin failures with configuration HMR.

Optional overlays

config/examples/ ships opt-in overlays for GitHub review webhooks, memory MCP servers, cross-Session messages in Web profiles, and runtime Cordis tools. They are never part of a default profile; the user guides and developer practice guides own setup and safety instructions.

Installed payload

The published tarball carries the bundled runtime under lib/, the TypeScript under src/, the declaration and JavaScript maps beside the files they describe, and the documentation under docs/. Only prepack stages docs/, and postpack removes that copy again, so a reader of the working tree sees whatever the checkout holds.

docs/ holds the documentation website's pages plus every upgrade guide, with the assets those pages reference. docs/upgrade-guide/README.md is generated during staging: it groups the guides by the release each v<T> directory upgrades from and lists each guide's title, English and Chinese descriptions, and relative paths. The Desktop application carries the same docs/ and src/ inside its app.asar. The generated persistence-changes/ records, the i18n/ guidelines, and the *.i18n.yaml consistency records are not published. Its pages keep the repository's relative links, so a link into ../packages/** or into the omitted persistence-changes/ records resolves only in a checkout.

Development

Production runs require built package and frontend artifacts. From the repository root, run pnpm run build separately, then use pnpm dsh <args...> to run the TypeScript entry and forward every argument; the source-execution reference owns the module-resolution contract.

The @deepseek-ai/dsh/profile-boot export provides the shared profile lifecycle to the Desktop host. A resolved application profile supplies its own installation anchor for runtime package resolution while retaining the Harness home patch, proxy environment, telemetry switch, patch reload, and bounded shutdown.

Packaged installations call the same runCli() entry with their package-manager executable. The Desktop carrier also enables plugin operations for its initialized profile; npm launches omit these options. Installation-owned package environments apply only to plugin package operations; the invoking directory, ordinary profile selection, and agent-shell PATH retain their CLI meanings.

The Web failure matrix runs the built CLI through startup failures and native configuration HMR with awaitWriteFinish enabled in test:expected. It verifies authenticated HTTP responses, diagnostics, recovery, process exits, and disposal without model API calls; the startup acceptance also covers the shipped required Web dependencies and port conflicts.