@vectorx/agent-runtime 1.0.0 → 1.1.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-runner.js +10 -5
- package/lib/agent.d.ts +1 -1
- package/lib/agent.js +5 -5
- package/lib/schema/message.schema.js +5 -1
- package/lib/sse-sender.d.ts +1 -1
- package/lib/utils/agent-helper.js +2 -2
- package/package.json +6 -6
package/lib/agent-runner.js
CHANGED
|
@@ -35,7 +35,12 @@ class AgentDriver {
|
|
|
35
35
|
"GET:messages": this.getHistoryMessagesFunc.bind(this),
|
|
36
36
|
"GET:info": this.getAgentInfoFunc.bind(this),
|
|
37
37
|
"GET:conversations": this.getConversationsFunc.bind(this),
|
|
38
|
-
"GET:health": () => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
"GET:health": () => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return ({
|
|
40
|
+
message: integration_response_1.OK_MESSAGE,
|
|
41
|
+
timestamp: new Date().toISOString(),
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
39
44
|
};
|
|
40
45
|
const httpMethod = context.httpContext.httpMethod;
|
|
41
46
|
const apiName = (0, agent_helper_1.parseApiName)(context.httpContext.url);
|
|
@@ -49,7 +54,7 @@ class AgentDriver {
|
|
|
49
54
|
return (0, integration_response_1.createIntegrationResponse)(404, codes_1.CODES.AGENT_API_NOT_FOUND, `Agent API ${httpMethod}:${apiName} has not been supported`);
|
|
50
55
|
});
|
|
51
56
|
}
|
|
52
|
-
sendMessageFunc(event,
|
|
57
|
+
sendMessageFunc(event, _context) {
|
|
53
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
59
|
var _a;
|
|
55
60
|
try {
|
|
@@ -62,7 +67,7 @@ class AgentDriver {
|
|
|
62
67
|
}
|
|
63
68
|
});
|
|
64
69
|
}
|
|
65
|
-
getHistoryMessagesFunc(
|
|
70
|
+
getHistoryMessagesFunc(_event, context) {
|
|
66
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
72
|
try {
|
|
68
73
|
const query = (0, agent_helper_1.parseQueryFromCtx)(context);
|
|
@@ -94,7 +99,7 @@ class AgentDriver {
|
|
|
94
99
|
}
|
|
95
100
|
});
|
|
96
101
|
}
|
|
97
|
-
queryTasksFunc(
|
|
102
|
+
queryTasksFunc(_event, context) {
|
|
98
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
104
|
var _a, _b;
|
|
100
105
|
try {
|
|
@@ -110,7 +115,7 @@ class AgentDriver {
|
|
|
110
115
|
}
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
|
-
uploadFileFunc(event,
|
|
118
|
+
uploadFileFunc(event, _context) {
|
|
114
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
120
|
var _a, _b, _c;
|
|
116
121
|
try {
|
package/lib/agent.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare class AgentRuntime {
|
|
|
33
33
|
private getModelNameFromUrl;
|
|
34
34
|
private updateModelApmData;
|
|
35
35
|
private createLoggedRequest;
|
|
36
|
-
protected createModel(modelName: models.ModelName): aiModels.ReActModel;
|
|
36
|
+
protected createModel(modelName: models.ModelName | models.TTSModelName): aiModels.ReActModel;
|
|
37
37
|
protected createRecordPair(params: CreateRecordPairParams): Promise<CreateRecordPairResponse>;
|
|
38
38
|
protected getHistoryMessages(params: GetHistoryMessagesParams): Promise<GetHistoryMessagesResponse>;
|
|
39
39
|
protected getConversations(): Promise<GetConversationsResponse>;
|
package/lib/agent.js
CHANGED
|
@@ -69,7 +69,7 @@ const safeJsonStringify = (obj) => {
|
|
|
69
69
|
try {
|
|
70
70
|
return JSON.stringify(obj);
|
|
71
71
|
}
|
|
72
|
-
catch (
|
|
72
|
+
catch (_error) {
|
|
73
73
|
return JSON.stringify({ error: "Failed to stringify object" });
|
|
74
74
|
}
|
|
75
75
|
};
|
|
@@ -765,14 +765,14 @@ class AgentRuntime {
|
|
|
765
765
|
uploadFile(input) {
|
|
766
766
|
return __awaiter(this, void 0, void 0, function* () {
|
|
767
767
|
var _a, _b;
|
|
768
|
-
const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
|
|
769
|
-
const path = yield Promise.resolve().then(() => __importStar(require("path")));
|
|
770
|
-
const os = yield Promise.resolve().then(() => __importStar(require("os")));
|
|
768
|
+
const fs = yield Promise.resolve().then(() => __importStar(require("node:fs")));
|
|
769
|
+
const path = yield Promise.resolve().then(() => __importStar(require("node:path")));
|
|
770
|
+
const os = yield Promise.resolve().then(() => __importStar(require("node:os")));
|
|
771
771
|
let tempFilePath = null;
|
|
772
772
|
try {
|
|
773
773
|
const fileData = input.file;
|
|
774
774
|
const rawFilename = fileData.newFilename || fileData.name || fileData.originalFilename || "unknown";
|
|
775
|
-
const baseName = (yield Promise.resolve().then(() => __importStar(require("path")))).basename(String(rawFilename));
|
|
775
|
+
const baseName = (yield Promise.resolve().then(() => __importStar(require("node:path")))).basename(String(rawFilename));
|
|
776
776
|
const safeFilename = baseName.replace(/[\/\\:*?"<>|]/g, "_");
|
|
777
777
|
const filename = safeFilename;
|
|
778
778
|
const purpose = input.purpose || "file-extract";
|
|
@@ -60,7 +60,11 @@ exports.toolResultMessageSchema = zod_1.z.object({
|
|
|
60
60
|
name: zod_1.z.string(),
|
|
61
61
|
content: zod_1.z.union([zod_1.z.string(), zod_1.z.record(zod_1.z.any()), zod_1.z.array(zod_1.z.any())]),
|
|
62
62
|
});
|
|
63
|
-
exports.messageItemSchema = zod_1.z.union([
|
|
63
|
+
exports.messageItemSchema = zod_1.z.union([
|
|
64
|
+
exports.baseMessageSchema,
|
|
65
|
+
exports.toolCallMessageSchema,
|
|
66
|
+
exports.toolResultMessageSchema,
|
|
67
|
+
]);
|
|
64
68
|
exports.messageHistorySchema = zod_1.z.array(exports.messageItemSchema);
|
|
65
69
|
exports.sendMessageInputSchema = zod_1.z.object({
|
|
66
70
|
msg: zod_1.z.string(),
|
package/lib/sse-sender.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EventEmitter } from "events";
|
|
1
|
+
import type { EventEmitter } from "node:events";
|
|
2
2
|
import type { RcbContext, ServerSentEvent } from "@vectorx/functions-framework";
|
|
3
3
|
export type Primitive = number | string | boolean | undefined | null;
|
|
4
4
|
export type BufferLike = number | string | Buffer | ArrayBuffer | ArrayBufferView | DataView;
|
|
@@ -43,7 +43,7 @@ exports.parseQueryFromCtx = parseQueryFromCtx;
|
|
|
43
43
|
exports.parseTaskIdFromPath = parseTaskIdFromPath;
|
|
44
44
|
exports.genRecordId = genRecordId;
|
|
45
45
|
exports.genRandomStr = genRandomStr;
|
|
46
|
-
const crypto = __importStar(require("crypto"));
|
|
46
|
+
const crypto = __importStar(require("node:crypto"));
|
|
47
47
|
const query_string_1 = __importDefault(require("query-string"));
|
|
48
48
|
const AGENT_REG = /\/v1\/aiagent\/agents\/([^\/]+)\/(.+)/;
|
|
49
49
|
function parseAgentId(url) {
|
|
@@ -58,7 +58,7 @@ function parseApiName(url) {
|
|
|
58
58
|
try {
|
|
59
59
|
return parseUrl(url).apiName;
|
|
60
60
|
}
|
|
61
|
-
catch (
|
|
61
|
+
catch (_e) {
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectorx/agent-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Cloud AI agent runtime",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
6
7
|
"files": [
|
|
7
8
|
"lib",
|
|
8
|
-
"types",
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
11
|
"keywords": [
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">=20.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@vectorx/ai-sdk": "1.0.0",
|
|
24
|
-
"@vectorx/functions-framework": "1.0.0",
|
|
25
23
|
"form-data": "^4.0.0",
|
|
26
24
|
"langfuse": "^3.38.4",
|
|
27
25
|
"query-string": "^6.14.1",
|
|
28
|
-
"zod": "^3.24.2"
|
|
26
|
+
"zod": "^3.24.2",
|
|
27
|
+
"@vectorx/ai-sdk": "1.1.0",
|
|
28
|
+
"@vectorx/functions-framework": "1.1.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/form-data": "^2.5.0",
|