@vectorx/agent-runtime 0.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/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.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,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,20 @@
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);
@@ -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,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
+ });
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendMessageInputSchema = exports.messageHistorySchema = exports.messageItemSchema = exports.toolResultMessageSchema = exports.toolCallMessageSchema = exports.baseMessageSchema = exports.messageContentSchema = exports.videoUrlContentSchema = exports.videoContentSchema = exports.audioContentSchema = exports.imageContentSchema = exports.textContentSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.textContentSchema = zod_1.z.object({
6
+ type: zod_1.z.literal("text"),
7
+ text: zod_1.z.string(),
8
+ });
9
+ exports.imageContentSchema = zod_1.z.object({
10
+ type: zod_1.z.literal("image_url"),
11
+ image_url: zod_1.z.object({
12
+ url: zod_1.z.string(),
13
+ }),
14
+ });
15
+ exports.audioContentSchema = zod_1.z.object({
16
+ type: zod_1.z.literal("input_audio"),
17
+ input_audio: zod_1.z.object({
18
+ data: zod_1.z.string(),
19
+ format: zod_1.z.string(),
20
+ }),
21
+ });
22
+ exports.videoContentSchema = zod_1.z.object({
23
+ type: zod_1.z.literal("video"),
24
+ video: zod_1.z.array(zod_1.z.string()),
25
+ });
26
+ exports.videoUrlContentSchema = zod_1.z.object({
27
+ type: zod_1.z.literal("video_url"),
28
+ video_url: zod_1.z.object({
29
+ url: zod_1.z.string(),
30
+ }),
31
+ });
32
+ exports.messageContentSchema = zod_1.z.union([
33
+ exports.textContentSchema,
34
+ exports.imageContentSchema,
35
+ exports.audioContentSchema,
36
+ exports.videoContentSchema,
37
+ exports.videoUrlContentSchema,
38
+ ]);
39
+ exports.baseMessageSchema = zod_1.z.object({
40
+ role: zod_1.z.union([zod_1.z.literal("system"), zod_1.z.literal("user"), zod_1.z.literal("assistant")]),
41
+ content: zod_1.z.union([
42
+ zod_1.z.string(),
43
+ zod_1.z.array(exports.messageContentSchema),
44
+ ]),
45
+ });
46
+ exports.toolCallMessageSchema = zod_1.z.object({
47
+ role: zod_1.z.literal("tool"),
48
+ function: zod_1.z.string(),
49
+ arguments: zod_1.z.record(zod_1.z.any()).optional(),
50
+ });
51
+ exports.toolResultMessageSchema = zod_1.z.object({
52
+ role: zod_1.z.literal("tool"),
53
+ function: zod_1.z.string(),
54
+ name: zod_1.z.string(),
55
+ 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())]),
56
+ });
57
+ exports.messageItemSchema = zod_1.z.union([exports.baseMessageSchema, exports.toolCallMessageSchema, exports.toolResultMessageSchema]);
58
+ exports.messageHistorySchema = zod_1.z.array(exports.messageItemSchema);
59
+ exports.sendMessageInputSchema = zod_1.z.object({
60
+ msg: zod_1.z.string(),
61
+ history: exports.messageHistorySchema,
62
+ });
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SSESender = void 0;
4
+ class SSESender {
5
+ get status() {
6
+ return this._status;
7
+ }
8
+ constructor(context) {
9
+ this.context = context;
10
+ this._status = "initial";
11
+ this._sse = null;
12
+ }
13
+ get sse() {
14
+ var _a, _b;
15
+ if (!this._sse) {
16
+ const sse = (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.sse) === null || _b === void 0 ? void 0 : _b.call(_a);
17
+ if (!sse) {
18
+ throw new Error("Invalid sse");
19
+ }
20
+ this._sse = sse;
21
+ this._status = "started";
22
+ }
23
+ return this._sse;
24
+ }
25
+ send(data) {
26
+ this.sse.send(data);
27
+ }
28
+ end() {
29
+ this.sse.end({ data: "[DONE]" });
30
+ this._status = "ended";
31
+ }
32
+ }
33
+ exports.SSESender = SSESender;
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,92 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.parseAgentId = parseAgentId;
40
+ exports.parseAgentTag = parseAgentTag;
41
+ exports.parseApiName = parseApiName;
42
+ exports.parseQueryFromCtx = parseQueryFromCtx;
43
+ exports.genRecordId = genRecordId;
44
+ exports.genRandomStr = genRandomStr;
45
+ const crypto = __importStar(require("crypto"));
46
+ const query_string_1 = __importDefault(require("query-string"));
47
+ const AGENT_REG = /\/v1\/aiagent\/agents\/([^\\]+)\/([^\\]+)/;
48
+ function parseAgentId(url) {
49
+ return parseUrl(url).agentId;
50
+ }
51
+ function parseAgentTag(url) {
52
+ const agentId = parseAgentId(url);
53
+ const agentTag = agentId.split("-")[2];
54
+ return agentTag;
55
+ }
56
+ function parseApiName(url) {
57
+ try {
58
+ return parseUrl(url).apiName;
59
+ }
60
+ catch (e) {
61
+ return null;
62
+ }
63
+ }
64
+ function parseUrl(url) {
65
+ const { pathname } = new URL(url);
66
+ const regResult = pathname.match(AGENT_REG);
67
+ if (!regResult) {
68
+ throw new Error("Invalid pathname");
69
+ }
70
+ const [_, agentId, apiName] = regResult;
71
+ return { agentId, apiName };
72
+ }
73
+ function parseQueryFromCtx(ctx) {
74
+ var _a;
75
+ const url = (_a = ctx.httpContext) === null || _a === void 0 ? void 0 : _a.url;
76
+ if (!url) {
77
+ throw new Error("Invalid url: " + url);
78
+ }
79
+ const [_, queryStr] = url.split("?");
80
+ return query_string_1.default.parse(queryStr, {
81
+ parseBooleans: true,
82
+ parseFragmentIdentifier: true,
83
+ });
84
+ }
85
+ function genRecordId() {
86
+ return "record-" + genRandomStr(8);
87
+ }
88
+ function genRandomStr(length) {
89
+ const randomBytes = crypto.randomBytes(Math.ceil(length / 2));
90
+ const hexString = randomBytes.toString("hex").slice(0, length);
91
+ return hexString;
92
+ }
@@ -0,0 +1,17 @@
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("./agent-helper"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OK_MESSAGE = void 0;
4
+ exports.createIntegrationResponse = createIntegrationResponse;
5
+ function createIntegrationResponse(statusCode, code, message) {
6
+ return {
7
+ statusCode,
8
+ headers: {
9
+ "Content-Type": "application/json",
10
+ },
11
+ body: {
12
+ code,
13
+ message,
14
+ },
15
+ };
16
+ }
17
+ exports.OK_MESSAGE = "OK";
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@vectorx/agent-runtime",
3
+ "version": "0.1.0",
4
+ "description": "Cloud AI agent runtime",
5
+ "main": "lib/index.js",
6
+ "types": "types/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "types",
10
+ "README.md"
11
+ ],
12
+ "keywords": [
13
+ "ai",
14
+ "agent",
15
+ "cloud",
16
+ "framework"
17
+ ],
18
+ "author": "",
19
+ "license": "ISC",
20
+ "engines": {
21
+ "node": ">=18.0.0"
22
+ },
23
+ "dependencies": {
24
+ "@vectorx/ai-sdk": "0.1.0",
25
+ "@vectorx/functions-framework": "0.1.0",
26
+ "query-string": "^6.14.1",
27
+ "zod": "^3.24.2"
28
+ },
29
+ "devDependencies": {
30
+ "@types/jest": "^29.5.12",
31
+ "@types/node": "^20.11.24",
32
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
33
+ "@typescript-eslint/parser": "^7.1.0",
34
+ "eslint": "^8.57.0",
35
+ "jest": "^29.7.0",
36
+ "ts-node-dev": "^2.0.0",
37
+ "typescript": "^5.3.3"
38
+ },
39
+ "scripts": {
40
+ "dev": "tsc -w",
41
+ "build": "rimraf lib types && tsc",
42
+ "lint": "eslint 'src/**/*.ts'",
43
+ "fix": "eslint 'src/**/*.ts' --fix"
44
+ }
45
+ }
@@ -0,0 +1,12 @@
1
+ import type { IAgent } from "@vectorx/ai-sdk";
2
+ import type { RcbContext } from "@vectorx/functions-framework";
3
+ export declare class AgentDriver {
4
+ readonly agent: IAgent;
5
+ static run(event: unknown, context: RcbContext, agent: IAgent): Promise<unknown>;
6
+ constructor(agent: IAgent);
7
+ run(event: unknown, context: RcbContext): Promise<unknown>;
8
+ private sendMessageFunc;
9
+ private getHistoryMessagesFunc;
10
+ private getAgentInfoFunc;
11
+ private getConversationsFunc;
12
+ }
@@ -0,0 +1,81 @@
1
+ import type { MessageType } from "@vectorx/ai-sdk";
2
+ import type { BaseResponse } from "./utils/integration-response";
3
+ export interface UserRecord {
4
+ content: string;
5
+ role: "user";
6
+ }
7
+ export interface AssistantRecord {
8
+ content: string;
9
+ role: "assistant";
10
+ reasoningContent: string;
11
+ type: MessageType;
12
+ }
13
+ export type CreateRecordPairResponse = BaseResponse;
14
+ export interface ParticipantInfo {
15
+ id: string;
16
+ name: string;
17
+ desc: string;
18
+ avatar_url: string;
19
+ }
20
+ export interface GetHistoryMessagesData {
21
+ message_list: (UserRecord | AssistantRecord)[];
22
+ conversation_id: string;
23
+ participant_info_map: Record<string, ParticipantInfo>;
24
+ next_cursor: number;
25
+ has_more: boolean;
26
+ }
27
+ export type GetHistoryMessagesResponse = BaseResponse<GetHistoryMessagesData>;
28
+ export interface Conversation {
29
+ id: string;
30
+ createAt: string;
31
+ }
32
+ export interface GetConversationsData {
33
+ conversations: Conversation[];
34
+ }
35
+ export type GetConversationsResponse = BaseResponse<GetConversationsData>;
36
+ export type ChatRecordBase = {};
37
+ export interface GetChatRecordsOutput {
38
+ recordList: ChatRecordBase[];
39
+ total: number;
40
+ }
41
+ export interface UserProfile {
42
+ tags?: string[];
43
+ preferences?: Record<string, any>;
44
+ }
45
+ export interface LoneMemoryRecord extends ChatRecordBase {
46
+ userProfile?: UserProfile;
47
+ }
48
+ export interface GetLoneMemoryOutput {
49
+ recordList: LoneMemoryRecord[];
50
+ total: number;
51
+ }
52
+ export interface KnowledgeResultMetaData {
53
+ score: number;
54
+ source_type: string;
55
+ doc_type: string;
56
+ content_length: number;
57
+ }
58
+ export interface KnowledgeResult {
59
+ id: string;
60
+ content: string;
61
+ chunk_id: string;
62
+ meta_data: KnowledgeResultMetaData;
63
+ }
64
+ export interface KnowledgeSearchOutput {
65
+ knowledge_results: KnowledgeResult[];
66
+ total_tokens: number;
67
+ }
68
+ export type KnowledgeBaseRetrieveResponse = BaseResponse<KnowledgeSearchOutput>;
69
+ export interface AgentInfo {
70
+ agentId: string;
71
+ version: string;
72
+ desc: string;
73
+ }
74
+ export interface GetAgentInfoResponse {
75
+ code: number;
76
+ success: boolean;
77
+ msg: string;
78
+ data: {
79
+ agentInfo: AgentInfo;
80
+ };
81
+ }
@@ -0,0 +1,37 @@
1
+ import { type AI, type models } from "@vectorx/ai-sdk";
2
+ import { type RcbContext } from "@vectorx/functions-framework";
3
+ import type { CreateRecordPairResponse, GetAgentInfoResponse, GetConversationsResponse, GetHistoryMessagesResponse, KnowledgeBaseRetrieveResponse } from "./agent-types";
4
+ import { type CreateRecordPairParams, type GetHistoryMessagesParams, type KnowledgeSearchInput } from "./schema";
5
+ import { SSESender } from "./sse-sender";
6
+ export declare enum AgentType {
7
+ AI_SDK_REQUEST_START = "AI_SDK_REQUEST_START",
8
+ AI_SDK_REQUEST_SUCCESS = "AI_SDK_REQUEST_SUCCESS",
9
+ AI_SDK_REQUEST_ERROR = "AI_SDK_REQUEST_ERROR",
10
+ AI_SDK_CREATE_MODEL = "AI_SDK_CREATE_MODEL",
11
+ AI_SDK_CREATE_RECORD_PAIR = "AI_SDK_CREATE_RECORD_PAIR",
12
+ AI_SDK_GET_HISTORY_MESSAGES = "AI_SDK_GET_HISTORY_MESSAGES",
13
+ AI_SDK_GET_CONVERSATIONS = "AI_SDK_GET_CONVERSATIONS",
14
+ Ai_SDK_POST_KNOWLEDGE_BASE = "Ai_SDK_POST_KNOWLEDGE_BASE"
15
+ }
16
+ export declare enum AgentEventType {
17
+ FRAMEWORK_EVENT = "FRAMEWORK_EVENT",
18
+ HTTP_ACCESS = "HTTP_ACCESS"
19
+ }
20
+ export declare class AgentRuntime {
21
+ readonly context: RcbContext;
22
+ sseSender: SSESender<unknown>;
23
+ protected ai: AI;
24
+ protected request: RcbContext["request"];
25
+ protected logger: RcbContext["logger"];
26
+ get agentTag(): string;
27
+ get agentId(): string;
28
+ get version(): string;
29
+ constructor(context: RcbContext);
30
+ private createLoggedRequest;
31
+ protected createModel(modelName: models.ModelName): models.ReactModel;
32
+ protected createRecordPair(params: CreateRecordPairParams): Promise<CreateRecordPairResponse>;
33
+ protected getHistoryMessages(params: GetHistoryMessagesParams): Promise<GetHistoryMessagesResponse>;
34
+ protected getConversations(): Promise<GetConversationsResponse>;
35
+ getAgentInfo(): Promise<GetAgentInfoResponse>;
36
+ knowledgeBaseRetrieve(params: KnowledgeSearchInput): Promise<KnowledgeBaseRetrieveResponse>;
37
+ }
@@ -0,0 +1,6 @@
1
+ export declare const CODES: {
2
+ INVALID_HTTP_CONTEXT: string;
3
+ AGENT_API_NOT_FOUND: string;
4
+ AGENT_API_NOT_IMPLEMENTED: string;
5
+ AGENT_API_ERROR: string;
6
+ };
@@ -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";
@@ -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
+ desc?: string;
105
+ id?: string;
106
+ avatar_url?: string;
107
+ }, {
108
+ name?: string;
109
+ desc?: string;
110
+ id?: 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,4 @@
1
+ export * from "./message.schema";
2
+ export * from "./conversation.schema";
3
+ export * from "./memory.schema";
4
+ export * from "./knowledge.schema";