/* * 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 ComputerToolCallWithId = { type: "computer_call"; /** * The unique ID of the message. */ 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; /** * 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 ComputerToolCallWithId$inboundSchema: z.ZodType< ComputerToolCallWithId, 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, response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "call_id": "callId", "pending_safety_checks": "pendingSafetyChecks", "response_id": "responseId", }); }); /** @internal */ export type ComputerToolCallWithId$Outbound = { type: "computer_call"; id: string; call_id: string; action: ComputerAction$Outbound; pending_safety_checks: Array; status: string; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ComputerToolCallWithId$outboundSchema: z.ZodType< ComputerToolCallWithId$Outbound, z.ZodTypeDef, ComputerToolCallWithId > = z.object({ type: z.literal("computer_call"), id: z.string(), callId: z.string(), action: ComputerAction$outboundSchema, pendingSafetyChecks: z.array(PendingSafetyCheck$outboundSchema), status: Status$outboundSchema, responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { callId: "call_id", pendingSafetyChecks: "pending_safety_checks", responseId: "response_id", }); }); export function computerToolCallWithIdToJSON( computerToolCallWithId: ComputerToolCallWithId, ): string { return JSON.stringify( ComputerToolCallWithId$outboundSchema.parse(computerToolCallWithId), ); } export function computerToolCallWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ComputerToolCallWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ComputerToolCallWithId' from JSON`, ); }