@opencode-ai/ai
Advanced tools
@@ -22,2 +22,31 @@ import { Effect, Schema } from "effect"; | ||
| type MessagePhase = Schema.Schema.Type<typeof MessagePhase>; | ||
| export declare const HostedToolItem: Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>; | ||
| export type HostedToolItem = Schema.Schema.Type<typeof HostedToolItem>; | ||
| export declare const InputItem: Schema.Union<readonly [Schema.Struct<{ | ||
@@ -61,5 +90,2 @@ readonly role: Schema.tag<"system">; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -88,5 +114,37 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>]>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>; | ||
| type OpenResponsesInputItem = Schema.Schema.Type<typeof InputItem>; | ||
| type LoweredInputItem = OpenResponsesInputItem | { | ||
| export type ExtendedHostedToolItem = { | ||
| readonly type: string; | ||
| readonly id: string; | ||
| readonly [key: string]: unknown; | ||
| }; | ||
| type LoweredInputItem = OpenResponsesInputItem | ExtendedHostedToolItem | { | ||
| readonly type: "message"; | ||
@@ -159,5 +217,2 @@ readonly id?: string; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -186,3 +241,30 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>]>>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>; | ||
| instructions: Schema.optional<Schema.String>; | ||
@@ -274,5 +356,2 @@ tools: Schema.optional<Schema.$Array<Schema.Struct<{ | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -301,3 +380,30 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>]>>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>; | ||
| readonly instructions: Schema.optional<Schema.String>; | ||
@@ -454,3 +560,3 @@ readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{ | ||
| export type Event = Schema.Schema.Type<typeof Event>; | ||
| export type ItemKind = "message" | "reasoning" | "function-call" | "reference"; | ||
| export type ItemKind = "message" | "reasoning" | "function-call" | "hosted-tool"; | ||
| export interface Extension { | ||
@@ -464,2 +570,3 @@ readonly id: string; | ||
| }) => MediaInput | undefined; | ||
| readonly lowerHostedToolItem?: (item: unknown) => ExtendedHostedToolItem | undefined; | ||
| readonly acceptsItemID?: (kind: ItemKind, id: string) => boolean; | ||
@@ -478,3 +585,2 @@ } | ||
| readonly reasoningItems: Readonly<Record<string, ReasoningStreamItem>>; | ||
| readonly store: boolean | undefined; | ||
| } | ||
@@ -558,2 +664,39 @@ type ReasoningSummaryStatus = "active" | "can-conclude" | "concluded"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -567,5 +710,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -872,2 +1012,39 @@ readonly content: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -881,5 +1058,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -1056,2 +1230,39 @@ readonly content: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -1065,5 +1276,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -1070,0 +1278,0 @@ readonly content: string; |
@@ -57,6 +57,39 @@ import { Effect, Schema } from "effect"; | ||
| }); | ||
| const OpenResponsesItemReference = Schema.Struct({ | ||
| type: Schema.tag("item_reference"), | ||
| const OpenResponsesWebSearchCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("web_search_call"), | ||
| id: Schema.String, | ||
| }); | ||
| status: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| }), [JsonObject]); | ||
| const OpenResponsesFileSearchCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("file_search_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| queries: Schema.optional(Schema.Array(Schema.String)), | ||
| results: optionalNull(Schema.Array(JsonObject)), | ||
| }), [JsonObject]); | ||
| const OpenResponsesCodeInterpreterCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("code_interpreter_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| code: optionalNull(Schema.String), | ||
| container_id: optionalNull(Schema.String), | ||
| outputs: optionalNull(Schema.Array(JsonObject)), | ||
| }), [JsonObject]); | ||
| const OpenResponsesMCPCall = Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("mcp_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| server_label: Schema.optional(Schema.String), | ||
| name: Schema.optional(Schema.String), | ||
| arguments: Schema.optional(Schema.String), | ||
| output: optionalNull(Schema.String), | ||
| error: Schema.optional(Schema.Unknown), | ||
| }), [JsonObject]); | ||
| export const HostedToolItem = Schema.Union([ | ||
| OpenResponsesWebSearchCall, | ||
| OpenResponsesFileSearchCall, | ||
| OpenResponsesCodeInterpreterCall, | ||
| OpenResponsesMCPCall, | ||
| ]); | ||
| // `function_call_output.output` accepts either a plain string or an ordered | ||
@@ -87,3 +120,2 @@ // array of content items so tools can return images and files in addition to text. | ||
| OpenResponsesReasoningItem, | ||
| OpenResponsesItemReference, | ||
| Schema.Struct({ | ||
@@ -101,2 +133,3 @@ type: Schema.tag("function_call"), | ||
| }), | ||
| HostedToolItem, | ||
| ]); | ||
@@ -349,3 +382,2 @@ export const Tool = Schema.Struct({ | ||
| const input = [...system]; | ||
| const store = OpenResponsesOptions.resolve(request).store; | ||
| const providerMetadataKey = request.model.route.providerMetadataKey ?? "openresponses"; | ||
@@ -370,4 +402,3 @@ for (const message of request.messages) { | ||
| const reasoningItems = {}; | ||
| const reasoningReferences = new Set(); | ||
| const hostedToolReferences = new Set(); | ||
| const hostedToolItems = new Set(); | ||
| const flushText = () => { | ||
@@ -407,8 +438,2 @@ if (content.length === 0) | ||
| continue; | ||
| if (store !== false) { | ||
| if (!reasoningReferences.has(reasoning.id)) | ||
| input.push({ type: "item_reference", id: reasoning.id }); | ||
| reasoningReferences.add(reasoning.id); | ||
| continue; | ||
| } | ||
| const existing = reasoningItems[reasoning.id]; | ||
@@ -435,18 +460,21 @@ if (existing) { | ||
| const id = itemID(part.providerMetadata, providerMetadataKey); | ||
| const reference = acceptsItemID(extension, "reference", id) ? id : undefined; | ||
| if (store !== false && reference && !hostedToolReferences.has(reference)) | ||
| input.push({ type: "item_reference", id: reference }); | ||
| if (store === false) { | ||
| // The server is not storing this exchange, so the tool outcome has to | ||
| // travel in the input. Non-content results degrade to their text form. | ||
| const content = part.result.type === "content" | ||
| const hosted = part.result.type !== "json" | ||
| ? undefined | ||
| : Schema.is(HostedToolItem)(part.result.value) | ||
| ? part.result.value | ||
| : [{ type: "text", text: ProviderShared.toolResultText(part) }]; | ||
| input.push({ | ||
| role: "user", | ||
| content: yield* Effect.forEach(content, (item) => lowerHostedToolResultContentItem(item, request, extension)), | ||
| }); | ||
| : extension.lowerHostedToolItem?.(part.result.value); | ||
| if (acceptsItemID(extension, "hosted-tool", id) && hosted?.id === id) { | ||
| if (!hostedToolItems.has(id)) { | ||
| input.push(hosted); | ||
| hostedToolItems.add(id); | ||
| } | ||
| continue; | ||
| } | ||
| if (reference) | ||
| hostedToolReferences.add(reference); | ||
| const content = part.result.type === "content" | ||
| ? part.result.value | ||
| : [{ type: "text", text: ProviderShared.toolResultText(part) }]; | ||
| input.push({ | ||
| role: "user", | ||
| content: yield* Effect.forEach(content, (item) => lowerHostedToolResultContentItem(item, request, extension)), | ||
| }); | ||
| continue; | ||
@@ -743,9 +771,5 @@ } | ||
| return [state, NO_EVENTS]; | ||
| const events = []; | ||
| return [ | ||
| { | ||
| ...state, | ||
| lifecycle: state.store !== false | ||
| ? Lifecycle.reasoningEnd(state.lifecycle, events, `${event.item_id}:${event.summary_index}`, providerMetadata(state, { itemId: event.item_id })) | ||
| : state.lifecycle, | ||
| reasoningItems: { | ||
@@ -757,3 +781,3 @@ ...state.reasoningItems, | ||
| ...item.summaryParts, | ||
| [event.summary_index]: state.store !== false ? "concluded" : "can-conclude", | ||
| [event.summary_index]: "can-conclude", | ||
| }, | ||
@@ -763,3 +787,3 @@ }, | ||
| }, | ||
| events, | ||
| NO_EVENTS, | ||
| ]; | ||
@@ -1019,3 +1043,2 @@ }; | ||
| reasoningItems: {}, | ||
| store: OpenResponsesOptions.resolve(request).store, | ||
| }); | ||
@@ -1022,0 +1045,0 @@ export const protocol = Protocol.make({ |
@@ -10,2 +10,39 @@ import { Route, type RouteRoutedLanguageModelInput } from "../route/client.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -19,5 +56,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -24,0 +58,0 @@ readonly content: string; |
@@ -10,34 +10,3 @@ import { Schema } from "effect"; | ||
| readonly stream: Schema.Literal<true>; | ||
| readonly tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| readonly description: Schema.String; | ||
| readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>; | ||
| readonly strict: Schema.optional<Schema.Boolean>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| readonly action: Schema.optional<Schema.Literals<readonly ["auto", "generate", "edit"]>>; | ||
| readonly background: Schema.optional<Schema.Literals<readonly ["auto", "opaque", "transparent"]>>; | ||
| readonly input_fidelity: Schema.optional<Schema.Literals<readonly ["low", "high"]>>; | ||
| readonly output_compression: Schema.optional<Schema.Int>; | ||
| readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>; | ||
| readonly partial_images: Schema.optional<Schema.Int>; | ||
| readonly quality: Schema.optional<Schema.Literals<readonly ["auto", "low", "medium", "high"]>>; | ||
| readonly size: Schema.optional<Schema.String>; | ||
| }>]>>>; | ||
| readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"allowed_tools">; | ||
| readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>; | ||
| readonly tools: Schema.$Array<Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>>; | ||
| }>]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| }>]>>; | ||
| readonly model: Schema.String; | ||
| readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly input: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{ | ||
| readonly role: Schema.tag<"system">; | ||
@@ -80,5 +49,2 @@ readonly content: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"item_reference">; | ||
| readonly id: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function_call">; | ||
@@ -107,3 +73,80 @@ readonly id: Schema.optionalKey<Schema.String>; | ||
| }>]>>]>; | ||
| }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"file_search_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly queries: Schema.optional<Schema.$Array<Schema.String>>; | ||
| readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"code_interpreter_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly code: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"mcp_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly server_label: Schema.optional<Schema.String>; | ||
| readonly name: Schema.optional<Schema.String>; | ||
| readonly arguments: Schema.optional<Schema.String>; | ||
| readonly output: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly error: Schema.optional<Schema.Unknown>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"computer_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly call_id: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| readonly pending_safety_checks: Schema.optional<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"web_search_preview_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation_call">; | ||
| readonly id: Schema.String; | ||
| readonly status: Schema.optional<Schema.String>; | ||
| readonly result: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>; | ||
| readonly revised_prompt: Schema.optional<Schema.NullOr<Schema.String>>; | ||
| }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>; | ||
| readonly tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| readonly description: Schema.String; | ||
| readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>; | ||
| readonly strict: Schema.optional<Schema.Boolean>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| readonly action: Schema.optional<Schema.Literals<readonly ["auto", "generate", "edit"]>>; | ||
| readonly background: Schema.optional<Schema.Literals<readonly ["auto", "opaque", "transparent"]>>; | ||
| readonly input_fidelity: Schema.optional<Schema.Literals<readonly ["low", "high"]>>; | ||
| readonly output_compression: Schema.optional<Schema.Int>; | ||
| readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>; | ||
| readonly partial_images: Schema.optional<Schema.Int>; | ||
| readonly quality: Schema.optional<Schema.Literals<readonly ["auto", "low", "medium", "high"]>>; | ||
| readonly size: Schema.optional<Schema.String>; | ||
| }>]>>>; | ||
| readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"allowed_tools">; | ||
| readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>; | ||
| readonly tools: Schema.$Array<Schema.Struct<{ | ||
| readonly type: Schema.tag<"function">; | ||
| readonly name: Schema.String; | ||
| }>>; | ||
| }>]>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"image_generation">; | ||
| }>]>>; | ||
| readonly model: Schema.String; | ||
| readonly instructions: Schema.optional<Schema.String>; | ||
@@ -139,2 +182,39 @@ readonly store: Schema.optional<Schema.Boolean>; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -148,5 +228,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -204,2 +281,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -336,2 +441,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -345,5 +487,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -401,2 +540,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -468,2 +635,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -477,5 +681,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -533,2 +734,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -600,2 +829,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -609,5 +875,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -665,2 +928,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -732,2 +1023,39 @@ readonly model: string; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -741,5 +1069,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -797,2 +1122,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -799,0 +1152,0 @@ readonly model: string; |
@@ -10,3 +10,3 @@ import { Effect, Encoding, Schema } from "effect"; | ||
| import { OpenResponses } from "./open-responses.js"; | ||
| import { optionalArray, ProviderShared } from "./shared.js"; | ||
| import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js"; | ||
| import { OpenAIImage } from "./utils/openai-image.js"; | ||
@@ -33,2 +33,26 @@ import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js"; | ||
| }); | ||
| const OpenAIResponsesHostedToolItem = Schema.Union([ | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("computer_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| call_id: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| pending_safety_checks: Schema.optional(Schema.Array(JsonObject)), | ||
| }), [JsonObject]), | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("web_search_preview_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| }), [JsonObject]), | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("image_generation_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| result: optionalNull(Schema.String), | ||
| output_format: Schema.optional(Schema.Literals(["png", "jpeg", "webp"])), | ||
| revised_prompt: optionalNull(Schema.String), | ||
| }), [JsonObject]), | ||
| ]); | ||
| const OpenAIResponsesTools = Schema.Union([OpenResponses.Tool, OpenAIResponsesImageGenerationTool]); | ||
@@ -41,2 +65,3 @@ const OpenAIResponsesToolChoice = Schema.Union([ | ||
| ...OpenResponses.coreFields, | ||
| input: Schema.Array(Schema.Union([OpenResponses.InputItem, OpenAIResponsesHostedToolItem])), | ||
| tools: optionalArray(OpenAIResponsesTools), | ||
@@ -52,3 +77,3 @@ tool_choice: Schema.optional(OpenAIResponsesToolChoice), | ||
| // intact. Only resend ids in each item kind's own grammar; hosted tool | ||
| // references keep generic validation because every hosted tool mints its own | ||
| // items keep generic validation because every hosted tool mints its own | ||
| // prefix. The same allowlist approach codex uses before resending history | ||
@@ -60,5 +85,4 @@ // (codex-rs core/src/client.rs, `prepare_response_items_for_request`). | ||
| "function-call": ["fc_"], | ||
| // Every hosted tool mints its own id prefix, so references keep generic | ||
| // validation only. | ||
| reference: [], | ||
| // Every hosted tool mints its own id prefix, so items keep generic validation. | ||
| "hosted-tool": [], | ||
| }; | ||
@@ -68,2 +92,3 @@ const extension = { | ||
| name: NAME, | ||
| lowerHostedToolItem: (item) => (Schema.is(OpenAIResponsesHostedToolItem)(item) ? item : undefined), | ||
| acceptsItemID: (kind, id) => { | ||
@@ -99,2 +124,3 @@ const prefixes = ITEM_ID_PREFIXES[kind]; | ||
| }); | ||
| const decodeBody = ProviderShared.validateWith(Schema.decodeUnknownEffect(OpenAIResponsesBody)); | ||
| const fromRequest = Effect.fn("OpenAIResponses.fromRequest")(function* (request) { | ||
@@ -104,3 +130,3 @@ const body = yield* OpenResponses.fromRequestWithExtension(LLMRequest.update(request, { tools: [], toolChoice: undefined }), extension); | ||
| const parallelToolCalls = OpenResponses.resolveParallelToolCalls(request); | ||
| return { | ||
| return yield* decodeBody({ | ||
| ...body, | ||
@@ -112,3 +138,3 @@ ...(parallelToolCalls === undefined ? {} : { parallel_tool_calls: parallelToolCalls }), | ||
| tool_choice: body.tool_choice ?? (request.toolChoice ? yield* lowerToolChoice(request.toolChoice, request.tools) : undefined), | ||
| }; | ||
| }); | ||
| }); | ||
@@ -115,0 +141,0 @@ const hostedToolResult = Effect.fn("OpenAIResponses.hostedToolResult")(function* (item) { |
@@ -5,2 +5,39 @@ import { Protocol } from "../route/protocol.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -14,5 +51,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -70,2 +104,17 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "x_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly error?: unknown; | ||
| readonly result?: unknown; | ||
| })[]; | ||
@@ -72,0 +121,0 @@ readonly model: string; |
@@ -0,10 +1,37 @@ | ||
| import { Effect, Schema } from "effect"; | ||
| import { Protocol } from "../route/protocol.js"; | ||
| import { OpenResponses } from "./open-responses.js"; | ||
| import { JsonObject, optionalNull, ProviderShared } from "./shared.js"; | ||
| import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js"; | ||
| const ADAPTER = "xai-responses"; | ||
| const NAME = "xAI Responses"; | ||
| const XAIResponsesHostedToolItem = Schema.Union([ | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("x_search_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| action: optionalNull(JsonObject), | ||
| }), [JsonObject]), | ||
| Schema.StructWithRest(Schema.Struct({ | ||
| type: Schema.tag("image_generation_call"), | ||
| id: Schema.String, | ||
| status: Schema.optional(Schema.String), | ||
| result: Schema.optional(Schema.Unknown), | ||
| error: Schema.optional(Schema.Unknown), | ||
| }), [JsonObject]), | ||
| ]); | ||
| const XAIResponsesBody = Schema.Struct({ | ||
| ...OpenResponses.coreFields, | ||
| input: Schema.Array(Schema.Union([OpenResponses.InputItem, XAIResponsesHostedToolItem])), | ||
| stream: Schema.Literal(true), | ||
| }); | ||
| const extension = { | ||
| id: ADAPTER, | ||
| name: NAME, | ||
| lowerHostedToolItem: (item) => (Schema.is(XAIResponsesHostedToolItem)(item) ? item : undefined), | ||
| }; | ||
| const decodeBody = ProviderShared.validateWith(Schema.decodeUnknownEffect(XAIResponsesBody)); | ||
| const fromRequest = Effect.fn("XAIResponses.fromRequest")(function* (request) { | ||
| return yield* decodeBody(yield* OpenResponses.fromRequestWithExtension(request, extension)); | ||
| }); | ||
| const HOSTED_TOOLS = { | ||
@@ -33,3 +60,6 @@ web_search_call: { name: "web_search", input: (item) => item.action ?? {} }, | ||
| id: ADAPTER, | ||
| body: OpenResponses.protocol.body, | ||
| body: { | ||
| schema: XAIResponsesBody, | ||
| from: fromRequest, | ||
| }, | ||
| stream: { | ||
@@ -36,0 +66,0 @@ event: OpenResponses.protocol.stream.event, |
@@ -122,2 +122,39 @@ import type { Route as RouteDef, RouteDefaultsInput } from "../route/client.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -131,5 +168,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -187,2 +221,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -189,0 +251,0 @@ readonly model: string; |
@@ -125,2 +125,39 @@ import { type AtLeastOne, type ProviderAuthOption } from "../route/auth-options.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -134,5 +171,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -190,2 +224,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -192,0 +254,0 @@ readonly model: string; |
@@ -23,2 +23,39 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -32,5 +69,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -37,0 +71,0 @@ readonly content: string; |
@@ -21,2 +21,39 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -30,5 +67,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -35,0 +69,0 @@ readonly content: string; |
@@ -110,2 +110,39 @@ import { type ProviderAuthOption } from "../route/auth-options.js"; | ||
| readonly input: readonly ({ | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "file_search_call"; | ||
| readonly status?: string | undefined; | ||
| readonly queries?: readonly string[] | undefined; | ||
| readonly results?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "code_interpreter_call"; | ||
| readonly status?: string | undefined; | ||
| readonly code?: string | null | undefined; | ||
| readonly container_id?: string | null | undefined; | ||
| readonly outputs?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "mcp_call"; | ||
| readonly status?: string | undefined; | ||
| readonly name?: string | undefined; | ||
| readonly output?: string | null | undefined; | ||
| readonly error?: unknown; | ||
| readonly arguments?: string | undefined; | ||
| readonly server_label?: string | undefined; | ||
| } | { | ||
| readonly type: "reasoning"; | ||
@@ -119,5 +156,2 @@ readonly summary: readonly { | ||
| } | { | ||
| readonly type: "item_reference"; | ||
| readonly id: string; | ||
| } | { | ||
| readonly role: "system"; | ||
@@ -175,2 +209,30 @@ readonly content: string; | ||
| })[]; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "computer_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| readonly call_id?: string | undefined; | ||
| readonly pending_safety_checks?: readonly { | ||
| readonly [x: string]: unknown; | ||
| }[] | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "web_search_preview_call"; | ||
| readonly status?: string | undefined; | ||
| readonly action?: { | ||
| readonly [x: string]: unknown; | ||
| } | null | undefined; | ||
| } | { | ||
| readonly [x: string]: unknown; | ||
| readonly id: string; | ||
| readonly type: "image_generation_call"; | ||
| readonly status?: string | undefined; | ||
| readonly result?: string | null | undefined; | ||
| readonly revised_prompt?: string | null | undefined; | ||
| readonly output_format?: "png" | "jpeg" | "webp" | undefined; | ||
| })[]; | ||
@@ -177,0 +239,0 @@ readonly model: string; |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-dev-18229", | ||
| "version": "0.0.0-dev-18231", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-rc.111", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18229", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18231", | ||
| "@tsconfig/bun": "1.0.9", | ||
@@ -43,3 +43,3 @@ "@types/bun": "1.3.13", | ||
| "@smithy/util-utf8": "4.2.2", | ||
| "@opencode-ai/schema": "0.0.0-dev-18229", | ||
| "@opencode-ai/schema": "0.0.0-dev-18231", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.111", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1313530
3.34%30149
3.35%+ Added
- Removed