Take rustfmt's defaults

The code was hand-formatted -- close to rustfmt's output but not it, mostly
in keeping chains and call arguments on one line where the formatter would
break them. That is a per-line decision every future change has to make
again, and reproducing it would mean a config whose only job is to preserve
how the code already looks.

So this is `cargo fmt` at its defaults, with no rustfmt.toml, which is
where the sibling dev-updater checkout already sits: it is clean at the
defaults today, so the two repos now agree on layout without either of them
configuring it.

Formatting only -- no behaviour, no renames, nothing reordered. Verified
after: cargo test (35 pass), cargo clippy --all-targets clean, cargo fmt
--check clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xn8nHw1tw1R6PtiY1eEtw
This commit is contained in:
irisandClaude Opus 5 committed 2026-08-28 03:13:36 -04:00
1 parent f014094fcd
commit c12ab7f098
13 files changed
+557 -190

No files matched your search

+45 -14
View File
@@ -28,8 +28,13 @@ pub struct EchoDriver {
impl EchoDriver {
pub fn new(sink: EventSink) -> Self {
let driver = Self { sink, pending_question: Mutex::new(None) };
driver.emit(Event::Status { state: SessionStatus::Idle });
let driver = Self {
sink,
pending_question: Mutex::new(None),
};
driver.emit(Event::Status {
state: SessionStatus::Idle,
});
driver
}
@@ -53,22 +58,30 @@ impl Driver for EchoDriver {
format!("Echo asks: {}", rest.trim())
};
*self.pending_question.lock().unwrap() = Some(id.clone());
self.emit(Event::Status { state: SessionStatus::Running });
self.emit(Event::Status {
state: SessionStatus::Running,
});
self.emit(Event::Question {
id,
prompt,
options: vec!["Yes".to_string(), "No".to_string()],
});
self.emit(Event::Status { state: SessionStatus::AwaitingInput });
self.emit(Event::Status {
state: SessionStatus::AwaitingInput,
});
return;
}
let run_tool = text.strip_prefix("/tool").map(|rest| rest.trim().to_string());
let run_tool = text
.strip_prefix("/tool")
.map(|rest| rest.trim().to_string());
tokio::spawn(async move {
let send = |event: Event| {
let _ = sink.send(event);
};
send(Event::Status { state: SessionStatus::Running });
send(Event::Status {
state: SessionStatus::Running,
});
if let Some(input) = run_tool {
let id = format!("t-{}", super::random_hex());
@@ -78,18 +91,30 @@ impl Driver for EchoDriver {
input: serde_json::json!({ "input": input }),
});
tokio::time::sleep(DELTA_DELAY).await;
send(Event::ToolUpdate { id: id.clone(), output: "working...".to_string() });
send(Event::ToolUpdate {
id: id.clone(),
output: "working...".to_string(),
});
tokio::time::sleep(DELTA_DELAY).await;
send(Event::ToolEnd { id, output: format!("echoed: {input}") });
send(Event::ToolEnd {
id,
output: format!("echoed: {input}"),
});
}
// Word-at-a-time so streaming is visibly streaming.
for word in format!("You said: {text}").split_inclusive(' ') {
send(Event::AssistantText { delta: word.to_string() });
send(Event::AssistantText {
delta: word.to_string(),
});
tokio::time::sleep(DELTA_DELAY).await;
}
send(Event::UsageDelta { tokens: text.split_whitespace().count() as u64 });
send(Event::Status { state: SessionStatus::Idle });
send(Event::UsageDelta {
tokens: text.split_whitespace().count() as u64,
});
send(Event::Status {
state: SessionStatus::Idle,
});
});
}
@@ -101,7 +126,9 @@ impl Driver for EchoDriver {
self.emit(Event::AssistantText {
delta: format!("You answered: {answer}"),
});
self.emit(Event::Status { state: SessionStatus::Idle });
self.emit(Event::Status {
state: SessionStatus::Idle,
});
}
_ => self.emit(Event::Error {
message: format!("no question {id} is awaiting an answer"),
@@ -113,7 +140,9 @@ impl Driver for EchoDriver {
// Nothing real to stop; a pending question is abandoned so the
// session isn't stuck awaiting input forever.
*self.pending_question.lock().unwrap() = None;
self.emit(Event::Status { state: SessionStatus::Idle });
self.emit(Event::Status {
state: SessionStatus::Idle,
});
}
fn set_model(&self, model: &str) {
@@ -129,6 +158,8 @@ impl Driver for EchoDriver {
}
fn shutdown(&self) {
self.emit(Event::Status { state: SessionStatus::Exited });
self.emit(Event::Status {
state: SessionStatus::Exited,
});
}
}