pub fn write_event_to( dir: &Path, session_id: &str, cwd: &str, pane_id: &str, state: &str, ) -> Result<(), String>
Append a state event to a session file in the given directory.