fixup: consolidate tool types, fix build after reorganization

Move FunctionCall, FunctionDef, FunctionCallDelta from user/types
to agent/tools. Re-export from user/types for backward compat.
Merge duplicate dispatch functions in tools/mod.rs into dispatch
(agent-specific) + dispatch_shared (with provenance). Fix orphaned
derive, missing imports, runner→agent module path.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
ProofOfConcept 2026-04-03 23:21:16 -04:00
parent 474b66c834
commit 17a018ff12
9 changed files with 1356 additions and 1380 deletions

View file

@ -9,7 +9,7 @@
use crate::user::api::ApiClient;
use crate::user::types::*;
use crate::agent::{self, ProcessTracker};
use crate::agent::tools::{self as agent_tools, ProcessTracker, ToolOutput};
use std::sync::OnceLock;
@ -46,7 +46,7 @@ pub async fn call_api_with_tools(
let (ui_tx, mut ui_rx) = crate::user::ui_channel::channel();
// All available native tools for subconscious agents
let all_tools = agent::memory_and_journal_definitions();
let all_tools = agent_tools::memory_and_journal_definitions();
// If agent header specifies a tools whitelist, filter to only those
let tool_defs: Vec<_> = if tools.is_empty() {
all_tools
@ -175,9 +175,9 @@ pub async fn call_api_with_tools(
};
let prov = provenance.borrow().clone();
let output = match agent::dispatch(&call.function.name, &args, &tracker, Some(&prov)).await {
let output = match agent_tools::dispatch_shared(&call.function.name, &args, &tracker, Some(&prov)).await {
Some(out) => out,
None => agent::ToolOutput::error(format!("Unknown tool: {}", call.function.name)),
None => ToolOutput::error(format!("Unknown tool: {}", call.function.name)),
};
if std::env::var("POC_AGENT_VERBOSE").is_ok() {

View file

@ -295,7 +295,7 @@ fn run_one_agent_inner(
_llm_tag: &str,
log: &(dyn Fn(&str) + Sync),
) -> Result<AgentResult, String> {
let all_tools = crate::agent::memory_and_journal_definitions();
let all_tools = crate::agent::tools::memory_and_journal_definitions();
let effective_tools: Vec<String> = if def.tools.is_empty() {
all_tools.iter().map(|t| t.function.name.clone()).collect()
} else {