/* * 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"; export type PlanStep = { type?: "plan" | undefined; think: string; currentQuestion: string; errored?: boolean | undefined; /** * The questions that need to be answered to answer the original question. */ questionsToAnswer?: Array | undefined; }; /** @internal */ export const PlanStep$inboundSchema: z.ZodType< PlanStep, z.ZodTypeDef, unknown > = z.object({ type: z.literal("plan").default("plan"), think: z.string(), current_question: z.string(), errored: z.boolean().default(false), questions_to_answer: z.array(z.string()).optional(), }).transform((v) => { return remap$(v, { "current_question": "currentQuestion", "questions_to_answer": "questionsToAnswer", }); }); /** @internal */ export type PlanStep$Outbound = { type: "plan"; think: string; current_question: string; errored: boolean; questions_to_answer?: Array | undefined; }; /** @internal */ export const PlanStep$outboundSchema: z.ZodType< PlanStep$Outbound, z.ZodTypeDef, PlanStep > = z.object({ type: z.literal("plan").default("plan" as const), think: z.string(), currentQuestion: z.string(), errored: z.boolean().default(false), questionsToAnswer: z.array(z.string()).optional(), }).transform((v) => { return remap$(v, { currentQuestion: "current_question", questionsToAnswer: "questions_to_answer", }); }); export function planStepToJSON(planStep: PlanStep): string { return JSON.stringify(PlanStep$outboundSchema.parse(planStep)); } export function planStepFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PlanStep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PlanStep' from JSON`, ); }