* Extract outputs from a tool content block by trying: * 1. Const reference (e.g., `outputs: GIT_REF_OUTPUT_PROPERTIES,`) * 2. Inline object (e.g., `outputs: { id: { type: 'string', ... } }`)
(content: string, toolPrefix: string)
| 1734 | * 2. Inline object (e.g., `outputs: { id: { type: 'string', ... } }`) |
| 1735 | */ |
| 1736 | function extractOutputsFromToolContent(content: string, toolPrefix: string): Record<string, any> { |
| 1737 | const constMatch = content.match(/(?<![a-zA-Z_])outputs\s*:\s*([A-Z][A-Z_0-9]+)\s*(?:,|\}|$)/) |
| 1738 | if (constMatch) { |
| 1739 | const resolved = resolveConstReference(constMatch[1], toolPrefix) |
| 1740 | if (resolved && typeof resolved === 'object') { |
| 1741 | return resolved |
| 1742 | } |
| 1743 | } |
| 1744 | |
| 1745 | const outputsStart = content.search(/(?<![a-zA-Z_])outputs\s*:\s*{/) |
| 1746 | if (outputsStart !== -1) { |
| 1747 | const openBracePos = content.indexOf('{', outputsStart) |
| 1748 | if (openBracePos !== -1) { |
| 1749 | const closePos = findMatchingClose(content, openBracePos) |
| 1750 | if (closePos !== -1) { |
| 1751 | const outputsContent = content.substring(openBracePos + 1, closePos - 1).trim() |
| 1752 | return parseToolOutputsField(outputsContent, toolPrefix) |
| 1753 | } |
| 1754 | } |
| 1755 | } |
| 1756 | |
| 1757 | return {} |
| 1758 | } |
| 1759 | |
| 1760 | function extractToolInfo( |
| 1761 | toolName: string, |
no test coverage detected