@vectorx/agent-runtime 0.0.0-beta-20251112071515
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.d.ts +14 -0
- package/lib/agent-runner.js +123 -0
- package/lib/agent-types.d.ts +118 -0
- package/lib/agent-types.js +2 -0
- package/lib/agent.d.ts +40 -0
- package/lib/agent.js +785 -0
- package/lib/codes.d.ts +6 -0
- package/lib/codes.js +9 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +23 -0
- package/lib/schema/conversation.schema.d.ts +126 -0
- package/lib/schema/conversation.schema.js +35 -0
- package/lib/schema/file.schema.d.ts +18 -0
- package/lib/schema/file.schema.js +10 -0
- package/lib/schema/index.d.ts +6 -0
- package/lib/schema/index.js +22 -0
- package/lib/schema/knowledge.schema.d.ts +37 -0
- package/lib/schema/knowledge.schema.js +13 -0
- package/lib/schema/memory.schema.d.ts +35 -0
- package/lib/schema/memory.schema.js +15 -0
- package/lib/schema/message.schema.d.ts +1050 -0
- package/lib/schema/message.schema.js +79 -0
- package/lib/schema/task.schema.d.ts +9 -0
- package/lib/schema/task.schema.js +7 -0
- package/lib/sse-sender.d.ts +32 -0
- package/lib/sse-sender.js +33 -0
- package/lib/types.d.ts +71 -0
- package/lib/types.js +2 -0
- package/lib/utils/agent-helper.d.ts +9 -0
- package/lib/utils/agent-helper.js +111 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +17 -0
- package/lib/utils/integration-response.d.ts +20 -0
- package/lib/utils/integration-response.js +17 -0
- package/package.json +47 -0
package/lib/codes.d.ts
ADDED
package/lib/codes.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CODES = void 0;
|
|
4
|
+
exports.CODES = {
|
|
5
|
+
INVALID_HTTP_CONTEXT: "INVALID_HTTP_CONTEXT",
|
|
6
|
+
AGENT_API_NOT_FOUND: "AGENT_API_NOT_FOUND",
|
|
7
|
+
AGENT_API_NOT_IMPLEMENTED: "AGENT_API_NOT_IMPLEMENTED",
|
|
8
|
+
AGENT_API_ERROR: "AGENT_API_ERROR",
|
|
9
|
+
};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./agent";
|
|
2
|
+
export { AgentDriver } from "./agent-runner";
|
|
3
|
+
export * from "./codes";
|
|
4
|
+
export * from "./agent-types";
|
|
5
|
+
export * from "./schema";
|
|
6
|
+
export type { SendMessageInput, TextContent, ImageContent, AudioContent, VideoContent, VideoUrlContent, MessageContent, BaseMessage, GetHistoryMessagesParams, CreateRecordPairParams, ParticipantInfo, Conversation, KnowledgeSearchInput, GetLoneMemoryInput, } from "./schema";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AgentDriver = void 0;
|
|
18
|
+
__exportStar(require("./agent"), exports);
|
|
19
|
+
var agent_runner_1 = require("./agent-runner");
|
|
20
|
+
Object.defineProperty(exports, "AgentDriver", { enumerable: true, get: function () { return agent_runner_1.AgentDriver; } });
|
|
21
|
+
__exportStar(require("./codes"), exports);
|
|
22
|
+
__exportStar(require("./agent-types"), exports);
|
|
23
|
+
__exportStar(require("./schema"), exports);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const userRecordSchema: z.ZodObject<{
|
|
3
|
+
content: z.ZodString;
|
|
4
|
+
role: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
role?: string;
|
|
7
|
+
content?: string;
|
|
8
|
+
}, {
|
|
9
|
+
role?: string;
|
|
10
|
+
content?: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const assistantRecordSchema: z.ZodObject<{
|
|
13
|
+
content: z.ZodOptional<z.ZodString>;
|
|
14
|
+
role: z.ZodOptional<z.ZodString>;
|
|
15
|
+
reasoning_content: z.ZodOptional<z.ZodString>;
|
|
16
|
+
type: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
type?: string;
|
|
19
|
+
role?: string;
|
|
20
|
+
content?: string;
|
|
21
|
+
reasoning_content?: string;
|
|
22
|
+
}, {
|
|
23
|
+
type?: string;
|
|
24
|
+
role?: string;
|
|
25
|
+
content?: string;
|
|
26
|
+
reasoning_content?: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const createRecordPairParamsSchema: z.ZodObject<{
|
|
29
|
+
conversation_id: z.ZodString;
|
|
30
|
+
user_input: z.ZodObject<{
|
|
31
|
+
content: z.ZodString;
|
|
32
|
+
role: z.ZodString;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
role?: string;
|
|
35
|
+
content?: string;
|
|
36
|
+
}, {
|
|
37
|
+
role?: string;
|
|
38
|
+
content?: string;
|
|
39
|
+
}>;
|
|
40
|
+
assistant_output: z.ZodObject<{
|
|
41
|
+
content: z.ZodOptional<z.ZodString>;
|
|
42
|
+
role: z.ZodOptional<z.ZodString>;
|
|
43
|
+
reasoning_content: z.ZodOptional<z.ZodString>;
|
|
44
|
+
type: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
type?: string;
|
|
47
|
+
role?: string;
|
|
48
|
+
content?: string;
|
|
49
|
+
reasoning_content?: string;
|
|
50
|
+
}, {
|
|
51
|
+
type?: string;
|
|
52
|
+
role?: string;
|
|
53
|
+
content?: string;
|
|
54
|
+
reasoning_content?: string;
|
|
55
|
+
}>;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
conversation_id?: string;
|
|
58
|
+
user_input?: {
|
|
59
|
+
role?: string;
|
|
60
|
+
content?: string;
|
|
61
|
+
};
|
|
62
|
+
assistant_output?: {
|
|
63
|
+
type?: string;
|
|
64
|
+
role?: string;
|
|
65
|
+
content?: string;
|
|
66
|
+
reasoning_content?: string;
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
69
|
+
conversation_id?: string;
|
|
70
|
+
user_input?: {
|
|
71
|
+
role?: string;
|
|
72
|
+
content?: string;
|
|
73
|
+
};
|
|
74
|
+
assistant_output?: {
|
|
75
|
+
type?: string;
|
|
76
|
+
role?: string;
|
|
77
|
+
content?: string;
|
|
78
|
+
reasoning_content?: string;
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
81
|
+
export declare const getHistoryMessagesParamsSchema: z.ZodObject<{
|
|
82
|
+
conversation_id: z.ZodString;
|
|
83
|
+
cursor: z.ZodNumber;
|
|
84
|
+
count: z.ZodNumber;
|
|
85
|
+
sort: z.ZodEnum<["desc", "asc"]>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
sort?: "desc" | "asc";
|
|
88
|
+
conversation_id?: string;
|
|
89
|
+
cursor?: number;
|
|
90
|
+
count?: number;
|
|
91
|
+
}, {
|
|
92
|
+
sort?: "desc" | "asc";
|
|
93
|
+
conversation_id?: string;
|
|
94
|
+
cursor?: number;
|
|
95
|
+
count?: number;
|
|
96
|
+
}>;
|
|
97
|
+
export declare const participantInfoSchema: z.ZodObject<{
|
|
98
|
+
id: z.ZodString;
|
|
99
|
+
name: z.ZodString;
|
|
100
|
+
desc: z.ZodString;
|
|
101
|
+
avatar_url: z.ZodString;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
name?: string;
|
|
104
|
+
id?: string;
|
|
105
|
+
desc?: string;
|
|
106
|
+
avatar_url?: string;
|
|
107
|
+
}, {
|
|
108
|
+
name?: string;
|
|
109
|
+
id?: string;
|
|
110
|
+
desc?: string;
|
|
111
|
+
avatar_url?: string;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const conversationSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
createAt: z.ZodString;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
id?: string;
|
|
118
|
+
createAt?: string;
|
|
119
|
+
}, {
|
|
120
|
+
id?: string;
|
|
121
|
+
createAt?: string;
|
|
122
|
+
}>;
|
|
123
|
+
export type GetHistoryMessagesParams = z.infer<typeof getHistoryMessagesParamsSchema>;
|
|
124
|
+
export type CreateRecordPairParams = z.infer<typeof createRecordPairParamsSchema>;
|
|
125
|
+
export type ParticipantInfo = z.infer<typeof participantInfoSchema>;
|
|
126
|
+
export type Conversation = z.infer<typeof conversationSchema>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.conversationSchema = exports.participantInfoSchema = exports.getHistoryMessagesParamsSchema = exports.createRecordPairParamsSchema = exports.assistantRecordSchema = exports.userRecordSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.userRecordSchema = zod_1.z.object({
|
|
6
|
+
content: zod_1.z.string(),
|
|
7
|
+
role: zod_1.z.string(),
|
|
8
|
+
});
|
|
9
|
+
exports.assistantRecordSchema = zod_1.z.object({
|
|
10
|
+
content: zod_1.z.string().optional(),
|
|
11
|
+
role: zod_1.z.string().optional(),
|
|
12
|
+
reasoning_content: zod_1.z.string().optional(),
|
|
13
|
+
type: zod_1.z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
exports.createRecordPairParamsSchema = zod_1.z.object({
|
|
16
|
+
conversation_id: zod_1.z.string(),
|
|
17
|
+
user_input: exports.userRecordSchema,
|
|
18
|
+
assistant_output: exports.assistantRecordSchema,
|
|
19
|
+
});
|
|
20
|
+
exports.getHistoryMessagesParamsSchema = zod_1.z.object({
|
|
21
|
+
conversation_id: zod_1.z.coerce.string(),
|
|
22
|
+
cursor: zod_1.z.coerce.number(),
|
|
23
|
+
count: zod_1.z.coerce.number(),
|
|
24
|
+
sort: zod_1.z.enum(["desc", "asc"]),
|
|
25
|
+
});
|
|
26
|
+
exports.participantInfoSchema = zod_1.z.object({
|
|
27
|
+
id: zod_1.z.string(),
|
|
28
|
+
name: zod_1.z.string(),
|
|
29
|
+
desc: zod_1.z.string(),
|
|
30
|
+
avatar_url: zod_1.z.string(),
|
|
31
|
+
});
|
|
32
|
+
exports.conversationSchema = zod_1.z.object({
|
|
33
|
+
id: zod_1.z.string(),
|
|
34
|
+
createAt: zod_1.z.string(),
|
|
35
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const uploadFileInputSchema: z.ZodObject<{
|
|
3
|
+
filename: z.ZodString;
|
|
4
|
+
purpose: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
5
|
+
fileContent: z.ZodString;
|
|
6
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
filename?: string;
|
|
9
|
+
purpose?: string;
|
|
10
|
+
fileContent?: string;
|
|
11
|
+
mimeType?: string;
|
|
12
|
+
}, {
|
|
13
|
+
filename?: string;
|
|
14
|
+
purpose?: string;
|
|
15
|
+
fileContent?: string;
|
|
16
|
+
mimeType?: string;
|
|
17
|
+
}>;
|
|
18
|
+
export type UploadFileInputSchema = z.infer<typeof uploadFileInputSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uploadFileInputSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.uploadFileInputSchema = zod_1.z.object({
|
|
6
|
+
filename: zod_1.z.string().min(1, "文件名不能为空"),
|
|
7
|
+
purpose: zod_1.z.string().optional().default("file-extract"),
|
|
8
|
+
fileContent: zod_1.z.string().min(1, "文件内容不能为空"),
|
|
9
|
+
mimeType: zod_1.z.string().optional(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./message.schema"), exports);
|
|
18
|
+
__exportStar(require("./conversation.schema"), exports);
|
|
19
|
+
__exportStar(require("./memory.schema"), exports);
|
|
20
|
+
__exportStar(require("./knowledge.schema"), exports);
|
|
21
|
+
__exportStar(require("./task.schema"), exports);
|
|
22
|
+
__exportStar(require("./file.schema"), exports);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const knowledgeSearchInputSchema: z.ZodObject<{
|
|
3
|
+
query: z.ZodString;
|
|
4
|
+
knowledge_base: z.ZodObject<{
|
|
5
|
+
knowledge_base_id: z.ZodString;
|
|
6
|
+
search_mode: z.ZodOptional<z.ZodString>;
|
|
7
|
+
score_threshold: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
limit?: number;
|
|
11
|
+
knowledge_base_id?: string;
|
|
12
|
+
search_mode?: string;
|
|
13
|
+
score_threshold?: number;
|
|
14
|
+
}, {
|
|
15
|
+
limit?: number;
|
|
16
|
+
knowledge_base_id?: string;
|
|
17
|
+
search_mode?: string;
|
|
18
|
+
score_threshold?: number;
|
|
19
|
+
}>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
query?: string;
|
|
22
|
+
knowledge_base?: {
|
|
23
|
+
limit?: number;
|
|
24
|
+
knowledge_base_id?: string;
|
|
25
|
+
search_mode?: string;
|
|
26
|
+
score_threshold?: number;
|
|
27
|
+
};
|
|
28
|
+
}, {
|
|
29
|
+
query?: string;
|
|
30
|
+
knowledge_base?: {
|
|
31
|
+
limit?: number;
|
|
32
|
+
knowledge_base_id?: string;
|
|
33
|
+
search_mode?: string;
|
|
34
|
+
score_threshold?: number;
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
export type KnowledgeSearchInput = z.infer<typeof knowledgeSearchInputSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.knowledgeSearchInputSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.knowledgeSearchInputSchema = zod_1.z.object({
|
|
6
|
+
query: zod_1.z.string(),
|
|
7
|
+
knowledge_base: zod_1.z.object({
|
|
8
|
+
knowledge_base_id: zod_1.z.string(),
|
|
9
|
+
search_mode: zod_1.z.string().optional(),
|
|
10
|
+
score_threshold: zod_1.z.number().optional(),
|
|
11
|
+
limit: zod_1.z.number().optional(),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getLoneMemoryInputSchema: z.ZodObject<{
|
|
3
|
+
userId: z.ZodString;
|
|
4
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
filter: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
type: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type?: string;
|
|
11
|
+
startTime?: number;
|
|
12
|
+
endTime?: number;
|
|
13
|
+
}, {
|
|
14
|
+
type?: string;
|
|
15
|
+
startTime?: number;
|
|
16
|
+
endTime?: number;
|
|
17
|
+
}>>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
filter?: {
|
|
20
|
+
type?: string;
|
|
21
|
+
startTime?: number;
|
|
22
|
+
endTime?: number;
|
|
23
|
+
};
|
|
24
|
+
userId?: string;
|
|
25
|
+
limit?: number;
|
|
26
|
+
}, {
|
|
27
|
+
filter?: {
|
|
28
|
+
type?: string;
|
|
29
|
+
startTime?: number;
|
|
30
|
+
endTime?: number;
|
|
31
|
+
};
|
|
32
|
+
userId?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}>;
|
|
35
|
+
export type GetLoneMemoryInput = z.infer<typeof getLoneMemoryInputSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLoneMemoryInputSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.getLoneMemoryInputSchema = zod_1.z.object({
|
|
6
|
+
userId: zod_1.z.string(),
|
|
7
|
+
limit: zod_1.z.number().optional(),
|
|
8
|
+
filter: zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
startTime: zod_1.z.number().optional(),
|
|
11
|
+
endTime: zod_1.z.number().optional(),
|
|
12
|
+
type: zod_1.z.string().optional(),
|
|
13
|
+
})
|
|
14
|
+
.optional(),
|
|
15
|
+
});
|