( toolName: string, state: ClientToolCallState )
| 166 | } |
| 167 | |
| 168 | function humanizedFallback( |
| 169 | toolName: string, |
| 170 | state: ClientToolCallState |
| 171 | ): ClientToolDisplay | undefined { |
| 172 | const titleCaseName = toolName.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()) |
| 173 | if (state === ClientToolCallState.error) { |
| 174 | const lowerCaseName = toolName.replace(/_/g, ' ').toLowerCase() |
| 175 | return { text: `Attempted to ${lowerCaseName}`, icon: Loader } |
| 176 | } |
| 177 | const stateVerb = |
| 178 | state === ClientToolCallState.success |
| 179 | ? 'Executed' |
| 180 | : state === ClientToolCallState.rejected || state === ClientToolCallState.aborted |
| 181 | ? 'Skipped' |
| 182 | : 'Executing' |
| 183 | return { text: `${stateVerb} ${titleCaseName}`, icon: Loader } |
| 184 | } |
no test coverage detected