feat: track interaction events during automatic compaction

- Added tracking for interaction events in the `Output` struct, including `summary_started` and `token_delta`.
- Updated the `run` function to push relevant interaction events to the `interaction_events` vector.
- Enhanced the automatic compaction test to verify the immediate reset of cursor usage and the correct logging of interaction events.
This commit is contained in:
leokun
2026-09-01 16:54:45 +08:00
parent 6e74637c69
commit 2c63bd845a
2 changed files with 28 additions and 2 deletions
+14
View File
@@ -703,6 +703,20 @@ impl RunEngine {
emit(client, RunEvent::AutoCompactionStarted)
.await
.map_err(|_| client_failure())?;
emit(
client,
RunEvent::Usage(Usage {
input_tokens: Some(0),
context_input_tokens: Some(0),
output_tokens: Some(0),
total_tokens: Some(0),
cache_read_tokens: Some(0),
cache_write_tokens: Some(0),
reasoning_tokens: Some(0),
}),
)
.await
.map_err(|_| client_failure())?;
let provider_call_index = self
.store
.begin_provider_call(&prepared.run_id)