From 9376e9b1ee55aecc162b1b1d65cf11463a4c59e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 06:04:49 +0000 Subject: [PATCH 01/14] Initial plan From 19692bfc0516ba53e7b1df6b84e6162dc845f717 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 06:09:10 +0000 Subject: [PATCH 02/14] Update mimeType to mediaType with backwards compatibility - Updated component schema to use optional mediaType and mimeType - Updated files.ts addFile mutation to accept both mediaType and mimeType - Updated client files.ts to use mediaType when calling component - Updated getFile to support both mediaType and mimeType from database - Updated mapping.ts to return mediaType instead of mimeType - Maintained backwards compatibility throughout Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- src/client/files.ts | 6 ++++-- src/component/files.ts | 13 +++++++++++-- src/component/schema.ts | 4 +++- src/mapping.ts | 8 ++++---- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/client/files.ts b/src/client/files.ts index 6ee78506..ae56581e 100644 --- a/src/client/files.ts +++ b/src/client/files.ts @@ -92,7 +92,7 @@ export async function storeFile( storageId: newStorageId, hash, filename, - mimeType: blob.type, + mediaType: blob.type, }); const url = (await ctx.storage.getUrl(storageId as Id<"_storage">))!; if (storageId !== newStorageId) { @@ -142,8 +142,10 @@ export async function getFile( if (!url) { throw new Error(`File not found in storage: ${file.storageId}`); } + // Support both mediaType (preferred) and mimeType (deprecated) + const mediaType = file.mediaType ?? file.mimeType ?? ""; return { - ...getParts(url, file.mimeType, file.filename), + ...getParts(url, mediaType, file.filename), file: { fileId, url, diff --git a/src/component/files.ts b/src/component/files.ts index c6ce165b..89506f4c 100644 --- a/src/component/files.ts +++ b/src/component/files.ts @@ -9,7 +9,9 @@ const addFileArgs = v.object({ storageId: v.string(), hash: v.string(), filename: v.optional(v.string()), - mimeType: v.string(), + mediaType: v.optional(v.string()), + /** @deprecated Use `mediaType` instead. */ + mimeType: v.optional(v.string()), }); export const addFile = mutation({ @@ -25,6 +27,9 @@ export async function addFileHandler( ctx: MutationCtx, args: Infer, ) { + // Support both mediaType (preferred) and mimeType (deprecated) + const mediaType = args.mediaType ?? args.mimeType; + const existingFile = await ctx.db .query("files") .withIndex("hash", (q) => q.eq("hash", args.hash)) @@ -42,7 +47,11 @@ export async function addFileHandler( }; } const fileId = await ctx.db.insert("files", { - ...args, + storageId: args.storageId, + hash: args.hash, + filename: args.filename, + mediaType, + mimeType: args.mimeType, // Keep for backwards compatibility // We start out with it unused - when it's saved in a message we increment. refcount: 0, lastTouchedAt: Date.now(), diff --git a/src/component/schema.ts b/src/component/schema.ts index da319828..644cc62e 100644 --- a/src/component/schema.ts +++ b/src/component/schema.ts @@ -149,7 +149,9 @@ export const schema = defineSchema({ files: defineTable({ storageId: v.string(), - mimeType: v.string(), + mediaType: v.optional(v.string()), + /** @deprecated Use `mediaType` instead. */ + mimeType: v.optional(v.string()), filename: v.optional(v.string()), hash: v.string(), refcount: v.number(), diff --git a/src/mapping.ts b/src/mapping.ts index 71c95ac0..4bb91659 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -328,7 +328,7 @@ export async function serializeContent( } return { type: part.type, - mimeType: getMimeOrMediaType(part), + mediaType: getMimeOrMediaType(part), ...metadata, image, } satisfies Infer; @@ -348,7 +348,7 @@ export async function serializeContent( type: part.type, data, filename: part.filename, - mimeType: getMimeOrMediaType(part)!, + mediaType: getMimeOrMediaType(part)!, ...metadata, } satisfies Infer; } @@ -419,7 +419,7 @@ export function fromModelMessageContent(content: Content): Message["content"] { case "image": return { type: part.type, - mimeType: getMimeOrMediaType(part), + mediaType: getMimeOrMediaType(part), ...metadata, image: serializeDataOrUrl(part.image), } satisfies Infer; @@ -428,7 +428,7 @@ export function fromModelMessageContent(content: Content): Message["content"] { type: part.type, data: serializeDataOrUrl(part.data), filename: part.filename, - mimeType: getMimeOrMediaType(part)!, + mediaType: getMimeOrMediaType(part)!, ...metadata, } satisfies Infer; case "tool-call": From dcdd9ea4aa358ea2f9b63f013660b70c9a9b4e0f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 06:10:29 +0000 Subject: [PATCH 03/14] Fix test to expect mediaType instead of mimeType Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- src/fromUIMessages.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fromUIMessages.test.ts b/src/fromUIMessages.test.ts index 4d295d43..cbe0cb24 100644 --- a/src/fromUIMessages.test.ts +++ b/src/fromUIMessages.test.ts @@ -277,7 +277,7 @@ describe("fromUIMessages round-trip tests", () => { expect(fileContent).toBeDefined(); expect(fileContent).toMatchObject({ type: "file", - mimeType: "image/png", + mediaType: "image/png", }); } }); From d051529f14c33f5f63cf8b73d97a006c8f9ffd1d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 06:12:50 +0000 Subject: [PATCH 04/14] Update generated component types to use mediaType instead of mimeType - Updated all file part definitions in generated component.ts - Changed mimeType from required to optional - Added mediaType as optional field - Resolved all TypeScript type errors related to mimeType/mediaType Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- src/component/_generated/component.ts | 57 ++++++++++++++++++--------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/src/component/_generated/component.ts b/src/component/_generated/component.ts index 228108ff..7ee22d7d 100644 --- a/src/component/_generated/component.ts +++ b/src/component/_generated/component.ts @@ -56,7 +56,8 @@ export type ComponentApi = { filename?: string; hash: string; - mimeType: string; + mediaType?: string; + mimeType?: string; storageId: string; }, { fileId: string; storageId: string }, @@ -86,7 +87,8 @@ export type ComponentApi = filename?: string; hash: string; lastTouchedAt: number; - mimeType: string; + mediaType?: string; + mimeType?: string; refcount: number; storageId: string; }, @@ -114,7 +116,8 @@ export type ComponentApi = filename?: string; hash: string; lastTouchedAt: number; - mimeType: string; + mediaType?: string; + mimeType?: string; refcount: number; storageId: string; }>; @@ -192,7 +195,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -226,7 +230,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -495,7 +500,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -529,7 +535,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -846,7 +853,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -874,7 +882,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1144,7 +1153,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1178,7 +1188,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1462,7 +1473,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1490,7 +1502,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1736,7 +1749,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1764,7 +1778,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -2006,7 +2021,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -2040,7 +2056,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -2248,7 +2265,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -2276,7 +2294,8 @@ export type ComponentApi = | { data: string | ArrayBuffer; filename?: string; - mimeType: string; + mediaType?: string; + mimeType?: string; providerMetadata?: Record< string, Record From 392152f5fd5c0b6c10a0dc6c3523bba567a34e15 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:19:05 +0000 Subject: [PATCH 05/14] Initial plan From 1e3f63ca3588b1832a4ac57dca93141a08fb8382 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:27:40 +0000 Subject: [PATCH 06/14] Fix tool-call input field and add execution-denied output type Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- src/client/search.ts | 11 +- src/component/_generated/component.ts | 96 +- src/component/_generated/component.ts.bak | 2941 +++++++++++++++++++++ src/mapping.ts | 17 +- 4 files changed, 3047 insertions(+), 18 deletions(-) create mode 100644 src/component/_generated/component.ts.bak diff --git a/src/client/search.ts b/src/client/search.ts index 05cf42d5..5c970932 100644 --- a/src/client/search.ts +++ b/src/client/search.ts @@ -267,9 +267,14 @@ export function filterOutOrphanedToolMessages(docs: MessageDoc[]) { }); } } else if (doc.message?.role === "tool") { - const content = doc.message.content.filter((c) => - toolCallIds.has(c.toolCallId), - ); + const content = doc.message.content.filter((c) => { + // tool-result parts have toolCallId + if (c.type === "tool-result") { + return toolCallIds.has(c.toolCallId); + } + // tool-approval-response parts don't have toolCallId, so include them + return true; + }); if (content.length) { result.push({ ...doc, diff --git a/src/component/_generated/component.ts b/src/component/_generated/component.ts index 7ee22d7d..eea30b00 100644 --- a/src/component/_generated/component.ts +++ b/src/component/_generated/component.ts @@ -268,7 +268,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -298,6 +299,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -371,11 +373,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -573,7 +583,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -603,6 +614,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -676,11 +688,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -911,7 +931,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -934,6 +955,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -998,11 +1020,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -1226,7 +1256,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -1256,6 +1287,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -1329,11 +1361,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -1531,7 +1571,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -1554,6 +1595,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -1618,11 +1660,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -1807,7 +1857,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -1830,6 +1881,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -1894,11 +1946,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -2094,7 +2154,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -2124,6 +2185,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -2197,11 +2259,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -2323,7 +2393,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - args: any; + input: any; + args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -2346,6 +2417,7 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< @@ -2410,11 +2482,19 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< | { text: string; type: "text" } | { data: string; mediaType: string; type: "media" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; diff --git a/src/component/_generated/component.ts.bak b/src/component/_generated/component.ts.bak new file mode 100644 index 00000000..7ee22d7d --- /dev/null +++ b/src/component/_generated/component.ts.bak @@ -0,0 +1,2941 @@ +/* eslint-disable */ +/** + * Generated `ComponentApi` utility. + * + * THIS CODE IS AUTOMATICALLY GENERATED. + * + * To regenerate, run `npx convex dev`. + * @module + */ + +import type { FunctionReference } from "convex/server"; + +/** + * A utility for referencing a Convex component's exposed API. + * + * Useful when expecting a parameter like `components.myComponent`. + * Usage: + * ```ts + * async function myFunction(ctx: QueryCtx, component: ComponentApi) { + * return ctx.runQuery(component.someFile.someQuery, { ...args }); + * } + * ``` + */ +export type ComponentApi = + { + apiKeys: { + destroy: FunctionReference< + "mutation", + "internal", + { apiKey?: string; name?: string }, + | "missing" + | "deleted" + | "name mismatch" + | "must provide either apiKey or name", + Name + >; + issue: FunctionReference< + "mutation", + "internal", + { name?: string }, + string, + Name + >; + validate: FunctionReference< + "query", + "internal", + { apiKey: string }, + boolean, + Name + >; + }; + files: { + addFile: FunctionReference< + "mutation", + "internal", + { + filename?: string; + hash: string; + mediaType?: string; + mimeType?: string; + storageId: string; + }, + { fileId: string; storageId: string }, + Name + >; + copyFile: FunctionReference< + "mutation", + "internal", + { fileId: string }, + null, + Name + >; + deleteFiles: FunctionReference< + "mutation", + "internal", + { fileIds: Array; force?: boolean }, + Array, + Name + >; + get: FunctionReference< + "query", + "internal", + { fileId: string }, + null | { + _creationTime: number; + _id: string; + filename?: string; + hash: string; + lastTouchedAt: number; + mediaType?: string; + mimeType?: string; + refcount: number; + storageId: string; + }, + Name + >; + getFilesToDelete: FunctionReference< + "query", + "internal", + { + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + }, + { + continueCursor: string; + isDone: boolean; + page: Array<{ + _creationTime: number; + _id: string; + filename?: string; + hash: string; + lastTouchedAt: number; + mediaType?: string; + mimeType?: string; + refcount: number; + storageId: string; + }>; + }, + Name + >; + useExistingFile: FunctionReference< + "mutation", + "internal", + { filename?: string; hash: string }, + null | { fileId: string; storageId: string }, + Name + >; + }; + messages: { + addMessages: FunctionReference< + "mutation", + "internal", + { + agentName?: string; + embeddings?: { + dimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + model: string; + vectors: Array | null>; + }; + failPendingSteps?: boolean; + hideFromUserIdSearch?: boolean; + messages: Array<{ + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + message: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + provider?: string; + providerMetadata?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status?: "pending" | "success" | "failed"; + text?: string; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + warnings?: Array< + | { + details?: string; + setting: string; + type: "unsupported-setting"; + } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>; + pendingMessageId?: string; + promptMessageId?: string; + threadId: string; + userId?: string; + }, + { + messages: Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { + details?: string; + setting: string; + type: "unsupported-setting"; + } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>; + }, + Name + >; + cloneThread: FunctionReference< + "action", + "internal", + { + batchSize?: number; + copyUserIdForVectorSearch?: boolean; + excludeToolMessages?: boolean; + insertAtOrder?: number; + limit?: number; + sourceThreadId: string; + statuses?: Array<"pending" | "success" | "failed">; + targetThreadId: string; + upToAndIncludingMessageId?: string; + }, + number, + Name + >; + deleteByIds: FunctionReference< + "mutation", + "internal", + { messageIds: Array }, + Array, + Name + >; + deleteByOrder: FunctionReference< + "mutation", + "internal", + { + endOrder: number; + endStepOrder?: number; + startOrder: number; + startStepOrder?: number; + threadId: string; + }, + { isDone: boolean; lastOrder?: number; lastStepOrder?: number }, + Name + >; + finalizeMessage: FunctionReference< + "mutation", + "internal", + { + messageId: string; + result: { status: "success" } | { error: string; status: "failed" }; + }, + null, + Name + >; + getMessagesByIds: FunctionReference< + "query", + "internal", + { messageIds: Array }, + Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>, + Name + >; + getMessageSearchFields: FunctionReference< + "query", + "internal", + { messageId: string }, + { embedding?: Array; embeddingModel?: string; text?: string }, + Name + >; + listMessagesByThreadId: FunctionReference< + "query", + "internal", + { + excludeToolMessages?: boolean; + order: "asc" | "desc"; + paginationOpts?: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + statuses?: Array<"pending" | "success" | "failed">; + threadId: string; + upToAndIncludingMessageId?: string; + }, + { + continueCursor: string; + isDone: boolean; + page: Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { + details?: string; + setting: string; + type: "unsupported-setting"; + } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>; + pageStatus?: "SplitRecommended" | "SplitRequired" | null; + splitCursor?: string | null; + }, + Name + >; + searchMessages: FunctionReference< + "action", + "internal", + { + embedding?: Array; + embeddingModel?: string; + limit: number; + messageRange?: { after: number; before: number }; + searchAllMessagesForUserId?: string; + targetMessageId?: string; + text?: string; + textSearch?: boolean; + threadId?: string; + vectorScoreThreshold?: number; + vectorSearch?: boolean; + }, + Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>, + Name + >; + textSearch: FunctionReference< + "query", + "internal", + { + limit: number; + searchAllMessagesForUserId?: string; + targetMessageId?: string; + text?: string; + threadId?: string; + }, + Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>, + Name + >; + updateMessage: FunctionReference< + "mutation", + "internal", + { + messageId: string; + patch: { + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + provider?: string; + providerOptions?: Record>; + status?: "pending" | "success" | "failed"; + }; + }, + { + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { + data: string; + mediaType: string; + type: "media"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array<{ + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { type: "text"; value: string } + | { type: "json"; value: any } + | { type: "error-text"; value: string } + | { type: "error-json"; value: any } + | { + type: "content"; + value: Array< + | { text: string; type: "text" } + | { data: string; mediaType: string; type: "media" } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + }>; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }, + Name + >; + }; + streams: { + abort: FunctionReference< + "mutation", + "internal", + { + finalDelta?: { + end: number; + parts: Array; + start: number; + streamId: string; + }; + reason: string; + streamId: string; + }, + boolean, + Name + >; + abortByOrder: FunctionReference< + "mutation", + "internal", + { order: number; reason: string; threadId: string }, + boolean, + Name + >; + addDelta: FunctionReference< + "mutation", + "internal", + { end: number; parts: Array; start: number; streamId: string }, + boolean, + Name + >; + create: FunctionReference< + "mutation", + "internal", + { + agentName?: string; + format?: "UIMessageChunk" | "TextStreamPart"; + model?: string; + order: number; + provider?: string; + providerOptions?: Record>; + stepOrder: number; + threadId: string; + userId?: string; + }, + string, + Name + >; + deleteAllStreamsForThreadIdAsync: FunctionReference< + "mutation", + "internal", + { deltaCursor?: string; streamOrder?: number; threadId: string }, + { deltaCursor?: string; isDone: boolean; streamOrder?: number }, + Name + >; + deleteAllStreamsForThreadIdSync: FunctionReference< + "action", + "internal", + { threadId: string }, + null, + Name + >; + deleteStreamAsync: FunctionReference< + "mutation", + "internal", + { cursor?: string; streamId: string }, + null, + Name + >; + deleteStreamSync: FunctionReference< + "mutation", + "internal", + { streamId: string }, + null, + Name + >; + finish: FunctionReference< + "mutation", + "internal", + { + finalDelta?: { + end: number; + parts: Array; + start: number; + streamId: string; + }; + streamId: string; + }, + null, + Name + >; + heartbeat: FunctionReference< + "mutation", + "internal", + { streamId: string }, + null, + Name + >; + list: FunctionReference< + "query", + "internal", + { + startOrder?: number; + statuses?: Array<"streaming" | "finished" | "aborted">; + threadId: string; + }, + Array<{ + agentName?: string; + format?: "UIMessageChunk" | "TextStreamPart"; + model?: string; + order: number; + provider?: string; + providerOptions?: Record>; + status: "streaming" | "finished" | "aborted"; + stepOrder: number; + streamId: string; + userId?: string; + }>, + Name + >; + listDeltas: FunctionReference< + "query", + "internal", + { + cursors: Array<{ cursor: number; streamId: string }>; + threadId: string; + }, + Array<{ + end: number; + parts: Array; + start: number; + streamId: string; + }>, + Name + >; + }; + threads: { + createThread: FunctionReference< + "mutation", + "internal", + { + defaultSystemPrompt?: string; + parentThreadIds?: Array; + summary?: string; + title?: string; + userId?: string; + }, + { + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }, + Name + >; + deleteAllForThreadIdAsync: FunctionReference< + "mutation", + "internal", + { + cursor?: string; + deltaCursor?: string; + limit?: number; + messagesDone?: boolean; + streamOrder?: number; + streamsDone?: boolean; + threadId: string; + }, + { isDone: boolean }, + Name + >; + deleteAllForThreadIdSync: FunctionReference< + "action", + "internal", + { limit?: number; threadId: string }, + null, + Name + >; + getThread: FunctionReference< + "query", + "internal", + { threadId: string }, + { + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + } | null, + Name + >; + listThreadsByUserId: FunctionReference< + "query", + "internal", + { + order?: "asc" | "desc"; + paginationOpts?: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + userId?: string; + }, + { + continueCursor: string; + isDone: boolean; + page: Array<{ + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }>; + pageStatus?: "SplitRecommended" | "SplitRequired" | null; + splitCursor?: string | null; + }, + Name + >; + searchThreadTitles: FunctionReference< + "query", + "internal", + { limit: number; query: string; userId?: string | null }, + Array<{ + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }>, + Name + >; + updateThread: FunctionReference< + "mutation", + "internal", + { + patch: { + status?: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }; + threadId: string; + }, + { + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }, + Name + >; + }; + users: { + deleteAllForUserId: FunctionReference< + "action", + "internal", + { userId: string }, + null, + Name + >; + deleteAllForUserIdAsync: FunctionReference< + "mutation", + "internal", + { userId: string }, + boolean, + Name + >; + listUsersWithThreads: FunctionReference< + "query", + "internal", + { + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + }, + { + continueCursor: string; + isDone: boolean; + page: Array; + pageStatus?: "SplitRecommended" | "SplitRequired" | null; + splitCursor?: string | null; + }, + Name + >; + }; + vector: { + index: { + deleteBatch: FunctionReference< + "mutation", + "internal", + { + ids: Array< + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string + >; + }, + null, + Name + >; + deleteBatchForThread: FunctionReference< + "mutation", + "internal", + { + cursor?: string; + limit: number; + model: string; + threadId: string; + vectorDimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + }, + { continueCursor: string; isDone: boolean }, + Name + >; + insertBatch: FunctionReference< + "mutation", + "internal", + { + vectorDimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + vectors: Array<{ + messageId?: string; + model: string; + table: string; + threadId?: string; + userId?: string; + vector: Array; + }>; + }, + Array< + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string + >, + Name + >; + paginate: FunctionReference< + "query", + "internal", + { + cursor?: string; + limit: number; + table?: string; + targetModel: string; + vectorDimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + }, + { + continueCursor: string; + ids: Array< + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string + >; + isDone: boolean; + }, + Name + >; + updateBatch: FunctionReference< + "mutation", + "internal", + { + vectors: Array<{ + id: + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string; + model: string; + vector: Array; + }>; + }, + null, + Name + >; + }; + }; + }; diff --git a/src/mapping.ts b/src/mapping.ts index 4bb91659..c2d179c0 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -353,12 +353,13 @@ export async function serializeContent( } satisfies Infer; } case "tool-call": { - const input = part.input ?? (part as any)?.args; + // Handle legacy data where only args field exists + const input = part.input ?? (part as any)?.args ?? {}; return { type: part.type, - input: input ?? null, + input, /** @deprecated Use `input` instead. */ - args: input ?? null, + args: input, toolCallId: part.toolCallId, toolName: part.toolName, providerExecuted: part.providerExecuted, @@ -432,11 +433,12 @@ export function fromModelMessageContent(content: Content): Message["content"] { ...metadata, } satisfies Infer; case "tool-call": + // Handle legacy data where only args field exists return { type: part.type, - input: part.input ?? null, + input: part.input ?? (part as any)?.args ?? {}, /** @deprecated Use `input` instead. */ - args: part.input ?? null, + args: part.input ?? (part as any)?.args ?? {}, toolCallId: part.toolCallId, toolName: part.toolName, providerExecuted: part.providerExecuted, @@ -515,10 +517,11 @@ export function toModelMessageContent( ...metadata, } satisfies FilePart; case "tool-call": { - const input = part.input ?? (part as any)?.args; + // Handle legacy data where only args field exists + const input = part.input ?? (part as any)?.args ?? {}; return { type: part.type, - input: input ?? null, + input, toolCallId: part.toolCallId, toolName: part.toolName, providerExecuted: part.providerExecuted, From 7d85495000530e0d71774072793bad3d7a44f6e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:27:49 +0000 Subject: [PATCH 07/14] Remove backup file --- src/component/_generated/component.ts.bak | 2941 --------------------- 1 file changed, 2941 deletions(-) delete mode 100644 src/component/_generated/component.ts.bak diff --git a/src/component/_generated/component.ts.bak b/src/component/_generated/component.ts.bak deleted file mode 100644 index 7ee22d7d..00000000 --- a/src/component/_generated/component.ts.bak +++ /dev/null @@ -1,2941 +0,0 @@ -/* eslint-disable */ -/** - * Generated `ComponentApi` utility. - * - * THIS CODE IS AUTOMATICALLY GENERATED. - * - * To regenerate, run `npx convex dev`. - * @module - */ - -import type { FunctionReference } from "convex/server"; - -/** - * A utility for referencing a Convex component's exposed API. - * - * Useful when expecting a parameter like `components.myComponent`. - * Usage: - * ```ts - * async function myFunction(ctx: QueryCtx, component: ComponentApi) { - * return ctx.runQuery(component.someFile.someQuery, { ...args }); - * } - * ``` - */ -export type ComponentApi = - { - apiKeys: { - destroy: FunctionReference< - "mutation", - "internal", - { apiKey?: string; name?: string }, - | "missing" - | "deleted" - | "name mismatch" - | "must provide either apiKey or name", - Name - >; - issue: FunctionReference< - "mutation", - "internal", - { name?: string }, - string, - Name - >; - validate: FunctionReference< - "query", - "internal", - { apiKey: string }, - boolean, - Name - >; - }; - files: { - addFile: FunctionReference< - "mutation", - "internal", - { - filename?: string; - hash: string; - mediaType?: string; - mimeType?: string; - storageId: string; - }, - { fileId: string; storageId: string }, - Name - >; - copyFile: FunctionReference< - "mutation", - "internal", - { fileId: string }, - null, - Name - >; - deleteFiles: FunctionReference< - "mutation", - "internal", - { fileIds: Array; force?: boolean }, - Array, - Name - >; - get: FunctionReference< - "query", - "internal", - { fileId: string }, - null | { - _creationTime: number; - _id: string; - filename?: string; - hash: string; - lastTouchedAt: number; - mediaType?: string; - mimeType?: string; - refcount: number; - storageId: string; - }, - Name - >; - getFilesToDelete: FunctionReference< - "query", - "internal", - { - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - }, - { - continueCursor: string; - isDone: boolean; - page: Array<{ - _creationTime: number; - _id: string; - filename?: string; - hash: string; - lastTouchedAt: number; - mediaType?: string; - mimeType?: string; - refcount: number; - storageId: string; - }>; - }, - Name - >; - useExistingFile: FunctionReference< - "mutation", - "internal", - { filename?: string; hash: string }, - null | { fileId: string; storageId: string }, - Name - >; - }; - messages: { - addMessages: FunctionReference< - "mutation", - "internal", - { - agentName?: string; - embeddings?: { - dimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - model: string; - vectors: Array | null>; - }; - failPendingSteps?: boolean; - hideFromUserIdSearch?: boolean; - messages: Array<{ - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - message: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - provider?: string; - providerMetadata?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status?: "pending" | "success" | "failed"; - text?: string; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - warnings?: Array< - | { - details?: string; - setting: string; - type: "unsupported-setting"; - } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>; - pendingMessageId?: string; - promptMessageId?: string; - threadId: string; - userId?: string; - }, - { - messages: Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { - details?: string; - setting: string; - type: "unsupported-setting"; - } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>; - }, - Name - >; - cloneThread: FunctionReference< - "action", - "internal", - { - batchSize?: number; - copyUserIdForVectorSearch?: boolean; - excludeToolMessages?: boolean; - insertAtOrder?: number; - limit?: number; - sourceThreadId: string; - statuses?: Array<"pending" | "success" | "failed">; - targetThreadId: string; - upToAndIncludingMessageId?: string; - }, - number, - Name - >; - deleteByIds: FunctionReference< - "mutation", - "internal", - { messageIds: Array }, - Array, - Name - >; - deleteByOrder: FunctionReference< - "mutation", - "internal", - { - endOrder: number; - endStepOrder?: number; - startOrder: number; - startStepOrder?: number; - threadId: string; - }, - { isDone: boolean; lastOrder?: number; lastStepOrder?: number }, - Name - >; - finalizeMessage: FunctionReference< - "mutation", - "internal", - { - messageId: string; - result: { status: "success" } | { error: string; status: "failed" }; - }, - null, - Name - >; - getMessagesByIds: FunctionReference< - "query", - "internal", - { messageIds: Array }, - Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>, - Name - >; - getMessageSearchFields: FunctionReference< - "query", - "internal", - { messageId: string }, - { embedding?: Array; embeddingModel?: string; text?: string }, - Name - >; - listMessagesByThreadId: FunctionReference< - "query", - "internal", - { - excludeToolMessages?: boolean; - order: "asc" | "desc"; - paginationOpts?: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - statuses?: Array<"pending" | "success" | "failed">; - threadId: string; - upToAndIncludingMessageId?: string; - }, - { - continueCursor: string; - isDone: boolean; - page: Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { - details?: string; - setting: string; - type: "unsupported-setting"; - } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>; - pageStatus?: "SplitRecommended" | "SplitRequired" | null; - splitCursor?: string | null; - }, - Name - >; - searchMessages: FunctionReference< - "action", - "internal", - { - embedding?: Array; - embeddingModel?: string; - limit: number; - messageRange?: { after: number; before: number }; - searchAllMessagesForUserId?: string; - targetMessageId?: string; - text?: string; - textSearch?: boolean; - threadId?: string; - vectorScoreThreshold?: number; - vectorSearch?: boolean; - }, - Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>, - Name - >; - textSearch: FunctionReference< - "query", - "internal", - { - limit: number; - searchAllMessagesForUserId?: string; - targetMessageId?: string; - text?: string; - threadId?: string; - }, - Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>, - Name - >; - updateMessage: FunctionReference< - "mutation", - "internal", - { - messageId: string; - patch: { - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - provider?: string; - providerOptions?: Record>; - status?: "pending" | "success" | "failed"; - }; - }, - { - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { - data: string; - mediaType: string; - type: "media"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { - type: "content"; - value: Array< - | { text: string; type: "text" } - | { data: string; mediaType: string; type: "media" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }, - Name - >; - }; - streams: { - abort: FunctionReference< - "mutation", - "internal", - { - finalDelta?: { - end: number; - parts: Array; - start: number; - streamId: string; - }; - reason: string; - streamId: string; - }, - boolean, - Name - >; - abortByOrder: FunctionReference< - "mutation", - "internal", - { order: number; reason: string; threadId: string }, - boolean, - Name - >; - addDelta: FunctionReference< - "mutation", - "internal", - { end: number; parts: Array; start: number; streamId: string }, - boolean, - Name - >; - create: FunctionReference< - "mutation", - "internal", - { - agentName?: string; - format?: "UIMessageChunk" | "TextStreamPart"; - model?: string; - order: number; - provider?: string; - providerOptions?: Record>; - stepOrder: number; - threadId: string; - userId?: string; - }, - string, - Name - >; - deleteAllStreamsForThreadIdAsync: FunctionReference< - "mutation", - "internal", - { deltaCursor?: string; streamOrder?: number; threadId: string }, - { deltaCursor?: string; isDone: boolean; streamOrder?: number }, - Name - >; - deleteAllStreamsForThreadIdSync: FunctionReference< - "action", - "internal", - { threadId: string }, - null, - Name - >; - deleteStreamAsync: FunctionReference< - "mutation", - "internal", - { cursor?: string; streamId: string }, - null, - Name - >; - deleteStreamSync: FunctionReference< - "mutation", - "internal", - { streamId: string }, - null, - Name - >; - finish: FunctionReference< - "mutation", - "internal", - { - finalDelta?: { - end: number; - parts: Array; - start: number; - streamId: string; - }; - streamId: string; - }, - null, - Name - >; - heartbeat: FunctionReference< - "mutation", - "internal", - { streamId: string }, - null, - Name - >; - list: FunctionReference< - "query", - "internal", - { - startOrder?: number; - statuses?: Array<"streaming" | "finished" | "aborted">; - threadId: string; - }, - Array<{ - agentName?: string; - format?: "UIMessageChunk" | "TextStreamPart"; - model?: string; - order: number; - provider?: string; - providerOptions?: Record>; - status: "streaming" | "finished" | "aborted"; - stepOrder: number; - streamId: string; - userId?: string; - }>, - Name - >; - listDeltas: FunctionReference< - "query", - "internal", - { - cursors: Array<{ cursor: number; streamId: string }>; - threadId: string; - }, - Array<{ - end: number; - parts: Array; - start: number; - streamId: string; - }>, - Name - >; - }; - threads: { - createThread: FunctionReference< - "mutation", - "internal", - { - defaultSystemPrompt?: string; - parentThreadIds?: Array; - summary?: string; - title?: string; - userId?: string; - }, - { - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }, - Name - >; - deleteAllForThreadIdAsync: FunctionReference< - "mutation", - "internal", - { - cursor?: string; - deltaCursor?: string; - limit?: number; - messagesDone?: boolean; - streamOrder?: number; - streamsDone?: boolean; - threadId: string; - }, - { isDone: boolean }, - Name - >; - deleteAllForThreadIdSync: FunctionReference< - "action", - "internal", - { limit?: number; threadId: string }, - null, - Name - >; - getThread: FunctionReference< - "query", - "internal", - { threadId: string }, - { - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - } | null, - Name - >; - listThreadsByUserId: FunctionReference< - "query", - "internal", - { - order?: "asc" | "desc"; - paginationOpts?: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - userId?: string; - }, - { - continueCursor: string; - isDone: boolean; - page: Array<{ - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }>; - pageStatus?: "SplitRecommended" | "SplitRequired" | null; - splitCursor?: string | null; - }, - Name - >; - searchThreadTitles: FunctionReference< - "query", - "internal", - { limit: number; query: string; userId?: string | null }, - Array<{ - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }>, - Name - >; - updateThread: FunctionReference< - "mutation", - "internal", - { - patch: { - status?: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }; - threadId: string; - }, - { - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }, - Name - >; - }; - users: { - deleteAllForUserId: FunctionReference< - "action", - "internal", - { userId: string }, - null, - Name - >; - deleteAllForUserIdAsync: FunctionReference< - "mutation", - "internal", - { userId: string }, - boolean, - Name - >; - listUsersWithThreads: FunctionReference< - "query", - "internal", - { - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - }, - { - continueCursor: string; - isDone: boolean; - page: Array; - pageStatus?: "SplitRecommended" | "SplitRequired" | null; - splitCursor?: string | null; - }, - Name - >; - }; - vector: { - index: { - deleteBatch: FunctionReference< - "mutation", - "internal", - { - ids: Array< - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string - >; - }, - null, - Name - >; - deleteBatchForThread: FunctionReference< - "mutation", - "internal", - { - cursor?: string; - limit: number; - model: string; - threadId: string; - vectorDimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - }, - { continueCursor: string; isDone: boolean }, - Name - >; - insertBatch: FunctionReference< - "mutation", - "internal", - { - vectorDimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - vectors: Array<{ - messageId?: string; - model: string; - table: string; - threadId?: string; - userId?: string; - vector: Array; - }>; - }, - Array< - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string - >, - Name - >; - paginate: FunctionReference< - "query", - "internal", - { - cursor?: string; - limit: number; - table?: string; - targetModel: string; - vectorDimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - }, - { - continueCursor: string; - ids: Array< - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string - >; - isDone: boolean; - }, - Name - >; - updateBatch: FunctionReference< - "mutation", - "internal", - { - vectors: Array<{ - id: - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string; - model: string; - vector: Array; - }>; - }, - null, - Name - >; - }; - }; - }; From 3ee52636b23e89714fc50f816758e7494123572a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:31:15 +0000 Subject: [PATCH 08/14] Add tool-call input field, execution-denied type, and extended content types Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- src/component/_generated/component.ts | 136 ++++++++++++++++++++------ 1 file changed, 104 insertions(+), 32 deletions(-) diff --git a/src/component/_generated/component.ts b/src/component/_generated/component.ts index eea30b00..066eee0e 100644 --- a/src/component/_generated/component.ts +++ b/src/component/_generated/component.ts @@ -286,7 +286,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; @@ -299,11 +299,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -364,7 +365,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -374,10 +375,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -386,6 +388,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -601,7 +610,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; @@ -614,11 +623,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -679,7 +689,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -689,10 +699,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -701,6 +712,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -946,7 +964,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -955,11 +973,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -1011,7 +1030,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -1021,10 +1040,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -1033,6 +1053,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -1274,7 +1301,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; @@ -1287,11 +1314,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -1352,7 +1380,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -1362,10 +1390,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -1374,6 +1403,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -1586,7 +1622,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -1595,11 +1631,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -1651,7 +1688,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -1661,10 +1698,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -1673,6 +1711,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -1872,7 +1917,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -1881,11 +1926,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -1937,7 +1983,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -1947,10 +1993,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -1959,6 +2006,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -2172,7 +2226,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; @@ -2185,11 +2239,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -2250,7 +2305,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -2260,10 +2315,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -2272,6 +2328,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; @@ -2408,7 +2471,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -2417,11 +2480,12 @@ export type ComponentApi = | { type: "json"; value: any } | { type: "error-text"; value: string } | { type: "error-json"; value: any } + | { type: "execution-denied"; reason?: string; } | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; @@ -2473,7 +2537,7 @@ export type ComponentApi = content: Array<{ args?: any; experimental_content?: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; @@ -2483,10 +2547,11 @@ export type ComponentApi = | { type: "error-text"; value: string } | { type: "error-json"; value: any } | { type: "execution-denied"; reason?: string; } + | { type: "execution-denied"; reason?: string; } | { type: "content"; value: Array< - | { text: string; type: "text" } + | { text: string; type: "text"; providerOptions?: Record> } | { data: string; mediaType: string; type: "media" } | { data: string; mediaType: string; filename?: string; type: "file-data" } | { url: string; type: "file-url" } @@ -2495,6 +2560,13 @@ export type ComponentApi = | { url: string; type: "image-url" } | { fileId: string | Record; type: "image-file-id" } | { type: "custom" } + | { data: string; mediaType: string; filename?: string; type: "file-data" } + | { url: string; type: "file-url" } + | { fileId: string | Record; type: "file-id" } + | { data: string; mediaType: string; type: "image-data" } + | { url: string; type: "image-url" } + | { fileId: string | Record; type: "image-file-id" } + | { type: "custom" } >; }; providerExecuted?: boolean; From 298753057689eb2d9e6e93406f3f1c7c4fa249c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:31:52 +0000 Subject: [PATCH 09/14] Add summary document for type error fixes Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- TYPE_FIX_SUMMARY.md | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 TYPE_FIX_SUMMARY.md diff --git a/TYPE_FIX_SUMMARY.md b/TYPE_FIX_SUMMARY.md new file mode 100644 index 00000000..f11e3ad2 --- /dev/null +++ b/TYPE_FIX_SUMMARY.md @@ -0,0 +1,63 @@ +# AI SDK v6 Type Error Fix Summary + +## Problem +The build fails with TypeScript errors after upgrading to AI SDK v6. The main issues are: +1. `ToolCallPart` type now requires `input` field (not optional), but stored data may only have deprecated `args` field +2. Tool-result output types missing newer types like `execution-denied` and extended content types +3. Generated component types out of sync with updated validators + +## Changes Made + +### 1. Fixed `tool-call` Part Handling (src/mapping.ts) +- Updated `toModelMessageContent()` to ensure `input` is always present by falling back to `args` or `{}` +- Updated `serializeContent()` and `fromModelMessageContent()` to handle both `input` and legacy `args` fields +- This fixes the core issue where AI SDK v6's `ToolCallPart` expects non-nullable `input` + +### 2. Fixed Tool Approval Response Handling (src/client/search.ts) +- Updated `filterOutOrphanedToolMessages()` to handle tool-approval-response parts that don't have `toolCallId` +- Tool-approval-response only has `approvalId`, not `toolCallId` + +### 3. Updated Generated Component Types (src/component/_generated/component.ts) +Made manual updates to sync with validators (normally done via `convex codegen`): +- Added `input: any` field to all tool-call type definitions +- Made `args` optional (`args?: any`) in tool-call types +- Added `execution-denied` output type to tool-result +- Added extended content types: `file-data`, `file-url`, `file-id`, `image-data`, `image-url`, `image-file-id`, `custom` +- Added `providerOptions` to text types in content values + +## Remaining Issues (5 TypeScript errors) + +The remaining errors are due to a structural mismatch in the generated component types: +- Generated types have BOTH `experimental_content` (deprecated) and `output` (new) fields on tool-result +- Our validators only define `output`, not `experimental_content` +- TypeScript is comparing our new output types against the old experimental_content types +- This cannot be fixed manually - requires proper component regeneration + +### To Complete the Fix: +1. Run `convex codegen --component-dir ./src/component` with a valid Convex deployment +2. This will regenerate `src/component/_generated/component.ts` from the validators +3. The regenerated types will: + - Remove the deprecated `experimental_content` field + - Use only the `output` field with correct types + - Properly match the validator definitions + +### Error Locations: +- `src/client/index.ts:1052` - addMessages call +- `src/client/index.ts:1103` - addMessages call +- `src/client/index.ts:1169` - updateMessage call +- `src/client/messages.ts:141` - addMessages call +- `src/client/start.ts:265` - addMessages call + +All errors have the same root cause: content value types in tool-result output don't match experimental_content expectations. + +## Testing Plan +Once component types are regenerated: +1. Run `npm run build` - should complete without errors +2. Run `npm test` - ensure no regressions +3. Test with actual AI SDK v6 workflow - verify tool-call handling works with both new `input` and legacy `args` fields + +## Notes +- The mapping functions in `src/mapping.ts` correctly handle both old and new formats +- Data with only `args` will be converted to have `input` (with `args` as fallback) +- Data with `input` will work directly +- This provides backward compatibility while supporting AI SDK v6's requirements From 1e7c351d5b870785d08edd34a4149435f8a4deb9 Mon Sep 17 00:00:00 2001 From: Zac <2215540+zboyles@users.noreply.github.com> Date: Sat, 17 Jan 2026 20:51:40 -0500 Subject: [PATCH 10/14] Fix type errors due to experimental_content vs output field mismatch in generated types. Ran `convex codegen --component-dir ./src/component`. --- src/component/_generated/component.ts | 2562 ++++++++++++++++++++----- 1 file changed, 2127 insertions(+), 435 deletions(-) diff --git a/src/component/_generated/component.ts b/src/component/_generated/component.ts index 066eee0e..b64ff3ed 100644 --- a/src/component/_generated/component.ts +++ b/src/component/_generated/component.ts @@ -185,6 +185,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record< string, @@ -268,8 +269,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - input: any; args?: any; + input: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -286,7 +287,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; @@ -295,21 +296,120 @@ export type ComponentApi = >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } >; }; providerExecuted?: boolean; @@ -357,54 +457,167 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } @@ -509,6 +722,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record< string, @@ -592,8 +806,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - input: any; args?: any; + input: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -610,7 +824,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; @@ -619,21 +833,120 @@ export type ComponentApi = >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } >; }; providerExecuted?: boolean; @@ -681,54 +994,167 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } @@ -884,6 +1310,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record>; type: "image"; @@ -892,7 +1319,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -921,7 +1348,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -949,8 +1376,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { + args?: any; input: any; - args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -964,26 +1391,125 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } >; }; providerExecuted?: boolean; @@ -1022,54 +1548,164 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } @@ -1200,6 +1836,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record< string, @@ -1283,8 +1920,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - input: any; args?: any; + input: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -1301,7 +1938,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; @@ -1310,32 +1947,131 @@ export type ComponentApi = >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; result?: any; toolCallId: string; toolName: string; @@ -1372,54 +2108,167 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } @@ -1542,6 +2391,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record>; type: "image"; @@ -1550,7 +2400,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1579,7 +2429,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1607,8 +2457,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { + args?: any; input: any; - args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -1622,26 +2472,125 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } >; }; providerExecuted?: boolean; @@ -1680,54 +2629,164 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } @@ -1837,6 +2896,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record>; type: "image"; @@ -1845,7 +2905,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1874,7 +2934,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -1902,8 +2962,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { + args?: any; input: any; - args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -1917,26 +2977,125 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } >; }; providerExecuted?: boolean; @@ -1975,54 +3134,164 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } @@ -2125,6 +3394,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record< string, @@ -2208,8 +3478,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { - input: any; args?: any; + input: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -2226,7 +3496,7 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; @@ -2235,21 +3505,120 @@ export type ComponentApi = >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } >; }; providerExecuted?: boolean; @@ -2297,54 +3666,167 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } @@ -2391,6 +3873,7 @@ export type ComponentApi = } | { image: string | ArrayBuffer; + mediaType?: string; mimeType?: string; providerOptions?: Record>; type: "image"; @@ -2399,7 +3882,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -2428,7 +3911,7 @@ export type ComponentApi = data: string | ArrayBuffer; filename?: string; mediaType?: string; - mimeType?: string; + mimeType?: string; providerMetadata?: Record< string, Record @@ -2456,8 +3939,8 @@ export type ComponentApi = type: "redacted-reasoning"; } | { + args?: any; input: any; - args?: any; providerExecuted?: boolean; providerMetadata?: Record< string, @@ -2471,26 +3954,125 @@ export type ComponentApi = | { args?: any; experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { text: string; type: "text" } | { data: string; mimeType?: string; type: "image" } >; isError?: boolean; output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } | { type: "content"; value: Array< - | { text: string; type: "text"; providerOptions?: Record> } + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } | { data: string; mediaType: string; type: "media"; } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } >; }; providerExecuted?: boolean; @@ -2529,54 +4111,164 @@ export type ComponentApi = title: string; type: "source"; } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } >; providerOptions?: Record>; role: "assistant"; } | { - content: Array<{ - args?: any; - experimental_content?: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { type: "text"; value: string } - | { type: "json"; value: any } - | { type: "error-text"; value: string } - | { type: "error-json"; value: any } - | { type: "execution-denied"; reason?: string; } - | { type: "execution-denied"; reason?: string; } - | { - type: "content"; - value: Array< - | { text: string; type: "text"; providerOptions?: Record> } - | { data: string; mediaType: string; type: "media" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - | { data: string; mediaType: string; filename?: string; type: "file-data" } - | { url: string; type: "file-url" } - | { fileId: string | Record; type: "file-id" } - | { data: string; mediaType: string; type: "image-data" } - | { url: string; type: "image-url" } - | { fileId: string | Record; type: "image-file-id" } - | { type: "custom" } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - }>; + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; providerOptions?: Record>; role: "tool"; } From 219f520da900998534adf7b8f65db7eff5afc2a6 Mon Sep 17 00:00:00 2001 From: Zac <2215540+zboyles@users.noreply.github.com> Date: Sat, 17 Jan 2026 20:59:26 -0500 Subject: [PATCH 11/14] Refactor test cases to replace 'args' with 'input' in tool-call definitions for consistency --- src/component/messages.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/component/messages.test.ts b/src/component/messages.test.ts index 9581b8f6..0c273307 100644 --- a/src/component/messages.test.ts +++ b/src/component/messages.test.ts @@ -68,7 +68,7 @@ describe("agent", () => { content: [ { type: "tool-call", - args: { a: 1 }, + input: { a: 1 }, toolCallId: "1", toolName: "tool", }, @@ -258,7 +258,7 @@ describe("agent", () => { content: [ { type: "tool-call", - args: { a: 1 }, + input: { a: 1 }, toolCallId: "1", toolName: "tool", }, @@ -389,7 +389,7 @@ describe("agent", () => { content: [ { type: "tool-call", - args: { a: 1 }, + input: { a: 1 }, toolCallId: "1", toolName: "tool", }, @@ -408,7 +408,7 @@ describe("agent", () => { content: [ { type: "tool-call", - args: { a: 2, b: 3 }, + input: { a: 2, b: 3 }, toolCallId: "1", toolName: "tool", }, @@ -422,7 +422,7 @@ describe("agent", () => { content: [ { type: "tool-call", - args: { a: 2, b: 3 }, + input: { a: 2, b: 3 }, toolCallId: "1", toolName: "tool", }, From 0a1bcb581dbc17d0aa916eb46ec08156a3417c05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 02:23:17 +0000 Subject: [PATCH 12/14] Use union type for tool-call to support both input and args formats Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- src/component/_generated/component.ts | 128 + src/component/_generated/component.ts.backup | 4785 ++++++++++++++++++ src/validators.ts | 39 +- 3 files changed, 4941 insertions(+), 11 deletions(-) create mode 100644 src/component/_generated/component.ts.backup diff --git a/src/component/_generated/component.ts b/src/component/_generated/component.ts index b64ff3ed..f6708edc 100644 --- a/src/component/_generated/component.ts +++ b/src/component/_generated/component.ts @@ -284,6 +284,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< @@ -821,6 +837,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< @@ -1388,6 +1420,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< @@ -1935,6 +1983,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< @@ -2469,6 +2533,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< @@ -2974,6 +3054,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< @@ -3493,6 +3589,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< @@ -3951,6 +4063,22 @@ export type ComponentApi = toolName: string; type: "tool-call"; } + | { + args: any; + input?: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } | { args?: any; experimental_content?: Array< diff --git a/src/component/_generated/component.ts.backup b/src/component/_generated/component.ts.backup new file mode 100644 index 00000000..b64ff3ed --- /dev/null +++ b/src/component/_generated/component.ts.backup @@ -0,0 +1,4785 @@ +/* eslint-disable */ +/** + * Generated `ComponentApi` utility. + * + * THIS CODE IS AUTOMATICALLY GENERATED. + * + * To regenerate, run `npx convex dev`. + * @module + */ + +import type { FunctionReference } from "convex/server"; + +/** + * A utility for referencing a Convex component's exposed API. + * + * Useful when expecting a parameter like `components.myComponent`. + * Usage: + * ```ts + * async function myFunction(ctx: QueryCtx, component: ComponentApi) { + * return ctx.runQuery(component.someFile.someQuery, { ...args }); + * } + * ``` + */ +export type ComponentApi = + { + apiKeys: { + destroy: FunctionReference< + "mutation", + "internal", + { apiKey?: string; name?: string }, + | "missing" + | "deleted" + | "name mismatch" + | "must provide either apiKey or name", + Name + >; + issue: FunctionReference< + "mutation", + "internal", + { name?: string }, + string, + Name + >; + validate: FunctionReference< + "query", + "internal", + { apiKey: string }, + boolean, + Name + >; + }; + files: { + addFile: FunctionReference< + "mutation", + "internal", + { + filename?: string; + hash: string; + mediaType?: string; + mimeType?: string; + storageId: string; + }, + { fileId: string; storageId: string }, + Name + >; + copyFile: FunctionReference< + "mutation", + "internal", + { fileId: string }, + null, + Name + >; + deleteFiles: FunctionReference< + "mutation", + "internal", + { fileIds: Array; force?: boolean }, + Array, + Name + >; + get: FunctionReference< + "query", + "internal", + { fileId: string }, + null | { + _creationTime: number; + _id: string; + filename?: string; + hash: string; + lastTouchedAt: number; + mediaType?: string; + mimeType?: string; + refcount: number; + storageId: string; + }, + Name + >; + getFilesToDelete: FunctionReference< + "query", + "internal", + { + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + }, + { + continueCursor: string; + isDone: boolean; + page: Array<{ + _creationTime: number; + _id: string; + filename?: string; + hash: string; + lastTouchedAt: number; + mediaType?: string; + mimeType?: string; + refcount: number; + storageId: string; + }>; + }, + Name + >; + useExistingFile: FunctionReference< + "mutation", + "internal", + { filename?: string; hash: string }, + null | { fileId: string; storageId: string }, + Name + >; + }; + messages: { + addMessages: FunctionReference< + "mutation", + "internal", + { + agentName?: string; + embeddings?: { + dimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + model: string; + vectors: Array | null>; + }; + failPendingSteps?: boolean; + hideFromUserIdSearch?: boolean; + messages: Array<{ + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + message: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + provider?: string; + providerMetadata?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status?: "pending" | "success" | "failed"; + text?: string; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + warnings?: Array< + | { + details?: string; + setting: string; + type: "unsupported-setting"; + } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>; + pendingMessageId?: string; + promptMessageId?: string; + threadId: string; + userId?: string; + }, + { + messages: Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { + details?: string; + setting: string; + type: "unsupported-setting"; + } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>; + }, + Name + >; + cloneThread: FunctionReference< + "action", + "internal", + { + batchSize?: number; + copyUserIdForVectorSearch?: boolean; + excludeToolMessages?: boolean; + insertAtOrder?: number; + limit?: number; + sourceThreadId: string; + statuses?: Array<"pending" | "success" | "failed">; + targetThreadId: string; + upToAndIncludingMessageId?: string; + }, + number, + Name + >; + deleteByIds: FunctionReference< + "mutation", + "internal", + { messageIds: Array }, + Array, + Name + >; + deleteByOrder: FunctionReference< + "mutation", + "internal", + { + endOrder: number; + endStepOrder?: number; + startOrder: number; + startStepOrder?: number; + threadId: string; + }, + { isDone: boolean; lastOrder?: number; lastStepOrder?: number }, + Name + >; + finalizeMessage: FunctionReference< + "mutation", + "internal", + { + messageId: string; + result: { status: "success" } | { error: string; status: "failed" }; + }, + null, + Name + >; + getMessagesByIds: FunctionReference< + "query", + "internal", + { messageIds: Array }, + Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>, + Name + >; + getMessageSearchFields: FunctionReference< + "query", + "internal", + { messageId: string }, + { embedding?: Array; embeddingModel?: string; text?: string }, + Name + >; + listMessagesByThreadId: FunctionReference< + "query", + "internal", + { + excludeToolMessages?: boolean; + order: "asc" | "desc"; + paginationOpts?: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + statuses?: Array<"pending" | "success" | "failed">; + threadId: string; + upToAndIncludingMessageId?: string; + }, + { + continueCursor: string; + isDone: boolean; + page: Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { + details?: string; + setting: string; + type: "unsupported-setting"; + } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>; + pageStatus?: "SplitRecommended" | "SplitRequired" | null; + splitCursor?: string | null; + }, + Name + >; + searchMessages: FunctionReference< + "action", + "internal", + { + embedding?: Array; + embeddingModel?: string; + limit: number; + messageRange?: { after: number; before: number }; + searchAllMessagesForUserId?: string; + targetMessageId?: string; + text?: string; + textSearch?: boolean; + threadId?: string; + vectorScoreThreshold?: number; + vectorSearch?: boolean; + }, + Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>, + Name + >; + textSearch: FunctionReference< + "query", + "internal", + { + limit: number; + searchAllMessagesForUserId?: string; + targetMessageId?: string; + text?: string; + threadId?: string; + }, + Array<{ + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }>, + Name + >; + updateMessage: FunctionReference< + "mutation", + "internal", + { + messageId: string; + patch: { + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record< + string, + Record + >; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { + data: string; + mimeType?: string; + type: "image"; + } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record< + string, + Record + >; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + provider?: string; + providerOptions?: Record>; + status?: "pending" | "success" | "failed"; + }; + }, + { + _creationTime: number; + _id: string; + agentName?: string; + embeddingId?: string; + error?: string; + fileIds?: Array; + finishReason?: + | "stop" + | "length" + | "content-filter" + | "tool-calls" + | "error" + | "other" + | "unknown"; + id?: string; + message?: + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + image: string | ArrayBuffer; + mediaType?: string; + mimeType?: string; + providerOptions?: Record>; + type: "image"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + >; + providerOptions?: Record>; + role: "user"; + } + | { + content: + | string + | Array< + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + text: string; + type: "text"; + } + | { + data: string | ArrayBuffer; + filename?: string; + mediaType?: string; + mimeType?: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "file"; + } + | { + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { + data: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + type: "redacted-reasoning"; + } + | { + args?: any; + input: any; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + toolName: string; + type: "tool-call"; + } + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + id: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + | { + approvalId: string; + providerMetadata?: Record< + string, + Record + >; + providerOptions?: Record>; + toolCallId: string; + type: "tool-approval-request"; + } + >; + providerOptions?: Record>; + role: "assistant"; + } + | { + content: Array< + | { + args?: any; + experimental_content?: Array< + | { text: string; type: "text" } + | { data: string; mimeType?: string; type: "image" } + >; + isError?: boolean; + output?: + | { + providerOptions?: Record< + string, + Record + >; + type: "text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-text"; + value: string; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "error-json"; + value: any; + } + | { + providerOptions?: Record< + string, + Record + >; + reason?: string; + type: "execution-denied"; + } + | { + type: "content"; + value: Array< + | { + providerOptions?: Record< + string, + Record + >; + text: string; + type: "text"; + } + | { + data: string; + mediaType: string; + type: "media"; + } + | { + data: string; + filename?: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "file-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "file-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "file-id"; + } + | { + data: string; + mediaType: string; + providerOptions?: Record< + string, + Record + >; + type: "image-data"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "image-url"; + url: string; + } + | { + fileId: string | Record; + providerOptions?: Record< + string, + Record + >; + type: "image-file-id"; + } + | { + providerOptions?: Record< + string, + Record + >; + type: "custom"; + } + >; + }; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + result?: any; + toolCallId: string; + toolName: string; + type: "tool-result"; + } + | { + approvalId: string; + approved: boolean; + providerExecuted?: boolean; + providerMetadata?: Record>; + providerOptions?: Record>; + reason?: string; + type: "tool-approval-response"; + } + >; + providerOptions?: Record>; + role: "tool"; + } + | { + content: string; + providerOptions?: Record>; + role: "system"; + }; + model?: string; + order: number; + provider?: string; + providerMetadata?: Record>; + providerOptions?: Record>; + reasoning?: string; + reasoningDetails?: Array< + | { + providerMetadata?: Record>; + providerOptions?: Record>; + signature?: string; + text: string; + type: "reasoning"; + } + | { signature?: string; text: string; type: "text" } + | { data: string; type: "redacted" } + >; + sources?: Array< + | { + id: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "url"; + title?: string; + type?: "source"; + url: string; + } + | { + filename?: string; + id: string; + mediaType: string; + providerMetadata?: Record>; + providerOptions?: Record>; + sourceType: "document"; + title: string; + type: "source"; + } + >; + status: "pending" | "success" | "failed"; + stepOrder: number; + text?: string; + threadId: string; + tool: boolean; + usage?: { + cachedInputTokens?: number; + completionTokens: number; + promptTokens: number; + reasoningTokens?: number; + totalTokens: number; + }; + userId?: string; + warnings?: Array< + | { details?: string; setting: string; type: "unsupported-setting" } + | { details?: string; tool: any; type: "unsupported-tool" } + | { message: string; type: "other" } + >; + }, + Name + >; + }; + streams: { + abort: FunctionReference< + "mutation", + "internal", + { + finalDelta?: { + end: number; + parts: Array; + start: number; + streamId: string; + }; + reason: string; + streamId: string; + }, + boolean, + Name + >; + abortByOrder: FunctionReference< + "mutation", + "internal", + { order: number; reason: string; threadId: string }, + boolean, + Name + >; + addDelta: FunctionReference< + "mutation", + "internal", + { end: number; parts: Array; start: number; streamId: string }, + boolean, + Name + >; + create: FunctionReference< + "mutation", + "internal", + { + agentName?: string; + format?: "UIMessageChunk" | "TextStreamPart"; + model?: string; + order: number; + provider?: string; + providerOptions?: Record>; + stepOrder: number; + threadId: string; + userId?: string; + }, + string, + Name + >; + deleteAllStreamsForThreadIdAsync: FunctionReference< + "mutation", + "internal", + { deltaCursor?: string; streamOrder?: number; threadId: string }, + { deltaCursor?: string; isDone: boolean; streamOrder?: number }, + Name + >; + deleteAllStreamsForThreadIdSync: FunctionReference< + "action", + "internal", + { threadId: string }, + null, + Name + >; + deleteStreamAsync: FunctionReference< + "mutation", + "internal", + { cursor?: string; streamId: string }, + null, + Name + >; + deleteStreamSync: FunctionReference< + "mutation", + "internal", + { streamId: string }, + null, + Name + >; + finish: FunctionReference< + "mutation", + "internal", + { + finalDelta?: { + end: number; + parts: Array; + start: number; + streamId: string; + }; + streamId: string; + }, + null, + Name + >; + heartbeat: FunctionReference< + "mutation", + "internal", + { streamId: string }, + null, + Name + >; + list: FunctionReference< + "query", + "internal", + { + startOrder?: number; + statuses?: Array<"streaming" | "finished" | "aborted">; + threadId: string; + }, + Array<{ + agentName?: string; + format?: "UIMessageChunk" | "TextStreamPart"; + model?: string; + order: number; + provider?: string; + providerOptions?: Record>; + status: "streaming" | "finished" | "aborted"; + stepOrder: number; + streamId: string; + userId?: string; + }>, + Name + >; + listDeltas: FunctionReference< + "query", + "internal", + { + cursors: Array<{ cursor: number; streamId: string }>; + threadId: string; + }, + Array<{ + end: number; + parts: Array; + start: number; + streamId: string; + }>, + Name + >; + }; + threads: { + createThread: FunctionReference< + "mutation", + "internal", + { + defaultSystemPrompt?: string; + parentThreadIds?: Array; + summary?: string; + title?: string; + userId?: string; + }, + { + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }, + Name + >; + deleteAllForThreadIdAsync: FunctionReference< + "mutation", + "internal", + { + cursor?: string; + deltaCursor?: string; + limit?: number; + messagesDone?: boolean; + streamOrder?: number; + streamsDone?: boolean; + threadId: string; + }, + { isDone: boolean }, + Name + >; + deleteAllForThreadIdSync: FunctionReference< + "action", + "internal", + { limit?: number; threadId: string }, + null, + Name + >; + getThread: FunctionReference< + "query", + "internal", + { threadId: string }, + { + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + } | null, + Name + >; + listThreadsByUserId: FunctionReference< + "query", + "internal", + { + order?: "asc" | "desc"; + paginationOpts?: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + userId?: string; + }, + { + continueCursor: string; + isDone: boolean; + page: Array<{ + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }>; + pageStatus?: "SplitRecommended" | "SplitRequired" | null; + splitCursor?: string | null; + }, + Name + >; + searchThreadTitles: FunctionReference< + "query", + "internal", + { limit: number; query: string; userId?: string | null }, + Array<{ + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }>, + Name + >; + updateThread: FunctionReference< + "mutation", + "internal", + { + patch: { + status?: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }; + threadId: string; + }, + { + _creationTime: number; + _id: string; + status: "active" | "archived"; + summary?: string; + title?: string; + userId?: string; + }, + Name + >; + }; + users: { + deleteAllForUserId: FunctionReference< + "action", + "internal", + { userId: string }, + null, + Name + >; + deleteAllForUserIdAsync: FunctionReference< + "mutation", + "internal", + { userId: string }, + boolean, + Name + >; + listUsersWithThreads: FunctionReference< + "query", + "internal", + { + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + }, + { + continueCursor: string; + isDone: boolean; + page: Array; + pageStatus?: "SplitRecommended" | "SplitRequired" | null; + splitCursor?: string | null; + }, + Name + >; + }; + vector: { + index: { + deleteBatch: FunctionReference< + "mutation", + "internal", + { + ids: Array< + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string + >; + }, + null, + Name + >; + deleteBatchForThread: FunctionReference< + "mutation", + "internal", + { + cursor?: string; + limit: number; + model: string; + threadId: string; + vectorDimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + }, + { continueCursor: string; isDone: boolean }, + Name + >; + insertBatch: FunctionReference< + "mutation", + "internal", + { + vectorDimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + vectors: Array<{ + messageId?: string; + model: string; + table: string; + threadId?: string; + userId?: string; + vector: Array; + }>; + }, + Array< + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string + >, + Name + >; + paginate: FunctionReference< + "query", + "internal", + { + cursor?: string; + limit: number; + table?: string; + targetModel: string; + vectorDimension: + | 128 + | 256 + | 512 + | 768 + | 1024 + | 1408 + | 1536 + | 2048 + | 3072 + | 4096; + }, + { + continueCursor: string; + ids: Array< + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string + >; + isDone: boolean; + }, + Name + >; + updateBatch: FunctionReference< + "mutation", + "internal", + { + vectors: Array<{ + id: + | string + | string + | string + | string + | string + | string + | string + | string + | string + | string; + model: string; + vector: Array; + }>; + }, + null, + Name + >; + }; + }; + }; diff --git a/src/validators.ts b/src/validators.ts index f7ecea38..f8e03132 100644 --- a/src/validators.ts +++ b/src/validators.ts @@ -115,17 +115,34 @@ export const vSourcePart = v.union( ); export type SourcePart = Infer; -export const vToolCallPart = v.object({ - type: v.literal("tool-call"), - toolCallId: v.string(), - toolName: v.string(), - input: v.any(), - /** @deprecated Use `input` instead. */ - args: v.optional(v.any()), - providerExecuted: v.optional(v.boolean()), - providerOptions, - providerMetadata, -}); +// Union type to support both old (args) and new (input) formats +// Both include input for type hint support +export const vToolCallPart = v.union( + // New format: input is primary, args is optional for backwards compat + v.object({ + type: v.literal("tool-call"), + toolCallId: v.string(), + toolName: v.string(), + input: v.any(), + /** @deprecated Use `input` instead. */ + args: v.optional(v.any()), + providerExecuted: v.optional(v.boolean()), + providerOptions, + providerMetadata, + }), + // Legacy format: args is present, input is optional + v.object({ + type: v.literal("tool-call"), + toolCallId: v.string(), + toolName: v.string(), + /** @deprecated Use `input` instead. */ + args: v.any(), + input: v.optional(v.any()), + providerExecuted: v.optional(v.boolean()), + providerOptions, + providerMetadata, + }), +); const vToolResultContent = v.array( v.union( From ca35f100e8eb87fb6fdfa56158abf0ec73af0146 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 18 Jan 2026 02:24:13 +0000 Subject: [PATCH 13/14] Fix AI SDK v6 type errors: tool-call input/args union type and tool-result output types Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com> --- src/component/_generated/component.ts.backup | 4785 ------------------ 1 file changed, 4785 deletions(-) delete mode 100644 src/component/_generated/component.ts.backup diff --git a/src/component/_generated/component.ts.backup b/src/component/_generated/component.ts.backup deleted file mode 100644 index b64ff3ed..00000000 --- a/src/component/_generated/component.ts.backup +++ /dev/null @@ -1,4785 +0,0 @@ -/* eslint-disable */ -/** - * Generated `ComponentApi` utility. - * - * THIS CODE IS AUTOMATICALLY GENERATED. - * - * To regenerate, run `npx convex dev`. - * @module - */ - -import type { FunctionReference } from "convex/server"; - -/** - * A utility for referencing a Convex component's exposed API. - * - * Useful when expecting a parameter like `components.myComponent`. - * Usage: - * ```ts - * async function myFunction(ctx: QueryCtx, component: ComponentApi) { - * return ctx.runQuery(component.someFile.someQuery, { ...args }); - * } - * ``` - */ -export type ComponentApi = - { - apiKeys: { - destroy: FunctionReference< - "mutation", - "internal", - { apiKey?: string; name?: string }, - | "missing" - | "deleted" - | "name mismatch" - | "must provide either apiKey or name", - Name - >; - issue: FunctionReference< - "mutation", - "internal", - { name?: string }, - string, - Name - >; - validate: FunctionReference< - "query", - "internal", - { apiKey: string }, - boolean, - Name - >; - }; - files: { - addFile: FunctionReference< - "mutation", - "internal", - { - filename?: string; - hash: string; - mediaType?: string; - mimeType?: string; - storageId: string; - }, - { fileId: string; storageId: string }, - Name - >; - copyFile: FunctionReference< - "mutation", - "internal", - { fileId: string }, - null, - Name - >; - deleteFiles: FunctionReference< - "mutation", - "internal", - { fileIds: Array; force?: boolean }, - Array, - Name - >; - get: FunctionReference< - "query", - "internal", - { fileId: string }, - null | { - _creationTime: number; - _id: string; - filename?: string; - hash: string; - lastTouchedAt: number; - mediaType?: string; - mimeType?: string; - refcount: number; - storageId: string; - }, - Name - >; - getFilesToDelete: FunctionReference< - "query", - "internal", - { - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - }, - { - continueCursor: string; - isDone: boolean; - page: Array<{ - _creationTime: number; - _id: string; - filename?: string; - hash: string; - lastTouchedAt: number; - mediaType?: string; - mimeType?: string; - refcount: number; - storageId: string; - }>; - }, - Name - >; - useExistingFile: FunctionReference< - "mutation", - "internal", - { filename?: string; hash: string }, - null | { fileId: string; storageId: string }, - Name - >; - }; - messages: { - addMessages: FunctionReference< - "mutation", - "internal", - { - agentName?: string; - embeddings?: { - dimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - model: string; - vectors: Array | null>; - }; - failPendingSteps?: boolean; - hideFromUserIdSearch?: boolean; - messages: Array<{ - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - message: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - provider?: string; - providerMetadata?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status?: "pending" | "success" | "failed"; - text?: string; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - warnings?: Array< - | { - details?: string; - setting: string; - type: "unsupported-setting"; - } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>; - pendingMessageId?: string; - promptMessageId?: string; - threadId: string; - userId?: string; - }, - { - messages: Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { - details?: string; - setting: string; - type: "unsupported-setting"; - } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>; - }, - Name - >; - cloneThread: FunctionReference< - "action", - "internal", - { - batchSize?: number; - copyUserIdForVectorSearch?: boolean; - excludeToolMessages?: boolean; - insertAtOrder?: number; - limit?: number; - sourceThreadId: string; - statuses?: Array<"pending" | "success" | "failed">; - targetThreadId: string; - upToAndIncludingMessageId?: string; - }, - number, - Name - >; - deleteByIds: FunctionReference< - "mutation", - "internal", - { messageIds: Array }, - Array, - Name - >; - deleteByOrder: FunctionReference< - "mutation", - "internal", - { - endOrder: number; - endStepOrder?: number; - startOrder: number; - startStepOrder?: number; - threadId: string; - }, - { isDone: boolean; lastOrder?: number; lastStepOrder?: number }, - Name - >; - finalizeMessage: FunctionReference< - "mutation", - "internal", - { - messageId: string; - result: { status: "success" } | { error: string; status: "failed" }; - }, - null, - Name - >; - getMessagesByIds: FunctionReference< - "query", - "internal", - { messageIds: Array }, - Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>, - Name - >; - getMessageSearchFields: FunctionReference< - "query", - "internal", - { messageId: string }, - { embedding?: Array; embeddingModel?: string; text?: string }, - Name - >; - listMessagesByThreadId: FunctionReference< - "query", - "internal", - { - excludeToolMessages?: boolean; - order: "asc" | "desc"; - paginationOpts?: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - statuses?: Array<"pending" | "success" | "failed">; - threadId: string; - upToAndIncludingMessageId?: string; - }, - { - continueCursor: string; - isDone: boolean; - page: Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { - details?: string; - setting: string; - type: "unsupported-setting"; - } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>; - pageStatus?: "SplitRecommended" | "SplitRequired" | null; - splitCursor?: string | null; - }, - Name - >; - searchMessages: FunctionReference< - "action", - "internal", - { - embedding?: Array; - embeddingModel?: string; - limit: number; - messageRange?: { after: number; before: number }; - searchAllMessagesForUserId?: string; - targetMessageId?: string; - text?: string; - textSearch?: boolean; - threadId?: string; - vectorScoreThreshold?: number; - vectorSearch?: boolean; - }, - Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>, - Name - >; - textSearch: FunctionReference< - "query", - "internal", - { - limit: number; - searchAllMessagesForUserId?: string; - targetMessageId?: string; - text?: string; - threadId?: string; - }, - Array<{ - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }>, - Name - >; - updateMessage: FunctionReference< - "mutation", - "internal", - { - messageId: string; - patch: { - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record< - string, - Record - >; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { - data: string; - mimeType?: string; - type: "image"; - } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record< - string, - Record - >; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - provider?: string; - providerOptions?: Record>; - status?: "pending" | "success" | "failed"; - }; - }, - { - _creationTime: number; - _id: string; - agentName?: string; - embeddingId?: string; - error?: string; - fileIds?: Array; - finishReason?: - | "stop" - | "length" - | "content-filter" - | "tool-calls" - | "error" - | "other" - | "unknown"; - id?: string; - message?: - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - image: string | ArrayBuffer; - mediaType?: string; - mimeType?: string; - providerOptions?: Record>; - type: "image"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - >; - providerOptions?: Record>; - role: "user"; - } - | { - content: - | string - | Array< - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - text: string; - type: "text"; - } - | { - data: string | ArrayBuffer; - filename?: string; - mediaType?: string; - mimeType?: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "file"; - } - | { - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { - data: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - type: "redacted-reasoning"; - } - | { - args?: any; - input: any; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - toolName: string; - type: "tool-call"; - } - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - id: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - | { - approvalId: string; - providerMetadata?: Record< - string, - Record - >; - providerOptions?: Record>; - toolCallId: string; - type: "tool-approval-request"; - } - >; - providerOptions?: Record>; - role: "assistant"; - } - | { - content: Array< - | { - args?: any; - experimental_content?: Array< - | { text: string; type: "text" } - | { data: string; mimeType?: string; type: "image" } - >; - isError?: boolean; - output?: - | { - providerOptions?: Record< - string, - Record - >; - type: "text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-text"; - value: string; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "error-json"; - value: any; - } - | { - providerOptions?: Record< - string, - Record - >; - reason?: string; - type: "execution-denied"; - } - | { - type: "content"; - value: Array< - | { - providerOptions?: Record< - string, - Record - >; - text: string; - type: "text"; - } - | { - data: string; - mediaType: string; - type: "media"; - } - | { - data: string; - filename?: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "file-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "file-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "file-id"; - } - | { - data: string; - mediaType: string; - providerOptions?: Record< - string, - Record - >; - type: "image-data"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "image-url"; - url: string; - } - | { - fileId: string | Record; - providerOptions?: Record< - string, - Record - >; - type: "image-file-id"; - } - | { - providerOptions?: Record< - string, - Record - >; - type: "custom"; - } - >; - }; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - result?: any; - toolCallId: string; - toolName: string; - type: "tool-result"; - } - | { - approvalId: string; - approved: boolean; - providerExecuted?: boolean; - providerMetadata?: Record>; - providerOptions?: Record>; - reason?: string; - type: "tool-approval-response"; - } - >; - providerOptions?: Record>; - role: "tool"; - } - | { - content: string; - providerOptions?: Record>; - role: "system"; - }; - model?: string; - order: number; - provider?: string; - providerMetadata?: Record>; - providerOptions?: Record>; - reasoning?: string; - reasoningDetails?: Array< - | { - providerMetadata?: Record>; - providerOptions?: Record>; - signature?: string; - text: string; - type: "reasoning"; - } - | { signature?: string; text: string; type: "text" } - | { data: string; type: "redacted" } - >; - sources?: Array< - | { - id: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "url"; - title?: string; - type?: "source"; - url: string; - } - | { - filename?: string; - id: string; - mediaType: string; - providerMetadata?: Record>; - providerOptions?: Record>; - sourceType: "document"; - title: string; - type: "source"; - } - >; - status: "pending" | "success" | "failed"; - stepOrder: number; - text?: string; - threadId: string; - tool: boolean; - usage?: { - cachedInputTokens?: number; - completionTokens: number; - promptTokens: number; - reasoningTokens?: number; - totalTokens: number; - }; - userId?: string; - warnings?: Array< - | { details?: string; setting: string; type: "unsupported-setting" } - | { details?: string; tool: any; type: "unsupported-tool" } - | { message: string; type: "other" } - >; - }, - Name - >; - }; - streams: { - abort: FunctionReference< - "mutation", - "internal", - { - finalDelta?: { - end: number; - parts: Array; - start: number; - streamId: string; - }; - reason: string; - streamId: string; - }, - boolean, - Name - >; - abortByOrder: FunctionReference< - "mutation", - "internal", - { order: number; reason: string; threadId: string }, - boolean, - Name - >; - addDelta: FunctionReference< - "mutation", - "internal", - { end: number; parts: Array; start: number; streamId: string }, - boolean, - Name - >; - create: FunctionReference< - "mutation", - "internal", - { - agentName?: string; - format?: "UIMessageChunk" | "TextStreamPart"; - model?: string; - order: number; - provider?: string; - providerOptions?: Record>; - stepOrder: number; - threadId: string; - userId?: string; - }, - string, - Name - >; - deleteAllStreamsForThreadIdAsync: FunctionReference< - "mutation", - "internal", - { deltaCursor?: string; streamOrder?: number; threadId: string }, - { deltaCursor?: string; isDone: boolean; streamOrder?: number }, - Name - >; - deleteAllStreamsForThreadIdSync: FunctionReference< - "action", - "internal", - { threadId: string }, - null, - Name - >; - deleteStreamAsync: FunctionReference< - "mutation", - "internal", - { cursor?: string; streamId: string }, - null, - Name - >; - deleteStreamSync: FunctionReference< - "mutation", - "internal", - { streamId: string }, - null, - Name - >; - finish: FunctionReference< - "mutation", - "internal", - { - finalDelta?: { - end: number; - parts: Array; - start: number; - streamId: string; - }; - streamId: string; - }, - null, - Name - >; - heartbeat: FunctionReference< - "mutation", - "internal", - { streamId: string }, - null, - Name - >; - list: FunctionReference< - "query", - "internal", - { - startOrder?: number; - statuses?: Array<"streaming" | "finished" | "aborted">; - threadId: string; - }, - Array<{ - agentName?: string; - format?: "UIMessageChunk" | "TextStreamPart"; - model?: string; - order: number; - provider?: string; - providerOptions?: Record>; - status: "streaming" | "finished" | "aborted"; - stepOrder: number; - streamId: string; - userId?: string; - }>, - Name - >; - listDeltas: FunctionReference< - "query", - "internal", - { - cursors: Array<{ cursor: number; streamId: string }>; - threadId: string; - }, - Array<{ - end: number; - parts: Array; - start: number; - streamId: string; - }>, - Name - >; - }; - threads: { - createThread: FunctionReference< - "mutation", - "internal", - { - defaultSystemPrompt?: string; - parentThreadIds?: Array; - summary?: string; - title?: string; - userId?: string; - }, - { - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }, - Name - >; - deleteAllForThreadIdAsync: FunctionReference< - "mutation", - "internal", - { - cursor?: string; - deltaCursor?: string; - limit?: number; - messagesDone?: boolean; - streamOrder?: number; - streamsDone?: boolean; - threadId: string; - }, - { isDone: boolean }, - Name - >; - deleteAllForThreadIdSync: FunctionReference< - "action", - "internal", - { limit?: number; threadId: string }, - null, - Name - >; - getThread: FunctionReference< - "query", - "internal", - { threadId: string }, - { - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - } | null, - Name - >; - listThreadsByUserId: FunctionReference< - "query", - "internal", - { - order?: "asc" | "desc"; - paginationOpts?: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - userId?: string; - }, - { - continueCursor: string; - isDone: boolean; - page: Array<{ - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }>; - pageStatus?: "SplitRecommended" | "SplitRequired" | null; - splitCursor?: string | null; - }, - Name - >; - searchThreadTitles: FunctionReference< - "query", - "internal", - { limit: number; query: string; userId?: string | null }, - Array<{ - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }>, - Name - >; - updateThread: FunctionReference< - "mutation", - "internal", - { - patch: { - status?: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }; - threadId: string; - }, - { - _creationTime: number; - _id: string; - status: "active" | "archived"; - summary?: string; - title?: string; - userId?: string; - }, - Name - >; - }; - users: { - deleteAllForUserId: FunctionReference< - "action", - "internal", - { userId: string }, - null, - Name - >; - deleteAllForUserIdAsync: FunctionReference< - "mutation", - "internal", - { userId: string }, - boolean, - Name - >; - listUsersWithThreads: FunctionReference< - "query", - "internal", - { - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - }, - { - continueCursor: string; - isDone: boolean; - page: Array; - pageStatus?: "SplitRecommended" | "SplitRequired" | null; - splitCursor?: string | null; - }, - Name - >; - }; - vector: { - index: { - deleteBatch: FunctionReference< - "mutation", - "internal", - { - ids: Array< - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string - >; - }, - null, - Name - >; - deleteBatchForThread: FunctionReference< - "mutation", - "internal", - { - cursor?: string; - limit: number; - model: string; - threadId: string; - vectorDimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - }, - { continueCursor: string; isDone: boolean }, - Name - >; - insertBatch: FunctionReference< - "mutation", - "internal", - { - vectorDimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - vectors: Array<{ - messageId?: string; - model: string; - table: string; - threadId?: string; - userId?: string; - vector: Array; - }>; - }, - Array< - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string - >, - Name - >; - paginate: FunctionReference< - "query", - "internal", - { - cursor?: string; - limit: number; - table?: string; - targetModel: string; - vectorDimension: - | 128 - | 256 - | 512 - | 768 - | 1024 - | 1408 - | 1536 - | 2048 - | 3072 - | 4096; - }, - { - continueCursor: string; - ids: Array< - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string - >; - isDone: boolean; - }, - Name - >; - updateBatch: FunctionReference< - "mutation", - "internal", - { - vectors: Array<{ - id: - | string - | string - | string - | string - | string - | string - | string - | string - | string - | string; - model: string; - vector: Array; - }>; - }, - null, - Name - >; - }; - }; - }; From 34df29bef44491c6948a8e05f966f7ed8adb58e3 Mon Sep 17 00:00:00 2001 From: Zac <2215540+zboyles@users.noreply.github.com> Date: Sat, 17 Jan 2026 21:31:00 -0500 Subject: [PATCH 14/14] Added `input` values to the test types, kept `args` --- src/client/index.test.ts | 1 + src/client/search.test.ts | 2 ++ src/fromUIMessages.test.ts | 9 +++++++-- src/toUIMessages.test.ts | 13 +++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/client/index.test.ts b/src/client/index.test.ts index f6e97269..9a2c4e18 100644 --- a/src/client/index.test.ts +++ b/src/client/index.test.ts @@ -193,6 +193,7 @@ describe("filterOutOrphanedToolMessages", () => { type: "tool-call", toolCallId: "1", toolName: "tool1", + input: { test: "test" }, args: { test: "test" }, }, ], diff --git a/src/client/search.test.ts b/src/client/search.test.ts index c2749c92..3a9b9b86 100644 --- a/src/client/search.test.ts +++ b/src/client/search.test.ts @@ -159,6 +159,7 @@ describe("search.ts", () => { type: "tool-call", toolCallId: "call_123", toolName: "test", + input: {}, args: {}, }, ], @@ -202,6 +203,7 @@ describe("search.ts", () => { type: "tool-call", toolCallId: "call_orphaned", toolName: "test", + input: {}, args: {}, }, ], diff --git a/src/fromUIMessages.test.ts b/src/fromUIMessages.test.ts index cbe0cb24..4413c3c1 100644 --- a/src/fromUIMessages.test.ts +++ b/src/fromUIMessages.test.ts @@ -166,6 +166,7 @@ describe("fromUIMessages round-trip tests", () => { type: "tool-call", toolName: "calculator", toolCallId: "call1", + input: { operation: "add", a: 2, b: 3 }, args: { operation: "add", a: 2, b: 3 }, }, ], @@ -442,7 +443,9 @@ describe("fromUIMessages functionality tests", () => { ], }; - const result = await fromUIMessages([toolUIMessage], { threadId: "thread1" }); + const result = await fromUIMessages([toolUIMessage], { + threadId: "thread1", + }); expect(result.length).toBeGreaterThan(0); // Should have tool messages @@ -471,7 +474,9 @@ describe("fromUIMessages functionality tests", () => { ], }; - const result = await fromUIMessages([toolUIMessage], { threadId: "thread1" }); + const result = await fromUIMessages([toolUIMessage], { + threadId: "thread1", + }); expect(result.length).toBeGreaterThan(0); // Should have tool messages diff --git a/src/toUIMessages.test.ts b/src/toUIMessages.test.ts index f871f8d3..63edb787 100644 --- a/src/toUIMessages.test.ts +++ b/src/toUIMessages.test.ts @@ -90,6 +90,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "myTool", toolCallId: "call1", + input: "an arg", args: "an arg", }, ], @@ -219,6 +220,7 @@ describe("toUIMessages", () => { }, { type: "tool-call", + input: "What's the meaning of life?", args: "What's the meaning of life?", toolCallId: "call1", toolName: "myTool", @@ -310,6 +312,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "myTool", toolCallId: "call1", + input: { query: "test" }, args: { query: "test" }, }, ], @@ -356,6 +359,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "myTool", toolCallId: "call1", + input: "hi", args: "hi", }, ], @@ -387,6 +391,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "myTool", toolCallId: "call1", + input: "", args: "", }, ], @@ -448,6 +453,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "calculator", toolCallId: "call1", + input: { operation: "add", a: 2, b: 3 }, args: { operation: "add", a: 2, b: 3 }, }, { @@ -490,6 +496,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "calculator", toolCallId: "call1", + input: { operation: "add", a: 1, b: 2 }, args: { operation: "add", a: 1, b: 2 }, }, ], @@ -561,6 +568,9 @@ describe("toUIMessages", () => { text: "**Finding the Time**\n\nI've pinpointed the core task: obtaining the current time in Paris. It involves using the `dateTime` tool. I've identified \"Europe/Paris\" as the necessary timezone identifier to provide to the tool. My next step is to test the tool.\n\n\n", }, { + input: { + timezone: "Europe/Paris", + }, args: { timezone: "Europe/Paris", }, @@ -690,6 +700,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "calculator", toolCallId: "call1", + input: { operation: "add", a: 40, b: 2 }, args: { operation: "add", a: 40, b: 2 }, }, ], @@ -744,6 +755,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "generateImage", toolCallId: "call1", + input: { id: "invalid-id" }, args: { id: "invalid-id" }, }, ], @@ -898,6 +910,7 @@ describe("toUIMessages", () => { type: "tool-call", toolName: "myTool", toolCallId: "call1", + input: {}, args: {}, }, ],