Render Codex web searches as common tools

This commit is contained in:
iris committed 2026-09-11 02:31:21 -04:00
1 parent 6226a1cb43
commit 57e1cec09c
2 files changed
+18 -1

No files matched your search

@@ -59,6 +59,9 @@ private val SUBJECTS: Map<String, Pair<String, Language?>> =
"Glob" to ("pattern" to null), "Glob" to ("pattern" to null),
"Grep" to ("pattern" to null), "Grep" to ("pattern" to null),
"WebFetch" to ("url" 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. */ /** Fields that are the tool's own prose about itself rather than input to it. */
+15 -1
View File
@@ -268,7 +268,7 @@ fn tool(item: &Value) -> Option<(String, String, Value)> {
json!({"path": item.get("path").cloned().unwrap_or(Value::Null)}), json!({"path": item.get("path").cloned().unwrap_or(Value::Null)}),
), ),
"web_search" | "webSearch" => ( "web_search" | "webSearch" => (
"web_search".to_string(), "WebSearch".to_string(),
json!({"query": item.get("query").cloned().unwrap_or(Value::Null)}), json!({"query": item.get("query").cloned().unwrap_or(Value::Null)}),
), ),
"todo_list" | "todoList" | "plan" => ("update_plan".to_string(), item.clone()), "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] #[test]
fn a_file_change_becomes_the_common_patch_shape() { fn a_file_change_becomes_the_common_patch_shape() {
let mut translator = Translator::default(); let mut translator = Translator::default();