extractFunctionResultText tries to get a short result string from Cursor function result JSON.
(raw json.RawMessage)
| 401 | |
| 402 | // extractFunctionResultText tries to get a short result string from Cursor function result JSON. |
| 403 | func extractFunctionResultText(raw json.RawMessage) string { |
| 404 | var m map[string]interface{} |
| 405 | if json.Unmarshal(raw, &m) != nil { |
| 406 | return "" |
| 407 | } |
| 408 | for _, key := range []string{"output", "content", "result", "stdout", "text"} { |
| 409 | if v, ok := m[key].(string); ok && v != "" { |
| 410 | return v |
| 411 | } |
| 412 | } |
| 413 | if success, ok := m["success"].(map[string]interface{}); ok { |
| 414 | for _, key := range []string{"output", "content", "result", "stdout"} { |
| 415 | if v, ok := success[key].(string); ok && v != "" { |
| 416 | return v |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | return "" |
| 421 | } |
no outgoing calls
no test coverage detected