|
6 | 6 | //! [`llm_coding_tools_core`]: llm_coding_tools_core |
7 | 7 |
|
8 | 8 | use llm_coding_tools_core::operations::EditError; |
| 9 | +use llm_coding_tools_core::tool_names; |
9 | 10 | use llm_coding_tools_core::{ToolError as CoreError, ToolOutput, ToolResult as CoreResult}; |
10 | 11 | use serde_json::json; |
11 | 12 | use serdes_ai::tools::{ToolError as SerdesError, ToolReturn}; |
@@ -68,28 +69,28 @@ pub fn to_serdes_result( |
68 | 69 | pub fn edit_error_to_serdes(err: EditError) -> SerdesError { |
69 | 70 | match err { |
70 | 71 | EditError::NotFound => SerdesError::validation_error( |
71 | | - "edit", |
| 72 | + tool_names::EDIT, |
72 | 73 | Some("old_string".to_string()), |
73 | 74 | "old_string not found in file content".to_string(), |
74 | 75 | ), |
75 | 76 | EditError::AmbiguousMatch(count) => SerdesError::validation_error( |
76 | | - "edit", |
| 77 | + tool_names::EDIT, |
77 | 78 | Some("old_string".to_string()), |
78 | 79 | format!( |
79 | 80 | "old_string found {count} times and requires more code context to uniquely identify the intended match" |
80 | 81 | ), |
81 | 82 | ), |
82 | 83 | EditError::EmptyOldString => SerdesError::validation_error( |
83 | | - "edit", |
| 84 | + tool_names::EDIT, |
84 | 85 | Some("old_string".to_string()), |
85 | 86 | "old_string must not be empty".to_string(), |
86 | 87 | ), |
87 | 88 | EditError::IdenticalStrings => SerdesError::validation_error( |
88 | | - "edit", |
| 89 | + tool_names::EDIT, |
89 | 90 | None, |
90 | 91 | "old_string and new_string must be different".to_string(), |
91 | 92 | ), |
92 | | - EditError::Tool(tool_err) => core_error_to_serdes("edit", tool_err), |
| 93 | + EditError::Tool(tool_err) => core_error_to_serdes(tool_names::EDIT, tool_err), |
93 | 94 | } |
94 | 95 | } |
95 | 96 |
|
|
0 commit comments