feat: Enhance OAuth module and OpenRouter client functionality
- Updated OAuth module to include unused imports for better clarity. - Refactored OpenRouterClient to improve chat functionality and added support for tools in chat requests. - Modified internet tools (Download, Fetch, Search) to use a more flexible internet mode check. - Introduced new Bash tools for managing background jobs (BashOutput, BashKill). - Enhanced workflow tool to parse and execute workflow scripts with arguments. - Updated status and workflow views to reflect new agent and findings counts. - Added IPC protocol definitions for client requests and state payloads.
This commit is contained in:
@@ -2,6 +2,7 @@ use std::path::PathBuf;
|
||||
use serde_json::Value;
|
||||
use anyhow::Result;
|
||||
|
||||
pub mod bash_tools;
|
||||
pub mod fs;
|
||||
pub mod git_cred;
|
||||
pub mod git_operator;
|
||||
@@ -28,6 +29,7 @@ pub struct GraduatedCheck {
|
||||
pub rule: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ToolCtx {
|
||||
pub workspaces: Vec<PathBuf>,
|
||||
pub session_dir: PathBuf,
|
||||
@@ -116,6 +118,8 @@ pub fn all_tools() -> Vec<Box<dyn Tool>> {
|
||||
Box::new(super::tool::fs::edit::Edit),
|
||||
Box::new(super::tool::search::Grep),
|
||||
Box::new(super::tool::search::Glob),
|
||||
Box::new(super::tool::bash_tools::BashOutput),
|
||||
Box::new(super::tool::bash_tools::BashKill),
|
||||
Box::new(super::tool::shell::Bash),
|
||||
Box::new(super::tool::git_operator::GitOperator),
|
||||
Box::new(super::tool::git_worktree::GitWorktree),
|
||||
@@ -124,6 +128,9 @@ pub fn all_tools() -> Vec<Box<dyn Tool>> {
|
||||
Box::new(super::tool::plan::PlanEnter),
|
||||
Box::new(super::tool::plan::PlanReady),
|
||||
Box::new(super::tool::workflow::WorkflowRun),
|
||||
Box::new(super::tool::internet::fetch::Fetch),
|
||||
Box::new(super::tool::internet::download::Download),
|
||||
Box::new(super::tool::internet::search::Search),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -131,6 +138,20 @@ pub fn tool_is_risky(name: &str) -> bool {
|
||||
matches!(name, "write" | "delete" | "edit" | "bash" | "git_operator")
|
||||
}
|
||||
|
||||
pub fn tool_defs(tools: &[Box<dyn Tool>]) -> Vec<crate::dto::openrouter::request::ToolDef> {
|
||||
tools
|
||||
.iter()
|
||||
.map(|t| crate::dto::openrouter::request::ToolDef {
|
||||
type_: "function".to_string(),
|
||||
function: crate::dto::openrouter::request::ToolFunctionDef {
|
||||
name: t.name().to_string(),
|
||||
description: t.description().to_string(),
|
||||
parameters: t.parameters(),
|
||||
},
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub const DEFERRED_TOOLS: &[&str] = &[
|
||||
"read", "write", "edit", "bash", "grep", "glob",
|
||||
"git_operator", "git_worktree", "git_cred",
|
||||
|
||||
Reference in New Issue
Block a user