/* * 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 { ClosedEnum } from "../../types/enums.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 const AgentScheduleObject = { AgentSchedule: "agent.schedule", } as const; export type AgentScheduleObject = ClosedEnum; export const AgentScheduleStatus = { Active: "active", Paused: "paused", Completed: "completed", Deleted: "deleted", } as const; export type AgentScheduleStatus = ClosedEnum; export type AgentSchedule = { object: AgentScheduleObject; id: string; agentId: string; name: string | null; status: AgentScheduleStatus; schedule: AgentScheduleSpec; /** * Arbitrary JSON value. */ input?: any | undefined; conversation?: any | null | undefined; previousResponseId: string | null; contextManagement: Array | null; metadata: { [k: string]: string } | null; temporalScheduleId: string | null; lastRunAt: Date | null; lastRunId: string | null; runCount: number; createdAt: Date; updatedAt: Date; deletedAt: Date | null; }; /** @internal */ export const AgentScheduleObject$inboundSchema: z.ZodNativeEnum< typeof AgentScheduleObject > = z.nativeEnum(AgentScheduleObject); /** @internal */ export const AgentScheduleObject$outboundSchema: z.ZodNativeEnum< typeof AgentScheduleObject > = AgentScheduleObject$inboundSchema; /** @internal */ export const AgentScheduleStatus$inboundSchema: z.ZodNativeEnum< typeof AgentScheduleStatus > = z.nativeEnum(AgentScheduleStatus); /** @internal */ export const AgentScheduleStatus$outboundSchema: z.ZodNativeEnum< typeof AgentScheduleStatus > = AgentScheduleStatus$inboundSchema; /** @internal */ export const AgentSchedule$inboundSchema: z.ZodType< AgentSchedule, z.ZodTypeDef, unknown > = z.object({ object: AgentScheduleObject$inboundSchema, id: z.string(), agent_id: z.string(), name: z.nullable(z.string()), status: AgentScheduleStatus$inboundSchema, schedule: AgentScheduleSpec$inboundSchema, input: z.any().optional(), conversation: z.nullable(z.any()).optional(), previous_response_id: z.nullable(z.string()), context_management: z.nullable( z.array(AgentCompactionContextManagement$inboundSchema), ), metadata: z.nullable(z.record(z.string())), temporal_schedule_id: z.nullable(z.string()), last_run_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), last_run_id: z.nullable(z.string()), run_count: z.number().int(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), deleted_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), }).transform((v) => { return remap$(v, { "agent_id": "agentId", "previous_response_id": "previousResponseId", "context_management": "contextManagement", "temporal_schedule_id": "temporalScheduleId", "last_run_at": "lastRunAt", "last_run_id": "lastRunId", "run_count": "runCount", "created_at": "createdAt", "updated_at": "updatedAt", "deleted_at": "deletedAt", }); }); /** @internal */ export type AgentSchedule$Outbound = { object: string; id: string; agent_id: string; name: string | null; status: string; schedule: AgentScheduleSpec$Outbound; input?: any | undefined; conversation?: any | null | undefined; previous_response_id: string | null; context_management: Array | null; metadata: { [k: string]: string } | null; temporal_schedule_id: string | null; last_run_at: string | null; last_run_id: string | null; run_count: number; created_at: string; updated_at: string; deleted_at: string | null; }; /** @internal */ export const AgentSchedule$outboundSchema: z.ZodType< AgentSchedule$Outbound, z.ZodTypeDef, AgentSchedule > = z.object({ object: AgentScheduleObject$outboundSchema, id: z.string(), agentId: z.string(), name: z.nullable(z.string()), status: AgentScheduleStatus$outboundSchema, schedule: AgentScheduleSpec$outboundSchema, input: z.any().optional(), conversation: z.nullable(z.any()).optional(), previousResponseId: z.nullable(z.string()), contextManagement: z.nullable( z.array(AgentCompactionContextManagement$outboundSchema), ), metadata: z.nullable(z.record(z.string())), temporalScheduleId: z.nullable(z.string()), lastRunAt: z.nullable(z.date().transform(v => v.toISOString())), lastRunId: z.nullable(z.string()), runCount: z.number().int(), createdAt: z.date().transform(v => v.toISOString()), updatedAt: z.date().transform(v => v.toISOString()), deletedAt: z.nullable(z.date().transform(v => v.toISOString())), }).transform((v) => { return remap$(v, { agentId: "agent_id", previousResponseId: "previous_response_id", contextManagement: "context_management", temporalScheduleId: "temporal_schedule_id", lastRunAt: "last_run_at", lastRunId: "last_run_id", runCount: "run_count", createdAt: "created_at", updatedAt: "updated_at", deletedAt: "deleted_at", }); }); export function agentScheduleToJSON(agentSchedule: AgentSchedule): string { return JSON.stringify(AgentSchedule$outboundSchema.parse(agentSchedule)); } export function agentScheduleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentSchedule$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentSchedule' from JSON`, ); }