agent-zero/plugins/_code_execution/AGENTS.md
frdel 4ffcdf5246 Handle shell/SSH process exits as completion
Detect and treat terminated local/SSH/TTY shells as definitive command completion. Add is_terminated and get_exit_code helpers to LocalInteractiveSession, SSHInteractiveSession, and TTYSession; expand _is_closed_pty_error to recognize exited TTY processes. CodeExecution now reports a shell-exit prompt, recreates terminated sessions lazily before the next command, and returns immediately when a shell has exited. Docs and README updated to describe strict-mode/exit behavior, and tests were added/updated to cover the new termination detection and handling.
2026-07-20 17:04:05 +02:00

33 lines
1.4 KiB
Markdown

# Code Execution Plugin DOX
## Purpose
- Own terminal, Python, and Node.js code execution through persistent local or SSH-backed sessions.
## Ownership
- `tools/` owns the code execution and input tools.
- `helpers/` owns local shell, SSH shell, and TTY session management.
- `prompts/` owns execution prompt and runtime response fragments.
- `default_config.yaml`, `plugin.yaml`, `extensions/`, and `webui/` own settings, metadata, hooks, and UI config.
## Local Contracts
- Keep session concurrency, timeout, streaming, and reset behavior predictable.
- Execute multi-line terminal input as one current-shell compound so intermediate prompts cannot mark queued work complete; preserve `cd`, exports, and other shell state.
- Treat local process exit and SSH channel termination as definitive command completion even when no final prompt is emitted; recreate terminated sessions before their next command.
- Terminal reset/close must not hang on foreground commands or shells that ignore SIGTERM.
- Explicitly target local versus SSH execution runtimes.
- Do not hardcode secrets, SSH credentials, or local user paths.
## Work Guidance
- Preserve long-running command output retrieval and busy-session guards when changing execution flow.
## Verification
- Smoke-test terminal, Python, Node.js, output polling, and reset paths after tool changes.
## Child DOX Index
No child DOX files.