/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Compaction item: A condensed summary of prior conversation history to reduce context size. */ export type ResponseCompactionItem = { type: "compaction"; id: string; /** * The compacted/summarized conversation content. */ content: string; /** * Optional encrypted content for OpenAI API compatibility. */ encryptedContent?: string | undefined; /** * The model that created this compaction. */ createdBy?: string | undefined; }; /** @internal */ export const ResponseCompactionItem$inboundSchema: z.ZodType< ResponseCompactionItem, z.ZodTypeDef, unknown > = z.object({ type: z.literal("compaction"), id: z.string(), content: z.string(), encrypted_content: z.string().optional(), created_by: z.string().optional(), }).transform((v) => { return remap$(v, { "encrypted_content": "encryptedContent", "created_by": "createdBy", }); }); /** @internal */ export type ResponseCompactionItem$Outbound = { type: "compaction"; id: string; content: string; encrypted_content?: string | undefined; created_by?: string | undefined; }; /** @internal */ export const ResponseCompactionItem$outboundSchema: z.ZodType< ResponseCompactionItem$Outbound, z.ZodTypeDef, ResponseCompactionItem > = z.object({ type: z.literal("compaction"), id: z.string(), content: z.string(), encryptedContent: z.string().optional(), createdBy: z.string().optional(), }).transform((v) => { return remap$(v, { encryptedContent: "encrypted_content", createdBy: "created_by", }); }); export function responseCompactionItemToJSON( responseCompactionItem: ResponseCompactionItem, ): string { return JSON.stringify( ResponseCompactionItem$outboundSchema.parse(responseCompactionItem), ); } export function responseCompactionItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseCompactionItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseCompactionItem' from JSON`, ); }