@vectorx/agent-runtime 0.0.0-beta-20260108133839 → 0.0.0-beta-20260320063305
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 +16 -8
- 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,10 +54,12 @@ 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* () {
|
|
59
|
+
var _a;
|
|
54
60
|
try {
|
|
55
|
-
const
|
|
61
|
+
const payload = (_a = event === null || event === void 0 ? void 0 : event.params) !== null && _a !== void 0 ? _a : event;
|
|
62
|
+
const parsedEvent = schema_1.sendMessageInputSchema.passthrough().parse(payload);
|
|
56
63
|
return yield this.agent.sendMessage(parsedEvent);
|
|
57
64
|
}
|
|
58
65
|
catch (e) {
|
|
@@ -60,7 +67,7 @@ class AgentDriver {
|
|
|
60
67
|
}
|
|
61
68
|
});
|
|
62
69
|
}
|
|
63
|
-
getHistoryMessagesFunc(
|
|
70
|
+
getHistoryMessagesFunc(_event, context) {
|
|
64
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
72
|
try {
|
|
66
73
|
const query = (0, agent_helper_1.parseQueryFromCtx)(context);
|
|
@@ -92,7 +99,7 @@ class AgentDriver {
|
|
|
92
99
|
}
|
|
93
100
|
});
|
|
94
101
|
}
|
|
95
|
-
queryTasksFunc(
|
|
102
|
+
queryTasksFunc(_event, context) {
|
|
96
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
104
|
var _a, _b;
|
|
98
105
|
try {
|
|
@@ -108,11 +115,12 @@ class AgentDriver {
|
|
|
108
115
|
}
|
|
109
116
|
});
|
|
110
117
|
}
|
|
111
|
-
uploadFileFunc(event,
|
|
118
|
+
uploadFileFunc(event, _context) {
|
|
112
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
var _a, _b;
|
|
120
|
+
var _a, _b, _c;
|
|
114
121
|
try {
|
|
115
|
-
|
|
122
|
+
const payload = (_a = event === null || event === void 0 ? void 0 : event.params) !== null && _a !== void 0 ? _a : event;
|
|
123
|
+
return yield ((_c = (_b = this.agent).uploadFile) === null || _c === void 0 ? void 0 : _c.call(_b, payload));
|
|
116
124
|
}
|
|
117
125
|
catch (e) {
|
|
118
126
|
return (0, integration_response_1.createIntegrationResponse)(500, codes_1.CODES.AGENT_API_ERROR, `Agent API 'uploadFile' failed, message: ${e}`);
|
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": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-20260320063305",
|
|
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": "0.0.0-beta-20260108133839",
|
|
24
|
-
"@vectorx/functions-framework": "0.0.0-beta-20260108133839",
|
|
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": "0.0.0-beta-20260320063305",
|
|
28
|
+
"@vectorx/functions-framework": "0.0.0-beta-20260320063305"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/form-data": "^2.5.0",
|