(text: string)
| 846 | } |
| 847 | |
| 848 | function parseToolActionPart(text: string): ToolAction | null { |
| 849 | const trimmed = text.trim(); |
| 850 | if (!trimmed) return null; |
| 851 | |
| 852 | const patterns: Array<[RegExp, ToolActionVerb]> = [ |
| 853 | [/^(?:run|execute)\s+(.+)$/i, 'run'], |
| 854 | [/^(?:read|view)\s+(.+)$/i, 'read'], |
| 855 | [/^(?:write|edit|modify|update)\s+(.+)$/i, 'edit'], |
| 856 | [/^(?:list)\s+(.+)$/i, 'list'], |
| 857 | [/^(?:search|find|grep)\s+(.+)$/i, 'search'], |
| 858 | [/^(?:fetch|download|request)\s+(.+)$/i, 'fetch'], |
| 859 | [/^(?:move|rename)\s+(.+)$/i, 'move'], |
| 860 | [/^(?:delete|remove|rm)\s+(.+)$/i, 'delete'], |
| 861 | ]; |
| 862 | |
| 863 | for (const [pattern, verb] of patterns) { |
| 864 | const match = trimmed.match(pattern); |
| 865 | if (!match) continue; |
| 866 | const target = match[1]?.trim(); |
| 867 | if (!target) return null; |
| 868 | return { verb, target }; |
| 869 | } |
| 870 | |
| 871 | return null; |
| 872 | } |
| 873 | |
| 874 | function summarizeInferredActions( |
| 875 | actions: ToolAction[], |
no outgoing calls
no test coverage detected