( entry: TranscriptEntry, )
| 289 | } |
| 290 | |
| 291 | function formatUndoChoiceLabel( |
| 292 | entry: TranscriptEntry, |
| 293 | ): string { |
| 294 | if (entry.kind === 'skill_activation') { |
| 295 | const name = singleLine( |
| 296 | entry.skillName ?? entry.content.replace(/^Activated skill:\s*/, ''), |
| 297 | ); |
| 298 | const args = singleLine(entry.skillArgs ?? ''); |
| 299 | if (name.length === 0) return 'Skill: unknown'; |
| 300 | return args.length > 0 ? `/${name} ${args}` : `/${name}`; |
| 301 | } |
| 302 | if (entry.kind === 'plugin_command' && entry.pluginCommandData !== undefined) { |
| 303 | return formatPluginCommandSlash(entry.pluginCommandData) ?? 'User message'; |
| 304 | } |
| 305 | |
| 306 | const content = singleLine(entry.content); |
| 307 | const imageCount = entry.imageAttachmentIds?.length ?? 0; |
| 308 | if (content.length > 0) return content; |
| 309 | if (imageCount > 0) { |
| 310 | return `User message (${String(imageCount)} ${imageCount === 1 ? 'image' : 'images'})`; |
| 311 | } |
| 312 | return 'User message'; |
| 313 | } |
| 314 | |
| 315 | function formatUndoChoiceInput(entry: TranscriptEntry): string { |
| 316 | if (entry.kind === 'skill_activation') { |
no test coverage detected