WIP: Fix Arc::new() wrapping on tool handlers — some import/paren issues remain
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
12798eeae2
commit
daba424a46
9 changed files with 16 additions and 16 deletions
|
|
@ -18,7 +18,7 @@ pub(super) fn tools() -> [super::Tool; 3] {
|
||||||
a.pending_model_switch = Some(model.to_string());
|
a.pending_model_switch = Some(model.to_string());
|
||||||
}
|
}
|
||||||
Ok(format!("Switching to model '{}' after this turn.", model))
|
Ok(format!("Switching to model '{}' after this turn.", model))
|
||||||
}) },
|
})) },
|
||||||
Tool { name: "pause",
|
Tool { name: "pause",
|
||||||
description: "Pause all autonomous behavior. Only the user can unpause (Ctrl+P or /wake).",
|
description: "Pause all autonomous behavior. Only the user can unpause (Ctrl+P or /wake).",
|
||||||
parameters_json: r#"{"type":"object","properties":{}}"#,
|
parameters_json: r#"{"type":"object","properties":{}}"#,
|
||||||
|
|
@ -29,7 +29,7 @@ pub(super) fn tools() -> [super::Tool; 3] {
|
||||||
a.pending_dmn_pause = true;
|
a.pending_dmn_pause = true;
|
||||||
}
|
}
|
||||||
Ok("Pausing autonomous behavior. Only user input will wake you.".into())
|
Ok("Pausing autonomous behavior. Only user input will wake you.".into())
|
||||||
}) },
|
})) },
|
||||||
Tool { name: "yield_to_user",
|
Tool { name: "yield_to_user",
|
||||||
description: "Wait for user input before continuing. The only way to enter a waiting state.",
|
description: "Wait for user input before continuing. The only way to enter a waiting state.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"message":{"type":"string","description":"Optional status message"}}}"#,
|
parameters_json: r#"{"type":"object","properties":{"message":{"type":"string","description":"Optional status message"}}}"#,
|
||||||
|
|
@ -40,6 +40,6 @@ pub(super) fn tools() -> [super::Tool; 3] {
|
||||||
a.pending_yield = true;
|
a.pending_yield = true;
|
||||||
}
|
}
|
||||||
Ok(format!("Yielding. {}", msg))
|
Ok(format!("Yielding. {}", msg))
|
||||||
}) },
|
})) },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ pub fn tool() -> super::Tool {
|
||||||
name: "edit_file",
|
name: "edit_file",
|
||||||
description: "Perform exact string replacement in a file. The old_string must appear exactly once (unless replace_all is true). Use read_file first to see current contents.",
|
description: "Perform exact string replacement in a file. The old_string must appear exactly once (unless replace_all is true). Use read_file first to see current contents.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Absolute path to the file to edit"},"old_string":{"type":"string","description":"The exact text to find and replace"},"new_string":{"type":"string","description":"The replacement text"},"replace_all":{"type":"boolean","description":"Replace all occurrences (default false)"}},"required":["file_path","old_string","new_string"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Absolute path to the file to edit"},"old_string":{"type":"string","description":"The exact text to find and replace"},"new_string":{"type":"string","description":"The replacement text"},"replace_all":{"type":"boolean","description":"Replace all occurrences (default false)"}},"required":["file_path","old_string","new_string"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { edit_file(&v)) }),
|
handler: Arc::new(|_a, v| Box::pin(async move { edit_file(&v) })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ pub fn tool() -> super::Tool {
|
||||||
name: "glob",
|
name: "glob",
|
||||||
description: "Find files matching a glob pattern. Returns file paths sorted by modification time (newest first).",
|
description: "Find files matching a glob pattern. Returns file paths sorted by modification time (newest first).",
|
||||||
parameters_json: r#"{"type":"object","properties":{"pattern":{"type":"string","description":"Glob pattern to match files (e.g. '**/*.rs')"},"path":{"type":"string","description":"Directory to search in (default: current directory)"}},"required":["pattern"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"pattern":{"type":"string","description":"Glob pattern to match files (e.g. '**/*.rs')"},"path":{"type":"string","description":"Directory to search in (default: current directory)"}},"required":["pattern"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { glob_search(&v)) }),
|
handler: Arc::new(|_a, v| Box::pin(async move { glob_search(&v) })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ pub fn tool() -> super::Tool {
|
||||||
name: "grep",
|
name: "grep",
|
||||||
description: "Search for a pattern in files. Returns matching file paths by default, or matching lines with context.",
|
description: "Search for a pattern in files. Returns matching file paths by default, or matching lines with context.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"pattern":{"type":"string","description":"Regex pattern to search for"},"path":{"type":"string","description":"Directory or file to search in (default: current directory)"},"glob":{"type":"string","description":"Glob pattern to filter files (e.g. '*.rs')"},"show_content":{"type":"boolean","description":"Show matching lines instead of just file paths"},"context_lines":{"type":"integer","description":"Lines of context around matches"}},"required":["pattern"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"pattern":{"type":"string","description":"Regex pattern to search for"},"path":{"type":"string","description":"Directory or file to search in (default: current directory)"},"glob":{"type":"string","description":"Glob pattern to filter files (e.g. '*.rs')"},"show_content":{"type":"boolean","description":"Show matching lines instead of just file paths"},"context_lines":{"type":"integer","description":"Lines of context around matches"}},"required":["pattern"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { grep(&v)) }),
|
handler: Arc::new(|_a, v| Box::pin(async move { grep(&v) })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ pub fn tool() -> super::Tool {
|
||||||
name: "read_file",
|
name: "read_file",
|
||||||
description: "Read the contents of a file. Returns the file contents with line numbers.",
|
description: "Read the contents of a file. Returns the file contents with line numbers.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Absolute path to the file to read"},"offset":{"type":"integer","description":"Line number to start reading from (1-based)"},"limit":{"type":"integer","description":"Maximum number of lines to read"}},"required":["file_path"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Absolute path to the file to read"},"offset":{"type":"integer","description":"Line number to start reading from (1-based)"},"limit":{"type":"integer","description":"Maximum number of lines to read"}},"required":["file_path"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { read_file(&v)) }),
|
handler: Arc::new(|_a, v| Box::pin(async move { read_file(&v) })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ pub fn tool() -> super::Tool {
|
||||||
name: "view_image",
|
name: "view_image",
|
||||||
description: "View an image file or capture a tmux pane screenshot. Supports PNG, JPEG, GIF, WebP. Use pane_id to capture a tmux pane instead.",
|
description: "View an image file or capture a tmux pane screenshot. Supports PNG, JPEG, GIF, WebP. Use pane_id to capture a tmux pane instead.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Path to an image file"},"pane_id":{"type":"string","description":"Tmux pane ID to capture (e.g. '0:1.0')"},"lines":{"type":"integer","description":"Lines to capture from tmux pane (default 50)"}}}"#,
|
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Path to an image file"},"pane_id":{"type":"string","description":"Tmux pane ID to capture (e.g. '0:1.0')"},"lines":{"type":"integer","description":"Lines to capture from tmux pane (default 50)"}}}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { view_image_text(&v)) }),
|
handler: Arc::new(|_a, v| Box::pin(async move { view_image_text(&v) })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ pub fn tools() -> [super::Tool; 2] {
|
||||||
name: "web_fetch",
|
name: "web_fetch",
|
||||||
description: "Fetch content from a URL and return it as text. Use for reading web pages, API responses, documentation.",
|
description: "Fetch content from a URL and return it as text. Use for reading web pages, API responses, documentation.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"url":{"type":"string","description":"The URL to fetch"}},"required":["url"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"url":{"type":"string","description":"The URL to fetch"}},"required":["url"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { web_fetch(&v).await }),
|
handler: Arc::new(|_a, v| Box::pin(async move { web_fetch(&v).await })),
|
||||||
},
|
},
|
||||||
super::Tool {
|
super::Tool {
|
||||||
name: "web_search",
|
name: "web_search",
|
||||||
description: "Search the web and return results. Use for finding documentation, looking up APIs, researching topics.",
|
description: "Search the web and return results. Use for finding documentation, looking up APIs, researching topics.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"query":{"type":"string","description":"The search query"},"num_results":{"type":"integer","description":"Number of results to return (default 5)"}},"required":["query"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"query":{"type":"string","description":"The search query"},"num_results":{"type":"integer","description":"Number of results to return (default 5)"}},"required":["query"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { web_search(&v).await }),
|
handler: Arc::new(|_a, v| Box::pin(async move { web_search(&v).await })),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ pub fn tool() -> super::Tool {
|
||||||
name: "write_file",
|
name: "write_file",
|
||||||
description: "Create or overwrite a file with the given content.",
|
description: "Create or overwrite a file with the given content.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Absolute path to write"},"content":{"type":"string","description":"File content"}},"required":["file_path","content"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"file_path":{"type":"string","description":"Absolute path to write"},"content":{"type":"string","description":"File content"}},"required":["file_path","content"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { write_file(&v)) }),
|
handler: Arc::new(|_a, v| Box::pin(async move { write_file(&v) })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -663,31 +663,31 @@ pub fn digest_tools() -> [super::super::agent::tools::Tool; 5] {
|
||||||
name: "digest_daily",
|
name: "digest_daily",
|
||||||
description: "Generate a daily digest from journal entries.",
|
description: "Generate a daily digest from journal entries.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"date":{"type":"string","description":"Date in YYYY-MM-DD format"}}, "required":["date"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"date":{"type":"string","description":"Date in YYYY-MM-DD format"}}, "required":["date"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_daily(_a, v).await }),
|
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_daily(_a, v).await })),
|
||||||
},
|
},
|
||||||
Tool {
|
Tool {
|
||||||
name: "digest_weekly",
|
name: "digest_weekly",
|
||||||
description: "Generate a weekly digest from daily digests.",
|
description: "Generate a weekly digest from daily digests.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"week":{"type":"string","description":"Week label (YYYY-W##) or date (YYYY-MM-DD)"}}, "required":["week"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"week":{"type":"string","description":"Week label (YYYY-W##) or date (YYYY-MM-DD)"}}, "required":["week"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_weekly(_a, v).await }),
|
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_weekly(_a, v).await })),
|
||||||
},
|
},
|
||||||
Tool {
|
Tool {
|
||||||
name: "digest_monthly",
|
name: "digest_monthly",
|
||||||
description: "Generate a monthly digest from weekly digests.",
|
description: "Generate a monthly digest from weekly digests.",
|
||||||
parameters_json: r#"{"type":"object","properties":{"month":{"type":"string","description":"Month label (YYYY-MM) or date (YYYY-MM-DD)"}}, "required":["month"]}"#,
|
parameters_json: r#"{"type":"object","properties":{"month":{"type":"string","description":"Month label (YYYY-MM) or date (YYYY-MM-DD)"}}, "required":["month"]}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_monthly(_a, v).await }),
|
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_monthly(_a, v).await })),
|
||||||
},
|
},
|
||||||
Tool {
|
Tool {
|
||||||
name: "digest_auto",
|
name: "digest_auto",
|
||||||
description: "Auto-generate all missing digests (daily, weekly, monthly) for past dates that have content but no digest yet.",
|
description: "Auto-generate all missing digests (daily, weekly, monthly) for past dates that have content but no digest yet.",
|
||||||
parameters_json: r#"{"type":"object","properties":{}}"#,
|
parameters_json: r#"{"type":"object","properties":{}}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_auto(_a, v).await }),
|
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_auto(_a, v).await })),
|
||||||
},
|
},
|
||||||
Tool {
|
Tool {
|
||||||
name: "digest_links",
|
name: "digest_links",
|
||||||
description: "Parse and apply structural links from digest nodes to the memory graph.",
|
description: "Parse and apply structural links from digest nodes to the memory graph.",
|
||||||
parameters_json: r#"{"type":"object","properties":{}}"#,
|
parameters_json: r#"{"type":"object","properties":{}}"#,
|
||||||
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_links(_a, v).await }),
|
handler: Arc::new(|_a, v| Box::pin(async move { handle_digest_links(_a, v).await })),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue