feat: add manual compact command

This commit is contained in:
2026-05-24 08:59:44 +09:00
parent 95d05628e7
commit cabc556b2c
6 changed files with 348 additions and 2 deletions
+14
View File
@@ -31,6 +31,11 @@ pub enum Method {
/// fresh turn via `Run` (orphan `tool_use` items are closed with a
/// synthetic tool result before the new user message is appended).
Pause,
/// Request an explicit compaction while the Pod is otherwise idle.
///
/// This is a typed control method: clients must not send `compact` as a
/// `Method::Run` user message.
Compact,
Shutdown,
/// Request a list of completion candidates from the Pod.
///
@@ -732,6 +737,15 @@ mod tests {
assert_eq!(serialized, json);
}
#[test]
fn method_compact_roundtrip() {
let json = r#"{"method":"compact"}"#;
let method: Method = serde_json::from_str(json).unwrap();
assert!(matches!(method, Method::Compact));
let serialized = serde_json::to_string(&method).unwrap();
assert_eq!(serialized, json);
}
#[test]
fn event_text_delta_format() {
let event = Event::TextDelta {