@wabot-dev/framework 0.0.1

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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/dist/src/_virtual/_commonjsHelpers.js +5 -0
  3. package/dist/src/_virtual/main.js +7 -0
  4. package/dist/src/_virtual/main2.js +3 -0
  5. package/dist/src/ai/index.d.ts +1 -0
  6. package/dist/src/ai/openia/OpenaiChatBotAdapter.d.ts +9 -0
  7. package/dist/src/ai/openia/OpenaiChatBotAdapter.js +85 -0
  8. package/dist/src/ai/openia/index.d.ts +1 -0
  9. package/dist/src/channels/cmd/CmdChannel.d.ts +9 -0
  10. package/dist/src/channels/cmd/CmdChannel.js +58 -0
  11. package/dist/src/channels/cmd/index.d.ts +1 -0
  12. package/dist/src/channels/index.d.ts +2 -0
  13. package/dist/src/channels/telegram/@telegram.d.ts +2 -0
  14. package/dist/src/channels/telegram/@telegram.js +19 -0
  15. package/dist/src/channels/telegram/TelegramChannel.d.ts +12 -0
  16. package/dist/src/channels/telegram/TelegramChannel.js +54 -0
  17. package/dist/src/channels/telegram/TelegramChannelConfig.d.ts +7 -0
  18. package/dist/src/channels/telegram/TelegramChannelConfig.js +8 -0
  19. package/dist/src/channels/telegram/index.d.ts +3 -0
  20. package/dist/src/chatbot/ChatBot.d.ts +11 -0
  21. package/dist/src/chatbot/ChatBot.js +51 -0
  22. package/dist/src/chatbot/ChatBotAdapter.d.ts +26 -0
  23. package/dist/src/chatbot/ChatBotAdapter.js +74 -0
  24. package/dist/src/chatbot/IChatBot.d.ts +4 -0
  25. package/dist/src/chatbot/chat/Chat.d.ts +23 -0
  26. package/dist/src/chatbot/chat/Chat.js +55 -0
  27. package/dist/src/chatbot/chat/IChatFunctionCall.d.ts +6 -0
  28. package/dist/src/chatbot/chat/IChatItem.d.ts +19 -0
  29. package/dist/src/chatbot/chat/index.d.ts +4 -0
  30. package/dist/src/chatbot/chat/repository/IChatMemory.d.ts +9 -0
  31. package/dist/src/chatbot/chat/repository/IChatMemory.js +10 -0
  32. package/dist/src/chatbot/chat/repository/IChatRepository.d.ts +12 -0
  33. package/dist/src/chatbot/chat/repository/IChatRepository.js +19 -0
  34. package/dist/src/chatbot/chat/repository/index.d.ts +3 -0
  35. package/dist/src/chatbot/chat/repository/ram/RamChatMemory.d.ts +8 -0
  36. package/dist/src/chatbot/chat/repository/ram/RamChatMemory.js +14 -0
  37. package/dist/src/chatbot/chat/repository/ram/RamChatRepository.d.ts +11 -0
  38. package/dist/src/chatbot/chat/repository/ram/RamChatRepository.js +41 -0
  39. package/dist/src/chatbot/chat/repository/ram/index.d.ts +2 -0
  40. package/dist/src/chatbot/index.d.ts +5 -0
  41. package/dist/src/chatbot/metadata/@chatBot.d.ts +3 -0
  42. package/dist/src/chatbot/metadata/@chatBot.js +18 -0
  43. package/dist/src/chatbot/metadata/ChatBotMetadataStore.d.ts +6 -0
  44. package/dist/src/chatbot/metadata/ChatBotMetadataStore.js +17 -0
  45. package/dist/src/chatbot/metadata/IChatBotMetadata.d.ts +7 -0
  46. package/dist/src/chatbot/metadata/index.d.ts +3 -0
  47. package/dist/src/context/IContext.d.ts +18 -0
  48. package/dist/src/context/IContext.js +10 -0
  49. package/dist/src/context/index.d.ts +1 -0
  50. package/dist/src/controller/channel/ChatResolver.d.ts +9 -0
  51. package/dist/src/controller/channel/ChatResolver.js +43 -0
  52. package/dist/src/controller/channel/IChatChannel.d.ts +5 -0
  53. package/dist/src/controller/channel/IMessageContext.d.ts +10 -0
  54. package/dist/src/controller/channel/index.d.ts +3 -0
  55. package/dist/src/controller/index.d.ts +2 -0
  56. package/dist/src/controller/metadata/ControllerMetadataStore.d.ts +12 -0
  57. package/dist/src/controller/metadata/ControllerMetadataStore.js +42 -0
  58. package/dist/src/controller/metadata/channel/IChannelMetadata.d.ts +8 -0
  59. package/dist/src/controller/metadata/channel/index.d.ts +1 -0
  60. package/dist/src/controller/metadata/controller/@chatController.d.ts +3 -0
  61. package/dist/src/controller/metadata/controller/@chatController.js +14 -0
  62. package/dist/src/controller/metadata/controller/IChatControllerConfig.d.ts +2 -0
  63. package/dist/src/controller/metadata/controller/IChatControllerMetadata.d.ts +3 -0
  64. package/dist/src/controller/metadata/controller/index.d.ts +3 -0
  65. package/dist/src/controller/metadata/index.d.ts +3 -0
  66. package/dist/src/index.d.ts +10 -0
  67. package/dist/src/index.js +34 -0
  68. package/dist/src/injection/Container.d.ts +18 -0
  69. package/dist/src/injection/Container.js +43 -0
  70. package/dist/src/injection/index.d.ts +3 -0
  71. package/dist/src/injection/index.js +4 -0
  72. package/dist/src/message/IChatDocument.d.ts +2 -0
  73. package/dist/src/message/IChatImage.d.ts +2 -0
  74. package/dist/src/message/IChatMessage.d.ts +9 -0
  75. package/dist/src/message/IChatSender.d.ts +4 -0
  76. package/dist/src/message/index.d.ts +4 -0
  77. package/dist/src/mindset/IMindset.d.ts +17 -0
  78. package/dist/src/mindset/IMindset.js +13 -0
  79. package/dist/src/mindset/MindsetOperator.d.ts +25 -0
  80. package/dist/src/mindset/MindsetOperator.js +101 -0
  81. package/dist/src/mindset/index.d.ts +3 -0
  82. package/dist/src/mindset/metadata/IMindsetMetadata.d.ts +28 -0
  83. package/dist/src/mindset/metadata/MindsetMetadataStore.d.ts +19 -0
  84. package/dist/src/mindset/metadata/MindsetMetadataStore.js +134 -0
  85. package/dist/src/mindset/metadata/functions/@mindsetFunction.d.ts +3 -0
  86. package/dist/src/mindset/metadata/functions/@mindsetFunction.js +21 -0
  87. package/dist/src/mindset/metadata/functions/IMindsetFunctionConfig.d.ts +3 -0
  88. package/dist/src/mindset/metadata/functions/IMindsetFunctionDecoration.d.ts +7 -0
  89. package/dist/src/mindset/metadata/functions/decoratorNames.d.ts +1 -0
  90. package/dist/src/mindset/metadata/functions/decoratorNames.js +3 -0
  91. package/dist/src/mindset/metadata/functions/index.d.ts +4 -0
  92. package/dist/src/mindset/metadata/index.d.ts +6 -0
  93. package/dist/src/mindset/metadata/mindsets/@mindset.d.ts +5 -0
  94. package/dist/src/mindset/metadata/mindsets/@mindset.js +18 -0
  95. package/dist/src/mindset/metadata/mindsets/IMindsetConfig.d.ts +4 -0
  96. package/dist/src/mindset/metadata/mindsets/IMindsetDecoration.d.ts +6 -0
  97. package/dist/src/mindset/metadata/mindsets/decoratorNames.d.ts +1 -0
  98. package/dist/src/mindset/metadata/mindsets/decoratorNames.js +3 -0
  99. package/dist/src/mindset/metadata/mindsets/index.d.ts +3 -0
  100. package/dist/src/mindset/metadata/modules/@mindsetModule.d.ts +4 -0
  101. package/dist/src/mindset/metadata/modules/@mindsetModule.js +18 -0
  102. package/dist/src/mindset/metadata/modules/IMindsetModuleConfig.d.ts +3 -0
  103. package/dist/src/mindset/metadata/modules/IMindsetModuleDecoration.d.ts +5 -0
  104. package/dist/src/mindset/metadata/modules/decoratorNames.d.ts +1 -0
  105. package/dist/src/mindset/metadata/modules/decoratorNames.js +3 -0
  106. package/dist/src/mindset/metadata/modules/index.d.ts +4 -0
  107. package/dist/src/mindset/metadata/params/@isOptional.d.ts +2 -0
  108. package/dist/src/mindset/metadata/params/@isOptional.js +21 -0
  109. package/dist/src/mindset/metadata/params/@param.d.ts +3 -0
  110. package/dist/src/mindset/metadata/params/@param.js +21 -0
  111. package/dist/src/mindset/metadata/params/IParamConfig.d.ts +4 -0
  112. package/dist/src/mindset/metadata/params/IParamDecoration.d.ts +7 -0
  113. package/dist/src/mindset/metadata/params/decoratorNames.d.ts +2 -0
  114. package/dist/src/mindset/metadata/params/decoratorNames.js +4 -0
  115. package/dist/src/mindset/metadata/params/index.d.ts +3 -0
  116. package/dist/src/node_modules/dotenv/lib/main.js +376 -0
  117. package/dist/src/node_modules/dotenv/package.json.js +5 -0
  118. package/dist/src/server/index.d.ts +3 -0
  119. package/dist/src/server/prepareChatContainer.d.ts +5 -0
  120. package/dist/src/server/prepareChatContainer.js +41 -0
  121. package/dist/src/server/runChannel.d.ts +12 -0
  122. package/dist/src/server/runChannel.js +29 -0
  123. package/dist/src/server/runServer.d.ts +8 -0
  124. package/dist/src/server/runServer.js +42 -0
  125. package/dist/src/shared/IConstructor.d.ts +1 -0
  126. package/dist/src/shared/index.d.ts +1 -0
  127. package/package.json +47 -0
@@ -0,0 +1,19 @@
1
+ import { __decorate } from 'tslib';
2
+ import { singleton } from '../../../injection/index.js';
3
+
4
+ let ChatRepository = class ChatRepository {
5
+ create(chat) {
6
+ throw new Error('Method not implemented.');
7
+ }
8
+ findByConnection(query) {
9
+ throw new Error('Method not implemented.');
10
+ }
11
+ findMemory(chatId) {
12
+ throw new Error('Method not implemented.');
13
+ }
14
+ };
15
+ ChatRepository = __decorate([
16
+ singleton()
17
+ ], ChatRepository);
18
+
19
+ export { ChatRepository };
@@ -0,0 +1,3 @@
1
+ export * from './ram';
2
+ export * from './IChatMemory';
3
+ export * from './IChatRepository';
@@ -0,0 +1,8 @@
1
+ import { IChatItem } from "../../IChatItem";
2
+ import { IChatMemory } from "../IChatMemory";
3
+ export declare class RamChatMemory implements IChatMemory {
4
+ private memory;
5
+ findLastItems(count: number): Promise<IChatItem[]>;
6
+ saveItem(item: IChatItem): Promise<void>;
7
+ clearMemory(): Promise<void>;
8
+ }
@@ -0,0 +1,14 @@
1
+ class RamChatMemory {
2
+ memory = [];
3
+ async findLastItems(count) {
4
+ return this.memory.slice(-count);
5
+ }
6
+ async saveItem(item) {
7
+ this.memory.push(item);
8
+ }
9
+ async clearMemory() {
10
+ this.memory = [];
11
+ }
12
+ }
13
+
14
+ export { RamChatMemory };
@@ -0,0 +1,11 @@
1
+ import { Chat, IChatConnection } from '../../Chat';
2
+ import { IChatRepository } from '../IChatRepository';
3
+ import { IChatMemory } from '../IChatMemory';
4
+ export declare class RamChatRepository implements IChatRepository {
5
+ private items;
6
+ private memories;
7
+ create(chat: Chat): Promise<void>;
8
+ findByConnection(query: IChatConnection): Promise<Chat | null>;
9
+ findMemory(chatId: string): Promise<IChatMemory | null>;
10
+ private getMemory;
11
+ }
@@ -0,0 +1,41 @@
1
+ import { __decorate } from 'tslib';
2
+ import { v4 } from 'uuid';
3
+ import { RamChatMemory } from './RamChatMemory.js';
4
+ import { singleton } from '../../../../injection/index.js';
5
+
6
+ let RamChatRepository = class RamChatRepository {
7
+ items = [];
8
+ memories = [];
9
+ async create(chat) {
10
+ if (chat.wasCreated()) {
11
+ throw new Error('Chat already created');
12
+ }
13
+ chat['data'].id = v4();
14
+ chat['data'].createdAt = new Date();
15
+ chat.validate();
16
+ this.items.push(chat);
17
+ const memory = {
18
+ memory: new RamChatMemory(),
19
+ chatId: chat.getId(),
20
+ };
21
+ this.memories.push(memory);
22
+ }
23
+ async findByConnection(query) {
24
+ return this.items.find((item) => item.hasConnection(query)) ?? null;
25
+ }
26
+ findMemory(chatId) {
27
+ const memory = this.getMemory(chatId);
28
+ if (!memory) {
29
+ return Promise.resolve(null);
30
+ }
31
+ return Promise.resolve(memory.memory);
32
+ }
33
+ getMemory(chatId) {
34
+ return this.memories.find((r) => r.chatId === chatId) ?? null;
35
+ }
36
+ };
37
+ RamChatRepository = __decorate([
38
+ singleton()
39
+ ], RamChatRepository);
40
+
41
+ export { RamChatRepository };
@@ -0,0 +1,2 @@
1
+ export * from './RamChatMemory';
2
+ export * from './RamChatRepository';
@@ -0,0 +1,5 @@
1
+ export * from './chat';
2
+ export * from './metadata';
3
+ export * from './ChatBot';
4
+ export * from './ChatBotAdapter';
5
+ export * from './IChatBot';
@@ -0,0 +1,3 @@
1
+ import { IMindset } from '@/mindset';
2
+ import { IConstructor } from '@/shared';
3
+ export declare function chatBot(mindset: IConstructor<IMindset>): (target: object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
@@ -0,0 +1,18 @@
1
+ import { container, inject } from '../../injection/index.js';
2
+ import { v4 } from 'uuid';
3
+ import { ChatBotMetadataStore } from './ChatBotMetadataStore.js';
4
+
5
+ function chatBot(mindset) {
6
+ return function (target, propertyKey, parameterIndex) {
7
+ const injectionToken = `ChatBot-${mindset.name}-${v4()}`;
8
+ const metadataStore = container.resolve(ChatBotMetadataStore);
9
+ metadataStore.saveChatBotMetadata({
10
+ constructor: target,
11
+ mindsetConstructor: mindset,
12
+ injectionToken,
13
+ });
14
+ inject(injectionToken)(target, propertyKey, parameterIndex);
15
+ };
16
+ }
17
+
18
+ export { chatBot };
@@ -0,0 +1,6 @@
1
+ import { IChatBotMetadata } from "./IChatBotMetadata";
2
+ export declare class ChatBotMetadataStore {
3
+ private chatBots;
4
+ saveChatBotMetadata(chatBot: IChatBotMetadata): void;
5
+ getChatBotsMetadata(): IChatBotMetadata[];
6
+ }
@@ -0,0 +1,17 @@
1
+ import { __decorate } from 'tslib';
2
+ import { singleton } from '../../injection/index.js';
3
+
4
+ let ChatBotMetadataStore = class ChatBotMetadataStore {
5
+ chatBots = [];
6
+ saveChatBotMetadata(chatBot) {
7
+ this.chatBots.push(chatBot);
8
+ }
9
+ getChatBotsMetadata() {
10
+ return this.chatBots;
11
+ }
12
+ };
13
+ ChatBotMetadataStore = __decorate([
14
+ singleton()
15
+ ], ChatBotMetadataStore);
16
+
17
+ export { ChatBotMetadataStore };
@@ -0,0 +1,7 @@
1
+ import { IMindset } from "@/mindset";
2
+ import { IConstructor } from "@/shared";
3
+ export interface IChatBotMetadata {
4
+ constructor: IConstructor<any>;
5
+ mindsetConstructor: IConstructor<IMindset>;
6
+ injectionToken: string;
7
+ }
@@ -0,0 +1,3 @@
1
+ export * from './@chatBot';
2
+ export * from './ChatBotMetadataStore';
3
+ export * from './IChatBotMetadata';
@@ -0,0 +1,18 @@
1
+ import { IChatMessage } from '@/message';
2
+ export interface IChatContext {
3
+ chatId: string;
4
+ message: IChatMessage;
5
+ reply: (message: IChatMessage) => void;
6
+ }
7
+ export interface IUserContext {
8
+ userId: string;
9
+ }
10
+ export interface IContext {
11
+ user?: IUserContext;
12
+ chat: IChatContext;
13
+ }
14
+ export declare class Context implements IContext {
15
+ chat: IChatContext;
16
+ user?: IUserContext | undefined;
17
+ constructor(chat: IChatContext, user?: IUserContext | undefined);
18
+ }
@@ -0,0 +1,10 @@
1
+ class Context {
2
+ chat;
3
+ user;
4
+ constructor(chat, user) {
5
+ this.chat = chat;
6
+ this.user = user;
7
+ }
8
+ }
9
+
10
+ export { Context };
@@ -0,0 +1 @@
1
+ export * from './IContext';
@@ -0,0 +1,9 @@
1
+ import { Chat, ChatRepository } from '@/chatbot';
2
+ import { IMessageOrigin } from './IMessageContext';
3
+ export declare class ChatResolver {
4
+ private chatRepository;
5
+ constructor(chatRepository: ChatRepository);
6
+ resolve(origin: IMessageOrigin): Promise<Chat>;
7
+ private resolveGroupChat;
8
+ private resolvePrivateChat;
9
+ }
@@ -0,0 +1,43 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import '../../chatbot/chat/repository/ram/RamChatRepository.js';
3
+ import { ChatRepository } from '../../chatbot/chat/repository/IChatRepository.js';
4
+ import { Chat } from '../../chatbot/chat/Chat.js';
5
+ import { injectable } from '../../injection/index.js';
6
+ import 'uuid';
7
+ import '../../chatbot/metadata/ChatBotMetadataStore.js';
8
+ import '../../chatbot/ChatBot.js';
9
+
10
+ let ChatResolver = class ChatResolver {
11
+ chatRepository;
12
+ constructor(chatRepository) {
13
+ this.chatRepository = chatRepository;
14
+ }
15
+ async resolve(origin) {
16
+ if (origin.chatType === 'GROUP') {
17
+ return this.resolveGroupChat({ channelType: origin.channelType.name, chatId: origin.chatId });
18
+ }
19
+ return this.resolvePrivateChat({ channelType: origin.channelType.name, chatId: origin.chatId });
20
+ }
21
+ async resolveGroupChat(connection) {
22
+ let chat = await this.chatRepository.findByConnection(connection);
23
+ if (!chat) {
24
+ chat = new Chat({ type: 'GROUP', connections: [connection] });
25
+ await this.chatRepository.create(chat);
26
+ }
27
+ return chat;
28
+ }
29
+ async resolvePrivateChat(connection) {
30
+ let chat = await this.chatRepository.findByConnection(connection);
31
+ if (!chat) {
32
+ chat = new Chat({ type: 'PRIVATE', connections: [connection] });
33
+ await this.chatRepository.create(chat);
34
+ }
35
+ return chat;
36
+ }
37
+ };
38
+ ChatResolver = __decorate([
39
+ injectable(),
40
+ __metadata("design:paramtypes", [ChatRepository])
41
+ ], ChatResolver);
42
+
43
+ export { ChatResolver };
@@ -0,0 +1,5 @@
1
+ import { IMessageContext } from "./IMessageContext";
2
+ export interface IChatChannel {
3
+ listen(callback: (message: IMessageContext) => void): void;
4
+ connect(): void;
5
+ }
@@ -0,0 +1,10 @@
1
+ import { IChatType } from '@/chatbot/chat';
2
+ import { IChatContext } from '@/context';
3
+ export interface IMessageOrigin {
4
+ chatId: string;
5
+ chatType: IChatType;
6
+ channelType: Function;
7
+ }
8
+ export interface IMessageContext extends IChatContext {
9
+ origin: IMessageOrigin;
10
+ }
@@ -0,0 +1,3 @@
1
+ export * from './ChatResolver';
2
+ export * from './IChatChannel';
3
+ export * from './IMessageContext';
@@ -0,0 +1,2 @@
1
+ export * from './channel';
2
+ export * from './metadata';
@@ -0,0 +1,12 @@
1
+ import { IChatControllerMetadata } from './controller/IChatControllerMetadata';
2
+ import { IChannelMetadata } from './channel/IChannelMetadata';
3
+ export declare class ControllerMetadataStore {
4
+ private channels;
5
+ private chatControllers;
6
+ saveChannelMetadata(channelMetadata: IChannelMetadata): void;
7
+ saveChatControllerMetadata(controllerMetadata: IChatControllerMetadata): void;
8
+ getChatControllerMetadata(controllerConstructor: Function): {
9
+ config: IChatControllerMetadata;
10
+ channels: IChannelMetadata[];
11
+ } | null;
12
+ }
@@ -0,0 +1,42 @@
1
+ import { __decorate } from 'tslib';
2
+ import { singleton } from '../../injection/index.js';
3
+
4
+ let ControllerMetadataStore = class ControllerMetadataStore {
5
+ channels = new Map();
6
+ chatControllers = new Map();
7
+ saveChannelMetadata(channelMetadata) {
8
+ let controllerChannels = this.channels.get(channelMetadata.controllerConstructor);
9
+ if (!controllerChannels) {
10
+ controllerChannels = new Map();
11
+ this.channels.set(channelMetadata.controllerConstructor, controllerChannels);
12
+ }
13
+ let functionChannels = controllerChannels.get(channelMetadata.functionName);
14
+ if (!functionChannels) {
15
+ functionChannels = [];
16
+ controllerChannels.set(channelMetadata.functionName, functionChannels);
17
+ }
18
+ functionChannels.push(channelMetadata);
19
+ }
20
+ saveChatControllerMetadata(controllerMetadata) {
21
+ this.chatControllers.set(controllerMetadata.controllerConstructor, controllerMetadata);
22
+ }
23
+ getChatControllerMetadata(controllerConstructor) {
24
+ const mainMetadata = this.chatControllers.get(controllerConstructor);
25
+ if (!mainMetadata)
26
+ return null;
27
+ const config = mainMetadata;
28
+ const channelsMap = this.channels.get(controllerConstructor);
29
+ const channels = Array.from(channelsMap?.values() ?? [])
30
+ .map((channelMetadata) => channelMetadata)
31
+ .flat();
32
+ return {
33
+ config,
34
+ channels,
35
+ };
36
+ }
37
+ };
38
+ ControllerMetadataStore = __decorate([
39
+ singleton()
40
+ ], ControllerMetadataStore);
41
+
42
+ export { ControllerMetadataStore };
@@ -0,0 +1,8 @@
1
+ import { IConstructor } from '@/shared';
2
+ import { IChatChannel } from '../../channel/IChatChannel';
3
+ export interface IChannelMetadata {
4
+ controllerConstructor: IConstructor<any>;
5
+ functionName: string;
6
+ channelConstructor: IConstructor<IChatChannel>;
7
+ channelConfig: object;
8
+ }
@@ -0,0 +1 @@
1
+ export * from './IChannelMetadata';
@@ -0,0 +1,3 @@
1
+ import { IchatControllerConfig } from "./IChatControllerConfig";
2
+ import { IConstructor } from "@/shared";
3
+ export declare function chatController(config?: IchatControllerConfig): (target: IConstructor<any>) => void;
@@ -0,0 +1,14 @@
1
+ import { container, injectable } from '../../../injection/index.js';
2
+ import { ControllerMetadataStore } from '../ControllerMetadataStore.js';
3
+
4
+ function chatController(config) {
5
+ return function (target) {
6
+ const controllerMetaDataStore = container.resolve(ControllerMetadataStore);
7
+ controllerMetaDataStore.saveChatControllerMetadata({
8
+ controllerConstructor: target,
9
+ });
10
+ injectable()(target);
11
+ };
12
+ }
13
+
14
+ export { chatController };
@@ -0,0 +1,2 @@
1
+ export interface IchatControllerConfig {
2
+ }
@@ -0,0 +1,3 @@
1
+ export interface IChatControllerMetadata {
2
+ controllerConstructor: Function;
3
+ }
@@ -0,0 +1,3 @@
1
+ export * from './@chatController';
2
+ export * from './IChatControllerConfig';
3
+ export * from './IChatControllerMetadata';
@@ -0,0 +1,3 @@
1
+ export * from './controller';
2
+ export * from './channel';
3
+ export * from './ControllerMetadataStore';
@@ -0,0 +1,10 @@
1
+ export * from './ai';
2
+ export * from './channels';
3
+ export * from './chatbot';
4
+ export * from './context';
5
+ export * from './controller';
6
+ export * from './injection';
7
+ export * from './message';
8
+ export * from './mindset';
9
+ export * from './server';
10
+ export * from './shared';
@@ -0,0 +1,34 @@
1
+ export { OpenaiChatBotAdapter } from './ai/openia/OpenaiChatBotAdapter.js';
2
+ export { CmdChannel } from './channels/cmd/CmdChannel.js';
3
+ export { telegram } from './channels/telegram/@telegram.js';
4
+ export { TelegramChannelConfig } from './channels/telegram/TelegramChannelConfig.js';
5
+ export { TelegramChannel } from './channels/telegram/TelegramChannel.js';
6
+ export { RamChatMemory } from './chatbot/chat/repository/ram/RamChatMemory.js';
7
+ export { RamChatRepository } from './chatbot/chat/repository/ram/RamChatRepository.js';
8
+ export { ChatMemory } from './chatbot/chat/repository/IChatMemory.js';
9
+ export { ChatRepository } from './chatbot/chat/repository/IChatRepository.js';
10
+ export { Chat } from './chatbot/chat/Chat.js';
11
+ export { chatBot } from './chatbot/metadata/@chatBot.js';
12
+ export { ChatBotMetadataStore } from './chatbot/metadata/ChatBotMetadataStore.js';
13
+ export { ChatBot } from './chatbot/ChatBot.js';
14
+ export { ChatBotAdapter } from './chatbot/ChatBotAdapter.js';
15
+ export { Context } from './context/IContext.js';
16
+ export { ChatResolver } from './controller/channel/ChatResolver.js';
17
+ export { chatController } from './controller/metadata/controller/@chatController.js';
18
+ export { ControllerMetadataStore } from './controller/metadata/ControllerMetadataStore.js';
19
+ export { container, inject, injectable, singleton } from './injection/index.js';
20
+ export { mindsetFunction } from './mindset/metadata/functions/@mindsetFunction.js';
21
+ export { MINDSET_FUNCTION_DECORATION_FUNCTION } from './mindset/metadata/functions/decoratorNames.js';
22
+ export { mindset } from './mindset/metadata/mindsets/@mindset.js';
23
+ export { MINDSET_DECORATION_MINDSET } from './mindset/metadata/mindsets/decoratorNames.js';
24
+ export { mindsetModule } from './mindset/metadata/modules/@mindsetModule.js';
25
+ export { MINDSET_MODULE_DECORATION_MODULE } from './mindset/metadata/modules/decoratorNames.js';
26
+ export { isOptional } from './mindset/metadata/params/@isOptional.js';
27
+ export { param } from './mindset/metadata/params/@param.js';
28
+ export { MindsetMetadataStore } from './mindset/metadata/MindsetMetadataStore.js';
29
+ export { Mindset } from './mindset/IMindset.js';
30
+ export { MindsetOperator } from './mindset/MindsetOperator.js';
31
+ export { prepareChatContainer } from './server/prepareChatContainer.js';
32
+ export { runChannel } from './server/runChannel.js';
33
+ export { runServer } from './server/runServer.js';
34
+ export { Container } from './injection/Container.js';
@@ -0,0 +1,18 @@
1
+ import { DependencyContainer, InjectionToken } from "tsyringe";
2
+ import { InterceptionOptions } from "tsyringe/dist/typings/types";
3
+ import { PostResolutionInterceptorCallback, PreResolutionInterceptorCallback } from "tsyringe/dist/typings/types/dependency-container";
4
+ export declare class Container implements DependencyContainer {
5
+ register(token: unknown, provider: unknown, options?: unknown): DependencyContainer;
6
+ registerSingleton(from: unknown, to?: unknown): DependencyContainer;
7
+ registerType<T>(from: InjectionToken<T>, to: InjectionToken<T>): DependencyContainer;
8
+ registerInstance<T>(token: InjectionToken<T>, instance: T): DependencyContainer;
9
+ resolve<T>(token: InjectionToken<T>): T;
10
+ resolveAll<T>(token: InjectionToken<T>): T[];
11
+ isRegistered<T>(token: InjectionToken<T>, recursive?: boolean): boolean;
12
+ reset(): void;
13
+ clearInstances(): void;
14
+ createChildContainer(): DependencyContainer;
15
+ beforeResolution<T>(token: InjectionToken<T>, callback: PreResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
16
+ afterResolution<T>(token: InjectionToken<T>, callback: PostResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
17
+ dispose(): Promise<void> | void;
18
+ }
@@ -0,0 +1,43 @@
1
+ class Container {
2
+ register(token, provider, options) {
3
+ throw new Error('Method not implemented.');
4
+ }
5
+ registerSingleton(from, to) {
6
+ throw new Error('Method not implemented.');
7
+ }
8
+ registerType(from, to) {
9
+ throw new Error('Method not implemented.');
10
+ }
11
+ registerInstance(token, instance) {
12
+ throw new Error('Method not implemented.');
13
+ }
14
+ resolve(token) {
15
+ throw new Error('Method not implemented.');
16
+ }
17
+ resolveAll(token) {
18
+ throw new Error('Method not implemented.');
19
+ }
20
+ isRegistered(token, recursive) {
21
+ throw new Error('Method not implemented.');
22
+ }
23
+ reset() {
24
+ throw new Error('Method not implemented.');
25
+ }
26
+ clearInstances() {
27
+ throw new Error('Method not implemented.');
28
+ }
29
+ createChildContainer() {
30
+ throw new Error('Method not implemented.');
31
+ }
32
+ beforeResolution(token, callback, options) {
33
+ throw new Error('Method not implemented.');
34
+ }
35
+ afterResolution(token, callback, options) {
36
+ throw new Error('Method not implemented.');
37
+ }
38
+ dispose() {
39
+ throw new Error('Method not implemented.');
40
+ }
41
+ }
42
+
43
+ export { Container };
@@ -0,0 +1,3 @@
1
+ export declare const injectable: typeof import("tsyringe").injectable, container: import("tsyringe").DependencyContainer, singleton: typeof import("tsyringe").singleton, inject: typeof import("tsyringe").inject;
2
+ export { Container } from './Container';
3
+ export type { DependencyContainer } from 'tsyringe';
@@ -0,0 +1,4 @@
1
+ await import('reflect-metadata');
2
+ const { injectable, container, singleton, inject } = await import('tsyringe');
3
+
4
+ export { container, inject, injectable, singleton };
@@ -0,0 +1,2 @@
1
+ export interface IChatDocument {
2
+ }
@@ -0,0 +1,2 @@
1
+ export interface IChatImage {
2
+ }
@@ -0,0 +1,9 @@
1
+ import { IChatDocument } from './IChatDocument';
2
+ import { IChatImage } from './IChatImage';
3
+ import { IChatSender } from './IChatSender';
4
+ export interface IChatMessage {
5
+ sender: IChatSender;
6
+ text?: string;
7
+ documents?: IChatDocument[];
8
+ images?: IChatImage[];
9
+ }
@@ -0,0 +1,4 @@
1
+ export interface IChatSender {
2
+ shortName: string;
3
+ senderId?: string;
4
+ }
@@ -0,0 +1,4 @@
1
+ export * from './IChatDocument';
2
+ export * from './IChatImage';
3
+ export * from './IChatMessage';
4
+ export * from './IChatSender';
@@ -0,0 +1,17 @@
1
+ export interface IMindsetIdentity {
2
+ name: string;
3
+ language: string;
4
+ age?: number;
5
+ personality?: string;
6
+ emotions?: string;
7
+ }
8
+ export interface IMindset {
9
+ identity(): Promise<IMindsetIdentity>;
10
+ skills(): Promise<string>;
11
+ limits(): Promise<string>;
12
+ }
13
+ export declare class Mindset implements IMindset {
14
+ identity(): Promise<IMindsetIdentity>;
15
+ skills(): Promise<string>;
16
+ limits(): Promise<string>;
17
+ }
@@ -0,0 +1,13 @@
1
+ class Mindset {
2
+ identity() {
3
+ throw new Error("Method not implemented.");
4
+ }
5
+ skills() {
6
+ throw new Error("Method not implemented.");
7
+ }
8
+ limits() {
9
+ throw new Error("Method not implemented.");
10
+ }
11
+ }
12
+
13
+ export { Mindset };
@@ -0,0 +1,25 @@
1
+ import { Container } from '@/injection';
2
+ import { IMindset, IMindsetIdentity, Mindset } from './IMindset';
3
+ import { MindsetMetadataStore } from './metadata/MindsetMetadataStore';
4
+ export declare class MindsetOperator implements IMindset {
5
+ private mindset;
6
+ private container;
7
+ private metadata;
8
+ constructor(mindset: Mindset, container: Container, metadataStore: MindsetMetadataStore);
9
+ identity(): Promise<IMindsetIdentity>;
10
+ skills(): Promise<string>;
11
+ limits(): Promise<string>;
12
+ callFunction(name: string, params: string): Promise<string>;
13
+ allFunctionsDescriptors(): Promise<{
14
+ readonly type: "function";
15
+ readonly name: string;
16
+ readonly description: string;
17
+ readonly parameters: {
18
+ readonly type: "object";
19
+ readonly properties: {};
20
+ readonly required: string[];
21
+ };
22
+ }[]>;
23
+ private functionDescriptor;
24
+ private toolParam;
25
+ }