@vectorx/agent-runtime 0.6.1 → 0.7.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/lib/agent.d.ts +6 -2
- package/lib/agent.js +111 -20
- package/lib/schema/file.schema.d.ts +2 -2
- package/lib/schema/message.schema.d.ts +66 -31
- package/lib/schema/message.schema.js +21 -9
- package/package.json +3 -3
package/lib/agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AI, type models } from "@vectorx/ai-sdk";
|
|
1
|
+
import { type AI, models as aiModels, type models } from "@vectorx/ai-sdk";
|
|
2
2
|
import { type RcbContext } from "@vectorx/functions-framework";
|
|
3
3
|
import type { CreateRecordPairResponse, GetAgentInfoResponse, GetConversationsResponse, GetHistoryMessagesResponse, KnowledgeBaseRetrieveResponse, QueryTasksResponse, UploadFileResponse } from "./agent-types";
|
|
4
4
|
import { type CreateRecordPairParams, type GetHistoryMessagesParams, type KnowledgeSearchInput } from "./schema";
|
|
@@ -24,12 +24,16 @@ export declare class AgentRuntime {
|
|
|
24
24
|
protected ai: AI;
|
|
25
25
|
protected request: RcbContext["request"];
|
|
26
26
|
protected logger: RcbContext["logger"];
|
|
27
|
+
private currentModelName?;
|
|
27
28
|
get agentTag(): string;
|
|
28
29
|
get agentId(): string;
|
|
29
30
|
get version(): string;
|
|
30
31
|
constructor(context: RcbContext);
|
|
32
|
+
private isModelRequest;
|
|
33
|
+
private getModelNameFromUrl;
|
|
34
|
+
private updateModelApmData;
|
|
31
35
|
private createLoggedRequest;
|
|
32
|
-
protected createModel(modelName: models.ModelName):
|
|
36
|
+
protected createModel(modelName: models.ModelName): aiModels.ReActModel;
|
|
33
37
|
protected createRecordPair(params: CreateRecordPairParams): Promise<CreateRecordPairResponse>;
|
|
34
38
|
protected getHistoryMessages(params: GetHistoryMessagesParams): Promise<GetHistoryMessagesResponse>;
|
|
35
39
|
protected getConversations(): Promise<GetConversationsResponse>;
|
package/lib/agent.js
CHANGED
|
@@ -97,12 +97,72 @@ class AgentRuntime {
|
|
|
97
97
|
env: ai_sdk_1.AiSdkEnv.Cloud,
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
+
isModelRequest(url) {
|
|
101
|
+
if (!url)
|
|
102
|
+
return false;
|
|
103
|
+
return ai_sdk_1.models.isModelRequestUrl(url);
|
|
104
|
+
}
|
|
105
|
+
getModelNameFromUrl(url) {
|
|
106
|
+
if (!url)
|
|
107
|
+
return undefined;
|
|
108
|
+
try {
|
|
109
|
+
const urlObj = new URL(url);
|
|
110
|
+
const fullPath = urlObj.pathname;
|
|
111
|
+
for (const [modelName, { domain, paths }] of ai_sdk_1.models.MODEL_REQUEST_PATTERNS) {
|
|
112
|
+
if (domain !== "*" && urlObj.origin !== domain) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const path of paths) {
|
|
116
|
+
if (fullPath.includes(path) || fullPath.endsWith(path)) {
|
|
117
|
+
return modelName;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
catch (_a) {
|
|
124
|
+
for (const [modelName, { paths }] of ai_sdk_1.models.MODEL_REQUEST_PATTERNS) {
|
|
125
|
+
for (const path of paths) {
|
|
126
|
+
if (url.includes(path)) {
|
|
127
|
+
return modelName;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
updateModelApmData(url, statusCode, rt) {
|
|
135
|
+
if (!this.isModelRequest(url)) {
|
|
136
|
+
(0, functions_framework_1.updateApmMeasurementData)({
|
|
137
|
+
kit_model_name: undefined,
|
|
138
|
+
kit_model_service_url: undefined,
|
|
139
|
+
kit_model_status_code: undefined,
|
|
140
|
+
kit_model_rt: undefined,
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const modelName = this.currentModelName || this.getModelNameFromUrl(url);
|
|
145
|
+
const updates = {
|
|
146
|
+
kit_model_service_url: url,
|
|
147
|
+
};
|
|
148
|
+
if (modelName) {
|
|
149
|
+
updates.kit_model_name = modelName;
|
|
150
|
+
}
|
|
151
|
+
if (statusCode !== undefined) {
|
|
152
|
+
updates.kit_model_status_code = statusCode;
|
|
153
|
+
}
|
|
154
|
+
if (rt !== undefined && rt > 0) {
|
|
155
|
+
updates.kit_model_rt = rt;
|
|
156
|
+
}
|
|
157
|
+
(0, functions_framework_1.updateApmMeasurementData)(updates);
|
|
158
|
+
}
|
|
100
159
|
createLoggedRequest(originalRequest, logger) {
|
|
101
160
|
return {
|
|
102
161
|
get: (options) => __awaiter(this, void 0, void 0, function* () {
|
|
103
162
|
const startTime = Date.now();
|
|
104
163
|
const requestStartLog = safeJsonStringify({
|
|
105
|
-
type:
|
|
164
|
+
type: AgentEventType.FRAMEWORK_EVENT,
|
|
165
|
+
scene: AgentType.AI_SDK_REQUEST_START,
|
|
106
166
|
method: "GET",
|
|
107
167
|
url: options.url,
|
|
108
168
|
headers: options.headers,
|
|
@@ -113,12 +173,14 @@ class AgentRuntime {
|
|
|
113
173
|
logger.logAccesslog(functions_framework_1.LogLevel.INFO, requestStartLog);
|
|
114
174
|
try {
|
|
115
175
|
const response = yield originalRequest.get(options);
|
|
176
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
116
177
|
const requestSuccessLog = safeJsonStringify({
|
|
117
|
-
type:
|
|
178
|
+
type: AgentEventType.FRAMEWORK_EVENT,
|
|
179
|
+
scene: AgentType.AI_SDK_REQUEST_SUCCESS,
|
|
118
180
|
method: "GET",
|
|
119
181
|
url: options.url,
|
|
120
182
|
status: response.statusCode,
|
|
121
|
-
duration:
|
|
183
|
+
duration: duration,
|
|
122
184
|
eventId: this.context.eventID,
|
|
123
185
|
timestamp: new Date().toISOString(),
|
|
124
186
|
});
|
|
@@ -126,13 +188,15 @@ class AgentRuntime {
|
|
|
126
188
|
return response;
|
|
127
189
|
}
|
|
128
190
|
catch (error) {
|
|
191
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
129
192
|
const requestErrorLog = safeJsonStringify({
|
|
130
|
-
type:
|
|
193
|
+
type: AgentEventType.FRAMEWORK_EVENT,
|
|
194
|
+
scene: AgentType.AI_SDK_REQUEST_ERROR,
|
|
131
195
|
method: "GET",
|
|
132
196
|
url: options.url,
|
|
133
197
|
error: error instanceof Error ? error.message : "请求失败",
|
|
134
198
|
stack: error instanceof Error ? error.stack : undefined,
|
|
135
|
-
duration:
|
|
199
|
+
duration: duration,
|
|
136
200
|
eventId: this.context.eventID,
|
|
137
201
|
timestamp: new Date().toISOString(),
|
|
138
202
|
});
|
|
@@ -155,13 +219,14 @@ class AgentRuntime {
|
|
|
155
219
|
logger.logAccesslog(functions_framework_1.LogLevel.INFO, requestStartLog);
|
|
156
220
|
try {
|
|
157
221
|
const response = yield originalRequest.post(options);
|
|
222
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
158
223
|
const requestSuccessLog = safeJsonStringify({
|
|
159
224
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
160
225
|
scene: AgentType.AI_SDK_REQUEST_SUCCESS,
|
|
161
226
|
method: "POST",
|
|
162
227
|
url: options.url,
|
|
163
228
|
status: response.statusCode,
|
|
164
|
-
duration:
|
|
229
|
+
duration: duration,
|
|
165
230
|
eventId: this.context.eventID,
|
|
166
231
|
timestamp: new Date().toISOString(),
|
|
167
232
|
});
|
|
@@ -169,6 +234,7 @@ class AgentRuntime {
|
|
|
169
234
|
return response;
|
|
170
235
|
}
|
|
171
236
|
catch (error) {
|
|
237
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
172
238
|
const requestErrorLog = safeJsonStringify({
|
|
173
239
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
174
240
|
scene: AgentType.AI_SDK_REQUEST_ERROR,
|
|
@@ -176,7 +242,7 @@ class AgentRuntime {
|
|
|
176
242
|
url: options.url,
|
|
177
243
|
error: error instanceof Error ? error.message : "请求失败",
|
|
178
244
|
stack: error instanceof Error ? error.stack : undefined,
|
|
179
|
-
duration:
|
|
245
|
+
duration: duration,
|
|
180
246
|
eventId: this.context.eventID,
|
|
181
247
|
timestamp: new Date().toISOString(),
|
|
182
248
|
});
|
|
@@ -199,13 +265,14 @@ class AgentRuntime {
|
|
|
199
265
|
logger.logAccesslog(functions_framework_1.LogLevel.INFO, requestStartLog);
|
|
200
266
|
try {
|
|
201
267
|
const response = yield originalRequest.put(options);
|
|
268
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
202
269
|
const requestSuccessLog = safeJsonStringify({
|
|
203
270
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
204
271
|
scene: AgentType.AI_SDK_REQUEST_SUCCESS,
|
|
205
272
|
method: "PUT",
|
|
206
273
|
url: options.url,
|
|
207
274
|
status: response.statusCode,
|
|
208
|
-
duration:
|
|
275
|
+
duration: duration,
|
|
209
276
|
eventId: this.context.eventID,
|
|
210
277
|
timestamp: new Date().toISOString(),
|
|
211
278
|
});
|
|
@@ -213,6 +280,7 @@ class AgentRuntime {
|
|
|
213
280
|
return response;
|
|
214
281
|
}
|
|
215
282
|
catch (error) {
|
|
283
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
216
284
|
const requestErrorLog = safeJsonStringify({
|
|
217
285
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
218
286
|
scene: AgentType.AI_SDK_REQUEST_ERROR,
|
|
@@ -220,7 +288,7 @@ class AgentRuntime {
|
|
|
220
288
|
url: options.url,
|
|
221
289
|
error: error instanceof Error ? error.message : "请求失败",
|
|
222
290
|
stack: error instanceof Error ? error.stack : undefined,
|
|
223
|
-
duration:
|
|
291
|
+
duration: duration,
|
|
224
292
|
eventId: this.context.eventID,
|
|
225
293
|
timestamp: new Date().toISOString(),
|
|
226
294
|
});
|
|
@@ -242,13 +310,14 @@ class AgentRuntime {
|
|
|
242
310
|
logger.logAccesslog(functions_framework_1.LogLevel.INFO, requestStartLog);
|
|
243
311
|
try {
|
|
244
312
|
const response = yield originalRequest.upload(options);
|
|
313
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
245
314
|
const requestSuccessLog = safeJsonStringify({
|
|
246
315
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
247
316
|
scene: AgentType.AI_SDK_REQUEST_SUCCESS,
|
|
248
317
|
method: "UPLOAD",
|
|
249
318
|
url: options.url,
|
|
250
319
|
status: response.statusCode,
|
|
251
|
-
duration:
|
|
320
|
+
duration: duration,
|
|
252
321
|
eventId: this.context.eventID,
|
|
253
322
|
timestamp: new Date().toISOString(),
|
|
254
323
|
});
|
|
@@ -256,6 +325,7 @@ class AgentRuntime {
|
|
|
256
325
|
return response;
|
|
257
326
|
}
|
|
258
327
|
catch (error) {
|
|
328
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
259
329
|
const requestErrorLog = safeJsonStringify({
|
|
260
330
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
261
331
|
scene: AgentType.AI_SDK_REQUEST_ERROR,
|
|
@@ -263,7 +333,7 @@ class AgentRuntime {
|
|
|
263
333
|
url: options.url,
|
|
264
334
|
error: error instanceof Error ? error.message : "请求失败",
|
|
265
335
|
stack: error instanceof Error ? error.stack : undefined,
|
|
266
|
-
duration:
|
|
336
|
+
duration: duration,
|
|
267
337
|
eventId: this.context.eventID,
|
|
268
338
|
timestamp: new Date().toISOString(),
|
|
269
339
|
});
|
|
@@ -285,12 +355,15 @@ class AgentRuntime {
|
|
|
285
355
|
logger.logAccesslog(functions_framework_1.LogLevel.INFO, requestStartLog);
|
|
286
356
|
try {
|
|
287
357
|
const response = yield originalRequest.download(options);
|
|
358
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
359
|
+
const statusCode = response === null || response === void 0 ? void 0 : response.statusCode;
|
|
288
360
|
const requestSuccessLog = safeJsonStringify({
|
|
289
361
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
290
362
|
scene: AgentType.AI_SDK_REQUEST_SUCCESS,
|
|
291
363
|
method: "DOWNLOAD",
|
|
292
364
|
url: options.url,
|
|
293
|
-
|
|
365
|
+
status: statusCode,
|
|
366
|
+
duration: duration,
|
|
294
367
|
eventId: this.context.eventID,
|
|
295
368
|
timestamp: new Date().toISOString(),
|
|
296
369
|
});
|
|
@@ -298,6 +371,7 @@ class AgentRuntime {
|
|
|
298
371
|
return response;
|
|
299
372
|
}
|
|
300
373
|
catch (error) {
|
|
374
|
+
const duration = `${Date.now() - startTime}ms`;
|
|
301
375
|
const requestErrorLog = safeJsonStringify({
|
|
302
376
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
303
377
|
scene: AgentType.AI_SDK_REQUEST_ERROR,
|
|
@@ -305,7 +379,7 @@ class AgentRuntime {
|
|
|
305
379
|
url: options.url,
|
|
306
380
|
error: error instanceof Error ? error.message : "请求失败",
|
|
307
381
|
stack: error instanceof Error ? error.stack : undefined,
|
|
308
|
-
duration:
|
|
382
|
+
duration: duration,
|
|
309
383
|
eventId: this.context.eventID,
|
|
310
384
|
timestamp: new Date().toISOString(),
|
|
311
385
|
});
|
|
@@ -328,20 +402,33 @@ class AgentRuntime {
|
|
|
328
402
|
logger.logAccesslog(functions_framework_1.LogLevel.INFO, requestStartLog);
|
|
329
403
|
try {
|
|
330
404
|
const response = yield originalRequest.fetch(options);
|
|
331
|
-
const
|
|
405
|
+
const rt = Date.now() - startTime;
|
|
406
|
+
const duration = `${rt}ms`;
|
|
407
|
+
const isSuccess = (response === null || response === void 0 ? void 0 : response.statusCode) >= 200 && (response === null || response === void 0 ? void 0 : response.statusCode) < 300;
|
|
408
|
+
const logData = {
|
|
332
409
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
333
|
-
scene: AgentType.AI_SDK_REQUEST_SUCCESS,
|
|
410
|
+
scene: isSuccess ? AgentType.AI_SDK_REQUEST_SUCCESS : AgentType.AI_SDK_REQUEST_ERROR,
|
|
334
411
|
method: "FETCH",
|
|
335
412
|
url: options.url,
|
|
336
|
-
|
|
337
|
-
duration: `${Date.now() - startTime}ms`,
|
|
413
|
+
duration: duration,
|
|
338
414
|
eventId: this.context.eventID,
|
|
339
415
|
timestamp: new Date().toISOString(),
|
|
340
|
-
}
|
|
341
|
-
|
|
416
|
+
};
|
|
417
|
+
if (isSuccess) {
|
|
418
|
+
logData.status = response.statusCode;
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
logData.error = `Request failed with status code: ${response === null || response === void 0 ? void 0 : response.statusCode}`;
|
|
422
|
+
}
|
|
423
|
+
this.updateModelApmData(options.url, response === null || response === void 0 ? void 0 : response.statusCode, rt);
|
|
424
|
+
const requestLog = safeJsonStringify(logData);
|
|
425
|
+
logger.logAccesslog(isSuccess ? functions_framework_1.LogLevel.INFO : functions_framework_1.LogLevel.ERROR, requestLog);
|
|
342
426
|
return response;
|
|
343
427
|
}
|
|
344
428
|
catch (error) {
|
|
429
|
+
const rt = Date.now() - startTime;
|
|
430
|
+
const duration = `${rt}ms`;
|
|
431
|
+
this.updateModelApmData(options.url, undefined, rt);
|
|
345
432
|
const requestErrorLog = safeJsonStringify({
|
|
346
433
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
347
434
|
scene: AgentType.AI_SDK_REQUEST_ERROR,
|
|
@@ -349,7 +436,7 @@ class AgentRuntime {
|
|
|
349
436
|
url: options.url,
|
|
350
437
|
error: error instanceof Error ? error.message : "请求失败",
|
|
351
438
|
stack: error instanceof Error ? error.stack : undefined,
|
|
352
|
-
duration:
|
|
439
|
+
duration: duration,
|
|
353
440
|
eventId: this.context.eventID,
|
|
354
441
|
timestamp: new Date().toISOString(),
|
|
355
442
|
});
|
|
@@ -360,6 +447,10 @@ class AgentRuntime {
|
|
|
360
447
|
};
|
|
361
448
|
}
|
|
362
449
|
createModel(modelName) {
|
|
450
|
+
this.currentModelName = modelName;
|
|
451
|
+
(0, functions_framework_1.updateApmMeasurementData)({
|
|
452
|
+
kit_model_name: modelName,
|
|
453
|
+
});
|
|
363
454
|
const createModelLog = safeJsonStringify({
|
|
364
455
|
type: AgentEventType.FRAMEWORK_EVENT,
|
|
365
456
|
scene: AgentType.AI_SDK_CREATE_MODEL,
|
|
@@ -7,12 +7,12 @@ export declare const uploadFileInputSchema: z.ZodObject<{
|
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
filename?: string;
|
|
9
9
|
purpose?: string;
|
|
10
|
-
fileContent?: string;
|
|
11
10
|
mimeType?: string;
|
|
11
|
+
fileContent?: string;
|
|
12
12
|
}, {
|
|
13
13
|
filename?: string;
|
|
14
14
|
purpose?: string;
|
|
15
|
-
fileContent?: string;
|
|
16
15
|
mimeType?: string;
|
|
16
|
+
fileContent?: string;
|
|
17
17
|
}>;
|
|
18
18
|
export type UploadFileInputSchema = z.infer<typeof uploadFileInputSchema>;
|
|
@@ -918,25 +918,46 @@ export declare const sendMessageInputSchema: z.ZodObject<{
|
|
|
918
918
|
content?: string | any[] | Record<string, any>;
|
|
919
919
|
name?: string;
|
|
920
920
|
}>]>, "many">;
|
|
921
|
-
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
922
|
-
id: z.ZodString
|
|
923
|
-
filename: z.ZodString
|
|
924
|
-
purpose: z.ZodString
|
|
925
|
-
bytes: z.ZodNumber
|
|
926
|
-
created_at: z.ZodNumber
|
|
921
|
+
files: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
922
|
+
id: z.ZodOptional<z.ZodString>;
|
|
923
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
924
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
925
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
926
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
927
927
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
928
|
-
id: z.ZodString
|
|
929
|
-
filename: z.ZodString
|
|
930
|
-
purpose: z.ZodString
|
|
931
|
-
bytes: z.ZodNumber
|
|
932
|
-
created_at: z.ZodNumber
|
|
928
|
+
id: z.ZodOptional<z.ZodString>;
|
|
929
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
930
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
931
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
932
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
933
933
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
934
|
-
id: z.ZodString
|
|
935
|
-
filename: z.ZodString
|
|
936
|
-
purpose: z.ZodString
|
|
937
|
-
bytes: z.ZodNumber
|
|
938
|
-
created_at: z.ZodNumber
|
|
939
|
-
}, z.ZodTypeAny, "passthrough">>,
|
|
934
|
+
id: z.ZodOptional<z.ZodString>;
|
|
935
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
936
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
937
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
938
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
939
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
940
|
+
url: z.ZodOptional<z.ZodString>;
|
|
941
|
+
type: z.ZodOptional<z.ZodString>;
|
|
942
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
943
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
944
|
+
fileSource: z.ZodOptional<z.ZodString>;
|
|
945
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
946
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
947
|
+
url: z.ZodOptional<z.ZodString>;
|
|
948
|
+
type: z.ZodOptional<z.ZodString>;
|
|
949
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
950
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
951
|
+
fileSource: z.ZodOptional<z.ZodString>;
|
|
952
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
953
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
954
|
+
url: z.ZodOptional<z.ZodString>;
|
|
955
|
+
type: z.ZodOptional<z.ZodString>;
|
|
956
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
957
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
958
|
+
fileSource: z.ZodOptional<z.ZodString>;
|
|
959
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
960
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
940
961
|
}, "strip", z.ZodTypeAny, {
|
|
941
962
|
msg?: string;
|
|
942
963
|
history?: ({
|
|
@@ -978,13 +999,20 @@ export declare const sendMessageInputSchema: z.ZodObject<{
|
|
|
978
999
|
content?: string | any[] | Record<string, any>;
|
|
979
1000
|
name?: string;
|
|
980
1001
|
})[];
|
|
981
|
-
files?: z.objectOutputType<{
|
|
982
|
-
id: z.ZodString
|
|
983
|
-
filename: z.ZodString
|
|
984
|
-
purpose: z.ZodString
|
|
985
|
-
bytes: z.ZodNumber
|
|
986
|
-
created_at: z.ZodNumber
|
|
987
|
-
}, z.ZodTypeAny, "passthrough">
|
|
1002
|
+
files?: (z.objectOutputType<{
|
|
1003
|
+
id: z.ZodOptional<z.ZodString>;
|
|
1004
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1005
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1006
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
1007
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
1008
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
|
|
1009
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1010
|
+
type: z.ZodOptional<z.ZodString>;
|
|
1011
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1012
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
1013
|
+
fileSource: z.ZodOptional<z.ZodString>;
|
|
1014
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1015
|
+
}, z.ZodTypeAny, "passthrough">)[];
|
|
988
1016
|
}, {
|
|
989
1017
|
msg?: string;
|
|
990
1018
|
history?: ({
|
|
@@ -1026,13 +1054,20 @@ export declare const sendMessageInputSchema: z.ZodObject<{
|
|
|
1026
1054
|
content?: string | any[] | Record<string, any>;
|
|
1027
1055
|
name?: string;
|
|
1028
1056
|
})[];
|
|
1029
|
-
files?: z.objectInputType<{
|
|
1030
|
-
id: z.ZodString
|
|
1031
|
-
filename: z.ZodString
|
|
1032
|
-
purpose: z.ZodString
|
|
1033
|
-
bytes: z.ZodNumber
|
|
1034
|
-
created_at: z.ZodNumber
|
|
1035
|
-
}, z.ZodTypeAny, "passthrough">
|
|
1057
|
+
files?: (z.objectInputType<{
|
|
1058
|
+
id: z.ZodOptional<z.ZodString>;
|
|
1059
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1060
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1061
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
1062
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
1063
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
1064
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1065
|
+
type: z.ZodOptional<z.ZodString>;
|
|
1066
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
1067
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
1068
|
+
fileSource: z.ZodOptional<z.ZodString>;
|
|
1069
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
1070
|
+
}, z.ZodTypeAny, "passthrough">)[];
|
|
1036
1071
|
}>;
|
|
1037
1072
|
export type TextContent = z.infer<typeof textContentSchema>;
|
|
1038
1073
|
export type ImageContent = z.infer<typeof imageContentSchema>;
|
|
@@ -66,14 +66,26 @@ exports.sendMessageInputSchema = zod_1.z.object({
|
|
|
66
66
|
msg: zod_1.z.string(),
|
|
67
67
|
history: exports.messageHistorySchema,
|
|
68
68
|
files: zod_1.z
|
|
69
|
-
.array(zod_1.z
|
|
70
|
-
.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
.array(zod_1.z.union([
|
|
70
|
+
zod_1.z
|
|
71
|
+
.object({
|
|
72
|
+
id: zod_1.z.string().optional(),
|
|
73
|
+
filename: zod_1.z.string().optional(),
|
|
74
|
+
purpose: zod_1.z.string().optional(),
|
|
75
|
+
bytes: zod_1.z.number().optional(),
|
|
76
|
+
created_at: zod_1.z.number().optional(),
|
|
77
|
+
})
|
|
78
|
+
.passthrough(),
|
|
79
|
+
zod_1.z
|
|
80
|
+
.object({
|
|
81
|
+
url: zod_1.z.string().optional(),
|
|
82
|
+
type: zod_1.z.string().optional(),
|
|
83
|
+
size: zod_1.z.number().optional(),
|
|
84
|
+
mimeType: zod_1.z.string().optional(),
|
|
85
|
+
fileSource: zod_1.z.string().optional(),
|
|
86
|
+
filename: zod_1.z.string().optional(),
|
|
87
|
+
})
|
|
88
|
+
.passthrough(),
|
|
89
|
+
]))
|
|
78
90
|
.optional(),
|
|
79
91
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectorx/agent-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Cloud AI agent runtime",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"node": ">=18.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@vectorx/ai-sdk": "0.
|
|
24
|
-
"@vectorx/functions-framework": "0.
|
|
23
|
+
"@vectorx/ai-sdk": "0.7.0",
|
|
24
|
+
"@vectorx/functions-framework": "0.7.0",
|
|
25
25
|
"form-data": "^4.0.0",
|
|
26
26
|
"langfuse": "^3.38.4",
|
|
27
27
|
"query-string": "^6.14.1",
|