| 140 | } |
| 141 | |
| 142 | function inputLabel(input: Record<string, unknown>): string | undefined { |
| 143 | const description = text(input.description) |
| 144 | if (description) { |
| 145 | return description |
| 146 | } |
| 147 | |
| 148 | const command = text(input.command) |
| 149 | if (command) { |
| 150 | return command |
| 151 | } |
| 152 | |
| 153 | const filePath = text(input.filePath) ?? text(input.filepath) |
| 154 | if (filePath) { |
| 155 | return filePath |
| 156 | } |
| 157 | |
| 158 | const pattern = text(input.pattern) |
| 159 | if (pattern) { |
| 160 | return pattern |
| 161 | } |
| 162 | |
| 163 | const query = text(input.query) |
| 164 | if (query) { |
| 165 | return query |
| 166 | } |
| 167 | |
| 168 | const url = text(input.url) |
| 169 | if (url) { |
| 170 | return url |
| 171 | } |
| 172 | |
| 173 | const path = text(input.path) |
| 174 | if (path) { |
| 175 | return path |
| 176 | } |
| 177 | |
| 178 | const prompt = text(input.prompt) |
| 179 | if (prompt) { |
| 180 | return prompt |
| 181 | } |
| 182 | |
| 183 | return undefined |
| 184 | } |
| 185 | |
| 186 | function stateTitle(part: ToolPart) { |
| 187 | return text("title" in part.state ? part.state.title : undefined) |