/* * 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 { collectExtraKeys as collectExtraKeys$, safeParse, } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AgentCompactionContextManagement, AgentCompactionContextManagement$inboundSchema, AgentCompactionContextManagement$Outbound, AgentCompactionContextManagement$outboundSchema, } from "./agentcompactioncontextmanagement.js"; import { AgentScheduleSpec, AgentScheduleSpec$inboundSchema, AgentScheduleSpec$Outbound, AgentScheduleSpec$outboundSchema, } from "./agentschedulespec.js"; export type Input2 = { type?: string | undefined; additionalProperties?: { [k: string]: any } | undefined; }; export type CreateAgentScheduleRequestInput = string | Array; export type CreateAgentScheduleRequest = { name?: string | undefined; schedule: AgentScheduleSpec; input: string | Array; /** * Arbitrary JSON value. */ conversation?: any | undefined; previousResponseId?: string | undefined; /** * Context management strategies to apply during agent-run response generation. Supports compaction, which summarizes older conversation history when the context exceeds a token threshold. */ contextManagement?: Array | undefined; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const Input2$inboundSchema: z.ZodType = collectExtraKeys$( z.object({ type: z.string().optional(), }).catchall(z.any()), "additionalProperties", true, ); /** @internal */ export type Input2$Outbound = { type?: string | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const Input2$outboundSchema: z.ZodType< Input2$Outbound, z.ZodTypeDef, Input2 > = z.object({ type: z.string().optional(), additionalProperties: z.record(z.any()).optional(), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { additionalProperties: null, }), }; }); export function input2ToJSON(input2: Input2): string { return JSON.stringify(Input2$outboundSchema.parse(input2)); } export function input2FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Input2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Input2' from JSON`, ); } /** @internal */ export const CreateAgentScheduleRequestInput$inboundSchema: z.ZodType< CreateAgentScheduleRequestInput, z.ZodTypeDef, unknown > = z.union([z.string(), z.array(z.lazy(() => Input2$inboundSchema))]); /** @internal */ export type CreateAgentScheduleRequestInput$Outbound = | string | Array; /** @internal */ export const CreateAgentScheduleRequestInput$outboundSchema: z.ZodType< CreateAgentScheduleRequestInput$Outbound, z.ZodTypeDef, CreateAgentScheduleRequestInput > = z.union([z.string(), z.array(z.lazy(() => Input2$outboundSchema))]); export function createAgentScheduleRequestInputToJSON( createAgentScheduleRequestInput: CreateAgentScheduleRequestInput, ): string { return JSON.stringify( CreateAgentScheduleRequestInput$outboundSchema.parse( createAgentScheduleRequestInput, ), ); } export function createAgentScheduleRequestInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAgentScheduleRequestInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentScheduleRequestInput' from JSON`, ); } /** @internal */ export const CreateAgentScheduleRequest$inboundSchema: z.ZodType< CreateAgentScheduleRequest, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), schedule: AgentScheduleSpec$inboundSchema, input: z.union([z.string(), z.array(z.lazy(() => Input2$inboundSchema))]), conversation: z.any().optional(), previous_response_id: z.string().optional(), context_management: z.array(AgentCompactionContextManagement$inboundSchema) .optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { "previous_response_id": "previousResponseId", "context_management": "contextManagement", }); }); /** @internal */ export type CreateAgentScheduleRequest$Outbound = { name?: string | undefined; schedule: AgentScheduleSpec$Outbound; input: string | Array; conversation?: any | undefined; previous_response_id?: string | undefined; context_management?: | Array | undefined; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const CreateAgentScheduleRequest$outboundSchema: z.ZodType< CreateAgentScheduleRequest$Outbound, z.ZodTypeDef, CreateAgentScheduleRequest > = z.object({ name: z.string().optional(), schedule: AgentScheduleSpec$outboundSchema, input: z.union([z.string(), z.array(z.lazy(() => Input2$outboundSchema))]), conversation: z.any().optional(), previousResponseId: z.string().optional(), contextManagement: z.array(AgentCompactionContextManagement$outboundSchema) .optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { previousResponseId: "previous_response_id", contextManagement: "context_management", }); }); export function createAgentScheduleRequestToJSON( createAgentScheduleRequest: CreateAgentScheduleRequest, ): string { return JSON.stringify( CreateAgentScheduleRequest$outboundSchema.parse(createAgentScheduleRequest), ); } export function createAgentScheduleRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAgentScheduleRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentScheduleRequest' from JSON`, ); }