Files
deepseek-harness/packages/terminal
Yichen Jiang 9757224349 fix(subprocess): fence each signal against current process state
Review found the shared observation defeated the very fence it fed:
it carries the original PID-to-start-time pairing forward, so a
recycled PID still matches it and takes a signal meant for the process
that exited. Capturing it outside the per-member try also let one
failed read abort a whole teardown round, breaking the synchronous
host-exit contract, and an empty round paid a read for no members.

signalProcess now reads ProcessInspector.isAlive immediately before
delivering, from the narrowest per-identity source each platform
offers; signalMembers and waitForMembers return before capturing when
a round has no members. snapshot() keeps serving the readiness poll,
whose per-poll table read stays at one.

Windows enumerates Toolhelp32 lazily on the first tree question, so a
snapshot asked only for liveness — the 25 ms teardown poll — performs
no table walk at all.
2026-08-27 15:19:43 +08:00
..

description, kind
description kind
Package map for the persistent terminal capability family: the owner-scoped ctx.terminals service, the shell backend that starts interactive bash or pwsh, and the six model-facing tools. package-group

terminal/ — persistent PTY capability family

English | 中文

Summary

The terminal/ group gives agents persistent, owner-scoped terminal sessions: shell and REPL state — cwd, exported variables, activated environments, running interactive children — survives across tool calls. Three packages cover the family: terminal/ provides the owner-scoped session service behind ctx.terminals (sessions get opaque ids, and every operation stays fenced to the owning agent); terminal-bash/ starts an interactive bash or pwsh shell under the shared sandbox policy; and tool-terminal/ exposes six model-facing tools with bounded results. A terminal complements the one-shot bash and filesystem tools: use it when work needs interactive stdin or cross-call state. Sessions are process-local and do not survive a harness restart.

Table of Contents


Packages

The family is one session service, one shell backend, and one set of model-facing tools. Each child README owns the full contract; the subsystem reference owns the shared vocabulary and the generated service surface.

Package Role ctx key
terminal/ Session service: owner-scoped sessions with opaque ids, exact-owner fencing, and awaited cleanup ctx.terminals
terminal-bash/ Shell backend: interactive bash or pwsh under the shared sandbox policy, with readiness detection and bounded output registers a backend on ctx.terminals
tool-terminal/ Six model-facing tools with owner isolation and optional background sends registers on ctx.tools

Start with the subsystem reference for the shared types and the service surface, then the Agent Note for the design rationale and deferred boundaries.

Dev Note

Working context for maintainers — click to expand

None.