| 724 | } |
| 725 | |
| 726 | function scrollPatchFinal(p: ToolProps<typeof ApplyPatchTool>): string { |
| 727 | if (p.frame.status === "error") { |
| 728 | return fail(p.frame) |
| 729 | } |
| 730 | |
| 731 | const files = list<PatchFile>(p.frame.meta.files) |
| 732 | if (files.length === 0) { |
| 733 | const time = span(p.frame.state) |
| 734 | if (!time) { |
| 735 | return "patch" |
| 736 | } |
| 737 | |
| 738 | return `patch · ${time}` |
| 739 | } |
| 740 | |
| 741 | const show_updates = !files.some((file) => file?.type && file.type !== "update") |
| 742 | const shown = files.filter((file) => show_updates || file.type !== "update") |
| 743 | const rows = shown.slice(0, 6).map(patchLine) |
| 744 | if (shown.length > 6) { |
| 745 | rows.push(`... and ${shown.length - 6} more`) |
| 746 | } |
| 747 | |
| 748 | if (rows.length > 0) { |
| 749 | return rows.join("\n") |
| 750 | } |
| 751 | |
| 752 | return patchLine(files[0]!) |
| 753 | } |
| 754 | |
| 755 | function scrollTaskStart(_: ToolProps<typeof TaskTool>): string { |
| 756 | return "" |