/* * 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 ResponseCompactionItemWithId = { type: "compaction"; /** * The unique ID of the message. */ 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; /** * The ID of the response that created this item, if any. */ responseId?: string | null | undefined; /** * Metadata from the response that created this item, if any. */ metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ResponseCompactionItemWithId$inboundSchema: z.ZodType< ResponseCompactionItemWithId, 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(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "encrypted_content": "encryptedContent", "created_by": "createdBy", "response_id": "responseId", }); }); /** @internal */ export type ResponseCompactionItemWithId$Outbound = { type: "compaction"; id: string; content: string; encrypted_content?: string | undefined; created_by?: string | undefined; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ResponseCompactionItemWithId$outboundSchema: z.ZodType< ResponseCompactionItemWithId$Outbound, z.ZodTypeDef, ResponseCompactionItemWithId > = z.object({ type: z.literal("compaction"), id: z.string(), content: z.string(), encryptedContent: z.string().optional(), createdBy: z.string().optional(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { encryptedContent: "encrypted_content", createdBy: "created_by", responseId: "response_id", }); }); export function responseCompactionItemWithIdToJSON( responseCompactionItemWithId: ResponseCompactionItemWithId, ): string { return JSON.stringify( ResponseCompactionItemWithId$outboundSchema.parse( responseCompactionItemWithId, ), ); } export function responseCompactionItemWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseCompactionItemWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseCompactionItemWithId' from JSON`, ); }