kage-baileys 25.3.6 → 25.3.8

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,4 @@
1
+ {
2
+ "private": true,
3
+ "type": "module"
4
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * TypeScript compatibility surface for the runtime-normalized WAProto export.
3
+ * The runtime protobuf constructors are generated from WAProto.proto; these
4
+ * declarations intentionally keep uncommon generated fields permissive so
5
+ * they do not claim a hand-maintained schema that can drift from the proto.
6
+ * For exact field-level types, use the checked-in WAProto.proto definitions.
7
+ */
8
+ export declare namespace proto {
9
+ export interface WebMessageInfo {
10
+ key?: any;
11
+ message?: Message;
12
+ messageTimestamp?: any;
13
+ messageStubType?: any;
14
+ [key: string]: any;
15
+ }
16
+ export namespace WebMessageInfo {
17
+ const Status: any;
18
+ const StubType: any;
19
+ }
20
+
21
+ export interface Message {
22
+ [key: string]: any;
23
+ }
24
+ export namespace Message {
25
+ export interface $Properties { [key: string]: any; }
26
+ export interface PollVoteMessage { [key: string]: any; }
27
+ export interface EventResponseMessage { [key: string]: any; }
28
+ export namespace ButtonsMessage {
29
+ const HeaderType: any;
30
+ export namespace Button { const Type: any; }
31
+ }
32
+ export namespace InteractiveMessage {
33
+ export namespace CarouselMessage { const CarouselCardType: any; }
34
+ }
35
+ export namespace ListMessage { const ListType: any; }
36
+ export namespace ProtocolMessage { const Type: any; }
37
+ }
38
+
39
+ export namespace MessageAssociation { const AssociationType: any; }
40
+ export namespace HistorySync { type HistorySyncType = any; }
41
+ export namespace SyncdMutation { type SyncdOperation = any; }
42
+ export interface SyncdMutations { [key: string]: any; }
43
+ export interface MediaRetryNotification { [key: string]: any; }
44
+ export interface ClientPayload { [key: string]: any; }
45
+ export interface ADVSignedDeviceIdentity { [key: string]: any; }
46
+ }
@@ -742,7 +742,7 @@ class AIRich extends BaseBuilder {
742
742
  this._noContextInfo = false;
743
743
  this._unifiedResponseData = undefined;
744
744
  this._messageSecret = false;
745
- this._bypassDownload = true;
745
+ this._bypassDownload = false;
746
746
  this._forwarded = true;
747
747
  this._includesUnifiedResponse = true;
748
748
  this._includesSubmessages = true;
@@ -1995,7 +1995,7 @@ class AIRich extends BaseBuilder {
1995
1995
  includesSubmessages = this._includesSubmessages,
1996
1996
  messageId,
1997
1997
  additionalNodes = [],
1998
- skipImageFallback = false,
1998
+ skipImageFallback = true,
1999
1999
  nativeEdit = false,
2000
2000
  ...options
2001
2001
  } = {}
@@ -1,7 +1,8 @@
1
1
  import crypto from 'node:crypto';
2
2
  import fs from 'node:fs';
3
- import baileys from '@whiskeysockets/baileys';
4
- const { generateWAMessageFromContent, prepareWAMessageMedia } = baileys;
3
+ import { createRequire } from 'node:module';
4
+ const require = createRequire(import.meta.url);
5
+ const { generateWAMessageFromContent, prepareWAMessageMedia } = require('../../Utils/messages.js');
5
6
  import {
6
7
  a2uiText,
7
8
  a2uiImage,
@@ -2,7 +2,10 @@
2
2
 
3
3
  const VERSION = '4.7';
4
4
 
5
- import { generateWAMessageFromContent, prepareWAMessageMedia, generateMessageIDV2 } from '@whiskeysockets/baileys';
5
+ import { createRequire } from 'node:module';
6
+ const require = createRequire(import.meta.url);
7
+ const { generateWAMessageFromContent, prepareWAMessageMedia } = require('../../Utils/messages.js');
8
+ const { generateMessageIDV2 } = require('../../Utils/generics.js');
6
9
  import crypto from 'crypto';
7
10
  import sharp from 'sharp';
8
11
  import ffmpeg from 'fluent-ffmpeg';
@@ -1942,7 +1945,7 @@ class AIRich extends BaseBuilder {
1942
1945
 
1943
1946
  async build(
1944
1947
  jid,
1945
- { bypassDownload = true, forwarded = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, quoted, quotedParticipant, messageId, ...options } = {}
1948
+ { bypassDownload = false, forwarded = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, quoted, quotedParticipant, messageId, ...options } = {}
1946
1949
  ) {
1947
1950
  const forward = forwarded
1948
1951
  ? {
@@ -2080,7 +2083,7 @@ class AIRich extends BaseBuilder {
2080
2083
  return msgEdit;
2081
2084
  }
2082
2085
 
2083
- async send(jid, { bypassDownload = true, forwarded = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, messageId, additionalNodes = [], ...options } = {}) {
2086
+ async send(jid, { bypassDownload = false, forwarded = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, messageId, additionalNodes = [], ...options } = {}) {
2084
2087
  const msg = await this.build(jid, {
2085
2088
  forwarded,
2086
2089
  notification,
@@ -26,7 +26,7 @@ export function setAIRichClass(cls) {
26
26
  }
27
27
  export function getAIRichClass() {
28
28
  if (!_AIRichClass) {
29
- _AIRichClass = baileys.AIRich;
29
+ throw new Error('AIRich class is not initialized; import the Kage mbuilder entry point before using this helper');
30
30
  }
31
31
  return _AIRichClass;
32
32
  }
@@ -41,8 +41,9 @@ const AIRich = new Proxy(class {}, {
41
41
  return new cls(...args);
42
42
  }
43
43
  });
44
- import baileys from '@whiskeysockets/baileys';
45
- const { extractMessageContent, generateWAMessageFromContent, prepareWAMessageMedia } = baileys;
44
+ import { createRequire } from 'node:module';
45
+ const require = createRequire(import.meta.url);
46
+ const { extractMessageContent, generateWAMessageFromContent, prepareWAMessageMedia } = require('../../Utils/messages.js');
46
47
  import { checkHtmlApp } from './html-app.js'
47
48
 
48
49
  export const AI_RICH_LAYOUTS = Object.freeze([
@@ -427,7 +428,7 @@ export const htmlSection = (html, { trustedSources = [], height, typename = AI_R
427
428
  })
428
429
  }
429
430
 
430
- export const sendHtmlApp = async (sock, jid, html, { title = '', label, trustedSources, height, autoHeight: auto, scrollButtons, typename, id, bypassDownload = true, guard = 'warn', botJid = '867051314767696@bot', contextInfo = {}, ...options } = {}) => {
431
+ export const sendHtmlApp = async (sock, jid, html, { title = '', label, trustedSources, height, autoHeight: auto, scrollButtons, typename, id, bypassDownload = false, guard = 'warn', botJid = '867051314767696@bot', contextInfo = {}, ...options } = {}) => {
431
432
  if (!sock) {
432
433
  throw new TypeError('sendHtmlApp requires a socket as the first argument')
433
434
  }
@@ -1,11 +1,11 @@
1
1
  const VERSION = '4.7';
2
2
 
3
- import baileys from '@whiskeysockets/baileys';
4
- const { generateWAMessageFromContent, prepareWAMessageMedia, generateMessageIDV2 } = baileys;;
5
- import * as crypto from 'node:crypto';
6
- import { readFile } from 'node:fs/promises';
7
3
  import { createRequire } from 'node:module';
8
4
  const requireModule = createRequire(import.meta.url);
5
+ const { generateWAMessageFromContent, prepareWAMessageMedia } = requireModule('../../Utils/messages.js');
6
+ const { generateMessageIDV2 } = requireModule('../../Utils/generics.js');
7
+ import * as crypto from 'node:crypto';
8
+ import { readFile } from 'node:fs/promises';
9
9
  import { loadFfmpeg, loadSharp } from './optional-media.js';
10
10
  import { isParsableCertificateChain } from './bot-signature.js';
11
11
  import { PassThrough, Readable } from 'node:stream';
@@ -2332,7 +2332,7 @@ class AIRich extends BaseBuilder {
2332
2332
 
2333
2333
  async build(
2334
2334
  jid,
2335
- { bypassDownload = true, forwarded = true, forwardWrapper = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, botJid = AIRich.DEFAULT_BOT_JID, disclaimerText = '', verification = 'auto', quoted, quotedParticipant, messageId, ...options } = {}
2335
+ { bypassDownload = false, forwarded = true, forwardWrapper = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, botJid = AIRich.DEFAULT_BOT_JID, disclaimerText = '', verification = 'auto', quoted, quotedParticipant, messageId, ...options } = {}
2336
2336
  ) {
2337
2337
  const forward = forwarded
2338
2338
  ? {
@@ -2508,7 +2508,7 @@ class AIRich extends BaseBuilder {
2508
2508
  return msgEdit;
2509
2509
  }
2510
2510
 
2511
- async send(jid, { bypassDownload = true, forwarded = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, messageId, additionalNodes = [], ...options } = {}) {
2511
+ async send(jid, { bypassDownload = false, forwarded = true, notification = false, includesUnifiedResponse = true, includesSubmessages = true, messageId, additionalNodes = [], ...options } = {}) {
2512
2512
  const msg = await this.build(jid, {
2513
2513
  forwarded,
2514
2514
  notification,
@@ -3694,6 +3694,7 @@ class ORich extends AIRich {}
3694
3694
 
3695
3695
  import { A2UI, sendA2UIWidget } from "./a2ui.js";
3696
3696
  import * as Extras from "./extras.js";
3697
+ Extras.setAIRichClass(AIRich);
3697
3698
  import * as MetaAI from "./metaai.js";
3698
3699
  import * as BotSignature from "./bot-signature.js";
3699
3700
  import * as HtmlApp from "./html-app.js";
@@ -1,7 +1,8 @@
1
1
  import { AIRich } from './index.js'
2
2
  import { AddonActionType } from './extras.js'
3
- import baileys from '@whiskeysockets/baileys';
4
- const { generateWAMessageFromContent } = baileys;
3
+ import { createRequire } from 'node:module';
4
+ const require = createRequire(import.meta.url);
5
+ const { generateWAMessageFromContent } = require('../../Utils/messages.js');
5
6
  import { BOT_SIGNATURE_USE_CASE_WA_BOT_MSG, verifyBotSignature } from './bot-signature.js'
6
7
 
7
8
  export const MapQueryStatus = Object.freeze({ FETCHING: 'FETCHING', FETCHED: 'FETCHED', FAILED: 'FAILED' })
@@ -359,5 +359,4 @@ for (const name of ['WA_CERT_DETAILS', 'MEDIA_PATH_MAP', 'MEDIA_HKDF_KEY_MAPPING
359
359
  exports.MEDIA_HKDF_KEY_MAPPING['product-catalog-image'] = 'Product Catalog Image';
360
360
  exports.MEDIA_KEYS = [...new Set([...exports.MEDIA_KEYS, ...Object.keys(exports.MEDIA_PATH_MAP)])];
361
361
 
362
- // Kage: AI bot JID used by AIRich forward/default target
363
- exports.DEFAULT_AI_BOT_JID = process.env.KAGE_AI_BOT_JID || '13135550002@s.whatsapp.net';
362
+ exports.DEFAULT_AI_BOT_JID = process.env.KAGE_AI_BOT_JID || "13135550002@s.whatsapp.net";
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  const layers = ['chats', 'newsletter', 'messages-send', 'business', 'community', 'socket'];
3
+ const INSTALL_KEY = Symbol.for('kage-baileys.extensions-installed');
3
4
  exports.installExtensions = (socket, config) => {
5
+ if (!socket || typeof socket !== 'object') throw new TypeError('installExtensions requiere un socket');
6
+ if (socket[INSTALL_KEY]) return socket;
4
7
  for (const layer of layers) {
5
8
  const additions = require('./' + layer).attach(socket, config);
6
9
  for (const key of Object.keys(additions)) {
@@ -26,5 +29,7 @@ exports.installExtensions = (socket, config) => {
26
29
  socket.messageRetryManager?.clear?.();
27
30
  socket.signalRepository?.lidMapping?.close?.();
28
31
  });
32
+ try { Object.defineProperty(socket, INSTALL_KEY, { value: true, configurable: false }); }
33
+ catch { socket[INSTALL_KEY] = true; }
29
34
  return socket;
30
35
  };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ const { spawnSync } = require("child_process");
3
+ const { existsSync } = require("fs");
4
+ let overridePath = null;
5
+ let cached;
6
+ async function moduleProvidedPath() {
7
+ try {
8
+ const mod = await import("ffmpeg-static");
9
+ const p = mod?.default ?? mod;
10
+ if (typeof p === "string" && existsSync(p)) return p;
11
+ } catch {}
12
+ try {
13
+ const mod = await import("@ffmpeg-installer/ffmpeg");
14
+ const p = (mod?.default ?? mod)?.path;
15
+ if (typeof p === "string" && existsSync(p)) return p;
16
+ } catch {}
17
+ return null;
18
+ }
19
+ function systemHasFfmpeg() {
20
+ try {
21
+ const r = spawnSync("ffmpeg", ["-version"], { stdio: "ignore" });
22
+ return !r.error && r.status === 0;
23
+ } catch { return false; }
24
+ }
25
+ function setFfmpegPath(path) { overridePath = path || null; cached = undefined; }
26
+ async function resolveFfmpegPath() {
27
+ if (overridePath) return overridePath;
28
+ if (process.env.FFMPEG_PATH && existsSync(process.env.FFMPEG_PATH)) return process.env.FFMPEG_PATH;
29
+ if (cached !== undefined) return cached;
30
+ cached = (await moduleProvidedPath()) ?? (systemHasFfmpeg() ? "ffmpeg" : null);
31
+ return cached;
32
+ }
33
+ function ffmpegInstallHint() {
34
+ return "ffmpeg not found. Install: npm i ffmpeg-static OR system ffmpeg OR set FFMPEG_PATH";
35
+ }
36
+ async function requireFfmpegPath() {
37
+ const path = await resolveFfmpegPath();
38
+ if (path) return path;
39
+ throw new Error(ffmpegInstallHint());
40
+ }
41
+ module.exports = { setFfmpegPath, resolveFfmpegPath, requireFfmpegPath, ffmpegInstallHint, getFfmpegPath: resolveFfmpegPath };
42
+ exports.setFfmpegPath = setFfmpegPath;
43
+ exports.resolveFfmpegPath = resolveFfmpegPath;
44
+ exports.requireFfmpegPath = requireFfmpegPath;
45
+ exports.ffmpegInstallHint = ffmpegInstallHint;
46
+ exports.getFfmpegPath = resolveFfmpegPath;
@@ -1,8 +1,9 @@
1
1
  /**
2
- * Kage AIRich — rich messages nativos desde kage-baileys
3
- * - Un solo relay (contenido completo) → se ve al instante sin salir del chat
4
- * - Imágenes product con URL pública (evita blanco)
5
- * - Sin dependencia externa de chiaki-builder / zapo
2
+ * Kage AIRich — rich messages nativos de Kage Baileys.
3
+ *
4
+ * A build() path always creates one WebMessageInfo through the fork's own
5
+ * generateWAMessageFromContent(). send() performs exactly one relayMessage()
6
+ * operation. It never creates a follow-up ProtocolMessage edit.
6
7
  */
7
8
  'use strict';
8
9
 
@@ -11,7 +12,7 @@ const messages = require('./messages.js');
11
12
  const generics = require('./generics.js');
12
13
  const { resolvePublicImageUrl, resolveRichImage, DEFAULT_IMAGE } = require('./kage-media-resolve.js');
13
14
 
14
- let genFromContent = messages.generateWAMessageFromContent;
15
+ const genFromContent = messages.generateWAMessageFromContent;
15
16
  let genId = generics.generateMessageIDV2 || messages.generateMessageIDV2;
16
17
  if (typeof genId !== 'function') {
17
18
  genId = () => crypto.randomBytes(8).toString('hex').toUpperCase();
@@ -28,17 +29,9 @@ const TN = {
28
29
  };
29
30
 
30
31
  function layout(name, data) {
31
- if (Array.isArray(data)) {
32
- return {
33
- view_model: {
34
- primitives: data,
35
- __typename: `GenAI${name}LayoutViewModel`,
36
- },
37
- };
38
- }
39
32
  return {
40
33
  view_model: {
41
- primitive: data,
34
+ [Array.isArray(data) ? 'primitives' : 'primitive']: data,
42
35
  __typename: `GenAI${name}LayoutViewModel`,
43
36
  },
44
37
  };
@@ -51,11 +44,49 @@ function stringifyEscaped(obj) {
51
44
  );
52
45
  }
53
46
 
47
+ function makeHtmlPrimitive(html, url, trustedSources) {
48
+ return {
49
+ __typename: 'GenAIUnifiedResponseSection',
50
+ ...layout('Single', {
51
+ payload: html,
52
+ ...(url ? { url } : {}),
53
+ trusted_sources: trustedSources,
54
+ __typename: TN.HTML,
55
+ }),
56
+ };
57
+ }
58
+
59
+ function getTrustedSources(url, trustedSources) {
60
+ if (trustedSources !== undefined) {
61
+ if (!Array.isArray(trustedSources) || !trustedSources.every((value) => typeof value === 'string')) {
62
+ throw new TypeError('trustedSources debe ser un array de strings');
63
+ }
64
+ return [...new Set(trustedSources.map((value) => value.trim()).filter(Boolean))];
65
+ }
66
+
67
+ if (!url) return [];
68
+ try {
69
+ const parsed = new URL(url);
70
+ if (!['http:', 'https:'].includes(parsed.protocol)) {
71
+ throw new TypeError('La URL de HTML debe usar HTTP o HTTPS');
72
+ }
73
+ return [parsed.hostname];
74
+ } catch (error) {
75
+ if (error instanceof TypeError && error.message === 'La URL de HTML debe usar HTTP o HTTPS') {
76
+ throw error;
77
+ }
78
+ throw new TypeError('La URL de HTML no es válida');
79
+ }
80
+ }
81
+
54
82
  class KageAIRich {
55
83
  constructor(sock) {
56
84
  if (!sock || typeof sock.relayMessage !== 'function') {
57
85
  throw new TypeError('KageAIRich requiere un socket Baileys con relayMessage');
58
86
  }
87
+ if (typeof genFromContent !== 'function') {
88
+ throw new TypeError('Kage Baileys no expone generateWAMessageFromContent');
89
+ }
59
90
  this.sock = sock;
60
91
  this._title = '';
61
92
  this._footer = '';
@@ -63,244 +94,175 @@ class KageAIRich {
63
94
  this._submessages = [];
64
95
  this._contextInfo = {};
65
96
  this._lastKey = null;
97
+ this._pendingProducts = [];
98
+ this._htmlPayload = null;
66
99
  }
67
100
 
68
- setTitle(t) {
69
- this._title = String(t || '');
101
+ setTitle(title) {
102
+ this._title = String(title ?? '');
70
103
  return this;
71
104
  }
72
105
 
73
- setFooter(t) {
74
- this._footer = String(t || '');
106
+ setFooter(footer) {
107
+ this._footer = String(footer ?? '');
75
108
  return this;
76
109
  }
77
110
 
78
- setContextInfo(ci) {
79
- if (ci && typeof ci === 'object') this._contextInfo = { ...this._contextInfo, ...ci };
111
+ setContextInfo(contextInfo) {
112
+ if (contextInfo && typeof contextInfo === 'object' && !Array.isArray(contextInfo)) {
113
+ this._contextInfo = { ...this._contextInfo, ...contextInfo };
114
+ }
80
115
  return this;
81
116
  }
82
117
 
83
118
  addText(text) {
84
- const t = String(text ?? '');
85
- this._sections.push(
86
- layout('Single', { text: t, __typename: TN.TEXT })
87
- );
88
- this._submessages.push({ messageType: 2, messageText: t });
119
+ const value = String(text ?? '');
120
+ this._sections.push(layout('Single', { text: value, __typename: TN.TEXT }));
121
+ this._submessages.push({ messageType: 2, messageText: value });
89
122
  return this;
90
123
  }
91
124
 
92
125
  addTable(rows) {
93
- if (!Array.isArray(rows)) throw new TypeError('Table must be array');
94
- // Formato simple: filas de celdas string
95
- const cells = rows.map((r) =>
96
- (Array.isArray(r) ? r : [r]).map((c) => String(c ?? ''))
97
- );
98
- this._sections.push(
99
- layout('Single', {
100
- __typename: TN.TABLE,
101
- rows: cells,
102
- table: cells,
103
- })
126
+ if (!Array.isArray(rows)) throw new TypeError('Table debe ser un array');
127
+ const cells = rows.map((row) =>
128
+ (Array.isArray(row) ? row : [row]).map((cell) => String(cell ?? ''))
104
129
  );
130
+ this._sections.push(layout('Single', {
131
+ __typename: TN.TABLE,
132
+ rows: cells,
133
+ table: cells,
134
+ }));
105
135
  this._submessages.push({
106
136
  messageType: 2,
107
- messageText: cells.map((r) => r.join(' | ')).join('\n'),
137
+ messageText: cells.map((row) => row.join(' | ')).join('\n'),
108
138
  });
109
139
  return this;
110
140
  }
111
141
 
112
- /**
113
- * Product cards — image debe ser URL http pública (no pps.whatsapp.net)
114
- * Acepta string URL, o se normaliza con resolvePublicImageUrl en send()
115
- */
142
+ /** Product cards. Images are uploaded/resolved as card data, not sent as a second chat message. */
116
143
  addProduct(data) {
117
144
  const items = Array.isArray(data) ? data : [data];
118
- this._pendingProducts = this._pendingProducts || [];
119
145
  this._pendingProducts.push(...items);
120
146
  return this;
121
147
  }
122
148
 
123
149
  addSuggest(prompts) {
124
150
  const list = Array.isArray(prompts) ? prompts : [prompts];
125
- this._sections.push(
126
- layout(
127
- 'HScroll',
128
- list.map((p) => ({
129
- prompt_text: String(p),
130
- category: 'ADD',
131
- __typename: TN.SUGGEST,
132
- }))
133
- )
134
- );
151
+ this._sections.push(layout('HScroll', list.map((prompt) => ({
152
+ prompt_text: String(prompt),
153
+ category: 'ADD',
154
+ __typename: TN.SUGGEST,
155
+ }))));
135
156
  return this;
136
157
  }
137
158
 
138
159
  addFooterAction({ text, url, cta_text, cta_url } = {}) {
139
- this._sections.push(
140
- layout('Single', {
141
- __typename: TN.FOOTER_ACTION,
142
- cta_text: text || cta_text || 'Open',
143
- cta_type: 'GENERATE_IMAGE',
144
- cta_url: url || cta_url || '',
145
- })
146
- );
160
+ this._sections.push(layout('Single', {
161
+ __typename: TN.FOOTER_ACTION,
162
+ cta_text: text || cta_text || 'Open',
163
+ cta_type: 'GENERATE_IMAGE',
164
+ cta_url: url || cta_url || '',
165
+ }));
147
166
  return this;
148
167
  }
149
168
 
150
169
  addMetadata(text) {
151
- this._sections.push(
152
- layout('Single', { text: String(text || ''), __typename: TN.METADATA })
153
- );
154
- this._submessages.push({ messageType: 2, messageText: String(text || '') });
170
+ const value = String(text ?? '');
171
+ this._sections.push(layout('Single', { text: value, __typename: TN.METADATA }));
172
+ this._submessages.push({ messageType: 2, messageText: value });
155
173
  return this;
156
174
  }
157
175
 
158
- /** HTML interactivo (juegos) */
159
- addHtml(html, { title = 'Chiaki', url = 'https://chiaki.dev' } = {}) {
160
- this._htmlPayload = { html: String(html || ''), title, url };
176
+ /**
177
+ * Embed an HTML app in AIRich's embedded_screens envelope. The HTML is not
178
+ * converted into image/document media and does not create an extra message.
179
+ */
180
+ addHtml(html, {
181
+ title = this._title || 'Chiaki',
182
+ url = 'https://chiaki.dev',
183
+ trustedSources,
184
+ label,
185
+ screenTitle,
186
+ tabHeader,
187
+ } = {}) {
188
+ if (typeof html !== 'string' || !html.trim()) {
189
+ throw new TypeError('addHtml(html) requiere un string HTML no vacío');
190
+ }
191
+ const normalizedUrl = url == null ? '' : String(url).trim();
192
+ const trusted = getTrustedSources(normalizedUrl, trustedSources);
193
+ const resolvedTitle = String(title || this._title || 'Chiaki');
194
+ const resolvedLabel = String(label || resolvedTitle);
195
+
196
+ this._title = resolvedTitle;
197
+ this._htmlPayload = {
198
+ html,
199
+ url: normalizedUrl,
200
+ trustedSources: trusted,
201
+ label: resolvedLabel,
202
+ screenTitle: String(screenTitle || resolvedTitle),
203
+ tabHeader: String(tabHeader || screenTitle || resolvedTitle).slice(0, 48),
204
+ };
161
205
  return this;
162
206
  }
163
207
 
164
208
  async #resolveProducts() {
165
- if (!this._pendingProducts?.length) return;
209
+ if (!this._pendingProducts.length) return;
166
210
  const products = [];
211
+
167
212
  for (const item of this._pendingProducts) {
168
- const rawImg = item.image_url ?? item.image ?? DEFAULT_IMAGE;
169
- let imgUrl = DEFAULT_IMAGE;
170
- let thumb = null;
213
+ const rawImage = item?.image_url ?? item?.image ?? DEFAULT_IMAGE;
214
+ let imageUrl = DEFAULT_IMAGE;
215
+ let thumbnail = null;
216
+
171
217
  try {
172
- const resolved = await resolveRichImage(this.sock, rawImg, { width: 640, height: 640 });
173
- imgUrl = resolved.url || DEFAULT_IMAGE;
174
- thumb = resolved.thumbBase64;
218
+ const resolved = await resolveRichImage(this.sock, rawImage, { width: 640, height: 640 });
219
+ imageUrl = resolved.url || DEFAULT_IMAGE;
220
+ thumbnail = resolved.thumbBase64;
175
221
  } catch {
176
222
  try {
177
- imgUrl = await resolvePublicImageUrl(this.sock, rawImg);
223
+ imageUrl = await resolvePublicImageUrl(this.sock, rawImage);
178
224
  } catch {
179
- imgUrl = DEFAULT_IMAGE;
225
+ imageUrl = DEFAULT_IMAGE;
180
226
  }
181
227
  }
182
228
 
183
- const imageObj = { url: imgUrl || DEFAULT_IMAGE };
184
- if (thumb) {
185
- imageObj.thumbnail = thumb;
186
- imageObj.jpegThumbnail = thumb;
229
+ const image = { url: imageUrl || DEFAULT_IMAGE };
230
+ if (thumbnail) {
231
+ image.thumbnail = thumbnail;
232
+ image.jpegThumbnail = thumbnail;
187
233
  }
188
234
 
189
235
  products.push({
190
- title: item.title || 'Item',
191
- brand: item.brand || '',
192
- price: item.price || '',
193
- sale_price: item.sale_price || item.salePrice || '',
194
- product_url: item.product_url ?? item.url ?? '',
195
- image: imageObj,
236
+ title: item?.title || 'Item',
237
+ brand: item?.brand || '',
238
+ price: item?.price || '',
239
+ sale_price: item?.sale_price || item?.salePrice || '',
240
+ product_url: item?.product_url ?? item?.url ?? '',
241
+ image,
196
242
  additional_images: [],
197
243
  __typename: TN.PRODUCT,
198
244
  });
199
245
  }
200
- this._sections.unshift(
201
- layout(products.length > 1 ? 'HScroll' : 'Single', products.length > 1 ? products : products[0])
202
- );
246
+
247
+ this._sections.unshift(layout(
248
+ products.length > 1 ? 'HScroll' : 'Single',
249
+ products.length > 1 ? products : products[0]
250
+ ));
203
251
  this._pendingProducts = [];
204
252
  }
205
253
 
206
- async build(jid, { quoted } = {}) {
254
+ async build(jid, {
255
+ quoted,
256
+ mentions,
257
+ messageId,
258
+ userJid,
259
+ timestamp,
260
+ ephemeralExpiration,
261
+ } = {}) {
207
262
  await this.#resolveProducts();
208
263
 
209
- let sections = [...this._sections];
210
- let submessages = [...this._submessages];
211
-
212
- // HTML game payload
213
- if (this._htmlPayload?.html) {
214
- const { html, title, url } = this._htmlPayload;
215
- const responseId = `kage_${Date.now()}_${crypto.randomBytes(3).toString('hex')}`;
216
- const payload = {
217
- response_id: responseId,
218
- sections: [
219
- {
220
- __typename: 'GenAIUnifiedResponseSection',
221
- view_model: {
222
- __typename: 'GenAISingleLayoutViewModel',
223
- primitive: {
224
- __typename: 'GenAIBotProgressStatusPrimitive',
225
- title,
226
- is_in_progress: true,
227
- },
228
- },
229
- },
230
- ],
231
- embedded_screens: [
232
- {
233
- title,
234
- content: [
235
- {
236
- __typename: 'FOAIDNixelButtonSheets',
237
- tabs: [
238
- {
239
- id: 'tab_0',
240
- tab_header: String(title).slice(0, 24),
241
- sections: [
242
- {
243
- __typename: 'GenAIUnifiedResponseSection',
244
- view_model: {
245
- __typename: 'GenAISingleLayoutViewModel',
246
- primitive: {
247
- __typename: TN.HTML,
248
- payload: html,
249
- url: url || 'https://chiaki.dev',
250
- trusted_sources: ['chiaki.dev'],
251
- },
252
- },
253
- },
254
- ],
255
- },
256
- ],
257
- },
258
- ],
259
- step_entries: [],
260
- },
261
- ],
262
- };
263
-
264
- const contextInfo = {
265
- forwardingScore: 1,
266
- isForwarded: true,
267
- forwardedAiBotMessageInfo: { botJid: '0@bot' },
268
- forwardOrigin: 4,
269
- ...this._contextInfo,
270
- };
271
- if (quoted?.key) {
272
- contextInfo.stanzaId = quoted.key.id;
273
- contextInfo.participant =
274
- quoted.key.participant || quoted.participant || quoted.key.remoteJid;
275
- contextInfo.quotedMessage = quoted.message;
276
- }
277
-
278
- return {
279
- message: {
280
- messageContextInfo: {
281
- deviceListMetadata: {},
282
- deviceListMetadataVersion: 2,
283
- messageSecret: crypto.randomBytes(32),
284
- botMetadata: {
285
- messageDisclaimerText: title || this._title,
286
- botResponseId: responseId,
287
- },
288
- },
289
- botForwardedMessage: {
290
- message: {
291
- richResponseMessage: {
292
- messageType: 1,
293
- unifiedResponse: {
294
- data: Buffer.from(JSON.stringify(payload)).toString('base64'),
295
- },
296
- contextInfo,
297
- },
298
- },
299
- },
300
- },
301
- key: { remoteJid: jid, fromMe: true, id: genId() },
302
- };
303
- }
264
+ const sections = [...this._sections];
265
+ const submessages = [...this._submessages];
304
266
 
305
267
  if (this._footer) {
306
268
  sections.push(layout('Single', { text: this._footer, __typename: TN.TEXT }));
@@ -308,7 +270,6 @@ class KageAIRich {
308
270
 
309
271
  const responseId = crypto.randomUUID();
310
272
  const botResponseId = crypto.randomUUID();
311
-
312
273
  const contextInfo = {
313
274
  forwardingScore: 1,
314
275
  isForwarded: true,
@@ -316,13 +277,51 @@ class KageAIRich {
316
277
  forwardOrigin: 4,
317
278
  ...this._contextInfo,
318
279
  };
280
+
281
+ if (Array.isArray(mentions) && mentions.length) {
282
+ contextInfo.mentionedJid = [...new Set(mentions.filter((jid) => typeof jid === 'string' && jid))];
283
+ }
284
+
319
285
  if (quoted?.key) {
286
+ const participant = quoted.key.fromMe
287
+ ? userJid || quoted.key.participant || quoted.key.remoteJid
288
+ : quoted.key.participant || quoted.participant || quoted.key.remoteJid;
320
289
  contextInfo.stanzaId = quoted.key.id;
321
- contextInfo.participant =
322
- quoted.key.participant || quoted.participant || quoted.key.remoteJid;
290
+ contextInfo.participant = participant;
291
+ contextInfo.quotedType = 0;
323
292
  contextInfo.quotedMessage = quoted.message;
324
293
  }
325
294
 
295
+ const unifiedResponse = {
296
+ response_id: responseId,
297
+ sections,
298
+ };
299
+
300
+ if (this._htmlPayload) {
301
+ const html = this._htmlPayload;
302
+ // Match the fork's AIRich.addHTMLCard contract: keep a visible label in
303
+ // the main sections and its text fallback in submessages even when the
304
+ // caller already added other sections before attaching the HTML screen.
305
+ sections.push(layout('Single', { text: html.label, __typename: TN.TEXT }));
306
+ submessages.push({ messageType: 2, messageText: html.label });
307
+
308
+ const htmlSection = makeHtmlPrimitive(html.html, html.url, html.trustedSources);
309
+ unifiedResponse.embedded_screens = [{
310
+ title: html.screenTitle,
311
+ content: [{
312
+ __typename: 'FOAIDNixelButtonSheets',
313
+ tabs: [{
314
+ id: 'tab_0',
315
+ tab_header: html.tabHeader,
316
+ sections: [htmlSection],
317
+ step_entries: [],
318
+ }],
319
+ step_entries: [],
320
+ }],
321
+ step_entries: [],
322
+ }];
323
+ }
324
+
326
325
  const content = {
327
326
  messageContextInfo: {
328
327
  deviceListMetadata: {},
@@ -339,9 +338,7 @@ class KageAIRich {
339
338
  messageType: 1,
340
339
  submessages,
341
340
  unifiedResponse: {
342
- data: Buffer.from(
343
- stringifyEscaped({ response_id: responseId, sections })
344
- ).toString('base64'),
341
+ data: Buffer.from(stringifyEscaped(unifiedResponse)).toString('base64'),
345
342
  },
346
343
  contextInfo,
347
344
  },
@@ -349,39 +346,53 @@ class KageAIRich {
349
346
  },
350
347
  };
351
348
 
352
- const messageId = genId();
353
- if (typeof genFromContent === 'function') {
354
- try {
355
- const msg = genFromContent(jid, content, { messageId });
356
- return msg;
357
- } catch {}
358
- }
359
- return {
360
- message: content,
361
- key: { remoteJid: jid, fromMe: true, id: messageId },
362
- };
349
+ // Use Kage's own protobuf conversion path for every AIRich envelope.
350
+ // This keeps normal and HTML responses consistent with the installed WAProto.
351
+ return genFromContent(jid, content, {
352
+ messageId: messageId || genId(),
353
+ userJid,
354
+ timestamp,
355
+ ephemeralExpiration,
356
+ });
363
357
  }
364
358
 
365
- /**
366
- * Envío único — contenido completo de una vez (se ve al instante, sin reabrir chat)
367
- * NO hace sendEdit (evita warning de seguridad y retrasos)
368
- */
359
+ /** Exactly one transport relay. No automatic ProtocolMessage edit or media send. */
369
360
  async send(jid, options = {}) {
370
- const { quoted, mentions, additionalNodes = [] } = options;
371
- if (mentions?.length) {
372
- this._contextInfo.mentionedJid = mentions;
361
+ const {
362
+ quoted,
363
+ mentions,
364
+ additionalNodes = [],
365
+ messageId,
366
+ userJid,
367
+ timestamp,
368
+ ephemeralExpiration,
369
+ ...relayOptions
370
+ } = options;
371
+
372
+ if (!Array.isArray(additionalNodes)) {
373
+ throw new TypeError('additionalNodes debe ser un array');
373
374
  }
374
- const msg = await this.build(jid, { quoted });
375
- const messageId = msg.key?.id || genId();
376
375
 
377
- await this.sock.relayMessage(jid, msg.message, {
376
+ const msg = await this.build(jid, {
377
+ quoted,
378
+ mentions,
378
379
  messageId,
380
+ userJid,
381
+ timestamp,
382
+ ephemeralExpiration,
383
+ });
384
+ const finalMessageId = msg?.key?.id;
385
+ if (!finalMessageId || !msg?.message) {
386
+ throw new Error('AIRich no pudo generar un WebMessageInfo válido');
387
+ }
388
+
389
+ await this.sock.relayMessage(jid, msg.message, {
390
+ ...relayOptions,
391
+ messageId: finalMessageId,
379
392
  additionalNodes,
380
- // ayuda a que el cliente pinte el mensaje de inmediato
381
- status: 1,
382
393
  });
383
394
 
384
- this._lastKey = { remoteJid: jid, fromMe: true, id: messageId };
395
+ this._lastKey = { remoteJid: jid, fromMe: true, id: finalMessageId };
385
396
  return { key: this._lastKey, message: msg.message };
386
397
  }
387
398
  }
@@ -24,68 +24,51 @@ function messageSecretB64(bytes = 32) {
24
24
  }
25
25
 
26
26
  /**
27
- * Code block COMPARTIBLE:
28
- * 1) Intenta AIRich con primitiva de código
29
- * 2) Si falla, interactive native flow simple
30
- * 3) Fallback texto ```code``` (todas las versiones)
27
+ * AIRich code block. A caller may choose text mode before transport with
28
+ * forceTextFallback; a failed relay is never followed by a second send because
29
+ * the server may already have accepted the first operation.
31
30
  */
32
31
  async function sendCodeBlock(sock, jid, code, quoted, opts = {}) {
33
32
  const title = opts.title || 'Code';
34
33
  const language = (opts.language || 'javascript').toLowerCase();
35
34
  const footer = opts.footer || '';
36
35
  const body = String(code ?? '');
36
+ const text =
37
+ `📦 *${title}*\n` +
38
+ `Lenguaje: \`${language}\`\n\n` +
39
+ '```' + language + '\n' +
40
+ body +
41
+ '\n```' +
42
+ (footer ? `\n\n_${footer}_` : '');
37
43
 
38
- // --- Preferencia: AIRich (clientes nuevos) ---
39
- try {
40
- const rich = new KageAIRich(sock);
41
- rich.setTitle(title);
42
- if (footer) rich.setFooter(footer);
43
-
44
- // Código legible en submessages (siempre)
45
- const display =
46
- `📦 *${title}*\n` +
47
- `_${language}_\n\n` +
48
- '```' + language + '\n' +
49
- body +
50
- '\n```' +
51
- (footer ? `\n\n${footer}` : '');
52
-
53
- rich.addText(display);
54
-
55
- // Primitiva code (si el cliente la entiende)
56
- try {
57
- rich._sections.push({
58
- view_model: {
59
- primitive: {
60
- __typename: 'GenAICodeBlockUXPrimitive',
61
- code: body,
62
- language,
63
- title,
64
- highlight: true,
65
- },
66
- __typename: 'GenAISingleLayoutViewModel',
67
- },
68
- });
69
- } catch {}
70
-
71
- const sent = await rich.send(jid, { quoted: quoted || undefined });
72
- return sent;
73
- } catch (e1) {
74
- // --- Fallback universal: texto con markdown code fence ---
75
- const text =
76
- `📦 *${title}*\n` +
77
- `Lenguaje: \`${language}\`\n\n` +
78
- '```' + language + '\n' +
79
- body +
80
- '\n```' +
81
- (footer ? `\n\n_${footer}_` : '');
82
-
83
- return sock.sendMessage(
84
- jid,
85
- { text },
86
- { quoted: quoted || undefined }
87
- );
44
+ if (opts.forceTextFallback === true) {
45
+ return sock.sendMessage(jid, { text }, { quoted: quoted || undefined });
88
46
  }
47
+
48
+ const rich = new KageAIRich(sock);
49
+ rich.setTitle(title);
50
+ if (footer) rich.setFooter(footer);
51
+ const display =
52
+ `📦 *${title}*\n` +
53
+ `_${language}_\n\n` +
54
+ '```' + language + '\n' +
55
+ body +
56
+ '\n```' +
57
+ (footer ? `\n\n${footer}` : '');
58
+ rich.addText(display);
59
+ rich._sections.push({
60
+ view_model: {
61
+ primitive: {
62
+ __typename: 'GenAICodeBlockUXPrimitive',
63
+ code: body,
64
+ language,
65
+ title,
66
+ highlight: true,
67
+ },
68
+ __typename: 'GenAISingleLayoutViewModel',
69
+ },
70
+ });
71
+ return rich.send(jid, { quoted: quoted || undefined });
89
72
  }
90
73
 
91
74
  async function sendLatexInlineImage(sock, jid, quoted, opts = {}) {
@@ -132,7 +115,7 @@ async function sendAIRich(sock, jid, config, quoted) {
132
115
  if (config.table) rich.addTable(config.table);
133
116
  if (config.products) rich.addProduct(config.products);
134
117
  if (config.suggest) rich.addSuggest(config.suggest);
135
- if (config.html) rich.addHtml(config.html, { title: config.title });
118
+ if (config.html) rich.addHtml(config.html, { title: config.title, url: config.url, trustedSources: config.trustedSources, label: config.label });
136
119
  }
137
120
  return rich.send(jid, { quoted: quoted || undefined });
138
121
  }
@@ -140,7 +123,7 @@ async function sendAIRich(sock, jid, config, quoted) {
140
123
  async function sendHtml(sock, jid, html, opts = {}) {
141
124
  const rich = new KageAIRich(sock);
142
125
  rich.setTitle(opts.title || 'HTML');
143
- rich.addHtml(html, { title: opts.title || 'HTML', url: opts.url || 'https://chiaki.dev' });
126
+ rich.addHtml(html, { title: opts.title || 'HTML', url: opts.url || 'https://chiaki.dev', trustedSources: opts.trustedSources, label: opts.label, screenTitle: opts.screenTitle, tabHeader: opts.tabHeader });
144
127
  return rich.send(jid, { quoted: opts.quoted });
145
128
  }
146
129
 
@@ -218,17 +201,16 @@ async function sendA2UI(sock, jid, payload, opts = {}) {
218
201
  },
219
202
  ];
220
203
 
221
- try {
222
- const messageId = genId();
223
- await sock.relayMessage(jid, content, { messageId, additionalNodes });
224
- return { key: { remoteJid: jid, fromMe: true, id: messageId }, message: content };
225
- } catch (e) {
226
- // Fallback compatible
227
- const text =
228
- opts.fallbackText ||
229
- '⚙️ *Widget A2UI*\nTu WhatsApp no soporta este componente. Actualiza la app o usa otro cliente.';
204
+ if (opts.forceTextFallback === true) {
205
+ const text = opts.fallbackText || '⚙️ *Widget A2UI*\nActualiza WhatsApp para ver este contenido.';
230
206
  return sock.sendMessage(jid, { text }, { quoted: opts.quoted });
231
207
  }
208
+
209
+ // The fallback text inside bloksWidget is client-rendered. Do not send a
210
+ // second chat message after a relay error: delivery may already have occurred.
211
+ const messageId = genId();
212
+ await sock.relayMessage(jid, content, { messageId, additionalNodes });
213
+ return { key: { remoteJid: jid, fromMe: true, id: messageId }, message: content };
232
214
  }
233
215
 
234
216
  /** Alias explícito */
@@ -241,20 +223,20 @@ async function sendBloksWidget(sock, jid, data, opts = {}) {
241
223
  * (el caller sigue usando sock.relayMessage nativo; esto es helper opcional)
242
224
  */
243
225
  async function relayCompatible(sock, jid, message, options = {}) {
244
- try {
245
- const messageId = options.messageId || genId();
246
- await sock.relayMessage(jid, message, { ...options, messageId });
247
- return { key: { remoteJid: jid, fromMe: true, id: messageId } };
248
- } catch (e) {
249
- if (options.fallbackText) {
250
- return sock.sendMessage(jid, { text: options.fallbackText }, { quoted: options.quoted });
251
- }
252
- throw e;
226
+ const { messageId: requestedId, fallbackText, forceTextFallback = false, quoted, ...relayOptions } = options;
227
+ if (forceTextFallback === true && fallbackText) {
228
+ return sock.sendMessage(jid, { text: fallbackText }, { quoted });
253
229
  }
230
+ const messageId = requestedId || genId();
231
+ await sock.relayMessage(jid, message, { ...relayOptions, messageId });
232
+ return { key: { remoteJid: jid, fromMe: true, id: messageId } };
254
233
  }
255
234
 
235
+ const RICH_METHODS_INSTALLED = Symbol.for('kage-baileys.rich-methods-installed');
236
+
256
237
  function installRichMethods(sock) {
257
238
  if (!sock) return sock;
239
+ if (sock[RICH_METHODS_INSTALLED]) return sock;
258
240
 
259
241
  const bind = (name, fn) => {
260
242
  const wrapped = (...args) => fn(sock, ...args);
@@ -288,6 +270,8 @@ function installRichMethods(sock) {
288
270
  require('./kage-send-table').installSendTable(sock);
289
271
  } catch {}
290
272
 
273
+ try { Object.defineProperty(sock, RICH_METHODS_INSTALLED, { value: true, configurable: false }); }
274
+ catch { sock[RICH_METHODS_INSTALLED] = true; }
291
275
  return sock;
292
276
  }
293
277
 
@@ -52,12 +52,14 @@ async function sendTable(sock, jid, title, headers, rows, quoted, opts = {}) {
52
52
  return rich.send(jid, {
53
53
  quoted: quoted || undefined,
54
54
  mentions: opts.mentions,
55
- bypassDownload: false,
56
55
  });
57
56
  }
58
57
 
58
+ const SEND_TABLE_INSTALLED = Symbol.for('kage-baileys.send-table-installed');
59
+
59
60
  function installSendTable(sock) {
60
61
  if (!sock) return sock;
62
+ if (sock[SEND_TABLE_INSTALLED]) return sock;
61
63
  const fn = function (jid, title, headers, rows, quoted, opts) {
62
64
  return sendTable(sock, jid, title, headers, rows, quoted, opts);
63
65
  };
@@ -73,6 +75,8 @@ function installSendTable(sock) {
73
75
  });
74
76
  } catch {}
75
77
  }
78
+ try { Object.defineProperty(sock, SEND_TABLE_INSTALLED, { value: true, configurable: false }); }
79
+ catch { sock[SEND_TABLE_INSTALLED] = true; }
76
80
  return sock;
77
81
  }
78
82
 
@@ -1,22 +1,18 @@
1
1
  "use strict";
2
- /**
3
- * Minimal stub – full payment params builder may live in upstream forks.
4
- * Keeps Builders/Button.js importable.
5
- */
6
- function buildPaymentParams(spec = {}) {
2
+ function buildPaymentParams(spec) {
3
+ spec = spec || {};
7
4
  if (typeof spec === "string") {
8
- try { spec = JSON.parse(spec); } catch { spec = { reference_id: spec }; }
5
+ try { spec = JSON.parse(spec); } catch (e) { spec = { reference_id: spec }; }
9
6
  }
10
- const params = {
11
- reference_id: spec.reference_id || spec.referenceId || `pay_${Date.now()}`,
7
+ return JSON.stringify({
8
+ reference_id: spec.reference_id || spec.referenceId || ("pay_" + Date.now()),
12
9
  type: spec.type || "physical-goods",
13
- payment_configuration: spec.payment_configuration || spec.paymentConfiguration || "merchant_account",
10
+ payment_configuration: spec.payment_configuration || "merchant_account",
14
11
  currency: spec.currency || "USD",
15
12
  total_amount: spec.total_amount || spec.totalAmount || { value: 0, offset: 100 },
16
- order: spec.order || undefined,
17
- payment_method: spec.payment_method || spec.paymentMethod || undefined,
18
- };
19
- return JSON.stringify(params);
13
+ order: spec.order,
14
+ payment_method: spec.payment_method || spec.paymentMethod
15
+ });
20
16
  }
21
17
  module.exports = { buildPaymentParams };
22
18
  exports.buildPaymentParams = buildPaymentParams;
package/lib/index.mjs CHANGED
@@ -467,14 +467,10 @@ export const queryUsernames = api.queryUsernames;
467
467
  export const installUsernameTools = api.installUsernameTools;
468
468
 
469
469
  // ========== Builders (ESM) ==========
470
- /* [fixed] Builders named re-export removed (CJS/ESM interop) */
471
470
 
472
471
  // Alias popular names
473
- /* [fixed] Builders named re-export removed (CJS/ESM interop) */
474
- /* [fixed] Builders named re-export removed (CJS/ESM interop) */
475
472
 
476
473
  // Sticker pack (from CJS side via api)
477
- /* [fixed] duplicate export const makeStickerPack removed */
478
474
  export const normalizeSticker = api.normalizeSticker;
479
475
  export const DEFAULT_EMOJIS = api.DEFAULT_EMOJIS;
480
476
 
@@ -486,7 +482,6 @@ export const getExt = api.getExt;
486
482
  export const basename = api.basename;
487
483
 
488
484
  // Country helpers
489
- /* [fixed] duplicate export const getCountryInfo removed */
490
485
  export const country = api.getCountryInfo; // alias
491
486
  export const countries = api.countries;
492
487
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kage-baileys",
3
- "version": "25.3.6",
3
+ "version": "25.3.8",
4
4
  "description": "Kage Baileys full merge — Builders + mbuilder + Framework + advanced sticker packs + KAGE pairing + extended WAProto + full TypeScript defs (.d.ts + maps) from elray + path utils. Multi-device ready.",
5
5
  "keywords": [
6
6
  "kage-baileys",