llm and everything: Update ToolResult to use []Content instead of string for multimodal support

This was a journey. The sketch-generated summary below is acceptable,
but I want to tell you about it in my voice too. The goal was to send
screenshots to Claude, so that it could... look at them. Currently
the take screenshot and read screenshot tools are different, and they'll
need to be renamed/prompt-engineered a bit, but that's all fine.

The miserable part was that we had to change the return value
of tool from string to Content[], and this crosses several layers:
 - llm.Tool
 - llm.Content
 - ant.Content & openai and gemini friends
 - AgentMessage [we left this alone]

Extra fun is that Claude's API for sending images has nested Content
fields, and empty string and missing needs to be distinguished for the
Text field (because lots of shell commands return the empty string!).

For the UI, I made us transform the results into a string, dropping
images. This would have been yet more churn for not much obvious
benefit. Plus, it was going to break skaband's compatibility, and ...
yet more work.

OpenAI and Gemini don't obviously support images in this same way,
so they just don't get the tools.

~~~~~~~~~~ Sketch said:

This architectural change transforms tool results from plain strings to []Content arrays, enabling multimodal interaction in the system. Key changes include:

- Core structural changes:
  - Modified ToolResult type from string to []Content across all packages
  - Added MediaType field to Content struct for MIME type support
  - Created TextContent and ImageContent helper functions
  - Updated all tool.Run implementations to return []Content

- Image handling:
  - Implemented base64 image support in Anthropic adapter
  - Added proper media type detection and content formatting
  - Created browser_read_image tool for displaying screenshots
  - Updated browser_screenshot to provide usable image paths

- Adapter improvements:
  - Updated all LLM adapters (ANT, OAI, GEM) to handle content arrays
  - Added specialized image content handling in the Anthropic adapter
  - Ensured proper JSON serialization/deserialization for all content types
  - Improved test coverage for content arrays

- UI enhancements:
  - Added omitempty tags to reduce JSON response size
  - Updated TypeScript types to handle array content
  - Made field naming consistent (tool_error vs is_error)
  - Preserved backward compatibility for existing consumers

Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s1a2b3c4d5e6f7g8h
diff --git a/claudetool/edit.go b/claudetool/edit.go
index 50084b7..b539cd6 100644
--- a/claudetool/edit.go
+++ b/claudetool/edit.go
@@ -67,55 +67,75 @@
 }
 
 // EditRun is the implementation of the edit tool
-func EditRun(ctx context.Context, input json.RawMessage) (string, error) {
+func EditRun(ctx context.Context, input json.RawMessage) ([]llm.Content, error) {
 	var editRequest editInput
 	if err := json.Unmarshal(input, &editRequest); err != nil {
-		return "", fmt.Errorf("failed to parse edit input: %v", err)
+		return nil, fmt.Errorf("failed to parse edit input: %v", err)
 	}
 
 	// Validate the command
 	cmd := editCommand(editRequest.Command)
 	if !isValidCommand(cmd) {
-		return "", fmt.Errorf("unrecognized command %s. The allowed commands are: view, create, str_replace, insert, undo_edit", cmd)
+		return nil, fmt.Errorf("unrecognized command %s. The allowed commands are: view, create, str_replace, insert, undo_edit", cmd)
 	}
 
 	path := editRequest.Path
 
 	// Validate the path
 	if err := validatePath(cmd, path); err != nil {
-		return "", err
+		return nil, err
 	}
 
 	// Execute the appropriate command
 	switch cmd {
 	case viewCommand:
-		return handleView(ctx, path, editRequest.ViewRange)
+		result, err := handleView(ctx, path, editRequest.ViewRange)
+		if err != nil {
+			return nil, err
+		}
+		return llm.TextContent(result), nil
 	case createCommand:
 		if editRequest.FileText == nil {
-			return "", fmt.Errorf("parameter file_text is required for command: create")
+			return nil, fmt.Errorf("parameter file_text is required for command: create")
 		}
-		return handleCreate(path, *editRequest.FileText)
+		result, err := handleCreate(path, *editRequest.FileText)
+		if err != nil {
+			return nil, err
+		}
+		return llm.TextContent(result), nil
 	case strReplaceCommand:
 		if editRequest.OldStr == nil {
-			return "", fmt.Errorf("parameter old_str is required for command: str_replace")
+			return nil, fmt.Errorf("parameter old_str is required for command: str_replace")
 		}
 		newStr := ""
 		if editRequest.NewStr != nil {
 			newStr = *editRequest.NewStr
 		}
-		return handleStrReplace(path, *editRequest.OldStr, newStr)
+		result, err := handleStrReplace(path, *editRequest.OldStr, newStr)
+		if err != nil {
+			return nil, err
+		}
+		return llm.TextContent(result), nil
 	case insertCommand:
 		if editRequest.InsertLine == nil {
-			return "", fmt.Errorf("parameter insert_line is required for command: insert")
+			return nil, fmt.Errorf("parameter insert_line is required for command: insert")
 		}
 		if editRequest.NewStr == nil {
-			return "", fmt.Errorf("parameter new_str is required for command: insert")
+			return nil, fmt.Errorf("parameter new_str is required for command: insert")
 		}
-		return handleInsert(path, *editRequest.InsertLine, *editRequest.NewStr)
+		result, err := handleInsert(path, *editRequest.InsertLine, *editRequest.NewStr)
+		if err != nil {
+			return nil, err
+		}
+		return llm.TextContent(result), nil
 	case undoEditCommand:
-		return handleUndoEdit(path)
+		result, err := handleUndoEdit(path)
+		if err != nil {
+			return nil, err
+		}
+		return llm.TextContent(result), nil
 	default:
-		return "", fmt.Errorf("command %s is not implemented", cmd)
+		return nil, fmt.Errorf("command %s is not implemented", cmd)
 	}
 }