@convex-dev/agent 0.0.16 → 0.0.17-alpha.0
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 +159 -98
- package/dist/commonjs/client/index.d.ts +806 -189
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +178 -28
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/client/playground.d.ts +609 -0
- package/dist/commonjs/client/playground.d.ts.map +1 -0
- package/dist/commonjs/client/playground.js +200 -0
- package/dist/commonjs/client/playground.js.map +1 -0
- package/dist/commonjs/component/apiKeys.d.ts +11 -0
- package/dist/commonjs/component/apiKeys.d.ts.map +1 -0
- package/dist/commonjs/component/apiKeys.js +69 -0
- package/dist/commonjs/component/apiKeys.js.map +1 -0
- package/dist/commonjs/component/files.d.ts +31 -0
- package/dist/commonjs/component/files.d.ts.map +1 -0
- package/dist/commonjs/component/files.js +61 -0
- package/dist/commonjs/component/files.js.map +1 -0
- package/dist/commonjs/component/messages.d.ts +720 -676
- package/dist/commonjs/component/messages.d.ts.map +1 -1
- package/dist/commonjs/component/messages.js +99 -287
- package/dist/commonjs/component/messages.js.map +1 -1
- package/dist/commonjs/component/schema.d.ts +1124 -1324
- package/dist/commonjs/component/schema.d.ts.map +1 -1
- package/dist/commonjs/component/schema.js +26 -14
- package/dist/commonjs/component/schema.js.map +1 -1
- package/dist/commonjs/component/threads.d.ts +95 -0
- package/dist/commonjs/component/threads.d.ts.map +1 -0
- package/dist/commonjs/component/threads.js +151 -0
- package/dist/commonjs/component/threads.js.map +1 -0
- package/dist/commonjs/component/users.d.ts +37 -0
- package/dist/commonjs/component/users.d.ts.map +1 -0
- package/dist/commonjs/component/users.js +118 -0
- package/dist/commonjs/component/users.js.map +1 -0
- package/dist/commonjs/component/vector/index.d.ts.map +1 -1
- package/dist/commonjs/component/vector/index.js +4 -6
- package/dist/commonjs/component/vector/index.js.map +1 -1
- package/dist/commonjs/component/vector/tables.d.ts +10 -10
- package/dist/commonjs/component/vector/tables.d.ts.map +1 -1
- package/dist/commonjs/component/vector/tables.js.map +1 -1
- package/dist/commonjs/mapping.d.ts +7 -1
- package/dist/commonjs/mapping.d.ts.map +1 -1
- package/dist/commonjs/mapping.js +39 -18
- package/dist/commonjs/mapping.js.map +1 -1
- package/dist/commonjs/validators.d.ts +1669 -2340
- package/dist/commonjs/validators.d.ts.map +1 -1
- package/dist/commonjs/validators.js +35 -26
- package/dist/commonjs/validators.js.map +1 -1
- package/dist/esm/client/index.d.ts +806 -189
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +178 -28
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/playground.d.ts +609 -0
- package/dist/esm/client/playground.d.ts.map +1 -0
- package/dist/esm/client/playground.js +200 -0
- package/dist/esm/client/playground.js.map +1 -0
- package/dist/esm/component/apiKeys.d.ts +11 -0
- package/dist/esm/component/apiKeys.d.ts.map +1 -0
- package/dist/esm/component/apiKeys.js +69 -0
- package/dist/esm/component/apiKeys.js.map +1 -0
- package/dist/esm/component/files.d.ts +31 -0
- package/dist/esm/component/files.d.ts.map +1 -0
- package/dist/esm/component/files.js +61 -0
- package/dist/esm/component/files.js.map +1 -0
- package/dist/esm/component/messages.d.ts +720 -676
- package/dist/esm/component/messages.d.ts.map +1 -1
- package/dist/esm/component/messages.js +99 -287
- package/dist/esm/component/messages.js.map +1 -1
- package/dist/esm/component/schema.d.ts +1124 -1324
- package/dist/esm/component/schema.d.ts.map +1 -1
- package/dist/esm/component/schema.js +26 -14
- package/dist/esm/component/schema.js.map +1 -1
- package/dist/esm/component/threads.d.ts +95 -0
- package/dist/esm/component/threads.d.ts.map +1 -0
- package/dist/esm/component/threads.js +151 -0
- package/dist/esm/component/threads.js.map +1 -0
- package/dist/esm/component/users.d.ts +37 -0
- package/dist/esm/component/users.d.ts.map +1 -0
- package/dist/esm/component/users.js +118 -0
- package/dist/esm/component/users.js.map +1 -0
- package/dist/esm/component/vector/index.d.ts.map +1 -1
- package/dist/esm/component/vector/index.js +4 -6
- package/dist/esm/component/vector/index.js.map +1 -1
- package/dist/esm/component/vector/tables.d.ts +10 -10
- package/dist/esm/component/vector/tables.d.ts.map +1 -1
- package/dist/esm/component/vector/tables.js.map +1 -1
- package/dist/esm/mapping.d.ts +7 -1
- package/dist/esm/mapping.d.ts.map +1 -1
- package/dist/esm/mapping.js +39 -18
- package/dist/esm/mapping.js.map +1 -1
- package/dist/esm/validators.d.ts +1669 -2340
- package/dist/esm/validators.d.ts.map +1 -1
- package/dist/esm/validators.js +35 -26
- package/dist/esm/validators.js.map +1 -1
- package/package.json +8 -1
- package/src/client/index.ts +220 -59
- package/src/client/playground.ts +257 -0
- package/src/component/_generated/api.d.ts +601 -400
- package/src/component/apiKeys.ts +74 -0
- package/src/component/files.ts +72 -0
- package/src/component/messages.test.ts +23 -0
- package/src/component/messages.ts +127 -341
- package/src/component/schema.ts +32 -13
- package/src/component/threads.ts +184 -0
- package/src/component/users.ts +145 -0
- package/src/component/vector/index.ts +5 -6
- package/src/component/vector/tables.ts +15 -15
- package/src/mapping.ts +65 -32
- package/src/validators.ts +47 -28
package/src/validators.ts
CHANGED
|
@@ -3,14 +3,16 @@ import { vVectorDimension } from "./component/vector/tables";
|
|
|
3
3
|
|
|
4
4
|
// const deprecated = v.optional(v.any()) as unknown as VNull<unknown, "optional">;
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
v.record(v.string(), v.record(v.string(), v.any()))
|
|
6
|
+
export const vProviderOptions = v.record(
|
|
7
|
+
v.string(),
|
|
8
|
+
v.record(v.string(), v.any())
|
|
10
9
|
);
|
|
11
|
-
|
|
10
|
+
const providerOptions = v.optional(vProviderOptions);
|
|
11
|
+
export type ProviderOptions = Infer<typeof providerOptions>;
|
|
12
|
+
|
|
13
|
+
export const vProviderMetadata = vProviderOptions;
|
|
14
|
+
const providerMetadata = providerOptions;
|
|
12
15
|
export type ProviderMetadata = Infer<typeof providerMetadata>;
|
|
13
|
-
const experimental_providerMetadata = providerOptions;
|
|
14
16
|
|
|
15
17
|
export const vThreadStatus = v.union(
|
|
16
18
|
v.literal("active"),
|
|
@@ -34,7 +36,6 @@ export const vTextPart = v.object({
|
|
|
34
36
|
type: v.literal("text"),
|
|
35
37
|
text: v.string(),
|
|
36
38
|
providerOptions,
|
|
37
|
-
experimental_providerMetadata,
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
export const vImagePart = v.object({
|
|
@@ -42,7 +43,6 @@ export const vImagePart = v.object({
|
|
|
42
43
|
image: v.union(v.string(), v.bytes()),
|
|
43
44
|
mimeType: v.optional(v.string()),
|
|
44
45
|
providerOptions,
|
|
45
|
-
experimental_providerMetadata,
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
export const vFilePart = v.object({
|
|
@@ -50,7 +50,13 @@ export const vFilePart = v.object({
|
|
|
50
50
|
data: v.union(v.string(), v.bytes()),
|
|
51
51
|
mimeType: v.string(),
|
|
52
52
|
providerOptions,
|
|
53
|
-
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const vFile = v.object({
|
|
56
|
+
data: v.optional(v.union(v.bytes(), v.string())),
|
|
57
|
+
url: v.optional(v.string()),
|
|
58
|
+
mimeType: v.string(),
|
|
59
|
+
fileId: v.optional(v.id("files")),
|
|
54
60
|
});
|
|
55
61
|
|
|
56
62
|
export const vUserContent = v.union(
|
|
@@ -61,24 +67,43 @@ export const vUserContent = v.union(
|
|
|
61
67
|
export const vReasoningPart = v.object({
|
|
62
68
|
type: v.literal("reasoning"),
|
|
63
69
|
text: v.string(),
|
|
70
|
+
signature: v.optional(v.string()),
|
|
64
71
|
providerOptions,
|
|
65
|
-
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const vFileWithStringId = v.object({
|
|
75
|
+
bytes: v.optional(v.bytes()),
|
|
76
|
+
url: v.optional(v.string()),
|
|
77
|
+
mimeType: v.string(),
|
|
78
|
+
fileId: v.optional(v.string()),
|
|
66
79
|
});
|
|
67
80
|
|
|
68
81
|
export const vRedactedReasoningPart = v.object({
|
|
69
82
|
type: v.literal("redacted-reasoning"),
|
|
70
83
|
data: v.string(),
|
|
71
84
|
providerOptions,
|
|
72
|
-
experimental_providerMetadata,
|
|
73
85
|
});
|
|
74
86
|
|
|
87
|
+
export const vReasoningDetails = v.array(
|
|
88
|
+
v.union(
|
|
89
|
+
v.object({
|
|
90
|
+
type: v.literal("text"),
|
|
91
|
+
text: v.string(),
|
|
92
|
+
signature: v.optional(v.string()),
|
|
93
|
+
}),
|
|
94
|
+
v.object({
|
|
95
|
+
type: v.literal("redacted"),
|
|
96
|
+
data: v.string(),
|
|
97
|
+
})
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
|
|
75
101
|
export const vToolCallPart = v.object({
|
|
76
102
|
type: v.literal("tool-call"),
|
|
77
103
|
toolCallId: v.string(),
|
|
78
104
|
toolName: v.string(),
|
|
79
105
|
args: v.any(),
|
|
80
106
|
providerOptions,
|
|
81
|
-
experimental_providerMetadata,
|
|
82
107
|
});
|
|
83
108
|
|
|
84
109
|
export const vAssistantContent = v.union(
|
|
@@ -113,11 +138,12 @@ const vToolResultPart = v.object({
|
|
|
113
138
|
toolCallId: v.string(),
|
|
114
139
|
toolName: v.string(),
|
|
115
140
|
result: v.any(),
|
|
141
|
+
// This is only here b/c steps include it in toolResults
|
|
142
|
+
// Normal CoreMessage doesn't have this
|
|
116
143
|
args: v.optional(v.any()),
|
|
117
144
|
experimental_content: v.optional(vToolResultContent),
|
|
118
145
|
isError: v.optional(v.boolean()),
|
|
119
146
|
providerOptions,
|
|
120
|
-
experimental_providerMetadata,
|
|
121
147
|
});
|
|
122
148
|
export const vToolContent = v.array(vToolResultPart);
|
|
123
149
|
|
|
@@ -128,28 +154,24 @@ export const vUserMessage = v.object({
|
|
|
128
154
|
role: v.literal("user"),
|
|
129
155
|
content: vUserContent,
|
|
130
156
|
providerOptions,
|
|
131
|
-
experimental_providerMetadata,
|
|
132
157
|
});
|
|
133
158
|
|
|
134
159
|
export const vAssistantMessage = v.object({
|
|
135
160
|
role: v.literal("assistant"),
|
|
136
161
|
content: vAssistantContent,
|
|
137
162
|
providerOptions,
|
|
138
|
-
experimental_providerMetadata,
|
|
139
163
|
});
|
|
140
164
|
|
|
141
165
|
export const vToolMessage = v.object({
|
|
142
166
|
role: v.literal("tool"),
|
|
143
167
|
content: vToolContent,
|
|
144
168
|
providerOptions,
|
|
145
|
-
experimental_providerMetadata,
|
|
146
169
|
});
|
|
147
170
|
|
|
148
171
|
export const vSystemMessage = v.object({
|
|
149
172
|
role: v.literal("system"),
|
|
150
173
|
content: v.string(),
|
|
151
174
|
providerOptions,
|
|
152
|
-
experimental_providerMetadata,
|
|
153
175
|
});
|
|
154
176
|
|
|
155
177
|
export const vMessage = v.union(
|
|
@@ -165,7 +187,7 @@ export const vSource = v.object({
|
|
|
165
187
|
id: v.string(),
|
|
166
188
|
url: v.string(),
|
|
167
189
|
title: v.optional(v.string()),
|
|
168
|
-
|
|
190
|
+
providerOptions,
|
|
169
191
|
});
|
|
170
192
|
|
|
171
193
|
export const vRequest = v.object({
|
|
@@ -237,7 +259,7 @@ export const vMessageWithMetadata = v.object({
|
|
|
237
259
|
id: v.optional(v.string()), // external id, e.g. from Vercel AI SDK
|
|
238
260
|
message: vMessage,
|
|
239
261
|
text: v.optional(v.string()),
|
|
240
|
-
|
|
262
|
+
files: v.optional(v.array(vFile)),
|
|
241
263
|
// metadata
|
|
242
264
|
finishReason: v.optional(vFinishReason),
|
|
243
265
|
model: v.optional(v.string()),
|
|
@@ -245,6 +267,7 @@ export const vMessageWithMetadata = v.object({
|
|
|
245
267
|
providerMetadata,
|
|
246
268
|
sources: v.optional(v.array(vSource)),
|
|
247
269
|
reasoning: v.optional(v.string()),
|
|
270
|
+
reasoningDetails: v.optional(vReasoningDetails),
|
|
248
271
|
usage: v.optional(vUsage),
|
|
249
272
|
warnings: v.optional(v.array(vLanguageModelV1CallWarning)),
|
|
250
273
|
error: v.optional(v.string()),
|
|
@@ -260,15 +283,14 @@ export const vMessageWithMetadata = v.object({
|
|
|
260
283
|
export type MessageWithMetadata = Infer<typeof vMessageWithMetadata>;
|
|
261
284
|
|
|
262
285
|
export const vStep = v.object({
|
|
263
|
-
experimental_providerMetadata,
|
|
264
286
|
files: v.optional(v.array(v.any())),
|
|
265
287
|
finishReason: vFinishReason,
|
|
266
288
|
isContinued: v.boolean(),
|
|
267
289
|
logprobs: v.optional(v.any()),
|
|
268
290
|
providerMetadata,
|
|
269
|
-
|
|
291
|
+
experimental_providerMetadata: providerMetadata,
|
|
270
292
|
reasoning: v.optional(v.string()),
|
|
271
|
-
reasoningDetails: v.optional(
|
|
293
|
+
reasoningDetails: v.optional(vReasoningDetails),
|
|
272
294
|
request: v.optional(vRequest),
|
|
273
295
|
response: v.optional(vResponse),
|
|
274
296
|
sources: v.optional(v.array(vSource)),
|
|
@@ -300,7 +322,6 @@ export const vObjectResult = v.object({
|
|
|
300
322
|
error: v.optional(v.string()),
|
|
301
323
|
warnings: v.optional(v.array(vLanguageModelV1CallWarning)),
|
|
302
324
|
providerMetadata,
|
|
303
|
-
experimental_providerMetadata,
|
|
304
325
|
});
|
|
305
326
|
export type ObjectResult = Infer<typeof vObjectResult>;
|
|
306
327
|
export const vSearchOptions = v.object({
|
|
@@ -321,7 +342,7 @@ export const vContextOptionsSearchOptions = v.object({
|
|
|
321
342
|
});
|
|
322
343
|
|
|
323
344
|
export const vContextOptions = v.object({
|
|
324
|
-
|
|
345
|
+
excludeToolMessages: v.optional(v.boolean()),
|
|
325
346
|
recentMessages: v.optional(v.number()),
|
|
326
347
|
searchOptions: v.optional(vContextOptionsSearchOptions),
|
|
327
348
|
searchOtherThreads: v.optional(v.boolean()),
|
|
@@ -329,7 +350,8 @@ export const vContextOptions = v.object({
|
|
|
329
350
|
|
|
330
351
|
export const vStorageOptions = v.object({
|
|
331
352
|
saveAllInputMessages: v.optional(v.boolean()),
|
|
332
|
-
|
|
353
|
+
saveAnyInputMessages: v.optional(v.boolean()),
|
|
354
|
+
saveOutputMessages: v.optional(v.boolean()),
|
|
333
355
|
});
|
|
334
356
|
|
|
335
357
|
const vPromptFields = {
|
|
@@ -356,9 +378,7 @@ const vCommonArgs = {
|
|
|
356
378
|
threadId: v.optional(v.string()),
|
|
357
379
|
contextOptions: v.optional(vContextOptions),
|
|
358
380
|
storageOptions: v.optional(vStorageOptions),
|
|
359
|
-
parentMessageId: v.optional(v.string()),
|
|
360
381
|
providerOptions,
|
|
361
|
-
experimental_providerMetadata,
|
|
362
382
|
...vCallSettingsFields,
|
|
363
383
|
...vPromptFields,
|
|
364
384
|
};
|
|
@@ -379,7 +399,6 @@ export const vTextArgs = v.object({
|
|
|
379
399
|
maxSteps: v.optional(v.number()),
|
|
380
400
|
experimental_continueSteps: v.optional(v.boolean()),
|
|
381
401
|
providerOptions,
|
|
382
|
-
experimental_providerMetadata,
|
|
383
402
|
});
|
|
384
403
|
export type TextArgs = Infer<typeof vTextArgs>;
|
|
385
404
|
|