summaryrefslogtreecommitdiff
path: root/makima/src/llm/contract_tools.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/llm/contract_tools.rs')
-rw-r--r--makima/src/llm/contract_tools.rs107
1 files changed, 40 insertions, 67 deletions
diff --git a/makima/src/llm/contract_tools.rs b/makima/src/llm/contract_tools.rs
index 44c1e20..0f50132 100644
--- a/makima/src/llm/contract_tools.rs
+++ b/makima/src/llm/contract_tools.rs
@@ -64,30 +64,8 @@ pub static CONTRACT_TOOLS: once_cell::sync::Lazy<Vec<Tool>> = once_cell::sync::L
// File Management Tools
// =============================================================================
Tool {
- name: "create_file_from_template".to_string(),
- description: "Create a new file in the contract from a template. Templates are phase-appropriate document structures.".to_string(),
- parameters: json!({
- "type": "object",
- "properties": {
- "template_id": {
- "type": "string",
- "description": "ID of the template to use (e.g., 'research-notes', 'requirements', 'architecture')"
- },
- "name": {
- "type": "string",
- "description": "Name for the new file"
- },
- "description": {
- "type": "string",
- "description": "Optional description for the file"
- }
- },
- "required": ["template_id", "name"]
- }),
- },
- Tool {
name: "create_empty_file".to_string(),
- description: "Create a new empty file in the contract without using a template.".to_string(),
+ description: "Create a new empty file in the contract.".to_string(),
parameters: json!({
"type": "object",
"properties": {
@@ -103,18 +81,26 @@ pub static CONTRACT_TOOLS: once_cell::sync::Lazy<Vec<Tool>> = once_cell::sync::L
"required": ["name"]
}),
},
+ // =============================================================================
+ // Deliverable Management Tools
+ // =============================================================================
Tool {
- name: "list_available_templates".to_string(),
- description: "List all available templates, optionally filtered by phase. Use this to see what templates can be used with create_file_from_template.".to_string(),
+ name: "mark_deliverable_complete".to_string(),
+ description: "Mark a phase deliverable as complete. Use this when you have verified that a deliverable requirement has been satisfied. Use get_phase_info or check_deliverables_met first to see available deliverable IDs.".to_string(),
parameters: json!({
"type": "object",
"properties": {
+ "deliverable_id": {
+ "type": "string",
+ "description": "The ID of the deliverable to mark as complete (e.g., 'plan-document', 'pull-request', 'research-notes')"
+ },
"phase": {
"type": "string",
"enum": ["research", "specify", "plan", "execute", "review"],
- "description": "Optional filter to show only templates for a specific phase"
+ "description": "Phase the deliverable belongs to. Defaults to the current contract phase if not specified."
}
- }
+ },
+ "required": ["deliverable_id"]
}),
},
// =============================================================================
@@ -488,16 +474,16 @@ pub enum ContractToolRequest {
ReadFile { file_id: Uuid },
// File management
- CreateFileFromTemplate {
- template_id: String,
- name: String,
- description: Option<String>,
- },
CreateEmptyFile {
name: String,
description: Option<String>,
},
- ListAvailableTemplates { phase: Option<String> },
+
+ // Deliverable management
+ MarkDeliverableComplete {
+ deliverable_id: String,
+ phase: Option<String>,
+ },
// Task management
CreateContractTask {
@@ -592,9 +578,10 @@ pub fn parse_contract_tool_call(call: &super::tools::ToolCall) -> ContractToolEx
"read_file" => parse_read_file(call),
// File management
- "create_file_from_template" => parse_create_file_from_template(call),
"create_empty_file" => parse_create_empty_file(call),
- "list_available_templates" => parse_list_available_templates(call),
+
+ // Deliverable management
+ "mark_deliverable_complete" => parse_mark_deliverable_complete(call),
// Task management
"create_contract_task" => parse_create_contract_task(call),
@@ -703,13 +690,9 @@ fn parse_read_file(call: &super::tools::ToolCall) -> ContractToolExecutionResult
// File Management Tool Parsing
// =============================================================================
-fn parse_create_file_from_template(call: &super::tools::ToolCall) -> ContractToolExecutionResult {
- let template_id = call.arguments.get("template_id").and_then(|v| v.as_str());
+fn parse_create_empty_file(call: &super::tools::ToolCall) -> ContractToolExecutionResult {
let name = call.arguments.get("name").and_then(|v| v.as_str());
- let Some(template_id) = template_id else {
- return error_result("Missing required parameter: template_id");
- };
let Some(name) = name else {
return error_result("Missing required parameter: name");
};
@@ -722,10 +705,9 @@ fn parse_create_file_from_template(call: &super::tools::ToolCall) -> ContractToo
ContractToolExecutionResult {
success: true,
- message: format!("Creating file '{}' from template '{}'...", name, template_id),
+ message: format!("Creating empty file '{}'...", name),
data: None,
- request: Some(ContractToolRequest::CreateFileFromTemplate {
- template_id: template_id.to_string(),
+ request: Some(ContractToolRequest::CreateEmptyFile {
name: name.to_string(),
description,
}),
@@ -733,32 +715,20 @@ fn parse_create_file_from_template(call: &super::tools::ToolCall) -> ContractToo
}
}
-fn parse_create_empty_file(call: &super::tools::ToolCall) -> ContractToolExecutionResult {
- let name = call.arguments.get("name").and_then(|v| v.as_str());
-
- let Some(name) = name else {
- return error_result("Missing required parameter: name");
- };
+// =============================================================================
+// Deliverable Management Tool Parsing
+// =============================================================================
- let description = call
+fn parse_mark_deliverable_complete(call: &super::tools::ToolCall) -> ContractToolExecutionResult {
+ let deliverable_id = call
.arguments
- .get("description")
- .and_then(|v| v.as_str())
- .map(|s| s.to_string());
+ .get("deliverable_id")
+ .and_then(|v| v.as_str());
- ContractToolExecutionResult {
- success: true,
- message: format!("Creating empty file '{}'...", name),
- data: None,
- request: Some(ContractToolRequest::CreateEmptyFile {
- name: name.to_string(),
- description,
- }),
- pending_questions: None,
- }
-}
+ let Some(deliverable_id) = deliverable_id else {
+ return error_result("Missing required parameter: deliverable_id");
+ };
-fn parse_list_available_templates(call: &super::tools::ToolCall) -> ContractToolExecutionResult {
let phase = call
.arguments
.get("phase")
@@ -767,9 +737,12 @@ fn parse_list_available_templates(call: &super::tools::ToolCall) -> ContractTool
ContractToolExecutionResult {
success: true,
- message: "Listing available templates...".to_string(),
+ message: format!("Marking deliverable '{}' as complete...", deliverable_id),
data: None,
- request: Some(ContractToolRequest::ListAvailableTemplates { phase }),
+ request: Some(ContractToolRequest::MarkDeliverableComplete {
+ deliverable_id: deliverable_id.to_string(),
+ phase,
+ }),
pending_questions: None,
}
}