Pods
This commit is contained in:
parent
f75c11b67d
commit
c325a7bc4f
3 changed files with 70 additions and 2 deletions
|
|
@ -28,8 +28,9 @@ pub use project::{Project, ProjectFile, ProjectId, ProjectSettings};
|
||||||
pub use task::{Task, TaskResult};
|
pub use task::{Task, TaskResult};
|
||||||
pub use todo::{Dependency, ToDo};
|
pub use todo::{Dependency, ToDo};
|
||||||
pub use tools::{
|
pub use tools::{
|
||||||
format_tool_error, format_tool_result, parse_tool_call_blocks, parse_tool_call_stream,
|
format_tool_error, format_tools_json, format_tool_result, parse_tool_call_blocks,
|
||||||
tool_definitions, CompositionStep, ExecutionContext, MarketplaceSearchResults, ParsedToolCall,
|
parse_tool_call_stream, tool_definitions, tool_ids_for_agent_type, CompositionStep,
|
||||||
|
ExecutionContext, MarketplaceSearchResults, ParsedToolCall,
|
||||||
TestAction, ToolComposition, ToolDefinition, ToolDependency, ToolDocumentation, ToolExample,
|
TestAction, ToolComposition, ToolDefinition, ToolDependency, ToolDocumentation, ToolExample,
|
||||||
ToolListing, ToolParser, ToolPlugin, ToolTest, ToolTestResult, ToolTestSuite,
|
ToolListing, ToolParser, ToolPlugin, ToolTest, ToolTestResult, ToolTestSuite,
|
||||||
ToolTestSuiteResult, ToolVersion,
|
ToolTestSuiteResult, ToolVersion,
|
||||||
|
|
|
||||||
15
src/task.rs
15
src/task.rs
|
|
@ -174,6 +174,15 @@ pub struct FileRange {
|
||||||
pub line_end: u32,
|
pub line_end: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct ConnectorConfig {
|
||||||
|
pub api_key: String,
|
||||||
|
pub base_url: String,
|
||||||
|
pub model: String,
|
||||||
|
pub max_tokens: Option<i32>,
|
||||||
|
pub temperature: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct AgentTaskSpec {
|
pub struct AgentTaskSpec {
|
||||||
pub task_id: Uuid,
|
pub task_id: Uuid,
|
||||||
|
|
@ -196,6 +205,10 @@ pub struct AgentTaskSpec {
|
||||||
pub suggested_test_files: Vec<String>,
|
pub suggested_test_files: Vec<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub project_id: Option<Uuid>,
|
pub project_id: Option<Uuid>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub connector_config: Option<ConnectorConfig>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub tools_json: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AgentTaskSpec {
|
impl AgentTaskSpec {
|
||||||
|
|
@ -224,6 +237,8 @@ impl AgentTaskSpec {
|
||||||
agent_type: None,
|
agent_type: None,
|
||||||
suggested_test_files: Vec::new(),
|
suggested_test_files: Vec::new(),
|
||||||
project_id: None,
|
project_id: None,
|
||||||
|
connector_config: None,
|
||||||
|
tools_json: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
52
src/tools.rs
52
src/tools.rs
|
|
@ -1534,6 +1534,58 @@ pub fn tool_definitions() -> Vec<ToolDefinition> {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the tool IDs appropriate for a given agent type.
|
||||||
|
/// Used by the dispatcher to embed tool definitions in task specs.
|
||||||
|
pub fn tool_ids_for_agent_type(agent_type: &crate::agents::AgentType) -> Option<Vec<&'static str>> {
|
||||||
|
Some(match agent_type {
|
||||||
|
crate::agents::AgentType::BuildAgent => vec![
|
||||||
|
"read_file", "write_file", "edit_file", "list_directory", "search_files",
|
||||||
|
"bash", "cargo_check", "npm_build", "python_check", "test_runner",
|
||||||
|
"create_workspace", "kanban_create_todo", "kanban_update_todo",
|
||||||
|
"kanban_create_task", "list_files", "submit_batch_plan", "report_completion",
|
||||||
|
],
|
||||||
|
crate::agents::AgentType::DocAgent => vec![
|
||||||
|
"read_file", "search_files", "list_files", "list_directory",
|
||||||
|
"find_references", "file_dependencies", "get_documentation_context",
|
||||||
|
"documentation_tree", "store_file_doc",
|
||||||
|
],
|
||||||
|
crate::agents::AgentType::TestJudge => vec![
|
||||||
|
"read_file", "search_files", "list_files", "list_directory",
|
||||||
|
"bash", "kanban_create_todo", "kanban_update_todo", "report_completion",
|
||||||
|
],
|
||||||
|
crate::agents::AgentType::Planner => vec![
|
||||||
|
"kanban_list_board", "kanban_create_todo", "kanban_update_todo",
|
||||||
|
"kanban_delete_todo", "kanban_move_todo", "kanban_create_task",
|
||||||
|
"kanban_update_task", "kanban_add_tag", "document_file", "document_project",
|
||||||
|
"find_references", "file_dependencies", "documentation_tree",
|
||||||
|
"verify_documentation", "document_folder", "get_documentation_context",
|
||||||
|
"list_files", "propose_strategic_item", "change_planner_mode",
|
||||||
|
"audit_assumptions", "identify_blind_spots", "check_dependencies",
|
||||||
|
"evaluate_plan_risk", "compare_project_patterns", "find_similar_risks",
|
||||||
|
"store_file_doc", "read_file",
|
||||||
|
],
|
||||||
|
crate::agents::AgentType::ChatAgent => return None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Formats tool definitions as OpenAI-compatible tools JSON.
|
||||||
|
pub fn format_tools_json(tools: &[ToolDefinition]) -> Option<String> {
|
||||||
|
let formatted: Vec<serde_json::Value> = tools
|
||||||
|
.iter()
|
||||||
|
.map(|t| {
|
||||||
|
serde_json::json!({
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": t.name,
|
||||||
|
"description": t.description,
|
||||||
|
"parameters": t.parameters,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
serde_json::to_string(&formatted).ok()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue