From c082f5044eedd2294d72f920d1018e40d73aab33 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Fri, 23 Oct 2026 13:20:11 +0300 Subject: restore, step 2: resume agents, retype command lines - the pi extension reports its session file; the daemon keeps it in the pane option @agent_session, and snapshots carry it. restore runs `pi --session ` in the rebuilt pane, one agent every 0.5s, then reports which agents run and which were interrupted mid-turn. - other panes: the command line running in them is typed at the new prompt but not run. exactly as typed with the zsh hook (dingger install zsh: preexec/precmd keep @dingger_cmd), else the foreground program's exact argv from the kernel (KERN_PROCARGS2), shell-quoted. - "at a prompt" is the pane's own shell owning the terminal's foreground process group, not a name check: `sh -c ...` is a running program. - an agent or command that exits keeps its place in snapshots for 60s, so a shutdown that stops programs before tmux still restores them. - typing waits for each new prompt (text typed earlier echoes twice). e2e step 16 covers resume with a session path containing a space, the interrupted report, an agent that exits just before the server dies, a quoted command retyped not run, and the hook's text; dropping the grace period, judging prompts by name, running retyped commands, or not storing the session reference each fail it. the test's fake pi is guarded so a real pi never starts. --- crates/dinggerd/src/tmux.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/dinggerd/src/tmux.rs') diff --git a/crates/dinggerd/src/tmux.rs b/crates/dinggerd/src/tmux.rs index 4e2b370..b1a2d60 100644 --- a/crates/dinggerd/src/tmux.rs +++ b/crates/dinggerd/src/tmux.rs @@ -27,6 +27,7 @@ pub struct Pane { pub written_since: String, pub written_hook: String, pub written_name: String, + pub written_session: String, } impl Pane { @@ -110,14 +111,15 @@ pub fn list_panes() -> Result, String> { "#{window_panes}\t", "#{pane_index}\t", "#{pane_current_path}\t", - "#{@agent_name}", + "#{@agent_name}\t", + "#{@agent_session}", ); let out = run_tmux(&["list-panes", "-a", "-F", format])?; let mut panes = Vec::new(); let mut process_tree = None; for line in out.lines() { let fields: Vec<&str> = line.split('\t').collect(); - if fields.len() < 18 { + if fields.len() < 19 { continue; } let current_command = fields[1]; @@ -154,6 +156,7 @@ pub fn list_panes() -> Result, String> { written_since: fields[11].to_string(), written_hook: fields[12].to_string(), written_name: fields[17].to_string(), + written_session: fields[18].to_string(), }); } Ok(panes) -- cgit v1.2.3