hive.terminal-tools-pty-sessions
必备用于需要状态、交互式程序或响应密码/确认提示的场景。
持久会话可能暴露凭据或长期占用终端资源,需要谨慎授权
介绍持久 PTY 会话用于驱动交互式 REPL、保持环境与处理交互提示的模式。
需要在多次交互中保留 shell 状态(cd、环境变量、sourced 脚本)或驱动交互式 REPL(python -i、mysql、psql、node)时用。持久 PTY 会话把终端行为还原,支持 prompt-sentinel、raw I/O 等交互模式。它有严格的一次会话只跑一个任务和显式 close/reuse 规则,避免会话泄露或状态丢失。
▸ 展开 SKILL.md 英文原文
Use when you need state across calls — building env vars, navigating with cd, driving REPLs (python -i, mysql, psql, node), or responding to interactive prompts (sudo password, ssh host-key confirmation, mysql connection). Teaches the prompt-sentinel exec pattern (default mode), raw I/O for REPLs (raw_send=True then read_only=True), the one-in-flight-per-session rule, and the close-or-leak-against-the-cap discipline. Bash on macOS — never zsh; explicit shell=/bin/zsh is rejected. Read before calling terminal_pty_open.
帮我安装这个 skill:https://raw.githubusercontent.com/aden-hive/hive/main/core/framework/skills/_preset_skills/terminal-tools-pty-sessions/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/aden-hive/hive/main/core/framework/skills/_preset_skills/terminal-tools-pty-sessions/SKILL.md"# Persistent PTY sessions PTY sessions are how you talk to interactive programs — programs that detect a terminal (`isatty()`) and behave differently when they don't see one. Use a session when: - You need state to persist across calls (`cd`, env vars, sourced scripts) - You're driving a REPL (`python -i`, `mysql`, `psql`, `node`, `irb`) - A program demands an interactive prompt (`sudo`, `ssh`, `npm login`, `gh auth login`) For everything else, `terminal_exec` is simpler. Sessions cost more (per-session bash process, ring buffer, idle-reaping bookkeeping) and have a hard cap (`TERMINAL_TOOLS_MAX_PTY`, default 8). ## Why PTY (and not subprocess pipes) Subprocess pipes break on every inte