/* * 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"; import { ComputerAction, ComputerAction$inboundSchema, ComputerAction$Outbound, ComputerAction$outboundSchema, } from "./computeraction.js"; import { PendingSafetyCheck, PendingSafetyCheck$inboundSchema, PendingSafetyCheck$Outbound, PendingSafetyCheck$outboundSchema, } from "./pendingsafetycheck.js"; import { Status, Status$inboundSchema, Status$outboundSchema, } from "./status.js"; /** * Computer call item: A computer-use tool-call step with the selected UI action and safety-check state. */ export type ComputerToolCall = { type: "computer_call"; id: string; callId: string; action: ComputerAction; pendingSafetyChecks: Array; /** * The processing status of an individual item. 'in_progress' means currently processing, 'completed' means finished successfully, 'incomplete' means processing stopped before completion. */ status: Status; }; /** @internal */ export const ComputerToolCall$inboundSchema: z.ZodType< ComputerToolCall, z.ZodTypeDef, unknown > = z.object({ type: z.literal("computer_call"), id: z.string(), call_id: z.string(), action: ComputerAction$inboundSchema, pending_safety_checks: z.array(PendingSafetyCheck$inboundSchema), status: Status$inboundSchema, }).transform((v) => { return remap$(v, { "call_id": "callId", "pending_safety_checks": "pendingSafetyChecks", }); }); /** @internal */ export type ComputerToolCall$Outbound = { type: "computer_call"; id: string; call_id: string; action: ComputerAction$Outbound; pending_safety_checks: Array; status: string; }; /** @internal */ export const ComputerToolCall$outboundSchema: z.ZodType< ComputerToolCall$Outbound, z.ZodTypeDef, ComputerToolCall > = z.object({ type: z.literal("computer_call"), id: z.string(), callId: z.string(), action: ComputerAction$outboundSchema, pendingSafetyChecks: z.array(PendingSafetyCheck$outboundSchema), status: Status$outboundSchema, }).transform((v) => { return remap$(v, { callId: "call_id", pendingSafetyChecks: "pending_safety_checks", }); }); export function computerToolCallToJSON( computerToolCall: ComputerToolCall, ): string { return JSON.stringify( ComputerToolCall$outboundSchema.parse(computerToolCall), ); } export function computerToolCallFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ComputerToolCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ComputerToolCall' from JSON`, ); }