Preface¶
When developing agents with the DeepSeek Harness (DSH) Web GUI, a common workflow is: describe requirements in the composer, let the model modify code and run scripts. If you only want to check versions, list directories, or execute a single local shell command, going through model conversation adds an extra context round and makes it easier to write irrelevant output into the session.
dsh-cli-mode executes the entire line as a real command in the current session working directory when the first character of the input box is ! or !, without sending it to the model and without generating a conversation turn. Below is an introduction to its capabilities, installation methods, and security boundaries.
What Is This¶
dsh-cli-mode is a DSH bundle plugin published by maintainer Shadoso-w, categorized as client-side: the Host half registers /cli-mode/* routes and executes commands via ctx.shell; the browser half listens to composer drafts, switches command-line mode styling, and displays result cards below the input area.
One-sentence positioning: Lines starting with ! or ! in the Web UI composer are run as shell commands in the session sandbox working directory, with results fed back as cards, and commands and stdout do not enter the model context.
Core Functions¶
Entering and Interaction¶
| Operation | Behavior |
|---|---|
| Input | First character is ! or ! (can have leading spaces, e.g., ! npm --version) enters command-line mode |
| Visual | When command-line mode is active, input area text turns red (#e5484d) |
| Execution | Enter executes; Shift+Enter newline; Esc clears the line and exits command-line mode |
Feedback and History¶
- Success: Shows “Command executed”, displays
`cmd` command has been executed, standard output, and currentcwd. - Failure: Original system error, with “Next Steps” numbered list (generated by
suggest.jsbased on error fingerprints, covering common cases like command not found, permissions, paths, npm/Git, sandbox rejection, timeout, etc.). - Result card displayed below the input area, can click “Clear”; command history persisted per session, path is
${DSH_HOME:-~/.dsh}/cli-mode/history/<session>.json, max 200 entries.
Host API (Browser calls via same-origin fetch)¶
| Route | Request Body | Response Points |
|---|---|---|
POST /cli-mode/exec |
{ command, sessionId, timeoutMs? } |
{ ok, kind, command?, stdout?, stderr?, truncated?, workdir, message, suggestions? } |
POST /cli-mode/workdir |
{ sessionId } |
{ workdir } |
POST /cli-mode/history |
Read: { sessionId }; Write: { sessionId, entries } |
{ entries } |
Tunable Constants (No settings schema, need to modify constants at top of source code)¶
| Constant | File | Default Value | Meaning |
|---|---|---|---|
DEFAULT_TIMEOUT_MS |
lib/index.js |
120000 |
Default timeout per command |
MAX_TIMEOUT_MS |
lib/index.js |
600000 |
Hard upper limit for request timeout |
STDOUT_MAX_BYTES |
lib/index.js |
120000 |
Byte capture limit per stream |
CFG.timeoutMs |
lib/client.js |
120000 |
Browser-side request timeout |
CFG.outputLimit |
lib/client.js |
4000 |
stdout character count displayed in result card |
Current package version is 1.3.0, license MIT, requires Node >= 20.
Installation and Enablement¶
Market/releasable installation is consistent with the official README. Execute under the specified profile (replace <package-or-tarball-or-git-url> with actual package name, tarball, or Git URL):
dsh plugin --profile web add <package-or-tarball-or-git-url>
dsh plugin add runs pnpm in the profile directory and automatically reconciles dsh.profile.bundles based on the dsh.bundle declared by installed packages.
For local development, link the package to the profile’s node_modules, add dependencies and dsh.profile.bundles in <DSH_HOME>/profiles/<profile>/package.json, then restart the profile:
dsh web
Before installation, recommend reading the GitHub repository source code and MIT license; plugin commands execute with current DSH process permissions, through session sandbox policy, equivalent to opening a shell in the harness session environment.
Typical Usage¶
- Start Web:
dsh web, open the corresponding session in the browser. - Enter
!or!as the first character in the composer input, confirm the input area turns red. - Enter command, e.g.,
! npm --versionor! ls, pressEnterto execute. - View stdout,
cwd, or “Next Steps” on failure in the result card below the input area; click “Clear” if not needed.
When troubleshooting authentication and Origin gates, you can call the read-only probe interface in the logged-in page console (does not execute any commands):
await (await fetch('/cli-mode/probe', { method: 'POST' })).json()
Returned fields include authenticated, gateShape, cookiePresent, loopback, etc., used to distinguish “no session cookie” from “connection gate resolution exception”.
Applicable Scenarios and Notes¶
Suitable for: Developers who maintain session workspaces in DSH Web, need to frequently execute short commands (version checks, directory listings, single build/test) and do not want to pollute the model context.
Security and deployment (README explicitly states three gates, all must pass before execution):
- Browser session: Plugin routes reuse the deployment
connectionservice’srequestRejection/isAuthenticated(runtime probes actually existing gates); no session returns 401. - Origin fence: Default same-host loopback scenario; cross-site
sec-fetch-site: cross-siterejects with 403; LAN deployment needs to relax itself. - File sandbox: Through
ctx.shelland session sandbox policy; when write is rejected, returns sandbox failure and widening mode suggestions.
Commands run on the server side as DSH Host identity, not JavaScript in the browser sandbox. Please audit lib/index.js and routing logic yourself before installation; the community catalog SkillHub plugin page and GitHub have no DeepSeek / High-Flyer official affiliation, only third-party plugin entries in the DSH ecosystem.
Conclusion¶
dsh-cli-mode turns the composer’s first character ! / ! into a real shell entry in the session workspace: does not occupy model rounds, has structured “Next Steps” on failure, history persisted per session. For installation or issues, see SkillHub catalog and GitHub: Shadoso-w/dsh-cli-mode.