(db: ReturnType<typeof makeDb>)
| 48 | } |
| 49 | |
| 50 | function insertSyntheticSession(db: ReturnType<typeof makeDb>) { |
| 51 | const sessionId = "ses_test"; |
| 52 | const cwd = "/tmp/migrate-project"; |
| 53 | db.prepare( |
| 54 | "INSERT INTO session (id, title, directory, path, time_created) VALUES (?, ?, ?, ?, ?)", |
| 55 | ).run(sessionId, "Test", cwd, null, 1000); |
| 56 | |
| 57 | const insertMessage = db.prepare( |
| 58 | "INSERT INTO message (id, session_id, time_created, data) VALUES (?, ?, ?, ?)", |
| 59 | ); |
| 60 | const insertPart = db.prepare( |
| 61 | "INSERT INTO part (id, message_id, session_id, time_created, data) VALUES (?, ?, ?, ?, ?)", |
| 62 | ); |
| 63 | |
| 64 | insertMessage.run( |
| 65 | "msg_1", |
| 66 | sessionId, |
| 67 | 1000, |
| 68 | JSON.stringify({ |
| 69 | role: "user", |
| 70 | model: { providerID: "anthropic", modelID: "claude-opus" }, |
| 71 | }), |
| 72 | ); |
| 73 | insertPart.run( |
| 74 | "prt_1", |
| 75 | "msg_1", |
| 76 | sessionId, |
| 77 | 1000, |
| 78 | JSON.stringify({ type: "text", text: "hello" }), |
| 79 | ); |
| 80 | insertPart.run("prt_2", "msg_1", sessionId, 1001, JSON.stringify({ type: "step-start" })); |
| 81 | insertPart.run( |
| 82 | "prt_3", |
| 83 | "msg_1", |
| 84 | sessionId, |
| 85 | 1002, |
| 86 | JSON.stringify({ type: "file", filename: "image.png", url: "data:image/png;base64,abc" }), |
| 87 | ); |
| 88 | insertPart.run("prt_4", "msg_1", sessionId, 1003, JSON.stringify({ type: "step-finish" })); |
| 89 | |
| 90 | insertMessage.run( |
| 91 | "msg_2", |
| 92 | sessionId, |
| 93 | 2000, |
| 94 | JSON.stringify({ role: "assistant", providerID: "anthropic", modelID: "claude-opus" }), |
| 95 | ); |
| 96 | insertPart.run( |
| 97 | "prt_5", |
| 98 | "msg_2", |
| 99 | sessionId, |
| 100 | 2000, |
| 101 | JSON.stringify({ |
| 102 | type: "reasoning", |
| 103 | text: "thinking text", |
| 104 | metadata: { anthropic: { signature: "signed-thinking" } }, |
| 105 | }), |
| 106 | ); |
| 107 | insertPart.run( |
no test coverage detected