| 1 | import assert from "node:assert/strict"; |
| 2 | import { parseDelimitedText } from "../components/WorkspaceCsvPreview"; |
| 3 | import { historyMessagesToItems } from "../lib/historyItems"; |
| 4 | |
| 5 | assert.deepEqual(parseDelimitedText('name,note\nGame,"one, two"\nQuote,"said ""hi"""\n', ","), [ |
| 6 | ["name", "note"], |
| 7 | ["Game", "one, two"], |
| 8 | ["Quote", 'said "hi"'], |
| 9 | ]); |
| 10 | assert.deepEqual(parseDelimitedText("name\tvalue\na\t1\n", "\t"), [ |
| 11 | ["name", "value"], |
| 12 | ["a", "1"], |
| 13 | ]); |
| 14 | |
| 15 | const remoteHistory = historyMessagesToItems([ |
| 16 | { role: "assistant", content: "", toolCalls: [{ id: "present-1", name: "present", arguments: '{"files":[{"path":"game.html"}]}' }] }, |
| 17 | { role: "tool", content: "Presented game.html", toolCallId: "present-1", toolName: "present", presentedFiles: [{ path: "game.html", description: "Game" }] }, |
| 18 | ], "remote-"); |
| 19 | const presentItem = remoteHistory.items.find(item => item.kind === "tool" && item.id.includes("present-1")); |
| 20 | assert.deepEqual(presentItem?.kind === "tool" ? presentItem.presentedFiles : undefined, [{ path: "game.html", description: "Game" }]); |
| 21 | |
| 22 | console.log("presented files: CSV, TSV, and remote history projection passed"); |
| 23 |