| 92 | |
| 93 | /** Serialize steps to plain text for the summarizer (tool outputs truncated). */ |
| 94 | export function stepsToTranscript(steps: Step[]): string { |
| 95 | const out: string[] = []; |
| 96 | for (const s of steps) { |
| 97 | if (s.kind === "user") { |
| 98 | out.push(`## User\n${s.text}`); |
| 99 | } else if (s.kind === "assistant") { |
| 100 | if (s.text) out.push(`## Assistant\n${s.text}`); |
| 101 | for (const c of s.calls || []) out.push(`## Assistant tool call: ${c.name}\n${(c.arguments || "").slice(0, 400)}`); |
| 102 | } else { |
| 103 | out.push(`## Tool result (${s.name})\n${(s.output || "").slice(0, 600)}`); |
| 104 | } |
| 105 | } |
| 106 | return out.join("\n\n"); |
| 107 | } |
| 108 | |
| 109 | export interface CursorContextBlocks { |
| 110 | /** <user_info> + <rules> + <agent_skills> */ |