Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:43: /// Salient-arg preference for an omp `toolCall.arguments` object. `i` is omp's per-call intent; /// concrete target keys come first, then intent. Falls back to the first scalar and compact JSON. const ARG_KEYS: &[&str] = &[ - "path", "command", "pattern", "query", "url", "prompt", "file_path", "i", "description", + "path", + "command", + "pattern", + "query", + "url", + "prompt", + "file_path", + "i", + "description", ]; /// Convert a JSON scalar to the digest contract's string representation. Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:215: } fn nonempty(value: Option<&OsString>) -> Option<&OsStr> { - value.map(OsString::as_os_str).filter(|value| !value.is_empty()) + value + .map(OsString::as_os_str) + .filter(|value| !value.is_empty()) } /// Mirror omp's public profile-name contract. `OMP_PROFILE` is authoritative even when explicitly Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:237: } let bytes = profile.as_bytes(); - let valid_first = bytes.first().is_some_and(|b| b.is_ascii_lowercase() || b.is_ascii_digit()); - let valid_rest = - bytes.iter().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || matches!(b, b'.' | b'_' | b'-')); + let valid_first = bytes + .first() + .is_some_and(|b| b.is_ascii_lowercase() || b.is_ascii_digit()); + let valid_rest = bytes + .iter() + .all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || matches!(b, b'.' | b'_' | b'-')); let base = profile.split('.').next().unwrap_or(profile); let reserved = matches!(base, "con" | "prn" | "aux" | "nul") || (base.len() == 4 Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:297: #[derive(Debug)] pub(crate) enum LocateError { - ReadDir { dir: PathBuf, source: io::Error }, - Ambiguous { session_id: String, matches: Vec }, + ReadDir { + dir: PathBuf, + source: io::Error, + }, + Ambiguous { + session_id: String, + matches: Vec, + }, } impl fmt::Display for LocateError { Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:305: fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::ReadDir { dir, source } => write!(f, "cannot scan {}: {source}", dir.display()), - Self::Ambiguous { session_id, matches } => { + Self::Ambiguous { + session_id, + matches, + } => { write!(f, "ambiguous omp session id '{session_id}':")?; for path in matches { write!(f, " {}", path.display())?; Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:320: let entries = match std::fs::read_dir(dir) { Ok(entries) => entries, Err(source) if source.kind() == io::ErrorKind::NotFound => return Ok(Vec::new()), - Err(source) => return Err(LocateError::ReadDir { dir: dir.to_path_buf(), source }), + Err(source) => { + return Err(LocateError::ReadDir { + dir: dir.to_path_buf(), + source, + }) + } }; let mut paths = Vec::new(); for entry in entries { Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:327: - let entry = - entry.map_err(|source| LocateError::ReadDir { dir: dir.to_path_buf(), source })?; + let entry = entry.map_err(|source| LocateError::ReadDir { + dir: dir.to_path_buf(), + source, + })?; paths.push(entry.path()); } paths.sort(); Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:350: exact.push(path.clone()); continue; } - if let Some(id_part) = name.rsplit('_').next().and_then(|part| part.strip_suffix(".jsonl")) { + if let Some(id_part) = name + .rsplit('_') + .next() + .and_then(|part| part.strip_suffix(".jsonl")) + { if id_part.starts_with(session_id) { prefixes.push(path.clone()); } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:367: match matches.len() { 0 => Ok(None), 1 => Ok(matches.pop()), - _ => Err(LocateError::Ambiguous { session_id: session_id.to_string(), matches }), + _ => Err(LocateError::Ambiguous { + session_id: session_id.to_string(), + matches, + }), } } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:379: let root_entries = sorted_entries(root)?; let mut exact = Vec::new(); let mut prefixes = Vec::new(); - record_matches(&root_entries, &suffix_exact, session_id, &mut exact, &mut prefixes); + record_matches( + &root_entries, + &suffix_exact, + session_id, + &mut exact, + &mut prefixes, + ); for subdir in root_entries.iter().filter(|path| path.is_dir()) { let entries = sorted_entries(subdir)?; Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:386: - record_matches(&entries, &suffix_exact, session_id, &mut exact, &mut prefixes); + record_matches( + &entries, + &suffix_exact, + session_id, + &mut exact, + &mut prefixes, + ); } if !exact.is_empty() { return select_match(session_id, exact); Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:402: "--session-dir" => session_dir = it.next(), "--in" => in_file = it.next(), "-h" | "--help" => { - println!("omp-spt digest-omp --session [--session-dir ] [--in ]"); + println!( + "omp-spt digest-omp --session [--session-dir ] [--in ]" + ); return ExitCode::SUCCESS; } // Tolerate stray flags a mid-update manifest might still pass (e.g. --config-dir): consume Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:437: match locate(&root, id) { Ok(Some(p)) => p, Ok(None) => { - eprintln!("omp-spt digest-omp: no session file for '{id}' under {}", root.display()); + eprintln!( + "omp-spt digest-omp: no session file for '{id}' under {}", + root.display() + ); return ExitCode::FAILURE; } Err(e) => { Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:481: } fn env_with_home(home: &str) -> SessionEnv { - SessionEnv { home: Some(home.into()), ..SessionEnv::default() } + SessionEnv { + home: Some(home.into()), + ..SessionEnv::default() + } } struct TempRoot(PathBuf); Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:511: let env = env_with_home("test-home"); assert_eq!( sessions_root_from(None, &env).unwrap(), - Path::new("test-home").join(".omp").join("agent").join("sessions") + Path::new("test-home") + .join(".omp") + .join("agent") + .join("sessions") ); } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:521: env.pi_config_dir = Some("alternate-omp".into()); assert_eq!( sessions_root_from(None, &env).unwrap(), - Path::new("test-home").join("alternate-omp").join("agent").join("sessions") + Path::new("test-home") + .join("alternate-omp") + .join("agent") + .join("sessions") ); } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\digest_omp.rs:570: env.omp_profile = Some(OsString::new()); assert_eq!( sessions_root_from(None, &env).unwrap(), - Path::new("test-home").join(".omp").join("agent").join("sessions") + Path::new("test-home") + .join(".omp") + .join("agent") + .join("sessions") ); } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:76: [ "-p", "--no-session", - "--tools", "read", + "--tools", + "read", "--auto-approve", - "--thinking", "off", + "--thinking", + "off", "--no-title", "--no-extensions", "--no-skills", Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:118: } pub fn run() -> ExitCode { - let Args { id, session_id, session_dir } = parse_args(std::env::args().skip(2)); + let Args { + id, + session_id, + session_dir, + } = parse_args(std::env::args().skip(2)); if id.is_empty() || session_id.is_empty() { eprintln!("{}", fail_line(&id, "need --id and --session-id")); return ExitCode::FAILURE; Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:140: Ok(Some(p)) => match std::fs::read_to_string(&p) { Ok(h) => history = h, Err(e) => { - eprintln!("{}", fail_line(&id, &format!("transcript unreadable ({}): {e}", p.display()))); + eprintln!( + "{}", + fail_line( + &id, + &format!("transcript unreadable ({}): {e}", p.display()) + ) + ); return ExitCode::FAILURE; } }, Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:166: // 2+3. BOUND + TURN via a scratch @file prompt. let prompt = compose_prompt(&id, bounded_tail(&history, TAIL_CAP_BYTES)); - let prompt_file = std::env::temp_dir().join(format!("omp-spt-echo-{}-{}.md", id, std::process::id())); + let prompt_file = + std::env::temp_dir().join(format!("omp-spt-echo-{}-{}.md", id, std::process::id())); if let Err(e) = std::fs::write(&prompt_file, &prompt) { - eprintln!("{}", fail_line(&id, &format!("cannot write prompt scratch {}: {e}", prompt_file.display()))); + eprintln!( + "{}", + fail_line( + &id, + &format!("cannot write prompt scratch {}: {e}", prompt_file.display()) + ) + ); return ExitCode::FAILURE; } let mut cmd = Command::new(omp); Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:175: cmd.args(turn_cmd()); cmd.arg(format!("@{}", prompt_file.display())); - cmd.stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped()); + cmd.stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()); let out = cmd.output(); let _ = std::fs::remove_file(&prompt_file); // scratch cleanup, success or fail Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:188: // [impl->REQ-SESSION-ECHO-COMMUNE] if !out.status.success() { let err_text = String::from_utf8_lossy(&out.stderr); - eprintln!("{}", fail_line(&id, &format!("omp exited {}: {}", out.status, err_text.trim()))); + eprintln!( + "{}", + fail_line( + &id, + &format!("omp exited {}: {}", out.status, err_text.trim()) + ) + ); return ExitCode::FAILURE; } // 4. OUTPUT: the delta on stdout (loud-fail on an empty one — a silent vacuous delta hides bugs). Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:208: #[test] fn parser_threads_explicit_session_dir_to_the_shared_resolver() { let args = parse_args( - ["--session-id", "session-1", "--session-dir", "relocated", "--id", "agent-1"] - .into_iter() - .map(str::to_string), + [ + "--session-id", + "session-1", + "--session-dir", + "relocated", + "--id", + "agent-1", + ] + .into_iter() + .map(str::to_string), ); assert_eq!( args, Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\echo_commune_omp.rs:297: assert!(c.contains(&"--no-session".to_string())); let ti = c.iter().position(|s| s == "--tools").unwrap(); assert_eq!(c[ti + 1], "read"); // a summarizer never writes - for flag in ["--auto-approve", "--thinking", "--no-title", "--no-extensions", "--no-skills", "--no-rules"] { + for flag in [ + "--auto-approve", + "--thinking", + "--no-title", + "--no-extensions", + "--no-skills", + "--no-rules", + ] { assert!(c.contains(&flag.to_string()), "missing {flag}"); } assert!(!c.contains(&"-c".to_string())); Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\history_omp.rs:14: let path = crate::digest_omp::locate(root, session_id) .map_err(|e| e.to_string())? .ok_or_else(|| { - format!("no omp session file for '{session_id}' under {}", root.display()) + format!( + "no omp session file for '{session_id}' under {}", + root.display() + ) })?; std::fs::read(&path).map_err(|e| format!("cannot read {}: {e}", path.display())) } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:39: while let Some(flag) = it.next() { match flag.as_str() { "--id" => id = Some(it.next().ok_or("--id expects a value")?), - "--session-id" => session_id = Some(it.next().ok_or("--session-id expects a value")?), + "--session-id" => { + session_id = Some(it.next().ok_or("--session-id expects a value")?) + } "--psyche-context-file" => { - psyche_context_file = Some(it.next().ok_or("--psyche-context-file expects a value")?) + psyche_context_file = + Some(it.next().ok_or("--psyche-context-file expects a value")?) } other => return Err(format!("unknown arg: {other}")), } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:98: } v.extend( [ - "--session-dir", session_dir, - "--tools", "read,write,edit", + "--session-dir", + session_dir, + "--tools", + "read,write,edit", "--auto-approve", - "--thinking", "off", + "--thinking", + "off", "--no-title", "--no-extensions", "--no-skills", Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:118: enum Plan { Ack, /// The dir-presence check happens at run() time (filesystem); the plan carries intent only. - Turn { is_first: bool, prompt: String }, + Turn { + is_first: bool, + prompt: String, + }, } fn plan(psyche_context: &str, event: &str) -> Plan { Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:152: let psyche_context = match std::fs::read_to_string(&args.psyche_context_file) { Ok(c) => c, Err(e) => { - eprintln!("{}", fail_line(&args.id, &format!("mind file unreadable ({}): {e}", args.psyche_context_file))); + eprintln!( + "{}", + fail_line( + &args.id, + &format!("mind file unreadable ({}): {e}", args.psyche_context_file) + ) + ); return ExitCode::FAILURE; } }; Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:160: // The per-turn EVENT/COMMUNE rides our stdin. let mut event = String::new(); if let Err(e) = std::io::stdin().read_to_string(&mut event) { - eprintln!("{}", fail_line(&args.id, &format!("stdin read failed: {e}"))); + eprintln!( + "{}", + fail_line(&args.id, &format!("stdin read failed: {e}")) + ); return ExitCode::FAILURE; } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:175: let sdir = match psyche_session_dir(&args.psyche_context_file) { Some(d) => d, None => { - eprintln!("{}", fail_line(&args.id, "mind file path has no parent dir (no session-dir anchor)")); + eprintln!( + "{}", + fail_line( + &args.id, + "mind file path has no parent dir (no session-dir anchor)" + ) + ); return ExitCode::FAILURE; } }; Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:187: return ExitCode::from(EXIT_SESSION_GONE); } if let Err(e) = std::fs::create_dir_all(&sdir) { - eprintln!("{}", fail_line(&args.id, &format!("cannot create session dir {}: {e}", sdir.display()))); + eprintln!( + "{}", + fail_line( + &args.id, + &format!("cannot create session dir {}: {e}", sdir.display()) + ) + ); return ExitCode::FAILURE; } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:194: // Seam 3: the composed prompt rides a shim-owned @file, never argv content and never stdin. let prompt_file = sdir.join(TURN_PROMPT_FILE); if let Err(e) = std::fs::write(&prompt_file, &prompt) { - eprintln!("{}", fail_line(&args.id, &format!("cannot write turn prompt {}: {e}", prompt_file.display()))); + eprintln!( + "{}", + fail_line( + &args.id, + &format!("cannot write turn prompt {}: {e}", prompt_file.display()) + ) + ); return ExitCode::FAILURE; } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:202: let omp = match crate::launch_omp::resolve_omp() { Ok(path) => path, Err(e) => { - eprintln!("{}", fail_line(&args.id, &format!("omp resolution failed: {e}"))); + eprintln!( + "{}", + fail_line(&args.id, &format!("omp resolution failed: {e}")) + ); return ExitCode::FAILURE; } }; Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:210: cmd.args(turn_cmd(&sdir.to_string_lossy(), is_first)); cmd.arg(format!("@{}", prompt_file.display())); // cwd = the psyche's nested perch dir (mind-file parent) — commune file-drops land beside it. - if let Some(parent) = Path::new(&args.psyche_context_file).parent().filter(|p| p.is_dir()) { + if let Some(parent) = Path::new(&args.psyche_context_file) + .parent() + .filter(|p| p.is_dir()) + { cmd.current_dir(parent); } - cmd.stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped()); + cmd.stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()); let out = match cmd.output() { Ok(o) => o, Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:228: eprint!("{err_text}"); } if !out.status.success() { - eprintln!("{}", fail_line(&args.id, &format!("omp exited {}", out.status))); + eprintln!( + "{}", + fail_line(&args.id, &format!("omp exited {}", out.status)) + ); return ExitCode::FAILURE; } // omp stdout = the psyche's outbound channel (the daemon parses intents); non-empty guarantee. Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:251: #[test] fn parses_all_three_required_flags_any_order() { - let a = args(&["--session-id", "s1", "--psyche-context-file", "/x/mind.txt", "--id", "lib"]).unwrap(); - assert_eq!(a, Args { id: "lib".into(), session_id: "s1".into(), psyche_context_file: "/x/mind.txt".into() }); + let a = args(&[ + "--session-id", + "s1", + "--psyche-context-file", + "/x/mind.txt", + "--id", + "lib", + ]) + .unwrap(); + assert_eq!( + a, + Args { + id: "lib".into(), + session_id: "s1".into(), + psyche_context_file: "/x/mind.txt".into() + } + ); } #[test] Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:259: fn missing_or_unknown_flags_are_loud() { assert!(args(&["--id", "x"]).is_err()); - assert!(args(&["--id", "x", "--session-id", "s", "--psyche-context-file", "f", "--bogus", "v"]).is_err()); + assert!(args(&[ + "--id", + "x", + "--session-id", + "s", + "--psyche-context-file", + "f", + "--bogus", + "v" + ]) + .is_err()); } #[test] Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:280: fn blank_prompt_plans_ack_no_spawn() { assert_eq!(plan("", " \n"), Plan::Ack); // A first turn's mind is non-empty by construction — always a Turn. - assert!(matches!(plan("mind", ""), Plan::Turn { is_first: true, .. })); + assert!(matches!( + plan("mind", ""), + Plan::Turn { is_first: true, .. } + )); } // [unit->REQ-PSYCHE-EPHEMERAL-SHIM] Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:292: let cont = turn_cmd("/p/omp-sessions", false); assert!(cont.contains(&"-c".to_string())); // Sandbox: file-IO tools only, auto-approved, no thinking/title/discovery surfaces. - for flag in ["--tools", "--auto-approve", "--thinking", "--no-title", "--no-extensions", "--no-skills", "--no-rules"] { + for flag in [ + "--tools", + "--auto-approve", + "--thinking", + "--no-title", + "--no-extensions", + "--no-skills", + "--no-rules", + ] { assert!(fresh.contains(&flag.to_string()), "fresh missing {flag}"); assert!(cont.contains(&flag.to_string()), "cont missing {flag}"); } Diff in \\?\C:\Users\decid\Documents\projects\omp-spt\tools\omp-spt\src\psyche_omp.rs:326: // [unit->REQ-PSYCHE-EPHEMERAL-SHIM] #[test] fn missing_dir_reads_as_no_prior_session() { - assert!(!has_prior_session(Path::new("/definitely/not/a/real/dir/xyz"))); + assert!(!has_prior_session(Path::new( + "/definitely/not/a/real/dir/xyz" + ))); } // [unit->REQ-PSYCHE-EPHEMERAL-SHIM]