import { CellLifecycle, type Cell } from "@textql/sdk/generated/connect/public/chat_pb.js";
import { timestampDate } from "@bufbuild/protobuf/wkt";
function handle(cell: Cell) {
cell.id; // string — upsert key
cell.complete; // boolean
cell.generated; // boolean — true = model-authored
cell.lifecycle; // CellLifecycle enum
cell.execError; // string | undefined
timestampDate(cell.timestamp!); // API timestamp → Date
switch (cell.value.case) {
case "mdCell":
cell.value.value.content; // streamed markdown
break;
case "ansCell":
cell.value.value.content; // final answer text
break;
case "sqlCell":
cell.value.value.query;
break;
// ...one case per tool: pyCell, wsCell, dashboardCell, reportCell,
// metricsCell, mcpToolCell, tableauCell, powerbiCell, and more
}
}