api: move wire types and parsing to api module

Move FunctionCall, FunctionCallDelta, ToolCall, ToolCallDelta from
tools/mod.rs to api/types.rs — these are API wire format, not tool
definitions. Re-export from tools for existing callers.

Move parsing.rs to api/parsing.rs — leaked tool call parsing is API
plumbing.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-04 17:58:49 -04:00 committed by Kent Overstreet
parent 618121067b
commit 6845644f7b
5 changed files with 41 additions and 42 deletions

View file

@ -16,7 +16,6 @@
pub mod api;
pub mod context;
pub mod oneshot;
pub mod parsing;
pub mod tools;
pub mod training;
@ -340,7 +339,7 @@ impl Agent {
tool_call_buf.push_str(&text);
if let Some(end) = tool_call_buf.find("</tool_call>") {
let body = &tool_call_buf[..end];
if let Some(call) = crate::agent::parsing::parse_tool_call_body(body) {
if let Some(call) = crate::agent::api::parsing::parse_tool_call_body(body) {
let args: serde_json::Value =
serde_json::from_str(&call.function.arguments).unwrap_or_default();
let args_summary = summarize_args(&call.function.name, &args);