loopd: subagent in the M5c registry, not core

Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
2026-10-03 19:44:25 -07:00
co-authored by ornith-1.5-35b-a3b
parent 25278b4c03
commit bab22bb4c8
5 changed files with 85 additions and 0 deletions
+1
View File
@@ -15,6 +15,7 @@ pub mod selftest;
pub mod session;
pub mod socket;
pub mod sse;
pub mod subagent;
pub mod summarise;
pub mod tools;
pub mod turn;
+22
View File
@@ -0,0 +1,22 @@
//! The `subagent` tool: loopd answers it itself (M6 spec, section 3).
//! It is not core; the parent finds it with `find_tool` and calls it through `call_tool`.
pub const SUBAGENT: &str = "subagent";
pub fn schema() -> crate::llama::ToolSchema {
crate::llama::ToolSchema {
name: SUBAGENT.to_string(),
description: "Run a short task in an isolated child session on the background slot."
.to_string(),
parameters: serde_json::json!({
"type": "object",
"properties": {
"task": {
"type": "string",
"description": "What the child should do."
}
},
"required": ["task"]
}),
}
}
+4
View File
@@ -114,6 +114,10 @@ impl Registry {
core: true,
},
);
entries.push(Entry {
schema: crate::subagent::schema(),
core: false,
});
Registry::new(entries)
}
+57
View File
@@ -0,0 +1,57 @@
//! `subagent` in the M5c registry, not core. Do not edit.
mod support;
use loopd::baseline::Baseline;
use loopd::subagent::{self, SUBAGENT};
use loopd::tools::Registry;
use std::path::Path;
use support::Home;
fn core_names(registry: &Registry) -> Vec<String> {
registry
.core_schemas()
.into_iter()
.map(|s| s.name)
.collect()
}
#[test]
fn subagent_is_in_m5c_and_is_not_core() {
let r = Registry::m5c();
let entry = r.get(SUBAGENT).expect("subagent");
assert!(!entry.core);
assert_eq!(entry.schema, subagent::schema());
assert_eq!(
core_names(&r),
[
"clock",
"recall",
"memory",
"ask_memory",
"find_tool",
"call_tool"
]
);
assert!(r.find("subagent").iter().any(|s| s.name == SUBAGENT));
assert!(r.find("isolated").iter().any(|s| s.name == SUBAGENT));
}
#[test]
fn a_baseline_from_m5c_does_not_put_subagent_in_the_tools_array() {
let home = Home::new();
let cfg = home.config(Path::new("/tmp/unused.sock"));
let baseline = Baseline::assemble(&cfg, &Registry::m5c()).unwrap();
let names: Vec<&str> = baseline.tools.iter().map(|t| t.name.as_str()).collect();
assert_eq!(
names,
[
"clock",
"recall",
"memory",
"ask_memory",
"find_tool",
"call_tool"
]
);
}