Move tunnel, browser, document, speech and integration runtimes into plugin-owned sandboxes with lazy dependencies and instance-scoped lifecycle management. Reuse Tuxee display assets and the sandbox image's Python/Node runtimes, enable automatic Desktop login, and show elapsed time for each browser launch. Slim the outer image, use offline ONNX embeddings, and calculate sandbox storage only on demand. Include regression coverage and updated runtime documentation. Exclude local handoff notes and temporary verification artifacts from publication.
4.4 KiB
Code Execution Plugin DOX
Purpose
- Own terminal, Python, and Node.js code execution through destination-aware persistent 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/, andwebui/own settings, metadata, hooks, and UI config.
Local Contracts
-
Local workdir creation resolves development paths with
files.fix_dev_path. Explicit SSH receives the configured remote workdir (project paths use/a0aliases) without creating a host-local directory. Empty SSH passwords fall back to the local root password; other hosts need explicit credentials. Connected-host and sandbox transports remain separate. -
extensions/webui/get_process_step_types/code-exe-types.jsregisterscode_exeas a process-step type so raw-log grouping matches the plugin's message renderer. -
Keep command previews compact in rendered execution output.
code-exe-handler.jsrestores a matching command prefix from the already-maskedkvps.codefor Copy Output and step details, preserving command whitespace and the output body. Existing log size limits remain; copying cannot recover text already discarded by those limits. -
Keep session concurrency, timeout, streaming, and reset behavior predictable.
-
A direct parallel code job retains its worker and loop-bound shell until the command ends or is cancelled. Output timeouts publish model-facing progress to the registered job and continue polling; callers use parallel job IDs. Close parallel shells explicitly on that worker loop on completion or cancellation, including partially connected shells. Top-level sessions retain their ordinary timeout/output/reset behavior.
-
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.
-
POSIX PTY I/O is nonblocking. The existing write/drain interface buffers partial writes and yields while the terminal is full; cancellation discards the shell only while POSIX input bytes remain unsent. Fully drained sends retain the shell and its state.
-
SSH command writes must send every byte without blocking the event loop. Cancelling an in-flight SSH send closes its connection so a partial command cannot contaminate subsequent input.
-
TTY destruction uses best-effort kill, never nested event-loop execution; explicit close retains awaited cleanup.
-
Windows cleanup uses the native process methods without looking up POSIX-only signals; the pywinpty adapter passes SIGTERM for forced termination. POSIX close retains process-group TERM-then-KILL escalation.
-
Local and SSH session wrappers must synchronously release their owned process or connection resources when discarded.
-
Explicitly target local versus SSH execution runtimes.
-
The
inputtool logs a prefix-freeicon://keyboard Using tool 'input'heading and forwards keyboard input through the code execution tool and its log. -
The tool's
allow_runningflag is framework-set (for example by theinputtool's terminal dispatch); it is not a model-facing arg and stays undocumented in prompts. -
Keep
destination=defaultisolated through registered destination extensions;localmeans the Agent Zero operating system, and connected-host routing reuses the authenticated connector transport. -
Key persistent sessions by destination and session id so output, input, and reset cannot cross execution boundaries.
-
Do not hardcode secrets, SSH credentials, or local user paths.
-
Direct local POSIX Python snippets run IPython with the framework's
sys.executable; Windows, SSH and sandbox sessions use the target'sipythoncommand.
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.
- Run
pytest tests/test_webui_plugin_process_types.py -qfor compact execution previews, full stored command copying, and streamed action updates.
Child DOX Index
No child DOX files.