Let task agents use client Macs directly: bash, copy and hands
This commit is contained in:
@@ -744,11 +744,16 @@ func (s *Session) callTool(raw json.RawMessage) (any, error) {
|
||||
return nil, fmt.Errorf("unknown tool %s in %s", p.Tool, p.Namespace)
|
||||
}
|
||||
|
||||
text, err := t.Handler(context.Background(), p.Arguments)
|
||||
if err != nil {
|
||||
return DynamicToolCallResponse{ContentItems: []DynamicToolCallOutputContentItem{{Type: DynamicToolCallOutputContentItemTypeInputText, Text: err.Error()}}}, nil
|
||||
res := t.Call(context.Background(), p.Arguments)
|
||||
items := []DynamicToolCallOutputContentItem{}
|
||||
for _, c := range res.Content {
|
||||
if c.Type == "image" {
|
||||
items = append(items, DynamicToolCallOutputContentItem{Type: DynamicToolCallOutputContentItemTypeInputImage, ImageURL: "data:" + c.MimeType + ";base64," + c.Data})
|
||||
continue
|
||||
}
|
||||
items = append(items, DynamicToolCallOutputContentItem{Type: DynamicToolCallOutputContentItemTypeInputText, Text: c.Text})
|
||||
}
|
||||
return DynamicToolCallResponse{Success: true, ContentItems: []DynamicToolCallOutputContentItem{{Type: DynamicToolCallOutputContentItemTypeInputText, Text: text}}}, nil
|
||||
return DynamicToolCallResponse{Success: !res.IsError, ContentItems: items}, nil
|
||||
}
|
||||
|
||||
func (s *Session) badLine(line []byte, reason string) {
|
||||
|
||||
Reference in New Issue
Block a user