BrowserUse_and_ComputerUse_.../tools
teknium1 061fa70907 Add background process management with process tool, wait, PTY, and stdin support
New process registry and tool for managing long-running background processes
across all terminal backends (local, Docker, Singularity, Modal, SSH).

Process Registry (tools/process_registry.py):
- ProcessSession tracking with rolling 200KB output buffer
- spawn_local() with optional PTY via ptyprocess for interactive CLIs
- spawn_via_env() for non-local backends (runs inside sandbox, never on host)
- Background reader threads per process (Popen stdout or PTY)
- wait() with timeout clamping, interrupt support, and transparent limit reporting
- JSON checkpoint to ~/.hermes/processes.json for gateway crash recovery
- Module-level singleton shared across agent loop, gateway, and RL

Process Tool (model_tools.py):
- 7 actions: list, poll, log, wait, kill, write, submit
- Paired with terminal in all toolsets (CLI, messaging, RL)
- Timeout clamping with transparent notes in response

Terminal Tool Updates (tools/terminal_tool.py):
- Replaced nohup background mode with registry spawn (returns session_id)
- Added workdir parameter for per-command working directory
- Added check_interval parameter for gateway auto-check watchers
- Added pty parameter for interactive CLI tools (Codex, Claude Code)
- Updated TERMINAL_TOOL_DESCRIPTION with full background workflow docs
- Cleanup thread now respects active background processes (won't reap sandbox)

Gateway Integration (gateway/run.py, session.py, config.py):
- Session reset protection: sessions with active processes exempt from reset
- Default idle timeout increased from 2 hours to 24 hours
- from_dict fallback aligned to match (was 120, now 1440)
- session_key env var propagated to process registry for session mapping
- Crash recovery on gateway startup via checkpoint probe
- check_interval watcher: asyncio task polls process, delivers updates to platform

RL Safety (environments/):
- tool_context.py cleanup() kills background processes on episode end
- hermes_base_env.py warns when enabled_toolsets is None (loads all tools)
- Process tool safe in RL via wait() blocking the agent loop

Also:
- Added ptyprocess as optional dependency (in pyproject.toml [pty] extra + [all])
- Fixed pre-existing bug: rl_test_inference missing from TOOL_TO_TOOLSET_MAP
- Updated AGENTS.md with process management docs and project structure
- Updated README.md terminal section with process management overview
2026-02-17 02:51:31 -08:00
..
__init__.py Add Text-to-Speech (TTS) functionality with multiple providers 2026-02-12 10:05:08 -08:00
browser_tool.py Enhance browser tool functionality and cleanup process 2026-02-09 04:36:37 +00:00
cronjob_tools.py Enhance CLI with multi-platform messaging integration and configuration management 2026-02-02 19:01:51 -08:00
file_operations.py Fix host CWD leaking into non-local terminal backends 2026-02-16 22:30:04 -08:00
file_tools.py Refactor file operations and environment management in file_tools and terminal_tool 2026-02-16 19:37:40 -08:00
fuzzy_match.py Add file manipulation tools and enhance setup scripts 2026-02-05 03:49:46 -08:00
image_generation_tool.py Enhance batch processing and image generation tools 2026-01-18 10:11:59 +00:00
mixture_of_agents_tool.py Enhance logging and tool initialization for improved performance 2026-01-29 19:59:59 +00:00
patch_parser.py Add file manipulation tools and enhance setup scripts 2026-02-05 03:49:46 -08:00
process_registry.py Add background process management with process tool, wait, PTY, and stdin support 2026-02-17 02:51:31 -08:00
rl_training_tool.py Update dependencies and enhance installation scripts 2026-02-07 00:05:04 +00:00
skills_tool.py Enhance skills tool to have an arg so it is more reliably called, and error handling in agent 2026-02-03 15:26:59 -08:00
terminal_hecate.py Update environment configuration and enhance terminal tool integration 2026-01-23 12:26:53 +00:00
terminal_tool.py Add background process management with process tool, wait, PTY, and stdin support 2026-02-17 02:51:31 -08:00
transcription_tools.py Add messaging platform enhancements: STT, stickers, Discord UX, Slack, pairing, hooks 2026-02-15 21:38:59 -08:00
tts_tool.py Enhance TTS tool to support platform-specific audio formats 2026-02-14 16:13:26 -08:00
vision_tools.py Enhance image handling and analysis capabilities across platforms 2026-02-15 16:10:50 -08:00
web_tools.py Add a claude code-like CLI 2026-01-31 06:30:48 +00:00