(tools: unknown[] | undefined)
| 191 | * @returns Sanitized tools array |
| 192 | */ |
| 193 | export function sanitizeTools(tools: unknown[] | undefined): Record<string, unknown>[] { |
| 194 | if (!Array.isArray(tools)) return [] |
| 195 | |
| 196 | return tools.map((tool) => { |
| 197 | if (tool && typeof tool === 'object' && !Array.isArray(tool)) { |
| 198 | const { isExpanded, ...rest } = tool as ToolWithExpanded |
| 199 | return rest |
| 200 | } |
| 201 | return tool as Record<string, unknown> |
| 202 | }) |
| 203 | } |
| 204 | |
| 205 | /** Variable with optional UI-only fields */ |
| 206 | type VariableWithUiFields = Variable & { validationError?: string; workflowId?: string } |
no outgoing calls
no test coverage detected