delete dead code: channel-test, mcp-schema, cmd_mcp_schema
channel-test was a debug tool, mcp-schema was superseded by consciousness-mcp, cmd_mcp_schema in cli/misc.rs was the old poc-memory subcommand. Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
2208e68b4f
commit
61deb7d488
5 changed files with 2 additions and 158 deletions
|
|
@ -105,10 +105,6 @@ path = "src/claude/poc-daemon.rs"
|
|||
name = "memory-search"
|
||||
path = "src/claude/memory-search.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "mcp-schema"
|
||||
path = "src/claude/mcp-schema.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "consciousness-mcp"
|
||||
path = "src/claude/mcp-server.rs"
|
||||
|
|
|
|||
|
|
@ -1,80 +0,0 @@
|
|||
// channel-test — quick RPC test tool for channel daemons
|
||||
//
|
||||
// Usage: channel-test <socket-path> [list|recv|send <channel> <msg>]
|
||||
|
||||
use capnp_rpc::{rpc_twoparty_capnp, twoparty, RpcSystem};
|
||||
use futures::AsyncReadExt;
|
||||
use tokio::net::UnixStream;
|
||||
use tokio_util::compat::TokioAsyncReadCompatExt;
|
||||
|
||||
use poc_memory::channel_capnp::channel_server;
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
if args.len() < 2 {
|
||||
eprintln!("usage: channel-test <socket-path> [list|recv <channel>|send <channel> <msg>]");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
let sock_path = args[1].clone();
|
||||
let cmd = args.get(2).cloned().unwrap_or_else(|| "list".to_string());
|
||||
let arg3 = args.get(3).cloned().unwrap_or_default();
|
||||
let arg_rest: String = args.iter().skip(4).cloned().collect::<Vec<_>>().join(" ");
|
||||
|
||||
tokio::task::LocalSet::new()
|
||||
.run_until(async move {
|
||||
let stream = UnixStream::connect(&sock_path).await?;
|
||||
let (reader, writer) = stream.compat().split();
|
||||
let rpc_network = Box::new(twoparty::VatNetwork::new(
|
||||
futures::io::BufReader::new(reader),
|
||||
futures::io::BufWriter::new(writer),
|
||||
rpc_twoparty_capnp::Side::Client,
|
||||
Default::default(),
|
||||
));
|
||||
let mut rpc_system = RpcSystem::new(rpc_network, None);
|
||||
let client: channel_server::Client =
|
||||
rpc_system.bootstrap(rpc_twoparty_capnp::Side::Server);
|
||||
tokio::task::spawn_local(rpc_system);
|
||||
|
||||
match cmd.as_str() {
|
||||
"list" => {
|
||||
let reply = client.list_request().send().promise.await?;
|
||||
let channels = reply.get()?.get_channels()?;
|
||||
println!("{} channels:", channels.len());
|
||||
for ch in channels.iter() {
|
||||
let name = ch.get_name()?.to_str()?;
|
||||
let connected = ch.get_connected();
|
||||
let unread = ch.get_unread();
|
||||
println!(" {} connected={} unread={}", name, connected, unread);
|
||||
}
|
||||
}
|
||||
"recv" => {
|
||||
let mut req = client.recv_request();
|
||||
req.get().set_channel(&arg3);
|
||||
req.get().set_all_new(true);
|
||||
req.get().set_min_count(20);
|
||||
let reply = req.send().promise.await?;
|
||||
let text = reply.get()?.get_text()?.to_str()?;
|
||||
if text.is_empty() {
|
||||
println!("(no messages)");
|
||||
} else {
|
||||
println!("{}", text);
|
||||
}
|
||||
}
|
||||
"send" => {
|
||||
let mut req = client.send_request();
|
||||
req.get().set_channel(&arg3);
|
||||
req.get().set_message(&arg_rest);
|
||||
req.send().promise.await?;
|
||||
println!("sent to {}", arg3);
|
||||
}
|
||||
_ => {
|
||||
eprintln!("unknown command: {}", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
Ok::<(), Box<dyn std::error::Error>>(())
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
// mcp-schema — Output MCP tool definitions as JSON
|
||||
//
|
||||
// Claude Code's Python MCP bridge calls this at startup to
|
||||
// discover available tools. The Rust ToolDef definitions are
|
||||
// the source of truth.
|
||||
|
||||
fn main() {
|
||||
use serde_json::json;
|
||||
|
||||
// Map tool names to CLI args + stdin param.
|
||||
let cli_map: std::collections::HashMap<&str, (Vec<&str>, Option<&str>)> = [
|
||||
("memory_render", (vec!["render"], None)),
|
||||
("memory_write", (vec!["write"], Some("content"))),
|
||||
("memory_search", (vec!["graph", "spread"], None)),
|
||||
("memory_links", (vec!["graph", "link"], None)),
|
||||
("memory_link_set", (vec!["graph", "link-set"], None)),
|
||||
("memory_link_add", (vec!["graph", "link-add"], None)),
|
||||
("memory_used", (vec!["used"], None)),
|
||||
("memory_weight_set", (vec!["weight-set"], None)),
|
||||
("memory_rename", (vec!["node", "rename"], None)),
|
||||
("memory_query", (vec!["query"], None)),
|
||||
].into_iter().collect();
|
||||
|
||||
let defs = poc_memory::thought::memory::definitions();
|
||||
let json_out: Vec<_> = defs.iter().filter_map(|d| {
|
||||
let name = &d.function.name;
|
||||
let (cli, stdin_param) = cli_map.get(name.as_str())?;
|
||||
Some(json!({
|
||||
"name": name,
|
||||
"description": d.function.description,
|
||||
"inputSchema": d.function.parameters,
|
||||
"cli": cli,
|
||||
"stdin_param": stdin_param,
|
||||
}))
|
||||
}).collect();
|
||||
|
||||
println!("{}", serde_json::to_string_pretty(&json_out).unwrap());
|
||||
}
|
||||
|
|
@ -265,41 +265,7 @@ pub fn get_group_content(group: &crate::config::ContextGroup, store: &crate::sto
|
|||
/// - stdin_param: which parameter (if any) should be sent via stdin
|
||||
///
|
||||
/// Tools with cli=null are agent-internal (not exposed via MCP CLI bridge).
|
||||
pub fn cmd_mcp_schema() -> Result<(), String> {
|
||||
use serde_json::json;
|
||||
|
||||
// Map tool names to CLI args + stdin param.
|
||||
// Tools not listed here are skipped (agent-internal).
|
||||
let cli_map: std::collections::HashMap<&str, (Vec<&str>, Option<&str>)> = [
|
||||
("memory_render", (vec!["render"], None)),
|
||||
("memory_write", (vec!["write"], Some("content"))),
|
||||
("memory_search", (vec!["graph", "spread"], None)),
|
||||
("memory_links", (vec!["graph", "link"], None)),
|
||||
("memory_link_set", (vec!["graph", "link-set"], None)),
|
||||
("memory_link_add", (vec!["graph", "link-add"], None)),
|
||||
("memory_used", (vec!["used"], None)),
|
||||
("memory_weight_set", (vec!["weight-set"], None)),
|
||||
("memory_rename", (vec!["node", "rename"], None)),
|
||||
("memory_query", (vec!["query"], None)),
|
||||
].into_iter().collect();
|
||||
|
||||
let defs = crate::thought::memory::definitions();
|
||||
let json_out: Vec<_> = defs.iter().filter_map(|d| {
|
||||
let name = &d.function.name;
|
||||
let (cli, stdin_param) = cli_map.get(name.as_str())?;
|
||||
Some(json!({
|
||||
"name": name,
|
||||
"description": d.function.description,
|
||||
"inputSchema": d.function.parameters,
|
||||
"cli": cli,
|
||||
"stdin_param": stdin_param,
|
||||
}))
|
||||
}).collect();
|
||||
|
||||
println!("{}", serde_json::to_string_pretty(&json_out)
|
||||
.map_err(|e| e.to_string())?);
|
||||
Ok(())
|
||||
}
|
||||
// mcp-schema moved to consciousness-mcp binary (src/claude/mcp-server.rs)
|
||||
|
||||
pub fn cmd_load_context(stats: bool) -> Result<(), String> {
|
||||
let cfg = crate::config::get();
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ impl Run for Command {
|
|||
Self::Cursor(sub) => sub.run(),
|
||||
Self::Agent(sub) => sub.run(),
|
||||
Self::Admin(sub) => sub.run(),
|
||||
// mcp-schema moved to standalone binary src/claude/mcp-schema.rs
|
||||
// mcp-schema moved to consciousness-mcp binary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue