kage-baileys 25.3.10 → 25.3.12

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 (110) hide show
  1. package/Example/plugins/scarr.mjs +1 -1
  2. package/Example/plugins/unico6.mjs +1 -1
  3. package/extras/Extensions/package.json +3 -0
  4. package/extras/Extensions/rich-carousel.js +1 -1
  5. package/extras/Extensions/rich-classic.js +1 -1
  6. package/extras/index.js +10 -10
  7. package/helpers/package.json +3 -0
  8. package/lib/Framework/Bot.js +36 -1
  9. package/lib/Utils/kage-airich.js +23 -0
  10. package/lib/index.d.ts +483 -28
  11. package/lib/index.js +7 -69
  12. package/lib/index.mjs +1 -0
  13. package/package.json +8 -4
  14. package/lib/Builders/index.d.ts +0 -454
  15. package/lib/Builders/mbuilder/bot-signature.d.ts +0 -22
  16. package/lib/Builders/mbuilder/extras.d.ts +0 -348
  17. package/lib/Builders/mbuilder/html-app.d.ts +0 -19
  18. package/lib/Builders/mbuilder/index.d.ts +0 -221
  19. package/lib/Builders/mbuilder/metaai.d.ts +0 -438
  20. package/lib/Defaults/index.d.ts +0 -145
  21. package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
  22. package/lib/Signal/Group/group-session-builder.d.ts +0 -8
  23. package/lib/Signal/Group/group_cipher.d.ts +0 -11
  24. package/lib/Signal/Group/index.d.ts +0 -12
  25. package/lib/Signal/Group/keyhelper.d.ts +0 -7
  26. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  27. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  28. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  29. package/lib/Signal/Group/sender-key-name.d.ts +0 -12
  30. package/lib/Signal/Group/sender-key-record.d.ts +0 -13
  31. package/lib/Signal/Group/sender-key-state.d.ts +0 -17
  32. package/lib/Signal/Group/sender-message-key.d.ts +0 -12
  33. package/lib/Signal/libsignal.d.ts +0 -55
  34. package/lib/Signal/lid-mapping.d.ts +0 -21
  35. package/lib/Socket/Client/index.d.ts +0 -3
  36. package/lib/Socket/Client/types.d.ts +0 -6
  37. package/lib/Socket/Client/websocket.d.ts +0 -13
  38. package/lib/Socket/business.d.ts +0 -395
  39. package/lib/Socket/chats.d.ts +0 -137
  40. package/lib/Socket/communities.d.ts +0 -562
  41. package/lib/Socket/groups.d.ts +0 -286
  42. package/lib/Socket/index.d.ts +0 -530
  43. package/lib/Socket/messages-recv.d.ts +0 -334
  44. package/lib/Socket/messages-send.d.ts +0 -330
  45. package/lib/Socket/mex.d.ts +0 -2
  46. package/lib/Socket/newsletter.d.ts +0 -283
  47. package/lib/Socket/socket.d.ts +0 -61
  48. package/lib/Store/index.d.ts +0 -4
  49. package/lib/Store/make-in-memory-store.d.ts +0 -63
  50. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  51. package/lib/Store/object-repository.d.ts +0 -11
  52. package/lib/Types/Auth.d.ts +0 -2
  53. package/lib/Types/Bussines.d.ts +0 -2
  54. package/lib/Types/Call.d.ts +0 -2
  55. package/lib/Types/Chat.d.ts +0 -2
  56. package/lib/Types/Contact.d.ts +0 -2
  57. package/lib/Types/Events.d.ts +0 -2
  58. package/lib/Types/GroupMetadata.d.ts +0 -2
  59. package/lib/Types/Label.d.ts +0 -3
  60. package/lib/Types/LabelAssociation.d.ts +0 -3
  61. package/lib/Types/Message.d.ts +0 -12
  62. package/lib/Types/Mex.d.ts +0 -3
  63. package/lib/Types/Product.d.ts +0 -2
  64. package/lib/Types/RichType.d.ts +0 -3
  65. package/lib/Types/Signal.d.ts +0 -2
  66. package/lib/Types/Socket.d.ts +0 -2
  67. package/lib/Types/State.d.ts +0 -6
  68. package/lib/Types/USync.d.ts +0 -2
  69. package/lib/Types/index.d.ts +0 -14
  70. package/lib/Utils/auth-utils.d.ts +0 -58
  71. package/lib/Utils/browser-utils.d.ts +0 -9
  72. package/lib/Utils/business.d.ts +0 -50
  73. package/lib/Utils/chat-utils.d.ts +0 -409
  74. package/lib/Utils/companion-reg-client-utils.d.ts +0 -5
  75. package/lib/Utils/crypto.d.ts +0 -40
  76. package/lib/Utils/decode-wa-message.d.ts +0 -84
  77. package/lib/Utils/event-buffer.d.ts +0 -13
  78. package/lib/Utils/generics.d.ts +0 -71
  79. package/lib/Utils/history.d.ts +0 -76
  80. package/lib/Utils/identity-change-handler.d.ts +0 -14
  81. package/lib/Utils/index.d.ts +0 -25
  82. package/lib/Utils/link-preview.d.ts +0 -13
  83. package/lib/Utils/logger.d.ts +0 -3
  84. package/lib/Utils/lt-hash.d.ts +0 -7
  85. package/lib/Utils/make-mutex.d.ts +0 -7
  86. package/lib/Utils/message-retry-manager.d.ts +0 -80
  87. package/lib/Utils/messages-media.d.ts +0 -137
  88. package/lib/Utils/messages.d.ts +0 -47
  89. package/lib/Utils/noise-handler.d.ts +0 -21
  90. package/lib/Utils/offline-node-processor.d.ts +0 -10
  91. package/lib/Utils/pre-key-manager.d.ts +0 -26
  92. package/lib/Utils/process-message.d.ts +0 -84
  93. package/lib/Utils/reporting-utils.d.ts +0 -13
  94. package/lib/Utils/rich-message-utils.d.ts +0 -49
  95. package/lib/Utils/signal.d.ts +0 -83
  96. package/lib/Utils/stanza-ack.d.ts +0 -17
  97. package/lib/Utils/sync-action-utils.d.ts +0 -3
  98. package/lib/Utils/tc-token-utils.d.ts +0 -30
  99. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -11
  100. package/lib/Utils/use-single-file-auth-state.d.ts +0 -11
  101. package/lib/Utils/use-sqlite-auth-state.d.ts +0 -11
  102. package/lib/Utils/validate-connection.d.ts +0 -44
  103. package/lib/WABinary/constants.d.ts +0 -62
  104. package/lib/WABinary/decode.d.ts +0 -10
  105. package/lib/WABinary/encode.d.ts +0 -3
  106. package/lib/WABinary/generic-utils.d.ts +0 -77
  107. package/lib/WABinary/index.d.ts +0 -6
  108. package/lib/WABinary/jid-utils.d.ts +0 -29
  109. package/lib/WABinary/types.d.ts +0 -2
  110. /package/extras/{optional-media.js → optional-media.mjs} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  createKageCarouselMessage,
5
5
  sendKageInteractiveMessage,
6
6
  validateKageInteractiveMessage
7
- } from '@whiskeysockets/baileys'
7
+ } from 'kage-baileys'
8
8
 
9
9
 
10
10
 
@@ -4,7 +4,7 @@ import {
4
4
  createKageOrderDetails,
5
5
  createKageInteractiveMessage,
6
6
  sendKageInteractiveMessage
7
- } from '@whiskeysockets/baileys'
7
+ } from 'kage-baileys'
8
8
 
9
9
 
10
10
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -16,7 +16,7 @@
16
16
  * generateWAMessageFromContent(jid, content, { userJid }) lalu
17
17
  * relayMessage(jid, msg.message, { messageId: msg.key.id }).
18
18
  */
19
- import { generateWAMessageFromContent } from '../Utils/messages.js';
19
+ import { generateWAMessageFromContent } from '../../lib/Utils/messages.js';
20
20
 
21
21
  /**
22
22
  * Normalisasi 1 definisi tombol ringkas menjadi NativeFlowButton
@@ -16,7 +16,7 @@
16
16
  * generateWAMessageFromContent(jid, content, { userJid }) lalu
17
17
  * relayMessage(jid, msg.message, { messageId: msg.key.id }).
18
18
  */
19
- import { generateWAMessageFromContent } from '../Utils/messages.js';
19
+ import { generateWAMessageFromContent } from '../../lib/Utils/messages.js';
20
20
 
21
21
  /**
22
22
  * Normalisasi userJid.
package/extras/index.js CHANGED
@@ -2,27 +2,27 @@
2
2
  * Kage Baileys — índice de extras
3
3
  * MessageBuilder extendido, rich UI, módulos proto adicionales
4
4
  */
5
+ const fs = require('fs')
5
6
  const path = require('path')
6
7
 
7
8
  function load(rel) {
8
- try {
9
- return require(path.join(__dirname, rel))
10
- } catch (e) {
11
- return null
12
- }
9
+ const target = path.resolve(__dirname, rel)
10
+ if (!fs.existsSync(target)) return null
11
+ // Do not hide dependency or module-format errors behind a null return.
12
+ return require(target)
13
13
  }
14
14
 
15
15
  module.exports = {
16
- loadMessageBuilder: () => load('MessageBuilder/index.js'),
17
- loadMessageExtras: () => load('MessageBuilder/extras.js'),
18
- loadMetaAI: () => load('MessageBuilder/metaai.js'),
19
- loadBotSignature: () => load('MessageBuilder/bot-signature.js'),
16
+ loadMessageBuilder: () => load('../lib/Builders/mbuilder/index.js'),
17
+ loadMessageExtras: () => load('../lib/Builders/mbuilder/extras.js'),
18
+ loadMetaAI: () => load('../lib/Builders/mbuilder/metaai.js'),
19
+ loadBotSignature: () => load('../lib/Builders/mbuilder/bot-signature.js'),
20
20
  loadRichMenu: () => load('Extensions/rich-menu.js'),
21
21
  loadRichCarousel: () => load('Extensions/rich-carousel.js'),
22
22
  loadRichClassic: () => load('Extensions/rich-classic.js'),
23
23
  loadRichWebUI: () => load('Extensions/rich-webui.js'),
24
24
  loadMediaProcessor: () => load('Extensions/media-processor.js'),
25
- loadOptionalMedia: () => load('optional-media.js'),
25
+ loadOptionalMedia: () => load('optional-media.mjs'),
26
26
  loadProtoModule: (name) => load(`WAProto/${name}/${name}.js`),
27
27
  PROTO_MODULES: [
28
28
  'Adv', 'BotMetadata', 'Cert', 'ChatLockSettings', 'CompanionReg',
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -3,7 +3,42 @@ import makeWASocket from "../Socket/index.js";
3
3
  import { DisconnectReason } from "../Types/index.js";
4
4
  import { isJidGroup } from "../WABinary/index.js";
5
5
  import defaultLogger from "../Utils/logger.js";
6
- import { fetchBestWaVersion } from "../Utils/generics.js";
6
+ import generics from "../Utils/generics.js";
7
+
8
+ // Import CommonJS utilities through their default namespace. Node's synthetic
9
+ // named-export detection can miss exports appended by compiled/merged CJS files.
10
+ // Keep startup compatible with older installs that only expose the legacy
11
+ // version lookup helpers.
12
+ const fetchBestWaVersion = async (options = {}) => {
13
+ const isValid = (value) => Array.isArray(value?.version) && value.version.length === 3;
14
+
15
+ if (typeof generics.fetchBestWaVersion === "function") {
16
+ try {
17
+ const result = await generics.fetchBestWaVersion(options);
18
+ if (isValid(result)) return result;
19
+ } catch (error) {
20
+ // Continue to the legacy lookup functions; version lookup must not stop
21
+ // the bot from starting when WhatsApp's public endpoint is unavailable.
22
+ }
23
+ }
24
+
25
+ for (const [name, source] of [
26
+ ["fetchLatestWaWebVersion", "wa-web"],
27
+ ["fetchLatestBaileysVersion", "baileys-upstream"]
28
+ ]) {
29
+ const lookup = generics[name];
30
+ if (typeof lookup !== "function") continue;
31
+ try {
32
+ const result = await lookup(options);
33
+ if (isValid(result) && !result.error) return { ...result, source };
34
+ } catch (error) {
35
+ // Try the next known source. resolveSocketVersionConfig keeps the
36
+ // configured/default version when all lookups fail.
37
+ }
38
+ }
39
+
40
+ throw new Error("No compatible Baileys version lookup is available");
41
+ };
7
42
  import { SQLiteStore } from "./Store/SQLiteStore.js";
8
43
  import { Context } from "./Context.js";
9
44
  import { SessionManager } from "./SessionManager.js";
@@ -109,6 +109,24 @@ class KageAIRich {
109
109
  return this;
110
110
  }
111
111
 
112
+ /** Add a pre-built GenAI section without converting it into media. */
113
+ addSection(section) {
114
+ if (!section || typeof section !== 'object' || Array.isArray(section)) {
115
+ throw new TypeError('addSection(section) requiere un objeto');
116
+ }
117
+ if (!section.view_model || typeof section.view_model !== 'object' || Array.isArray(section.view_model)) {
118
+ throw new TypeError('addSection(section) requiere section.view_model');
119
+ }
120
+ let normalized;
121
+ try {
122
+ normalized = structuredClone(section);
123
+ } catch (error) {
124
+ throw new TypeError(`addSection(section) debe ser clonable: ${error?.message || error}`);
125
+ }
126
+ this._sections.push(normalized);
127
+ return this;
128
+ }
129
+
112
130
  setContextInfo(contextInfo) {
113
131
  if (contextInfo && typeof contextInfo === 'object' && !Array.isArray(contextInfo)) {
114
132
  this._contextInfo = { ...this._contextInfo, ...contextInfo };
@@ -372,6 +390,11 @@ class KageAIRich {
372
390
  userJidLid,
373
391
  timestamp,
374
392
  ephemeralExpiration,
393
+ // Compatibility flags accepted by the higher-level helper. KageAIRich
394
+ // deliberately performs one relay and never sends a follow-up edit.
395
+ bypassDownload: _bypassDownload,
396
+ nativeEdit: _nativeEdit,
397
+ skipImageFallback: _skipImageFallback,
375
398
  ...relayOptions
376
399
  } = options;
377
400