Skip to main content

Module agent_resume

Module agent_resume 

Source
Expand description

Durable interactive-agent session records, so a coding-agent TUI piloted through winx (claude, codex, …) is not silently lost when the process that owned its PTY dies (host reboot, guardian kill, embedded-adapter restart).

Modeled on herdr’s agent_resume (https://github.com/herdrdev/herdr, Apache-2.0): persist what was launched where, and rebuild a resume command after the loss. winx keeps it deliberately simpler than herdr — it records the launch command it executed itself instead of inspecting process trees, and resumes by conversation-continuation flags (claude --continue, codex resume --last) instead of persisted session ids.

Lifecycle: every foreground Command action either overwrites the record (the command launches a known agent) or clears it (it doesn’t) — the main PTY runs one foreground program at a time, so the latest record is the only one that can still matter. Records survive until superseded; a stale record after a clean agent exit only makes the recovery hint say the agent “was running”, which continuation-style resume commands tolerate.

Structs§

AgentSessionRecord
What was running in the foreground PTY when the record was written.

Functions§

clear_agent_session
clear_agent_session_at_path
detect_agent_launch
Canonical agent id when command launches a known interactive coding agent in the foreground, None otherwise.
load_agent_session
load_agent_session_from_path
now_unix_ms
save_agent_session
save_agent_session_to_path