loopd: consult in the M5c registry, not core
Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
//! The `consult` tool: `brokerd` decides it and POSTs an allowlisted body (M6 spec, section 4).
|
||||
//! It is not core; the parent finds it with `find_tool` and calls it through `call_tool`.
|
||||
|
||||
pub const CONSULT: &str = "consult";
|
||||
|
||||
pub fn schema() -> crate::llama::ToolSchema {
|
||||
crate::llama::ToolSchema {
|
||||
name: CONSULT.to_string(),
|
||||
description: "Ask a remote model a question. The session history is not sent. Needs a grant from the owner.".to_string(),
|
||||
parameters: serde_json::json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {
|
||||
"type": "string",
|
||||
"description": "The question to send. Nothing else of the session is included."
|
||||
}
|
||||
},
|
||||
"required": ["question"]
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ pub mod broker_port;
|
||||
pub mod channel;
|
||||
pub mod compact;
|
||||
pub mod config;
|
||||
pub mod consult;
|
||||
pub mod cron;
|
||||
pub mod http;
|
||||
pub mod jobs;
|
||||
|
||||
@@ -118,6 +118,10 @@ impl Registry {
|
||||
schema: crate::subagent::schema(),
|
||||
core: false,
|
||||
});
|
||||
entries.push(Entry {
|
||||
schema: crate::consult::schema(),
|
||||
core: false,
|
||||
});
|
||||
Registry::new(entries)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//! `consult` in the M5c registry, not core. Do not edit.
|
||||
|
||||
mod support;
|
||||
|
||||
use loopd::baseline::Baseline;
|
||||
use loopd::consult::{self, CONSULT};
|
||||
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 consult_is_in_m5c_and_is_not_core() {
|
||||
let r = Registry::m5c();
|
||||
let entry = r.get(CONSULT).expect("consult");
|
||||
assert!(!entry.core);
|
||||
assert_eq!(entry.schema, consult::schema());
|
||||
assert_eq!(
|
||||
core_names(&r),
|
||||
[
|
||||
"clock",
|
||||
"recall",
|
||||
"memory",
|
||||
"ask_memory",
|
||||
"find_tool",
|
||||
"call_tool"
|
||||
]
|
||||
);
|
||||
assert!(r.find("consult").iter().any(|s| s.name == CONSULT));
|
||||
assert!(r.find("remote").iter().any(|s| s.name == CONSULT));
|
||||
assert!(r.get("subagent").is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_baseline_from_m5c_does_not_put_consult_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"
|
||||
]
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user