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:
parent
618121067b
commit
6845644f7b
5 changed files with 41 additions and 42 deletions
|
|
@ -6,6 +6,7 @@
|
|||
// Diagnostics: anomalies always logged to debug panel.
|
||||
// Set POC_DEBUG=1 for verbose per-turn logging.
|
||||
|
||||
pub mod parsing;
|
||||
pub mod types;
|
||||
mod openai;
|
||||
|
||||
|
|
@ -17,7 +18,8 @@ use std::time::{Duration, Instant};
|
|||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::agent::tools::{self as agent_tools, ToolCall, FunctionCall};
|
||||
use crate::agent::tools::{self as agent_tools};
|
||||
use types::{ToolCall, FunctionCall};
|
||||
use crate::user::ui_channel::{UiMessage, UiSender};
|
||||
|
||||
/// A JoinHandle that aborts its task when dropped.
|
||||
|
|
@ -488,9 +490,9 @@ pub fn build_response_message(
|
|||
}
|
||||
|
||||
// Check for leaked tool calls in content text.
|
||||
let leaked = crate::agent::parsing::parse_leaked_tool_calls(&content);
|
||||
let leaked = parsing::parse_leaked_tool_calls(&content);
|
||||
if !leaked.is_empty() {
|
||||
let cleaned = crate::agent::parsing::strip_leaked_artifacts(&content);
|
||||
let cleaned = parsing::strip_leaked_artifacts(&content);
|
||||
return Message {
|
||||
role: Role::Assistant,
|
||||
content: if cleaned.trim().is_empty() { None }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue