Introduction¶
DeepSeek Harness (DSH) is a plugin-based extension system. When developing or debugging agents, the ability to execute commands directly within the web interface is a crucial requirement. Existing solutions often rely on external windows or simulated text output boxes, failing to meet the needs of real-time interaction.
dsh-plugin-terminal-panel solves this problem. It adds a terminal panel to the DSH web interface via a sidebar entry. Located at the same level as the “Chat” panel, it utilizes real PTY (Pseudo-terminal) technology internally, supports replaying the last 256K characters of output, and runs the terminal process within the DSH host process, ensuring the connection remains intact even after a page refresh.
Core Capabilities¶
Sidebar Entry & Active Count¶
Upon loading the plugin, a terminal icon appears in the sidebar icon area. A real-time badge on the top-right corner of the icon displays the number of running terminals; it automatically hides when the count is zero.
Real PTY & Replay¶
The panel runs a real PTY (node-pty / ConPTY), not a fake output box. Terminal output is pushed to the page in real-time via SSE. Since the terminal resides in the host process, the PTY survives page refreshes and replays the most recent 256K characters of output.
Device-Aware Terminal Types¶
The plugin does not hardcode a list of terminals but detects available shells based on the current device. On Windows, it lists PowerShell 7 / cmd / Git Bash / WSL distributions; on macOS, it lists login shells / zsh / bash / fish, etc.; on Linux, it lists types from /etc/shells. Types not installed are displayed in a “Not Installed” section.
Shell Selection & Default Working Directory¶
When creating a new terminal, you can select the shell type and working directory (supporting ~ and relative paths). The default working directory is the user’s home directory (~). The settings panel allows specifying the default terminal type and toggling the injection of Agent tools.
Multi-tab, Rename, and Interaction¶
The panel supports multi-tabbing (up to 12 tabs). Double-clicking a tab name or clicking the ✎ icon allows renaming (supporting Chinese and emoji). Double-clicking the ✕ on a tab closes the terminal (terminating the process tree). Panel width changes automatically resize the PTY.
Self-Drawn Terminal, Theme Following & Input¶
It features a built-in mini VT engine supporting ANSI colors (16/256/True Color), cursor positioning, and wide characters. It supports both light and dark ANSI palettes, following the DSH theme. It also supports text selection mode and Chinese input (IME composition).
Agent Tools¶
The plugin registers 9 terminal_* tools (e.g., terminal_create, terminal_exec, terminal_read) to the DSH tool registry. Models and users share the same batch of terminals. Injection can be disabled with a single click in the settings panel.
Hot Reload¶
Changes to impl.js take effect immediately via POST /__reload, updating tool definitions without requiring a DSH restart. Terminals that are already open will not be replaced.
Installation & Activation¶
Environment requirements: DSH >= 0.2.0-rc.2, Node ^22.19.0 || >=24.0.0.
Run the following command to install:
dsh plugin --profile web add dsh-terminal-panel
After installation, refresh the page, and the terminal icon will appear in the sidebar icon area.
Usage Steps¶
- Click the Terminal icon in the left column to open the terminal panel in the main area.
- Click + New Terminal to start a PTY in the home directory by default; click the ▾ on the right to expand the menu to select a shell or modify the working directory.
- Type commands directly within the panel; Chinese input is supported.
- Rename: Double-click the tab name or click the ✎ on the tab.
- Close: Double-click the ✕ on the tab; the process tree will be terminated.
- Adjust: The panel automatically resizes with the window.
Agent Tools Description¶
List of tools registered after the plugin loads:
terminal_shells: Detects locally available shells and uninstalled types.terminal_list: Lists all current terminals.terminal_create: Creates a new terminal; can specify shell, cwd, and dimensions.terminal_read: Reads terminal output (incremental reading by offset).terminal_write: Sends raw keystrokes to the terminal.terminal_exec: Executes a command and waits for completion.terminal_resize: Changes the terminal row and column counts.terminal_rename: Renames the terminal.terminal_close: Closes the terminal.
Technical Architecture & Security¶
The plugin is implemented in pure JS with no build step and no runtime dependencies. The file structure includes host.js (host entry), impl.js (PTY lifecycle, tool definitions), and client.js (terminal panel, sidebar icon).
Write operations (POST requests) must include the x-dsh-terminal: 1 header. This serves as a security baseline, as cross-site pages cannot set custom headers, thereby preventing third-party pages from driving your terminal.
Conclusion¶
This plugin adds native terminal capabilities to DSH, seamlessly integrating web operations and command-line interaction within the same interface. It is ideal for scenarios requiring direct debugging, script execution, or agent development within the web page.