@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.
@@ -0,0 +1,32 @@
1
+ import type { EventEmitter } from "events";
2
+ import type { RcbContext, ServerSentEvent } from "@vectorx/functions-framework";
3
+ export type Primitive = number | string | boolean | undefined | null;
4
+ export type BufferLike = number | string | Buffer | ArrayBuffer | ArrayBufferView | DataView;
5
+ export declare namespace sse {
6
+ interface SseEvent<T = Primitive | object | Buffer> {
7
+ data: T;
8
+ comment?: string;
9
+ event?: string;
10
+ id?: string;
11
+ retry?: number;
12
+ }
13
+ type Event<T> = SseEvent<T> | string | Buffer;
14
+ interface IServerSentEvent extends EventEmitter {
15
+ closed: boolean;
16
+ setEncoder(encoder: TextEncoder): void;
17
+ send<T>(event: Event<T> | Event<T>[]): boolean;
18
+ end(msg: SseEvent): void;
19
+ on(event: "close", listener: () => void): this;
20
+ on(event: "error", listener: (errorEvent: SseEvent) => void): this;
21
+ }
22
+ }
23
+ export declare class SSESender<T> {
24
+ readonly context: RcbContext;
25
+ private _status;
26
+ private _sse;
27
+ get status(): "initial" | "started" | "ended";
28
+ constructor(context: RcbContext);
29
+ get sse(): ServerSentEvent;
30
+ send(data: sse.Event<T>): void;
31
+ end(): void;
32
+ }
@@ -0,0 +1,71 @@
1
+ import type { SSESender } from "./sse-sender";
2
+ export interface SendMessageInput {
3
+ msg: string;
4
+ history?: {
5
+ role: "user" | "assistant";
6
+ content: string;
7
+ }[];
8
+ searchEnable?: boolean;
9
+ }
10
+ export interface GetLoneMemoryInput {
11
+ userId: string;
12
+ limit?: number;
13
+ filter?: {
14
+ startTime?: number;
15
+ endTime?: number;
16
+ type?: string;
17
+ };
18
+ }
19
+ export interface KnowledgeSearchInput {
20
+ collectionView: string;
21
+ search: {
22
+ content: string;
23
+ documentSetName?: string[];
24
+ options?: {
25
+ chunkExpand?: number[];
26
+ filter?: string;
27
+ limit?: number;
28
+ };
29
+ };
30
+ }
31
+ export interface UserProfile {
32
+ tags?: string[];
33
+ preferences?: Record<string, any>;
34
+ }
35
+ export interface DocumentSet {
36
+ documentSetId: string;
37
+ documentSetName: string;
38
+ author: string;
39
+ fileTitle: string;
40
+ fileMetaData: string;
41
+ }
42
+ export interface DocumentData {
43
+ text: string;
44
+ startPos: number;
45
+ endPos: number;
46
+ pre: string[];
47
+ next: string[];
48
+ paragraphTitle: string;
49
+ allParentParagraphTitles: string[];
50
+ documentSet: DocumentSet;
51
+ }
52
+ export interface KnowledgeSearchResult {
53
+ score: number;
54
+ data: DocumentData;
55
+ }
56
+ export interface KnowledgeSearchResponse {
57
+ data: {
58
+ documents: KnowledgeSearchResult[];
59
+ requestId: string;
60
+ };
61
+ }
62
+ export interface ErrorResponse {
63
+ code: string;
64
+ message: string;
65
+ requestId: string;
66
+ }
67
+ export type AgentCoreSseSender = SSESender<{
68
+ content: string;
69
+ [key: string]: unknown;
70
+ }>;
71
+ export type PickRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
@@ -0,0 +1,8 @@
1
+ import type { RcbContext } from "@vectorx/functions-framework";
2
+ import queryString from "query-string";
3
+ export declare function parseAgentId(url: string): string;
4
+ export declare function parseAgentTag(url: string): string;
5
+ export declare function parseApiName(url: string): string;
6
+ export declare function parseQueryFromCtx(ctx: RcbContext): queryString.ParsedQuery<string | boolean>;
7
+ export declare function genRecordId(): string;
8
+ export declare function genRandomStr(length: number): string;
@@ -0,0 +1 @@
1
+ export * from "./agent-helper";
@@ -0,0 +1,20 @@
1
+ export interface IntegrationResponse {
2
+ statusCode: number;
3
+ headers: Record<string, string>;
4
+ body: {
5
+ code: string;
6
+ message: string;
7
+ };
8
+ }
9
+ export interface ErrorResponse {
10
+ code: string;
11
+ message: string;
12
+ requestId: string;
13
+ }
14
+ export interface BaseResponse<T = any> {
15
+ code: number;
16
+ msg: string;
17
+ data?: T;
18
+ }
19
+ export declare function createIntegrationResponse(statusCode: number, code: string, message: string): IntegrationResponse;
20
+ export declare const OK_MESSAGE = "OK";