Skip to main content
M

dsh-terminal-command

minimiao/dsh-terminal-command

A Claude bash mode-like terminal command experience for DSH, allowing users to run commands manually, view live output, and return execution results to the model. Use /sh <command> to submit a terminal command.

Install

dsh plugin --profile web add github:minimiao/dsh-terminal-command

README

Terminal commands

A user-submitted terminal command runs on the execution host and appears in the conversation as an application-rendered card. The card displays the submitted command, captured standard output and standard error, execution status, duration, and retained output count. Its structure and styling are fixed in the Client component; model output does not control them.

Use

Submit /sh <command> in a connected DSH Web conversation. The input after the command name is passed to the active shell provider without trimming or rewriting it. The card itself does not display the trigger syntax.

The card's Stop button sends a Host request directly, without a model message or an extra confirmation. Stopping remains transitional until the process actually exits. Existing output stays visible, and a failed stop request does not mark a running process as terminated.

UI labels follow the application's selected locale through fixed English, Chinese, Japanese, and French dictionaries. Unsupported locales fall back to English. Command text and program output are not translated.

Execution authority

Commands execute with the current operating-system account's access. The call uses danger-full-access: this plugin adds neither a filesystem sandbox boundary nor an approval prompt. It does not grant administrator or root privileges, change the session policy, or widen the permissions of agent tools.

DSH's normal authenticated Connection transport protects the browser routes. This plugin adds no second user-source gate. A Host/plugin caller that already has access to the command registry can invoke the command as part of that existing authority. No model-callable execution or stopping tool is registered.

Output and context

The UI reads snapshots of Host-owned captured output, independently of model context. It displays output as text, not HTML. Stream channels remain separate. Truncation and unavailable records are shown explicitly.

By default, each stream retains up to 65,536 UTF-8 bytes for the card. Each stream contributes at most 16,384 UTF-8 bytes to completion context. The execution provider may retain a spill log for larger output; that log's size, lifetime, and access depend on the provider. The card and context identify available log paths. Arbitrary output beyond a provider's capture limit is not guaranteed to be retained.

On completion, an identified record containing command text, directory, execution platform, output, exit status, timing, and truncation is injected into the receiving Agent inbox and flushed. This does not wake the Agent. A running Agent reads it at a subsequent admitted step; an idle Agent reads it after later waking input. The UI distinguishes pending, delivered, failed, and unavailable delivery.

Captured output is untrusted program data. Neither rendering nor context framing turns it into instructions.

Persistence and lifecycle

Bounded authoritative records use the DSH JSON storage backend under the terminal_command unit. Completed records survive restart. Work interrupted by a restart is marked interrupted and is not rerun. Uncertain completion delivery is marked unavailable rather than blindly injected again. A crash can prevent delivery; the plugin does not claim exactly-once delivery across crashes.

The plugin owns running processes and their asynchronous finalization. Unloading it or disposing the receiving Agent requests termination and waits for completion before releasing its storage. Observers may disconnect without stopping execution.

Requirements and limitations

  • Runtime contract: DSH 0.2.2-rc.5.
  • Host services: commands, shell, agents, workingDirectory, sessions, systemPrompt, connection, storage, and the JSON storage backend.
  • Client services: slots and locale in the served Web GUI.
  • Shell syntax depends on the active provider: Bash and PowerShell commands are not automatically translated.
  • Each invocation starts a fresh provider-managed command. Directory changes or environment exports inside one command do not change subsequent commands.
  • Interactive terminal input and PTY applications are not provided.
  • Generated Client code is included. No installation hooks or additional package dependencies are required.

Source maintenance

The fixed UI component, stylesheet, state mapping, transport, and locale dictionaries are under ui/. Run node scripts/build-client.mjs after changing them to regenerate the distributable Client module. Browser rendering must be verified in the installed application; offline tests and syntax checks are not a substitute for that check.

Related plugins