@convex-dev/agent 0.1.5-alpha.0 → 0.1.5-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -3
- package/dist/commonjs/client/index.d.ts +31 -0
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +62 -1
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/component/messages.d.ts +134 -0
- package/dist/commonjs/component/messages.d.ts.map +1 -1
- package/dist/commonjs/component/messages.js +9 -0
- package/dist/commonjs/component/messages.js.map +1 -1
- package/dist/commonjs/component/vector/index.d.ts +4 -1
- package/dist/commonjs/component/vector/index.d.ts.map +1 -1
- package/dist/commonjs/component/vector/index.js +12 -3
- package/dist/commonjs/component/vector/index.js.map +1 -1
- package/dist/commonjs.tsbuildinfo +1 -1
- package/dist/esm/client/index.d.ts +31 -0
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +62 -1
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/component/messages.d.ts +134 -0
- package/dist/esm/component/messages.d.ts.map +1 -1
- package/dist/esm/component/messages.js +9 -0
- package/dist/esm/component/messages.js.map +1 -1
- package/dist/esm/component/vector/index.d.ts +4 -1
- package/dist/esm/component/vector/index.d.ts.map +1 -1
- package/dist/esm/component/vector/index.js +12 -3
- package/dist/esm/component/vector/index.js.map +1 -1
- package/dist/esm.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +113 -1
- package/src/component/_generated/api.d.ts +158 -1
- package/src/component/messages.ts +10 -0
- package/src/component/vector/index.ts +15 -4
|
@@ -1045,6 +1045,151 @@ export type Mounts = {
|
|
|
1045
1045
|
{ messageId: string },
|
|
1046
1046
|
null
|
|
1047
1047
|
>;
|
|
1048
|
+
getMessagesByIds: FunctionReference<
|
|
1049
|
+
"query",
|
|
1050
|
+
"public",
|
|
1051
|
+
{ messageIds: Array<string> },
|
|
1052
|
+
Array<null | {
|
|
1053
|
+
_creationTime: number;
|
|
1054
|
+
_id: string;
|
|
1055
|
+
agentName?: string;
|
|
1056
|
+
embeddingId?: string;
|
|
1057
|
+
error?: string;
|
|
1058
|
+
files?: Array<{
|
|
1059
|
+
data?: ArrayBuffer | string;
|
|
1060
|
+
fileId?: string;
|
|
1061
|
+
mimeType: string;
|
|
1062
|
+
url?: string;
|
|
1063
|
+
}>;
|
|
1064
|
+
finishReason?:
|
|
1065
|
+
| "stop"
|
|
1066
|
+
| "length"
|
|
1067
|
+
| "content-filter"
|
|
1068
|
+
| "tool-calls"
|
|
1069
|
+
| "error"
|
|
1070
|
+
| "other"
|
|
1071
|
+
| "unknown";
|
|
1072
|
+
id?: string;
|
|
1073
|
+
message?:
|
|
1074
|
+
| {
|
|
1075
|
+
content:
|
|
1076
|
+
| string
|
|
1077
|
+
| Array<
|
|
1078
|
+
| {
|
|
1079
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1080
|
+
text: string;
|
|
1081
|
+
type: "text";
|
|
1082
|
+
}
|
|
1083
|
+
| {
|
|
1084
|
+
image: string | ArrayBuffer;
|
|
1085
|
+
mimeType?: string;
|
|
1086
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1087
|
+
type: "image";
|
|
1088
|
+
}
|
|
1089
|
+
| {
|
|
1090
|
+
data: string | ArrayBuffer;
|
|
1091
|
+
mimeType: string;
|
|
1092
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1093
|
+
type: "file";
|
|
1094
|
+
}
|
|
1095
|
+
>;
|
|
1096
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1097
|
+
role: "user";
|
|
1098
|
+
}
|
|
1099
|
+
| {
|
|
1100
|
+
content:
|
|
1101
|
+
| string
|
|
1102
|
+
| Array<
|
|
1103
|
+
| {
|
|
1104
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1105
|
+
text: string;
|
|
1106
|
+
type: "text";
|
|
1107
|
+
}
|
|
1108
|
+
| {
|
|
1109
|
+
data: string | ArrayBuffer;
|
|
1110
|
+
mimeType: string;
|
|
1111
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1112
|
+
type: "file";
|
|
1113
|
+
}
|
|
1114
|
+
| {
|
|
1115
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1116
|
+
signature?: string;
|
|
1117
|
+
text: string;
|
|
1118
|
+
type: "reasoning";
|
|
1119
|
+
}
|
|
1120
|
+
| {
|
|
1121
|
+
data: string;
|
|
1122
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1123
|
+
type: "redacted-reasoning";
|
|
1124
|
+
}
|
|
1125
|
+
| {
|
|
1126
|
+
args: any;
|
|
1127
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1128
|
+
toolCallId: string;
|
|
1129
|
+
toolName: string;
|
|
1130
|
+
type: "tool-call";
|
|
1131
|
+
}
|
|
1132
|
+
>;
|
|
1133
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1134
|
+
role: "assistant";
|
|
1135
|
+
}
|
|
1136
|
+
| {
|
|
1137
|
+
content: Array<{
|
|
1138
|
+
args?: any;
|
|
1139
|
+
experimental_content?: Array<
|
|
1140
|
+
| { text: string; type: "text" }
|
|
1141
|
+
| { data: string; mimeType?: string; type: "image" }
|
|
1142
|
+
>;
|
|
1143
|
+
isError?: boolean;
|
|
1144
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1145
|
+
result: any;
|
|
1146
|
+
toolCallId: string;
|
|
1147
|
+
toolName: string;
|
|
1148
|
+
type: "tool-result";
|
|
1149
|
+
}>;
|
|
1150
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1151
|
+
role: "tool";
|
|
1152
|
+
}
|
|
1153
|
+
| {
|
|
1154
|
+
content: string;
|
|
1155
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1156
|
+
role: "system";
|
|
1157
|
+
};
|
|
1158
|
+
model?: string;
|
|
1159
|
+
order: number;
|
|
1160
|
+
provider?: string;
|
|
1161
|
+
providerMetadata?: Record<string, Record<string, any>>;
|
|
1162
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1163
|
+
reasoning?: string;
|
|
1164
|
+
reasoningDetails?: Array<
|
|
1165
|
+
| { signature?: string; text: string; type: "text" }
|
|
1166
|
+
| { data: string; type: "redacted" }
|
|
1167
|
+
>;
|
|
1168
|
+
sources?: Array<{
|
|
1169
|
+
id: string;
|
|
1170
|
+
providerOptions?: Record<string, Record<string, any>>;
|
|
1171
|
+
sourceType: "url";
|
|
1172
|
+
title?: string;
|
|
1173
|
+
url: string;
|
|
1174
|
+
}>;
|
|
1175
|
+
status: "pending" | "success" | "failed";
|
|
1176
|
+
stepOrder: number;
|
|
1177
|
+
text?: string;
|
|
1178
|
+
threadId: string;
|
|
1179
|
+
tool: boolean;
|
|
1180
|
+
usage?: {
|
|
1181
|
+
completionTokens: number;
|
|
1182
|
+
promptTokens: number;
|
|
1183
|
+
totalTokens: number;
|
|
1184
|
+
};
|
|
1185
|
+
userId?: string;
|
|
1186
|
+
warnings?: Array<
|
|
1187
|
+
| { details?: string; setting: string; type: "unsupported-setting" }
|
|
1188
|
+
| { details?: string; tool: any; type: "unsupported-tool" }
|
|
1189
|
+
| { message: string; type: "other" }
|
|
1190
|
+
>;
|
|
1191
|
+
}>
|
|
1192
|
+
>;
|
|
1048
1193
|
getThreadMessages: FunctionReference<
|
|
1049
1194
|
"query",
|
|
1050
1195
|
"public",
|
|
@@ -2068,6 +2213,7 @@ export type Mounts = {
|
|
|
2068
2213
|
| 3072
|
|
2069
2214
|
| 4096;
|
|
2070
2215
|
vectors: Array<{
|
|
2216
|
+
messageId?: string;
|
|
2071
2217
|
model: string;
|
|
2072
2218
|
table: string;
|
|
2073
2219
|
threadId?: string;
|
|
@@ -2075,7 +2221,18 @@ export type Mounts = {
|
|
|
2075
2221
|
vector: Array<number>;
|
|
2076
2222
|
}>;
|
|
2077
2223
|
},
|
|
2078
|
-
|
|
2224
|
+
Array<
|
|
2225
|
+
| string
|
|
2226
|
+
| string
|
|
2227
|
+
| string
|
|
2228
|
+
| string
|
|
2229
|
+
| string
|
|
2230
|
+
| string
|
|
2231
|
+
| string
|
|
2232
|
+
| string
|
|
2233
|
+
| string
|
|
2234
|
+
| string
|
|
2235
|
+
>
|
|
2079
2236
|
>;
|
|
2080
2237
|
paginate: FunctionReference<
|
|
2081
2238
|
"query",
|
|
@@ -443,6 +443,16 @@ export const listMessagesByThreadId = query({
|
|
|
443
443
|
returns: vPaginationResult(vMessageDoc),
|
|
444
444
|
});
|
|
445
445
|
|
|
446
|
+
export const getMessagesByIds = query({
|
|
447
|
+
args: {
|
|
448
|
+
messageIds: v.array(v.id("messages")),
|
|
449
|
+
},
|
|
450
|
+
handler: async (ctx, args) => {
|
|
451
|
+
return await Promise.all(args.messageIds.map((id) => ctx.db.get(id)));
|
|
452
|
+
},
|
|
453
|
+
returns: v.array(v.union(v.null(), vMessageDoc)),
|
|
454
|
+
});
|
|
455
|
+
|
|
446
456
|
/** @deprecated Use listMessagesByThreadId instead. */
|
|
447
457
|
export const getThreadMessages = query({
|
|
448
458
|
args: { deprecated: v.literal("Use listMessagesByThreadId instead") },
|
|
@@ -97,12 +97,23 @@ export const deleteBatchForThread = mutation({
|
|
|
97
97
|
export const insertBatch = mutation({
|
|
98
98
|
args: {
|
|
99
99
|
vectorDimension: vVectorDimension,
|
|
100
|
-
vectors: v.array(
|
|
100
|
+
vectors: v.array(
|
|
101
|
+
v.object({
|
|
102
|
+
...vEmbeddingsWithoutDenormalizedFields.fields,
|
|
103
|
+
messageId: v.optional(v.id("messages")),
|
|
104
|
+
})
|
|
105
|
+
),
|
|
101
106
|
},
|
|
102
|
-
returns: v.
|
|
107
|
+
returns: v.array(vVectorId),
|
|
103
108
|
handler: async (ctx, args) => {
|
|
104
|
-
|
|
105
|
-
args.vectors.map(
|
|
109
|
+
return Promise.all(
|
|
110
|
+
args.vectors.map(async ({ messageId, ...v }) => {
|
|
111
|
+
const embeddingId = await insertVector(ctx, args.vectorDimension, v);
|
|
112
|
+
if (messageId) {
|
|
113
|
+
await ctx.db.patch(messageId, { embeddingId });
|
|
114
|
+
}
|
|
115
|
+
return embeddingId;
|
|
116
|
+
})
|
|
106
117
|
);
|
|
107
118
|
},
|
|
108
119
|
});
|