import { createDb } from "../packages/db/src/index.js"; async function run() { const { prisma } = createDb("postgres://ingowagner@127.0.0.1:5432/evoo"); const runs = await prisma.run.findMany({ where: { id: { in: [ "cmu7k4dc50016iryyrv036xze", "cmu7k4db10012iryyuhfoukpt", "cmu7k4d9n000yiryy0zz4obmq", "cmu7k4d8k000uiryy086x000a", ], }, }, include: { bot: true, thread: { include: { messages: { orderBy: { seq: "desc" }, take: 1, }, }, }, }, }); for (const r of runs) { console.log(`\n======================================================`); console.log(`Bot: ${r.bot?.name} | Status: ${r.status}`); const lastMsg = r.thread?.messages[0]; if (lastMsg && lastMsg.role === "bot") { console.log(`Message blocks:\n`, JSON.stringify(lastMsg.blocks, null, 2)); } else { console.log(`Still processing / no final bot message yet`); } } } run() .catch(console.error) .finally(() => process.exit(0));