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

@ -156,7 +156,7 @@ impl AgentCycleState {
}
fn agent_spawned(&mut self, name: &str, phase: &str,
result: crate::agents::knowledge::SpawnResult) {
result: crate::agent::oneshot::SpawnResult) {
if let Some(agent) = self.agents.iter_mut().find(|a| a.name == name) {
agent.pid = Some(result.child.id());
agent.phase = Some(phase.to_string());
@ -279,7 +279,7 @@ impl AgentCycleState {
if transcript.size > 0 {
fs::write(&offset_path, transcript.size.to_string()).ok();
}
if let Some(result) = crate::agents::knowledge::spawn_agent(
if let Some(result) = crate::agent::oneshot::spawn_agent(
"surface-observe", &state_dir, &session.session_id) {
self.log(format_args!("spawned surface-observe pid {}\n", result.child.id()));
self.agent_spawned("surface-observe", "surface", result);
@ -346,7 +346,7 @@ impl AgentCycleState {
}
fs::write(&offset_path, transcript.size.to_string()).ok();
if let Some(result) = crate::agents::knowledge::spawn_agent(
if let Some(result) = crate::agent::oneshot::spawn_agent(
"reflect", &state_dir, &session.session_id) {
self.log(format_args!("reflect: spawned pid {}\n", result.child.id()));
self.agent_spawned("reflect", "step-0", result);
@ -375,7 +375,7 @@ impl AgentCycleState {
}
fs::write(&offset_path, transcript.size.to_string()).ok();
if let Some(result) = crate::agents::knowledge::spawn_agent(
if let Some(result) = crate::agent::oneshot::spawn_agent(
"journal", &state_dir, &session.session_id) {
self.log(format_args!("journal: spawned pid {}\n", result.child.id()));
self.agent_spawned("journal", "step-0", result);