/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: e94063d48620 */ import * as z from "zod/v4"; 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 AgentHandoffEntry = { object?: "entry" | undefined; type?: "agent.handoff" | undefined; createdAt?: Date | undefined; completedAt?: Date | null | undefined; id?: string | undefined; previousAgentId: string; previousAgentName: string; nextAgentId: string; nextAgentName: string; }; /** @internal */ export const AgentHandoffEntry$inboundSchema: z.ZodType< AgentHandoffEntry, unknown > = z.object({ object: z.literal("entry").default("entry"), type: z.literal("agent.handoff").default("agent.handoff"), created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)) .optional(), completed_at: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), id: z.string().optional(), previous_agent_id: z.string(), previous_agent_name: z.string(), next_agent_id: z.string(), next_agent_name: z.string(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "completed_at": "completedAt", "previous_agent_id": "previousAgentId", "previous_agent_name": "previousAgentName", "next_agent_id": "nextAgentId", "next_agent_name": "nextAgentName", }); }); /** @internal */ export type AgentHandoffEntry$Outbound = { object: "entry"; type: "agent.handoff"; created_at?: string | undefined; completed_at?: string | null | undefined; id?: string | undefined; previous_agent_id: string; previous_agent_name: string; next_agent_id: string; next_agent_name: string; }; /** @internal */ export const AgentHandoffEntry$outboundSchema: z.ZodType< AgentHandoffEntry$Outbound, AgentHandoffEntry > = z.object({ object: z.literal("entry").default("entry" as const), type: z.literal("agent.handoff").default("agent.handoff" as const), createdAt: z.date().transform(v => v.toISOString()).optional(), completedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), id: z.string().optional(), previousAgentId: z.string(), previousAgentName: z.string(), nextAgentId: z.string(), nextAgentName: z.string(), }).transform((v) => { return remap$(v, { createdAt: "created_at", completedAt: "completed_at", previousAgentId: "previous_agent_id", previousAgentName: "previous_agent_name", nextAgentId: "next_agent_id", nextAgentName: "next_agent_name", }); }); export function agentHandoffEntryToJSON( agentHandoffEntry: AgentHandoffEntry, ): string { return JSON.stringify( AgentHandoffEntry$outboundSchema.parse(agentHandoffEntry), ); } export function agentHandoffEntryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentHandoffEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentHandoffEntry' from JSON`, ); }