tryParseEmbeddedJSON attempts to parse s as JSON, returning the native value when it succeeds. Returns (nil, false) when the string is empty, doesn't start with `{` or `[`, or fails to unmarshal — leaves the caller free to keep the original string. We require the leading-brace check before attempti
(s string)
| 269 | // quoted-but-bare strings don't get spuriously coerced into Go |
| 270 | // values agents weren't expecting. |
| 271 | func tryParseEmbeddedJSON(s string) (any, bool) { |
| 272 | s = strings.TrimSpace(s) |
| 273 | if s == "" { |
| 274 | return nil, false |
| 275 | } |
| 276 | if !strings.HasPrefix(s, "{") && !strings.HasPrefix(s, "[") { |
| 277 | return nil, false |
| 278 | } |
| 279 | var out any |
| 280 | if err := json.Unmarshal([]byte(s), &out); err != nil { |
| 281 | return nil, false |
| 282 | } |
| 283 | return out, true |
| 284 | } |
| 285 | |
| 286 | // ListWorkspaces satisfies WorkspaceLister so error helpers can |
| 287 | // populate available_workspaces hints. Best-effort: if listing fails |
no outgoing calls
no test coverage detected