.env
1. Create a machine and open a terminal
2. Bridge stdin/stdout for the agent
The agent writes a command, you send it as a Binary frame, you collect the bytes that come back until the shell prints a fresh prompt, then you hand the captured output to the agent.3. Loop the agent against the shell
Notes
- Why a terminal and not executions? State persists across commands.
cd /tmp && lsfollowed bypwdreturns/tmp. Executions are independent and lose that. - Resize the PTY before running TUI programs (
top,htop,less): send a Text frame{"cols": 200, "rows": 50}. - Stripping ANSI is only for the prompt-detection heuristic. If the agent itself benefits from colors and cursor codes (e.g., parsing
git statusoutput), pass the raw bytes through. - Detect the prompt robustly by setting
PS1to a known sentinel (export PS1='__DEDALUS_PROMPT__$ ') at the start of the session. Regex against that instead of\$\s$. - Timeouts: wrap
readUntilPromptin aPromise.raceagainst a timer; long-running commands (apt-get install) don’t return a prompt for a while.
