(appId string, builderId string)
| 193 | } |
| 194 | |
| 195 | func GetBuilderEditAppFileToolDefinition(appId string, builderId string) uctypes.ToolDefinition { |
| 196 | return uctypes.ToolDefinition{ |
| 197 | Name: "builder_edit_app_file", |
| 198 | DisplayName: "Edit App File", |
| 199 | Description: "Edit the app.go file for this app using precise search and replace. " + |
| 200 | "Each old_str must appear EXACTLY ONCE in the file or the edit will fail. " + |
| 201 | "Edits are applied sequentially - if an edit fails, all previous edits are kept and subsequent edits are skipped.", |
| 202 | ToolLogName: "builder:edit_app", |
| 203 | Strict: false, |
| 204 | InputSchema: map[string]any{ |
| 205 | "type": "object", |
| 206 | "properties": map[string]any{ |
| 207 | "edits": map[string]any{ |
| 208 | "type": "array", |
| 209 | "description": "Array of edit specifications. Edits are applied sequentially - if one fails, previous edits are kept but remaining edits are skipped.", |
| 210 | "items": map[string]any{ |
| 211 | "type": "object", |
| 212 | "properties": map[string]any{ |
| 213 | "old_str": map[string]any{ |
| 214 | "type": "string", |
| 215 | "description": "The exact string to find and replace. MUST appear exactly once in the file - if it appears zero times or multiple times, this edit will fail.", |
| 216 | }, |
| 217 | "new_str": map[string]any{ |
| 218 | "type": "string", |
| 219 | "description": "The string to replace with", |
| 220 | }, |
| 221 | "desc": map[string]any{ |
| 222 | "type": "string", |
| 223 | "description": "Description of what this edit does (keep short, half a line of text max)", |
| 224 | }, |
| 225 | }, |
| 226 | "required": []string{"old_str", "new_str"}, |
| 227 | }, |
| 228 | }, |
| 229 | }, |
| 230 | "required": []string{"edits"}, |
| 231 | "additionalProperties": false, |
| 232 | }, |
| 233 | ToolCallDesc: func(input any, output any, toolUseData *uctypes.UIMessageDataToolUse) string { |
| 234 | params, err := parseBuilderEditAppFileInput(input) |
| 235 | if err != nil { |
| 236 | return fmt.Sprintf("error parsing input: %v", err) |
| 237 | } |
| 238 | return strings.Join(formatEditDescriptions(params.Edits), "\n") |
| 239 | }, |
| 240 | ToolProgressDesc: func(input any) ([]string, error) { |
| 241 | params, err := parseBuilderEditAppFileInput(input) |
| 242 | if err != nil { |
| 243 | return nil, err |
| 244 | } |
| 245 | return formatEditDescriptions(params.Edits), nil |
| 246 | }, |
| 247 | ToolAnyCallback: func(input any, toolUseData *uctypes.UIMessageDataToolUse) (any, error) { |
| 248 | params, err := parseBuilderEditAppFileInput(input) |
| 249 | if err != nil { |
| 250 | return nil, err |
| 251 | } |
| 252 |
no test coverage detected