| 829 | } |
| 830 | |
| 831 | function scrollQuestionFinal(p: ToolProps<typeof QuestionTool>): string { |
| 832 | const q = p.input.questions ?? [] |
| 833 | const a = p.metadata.answers ?? [] |
| 834 | const time = span(p.frame.state) |
| 835 | if (q.length === 0) { |
| 836 | if (!time) { |
| 837 | return "0 questions" |
| 838 | } |
| 839 | |
| 840 | return `0 questions · ${time}` |
| 841 | } |
| 842 | |
| 843 | const rows: string[] = [] |
| 844 | for (const [i, item] of q.slice(0, 4).entries()) { |
| 845 | const prompt = item.question |
| 846 | const reply = a[i] ?? [] |
| 847 | rows.push(`? ${prompt || `Question ${i + 1}`}`) |
| 848 | rows.push(` ${reply.length > 0 ? reply.join(", ") : "(no answer)"}`) |
| 849 | } |
| 850 | |
| 851 | if (q.length > 4) { |
| 852 | rows.push(`... and ${q.length - 4} more`) |
| 853 | } |
| 854 | |
| 855 | return rows.join("\n") |
| 856 | } |
| 857 | |
| 858 | function scrollLspStart(p: ToolProps<typeof LspTool>): string { |
| 859 | return `→ ${lspTitle(p.input)}` |