Normalize shell and patch tool cards

This commit is contained in:
iris committed 2026-09-09 20:30:52 -04:00
1 parent 4dc3e3d784
commit b507656abd
11 files changed
+327 -16

No files matched your search

+18 -1
View File
@@ -10,6 +10,8 @@
//! - `/tool [input]` -- a full tool run, start through end.
//! - `/bash [command]` -- a Bash call carrying that command, for what the
//! phone's shell highlighting does to a particular line.
//! - `/patch` -- one common patch call, for the diff presentation shared by
//! real Codex and Claude sessions.
//! - `/tools [n] [gap]` -- n calls back to back. `gap` is seconds between one
//! call and the next, which is what makes a run *grow* while somebody is
//! looking at it -- the only way to reach the state where a call opened on
@@ -73,7 +75,7 @@ use std::sync::{Arc, Mutex};
use std::time::Duration;
use super::driver::{
AttachmentRef, Driver, Event, EventSink, QuestionOption, SessionStatus, Unqueued,
AttachmentRef, Driver, Event, EventSink, QuestionOption, SessionStatus, Unqueued, patch_start,
};
use super::subagent::Subagents;
@@ -621,6 +623,7 @@ impl EchoDriver {
let run_bash = text
.strip_prefix("/bash")
.map(|rest| rest.trim().to_string());
let run_patch = text == "/patch";
// Seconds to stay running before answering, default 30. Clamped rather
// than trusted: a session pinned running for an hour by a typo is a
// worse outcome than a short wait.
@@ -790,6 +793,20 @@ impl EchoDriver {
});
}
if run_patch {
let id = format!("p-{}", super::random_hex());
send(patch_start(
id.clone(),
"--- src/example.rs\n+++ src/example.rs\n@@ -1,3 +1,3 @@\n fn answer() -> u8 {\n- 41\n+ 42\n }\n"
.to_string(),
));
tokio::time::sleep(DELTA_DELAY).await;
send(Event::ToolEnd {
id,
output: String::new(),
});
}
if let Some(input) = run_tool {
let id = format!("t-{}", super::random_hex());
send(Event::ToolStart {