/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 { FileSearchResult, FileSearchResult$inboundSchema, FileSearchResult$Outbound, FileSearchResult$outboundSchema, } from "./filesearchresult.js"; export const FileSearchToolCallStatus = { InProgress: "in_progress", Searching: "searching", Completed: "completed", Incomplete: "incomplete", Failed: "failed", } as const; export type FileSearchToolCallStatus = ClosedEnum< typeof FileSearchToolCallStatus >; /** * File search call item: A tool-call record for semantic file search, including query terms, status, and optional results. */ export type FileSearchToolCall = { type: "file_search_call"; id: string; queries: Array; status: FileSearchToolCallStatus; results?: Array | undefined; }; /** @internal */ export const FileSearchToolCallStatus$inboundSchema: z.ZodNativeEnum< typeof FileSearchToolCallStatus > = z.nativeEnum(FileSearchToolCallStatus); /** @internal */ export const FileSearchToolCallStatus$outboundSchema: z.ZodNativeEnum< typeof FileSearchToolCallStatus > = FileSearchToolCallStatus$inboundSchema; /** @internal */ export const FileSearchToolCall$inboundSchema: z.ZodType< FileSearchToolCall, z.ZodTypeDef, unknown > = z.object({ type: z.literal("file_search_call"), id: z.string(), queries: z.array(z.string()), status: FileSearchToolCallStatus$inboundSchema, results: z.array(FileSearchResult$inboundSchema).optional(), }); /** @internal */ export type FileSearchToolCall$Outbound = { type: "file_search_call"; id: string; queries: Array; status: string; results?: Array | undefined; }; /** @internal */ export const FileSearchToolCall$outboundSchema: z.ZodType< FileSearchToolCall$Outbound, z.ZodTypeDef, FileSearchToolCall > = z.object({ type: z.literal("file_search_call"), id: z.string(), queries: z.array(z.string()), status: FileSearchToolCallStatus$outboundSchema, results: z.array(FileSearchResult$outboundSchema).optional(), }); export function fileSearchToolCallToJSON( fileSearchToolCall: FileSearchToolCall, ): string { return JSON.stringify( FileSearchToolCall$outboundSchema.parse(fileSearchToolCall), ); } export function fileSearchToolCallFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FileSearchToolCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileSearchToolCall' from JSON`, ); }