Files
deepseek-harness/packages/terminal
Yichen Jiang a8dc6f9776 fix(pty): keep the controlled prompt so persistent bash settles fast
tool-bash-persistent overwrote the backend's PS1, so terminal-bash prompt
readiness never matched and every send degraded to the 3.5s silence tier
(idleSilenceMs + handoffGraceMs) under production defaults.

The controlled PROMPT_COMMAND now re-asserts PS1 before every prompt, so an
in-shell override never survives to the next prompt. The tool initializes
with stty -echo alone and detects the no-end-marker fallback through the
seam's stdin_read wait reason instead of matching its own prompt text.

Tool calls drop from 7180/3560/3566 ms to 355/88/91 ms (spawn+init+echo,
echo, pwd; darwin, production defaults). The loader composition suite now
pins the fast path by pushing idleSilenceMs beyond the send bound, and a
real-PTY case proves PS1 self-healing.

Fixes #2585
2026-08-15 11:06:57 +08:00
..
2026-08-13 19:52:05 +08:00
2026-08-13 19:52:05 +08:00

terminal/ — persistent PTY capability family

English | 中文

PTY stands for Pseudo-Terminal(伪终端). This capability provides persistent, owner-scoped terminal sessions for workflows that require state across tool calls or interactive stdin. PTY complements the one-shot bash and filesystem tools; it does not replace their stronger per-operation contracts.

Package Role ctx key
pty (@deepseek-ai/dsh-terminal) Backend registry, branded ids, exact-Agent ownership, session operations, and awaited cleanup ctx.terminals
terminal-bash (@deepseek-ai/dsh-terminal-bash) Shell backend over ctx.subprocess.spawnTerminal: readiness detection, bounded terminal state, sandbox policy, and session operations registers on ctx.terminals
tool-terminal (@deepseek-ai/dsh-tool-terminal) Six model-facing tools and generic task integration for background sends registers on ctx.tools

The design and deferred boundaries live in the persistent PTY Agent Note.

The subsystem reference — ids, backend/session contracts, send readiness, bounded reads — is docs/subsystems/terminal.md; design and deferred boundaries in the persistent PTY Agent Note.