From 57e1cec09c6834502a019eb9ca097e4e8ec0c02d Mon Sep 17 00:00:00 2001 From: iris <2+iris@noreply.localhost> Date: Fri, 11 Sep 2026 02:31:21 -0400 Subject: [PATCH] Render Codex web searches as common tools --- .../main/kotlin/com/example/aiapp/ToolInput.kt | 3 +++ server/src/session/codex/translate.rs | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/androidApp/src/main/kotlin/com/example/aiapp/ToolInput.kt b/app/androidApp/src/main/kotlin/com/example/aiapp/ToolInput.kt index 7c9cd71..090aca5 100644 --- a/app/androidApp/src/main/kotlin/com/example/aiapp/ToolInput.kt +++ b/app/androidApp/src/main/kotlin/com/example/aiapp/ToolInput.kt @@ -59,6 +59,9 @@ private val SUBJECTS: Map> = "Glob" to ("pattern" to null), "Grep" to ("pattern" to null), "WebFetch" to ("url" to null), + "WebSearch" to ("query" to null), + // Persisted transcripts keep the provider vocabulary they were written with. + "web_search" to ("query" to null), ) /** Fields that are the tool's own prose about itself rather than input to it. */ diff --git a/server/src/session/codex/translate.rs b/server/src/session/codex/translate.rs index 3367873..82a9ef2 100644 --- a/server/src/session/codex/translate.rs +++ b/server/src/session/codex/translate.rs @@ -268,7 +268,7 @@ fn tool(item: &Value) -> Option<(String, String, Value)> { json!({"path": item.get("path").cloned().unwrap_or(Value::Null)}), ), "web_search" | "webSearch" => ( - "web_search".to_string(), + "WebSearch".to_string(), json!({"query": item.get("query").cloned().unwrap_or(Value::Null)}), ), "todo_list" | "todoList" | "plan" => ("update_plan".to_string(), item.clone()), @@ -611,6 +611,20 @@ mod tests { ); } + #[test] + fn web_search_uses_the_common_tool_shape() { + assert_eq!( + tool(&line( + r#"{"id":"search-1","type":"webSearch","query":"Codex app-server protocol"}"#, + )), + Some(( + "search-1".to_string(), + "WebSearch".to_string(), + json!({"query": "Codex app-server protocol"}) + )) + ); + } + #[test] fn a_file_change_becomes_the_common_patch_shape() { let mut translator = Translator::default();