( operation: ShellRunOperation | undefined, args: unknown, )
| 684 | } |
| 685 | |
| 686 | function formatPtyControlOperation( |
| 687 | operation: ShellRunOperation | undefined, |
| 688 | args: unknown, |
| 689 | ): string { |
| 690 | if (operation?.kind !== 'pty_control') return 'Background terminal interaction failed'; |
| 691 | const parts: string[] = []; |
| 692 | if (operation.input) { |
| 693 | const preview = readWriteStdinInputPreview(args); |
| 694 | const action = operation.input.queued ? 'Entered' : 'Not entered'; |
| 695 | if (preview) { |
| 696 | parts.push( |
| 697 | preview.truncated |
| 698 | ? `${action}: ${preview.text}… · ${operation.input.bytes} bytes total` |
| 699 | : `${action}: ${preview.text}`, |
| 700 | ); |
| 701 | } else { |
| 702 | parts.push(`${action} ${operation.input.bytes} bytes`); |
| 703 | } |
| 704 | } |
| 705 | if (operation.resize) { |
| 706 | const size = `${operation.resize.cols}x${operation.resize.rows}`; |
| 707 | if (!operation.resize.applied) parts.push(`Did not resize to ${size}`); |
| 708 | else if (operation.resize.changed) parts.push(`Resized to ${size}`); |
| 709 | else if (!operation.input) parts.push(`Size already ${size}`); |
| 710 | } |
| 711 | if (operation.failed) parts.push('Background terminal interaction failed'); |
| 712 | return parts.join(' · ') || 'Background terminal interaction completed'; |
| 713 | } |
| 714 | |
| 715 | function toolInputSummary(entry: MakaPiToolEntry): string { |
| 716 | const input = entry.input; |
no test coverage detected