events: LiveEvent::Note becomes struct variant so serde can actually serialize it
This commit is contained in:
parent
aa24080f7b
commit
b60774a66c
5 changed files with 46 additions and 29 deletions
|
|
@ -206,11 +206,13 @@ pub async fn run_turn(prompt: &str, files: &TurnFiles, bus: &Bus) -> TurnOutcome
|
|||
/// compact state matches a normal turn's. Only the prompt over stdin
|
||||
/// differs (`/compact` vs the wake-up payload).
|
||||
pub async fn compact_session(files: &TurnFiles, bus: &Bus) -> Result<()> {
|
||||
bus.emit(LiveEvent::Note(
|
||||
"context overflow — running /compact on the persistent session".into(),
|
||||
));
|
||||
bus.emit(LiveEvent::Note {
|
||||
text: "context overflow — running /compact on the persistent session".into(),
|
||||
});
|
||||
let _ = run_claude("/compact", files, bus).await?;
|
||||
bus.emit(LiveEvent::Note("/compact done".into()));
|
||||
bus.emit(LiveEvent::Note {
|
||||
text: "/compact done".into(),
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -218,9 +220,9 @@ async fn run_claude(prompt: &str, files: &TurnFiles, bus: &Bus) -> Result<bool>
|
|||
let model = bus.model();
|
||||
let resume = !bus.take_skip_continue();
|
||||
if !resume {
|
||||
bus.emit(LiveEvent::Note(
|
||||
"fresh session (--continue suppressed for this turn)".into(),
|
||||
));
|
||||
bus.emit(LiveEvent::Note {
|
||||
text: "fresh session (--continue suppressed for this turn)".into(),
|
||||
});
|
||||
}
|
||||
let mut cmd = Command::new("claude");
|
||||
// Spawn inside the agent's state dir so relative paths in tool calls
|
||||
|
|
@ -282,7 +284,9 @@ async fn run_claude(prompt: &str, files: &TurnFiles, bus: &Bus) -> Result<bool>
|
|||
}
|
||||
bus_out.emit(LiveEvent::Stream(v));
|
||||
}
|
||||
Err(_) => bus_out.emit(LiveEvent::Note(format!("(non-json) {line}"))),
|
||||
Err(_) => bus_out.emit(LiveEvent::Note {
|
||||
text: format!("(non-json) {line}"),
|
||||
}),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -304,7 +308,9 @@ async fn run_claude(prompt: &str, files: &TurnFiles, bus: &Bus) -> Result<bool>
|
|||
// renders; the tracing line is what `journalctl -M <c> -b`
|
||||
// surfaces when claude exits non-zero.
|
||||
tracing::warn!(line = %line, "claude stderr");
|
||||
bus_err.emit(LiveEvent::Note(format!("stderr: {line}")));
|
||||
bus_err.emit(LiveEvent::Note {
|
||||
text: format!("stderr: {line}"),
|
||||
});
|
||||
let mut t = tail_clone.lock().unwrap();
|
||||
if t.len() >= STDERR_TAIL_LINES {
|
||||
t.pop_front();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue