/* * 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 ShellCallWithIdStatus = { InProgress: "in_progress", Completed: "completed", Incomplete: "incomplete", } as const; export type ShellCallWithIdStatus = ClosedEnum; /** * Shell call item: A hosted-container shell execution request with a command and status. */ export type ShellCallWithId = { type: "shell_call"; /** * The unique ID of the message. */ id: string; callId: string; action: ShellCallAction; status: ShellCallWithIdStatus; /** * The ID of the response that created this item, if any. */ responseId?: string | null | undefined; /** * Metadata from the response that created this item, if any. */ metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ShellCallWithIdStatus$inboundSchema: z.ZodNativeEnum< typeof ShellCallWithIdStatus > = z.nativeEnum(ShellCallWithIdStatus); /** @internal */ export const ShellCallWithIdStatus$outboundSchema: z.ZodNativeEnum< typeof ShellCallWithIdStatus > = ShellCallWithIdStatus$inboundSchema; /** @internal */ export const ShellCallWithId$inboundSchema: z.ZodType< ShellCallWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("shell_call"), id: z.string(), call_id: z.string(), action: ShellCallAction$inboundSchema, status: ShellCallWithIdStatus$inboundSchema, response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "call_id": "callId", "response_id": "responseId", }); }); /** @internal */ export type ShellCallWithId$Outbound = { type: "shell_call"; id: string; call_id: string; action: ShellCallAction$Outbound; status: string; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ShellCallWithId$outboundSchema: z.ZodType< ShellCallWithId$Outbound, z.ZodTypeDef, ShellCallWithId > = z.object({ type: z.literal("shell_call"), id: z.string(), callId: z.string(), action: ShellCallAction$outboundSchema, status: ShellCallWithIdStatus$outboundSchema, responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { callId: "call_id", responseId: "response_id", }); }); export function shellCallWithIdToJSON( shellCallWithId: ShellCallWithId, ): string { return JSON.stringify(ShellCallWithId$outboundSchema.parse(shellCallWithId)); } export function shellCallWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ShellCallWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShellCallWithId' from JSON`, ); }