/* * 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 ShellCallAction = { type: "exec"; /** * Shell command to execute. */ command?: string | undefined; /** * Command timeout in milliseconds. */ timeoutMs?: number | undefined; /** * Maximum output characters. */ maxOutputLength?: number | undefined; }; /** @internal */ export const ShellCallAction$inboundSchema: z.ZodType< ShellCallAction, z.ZodTypeDef, unknown > = z.object({ type: z.literal("exec"), command: z.string().optional(), timeout_ms: z.number().int().optional(), max_output_length: z.number().int().optional(), }).transform((v) => { return remap$(v, { "timeout_ms": "timeoutMs", "max_output_length": "maxOutputLength", }); }); /** @internal */ export type ShellCallAction$Outbound = { type: "exec"; command?: string | undefined; timeout_ms?: number | undefined; max_output_length?: number | undefined; }; /** @internal */ export const ShellCallAction$outboundSchema: z.ZodType< ShellCallAction$Outbound, z.ZodTypeDef, ShellCallAction > = z.object({ type: z.literal("exec"), command: z.string().optional(), timeoutMs: z.number().int().optional(), maxOutputLength: z.number().int().optional(), }).transform((v) => { return remap$(v, { timeoutMs: "timeout_ms", maxOutputLength: "max_output_length", }); }); export function shellCallActionToJSON( shellCallAction: ShellCallAction, ): string { return JSON.stringify(ShellCallAction$outboundSchema.parse(shellCallAction)); } export function shellCallActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShellCallAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShellCallAction' from JSON`, ); }