/* * 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 { ShellCallAction, ShellCallAction$inboundSchema, ShellCallAction$Outbound, ShellCallAction$outboundSchema, } from "./shellcallaction.js"; export const ShellCallStatus = { InProgress: "in_progress", Completed: "completed", Incomplete: "incomplete", } as const; export type ShellCallStatus = ClosedEnum; /** * Shell call item: A hosted-container shell execution request with a command and status. */ export type ShellCall = { type: "shell_call"; id: string; callId: string; action: ShellCallAction; status: ShellCallStatus; }; /** @internal */ export const ShellCallStatus$inboundSchema: z.ZodNativeEnum< typeof ShellCallStatus > = z.nativeEnum(ShellCallStatus); /** @internal */ export const ShellCallStatus$outboundSchema: z.ZodNativeEnum< typeof ShellCallStatus > = ShellCallStatus$inboundSchema; /** @internal */ export const ShellCall$inboundSchema: z.ZodType< ShellCall, z.ZodTypeDef, unknown > = z.object({ type: z.literal("shell_call"), id: z.string(), call_id: z.string(), action: ShellCallAction$inboundSchema, status: ShellCallStatus$inboundSchema, }).transform((v) => { return remap$(v, { "call_id": "callId", }); }); /** @internal */ export type ShellCall$Outbound = { type: "shell_call"; id: string; call_id: string; action: ShellCallAction$Outbound; status: string; }; /** @internal */ export const ShellCall$outboundSchema: z.ZodType< ShellCall$Outbound, z.ZodTypeDef, ShellCall > = z.object({ type: z.literal("shell_call"), id: z.string(), callId: z.string(), action: ShellCallAction$outboundSchema, status: ShellCallStatus$outboundSchema, }).transform((v) => { return remap$(v, { callId: "call_id", }); }); export function shellCallToJSON(shellCall: ShellCall): string { return JSON.stringify(ShellCall$outboundSchema.parse(shellCall)); } export function shellCallFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShellCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShellCall' from JSON`, ); }