@convex-dev/agent
Version:
A agent component for Convex.
1,353 lines • 54.3 kB
TypeScript
import type { Doc, Id } from "./_generated/dataModel.js";
import { type MutationCtx, type QueryCtx } from "./_generated/server.js";
/** @deprecated Use *.threads.listMessagesByThreadId instead. */
export declare const listThreadsByUserId: import("convex/server").RegisteredQuery<"public", {
userId?: string | undefined;
order?: "asc" | "desc" | undefined;
paginationOpts?: {
id?: number | undefined;
endCursor?: string | null | undefined;
maximumRowsRead?: number | undefined;
maximumBytesRead?: number | undefined;
numItems: number;
cursor: string | null;
} | undefined;
}, Promise<{
page: {
userId?: string | undefined;
title?: string | undefined;
summary?: string | undefined;
_id: string;
_creationTime: number;
status: "active" | "archived";
}[];
isDone: boolean;
continueCursor: import("convex/server").Cursor;
splitCursor?: import("convex/server").Cursor | null;
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
}>>;
/** @deprecated Use *.threads.getThread */
export declare const getThread: import("convex/server").RegisteredQuery<"public", {
threadId: import("convex/values").GenericId<"threads">;
}, Promise<{
userId?: string | undefined;
title?: string | undefined;
summary?: string | undefined;
_id: string;
_creationTime: number;
status: "active" | "archived";
} | null>>;
/** @deprecated Use *.threads.updateThread instead */
export declare const updateThread: import("convex/server").RegisteredMutation<"public", {
threadId: import("convex/values").GenericId<"threads">;
patch: {
status?: "active" | "archived" | undefined;
title?: string | undefined;
summary?: string | undefined;
};
}, Promise<{
userId?: string | undefined;
title?: string | undefined;
summary?: string | undefined;
_id: string;
_creationTime: number;
status: "active" | "archived";
}>>;
export declare function deleteMessage(ctx: MutationCtx, messageDoc: Doc<"messages">): Promise<void>;
export declare const messageStatuses: ("pending" | "success" | "failed")[];
export declare const addMessages: import("convex/server").RegisteredMutation<"public", {
userId?: string | undefined;
pending?: boolean | undefined;
agentName?: string | undefined;
promptMessageId?: import("convex/values").GenericId<"messages"> | undefined;
failPendingSteps?: boolean | undefined;
embeddings?: {
model: string;
dimension: 128 | 256 | 512 | 768 | 1024 | 1408 | 1536 | 2048 | 3072 | 4096;
vectors: (number[] | null)[];
} | undefined;
threadId: import("convex/values").GenericId<"threads">;
messages: {
id?: string | undefined;
fileIds?: import("convex/values").GenericId<"files">[] | undefined;
error?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
message: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
};
}[];
}, Promise<{
messages: {
id?: string | undefined;
userId?: string | undefined;
embeddingId?: string | undefined;
fileIds?: string[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
_id: string;
_creationTime: number;
status: "pending" | "success" | "failed";
order: number;
threadId: string;
stepOrder: number;
tool: boolean;
}[];
}>>;
export declare function getMaxMessage(ctx: QueryCtx, threadId: Id<"threads">, order?: number): Promise<{
_id: import("convex/values").GenericId<"messages">;
_creationTime: number;
id?: string | undefined;
userId?: string | undefined;
embeddingId?: import("convex/values").GenericId<"embeddings_128" | "embeddings_256" | "embeddings_512" | "embeddings_768" | "embeddings_1024" | "embeddings_1408" | "embeddings_1536" | "embeddings_2048" | "embeddings_3072" | "embeddings_4096"> | undefined;
fileIds?: import("convex/values").GenericId<"files">[] | undefined;
files?: any[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
parentMessageId?: import("convex/values").GenericId<"messages"> | undefined;
stepId?: string | undefined;
status: "pending" | "success" | "failed";
order: number;
threadId: import("convex/values").GenericId<"threads">;
stepOrder: number;
tool: boolean;
} | null>;
export declare const rollbackMessage: import("convex/server").RegisteredMutation<"public", {
error?: string | undefined;
messageId: import("convex/values").GenericId<"messages">;
}, Promise<void>>;
export declare const commitMessage: import("convex/server").RegisteredMutation<"public", {
messageId: Id<"messages">;
}, Promise<void>>;
export declare const updateMessage: import("convex/server").RegisteredMutation<"public", {
patch: {
status?: "pending" | "success" | "failed" | undefined;
error?: string | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
};
messageId: import("convex/values").GenericId<"messages">;
}, Promise<{
id?: string | undefined;
userId?: string | undefined;
embeddingId?: string | undefined;
fileIds?: string[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
_id: string;
_creationTime: number;
status: "pending" | "success" | "failed";
order: number;
threadId: string;
stepOrder: number;
tool: boolean;
}>>;
export declare const listMessagesByThreadId: import("convex/server").RegisteredQuery<"public", {
excludeToolMessages?: boolean | undefined;
paginationOpts?: {
id?: number | undefined;
endCursor?: string | null | undefined;
maximumRowsRead?: number | undefined;
maximumBytesRead?: number | undefined;
numItems: number;
cursor: string | null;
} | undefined;
isTool?: "use excludeToolMessages instead of this" | undefined;
statuses?: ("pending" | "success" | "failed")[] | undefined;
upToAndIncludingMessageId?: import("convex/values").GenericId<"messages"> | undefined;
order: "asc" | "desc";
threadId: import("convex/values").GenericId<"threads">;
}, Promise<{
page: {
id?: string | undefined;
userId?: string | undefined;
embeddingId?: string | undefined;
fileIds?: string[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
_id: string;
_creationTime: number;
status: "pending" | "success" | "failed";
order: number;
threadId: string;
stepOrder: number;
tool: boolean;
}[];
isDone: boolean;
continueCursor: import("convex/server").Cursor;
splitCursor?: import("convex/server").Cursor | null;
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
}>>;
export declare const getMessagesByIds: import("convex/server").RegisteredQuery<"public", {
messageIds: import("convex/values").GenericId<"messages">[];
}, Promise<({
_id: import("convex/values").GenericId<"messages">;
_creationTime: number;
id?: string | undefined;
userId?: string | undefined;
embeddingId?: import("convex/values").GenericId<"embeddings_128" | "embeddings_256" | "embeddings_512" | "embeddings_768" | "embeddings_1024" | "embeddings_1408" | "embeddings_1536" | "embeddings_2048" | "embeddings_3072" | "embeddings_4096"> | undefined;
fileIds?: import("convex/values").GenericId<"files">[] | undefined;
files?: any[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
parentMessageId?: import("convex/values").GenericId<"messages"> | undefined;
stepId?: string | undefined;
status: "pending" | "success" | "failed";
order: number;
threadId: import("convex/values").GenericId<"threads">;
stepOrder: number;
tool: boolean;
} | null)[]>>;
/** @deprecated Use listMessagesByThreadId instead. */
export declare const getThreadMessages: import("convex/server").RegisteredQuery<"public", {
deprecated: "Use listMessagesByThreadId instead";
}, Promise<never>>;
export declare const searchMessages: import("convex/server").RegisteredAction<"public", {
threadId?: import("convex/values").GenericId<"threads"> | undefined;
text?: string | undefined;
vector?: number[] | undefined;
vectorModel?: string | undefined;
vectorScoreThreshold?: number | undefined;
messageRange?: {
before: number;
after: number;
} | undefined;
beforeMessageId?: import("convex/values").GenericId<"messages"> | undefined;
searchAllMessagesForUserId?: string | undefined;
limit: number;
}, Promise<{
id?: string | undefined;
userId?: string | undefined;
embeddingId?: string | undefined;
fileIds?: string[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
_id: string;
_creationTime: number;
status: "pending" | "success" | "failed";
order: number;
threadId: string;
stepOrder: number;
tool: boolean;
}[]>>;
export declare const _fetchSearchMessages: import("convex/server").RegisteredQuery<"internal", {
threadId?: import("convex/values").GenericId<"threads"> | undefined;
beforeMessageId?: import("convex/values").GenericId<"messages"> | undefined;
searchAllMessagesForUserId?: string | undefined;
textSearchMessages?: {
id?: string | undefined;
userId?: string | undefined;
embeddingId?: string | undefined;
fileIds?: string[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
_id: string;
_creationTime: number;
status: "pending" | "success" | "failed";
order: number;
threadId: string;
stepOrder: number;
tool: boolean;
}[] | undefined;
limit: number;
messageRange: {
before: number;
after: number;
};
vectorIds: import("convex/values").GenericId<"embeddings_128" | "embeddings_256" | "embeddings_512" | "embeddings_768" | "embeddings_1024" | "embeddings_1408" | "embeddings_1536" | "embeddings_2048" | "embeddings_3072" | "embeddings_4096">[];
}, Promise<{
id?: string | undefined;
userId?: string | undefined;
embeddingId?: string | undefined;
fileIds?: string[] | undefined;
error?: string | undefined;
agentName?: string | undefined;
model?: string | undefined;
provider?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
message?: {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "user";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
mimeType?: string | undefined;
type: "image";
image: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "assistant";
content: string | ({
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "text";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
filename?: string | undefined;
type: "file";
mimeType: string;
data: string | ArrayBuffer;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
signature?: string | undefined;
type: "reasoning";
text: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "redacted-reasoning";
data: string;
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
type: "tool-call";
toolCallId: string;
toolName: string;
args: any;
})[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "tool";
content: {
providerOptions?: Record<string, Record<string, any>> | undefined;
args?: any;
experimental_content?: ({
type: "text";
text: string;
} | {
mimeType?: string | undefined;
type: "image";
data: string;
})[] | undefined;
isError?: boolean | undefined;
type: "tool-result";
toolCallId: string;
toolName: string;
result: any;
}[];
} | {
providerOptions?: Record<string, Record<string, any>> | undefined;
role: "system";
content: string;
} | undefined;
text?: string | undefined;
reasoning?: string | undefined;
usage?: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
} | undefined;
providerMetadata?: Record<string, Record<string, any>> | undefined;
sources?: {
title?: string | undefined;
providerOptions?: Record<string, Record<string, any>> | undefined;
id: string;
sourceType: "url";
url: string;
}[] | undefined;
reasoningDetails?: ({
signature?: string | undefined;
type: "text";
text: string;
} | {
type: "redacted";
data: string;
})[] | undefined;
warnings?: ({
details?: string | undefined;
type: "unsupported-setting";
setting: string;
} | {
details?: string | undefined;
type: "unsupported-tool";
tool: any;
} | {
type: "other";
message: string;
})[] | undefined;
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
_id: string;
_creationTime: number;
status: "pending" | "success" | "failed";
order: number;
threadId: string;
stepOrder: number;
tool: boolean;
}[]>>;
export declare const textSearch: import("convex/server").RegisteredQuery<"public", {
threadId?: import("convex/values").GenericId<"threads"> | undefined;
beforeMessageId?: import("convex/values").GenericId<"messages"> | undefined;
searchAllMessagesForUserId?: string | undefined;
text: string;
limit: number;
}, Promise<{
i