| 583 | } |
| 584 | |
| 585 | function snapTodo(p: ToolProps<typeof TodoWriteTool>): ToolSnapshot { |
| 586 | const items = list<{ status?: string; content?: string }>(p.frame.input.todos).flatMap((item) => { |
| 587 | const content = typeof item?.content === "string" ? item.content : "" |
| 588 | if (!content) { |
| 589 | return [] |
| 590 | } |
| 591 | |
| 592 | return [ |
| 593 | { |
| 594 | status: typeof item.status === "string" ? item.status : "", |
| 595 | content, |
| 596 | }, |
| 597 | ] |
| 598 | }) |
| 599 | |
| 600 | return { |
| 601 | kind: "todo", |
| 602 | items, |
| 603 | tail: "", |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | function snapQuestion(p: ToolProps<typeof QuestionTool>): ToolSnapshot { |
| 608 | const answers = list<unknown[]>(p.frame.meta.answers) |