description: "The shipped shell backend for persistent terminal sessions: interactive bash or pwsh under the shared sandbox policy, with readiness detection and bounded line-oriented output."
English | 中文
dsh-terminal-bash starts a persistent interactive shell under the deployment's sandbox policy: the session stays alive across tool calls, readiness for input is detected, and bounded line-oriented output is retained for reads. It provides the shell backend type and supports bash on POSIX and pwsh on Windows through a shellDialect setting. The same backend composes with local or remote execution worlds through the mounted subprocess provider. Full-screen terminal applications are outside its line-oriented contract.
Mount this backend when a composition needs persistent shell sessions — state such as cwd, exported variables, functions, or running interactive children must survive across tool calls. It is the default shell type: a composition that mounts @deepseek-ai/dsh-terminal without it has no sessions to open.
Choose this backend when work needs an interactive shell or REPL whose state persists: stepping a debugger, exploring in a Python or Node REPL, or returning to a shell after interrupting a foreground command. Choose the one-shot bash tool for bounded commands that should start and end in one call. The bash dialect targets POSIX; the pwsh dialect targets Windows hosts where dsh-pwsh-local can resolve a pwsh executable.
Mount the terminal service, a subprocess provider, the sandbox and policy services, this backend, and a tool package:
- name: '@deepseek-ai/dsh-terminal'
- name: '@deepseek-ai/dsh-subprocess-local'
- name: '@deepseek-ai/dsh-sandbox-local'
- name: '@deepseek-ai/dsh-sandbox-policy'
- name: '@deepseek-ai/dsh-terminal-bash'
- name: '@deepseek-ai/dsh-tool-terminal'
danger-full-access starts the shell directly. Confined modes require a same-world ctx.sandbox provider: without one, the spawn fails before the shell starts. Confinement preparation receives the opening signal; cancellation prevents terminal allocation even if the provider returns later.
| Field | Default | Meaning |
|---|---|---|
backendType |
shell |
Backend type registered on ctx.terminals |
shellDialect |
bash |
Interactive shell stack: bash or pwsh |
shellPath / shellArgs |
per dialect | Shell executable and arguments; empty selects the dialect defaults |
maxReadBytes |
262144 |
Maximum UTF-8 bytes returned by one read or settled send |
timeoutMs |
30000 |
Absolute bound on one send wait |
disposeGraceMs |
3000 |
Grace before teardown escalates to SIGKILL |
The generated configuration catalog is the exhaustive source for every field, including the readiness timings (pollIntervalMs, exactProbeAfterMs, idleSilenceMs, handoffGraceMs), terminal size (rows, cols), and scrollback bounds (scrollbackLines, scrollbackMaxBytes).
Both dialects expose the same readiness contract, so consumers are dialect-agnostic. A send settles when the shell is ready again: after the controlled prompt is verified, after the foreground process group provably waits on stdin (Linux), after output silence (inferred_idle), or at the absolute timeoutMs. An inferred_idle or timeout result does not prove the foreground command exited.
The shell runs under the effective sandbox boundary for its whole life. Changing the effective sandbox mode is rejected while the owner still has open sessions or a spawn in progress — wait for creation to settle and close the sessions first, so a terminal opened with wider access cannot survive a downgrade. The backend supplies only terminal-specific environment overrides; the subprocess provider applies its shared credential scrub.
An open returns the session id and a bounded startup message. Sends settle with one of the four wait reasons and a session status; session_exit means the top-level shell exited. Setup failures reject the open: a missing sandbox provider in a confined mode, a shell that exits during startup, a shell that fails to reach readiness before the startup timeout, or caller cancellation. Cleanup failures reject the close instead of claiming success.
Read these pages when the package-level contract is not enough. They move from the shared terminal model to the service, the tools, and the execution-world substrate.
ctx.terminals surface.This package registers no prompt or tool. Through @deepseek-ai/dsh-tool-terminal or another PTY consumer, the model may receive bounded startup output, send deltas, scrollback pages, readiness reasons, and cleanup errors.
Retained PTY scrollback is not placed in model history until a consumer returns bounded output.
No direct invalidation; consumer results remain append-only.
While this backend is composed, the sandbox-policy owner contributes the capability-neutral sandbox:policy runtime-context clause to prompts.
The policy clause is present on requests while the backend is mounted.
A standing-policy change appends a superseding runtime-context snapshot after retained history.
These limits define where the backend is a poor fit or needs special operational care. They are current package constraints, not a general shell comparison or a task backlog.
[Console]::, which the Windows ACL sandbox's read-only mode may deny. When that prevents marker readiness, startup rejects at timeoutMs instead of publishing an incomplete shell.SubprocessTerminalHandle contract, not this backend's.Runtime invariant: No companion is published. Readiness, terminal buffers, and process-tree state are private per-session implementation state, and the backend publishes no independent lifecycle stream or snapshot.