import { describe, expect, it } from "vitest"; import { auiV0Encode } from "../legacy-runtime/cloud/auiV0"; describe("auiV0Encode", () => { it("preserves document source parts in the legacy cloud encoder", () => { const encoded = auiV0Encode({ id: "m1", createdAt: new Date("2026-03-15T00:00:00.000Z"), role: "assistant", status: { type: "complete", reason: "stop" }, metadata: { unstable_state: undefined, unstable_annotations: [], unstable_data: [], steps: [], custom: {}, }, content: [ { type: "source", sourceType: "document", id: "doc_123", title: "proposal.pdf", mediaType: "application/pdf", filename: "proposal.pdf", providerMetadata: { openai: { type: "file_citation", fileId: "file_123", index: 0, }, }, }, ], }); expect(encoded.content).toEqual([ { type: "source", sourceType: "document", id: "doc_123", title: "proposal.pdf", mediaType: "application/pdf", filename: "proposal.pdf", providerMetadata: { openai: { type: "file_citation", fileId: "file_123", index: 0, }, }, }, ]); }); });