1.4 KiB
1.4 KiB
Session Lifecycle and Concurrency
Use this file when managing multiple sessions or debugging stuck runs.
Lifecycle Overview
runcreates a session and returnssession_id.- Commands without
--sessiontarget the most recent session. - Use
--session <id>when multiple sessions exist. - End automation sessions with
kill --yesorsessions cleanup --yes.
Recommended Pattern
- Capture
session_idfromrunJSON output. - Pass
--session <id>to every subsequent command in the flow. - When running multiple apps concurrently, never rely on the default session.
Inspect and Attach
sessions: list active sessions.sessions show <id>: show session details.sessions switch <id>: set the active session.sessions attach: attach in TTY mode (detach with Ctrl-P Ctrl-B). Use-s <id>to target a specific session.-s <id> sessions attach -T: stream output only (no TTY).
Cleanup and Recovery
kill --yes: terminate the current session without prompting.sessions cleanup --yes: remove dead/orphaned sessions without prompting.sessions cleanup --all --yes: remove all sessions (including active) without prompting.
Restart Behavior
restart: restart the current session command.daemon restart: restarts daemon and terminates all sessions.
Utilities
env: show environment configuration affecting the CLI.version: show CLI + daemon version info.