@wabot-dev/framework 0.0.14 → 0.0.17
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/src/ai/deepseek/DeepSeekChatBotAdapter.js +108 -0
- package/dist/src/channels/cmd/@cmd.js +1 -1
- package/dist/src/channels/cmd/CmdChannel.js +1 -1
- package/dist/src/channels/socket-io/@socket.js +24 -0
- package/dist/src/channels/socket-io/SocketChannel.js +78 -0
- package/dist/src/channels/socket-io/SocketChannelConfig.js +15 -0
- package/dist/src/channels/telegram/@telegram.js +1 -1
- package/dist/src/channels/telegram/TelegramChannel.js +1 -1
- package/dist/src/channels/whatsapp/@whatsapp.js +1 -1
- package/dist/src/channels/whatsapp/WhatsAppChannel.js +1 -1
- package/dist/src/channels/whatsapp/WhatsAppConnection.js +1 -1
- package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +11 -3
- package/dist/src/channels/whatsapp/{whatsAppDevSocketContracts.js → WhatsAppDevSocketContracts.js} +1 -0
- package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +4 -1
- package/dist/src/channels/whatsapp/WhatsAppSender.js +23 -0
- package/dist/src/controller/socket.io/SocketIO.js +1 -1
- package/dist/src/index.d.ts +82 -9
- package/dist/src/index.js +9 -1
- package/dist/src/logger/Logger.js +1 -1
- package/dist/src/mindset/MindsetOperator.js +1 -1
- package/dist/src/server/runChannel.js +1 -1
- package/dist/src/server/runServer.js +4 -4
- package/package.json +2 -1
- package/dist/src/_virtual/XMLHttpRequest.js +0 -7
- package/dist/src/_virtual/_commonjsHelpers.js +0 -32
- package/dist/src/_virtual/base64id.js +0 -3
- package/dist/src/_virtual/binary.js +0 -3
- package/dist/src/_virtual/bom-handling.js +0 -3
- package/dist/src/_virtual/broadcast-operator.js +0 -3
- package/dist/src/_virtual/browser.js +0 -3
- package/dist/src/_virtual/browser2.js +0 -3
- package/dist/src/_virtual/browser3.js +0 -3
- package/dist/src/_virtual/browser4.js +0 -3
- package/dist/src/_virtual/browser5.js +0 -3
- package/dist/src/_virtual/buffer-util.js +0 -3
- package/dist/src/_virtual/buffer-util2.js +0 -3
- package/dist/src/_virtual/buffer-util3.js +0 -3
- package/dist/src/_virtual/charset.js +0 -3
- package/dist/src/_virtual/charset2.js +0 -3
- package/dist/src/_virtual/client.js +0 -3
- package/dist/src/_virtual/cluster-adapter.js +0 -3
- package/dist/src/_virtual/commons.js +0 -3
- package/dist/src/_virtual/dbcs-codec.js +0 -3
- package/dist/src/_virtual/decodePacket.js +0 -3
- package/dist/src/_virtual/encodePacket.js +0 -3
- package/dist/src/_virtual/encoding.js +0 -3
- package/dist/src/_virtual/encoding2.js +0 -3
- package/dist/src/_virtual/engine.io.js +0 -3
- package/dist/src/_virtual/in-memory-adapter.js +0 -3
- package/dist/src/_virtual/index.js +0 -7
- package/dist/src/_virtual/index10.js +0 -3
- package/dist/src/_virtual/index11.js +0 -3
- package/dist/src/_virtual/index12.js +0 -3
- package/dist/src/_virtual/index13.js +0 -3
- package/dist/src/_virtual/index14.js +0 -3
- package/dist/src/_virtual/index15.js +0 -3
- package/dist/src/_virtual/index16.js +0 -3
- package/dist/src/_virtual/index17.js +0 -3
- package/dist/src/_virtual/index18.js +0 -3
- package/dist/src/_virtual/index19.js +0 -3
- package/dist/src/_virtual/index2.js +0 -7
- package/dist/src/_virtual/index20.js +0 -3
- package/dist/src/_virtual/index21.js +0 -3
- package/dist/src/_virtual/index22.js +0 -3
- package/dist/src/_virtual/index23.js +0 -3
- package/dist/src/_virtual/index24.js +0 -3
- package/dist/src/_virtual/index25.js +0 -3
- package/dist/src/_virtual/index26.js +0 -3
- package/dist/src/_virtual/index27.js +0 -3
- package/dist/src/_virtual/index28.js +0 -3
- package/dist/src/_virtual/index29.js +0 -3
- package/dist/src/_virtual/index3.js +0 -7
- package/dist/src/_virtual/index30.js +0 -3
- package/dist/src/_virtual/index31.js +0 -3
- package/dist/src/_virtual/index32.js +0 -3
- package/dist/src/_virtual/index33.js +0 -3
- package/dist/src/_virtual/index4.js +0 -3
- package/dist/src/_virtual/index5.js +0 -3
- package/dist/src/_virtual/index6.js +0 -3
- package/dist/src/_virtual/index7.js +0 -3
- package/dist/src/_virtual/index8.js +0 -6
- package/dist/src/_virtual/index9.js +0 -3
- package/dist/src/_virtual/inherits.js +0 -3
- package/dist/src/_virtual/inherits_browser.js +0 -3
- package/dist/src/_virtual/is-binary.js +0 -3
- package/dist/src/_virtual/language.js +0 -3
- package/dist/src/_virtual/language2.js +0 -3
- package/dist/src/_virtual/mediaType.js +0 -3
- package/dist/src/_virtual/mediaType2.js +0 -3
- package/dist/src/_virtual/namespace.js +0 -3
- package/dist/src/_virtual/node.js +0 -3
- package/dist/src/_virtual/node2.js +0 -3
- package/dist/src/_virtual/node3.js +0 -3
- package/dist/src/_virtual/node4.js +0 -3
- package/dist/src/_virtual/node5.js +0 -3
- package/dist/src/_virtual/parent-namespace.js +0 -3
- package/dist/src/_virtual/polling-jsonp.js +0 -3
- package/dist/src/_virtual/polling.js +0 -3
- package/dist/src/_virtual/polling2.js +0 -3
- package/dist/src/_virtual/receiver.js +0 -3
- package/dist/src/_virtual/sbcs-codec.js +0 -3
- package/dist/src/_virtual/sender.js +0 -3
- package/dist/src/_virtual/server.js +0 -3
- package/dist/src/_virtual/socket-types.js +0 -3
- package/dist/src/_virtual/socket.js +0 -3
- package/dist/src/_virtual/socket2.js +0 -3
- package/dist/src/_virtual/stream.js +0 -3
- package/dist/src/_virtual/transport.js +0 -3
- package/dist/src/_virtual/typed-events.js +0 -3
- package/dist/src/_virtual/userver.js +0 -3
- package/dist/src/_virtual/utf16.js +0 -3
- package/dist/src/_virtual/utf32.js +0 -3
- package/dist/src/_virtual/utf7.js +0 -3
- package/dist/src/_virtual/uws.js +0 -3
- package/dist/src/_virtual/validation.js +0 -3
- package/dist/src/_virtual/validation2.js +0 -3
- package/dist/src/_virtual/validation3.js +0 -3
- package/dist/src/_virtual/websocket-server.js +0 -3
- package/dist/src/_virtual/websocket.js +0 -7
- package/dist/src/_virtual/websocket2.js +0 -3
- package/dist/src/_virtual/websocket3.js +0 -3
- package/dist/src/_virtual/webtransport.js +0 -3
- package/dist/src/_virtual/yeast.js +0 -3
- package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -171
- package/dist/src/node_modules/base64id/lib/base64id.js +0 -117
- package/dist/src/node_modules/body-parser/index.js +0 -96
- package/dist/src/node_modules/body-parser/lib/read.js +0 -225
- package/dist/src/node_modules/body-parser/lib/types/json.js +0 -222
- package/dist/src/node_modules/body-parser/lib/types/raw.js +0 -90
- package/dist/src/node_modules/body-parser/lib/types/text.js +0 -95
- package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +0 -194
- package/dist/src/node_modules/body-parser/lib/utils.js +0 -96
- package/dist/src/node_modules/bytes/index.js +0 -180
- package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +0 -24
- package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +0 -13
- package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +0 -13
- package/dist/src/node_modules/call-bind-apply-helpers/index.js +0 -29
- package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +0 -13
- package/dist/src/node_modules/call-bound/index.js +0 -31
- package/dist/src/node_modules/content-type/index.js +0 -235
- package/dist/src/node_modules/cookie/index.js +0 -345
- package/dist/src/node_modules/cors/lib/index.js +0 -249
- package/dist/src/node_modules/debug/src/browser.js +0 -286
- package/dist/src/node_modules/debug/src/common.js +0 -303
- package/dist/src/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/depd/index.js +0 -550
- package/dist/src/node_modules/dunder-proto/get.js +0 -42
- package/dist/src/node_modules/ee-first/index.js +0 -104
- package/dist/src/node_modules/engine.io/build/engine.io.js +0 -73
- package/dist/src/node_modules/engine.io/build/parser-v3/index.js +0 -429
- package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +0 -198
- package/dist/src/node_modules/engine.io/build/server.js +0 -808
- package/dist/src/node_modules/engine.io/build/socket.js +0 -469
- package/dist/src/node_modules/engine.io/build/transport.js +0 -131
- package/dist/src/node_modules/engine.io/build/transports/index.js +0 -37
- package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +0 -53
- package/dist/src/node_modules/engine.io/build/transports/polling.js +0 -346
- package/dist/src/node_modules/engine.io/build/transports/websocket.js +0 -106
- package/dist/src/node_modules/engine.io/build/transports/webtransport.js +0 -76
- package/dist/src/node_modules/engine.io/build/transports-uws/index.js +0 -20
- package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +0 -378
- package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +0 -85
- package/dist/src/node_modules/engine.io/build/userver.js +0 -292
- package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +0 -250
- package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +0 -10704
- package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +0 -24
- package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +0 -202
- package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +0 -96
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +0 -179
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +0 -193
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +0 -188
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +0 -304
- package/dist/src/node_modules/engine.io/node_modules/ws/index.js +0 -28
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +0 -142
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +0 -21
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +0 -303
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +0 -214
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +0 -64
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +0 -528
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +0 -719
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +0 -513
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +0 -170
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +0 -73
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +0 -141
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +0 -559
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +0 -1363
- package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -13
- package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -36
- package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -66
- package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +0 -92
- package/dist/src/node_modules/engine.io-client/build/esm/index.js +0 -17
- package/dist/src/node_modules/engine.io-client/build/esm/socket.js +0 -728
- package/dist/src/node_modules/engine.io-client/build/esm/transport.js +0 -143
- package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +0 -11
- package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -256
- package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -21
- package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +0 -146
- package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -107
- package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -48
- package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -83
- package/dist/src/node_modules/engine.io-client/build/esm/util.js +0 -62
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +0 -142
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +0 -21
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +0 -303
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +0 -214
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +0 -64
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +0 -528
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +0 -719
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +0 -513
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +0 -170
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +0 -73
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +0 -141
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +0 -559
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +0 -1363
- package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +0 -29
- package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -70
- package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -51
- package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +0 -179
- package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +0 -15
- package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -58
- package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -36
- package/dist/src/node_modules/engine.io-parser/build/esm/index.js +0 -158
- package/dist/src/node_modules/es-define-property/index.js +0 -23
- package/dist/src/node_modules/es-errors/eval.js +0 -13
- package/dist/src/node_modules/es-errors/index.js +0 -13
- package/dist/src/node_modules/es-errors/range.js +0 -13
- package/dist/src/node_modules/es-errors/ref.js +0 -13
- package/dist/src/node_modules/es-errors/syntax.js +0 -13
- package/dist/src/node_modules/es-errors/type.js +0 -13
- package/dist/src/node_modules/es-errors/uri.js +0 -13
- package/dist/src/node_modules/es-object-atoms/index.js +0 -13
- package/dist/src/node_modules/function-bind/implementation.js +0 -93
- package/dist/src/node_modules/function-bind/index.js +0 -16
- package/dist/src/node_modules/get-intrinsic/index.js +0 -413
- package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +0 -17
- package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -13
- package/dist/src/node_modules/get-proto/index.js +0 -40
- package/dist/src/node_modules/gopd/gOPD.js +0 -13
- package/dist/src/node_modules/gopd/index.js +0 -26
- package/dist/src/node_modules/has-symbols/index.js +0 -25
- package/dist/src/node_modules/has-symbols/shams.js +0 -54
- package/dist/src/node_modules/hasown/index.js +0 -19
- package/dist/src/node_modules/http-errors/index.js +0 -306
- package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -598
- package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +0 -206
- package/dist/src/node_modules/iconv-lite/encodings/index.js +0 -44
- package/dist/src/node_modules/iconv-lite/encodings/internal.js +0 -210
- package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -83
- package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -460
- package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +0 -187
- package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +0 -506
- package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +0 -2621
- package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +0 -2380
- package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +0 -729
- package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +0 -822
- package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +0 -424
- package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +0 -264
- package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +0 -548
- package/dist/src/node_modules/iconv-lite/encodings/utf16.js +0 -206
- package/dist/src/node_modules/iconv-lite/encodings/utf32.js +0 -329
- package/dist/src/node_modules/iconv-lite/encodings/utf7.js +0 -297
- package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +0 -61
- package/dist/src/node_modules/iconv-lite/lib/index.js +0 -192
- package/dist/src/node_modules/iconv-lite/lib/streams.js +0 -120
- package/dist/src/node_modules/inherits/inherits.js +0 -21
- package/dist/src/node_modules/inherits/inherits_browser.js +0 -38
- package/dist/src/node_modules/math-intrinsics/abs.js +0 -13
- package/dist/src/node_modules/math-intrinsics/floor.js +0 -13
- package/dist/src/node_modules/math-intrinsics/isNaN.js +0 -15
- package/dist/src/node_modules/math-intrinsics/max.js +0 -13
- package/dist/src/node_modules/math-intrinsics/min.js +0 -13
- package/dist/src/node_modules/math-intrinsics/pow.js +0 -13
- package/dist/src/node_modules/math-intrinsics/round.js +0 -13
- package/dist/src/node_modules/math-intrinsics/sign.js +0 -22
- package/dist/src/node_modules/media-typer/index.js +0 -153
- package/dist/src/node_modules/mime-db/db.json.js +0 -11656
- package/dist/src/node_modules/mime-db/index.js +0 -24
- package/dist/src/node_modules/mime-types/index.js +0 -226
- package/dist/src/node_modules/mime-types/mimeScore.js +0 -62
- package/dist/src/node_modules/ms/index.js +0 -172
- package/dist/src/node_modules/object-assign/index.js +0 -99
- package/dist/src/node_modules/object-inspect/index.js +0 -557
- package/dist/src/node_modules/object-inspect/util.inspect.js +0 -13
- package/dist/src/node_modules/on-finished/index.js +0 -245
- package/dist/src/node_modules/qs/lib/formats.js +0 -32
- package/dist/src/node_modules/qs/lib/index.js +0 -24
- package/dist/src/node_modules/qs/lib/parse.js +0 -339
- package/dist/src/node_modules/qs/lib/stringify.js +0 -369
- package/dist/src/node_modules/qs/lib/utils.js +0 -279
- package/dist/src/node_modules/raw-body/index.js +0 -351
- package/dist/src/node_modules/safer-buffer/safer.js +0 -88
- package/dist/src/node_modules/setprototypeof/index.js +0 -26
- package/dist/src/node_modules/side-channel/index.js +0 -58
- package/dist/src/node_modules/side-channel-list/index.js +0 -125
- package/dist/src/node_modules/side-channel-map/index.js +0 -82
- package/dist/src/node_modules/side-channel-weakmap/index.js +0 -99
- package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +0 -448
- package/dist/src/node_modules/socket.io/dist/client.js +0 -281
- package/dist/src/node_modules/socket.io/dist/index.js +0 -837
- package/dist/src/node_modules/socket.io/dist/namespace.js +0 -597
- package/dist/src/node_modules/socket.io/dist/parent-namespace.js +0 -101
- package/dist/src/node_modules/socket.io/dist/socket-types.js +0 -21
- package/dist/src/node_modules/socket.io/dist/socket.js +0 -993
- package/dist/src/node_modules/socket.io/dist/typed-events.js +0 -92
- package/dist/src/node_modules/socket.io/dist/uws.js +0 -149
- package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +0 -250
- package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +0 -10704
- package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +0 -24
- package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +0 -202
- package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +0 -96
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +0 -179
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +0 -193
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +0 -188
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +0 -304
- package/dist/src/node_modules/socket.io/package.json.js +0 -5
- package/dist/src/node_modules/socket.io/wrapper.js +0 -5
- package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -689
- package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -64
- package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -407
- package/dist/src/node_modules/socket.io-adapter/dist/index.js +0 -24
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +0 -28
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +0 -142
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +0 -21
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +0 -303
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +0 -214
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +0 -64
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +0 -528
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +0 -719
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +0 -513
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +0 -170
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +0 -73
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +0 -141
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +0 -559
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +0 -1363
- package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -68
- package/dist/src/node_modules/socket.io-client/build/esm/index.js +0 -50
- package/dist/src/node_modules/socket.io-client/build/esm/manager.js +0 -373
- package/dist/src/node_modules/socket.io-client/build/esm/on.js +0 -8
- package/dist/src/node_modules/socket.io-client/build/esm/socket.js +0 -884
- package/dist/src/node_modules/socket.io-client/build/esm/url.js +0 -63
- package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +0 -99
- package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +0 -337
- package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -65
- package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +0 -86
- package/dist/src/node_modules/socket.io-parser/build/esm/index.js +0 -314
- package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +0 -52
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/statuses/codes.json.js +0 -67
- package/dist/src/node_modules/statuses/index.js +0 -157
- package/dist/src/node_modules/toidentifier/index.js +0 -41
- package/dist/src/node_modules/type-is/index.js +0 -263
- package/dist/src/node_modules/unpipe/index.js +0 -78
- package/dist/src/node_modules/vary/index.js +0 -159
- package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -702
|
@@ -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 };
|
|
@@ -5,7 +5,7 @@ import '../../core/chat/repository/IChatRepository.js';
|
|
|
5
5
|
import '../../core/user/IUserRepository.js';
|
|
6
6
|
import { ControllerMetadataStore } from '../../controller/metadata/ControllerMetadataStore.js';
|
|
7
7
|
import 'express';
|
|
8
|
-
import '
|
|
8
|
+
import 'socket.io';
|
|
9
9
|
import { CmdChannel } from './CmdChannel.js';
|
|
10
10
|
|
|
11
11
|
function cmd() {
|
|
@@ -6,7 +6,7 @@ import '../../core/chat/repository/IChatRepository.js';
|
|
|
6
6
|
import '../../core/user/IUserRepository.js';
|
|
7
7
|
import '../../controller/metadata/ControllerMetadataStore.js';
|
|
8
8
|
import 'express';
|
|
9
|
-
import '
|
|
9
|
+
import 'socket.io';
|
|
10
10
|
import * as readline from 'readline';
|
|
11
11
|
|
|
12
12
|
var CmdChannel_1;
|
|
@@ -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 };
|
|
@@ -5,7 +5,7 @@ import '../../core/chat/repository/IChatRepository.js';
|
|
|
5
5
|
import '../../core/user/IUserRepository.js';
|
|
6
6
|
import { ControllerMetadataStore } from '../../controller/metadata/ControllerMetadataStore.js';
|
|
7
7
|
import 'express';
|
|
8
|
-
import '
|
|
8
|
+
import 'socket.io';
|
|
9
9
|
import { TelegramChannel } from './TelegramChannel.js';
|
|
10
10
|
import { TelegramChannelConfig } from './TelegramChannelConfig.js';
|
|
11
11
|
|
|
@@ -6,7 +6,7 @@ import '../../core/chat/repository/IChatRepository.js';
|
|
|
6
6
|
import '../../core/user/IUserRepository.js';
|
|
7
7
|
import '../../controller/metadata/ControllerMetadataStore.js';
|
|
8
8
|
import 'express';
|
|
9
|
-
import '
|
|
9
|
+
import 'socket.io';
|
|
10
10
|
import { Bot } from 'grammy';
|
|
11
11
|
import { TelegramChannelConfig } from './TelegramChannelConfig.js';
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ import '../../core/chat/repository/IChatRepository.js';
|
|
|
6
6
|
import '../../core/user/IUserRepository.js';
|
|
7
7
|
import { ControllerMetadataStore } from '../../controller/metadata/ControllerMetadataStore.js';
|
|
8
8
|
import 'express';
|
|
9
|
-
import '
|
|
9
|
+
import 'socket.io';
|
|
10
10
|
import { WhatsAppChannel } from './WhatsAppChannel.js';
|
|
11
11
|
|
|
12
12
|
function whatsapp(config) {
|
|
@@ -6,7 +6,7 @@ import '../../core/chat/repository/IChatRepository.js';
|
|
|
6
6
|
import '../../core/user/IUserRepository.js';
|
|
7
7
|
import '../../controller/metadata/ControllerMetadataStore.js';
|
|
8
8
|
import 'express';
|
|
9
|
-
import '
|
|
9
|
+
import 'socket.io';
|
|
10
10
|
import { WabotEnv } from '../../env/WabotEnv.js';
|
|
11
11
|
import { Logger } from '../../logger/Logger.js';
|
|
12
12
|
import { WhatsappChannelConfig } from './WhatsAppChannelConfig.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import { singleton } from '../../injection/index.js';
|
|
3
3
|
import { Logger } from '../../logger/Logger.js';
|
|
4
|
-
import { io
|
|
4
|
+
import { io } from 'socket.io-client';
|
|
5
5
|
import { WhatsAppConnection } from './WhatsAppConnection.js';
|
|
6
|
-
import { devWhatsappEmitEvent, devWhatsAppListentEvent } from './
|
|
6
|
+
import { devWhatsappEmitEvent, devWhatsAppListentEvent } from './WhatsAppDevSocketContracts.js';
|
|
7
7
|
|
|
8
8
|
let WhatsAppDevConnection = class WhatsAppDevConnection extends WhatsAppConnection {
|
|
9
9
|
devProxy;
|
|
@@ -14,7 +14,7 @@ let WhatsAppDevConnection = class WhatsAppDevConnection extends WhatsAppConnecti
|
|
|
14
14
|
super(new Logger('wabot:whatsapp-dev-connection'));
|
|
15
15
|
this.devProxy = process.env.WABOT_DEV_PROXY ?? 'https://proxy.wabot.dev';
|
|
16
16
|
this.devToken = process.env.WABOT_DEV_TOKEN;
|
|
17
|
-
this.devProxySocket =
|
|
17
|
+
this.devProxySocket = io(this.devProxy, { autoConnect: false });
|
|
18
18
|
}
|
|
19
19
|
async sendWhatsApp(businessNumber, to, chatMessage) {
|
|
20
20
|
const req = {
|
|
@@ -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;
|
package/dist/src/channels/whatsapp/{whatsAppDevSocketContracts.js → WhatsAppDevSocketContracts.js}
RENAMED
|
@@ -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 };
|
|
@@ -6,7 +6,7 @@ import '../../core/chat/repository/IChatRepository.js';
|
|
|
6
6
|
import '../../core/user/IUserRepository.js';
|
|
7
7
|
import '../../controller/metadata/ControllerMetadataStore.js';
|
|
8
8
|
import { ExpressApp } from '../../controller/express/Express.js';
|
|
9
|
-
import '
|
|
9
|
+
import 'socket.io';
|
|
10
10
|
import { singleton } from 'tsyringe';
|
|
11
11
|
|
|
12
12
|
let WhatsAppProdConnection = class WhatsAppProdConnection {
|
|
@@ -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 };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
}
|
|
@@ -12,7 +12,7 @@ import '../controller/channel/ChatResolver.js';
|
|
|
12
12
|
import '../controller/channel/UserResolver.js';
|
|
13
13
|
import '../controller/metadata/ControllerMetadataStore.js';
|
|
14
14
|
import 'express';
|
|
15
|
-
import '
|
|
15
|
+
import 'socket.io';
|
|
16
16
|
import { prepareChatContainer } from './prepareChatContainer.js';
|
|
17
17
|
|
|
18
18
|
function runChannel(props) {
|
|
@@ -8,16 +8,16 @@ import { ExpressApp } from '../controller/express/Express.js';
|
|
|
8
8
|
import { SocketIoApp } from '../controller/socket.io/SocketIO.js';
|
|
9
9
|
import { prepareChatContainer } from './prepareChatContainer.js';
|
|
10
10
|
import express from 'express';
|
|
11
|
-
import { Server } from '
|
|
12
|
-
import
|
|
13
|
-
import bodyParser from '
|
|
11
|
+
import { Server } from 'socket.io';
|
|
12
|
+
import http from 'http';
|
|
13
|
+
import bodyParser from 'body-parser';
|
|
14
14
|
import { Logger } from '../logger/Logger.js';
|
|
15
15
|
|
|
16
16
|
function runServer(config) {
|
|
17
17
|
const httpLogger = new Logger('wabot:http');
|
|
18
18
|
const socketLogger = new Logger('wabot:socket');
|
|
19
19
|
const expressApp = express();
|
|
20
|
-
const httpServer =
|
|
20
|
+
const httpServer = http.createServer(expressApp);
|
|
21
21
|
const io = new Server(httpServer, {
|
|
22
22
|
cors: {
|
|
23
23
|
origin: '*',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wabot-dev/framework",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Framework for IA Chat Bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@types/express": "^5.0.1",
|
|
39
39
|
"@types/pg": "^8.11.14",
|
|
40
40
|
"@yucacodes/ts": "^0.0.4",
|
|
41
|
+
"body-parser": "^2.2.0",
|
|
41
42
|
"class-transformer": "^0.5.1",
|
|
42
43
|
"class-validator": "^0.14.1",
|
|
43
44
|
"debug": "^4.4.0",
|