/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d54ddc254829 */ import * as z from "zod/v4"; import { smartUnion } from "../../types/smartUnion.js"; import { ReferenceChunk, ReferenceChunk$Outbound, ReferenceChunk$outboundSchema, } from "./referencechunk.js"; import { TextChunk, TextChunk$Outbound, TextChunk$outboundSchema, } from "./textchunk.js"; import { ToolReferenceChunk, ToolReferenceChunk$Outbound, ToolReferenceChunk$outboundSchema, } from "./toolreferencechunk.js"; export type Thinking = TextChunk | ToolReferenceChunk | ReferenceChunk; export type ThinkChunk = { type: "thinking"; thinking: Array; /** * Whether the thinking chunk is closed or not. Currently only used for prefixing. */ closed?: boolean | undefined; }; /** @internal */ export type Thinking$Outbound = | TextChunk$Outbound | ToolReferenceChunk$Outbound | ReferenceChunk$Outbound; /** @internal */ export const Thinking$outboundSchema: z.ZodType = smartUnion([ TextChunk$outboundSchema, ToolReferenceChunk$outboundSchema, ReferenceChunk$outboundSchema, ]); export function thinkingToJSON(thinking: Thinking): string { return JSON.stringify(Thinking$outboundSchema.parse(thinking)); } /** @internal */ export type ThinkChunk$Outbound = { type: "thinking"; thinking: Array< TextChunk$Outbound | ToolReferenceChunk$Outbound | ReferenceChunk$Outbound >; closed?: boolean | undefined; }; /** @internal */ export const ThinkChunk$outboundSchema: z.ZodType< ThinkChunk$Outbound, ThinkChunk > = z.object({ type: z.literal("thinking"), thinking: z.array( smartUnion([ TextChunk$outboundSchema, ToolReferenceChunk$outboundSchema, ReferenceChunk$outboundSchema, ]), ), closed: z.boolean().optional(), }); export function thinkChunkToJSON(thinkChunk: ThinkChunk): string { return JSON.stringify(ThinkChunk$outboundSchema.parse(thinkChunk)); }