agent: move oneshot execution from subconscious to agent module

Move agent execution machinery (run_one_agent, spawn_agent, PID
tracking) from subconscious/knowledge.rs to agent/oneshot.rs — the
agent module owns execution, subconscious owns scheduling and defs.

Delete subconscious/llm.rs — callers now use api::call_api_with_tools_sync
directly. Audit and compare inline the call; oneshot inlines tool
filtering.

Update all callers: consolidate, daemon, subconscious, cli/agent.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-04 17:25:10 -04:00 committed by Kent Overstreet
parent 1457a1b50d
commit 0f4ca9e2f2
10 changed files with 43 additions and 106 deletions

View file

@ -123,7 +123,7 @@ fn job_targeted_agent(
ctx.log_line(msg);
log_event(&job_name, "progress", msg);
};
super::knowledge::run_one_agent_with_keys(
crate::agent::oneshot::run_one_agent_with_keys(
&mut store, &agent, std::slice::from_ref(&key), 5, "daemon", &log,
)?;
ctx.log_line("done");
@ -208,7 +208,7 @@ fn job_consolidation_agent(
};
// Use run_one_agent_with_keys — we already selected seeds above,
// no need to re-run the query.
let result = super::knowledge::run_one_agent_with_keys(
let result = crate::agent::oneshot::run_one_agent_with_keys(
&mut store, &agent, &claimed_keys, batch, "consolidate", &log,
).map(|_| ());
@ -239,7 +239,7 @@ fn job_rename_agent(
ctx.log_line(format!("running rename agent (batch={})", batch));
let log = |msg: &str| ctx.log_line(msg);
let result = super::knowledge::run_one_agent(&mut store, "rename", batch, "consolidate", &log)?;
let result = crate::agent::oneshot::run_one_agent(&mut store, "rename", batch, "consolidate", &log)?;
// Parse RENAME actions from response (rename uses its own format, not WRITE_NODE/LINK/REFINE)
let mut applied = 0;