@convex-dev/agent 0.0.1-alpha.1 → 0.0.1-alpha.3
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 +293 -6
- package/dist/commonjs/client/index.d.ts +520 -96
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +210 -131
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/client/types.d.ts +3 -0
- package/dist/commonjs/client/types.d.ts.map +1 -1
- package/dist/commonjs/component/messages.d.ts +57 -56
- package/dist/commonjs/component/messages.d.ts.map +1 -1
- package/dist/commonjs/component/messages.js +184 -147
- package/dist/commonjs/component/messages.js.map +1 -1
- package/dist/commonjs/component/schema.d.ts +260 -256
- package/dist/commonjs/component/schema.d.ts.map +1 -1
- package/dist/commonjs/component/schema.js +25 -18
- package/dist/commonjs/component/schema.js.map +1 -1
- package/dist/commonjs/component/vector/index.d.ts +4 -4
- package/dist/commonjs/component/vector/index.d.ts.map +1 -1
- package/dist/commonjs/component/vector/index.js +12 -10
- package/dist/commonjs/component/vector/index.js.map +1 -1
- package/dist/commonjs/component/vector/tables.d.ts +3 -3
- package/dist/commonjs/component/vector/tables.js +6 -6
- package/dist/commonjs/component/vector/tables.js.map +1 -1
- package/dist/commonjs/mapping.d.ts +6 -1
- package/dist/commonjs/mapping.d.ts.map +1 -1
- package/dist/commonjs/mapping.js +25 -0
- package/dist/commonjs/mapping.js.map +1 -1
- package/dist/commonjs/validators.d.ts +1376 -1
- package/dist/commonjs/validators.d.ts.map +1 -1
- package/dist/commonjs/validators.js +28 -1
- package/dist/commonjs/validators.js.map +1 -1
- package/dist/esm/client/index.d.ts +520 -96
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +210 -131
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/types.d.ts +3 -0
- package/dist/esm/client/types.d.ts.map +1 -1
- package/dist/esm/component/messages.d.ts +57 -56
- package/dist/esm/component/messages.d.ts.map +1 -1
- package/dist/esm/component/messages.js +184 -147
- package/dist/esm/component/messages.js.map +1 -1
- package/dist/esm/component/schema.d.ts +260 -256
- package/dist/esm/component/schema.d.ts.map +1 -1
- package/dist/esm/component/schema.js +25 -18
- package/dist/esm/component/schema.js.map +1 -1
- package/dist/esm/component/vector/index.d.ts +4 -4
- package/dist/esm/component/vector/index.d.ts.map +1 -1
- package/dist/esm/component/vector/index.js +12 -10
- package/dist/esm/component/vector/index.js.map +1 -1
- package/dist/esm/component/vector/tables.d.ts +3 -3
- package/dist/esm/component/vector/tables.js +6 -6
- package/dist/esm/component/vector/tables.js.map +1 -1
- package/dist/esm/mapping.d.ts +6 -1
- package/dist/esm/mapping.d.ts.map +1 -1
- package/dist/esm/mapping.js +25 -0
- package/dist/esm/mapping.js.map +1 -1
- package/dist/esm/validators.d.ts +1376 -1
- package/dist/esm/validators.d.ts.map +1 -1
- package/dist/esm/validators.js +28 -1
- package/dist/esm/validators.js.map +1 -1
- package/package.json +3 -3
- package/src/client/index.ts +384 -276
- package/src/client/types.ts +4 -0
- package/src/component/_generated/api.d.ts +54 -53
- package/src/component/messages.ts +219 -177
- package/src/component/schema.ts +25 -18
- package/src/component/vector/index.ts +13 -11
- package/src/component/vector/tables.ts +6 -6
- package/src/mapping.ts +46 -11
- package/src/validators.test.ts +9 -0
- package/src/validators.ts +36 -1
package/src/client/types.ts
CHANGED
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
GenericActionCtx,
|
|
8
8
|
} from "convex/server";
|
|
9
9
|
import { GenericId } from "convex/values";
|
|
10
|
+
import type { Doc } from "../component/_generated/dataModel";
|
|
11
|
+
|
|
12
|
+
export type ThreadDoc = OpaqueIds<Doc<"threads">>;
|
|
13
|
+
export type MessageDoc = OpaqueIds<Doc<"messages">>;
|
|
10
14
|
|
|
11
15
|
/* Type utils follow */
|
|
12
16
|
export type RunQueryCtx = {
|
|
@@ -40,7 +40,6 @@ export type Mounts = {
|
|
|
40
40
|
"public",
|
|
41
41
|
{
|
|
42
42
|
agentName?: string;
|
|
43
|
-
chatId: string;
|
|
44
43
|
failPendingSteps?: boolean;
|
|
45
44
|
messages: Array<{
|
|
46
45
|
fileId?: string;
|
|
@@ -147,13 +146,14 @@ export type Mounts = {
|
|
|
147
146
|
parentMessageId?: string;
|
|
148
147
|
pending?: boolean;
|
|
149
148
|
stepId?: string;
|
|
149
|
+
threadId?: string;
|
|
150
|
+
userId?: string;
|
|
150
151
|
},
|
|
151
152
|
{
|
|
152
153
|
messages: Array<{
|
|
153
154
|
_creationTime: number;
|
|
154
155
|
_id: string;
|
|
155
156
|
agentName?: string;
|
|
156
|
-
chatId: string;
|
|
157
157
|
embeddingId?:
|
|
158
158
|
| string
|
|
159
159
|
| string
|
|
@@ -265,6 +265,7 @@ export type Mounts = {
|
|
|
265
265
|
};
|
|
266
266
|
model?: string;
|
|
267
267
|
order: number;
|
|
268
|
+
parentMessageId?: string;
|
|
268
269
|
status: "pending" | "success" | "failed";
|
|
269
270
|
stepId?: string;
|
|
270
271
|
stepOrder?: number;
|
|
@@ -277,7 +278,6 @@ export type Mounts = {
|
|
|
277
278
|
_creationTime: number;
|
|
278
279
|
_id: string;
|
|
279
280
|
agentName?: string;
|
|
280
|
-
chatId: string;
|
|
281
281
|
embeddingId?:
|
|
282
282
|
| string
|
|
283
283
|
| string
|
|
@@ -389,6 +389,7 @@ export type Mounts = {
|
|
|
389
389
|
};
|
|
390
390
|
model?: string;
|
|
391
391
|
order: number;
|
|
392
|
+
parentMessageId?: string;
|
|
392
393
|
status: "pending" | "success" | "failed";
|
|
393
394
|
stepId?: string;
|
|
394
395
|
stepOrder?: number;
|
|
@@ -403,7 +404,6 @@ export type Mounts = {
|
|
|
403
404
|
"mutation",
|
|
404
405
|
"public",
|
|
405
406
|
{
|
|
406
|
-
chatId: string;
|
|
407
407
|
failPendingSteps?: boolean;
|
|
408
408
|
messageId: string;
|
|
409
409
|
steps: Array<{
|
|
@@ -710,11 +710,11 @@ export type Mounts = {
|
|
|
710
710
|
>;
|
|
711
711
|
};
|
|
712
712
|
}>;
|
|
713
|
+
threadId: string;
|
|
713
714
|
},
|
|
714
715
|
Array<{
|
|
715
716
|
_creationTime: number;
|
|
716
717
|
_id: string;
|
|
717
|
-
chatId: string;
|
|
718
718
|
order: number;
|
|
719
719
|
parentMessageId: string;
|
|
720
720
|
status: "pending" | "success" | "failed";
|
|
@@ -916,18 +916,19 @@ export type Mounts = {
|
|
|
916
916
|
>;
|
|
917
917
|
};
|
|
918
918
|
stepOrder: number;
|
|
919
|
+
threadId: string;
|
|
919
920
|
}>
|
|
920
921
|
>;
|
|
921
|
-
|
|
922
|
+
archiveThread: FunctionReference<
|
|
922
923
|
"mutation",
|
|
923
924
|
"public",
|
|
924
|
-
{
|
|
925
|
+
{ threadId: string },
|
|
925
926
|
{
|
|
926
927
|
_creationTime: number;
|
|
927
928
|
_id: string;
|
|
928
929
|
defaultSystemPrompt?: string;
|
|
929
930
|
order?: number;
|
|
930
|
-
|
|
931
|
+
parentThreadIds?: Array<string>;
|
|
931
932
|
status: "active" | "archived";
|
|
932
933
|
summary?: string;
|
|
933
934
|
title?: string;
|
|
@@ -940,12 +941,12 @@ export type Mounts = {
|
|
|
940
941
|
{ messageId: string },
|
|
941
942
|
null
|
|
942
943
|
>;
|
|
943
|
-
|
|
944
|
+
createThread: FunctionReference<
|
|
944
945
|
"mutation",
|
|
945
946
|
"public",
|
|
946
947
|
{
|
|
947
948
|
defaultSystemPrompt?: string;
|
|
948
|
-
|
|
949
|
+
parentThreadIds?: Array<string>;
|
|
949
950
|
summary?: string;
|
|
950
951
|
title?: string;
|
|
951
952
|
userId?: string;
|
|
@@ -955,23 +956,23 @@ export type Mounts = {
|
|
|
955
956
|
_id: string;
|
|
956
957
|
defaultSystemPrompt?: string;
|
|
957
958
|
order?: number;
|
|
958
|
-
|
|
959
|
+
parentThreadIds?: Array<string>;
|
|
959
960
|
status: "active" | "archived";
|
|
960
961
|
summary?: string;
|
|
961
962
|
title?: string;
|
|
962
963
|
userId?: string;
|
|
963
964
|
}
|
|
964
965
|
>;
|
|
965
|
-
|
|
966
|
+
deleteAllForThreadIdAsync: FunctionReference<
|
|
966
967
|
"mutation",
|
|
967
968
|
"public",
|
|
968
|
-
{
|
|
969
|
+
{ cursor?: string; limit?: number; threadId: string },
|
|
969
970
|
{ cursor: string; isDone: boolean }
|
|
970
971
|
>;
|
|
971
|
-
|
|
972
|
+
deleteAllForThreadIdSync: FunctionReference<
|
|
972
973
|
"action",
|
|
973
974
|
"public",
|
|
974
|
-
{
|
|
975
|
+
{ cursor?: string; limit?: number; threadId: string },
|
|
975
976
|
{ cursor: string; isDone: boolean }
|
|
976
977
|
>;
|
|
977
978
|
deleteAllForUserId: FunctionReference<
|
|
@@ -986,33 +987,49 @@ export type Mounts = {
|
|
|
986
987
|
{ userId: string },
|
|
987
988
|
boolean
|
|
988
989
|
>;
|
|
989
|
-
|
|
990
|
+
getFilesToDelete: FunctionReference<
|
|
990
991
|
"query",
|
|
991
992
|
"public",
|
|
992
|
-
{
|
|
993
|
+
{ cursor?: string; limit?: number },
|
|
994
|
+
{
|
|
995
|
+
continueCursor: string;
|
|
996
|
+
files: Array<{
|
|
997
|
+
_creationTime: number;
|
|
998
|
+
_id: string;
|
|
999
|
+
hash: string;
|
|
1000
|
+
refcount: number;
|
|
1001
|
+
storageId: string;
|
|
1002
|
+
}>;
|
|
1003
|
+
isDone: boolean;
|
|
1004
|
+
}
|
|
1005
|
+
>;
|
|
1006
|
+
getThread: FunctionReference<
|
|
1007
|
+
"query",
|
|
1008
|
+
"public",
|
|
1009
|
+
{ threadId: string },
|
|
993
1010
|
{
|
|
994
1011
|
_creationTime: number;
|
|
995
1012
|
_id: string;
|
|
996
1013
|
defaultSystemPrompt?: string;
|
|
997
1014
|
order?: number;
|
|
998
|
-
|
|
1015
|
+
parentThreadIds?: Array<string>;
|
|
999
1016
|
status: "active" | "archived";
|
|
1000
1017
|
summary?: string;
|
|
1001
1018
|
title?: string;
|
|
1002
1019
|
userId?: string;
|
|
1003
1020
|
} | null
|
|
1004
1021
|
>;
|
|
1005
|
-
|
|
1022
|
+
getThreadMessages: FunctionReference<
|
|
1006
1023
|
"query",
|
|
1007
1024
|
"public",
|
|
1008
1025
|
{
|
|
1009
|
-
chatId: string;
|
|
1010
1026
|
cursor?: string;
|
|
1011
1027
|
isTool?: boolean;
|
|
1012
1028
|
limit?: number;
|
|
1013
1029
|
order?: "asc" | "desc";
|
|
1014
1030
|
parentMessageId?: string;
|
|
1015
1031
|
statuses?: Array<"pending" | "success" | "failed">;
|
|
1032
|
+
threadId: string;
|
|
1016
1033
|
},
|
|
1017
1034
|
{
|
|
1018
1035
|
continueCursor: string;
|
|
@@ -1021,7 +1038,6 @@ export type Mounts = {
|
|
|
1021
1038
|
_creationTime: number;
|
|
1022
1039
|
_id: string;
|
|
1023
1040
|
agentName?: string;
|
|
1024
|
-
chatId: string;
|
|
1025
1041
|
embeddingId?:
|
|
1026
1042
|
| string
|
|
1027
1043
|
| string
|
|
@@ -1133,6 +1149,7 @@ export type Mounts = {
|
|
|
1133
1149
|
};
|
|
1134
1150
|
model?: string;
|
|
1135
1151
|
order: number;
|
|
1152
|
+
parentMessageId?: string;
|
|
1136
1153
|
status: "pending" | "success" | "failed";
|
|
1137
1154
|
stepId?: string;
|
|
1138
1155
|
stepOrder?: number;
|
|
@@ -1143,7 +1160,7 @@ export type Mounts = {
|
|
|
1143
1160
|
}>;
|
|
1144
1161
|
}
|
|
1145
1162
|
>;
|
|
1146
|
-
|
|
1163
|
+
getThreadsByUserId: FunctionReference<
|
|
1147
1164
|
"query",
|
|
1148
1165
|
"public",
|
|
1149
1166
|
{
|
|
@@ -1154,35 +1171,19 @@ export type Mounts = {
|
|
|
1154
1171
|
userId: string;
|
|
1155
1172
|
},
|
|
1156
1173
|
{
|
|
1157
|
-
|
|
1174
|
+
continueCursor: string;
|
|
1175
|
+
isDone: boolean;
|
|
1176
|
+
threads: Array<{
|
|
1158
1177
|
_creationTime: number;
|
|
1159
1178
|
_id: string;
|
|
1160
1179
|
defaultSystemPrompt?: string;
|
|
1161
1180
|
order?: number;
|
|
1162
|
-
|
|
1181
|
+
parentThreadIds?: Array<string>;
|
|
1163
1182
|
status: "active" | "archived";
|
|
1164
1183
|
summary?: string;
|
|
1165
1184
|
title?: string;
|
|
1166
1185
|
userId?: string;
|
|
1167
1186
|
}>;
|
|
1168
|
-
continueCursor: string;
|
|
1169
|
-
isDone: boolean;
|
|
1170
|
-
}
|
|
1171
|
-
>;
|
|
1172
|
-
getFilesToDelete: FunctionReference<
|
|
1173
|
-
"query",
|
|
1174
|
-
"public",
|
|
1175
|
-
{ cursor?: string; limit?: number },
|
|
1176
|
-
{
|
|
1177
|
-
continueCursor: string;
|
|
1178
|
-
files: Array<{
|
|
1179
|
-
_creationTime: number;
|
|
1180
|
-
_id: string;
|
|
1181
|
-
hash: string;
|
|
1182
|
-
refcount: number;
|
|
1183
|
-
storageId: string;
|
|
1184
|
-
}>;
|
|
1185
|
-
isDone: boolean;
|
|
1186
1187
|
}
|
|
1187
1188
|
>;
|
|
1188
1189
|
rollbackMessage: FunctionReference<
|
|
@@ -1195,11 +1196,11 @@ export type Mounts = {
|
|
|
1195
1196
|
"action",
|
|
1196
1197
|
"public",
|
|
1197
1198
|
{
|
|
1198
|
-
chatId?: string;
|
|
1199
1199
|
limit: number;
|
|
1200
1200
|
messageRange?: { after: number; before: number };
|
|
1201
1201
|
parentMessageId?: string;
|
|
1202
1202
|
text?: string;
|
|
1203
|
+
threadId?: string;
|
|
1203
1204
|
userId?: string;
|
|
1204
1205
|
vector?: Array<number>;
|
|
1205
1206
|
vectorModel?: string;
|
|
@@ -1208,7 +1209,6 @@ export type Mounts = {
|
|
|
1208
1209
|
_creationTime: number;
|
|
1209
1210
|
_id: string;
|
|
1210
1211
|
agentName?: string;
|
|
1211
|
-
chatId: string;
|
|
1212
1212
|
embeddingId?:
|
|
1213
1213
|
| string
|
|
1214
1214
|
| string
|
|
@@ -1320,6 +1320,7 @@ export type Mounts = {
|
|
|
1320
1320
|
};
|
|
1321
1321
|
model?: string;
|
|
1322
1322
|
order: number;
|
|
1323
|
+
parentMessageId?: string;
|
|
1323
1324
|
status: "pending" | "success" | "failed";
|
|
1324
1325
|
stepId?: string;
|
|
1325
1326
|
stepOrder?: number;
|
|
@@ -1332,12 +1333,11 @@ export type Mounts = {
|
|
|
1332
1333
|
textSearch: FunctionReference<
|
|
1333
1334
|
"query",
|
|
1334
1335
|
"public",
|
|
1335
|
-
{
|
|
1336
|
+
{ limit: number; text: string; threadId?: string; userId?: string },
|
|
1336
1337
|
Array<{
|
|
1337
1338
|
_creationTime: number;
|
|
1338
1339
|
_id: string;
|
|
1339
1340
|
agentName?: string;
|
|
1340
|
-
chatId: string;
|
|
1341
1341
|
embeddingId?:
|
|
1342
1342
|
| string
|
|
1343
1343
|
| string
|
|
@@ -1449,6 +1449,7 @@ export type Mounts = {
|
|
|
1449
1449
|
};
|
|
1450
1450
|
model?: string;
|
|
1451
1451
|
order: number;
|
|
1452
|
+
parentMessageId?: string;
|
|
1452
1453
|
status: "pending" | "success" | "failed";
|
|
1453
1454
|
stepId?: string;
|
|
1454
1455
|
stepOrder?: number;
|
|
@@ -1458,24 +1459,24 @@ export type Mounts = {
|
|
|
1458
1459
|
userId?: string;
|
|
1459
1460
|
}>
|
|
1460
1461
|
>;
|
|
1461
|
-
|
|
1462
|
+
updateThread: FunctionReference<
|
|
1462
1463
|
"mutation",
|
|
1463
1464
|
"public",
|
|
1464
1465
|
{
|
|
1465
|
-
chatId: string;
|
|
1466
1466
|
patch: {
|
|
1467
1467
|
defaultSystemPrompt?: string;
|
|
1468
1468
|
status?: "active" | "archived";
|
|
1469
1469
|
summary?: string;
|
|
1470
1470
|
title?: string;
|
|
1471
1471
|
};
|
|
1472
|
+
threadId: string;
|
|
1472
1473
|
},
|
|
1473
1474
|
{
|
|
1474
1475
|
_creationTime: number;
|
|
1475
1476
|
_id: string;
|
|
1476
1477
|
defaultSystemPrompt?: string;
|
|
1477
1478
|
order?: number;
|
|
1478
|
-
|
|
1479
|
+
parentThreadIds?: Array<string>;
|
|
1479
1480
|
status: "active" | "archived";
|
|
1480
1481
|
summary?: string;
|
|
1481
1482
|
title?: string;
|
|
@@ -1503,14 +1504,14 @@ export type Mounts = {
|
|
|
1503
1504
|
},
|
|
1504
1505
|
null
|
|
1505
1506
|
>;
|
|
1506
|
-
|
|
1507
|
+
deleteBatchForThread: FunctionReference<
|
|
1507
1508
|
"mutation",
|
|
1508
1509
|
"public",
|
|
1509
1510
|
{
|
|
1510
|
-
chatId: string;
|
|
1511
1511
|
cursor?: string;
|
|
1512
1512
|
limit: number;
|
|
1513
1513
|
model: string;
|
|
1514
|
+
threadId: string;
|
|
1514
1515
|
vectorDimension:
|
|
1515
1516
|
| 128
|
|
1516
1517
|
| 256
|
|
@@ -1539,9 +1540,9 @@ export type Mounts = {
|
|
|
1539
1540
|
| 3072
|
|
1540
1541
|
| 4096;
|
|
1541
1542
|
vectors: Array<{
|
|
1542
|
-
|
|
1543
|
-
kind: "chat" | "memory";
|
|
1543
|
+
kind: "thread" | "memory";
|
|
1544
1544
|
model: string;
|
|
1545
|
+
threadId?: string;
|
|
1545
1546
|
userId?: string;
|
|
1546
1547
|
vector: Array<number>;
|
|
1547
1548
|
}>;
|