@wabot-dev/framework 0.0.16 → 0.1.0-beta.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.
@@ -0,0 +1,108 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { injectable } from '../../injection/index.js';
3
+ import { OpenAI } from 'openai';
4
+ import 'reflect-metadata';
5
+ import '../../mindset/metadata/MindsetMetadataStore.js';
6
+ import '../../core/chat/repository/IChatRepository.js';
7
+ import '../../core/user/IUserRepository.js';
8
+ import { MindsetOperator } from '../../mindset/MindsetOperator.js';
9
+ import 'uuid';
10
+ import '../../chatbot/metadata/ChatBotMetadataStore.js';
11
+ import '../../chatbot/ChatBot.js';
12
+ import { ChatBotAdapter } from '../../chatbot/ChatBotAdapter.js';
13
+
14
+ let DeepSeekChatBotAdapter = class DeepSeekChatBotAdapter extends ChatBotAdapter {
15
+ deepSeek;
16
+ model;
17
+ constructor(mindset) {
18
+ super(mindset);
19
+ const model = process.env.DEEPSEEK_CHAT_MODEL;
20
+ const apiKey = process.env.DEEPSEEK_API_KEY;
21
+ const baseURL = process.env.DEEPSEEK_BASE_URL;
22
+ this.validateEnvVariables([model, apiKey, baseURL]);
23
+ this.model = model || 'deepseek-chat';
24
+ this.deepSeek = new OpenAI({
25
+ apiKey: apiKey,
26
+ baseURL: baseURL
27
+ });
28
+ }
29
+ validateEnvVariables(envVariables) {
30
+ envVariables.forEach((envVariable) => {
31
+ if (!envVariable) {
32
+ throw new Error('Missing environment variable');
33
+ }
34
+ });
35
+ }
36
+ async generateNextChatItem(chatItems) {
37
+ const systemPrompt = await this.systemPrompt();
38
+ const tools = (await this.mindset.allFunctionsDescriptors()).map((fn) => {
39
+ const parameters = { ...fn.parameters, additionalProperties: false, type: 'object' };
40
+ return {
41
+ type: 'function', function: { name: fn.name, description: fn.description, parameters, strict: true }
42
+ };
43
+ });
44
+ const response = await this.deepSeek.chat.completions.create({
45
+ model: this.model,
46
+ messages: [{ role: 'system', content: systemPrompt }, ...this.mapChatItems(chatItems)],
47
+ tools: tools,
48
+ tool_choice: 'auto'
49
+ });
50
+ let newChatItem;
51
+ const { tool_calls: responseFunctionCall, content: responseText } = response.choices?.[0]?.message ?? {};
52
+ if (responseText) {
53
+ newChatItem = await this.buildBotMessageItem(responseText);
54
+ }
55
+ else if (responseFunctionCall && responseFunctionCall[0]?.type == 'function') {
56
+ newChatItem = await this.buildFunctionCallItem(responseFunctionCall[0].id, responseFunctionCall[0].function.name, responseFunctionCall[0].function.arguments);
57
+ }
58
+ else {
59
+ throw new Error('Not supported DeepSeek Response');
60
+ }
61
+ return newChatItem;
62
+ }
63
+ mapChatItems(chatItems) {
64
+ const deepSeekInput = [];
65
+ for (const item of chatItems) {
66
+ const itemData = item.getData();
67
+ if (itemData.type === 'CONNECTION_MESSAGE') {
68
+ if (!itemData.content.text) {
69
+ throw new Error('System message content is empty');
70
+ }
71
+ deepSeekInput.push({ role: 'user', content: itemData.content.text });
72
+ }
73
+ else if (itemData.type === 'BOT_MESSAGE') {
74
+ if (!itemData.content.text) {
75
+ throw new Error('System message content is empty');
76
+ }
77
+ deepSeekInput.push({ role: 'assistant', content: itemData.content.text });
78
+ }
79
+ if (itemData.type === 'FUNCTION_CALL') {
80
+ deepSeekInput.push({
81
+ role: 'assistant',
82
+ tool_calls: [
83
+ {
84
+ id: itemData.content.id,
85
+ type: 'function',
86
+ function: {
87
+ name: itemData.content.name,
88
+ arguments: JSON.stringify(itemData.content.arguments)
89
+ }
90
+ }
91
+ ]
92
+ });
93
+ deepSeekInput.push({
94
+ role: 'tool',
95
+ tool_call_id: itemData.content.id,
96
+ content: itemData.content.result
97
+ });
98
+ }
99
+ }
100
+ return deepSeekInput;
101
+ }
102
+ };
103
+ DeepSeekChatBotAdapter = __decorate([
104
+ injectable(),
105
+ __metadata("design:paramtypes", [MindsetOperator])
106
+ ], DeepSeekChatBotAdapter);
107
+
108
+ export { DeepSeekChatBotAdapter };
@@ -0,0 +1,24 @@
1
+ import '../../controller/channel/ChatResolver.js';
2
+ import '../../controller/channel/UserResolver.js';
3
+ import { container } from '../../injection/index.js';
4
+ import '../../core/chat/repository/IChatRepository.js';
5
+ import '../../core/user/IUserRepository.js';
6
+ import { ControllerMetadataStore } from '../../controller/metadata/ControllerMetadataStore.js';
7
+ import 'express';
8
+ import 'socket.io';
9
+ import { SocketChannel } from './SocketChannel.js';
10
+ import { SocketChannelConfig } from './SocketChannelConfig.js';
11
+
12
+ function socket(config) {
13
+ return function (target, propertyKey) {
14
+ const store = container.resolve(ControllerMetadataStore);
15
+ store.saveChannelMetadata({
16
+ channelConstructor: SocketChannel,
17
+ functionName: propertyKey.toString(),
18
+ controllerConstructor: target.constructor,
19
+ channelConfig: new SocketChannelConfig(config.channel),
20
+ });
21
+ };
22
+ }
23
+
24
+ export { socket };
@@ -0,0 +1,78 @@
1
+ import { __decorate, __param, __metadata } from 'tslib';
2
+ import { SocketChannelConfig } from './SocketChannelConfig.js';
3
+ import { injectable, inject } from '../../injection/index.js';
4
+ import { ChatResolver } from '../../controller/channel/ChatResolver.js';
5
+ import { UserResolver } from '../../controller/channel/UserResolver.js';
6
+ import '../../core/chat/repository/IChatRepository.js';
7
+ import '../../core/user/IUserRepository.js';
8
+ import '../../controller/metadata/ControllerMetadataStore.js';
9
+ import 'express';
10
+ import { SocketIoApp } from '../../controller/socket.io/SocketIO.js';
11
+
12
+ var SocketChannel_1;
13
+ let SocketChannel = SocketChannel_1 = class SocketChannel {
14
+ config;
15
+ server;
16
+ chatResolver;
17
+ userResolver;
18
+ callBack = null;
19
+ constructor(config, server, chatResolver, userResolver) {
20
+ this.config = config;
21
+ this.server = server;
22
+ this.chatResolver = chatResolver;
23
+ this.userResolver = userResolver;
24
+ }
25
+ listen(callback) {
26
+ this.callBack = callback;
27
+ }
28
+ connect() {
29
+ this.server.on('connection', (socket) => {
30
+ socket.on(this.config.channel, async (message) => {
31
+ const trimmedInput = message.text.trim();
32
+ if (!trimmedInput) {
33
+ return;
34
+ }
35
+ if (!message.chatId || !message.userId || !message.senderName) {
36
+ socket.emit(this.config.channel, {
37
+ error: 'Invalid message format. chatId, userId, and senderName are required.',
38
+ });
39
+ return;
40
+ }
41
+ const chatConnection = {
42
+ id: message.chatId,
43
+ chatType: 'PRIVATE',
44
+ channelName: SocketChannel_1.name,
45
+ };
46
+ const chat = await this.chatResolver.resolve(chatConnection);
47
+ const userConnection = {
48
+ id: message.userId,
49
+ channelName: SocketChannel_1.name,
50
+ };
51
+ const user = await this.userResolver.resolve(userConnection);
52
+ if (!this.callBack)
53
+ return;
54
+ this.callBack({
55
+ chat,
56
+ user,
57
+ message: {
58
+ chatConnection,
59
+ userConnection,
60
+ text: trimmedInput,
61
+ senderName: message.senderName,
62
+ },
63
+ reply: (message) => {
64
+ socket.emit(this.config.channel, message);
65
+ },
66
+ });
67
+ });
68
+ });
69
+ }
70
+ };
71
+ SocketChannel = SocketChannel_1 = __decorate([
72
+ injectable(),
73
+ __param(1, inject(SocketIoApp)),
74
+ __metadata("design:paramtypes", [SocketChannelConfig, Function, ChatResolver,
75
+ UserResolver])
76
+ ], SocketChannel);
77
+
78
+ export { SocketChannel };
@@ -0,0 +1,15 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { injectable } from '../../injection/index.js';
3
+
4
+ let SocketChannelConfig = class SocketChannelConfig {
5
+ channel;
6
+ constructor(channel) {
7
+ this.channel = channel;
8
+ }
9
+ };
10
+ SocketChannelConfig = __decorate([
11
+ injectable(),
12
+ __metadata("design:paramtypes", [String])
13
+ ], SocketChannelConfig);
14
+
15
+ export { SocketChannelConfig };
@@ -3,7 +3,7 @@ import { singleton } from '../../injection/index.js';
3
3
  import { Logger } from '../../logger/Logger.js';
4
4
  import { io } from 'socket.io-client';
5
5
  import { WhatsAppConnection } from './WhatsAppConnection.js';
6
- import { devWhatsappEmitEvent, devWhatsAppListentEvent } from './whatsAppDevSocketContracts.js';
6
+ import { devWhatsappEmitEvent, devWhatsAppListentEvent } from './WhatsAppDevSocketContracts.js';
7
7
 
8
8
  let WhatsAppDevConnection = class WhatsAppDevConnection extends WhatsAppConnection {
9
9
  devProxy;
@@ -24,6 +24,14 @@ let WhatsAppDevConnection = class WhatsAppDevConnection extends WhatsAppConnecti
24
24
  };
25
25
  await this.devProxySocket.emitWithAck(devWhatsappEmitEvent.DEV_SEND_WHATSAPP, req);
26
26
  }
27
+ async sendWhatsAppTemplate(businessNumber, to, templateMessage) {
28
+ const req = {
29
+ from: businessNumber,
30
+ to,
31
+ message: templateMessage,
32
+ };
33
+ await this.devProxySocket.emitWithAck(devWhatsappEmitEvent.DEV_SEND_WHATSAPP_TEMPLATE, req);
34
+ }
27
35
  connect() {
28
36
  if (this.connected) {
29
37
  return;
@@ -4,6 +4,7 @@ const devWhatsAppListentEvent = {
4
4
  const devWhatsappEmitEvent = {
5
5
  DEV_CONNECTION: 'dev-connection',
6
6
  DEV_SEND_WHATSAPP: 'dev-send-whatsapp',
7
+ DEV_SEND_WHATSAPP_TEMPLATE: 'dev-send-whatsapp-template',
7
8
  };
8
9
 
9
10
  export { devWhatsAppListentEvent, devWhatsappEmitEvent };
@@ -23,6 +23,9 @@ let WhatsAppProdConnection = class WhatsAppProdConnection {
23
23
  sendWhatsApp(businessNumber, to, replyMessage) {
24
24
  throw new Error('Method not implemented.');
25
25
  }
26
+ sendWhatsAppTemplate(businessNumber, to, templateMessage) {
27
+ throw new Error('Method not implemented.');
28
+ }
26
29
  connect() {
27
30
  throw new Error('Method not implemented.');
28
31
  }
@@ -0,0 +1,23 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { singleton } from 'tsyringe';
3
+
4
+ let WhatsAppSender = class WhatsAppSender {
5
+ wabotEnv;
6
+ whatsAppConection;
7
+ constructor(wabotEnv, devConnection, prodConnection) {
8
+ this.wabotEnv = wabotEnv;
9
+ this.whatsAppConection = this.wabotEnv.isProduction() ? prodConnection : devConnection;
10
+ }
11
+ async send(businessNumber, to, message) {
12
+ this.whatsAppConection.sendWhatsApp(businessNumber, to, message);
13
+ }
14
+ async sendTemplate(businessNumber, to, templateMessage) {
15
+ this.whatsAppConection.sendWhatsAppTemplate(businessNumber, to, templateMessage);
16
+ }
17
+ };
18
+ WhatsAppSender = __decorate([
19
+ singleton(),
20
+ __metadata("design:paramtypes", [Function, Function, Function])
21
+ ], WhatsAppSender);
22
+
23
+ export { WhatsAppSender };
@@ -3,13 +3,14 @@ import DependencyContainer, { PreResolutionInterceptorCallback, PostResolutionIn
3
3
  import InterceptionOptions from 'tsyringe/dist/typings/types/interceptor-options';
4
4
  import { Express } from 'express';
5
5
  export { Express } from 'express';
6
+ import { Server } from 'socket.io';
7
+ export { Server as SocketIo } from 'socket.io';
6
8
  import * as tsyringe from 'tsyringe';
7
9
  import { DependencyContainer as DependencyContainer$1 } from 'tsyringe';
8
10
  export { DependencyContainer } from 'tsyringe';
9
11
  import { Pool } from 'pg';
10
12
  import { Database } from 'sqlite';
11
13
  import sqlite3 from 'sqlite3';
12
- export { Server as SocketIo } from 'socket.io';
13
14
 
14
15
  interface IMindsetFunctionConfig {
15
16
  description: string;
@@ -231,6 +232,7 @@ declare function isOptional(): PropertyDecorator;
231
232
 
232
233
  interface IParamConfig {
233
234
  name?: string;
235
+ optional?: boolean;
234
236
  description: string;
235
237
  }
236
238
 
@@ -375,6 +377,15 @@ declare class OpenaiChatBotAdapter extends ChatBotAdapter {
375
377
  private mapChatItems;
376
378
  }
377
379
 
380
+ declare class DeepSeekChatBotAdapter extends ChatBotAdapter {
381
+ private deepSeek;
382
+ private model;
383
+ constructor(mindset: MindsetOperator);
384
+ validateEnvVariables(envVariables: (string | undefined)[]): void;
385
+ generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
386
+ private mapChatItems;
387
+ }
388
+
378
389
  declare function cmd(): (target: object, propertyKey: string | symbol) => void;
379
390
 
380
391
  declare class ChatResolver {
@@ -471,6 +482,36 @@ declare class WhatsappChannelConfig implements IWhatsappChannelConfig {
471
482
 
472
483
  declare function whatsapp(config: IWhatsappChannelConfig): (target: object, propertyKey: string | symbol) => void;
473
484
 
485
+ type IWhatsAppTemplateParameter = {
486
+ type: 'text';
487
+ text: string;
488
+ } | {
489
+ type: 'currency';
490
+ currency: {
491
+ fallback_value: string;
492
+ code: string;
493
+ amount_1000: number;
494
+ };
495
+ } | {
496
+ type: 'date_time';
497
+ date_time: {
498
+ fallback_value: string;
499
+ };
500
+ };
501
+ interface IWhatsAppTemplateMessage {
502
+ templateName: string;
503
+ languageCode: string;
504
+ parameters: IWhatsAppTemplateParameter[];
505
+ }
506
+
507
+ type IWhatsAppMessageListener = (message: IConnectionChatMessage) => Promise<void>;
508
+ interface IWhatsAppConnection {
509
+ listenMessage(businessNumber: string, listener: IWhatsAppMessageListener): void;
510
+ sendWhatsApp(businessNumber: string, to: string, message: IChatMessage): Promise<void>;
511
+ sendWhatsAppTemplate(businessNumber: string, to: string, templateMessage: IWhatsAppTemplateMessage): Promise<void>;
512
+ connect(): void;
513
+ }
514
+
474
515
  interface IWhatsAppWebhookPayload {
475
516
  object: 'whatsapp_business_account';
476
517
  entry: IEntry[];
@@ -531,13 +572,6 @@ declare class WabotEnv {
531
572
  isProduction(): boolean;
532
573
  }
533
574
 
534
- type IWhatsAppMessageListener = (message: IConnectionChatMessage) => Promise<void>;
535
- interface IWhatsAppConnection {
536
- listenMessage(businessNumber: string, listener: IWhatsAppMessageListener): void;
537
- sendWhatsApp(businessNumber: string, to: string, replyMessage: IChatMessage): Promise<void>;
538
- connect(): void;
539
- }
540
-
541
575
  declare class Logger {
542
576
  private debuggers;
543
577
  constructor(name: string);
@@ -556,6 +590,7 @@ declare abstract class WhatsAppConnection implements IWhatsAppConnection {
556
590
  constructor(logger: Logger);
557
591
  abstract sendWhatsApp(businessNumber: string, to: string, chatMessage: IChatMessage): Promise<void>;
558
592
  abstract connect(): void;
593
+ abstract sendWhatsAppTemplate(businessNumber: string, to: string, templateMessage: IWhatsAppTemplateMessage): Promise<void>;
559
594
  listenMessage(businessNumber: string, listener: IWhatsAppMessageListener): void;
560
595
  protected handlePayload(payload: IWhatsAppWebhookPayload): Promise<void>;
561
596
  private emmitMessage;
@@ -568,6 +603,7 @@ declare class WhatsAppDevConnection extends WhatsAppConnection implements IWhats
568
603
  private connected;
569
604
  constructor();
570
605
  sendWhatsApp(businessNumber: string, to: string, chatMessage: IChatMessage): Promise<void>;
606
+ sendWhatsAppTemplate(businessNumber: string, to: string, templateMessage: IWhatsAppTemplateMessage): Promise<void>;
571
607
  connect(): void;
572
608
  }
573
609
 
@@ -576,6 +612,7 @@ declare class WhatsAppProdConnection implements IWhatsAppConnection {
576
612
  constructor(express: Express);
577
613
  listenMessage(businessNumber: string, listener: IWhatsAppMessageListener): void;
578
614
  sendWhatsApp(businessNumber: string, to: string, replyMessage: IChatMessage): Promise<void>;
615
+ sendWhatsAppTemplate(businessNumber: string, to: string, templateMessage: IWhatsAppTemplateMessage): Promise<void>;
579
616
  connect(): void;
580
617
  }
581
618
 
@@ -597,6 +634,7 @@ declare const devWhatsAppListentEvent: {
597
634
  declare const devWhatsappEmitEvent: {
598
635
  readonly DEV_CONNECTION: "dev-connection";
599
636
  readonly DEV_SEND_WHATSAPP: "dev-send-whatsapp";
637
+ readonly DEV_SEND_WHATSAPP_TEMPLATE: "dev-send-whatsapp-template";
600
638
  };
601
639
  interface IDevConnectionRequest {
602
640
  token: string;
@@ -606,6 +644,41 @@ interface IDevSendWhatsappRequest {
606
644
  to: string;
607
645
  message: IChatMessage;
608
646
  }
647
+ interface IDevSendWhatsappTemplateRequest {
648
+ from: string;
649
+ to: string;
650
+ message: IWhatsAppTemplateMessage;
651
+ }
652
+
653
+ declare class WhatsAppSender {
654
+ private wabotEnv;
655
+ private whatsAppConection;
656
+ constructor(wabotEnv: WabotEnv, devConnection: WhatsAppDevConnection, prodConnection: WhatsAppProdConnection);
657
+ send(businessNumber: string, to: string, message: IChatMessage): Promise<void>;
658
+ sendTemplate(businessNumber: string, to: string, templateMessage: IWhatsAppTemplateMessage): Promise<void>;
659
+ }
660
+
661
+ interface ISocketChannelConfig {
662
+ channel: string;
663
+ }
664
+
665
+ declare class SocketChannelConfig implements ISocketChannelConfig {
666
+ channel: string;
667
+ constructor(channel: string);
668
+ }
669
+
670
+ declare function socket(config: SocketChannelConfig): (target: object, propertyKey: string | symbol) => void;
671
+
672
+ declare class SocketChannel implements IChatChannel {
673
+ private config;
674
+ private server;
675
+ private chatResolver;
676
+ private userResolver;
677
+ private callBack;
678
+ constructor(config: SocketChannelConfig, server: Server, chatResolver: ChatResolver, userResolver: UserResolver);
679
+ listen(callback: (message: IReceivedMessage) => void): void;
680
+ connect(): void;
681
+ }
609
682
 
610
683
  declare function prepareChatContainer(container: DependencyContainer$1, context: IMessageContext, mindsetCtor?: IConstructor<IMindset>): Promise<DependencyContainer$1>;
611
684
 
@@ -828,4 +901,4 @@ declare class RamChatRepository implements IChatRepository {
828
901
  private getMemory;
829
902
  }
830
903
 
831
- export { AuthenticationModule, Chat, ChatBot, ChatBotAdapter, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Container, ControllerMetadataStore, EmailService, ExpressApp, type IChannelMetadata, type IChatBot, type IChatBotAdapter, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatFunctionCall, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type IConnectionChatMessage, type IConstructor, type ICrudRepository, type IDevConnectionRequest, type IDevSendWhatsappRequest, type IEmailService, type IMessageContext, type IMessageMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IOtpService, type IParamConfig, type IParamDecoration, type IPersistent, type IPgRepositoryConfig, type IReceivedMessage, type IReceivedMessageItem, type IReversibleMapper, type ISendEmailRequest, type IServerConfig, type IServerProvider, type ISqliteRecord, type ISystemFunctionCallItem, type ISystemMessageItem, type ITelegramChannelConfig, type IUserConnection, type IUserData, type IUserRepository, type IWabotEnvType, type IWhatsAppContact, type IWhatsAppMessage, type IWhatsAppWebhookPayload, type IWhatsappChannelConfig, type IchatControllerConfig, type IrunChannelProps, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, MessageContext, Mindset, MindsetMetadataStore, MindsetOperator, OpenaiChatBotAdapter, OtpService, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Persistent, PgChatMemory, PgChatRepository, PgCrudRepository, PgRepositoryBase, PgUserRepository, RamChatMemory, RamChatRepository, RamUserRepository, RegisterUserModule, RegisterUserWithEmailRequest, SendOneTimePasswordRequest, SocketIoApp, SqliteChatMemory, SqliteChatRepository, SqliteCrudRepository, SqlitePersistentMapper, SqliteUserRepository, TelegramChannel, TelegramChannelConfig, User, UserRepository, UserResolver, ValidateOneTimePasswordRequest, WabotEnv, WhatsAppChannel, WhatsappChannelConfig, chatBot, chatController, cmd, container, devWhatsAppListentEvent, devWhatsappEmitEvent, inject, injectable, isOptional, mindset, mindsetFunction, mindsetModule, param, prepareChatContainer, runChannel, runServer, singleton, sqliteMapperFor, telegram, whatsapp };
904
+ export { AuthenticationModule, Chat, ChatBot, ChatBotAdapter, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Container, ControllerMetadataStore, DeepSeekChatBotAdapter, EmailService, ExpressApp, type IChannelMetadata, type IChatBot, type IChatBotAdapter, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatFunctionCall, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type IConnectionChatMessage, type IConstructor, type ICrudRepository, type IDevConnectionRequest, type IDevSendWhatsappRequest, type IDevSendWhatsappTemplateRequest, type IEmailService, type IMessageContext, type IMessageMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IOtpService, type IParamConfig, type IParamDecoration, type IPersistent, type IPgRepositoryConfig, type IReceivedMessage, type IReceivedMessageItem, type IReversibleMapper, type ISendEmailRequest, type IServerConfig, type IServerProvider, type ISqliteRecord, type ISystemFunctionCallItem, type ISystemMessageItem, type ITelegramChannelConfig, type IUserConnection, type IUserData, type IUserRepository, type IWabotEnvType, type IWhatsAppConnection, type IWhatsAppContact, type IWhatsAppMessage, type IWhatsAppMessageListener, type IWhatsAppTemplateMessage, type IWhatsAppTemplateParameter, type IWhatsAppWebhookPayload, type IWhatsappChannelConfig, type IchatControllerConfig, type IrunChannelProps, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, MessageContext, Mindset, MindsetMetadataStore, MindsetOperator, OpenaiChatBotAdapter, OtpService, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Persistent, PgChatMemory, PgChatRepository, PgCrudRepository, PgRepositoryBase, PgUserRepository, RamChatMemory, RamChatRepository, RamUserRepository, RegisterUserModule, RegisterUserWithEmailRequest, SendOneTimePasswordRequest, SocketChannel, SocketChannelConfig, SocketIoApp, SqliteChatMemory, SqliteChatRepository, SqliteCrudRepository, SqlitePersistentMapper, SqliteUserRepository, TelegramChannel, TelegramChannelConfig, User, UserRepository, UserResolver, ValidateOneTimePasswordRequest, WabotEnv, WhatsAppChannel, WhatsAppConnection, WhatsAppDevConnection, WhatsAppProdConnection, WhatsAppSender, WhatsappChannelConfig, chatBot, chatController, cmd, container, devWhatsAppListentEvent, devWhatsappEmitEvent, inject, injectable, isOptional, mindset, mindsetFunction, mindsetModule, param, prepareChatContainer, runChannel, runServer, singleton, socket, sqliteMapperFor, telegram, whatsapp };
package/dist/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { OpenaiChatBotAdapter } from './ai/openia/OpenaiChatBotAdapter.js';
2
+ export { DeepSeekChatBotAdapter } from './ai/deepseek/DeepSeekChatBotAdapter.js';
2
3
  export { cmd } from './channels/cmd/@cmd.js';
3
4
  export { CmdChannel } from './channels/cmd/CmdChannel.js';
4
5
  export { telegram } from './channels/telegram/@telegram.js';
@@ -7,7 +8,14 @@ export { TelegramChannel } from './channels/telegram/TelegramChannel.js';
7
8
  export { whatsapp } from './channels/whatsapp/@whatsapp.js';
8
9
  export { WhatsAppChannel } from './channels/whatsapp/WhatsAppChannel.js';
9
10
  export { WhatsappChannelConfig } from './channels/whatsapp/WhatsAppChannelConfig.js';
10
- export { devWhatsAppListentEvent, devWhatsappEmitEvent } from './channels/whatsapp/whatsAppDevSocketContracts.js';
11
+ export { WhatsAppConnection } from './channels/whatsapp/WhatsAppConnection.js';
12
+ export { WhatsAppDevConnection } from './channels/whatsapp/WhatsAppDevConnection.js';
13
+ export { devWhatsAppListentEvent, devWhatsappEmitEvent } from './channels/whatsapp/WhatsAppDevSocketContracts.js';
14
+ export { WhatsAppProdConnection } from './channels/whatsapp/WhatsAppProdConnection.js';
15
+ export { WhatsAppSender } from './channels/whatsapp/WhatsAppSender.js';
16
+ export { socket } from './channels/socket-io/@socket.js';
17
+ export { SocketChannel } from './channels/socket-io/SocketChannel.js';
18
+ export { SocketChannelConfig } from './channels/socket-io/SocketChannelConfig.js';
11
19
  export { chatBot } from './chatbot/metadata/@chatBot.js';
12
20
  export { ChatBotMetadataStore } from './chatbot/metadata/ChatBotMetadataStore.js';
13
21
  export { mindsetFunction } from './mindset/metadata/functions/@mindsetFunction.js';
@@ -62,7 +62,7 @@ let MindsetOperator = class MindsetOperator {
62
62
  ...prev,
63
63
  [param.name]: this.toolParam(param),
64
64
  }), {}),
65
- required: fn.params.map((param) => param.name),
65
+ required: fn.params.filter((param) => !param.config.optional).map((param) => param.name)
66
66
  },
67
67
  };
68
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.0.16",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",