description: "The model-facing persistent pwsh tool for users and maintainers choosing, configuring, or debugging owner-scoped PowerShell state that survives across calls."
English | 中文
dsh-tool-pwsh-persistent gives each agent a pwsh tool that preserves its current directory, environment variables, functions, and background jobs across calls. Commands for one agent run sequentially, while different agents keep separate shell state. Choose it for multi-step PowerShell work; use dsh-tool-pwsh when every command should start clean, and use a terminal tool when commands require interactive stdin. Configure a pwsh-capable backend and per-command timeout; timeout or explicit exit discards the shell, so the next call starts fresh.
Load this plugin in any composition where the agent should keep PowerShell state between commands — the persistent counterpart of dsh-tool-pwsh for work that needs cross-call state. It registers the pwsh tool and requires the ctx.tools and ctx.terminals services plus an owning agent session at execution time.
Choose the persistent tool when work depends on cross-call PowerShell state, and choose dsh-tool-pwsh when every command should start from a known, clean environment. Commands that need interactive stdin are unsupported here — a foreground child that reads input blocks until the command timeout, which resets the shell — so interactive work belongs to the terminal tools.
The default shell backend starts a PowerShell shell through a dsh-terminal-bash instance configured with shellDialect: pwsh; deployments may register another pwsh-dialect PTY backend and select it by name.
- name: '@deepseek-ai/dsh-terminal'
- name: '@deepseek-ai/dsh-terminal-bash'
config:
shellDialect: pwsh
- name: '@deepseek-ai/dsh-tool-pwsh-persistent'
| Field | Default | Meaning |
|---|---|---|
backendType |
shell |
Registered PTY backend used for each agent's shell |
timeoutMs |
300,000 |
Wall-clock limit for one command; timeout closes the shell |
maxOutputChars |
16,000 |
Maximum retained command-output characters; fixed diagnostics are added afterward |
description |
Run commands in a persistent PowerShell shell. State, including the current directory and exported environment variables, persists across calls for this agent. |
Model-facing environment contract; deployments may describe their environment |
The generated configuration catalog is the exhaustive source for every accepted field and its JSDoc.
Commands share one shell per agent, so cwd, $env: variables, functions, and background jobs persist across calls. Results exclude the private completion markers, the shell prompt, and the echoed input line. A non-zero wrapped command appends [exit code: N] — the exact native exit code when the command ran a native program, 1 for a terminating PowerShell error. A shell that exits before reporting that status instead appends [shell exited: code N], [shell killed by signal: SIG], or [shell exited] (Windows forced termination reports exit 1 without a signal), then resets and tells the agent the next call starts fresh. Long output keeps the earliest retained prefix plus a clipping notice; if the terminal has already dropped that prefix, the result says so explicitly.
A call without an owning agent session fails with pwsh requires an owning agent session, and a composition without a pwsh-dialect PTY backend activates the tool but fails its first call with no PTY backend registered for "shell". A model redefinition of the prompt function removes the readiness marker, and the shell then settles on the silence tier instead of the marker fast path. Raw ESC characters inside a command are consumed by PSReadLine before execution and are unsupported. A timeout or cancellation closes the uncertain shell, discards the result, and reports the reset.
Read these pages when the package-level contract is not enough. They move from the terminal family to the seam, the backends, and the design notes behind the persistent-shell design.
ctx.terminals service behind the tool.shellDialect: pwsh.pwsh argument schema.The generated pwsh schema, including the configured description. The plugin contributes no standalone system-prompt section; the deployment owns persona and environment guidance.
Fixed schema cost while pwsh is visible.
Prefix-stable while the configured description and schema remain unchanged.
Commands share one shell per Agent, so cwd, $env: variables, functions, and background jobs persist across calls. Results exclude private completion markers, the shell prompt, and the echoed input line (PSReadLine renders submitted input back into the stream; the marker-anchored extraction and the wrapper-source strip remove it). A nonzero wrapped command appends [exit code: N] — the exact native exit code when the command ran a native program, 1 for a terminating PowerShell error. A shell that exits before reporting that status instead appends [shell exited: code N], [shell killed by signal: SIG], or [shell exited] when the backend supplies neither (Windows forced termination reports exit 1 without a signal), then resets and tells the model that the next call starts fresh. Long output keeps the earliest retained prefix plus a clipping notice; if the terminal has already dropped that prefix, the result says so explicitly. Timeout returns bounded partial output, closes the uncertain shell, and reports the reset.
Data-dependent. maxOutputChars bounds retained command output; fixed clipping, lost-prefix, status, timeout, and reset diagnostics can extend the result.
Append-only tool results follow the reusable request prefix.
These limits define when the tool is a poor fit or needs special care. They are current package constraints, not a task backlog.
stty -echo equivalent. The marker-anchored extraction excludes the echo in complete results; the wrapper-source strip covers fallback paths, but a wrapper that wraps across the terminal width may leave a partial echo in partial-output results, bounded by maxOutputChars.[char]27-built OSC markers, backtick escapes for the body).prompt function removes the readiness marker — the shell then settles on the silence tier instead of the marker fast path.[Console]:: encoding pin and prompt marker. Commands can still settle through the printable prompt and silence tier, but non-ASCII output may follow the host code page.