(text: string)
| 326 | } |
| 327 | |
| 328 | function extractJsonObject(text: string): Record<string, unknown> | null { |
| 329 | const trimmed = text.trim(); |
| 330 | try { |
| 331 | return JSON.parse(trimmed) as Record<string, unknown>; |
| 332 | } catch { |
| 333 | // ignore |
| 334 | } |
| 335 | |
| 336 | const first = trimmed.indexOf("{"); |
| 337 | const last = trimmed.lastIndexOf("}"); |
| 338 | if (first >= 0 && last > first) { |
| 339 | try { |
| 340 | return JSON.parse(trimmed.slice(first, last + 1)) as Record<string, unknown>; |
| 341 | } catch { |
| 342 | return null; |
| 343 | } |
| 344 | } |
| 345 | return null; |
| 346 | } |
| 347 | |
| 348 | async function detectSkillMetadataRisk( |
| 349 | skill: Skill, |
no outgoing calls
no test coverage detected