@drax/ai-back 3.28.0 → 3.31.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/dist/agents/ChatbotTaskService.js +143 -0
- package/dist/agents/ChatbotTaskTools.js +756 -0
- package/dist/agents/DraxAgent.js +450 -0
- package/dist/controllers/AgentSessionController.js +18 -0
- package/dist/controllers/DraxAgentController.js +114 -0
- package/dist/factory/services/AgentSessionServiceFactory.js +30 -0
- package/dist/index.js +15 -1
- package/dist/interfaces/IAgentSession.js +1 -0
- package/dist/interfaces/IAgentSessionRepository.js +1 -0
- package/dist/interfaces/IBuilderTool.js +1 -0
- package/dist/interfaces/IDraxAgent.js +1 -0
- package/dist/interfaces/IDraxAgentController.js +1 -0
- package/dist/interfaces/IDraxAgentRoutes.js +1 -0
- package/dist/models/AgentSessionModel.js +31 -0
- package/dist/permissions/AgentPermissions.js +6 -0
- package/dist/permissions/AgentSessionPermissions.js +10 -0
- package/dist/repository/mongo/AgentSessionMongoRepository.js +13 -0
- package/dist/repository/sqlite/AgentSessionSqliteRepository.js +34 -0
- package/dist/routes/AgentSessionRoutes.js +21 -0
- package/dist/routes/ChatbotTaskRoutes.js +8 -0
- package/dist/routes/DraxAgentRoutes.js +9 -0
- package/dist/schemas/AgentSessionSchema.js +25 -0
- package/dist/services/AgentSessionService.js +9 -0
- package/dist/tools/BuilderTool.js +248 -0
- package/dist/tools/ToolBuilder.js +243 -0
- package/package.json +4 -4
- package/src/agents/DraxAgent.ts +574 -0
- package/src/controllers/AgentSessionController.ts +29 -0
- package/src/controllers/DraxAgentController.ts +135 -0
- package/src/factory/services/AgentSessionServiceFactory.ts +41 -0
- package/src/index.ts +58 -1
- package/src/interfaces/IAIProvider.ts +8 -0
- package/src/interfaces/IAgentSession.ts +44 -0
- package/src/interfaces/IAgentSessionRepository.ts +11 -0
- package/src/interfaces/IBuilderTool.ts +51 -0
- package/src/interfaces/IDraxAgent.ts +108 -0
- package/src/interfaces/IDraxAgentController.ts +5 -0
- package/src/interfaces/IDraxAgentRoutes.ts +7 -0
- package/src/models/AgentSessionModel.ts +46 -0
- package/src/permissions/AgentPermissions.ts +10 -0
- package/src/permissions/AgentSessionPermissions.ts +14 -0
- package/src/repository/mongo/AgentSessionMongoRepository.ts +22 -0
- package/src/repository/sqlite/AgentSessionSqliteRepository.ts +42 -0
- package/src/routes/AgentSessionRoutes.ts +38 -0
- package/src/routes/DraxAgentRoutes.ts +12 -0
- package/src/schemas/AgentSessionSchema.ts +30 -0
- package/src/services/AgentSessionService.ts +20 -0
- package/src/tools/BuilderTool.ts +289 -0
- package/test/DraxAgent.test.ts +221 -0
- package/test/ToolBuilder.test.ts +90 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types/agents/ChatbotTaskService.d.ts +42 -0
- package/types/agents/ChatbotTaskService.d.ts.map +1 -0
- package/types/agents/ChatbotTaskTools.d.ts +54 -0
- package/types/agents/ChatbotTaskTools.d.ts.map +1 -0
- package/types/agents/DraxAgent.d.ts +55 -0
- package/types/agents/DraxAgent.d.ts.map +1 -0
- package/types/controllers/AgentSessionController.d.ts +8 -0
- package/types/controllers/AgentSessionController.d.ts.map +1 -0
- package/types/controllers/DraxAgentController.d.ts +16 -0
- package/types/controllers/DraxAgentController.d.ts.map +1 -0
- package/types/factory/services/AgentSessionServiceFactory.d.ts +8 -0
- package/types/factory/services/AgentSessionServiceFactory.d.ts.map +1 -0
- package/types/index.d.ts +14 -2
- package/types/index.d.ts.map +1 -1
- package/types/interfaces/IAIProvider.d.ts +7 -1
- package/types/interfaces/IAIProvider.d.ts.map +1 -1
- package/types/interfaces/IAgentSession.d.ts +39 -0
- package/types/interfaces/IAgentSession.d.ts.map +1 -0
- package/types/interfaces/IAgentSessionRepository.d.ts +6 -0
- package/types/interfaces/IAgentSessionRepository.d.ts.map +1 -0
- package/types/interfaces/IBuilderTool.d.ts +26 -0
- package/types/interfaces/IBuilderTool.d.ts.map +1 -0
- package/types/interfaces/IDraxAgent.d.ts +74 -0
- package/types/interfaces/IDraxAgent.d.ts.map +1 -0
- package/types/interfaces/IDraxAgentController.d.ts +5 -0
- package/types/interfaces/IDraxAgentController.d.ts.map +1 -0
- package/types/interfaces/IDraxAgentRoutes.d.ts +6 -0
- package/types/interfaces/IDraxAgentRoutes.d.ts.map +1 -0
- package/types/models/AgentSessionModel.d.ts +15 -0
- package/types/models/AgentSessionModel.d.ts.map +1 -0
- package/types/permissions/AgentPermissions.d.ts +6 -0
- package/types/permissions/AgentPermissions.d.ts.map +1 -0
- package/types/permissions/AgentSessionPermissions.d.ts +10 -0
- package/types/permissions/AgentSessionPermissions.d.ts.map +1 -0
- package/types/repository/mongo/AgentSessionMongoRepository.d.ts +9 -0
- package/types/repository/mongo/AgentSessionMongoRepository.d.ts.map +1 -0
- package/types/repository/sqlite/AgentSessionSqliteRepository.d.ts +23 -0
- package/types/repository/sqlite/AgentSessionSqliteRepository.d.ts.map +1 -0
- package/types/routes/AgentSessionRoutes.d.ts +4 -0
- package/types/routes/AgentSessionRoutes.d.ts.map +1 -0
- package/types/routes/ChatbotTaskRoutes.d.ts +4 -0
- package/types/routes/ChatbotTaskRoutes.d.ts.map +1 -0
- package/types/routes/DraxAgentRoutes.d.ts +4 -0
- package/types/routes/DraxAgentRoutes.d.ts.map +1 -0
- package/types/schemas/AgentSessionSchema.d.ts +51 -0
- package/types/schemas/AgentSessionSchema.d.ts.map +1 -0
- package/types/services/AgentSessionService.d.ts +10 -0
- package/types/services/AgentSessionService.d.ts.map +1 -0
- package/types/tools/BuilderTool.d.ts +35 -0
- package/types/tools/BuilderTool.d.ts.map +1 -0
- package/types/tools/ToolBuilder.d.ts +47 -0
- package/types/tools/ToolBuilder.d.ts.map +1 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
type ChatRole = "user" | "assistant" | "system";
|
|
2
|
+
interface ChatMessage {
|
|
3
|
+
role: ChatRole;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
interface ChatbotTaskMessageInput {
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
tenantId?: string | null;
|
|
11
|
+
ip?: string;
|
|
12
|
+
userAgent?: string;
|
|
13
|
+
}
|
|
14
|
+
interface ChatbotTaskMessageOutput {
|
|
15
|
+
sessionId: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
interface ChatbotTaskSession {
|
|
19
|
+
id: string;
|
|
20
|
+
userId: string;
|
|
21
|
+
messages: ChatMessage[];
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
}
|
|
25
|
+
declare class ChatbotTaskService {
|
|
26
|
+
private sessions;
|
|
27
|
+
startSession(userId: string): ChatbotTaskSession;
|
|
28
|
+
private createSession;
|
|
29
|
+
sendMessage(input: ChatbotTaskMessageInput): Promise<ChatbotTaskMessageOutput>;
|
|
30
|
+
private resolveSession;
|
|
31
|
+
private getSessionKey;
|
|
32
|
+
private normalizeOutput;
|
|
33
|
+
private withToolExecutionLogs;
|
|
34
|
+
private systemPrompt;
|
|
35
|
+
private formatTaskOptionNames;
|
|
36
|
+
private formatEntityTypeOptionNames;
|
|
37
|
+
private formatOptionList;
|
|
38
|
+
}
|
|
39
|
+
export type { ChatbotTaskMessageInput, ChatbotTaskMessageOutput, ChatbotTaskSession };
|
|
40
|
+
export default ChatbotTaskService;
|
|
41
|
+
export { ChatbotTaskService };
|
|
42
|
+
//# sourceMappingURL=ChatbotTaskService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatbotTaskService.d.ts","sourceRoot":"","sources":["../../src/agents/ChatbotTaskService.ts"],"names":[],"mappings":"AAMA,KAAK,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEhD,UAAU,WAAW;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,uBAAuB;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,wBAAwB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,kBAAkB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACnB;AAED,cAAM,kBAAkB;IACpB,OAAO,CAAC,QAAQ,CAA8C;IAE9D,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB;IAIhD,OAAO,CAAC,aAAa;IAaf,WAAW,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAmCpF,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,qBAAqB;IAgC7B,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,gBAAgB;CAG3B;AAED,YAAY,EAAC,uBAAuB,EAAE,wBAAwB,EAAE,kBAAkB,EAAC,CAAC;AACpF,eAAe,kBAAkB,CAAC;AAClC,OAAO,EAAC,kBAAkB,EAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { IPromptTool } from "@drax/ai-back/types/interfaces/IAIProvider.js";
|
|
2
|
+
interface ChatbotTaskToolsContext {
|
|
3
|
+
userId: string;
|
|
4
|
+
}
|
|
5
|
+
interface TaskOptionNames {
|
|
6
|
+
sources: string[];
|
|
7
|
+
statuses: string[];
|
|
8
|
+
types: string[];
|
|
9
|
+
priorities: string[];
|
|
10
|
+
}
|
|
11
|
+
interface EntityTypeOptionNames {
|
|
12
|
+
contactTypes: string[];
|
|
13
|
+
companyTypes: string[];
|
|
14
|
+
clientTypes: string[];
|
|
15
|
+
}
|
|
16
|
+
interface LifeOpsOptionNames {
|
|
17
|
+
task: TaskOptionNames;
|
|
18
|
+
entityTypes: EntityTypeOptionNames;
|
|
19
|
+
}
|
|
20
|
+
declare class ChatbotTaskTools {
|
|
21
|
+
static build(context: ChatbotTaskToolsContext): IPromptTool[];
|
|
22
|
+
static fetchTaskOptionNames(): Promise<TaskOptionNames>;
|
|
23
|
+
static fetchLifeOpsOptionNames(): Promise<LifeOpsOptionNames>;
|
|
24
|
+
private static taskUserFilter;
|
|
25
|
+
private static compactObject;
|
|
26
|
+
private static serializeOptionNames;
|
|
27
|
+
private static serializeTask;
|
|
28
|
+
private static entityUserFilter;
|
|
29
|
+
private static serializeGoal;
|
|
30
|
+
private static serializeProject;
|
|
31
|
+
private static serializeContact;
|
|
32
|
+
private static serializeClient;
|
|
33
|
+
private static serializeCompany;
|
|
34
|
+
private static serializeFields;
|
|
35
|
+
private static findUserTaskById;
|
|
36
|
+
private static findUserEntityById;
|
|
37
|
+
private static buildEntityTools;
|
|
38
|
+
private static entityConfigs;
|
|
39
|
+
private static createEntityTool;
|
|
40
|
+
private static searchEntitiesTool;
|
|
41
|
+
private static findEntityByIdTool;
|
|
42
|
+
private static updateEntityPartialTool;
|
|
43
|
+
private static registerTaskTool;
|
|
44
|
+
private static searchTasksTool;
|
|
45
|
+
private static findTaskByIdTool;
|
|
46
|
+
private static groupTasksTool;
|
|
47
|
+
private static updateTaskPartialTool;
|
|
48
|
+
private static listTaskOptionsTool;
|
|
49
|
+
private static createTaskOptionTool;
|
|
50
|
+
}
|
|
51
|
+
export type { ChatbotTaskToolsContext, TaskOptionNames, EntityTypeOptionNames, LifeOpsOptionNames };
|
|
52
|
+
export default ChatbotTaskTools;
|
|
53
|
+
export { ChatbotTaskTools };
|
|
54
|
+
//# sourceMappingURL=ChatbotTaskTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatbotTaskTools.d.ts","sourceRoot":"","sources":["../../src/agents/ChatbotTaskTools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,+CAA+C,CAAC;AAe/E,UAAU,uBAAuB;IAC7B,MAAM,EAAE,MAAM,CAAC;CAClB;AA4BD,UAAU,eAAe;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,UAAU,qBAAqB;IAC3B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,UAAU,kBAAkB;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,EAAE,qBAAqB,CAAC;CACtC;AAYD,cAAM,gBAAgB;IAClB,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,uBAAuB,GAAG,WAAW,EAAE;WAgBhD,oBAAoB,IAAI,OAAO,CAAC,eAAe,CAAC;WAgBhD,uBAAuB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAkBnE,OAAO,CAAC,MAAM,CAAC,cAAc;IAI7B,OAAO,CAAC,MAAM,CAAC,aAAa;IAM5B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAMnC,OAAO,CAAC,MAAM,CAAC,aAAa;IA0B5B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAI/B,OAAO,CAAC,MAAM,CAAC,aAAa;IAQ5B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAQ/B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAQ/B,OAAO,CAAC,MAAM,CAAC,eAAe;IAQ9B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAO/B,OAAO,CAAC,MAAM,CAAC,eAAe;mBAQT,gBAAgB;mBAKhB,kBAAkB;IAIvC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,OAAO,CAAC,MAAM,CAAC,aAAa;IAqN5B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAqB/B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAsCjC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAmBjC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAgCtC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyD/B,OAAO,CAAC,MAAM,CAAC,eAAe;IAsC9B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAmB/B,OAAO,CAAC,MAAM,CAAC,cAAc;IA4D7B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAkDpC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAelC,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAkDtC;AAED,YAAY,EAAC,uBAAuB,EAAE,eAAe,EAAE,qBAAqB,EAAE,kBAAkB,EAAC,CAAC;AAClG,eAAe,gBAAgB,CAAC;AAChC,OAAO,EAAC,gBAAgB,EAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { IPromptTool, IPromptToolNavigation } from "../interfaces/IAIProvider.js";
|
|
2
|
+
import type { DraxAgentConfig, DraxAgentMessageInput, DraxAgentMessageOutput, DraxAgentPromptContext, DraxAgentSession, DraxAgentSessionInput, DraxAgentSystemPrompt, DraxAgentToolBuilder, DraxAgentToolBuilderSource, DraxAgentToolSource } from "../interfaces/IDraxAgent.js";
|
|
3
|
+
import type { IPromptMessage } from "../interfaces/IAIProvider.js";
|
|
4
|
+
import type { IAgentSession, IAgentSessionBase } from "../interfaces/IAgentSession.js";
|
|
5
|
+
import type { AgentSessionService } from "../services/AgentSessionService.js";
|
|
6
|
+
declare class DraxAgent {
|
|
7
|
+
private static singleton?;
|
|
8
|
+
protected sessions: Map<string, DraxAgentSession>;
|
|
9
|
+
protected config: DraxAgentConfig;
|
|
10
|
+
private constructor();
|
|
11
|
+
static instance(): DraxAgent;
|
|
12
|
+
configure(config: DraxAgentConfig): this;
|
|
13
|
+
setProvider(provider: DraxAgentConfig["provider"]): this;
|
|
14
|
+
setSystemPrompt(systemPrompt: DraxAgentSystemPrompt): this;
|
|
15
|
+
setToolBuilders(toolBuilders: DraxAgentToolBuilderSource): this;
|
|
16
|
+
setTools(tools: DraxAgentToolSource): this;
|
|
17
|
+
clearSessions(): this;
|
|
18
|
+
startSession(input?: DraxAgentSessionInput): Promise<DraxAgentSession>;
|
|
19
|
+
getSession(input: DraxAgentSessionInput): DraxAgentSession | null;
|
|
20
|
+
sendMessage(input: DraxAgentMessageInput): Promise<DraxAgentMessageOutput>;
|
|
21
|
+
protected createSession(input?: DraxAgentSessionInput): Promise<DraxAgentSession>;
|
|
22
|
+
protected resolveSession(input: DraxAgentSessionInput): Promise<DraxAgentSession>;
|
|
23
|
+
protected persistSessionCreate(session: DraxAgentSession): Promise<void>;
|
|
24
|
+
protected persistSessionUpdate(session: DraxAgentSession, usage: Pick<IAgentSessionBase, "lastMessageAt" | "tokens" | "inputTokens" | "outputTokens">): Promise<void>;
|
|
25
|
+
protected buildSessionPayload(session: DraxAgentSession, overrides?: Partial<IAgentSessionBase>): IAgentSessionBase;
|
|
26
|
+
protected findPersistedSession(input: DraxAgentSessionInput): Promise<IAgentSession | null>;
|
|
27
|
+
protected hydrateSession(record: IAgentSession, input: DraxAgentSessionInput): DraxAgentSession;
|
|
28
|
+
protected normalizeStoredMessages(messages: IAgentSessionBase["messages"]): IPromptMessage[];
|
|
29
|
+
protected resolveStoredUsage(recordId: string): Promise<Required<Pick<IAgentSessionBase, "inputTokens" | "outputTokens" | "tokens">>>;
|
|
30
|
+
protected normalizeNumber(value: any): number;
|
|
31
|
+
protected resolveSessionTitle(messages: IPromptMessage[]): string | undefined;
|
|
32
|
+
protected stringifyMessageContent(content: IPromptMessage["content"]): string;
|
|
33
|
+
protected stringifyRecordId(record: IAgentSession | null | undefined): string | null;
|
|
34
|
+
protected stringifyRelationId(value: any): string | null;
|
|
35
|
+
protected getSessionService(): AgentSessionService | null;
|
|
36
|
+
protected getSessionKey(userId: string | null | undefined, tenantId: string | null | undefined, sessionId: string): string;
|
|
37
|
+
protected buildSystemPrompt(context: DraxAgentPromptContext, toolBuilders: DraxAgentToolBuilder[]): Promise<string>;
|
|
38
|
+
protected buildRbacContextSection(context: DraxAgentPromptContext): string;
|
|
39
|
+
protected resolveToolBuilders(context: DraxAgentPromptContext): Promise<DraxAgentToolBuilder[]>;
|
|
40
|
+
protected resolveTools(context: DraxAgentPromptContext): Promise<IPromptTool[]>;
|
|
41
|
+
protected prepareTools(tools: IPromptTool[], sessionId: string, navigationState: {
|
|
42
|
+
path: string | null;
|
|
43
|
+
}): IPromptTool[];
|
|
44
|
+
protected resolveNavigationPath(navigation: IPromptToolNavigation | undefined, args: any, result: any): string | null;
|
|
45
|
+
protected resolveNavigationMode(method: string): "edit" | "view" | null;
|
|
46
|
+
protected resolveNavigationId(method: string, args: any, result: any): string | null;
|
|
47
|
+
protected extractRecordId(result: any): string | null;
|
|
48
|
+
protected resolveSingleRecord(result: any): any;
|
|
49
|
+
protected stringifyNavigationId(id: any): string | null;
|
|
50
|
+
protected normalizeOutput(output: any): string;
|
|
51
|
+
protected getProvider(): import("../interfaces/IAIProvider.js").IAIProvider;
|
|
52
|
+
}
|
|
53
|
+
export default DraxAgent;
|
|
54
|
+
export { DraxAgent };
|
|
55
|
+
//# sourceMappingURL=DraxAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraxAgent.d.ts","sourceRoot":"","sources":["../../src/agents/DraxAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAE,qBAAqB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AAE,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;IAiBvD,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM;IAgB9C,SAAS,CAAC,WAAW;CAOxB;AAED,eAAe,SAAS,CAAC;AACzB,OAAO,EAAC,SAAS,EAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AbstractFastifyController } from "@drax/crud-back";
|
|
2
|
+
import type { IAgentSession, IAgentSessionBase } from "../interfaces/IAgentSession";
|
|
3
|
+
declare class AgentSessionController extends AbstractFastifyController<IAgentSession, IAgentSessionBase, IAgentSessionBase> {
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
export default AgentSessionController;
|
|
7
|
+
export { AgentSessionController };
|
|
8
|
+
//# sourceMappingURL=AgentSessionController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSessionController.d.ts","sourceRoot":"","sources":["../../src/controllers/AgentSessionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,yBAAyB,EAAC,MAAM,iBAAiB,CAAC;AAE1D,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAElF,cAAM,sBAAuB,SAAQ,yBAAyB,CAAC,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;;CAgBlH;AAED,eAAe,sBAAsB,CAAC;AACtC,OAAO,EACH,sBAAsB,EACzB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CommonController } from "@drax/common-back";
|
|
2
|
+
import { DraxAgent } from "../agents/DraxAgent.js";
|
|
3
|
+
declare class DraxAgentController extends CommonController {
|
|
4
|
+
protected agent: DraxAgent;
|
|
5
|
+
protected permission: string | false;
|
|
6
|
+
constructor();
|
|
7
|
+
startSession(request: any, reply: any): Promise<any>;
|
|
8
|
+
message(request: any, reply: any): Promise<any>;
|
|
9
|
+
protected assertAccess(request: any): void;
|
|
10
|
+
protected resolveUserId(request: any, userId?: string | null): any;
|
|
11
|
+
protected resolveTenantId(request: any, tenantId?: string | null): any;
|
|
12
|
+
protected handleControllerError(e: any, reply: any): any;
|
|
13
|
+
}
|
|
14
|
+
export default DraxAgentController;
|
|
15
|
+
export { DraxAgentController };
|
|
16
|
+
//# sourceMappingURL=DraxAgentController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraxAgentController.d.ts","sourceRoot":"","sources":["../../src/controllers/DraxAgentController.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AAsDjD,cAAM,mBAAoB,SAAQ,gBAAgB;IAC9C,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;;IAQ/B,YAAY,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAqB3B,OAAO,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAmB5B,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG;IAQnC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAI5D,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAIhE,SAAS,CAAC,qBAAqB,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;CASrD;AAED,eAAe,mBAAmB,CAAC;AACnC,OAAO,EAAC,mBAAmB,EAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AgentSessionService } from '../../services/AgentSessionService.js';
|
|
2
|
+
declare class AgentSessionServiceFactory {
|
|
3
|
+
private static service;
|
|
4
|
+
static get instance(): AgentSessionService;
|
|
5
|
+
}
|
|
6
|
+
export default AgentSessionServiceFactory;
|
|
7
|
+
export { AgentSessionServiceFactory };
|
|
8
|
+
//# sourceMappingURL=AgentSessionServiceFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSessionServiceFactory.d.ts","sourceRoot":"","sources":["../../../src/factory/services/AgentSessionServiceFactory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,mBAAmB,EAAC,MAAM,uCAAuC,CAAA;AAIzE,cAAM,0BAA0B;IAC5B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAsB;IAE5C,WAAkB,QAAQ,IAAI,mBAAmB,CAsBhD;CACJ;AAED,eAAe,0BAA0B,CAAA;AACzC,OAAO,EACH,0BAA0B,EAC7B,CAAA"}
|
package/types/index.d.ts
CHANGED
|
@@ -7,17 +7,29 @@ import { OpenAiProviderFactory } from "./factory/OpenAiProviderFactory.js";
|
|
|
7
7
|
import { AiProviderFactory } from "./factory/AiProviderFactory.js";
|
|
8
8
|
import AILogServiceFactory from "./factory/services/AILogServiceFactory.js";
|
|
9
9
|
import { OpenAiProvider } from "./providers/OpenAiProvider.js";
|
|
10
|
+
import { BuilderTool } from "./tools/BuilderTool.js";
|
|
10
11
|
import { KnowledgeService } from "./services/KnowledgeService.js";
|
|
11
12
|
import { AILogService } from "./services/AILogService.js";
|
|
12
13
|
import AILogPermissions from "./permissions/AILogPermissions.js";
|
|
14
|
+
import AgentPermissions from "./permissions/AgentPermissions.js";
|
|
15
|
+
import AgentSessionPermissions from "./permissions/AgentSessionPermissions.js";
|
|
13
16
|
import AIPermissions from "./permissions/AIPermissions.js";
|
|
14
17
|
import AILogController from "./controllers/AILogController.js";
|
|
15
18
|
import AICrudController from "./controllers/AICrudController.js";
|
|
16
19
|
import AIGenericController from "./controllers/AIGenericController.js";
|
|
20
|
+
import DraxAgentController from "./controllers/DraxAgentController.js";
|
|
21
|
+
import AgentSessionController from "./controllers/AgentSessionController.js";
|
|
17
22
|
import AILogRoutes from "./routes/AILogRoutes.js";
|
|
18
23
|
import AIRoutes from "./routes/AIRoutes.js";
|
|
24
|
+
import DraxAgentRoutes from "./routes/DraxAgentRoutes.js";
|
|
25
|
+
import AgentSessionRoutes from "./routes/AgentSessionRoutes.js";
|
|
26
|
+
import { DraxAgent } from "./agents/DraxAgent.js";
|
|
19
27
|
import type { IAILogRepository } from "./interfaces/IAILogRepository.js";
|
|
20
28
|
import type { IAIProvider, IPromptContentPart, IPromptContentPartImage, IPromptContentPartText, IPromptImage, IPromptImageDetail, IPromptMessage, IPromptMemory, IPromptParams, IPromptResponse, IPromptTool } from "./interfaces/IAIProvider.js";
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
import type { ToolBuilderMethod, ToolBuilderOptions, ToolBuilderService } from "./interfaces/IBuilderTool.js";
|
|
30
|
+
import type { DraxAgentControllerOptions } from "./interfaces/IDraxAgentController.js";
|
|
31
|
+
import type { DraxAgentFastifyRoutesOptions } from "./interfaces/IDraxAgentRoutes.js";
|
|
32
|
+
import type { DraxAgentConfig, DraxAgentMessageInput, DraxAgentMessageOutput, DraxAgentPromptContext, DraxAgentSession, DraxAgentSessionInput, DraxAgentToolBuilder, DraxAgentToolBuilderSource, DraxAgentToolSource, DraxAgentSystemPrompt } from "./interfaces/IDraxAgent.js";
|
|
33
|
+
export type { IAILogRepository, IAIProvider, IPromptParams, IPromptMessage, IPromptMemory, IPromptTool, IPromptImage, IPromptImageDetail, IPromptContentPart, IPromptContentPartImage, IPromptContentPartText, IPromptResponse, ToolBuilderMethod, ToolBuilderOptions, ToolBuilderService, DraxAgentControllerOptions, DraxAgentFastifyRoutesOptions, DraxAgentConfig, DraxAgentMessageInput, DraxAgentMessageOutput, DraxAgentPromptContext, DraxAgentSession, DraxAgentSessionInput, DraxAgentToolBuilder, DraxAgentToolBuilderSource, DraxAgentToolSource, DraxAgentSystemPrompt, };
|
|
34
|
+
export { OpenAiConfig, AILogSchema, AILogBaseSchema, AILogModel, AILogMongoRepository, AILogSqliteRepository, OpenAiProviderFactory, AiProviderFactory, AILogServiceFactory, OpenAiProvider, BuilderTool, KnowledgeService, AILogService, AILogPermissions, AgentPermissions, AIPermissions, AgentSessionPermissions, AILogController, AICrudController, AIGenericController, DraxAgentController, AgentSessionController, DraxAgent, AILogRoutes, AIRoutes, DraxAgentRoutes, AgentSessionRoutes };
|
|
23
35
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,oBAAoB,MAAM,4CAA4C,CAAC;AAC9E,OAAO,qBAAqB,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACjE,OAAO,mBAAmB,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AACxD,OAAO,gBAAgB,MAAM,mCAAmC,CAAC;AACjE,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,eAAe,MAAM,kCAAkC,CAAC;AAC/D,OAAO,gBAAgB,MAAM,mCAAmC,CAAC;AACjE,OAAO,mBAAmB,MAAM,sCAAsC,CAAC;AACvE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MA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,EACH,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,WAAW,EAEX,gBAAgB,EAChB,YAAY,EAEZ,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EAEvB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,eAAe,EACf,kBAAkB,EACrB,CAAA"}
|
|
@@ -28,6 +28,12 @@ interface IPromptTool {
|
|
|
28
28
|
description: string;
|
|
29
29
|
parameters?: object;
|
|
30
30
|
execute: (args: any) => any | Promise<any>;
|
|
31
|
+
navigation?: IPromptToolNavigation;
|
|
32
|
+
}
|
|
33
|
+
interface IPromptToolNavigation {
|
|
34
|
+
entityName: string;
|
|
35
|
+
method: string;
|
|
36
|
+
basePath?: string;
|
|
31
37
|
}
|
|
32
38
|
interface IPromptParams {
|
|
33
39
|
systemPrompt: string;
|
|
@@ -68,5 +74,5 @@ interface IPromptResponse {
|
|
|
68
74
|
interface IAIProvider {
|
|
69
75
|
prompt(input: IPromptParams): Promise<IPromptResponse>;
|
|
70
76
|
}
|
|
71
|
-
export type { IAIProvider, IPromptParams, IPromptResponse, IPromptMessage, IPromptMemory, IPromptTool, IPromptImage, IPromptImageDetail, IPromptContentPart, IPromptContentPartImage, IPromptContentPartText, };
|
|
77
|
+
export type { IAIProvider, IPromptParams, IPromptResponse, IPromptMessage, IPromptMemory, IPromptTool, IPromptToolNavigation, IPromptImage, IPromptImageDetail, IPromptContentPart, IPromptContentPartImage, IPromptContentPartText, };
|
|
72
78
|
//# sourceMappingURL=IAIProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IAIProvider.d.ts","sourceRoot":"","sources":["../../src/interfaces/IAIProvider.ts"],"names":[],"mappings":"AAAA,O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|
|
|
1
|
+
interface IAgentSessionBase {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
lastMessageAt?: Date;
|
|
5
|
+
messages?: Array<{
|
|
6
|
+
role: string;
|
|
7
|
+
content: string;
|
|
8
|
+
createdAt?: Date;
|
|
9
|
+
}>;
|
|
10
|
+
messageCount?: number;
|
|
11
|
+
inputTokens?: number;
|
|
12
|
+
outputTokens?: number;
|
|
13
|
+
tokens?: number;
|
|
14
|
+
tenant?: any;
|
|
15
|
+
user?: any;
|
|
16
|
+
createdAt?: Date;
|
|
17
|
+
updatedAt?: Date;
|
|
18
|
+
}
|
|
19
|
+
interface IAgentSession {
|
|
20
|
+
_id: string;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
title?: string;
|
|
23
|
+
lastMessageAt?: Date;
|
|
24
|
+
messages?: Array<{
|
|
25
|
+
role: string;
|
|
26
|
+
content: string;
|
|
27
|
+
createdAt?: Date;
|
|
28
|
+
}>;
|
|
29
|
+
messageCount?: number;
|
|
30
|
+
inputTokens?: number;
|
|
31
|
+
outputTokens?: number;
|
|
32
|
+
tokens?: number;
|
|
33
|
+
tenant?: any;
|
|
34
|
+
user?: any;
|
|
35
|
+
createdAt?: Date;
|
|
36
|
+
updatedAt?: Date;
|
|
37
|
+
}
|
|
38
|
+
export type { IAgentSessionBase, IAgentSession };
|
|
39
|
+
//# sourceMappingURL=IAgentSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAgentSession.d.ts","sourceRoot":"","sources":["../../src/interfaces/IAgentSession.ts"],"names":[],"mappings":"AACA,UAAU,iBAAiB;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,IAAI,CAAA;KACf,CAAC,CAAA;IACF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,SAAS,CAAC,EAAE,IAAI,CAAA;CACnB;AAED,UAAU,aAAa;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,IAAI,CAAA;KACf,CAAC,CAAA;IACF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,SAAS,CAAC,EAAE,IAAI,CAAA;CACnB;AAED,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACZ,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IAgentSession, IAgentSessionBase } from './IAgentSession';
|
|
2
|
+
import { IDraxCrudRepository } from "@drax/crud-share";
|
|
3
|
+
interface IAgentSessionRepository extends IDraxCrudRepository<IAgentSession, IAgentSessionBase, IAgentSessionBase> {
|
|
4
|
+
}
|
|
5
|
+
export { IAgentSessionRepository };
|
|
6
|
+
//# sourceMappingURL=IAgentSessionRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAgentSessionRepository.d.ts","sourceRoot":"","sources":["../../src/interfaces/IAgentSessionRepository.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErD,UAAU,uBAAwB,SAAQ,mBAAmB,CAAC,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;CAEjH;AAED,OAAO,EAAC,uBAAuB,EAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IDraxCrudService } from "@drax/crud-share";
|
|
2
|
+
import type { ZodObject, ZodRawShape } from "zod";
|
|
3
|
+
type ToolBuilderMethod = "create" | "update" | "updatePartial" | "delete" | "findById" | "findByIds" | "findOneBy" | "findOne" | "findBy" | "fetchAll" | "search" | "find" | "paginate" | "groupBy";
|
|
4
|
+
type ToolBuilderService<T = any, C = any, U = any> = IDraxCrudService<T, C, U> & Record<string, any>;
|
|
5
|
+
interface ToolBuilderOptions<T = any, C = any, U = any> {
|
|
6
|
+
entityName: string;
|
|
7
|
+
entityDescription?: string;
|
|
8
|
+
navigationBasePath?: string;
|
|
9
|
+
schema: ZodObject<ZodRawShape>;
|
|
10
|
+
outputSchema?: ZodObject<ZodRawShape>;
|
|
11
|
+
service: ToolBuilderService<T, C, U>;
|
|
12
|
+
methods: ToolBuilderMethod[];
|
|
13
|
+
toolNamePrefix?: string;
|
|
14
|
+
}
|
|
15
|
+
interface ToolBuilderLike {
|
|
16
|
+
inputSchema: ZodObject<ZodRawShape>;
|
|
17
|
+
partialInputSchema: ZodObject<ZodRawShape>;
|
|
18
|
+
objectParameters(schema: ZodObject<ZodRawShape>): object;
|
|
19
|
+
}
|
|
20
|
+
interface ToolDefinition<T = any, C = any, U = any> {
|
|
21
|
+
description: (entityName: string) => string;
|
|
22
|
+
parameters: (builder: ToolBuilderLike) => object;
|
|
23
|
+
execute: (service: ToolBuilderService<T, C, U>, args: any) => any | Promise<any>;
|
|
24
|
+
}
|
|
25
|
+
export type { ToolBuilderLike, ToolBuilderMethod, ToolBuilderOptions, ToolBuilderService, ToolDefinition, };
|
|
26
|
+
//# sourceMappingURL=IBuilderTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IBuilderTool.d.ts","sourceRoot":"","sources":["../../src/interfaces/IBuilderTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,KAAK,CAAC;AAEhD,KAAK,iBAAiB,GAChB,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,QAAQ,GACR,UAAU,GACV,WAAW,GACX,WAAW,GACX,SAAS,GACT,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,MAAM,GACN,UAAU,GACV,SAAS,CAAC;AAEhB,KAAK,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAErG,UAAU,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,YAAY,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACrC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,UAAU,eAAe;IACrB,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACpC,kBAAkB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;CAC5D;AAED,UAAU,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IAC9C,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,UAAU,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,CAAC;IACjD,OAAO,EAAE,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACpF;AAED,YAAY,EACR,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACjB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IAIProvider, IPromptContentPart, IPromptImage, IPromptMemory, IPromptMessage, IPromptTool } from "./IAIProvider.js";
|
|
2
|
+
import type { AgentSessionService } from "../services/AgentSessionService.js";
|
|
3
|
+
type DraxAgentSystemPrompt = string | ((context: DraxAgentPromptContext) => string | Promise<string>);
|
|
4
|
+
type DraxAgentToolSource = IPromptTool[] | ((context: DraxAgentPromptContext) => IPromptTool[] | Promise<IPromptTool[]>);
|
|
5
|
+
interface DraxAgentToolBuilder {
|
|
6
|
+
getTools(): IPromptTool[];
|
|
7
|
+
getSystemPromptSection(): string;
|
|
8
|
+
}
|
|
9
|
+
type DraxAgentToolBuilderSource = DraxAgentToolBuilder[] | ((context: DraxAgentPromptContext) => DraxAgentToolBuilder[] | Promise<DraxAgentToolBuilder[]>);
|
|
10
|
+
interface DraxAgentConfig {
|
|
11
|
+
provider?: IAIProvider;
|
|
12
|
+
systemPrompt?: DraxAgentSystemPrompt;
|
|
13
|
+
toolBuilders?: DraxAgentToolBuilderSource;
|
|
14
|
+
tools?: DraxAgentToolSource;
|
|
15
|
+
historyLimit?: number;
|
|
16
|
+
toolMaxIterations?: number;
|
|
17
|
+
operationTitle?: string;
|
|
18
|
+
operationGroup?: string;
|
|
19
|
+
logToolExecution?: boolean;
|
|
20
|
+
normalizeOutput?: (output: any) => string;
|
|
21
|
+
sessionService?: AgentSessionService | false;
|
|
22
|
+
}
|
|
23
|
+
interface DraxAgentSessionInput {
|
|
24
|
+
sessionId?: string;
|
|
25
|
+
userId?: string | null;
|
|
26
|
+
tenantId?: string | null;
|
|
27
|
+
}
|
|
28
|
+
interface DraxAgentMessageInput extends DraxAgentSessionInput {
|
|
29
|
+
message: string;
|
|
30
|
+
ip?: string;
|
|
31
|
+
userAgent?: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
userImages?: IPromptImage[];
|
|
34
|
+
userContent?: IPromptContentPart[];
|
|
35
|
+
inputFiles?: Array<{
|
|
36
|
+
filename?: string;
|
|
37
|
+
filepath?: string;
|
|
38
|
+
size?: number | null;
|
|
39
|
+
mimetype?: string;
|
|
40
|
+
url?: string;
|
|
41
|
+
}>;
|
|
42
|
+
memory?: IPromptMemory[];
|
|
43
|
+
memoryHeader?: string;
|
|
44
|
+
knowledgeBase?: string[];
|
|
45
|
+
knowledgeBaseHeader?: string;
|
|
46
|
+
toolMaxIterations?: number;
|
|
47
|
+
operationTitle?: string;
|
|
48
|
+
operationGroup?: string;
|
|
49
|
+
}
|
|
50
|
+
interface DraxAgentMessageOutput {
|
|
51
|
+
sessionId: string;
|
|
52
|
+
message: string;
|
|
53
|
+
navigationPath?: string | null;
|
|
54
|
+
output: any;
|
|
55
|
+
tokens: number;
|
|
56
|
+
inputTokens: number;
|
|
57
|
+
outputTokens: number;
|
|
58
|
+
time: number;
|
|
59
|
+
}
|
|
60
|
+
interface DraxAgentSession {
|
|
61
|
+
id: string;
|
|
62
|
+
recordId?: string | null;
|
|
63
|
+
userId?: string | null;
|
|
64
|
+
tenantId?: string | null;
|
|
65
|
+
messages: IPromptMessage[];
|
|
66
|
+
createdAt: Date;
|
|
67
|
+
updatedAt: Date;
|
|
68
|
+
}
|
|
69
|
+
interface DraxAgentPromptContext {
|
|
70
|
+
session: DraxAgentSession;
|
|
71
|
+
input?: DraxAgentMessageInput;
|
|
72
|
+
}
|
|
73
|
+
export type { DraxAgentConfig, DraxAgentMessageInput, DraxAgentMessageOutput, DraxAgentPromptContext, DraxAgentSession, DraxAgentSessionInput, DraxAgentSystemPrompt, DraxAgentToolBuilder, DraxAgentToolBuilderSource, DraxAgentToolSource, };
|
|
74
|
+
//# sourceMappingURL=IDraxAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDraxAgent.d.ts","sourceRoot":"","sources":["../../src/interfaces/IDraxAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAE5E,KAAK,qBAAqB,GACpB,MAAM,GACN,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAEtE,KAAK,mBAAmB,GAClB,WAAW,EAAE,GACb,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AAEpF,UAAU,oBAAoB;IAC1B,QAAQ,IAAI,WAAW,EAAE,CAAC;IAC1B,sBAAsB,IAAI,MAAM,CAAC;CACpC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
|
+
{"version":3,"file":"IDraxAgentController.d.ts","sourceRoot":"","sources":["../../src/interfaces/IDraxAgentController.ts"],"names":[],"mappings":"AAAA,UAAU,0BAA0B;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC/B;AAED,YAAY,EAAC,0BAA0B,EAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DraxAgentControllerOptions } from "./IDraxAgentController.js";
|
|
2
|
+
interface DraxAgentFastifyRoutesOptions extends DraxAgentControllerOptions {
|
|
3
|
+
prefix?: string;
|
|
4
|
+
}
|
|
5
|
+
export type { DraxAgentFastifyRoutesOptions };
|
|
6
|
+
//# sourceMappingURL=IDraxAgentRoutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDraxAgentRoutes.d.ts","sourceRoot":"","sources":["../../src/interfaces/IDraxAgentRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,0BAA0B,EAAC,MAAM,2BAA2B,CAAC;AAE1E,UAAU,6BAA8B,SAAQ,0BAA0B;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,YAAY,EAAC,6BAA6B,EAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { mongoose } from '@drax/common-back';
|
|
2
|
+
import type { IAgentSession } from '../interfaces/IAgentSession';
|
|
3
|
+
declare const AgentSessionSchema: mongoose.Schema<IAgentSession, mongoose.Model<IAgentSession, any, any, any, mongoose.Document<unknown, any, IAgentSession, any, {}> & IAgentSession & Required<{
|
|
4
|
+
_id: string;
|
|
5
|
+
}> & {
|
|
6
|
+
__v: number;
|
|
7
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAgentSession, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAgentSession>, {}, mongoose.DefaultSchemaOptions> & mongoose.FlatRecord<IAgentSession> & Required<{
|
|
8
|
+
_id: string;
|
|
9
|
+
}> & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}>;
|
|
12
|
+
declare const AgentSessionModel: mongoose.PaginateModel<IAgentSession, {}, {}>;
|
|
13
|
+
export { AgentSessionSchema, AgentSessionModel };
|
|
14
|
+
export default AgentSessionModel;
|
|
15
|
+
//# sourceMappingURL=AgentSessionModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSessionModel.d.ts","sourceRoot":"","sources":["../../src/models/AgentSessionModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAI3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAA;AAE9D,QAAA,MAAM,kBAAkB;;;;;;;;EAeF,CAAC;AAgBvB,QAAA,MAAM,iBAAiB,+CAA8G,CAAC;AAEtI,OAAO,EACH,kBAAkB,EAClB,iBAAiB,EACpB,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentPermissions.d.ts","sourceRoot":"","sources":["../../src/permissions/AgentPermissions.ts"],"names":[],"mappings":"AACA,aAAK,gBAAgB;IAEjB,OAAO,kBAAkB;CAE5B;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare enum AgentSessionPermissions {
|
|
2
|
+
Create = "agentsession:create",
|
|
3
|
+
Update = "agentsession:update",
|
|
4
|
+
Delete = "agentsession:delete",
|
|
5
|
+
View = "agentsession:view",
|
|
6
|
+
Manage = "agentsession:manage"
|
|
7
|
+
}
|
|
8
|
+
export { AgentSessionPermissions };
|
|
9
|
+
export default AgentSessionPermissions;
|
|
10
|
+
//# sourceMappingURL=AgentSessionPermissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSessionPermissions.d.ts","sourceRoot":"","sources":["../../src/permissions/AgentSessionPermissions.ts"],"names":[],"mappings":"AACA,aAAK,uBAAuB;IAExB,MAAM,wBAAwB;IAC9B,MAAM,wBAAwB;IAC9B,MAAM,wBAAwB;IAC9B,IAAI,sBAAsB;IAC1B,MAAM,wBAAwB;CAEjC;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACnC,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AbstractMongoRepository } from "@drax/crud-back";
|
|
2
|
+
import type { IAgentSessionRepository } from '../../interfaces/IAgentSessionRepository';
|
|
3
|
+
import type { IAgentSession, IAgentSessionBase } from "../../interfaces/IAgentSession";
|
|
4
|
+
declare class AgentSessionMongoRepository extends AbstractMongoRepository<IAgentSession, IAgentSessionBase, IAgentSessionBase> implements IAgentSessionRepository {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export default AgentSessionMongoRepository;
|
|
8
|
+
export { AgentSessionMongoRepository };
|
|
9
|
+
//# sourceMappingURL=AgentSessionMongoRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSessionMongoRepository.d.ts","sourceRoot":"","sources":["../../../src/repository/mongo/AgentSessionMongoRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0CAA0C,CAAA;AACrF,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAGrF,cAAM,2BAA4B,SAAQ,uBAAuB,CAAC,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAE,YAAW,uBAAuB;;CAUxJ;AAED,eAAe,2BAA2B,CAAA;AAC1C,OAAO,EAAC,2BAA2B,EAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AbstractSqliteRepository } from "@drax/crud-back";
|
|
2
|
+
import type { IAgentSessionRepository } from '../../interfaces/IAgentSessionRepository';
|
|
3
|
+
import type { IAgentSession, IAgentSessionBase } from "../../interfaces/IAgentSession";
|
|
4
|
+
import { SqliteTableField } from "@drax/common-back";
|
|
5
|
+
declare class AgentSessionSqliteRepository extends AbstractSqliteRepository<IAgentSession, IAgentSessionBase, IAgentSessionBase> implements IAgentSessionRepository {
|
|
6
|
+
protected db: any;
|
|
7
|
+
protected tableName: string;
|
|
8
|
+
protected dataBaseFile: string;
|
|
9
|
+
protected searchFields: string[];
|
|
10
|
+
protected booleanFields: string[];
|
|
11
|
+
protected jsonFields: string[];
|
|
12
|
+
protected identifier: string;
|
|
13
|
+
protected populateFields: {
|
|
14
|
+
field: string;
|
|
15
|
+
table: string;
|
|
16
|
+
identifier: string;
|
|
17
|
+
}[];
|
|
18
|
+
protected verbose: boolean;
|
|
19
|
+
protected tableFields: SqliteTableField[];
|
|
20
|
+
}
|
|
21
|
+
export default AgentSessionSqliteRepository;
|
|
22
|
+
export { AgentSessionSqliteRepository };
|
|
23
|
+
//# sourceMappingURL=AgentSessionSqliteRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSessionSqliteRepository.d.ts","sourceRoot":"","sources":["../../../src/repository/sqlite/AgentSessionSqliteRepository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,wBAAwB,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0CAA0C,CAAA;AACrF,OAAO,KAAK,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACrF,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAEnD,cAAM,4BAA6B,SAAQ,wBAAwB,CAAC,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAE,YAAW,uBAAuB;IAEvJ,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC;IAClB,SAAS,CAAC,SAAS,EAAE,MAAM,CAAkB;IAC7C,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,CAA0B;IAC1D,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,CAAM;IACvC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAgB;IAC9C,SAAS,CAAC,UAAU,EAAE,MAAM,CAAS;IACrC,SAAS,CAAC,cAAc;;;;QAGvB;IACD,SAAS,CAAC,OAAO,EAAE,OAAO,CAAS;IACnC,SAAS,CAAC,WAAW,EAAE,gBAAgB,EAAE,CAexC;CAEJ;AAED,eAAe,4BAA4B,CAAA;AAC3C,OAAO,EAAC,4BAA4B,EAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentSessionRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/AgentSessionRoutes.ts"],"names":[],"mappings":"AAKA,iBAAe,kBAAkB,CAAC,OAAO,KAAA,EAAE,OAAO,KAAA,iBA6BjD;AAED,eAAe,kBAAkB,CAAC;AAClC,OAAO,EAAC,kBAAkB,EAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatbotTaskRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/ChatbotTaskRoutes.ts"],"names":[],"mappings":"AAEA,iBAAe,wBAAwB,CAAC,OAAO,KAAA,EAAE,OAAO,KAAA,iBAKvD;AAED,eAAe,wBAAwB,CAAC;AACxC,OAAO,EAAC,wBAAwB,EAAC,CAAC"}
|