@zelynskybail/baileys 2.6.34 → 2.6.35

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/BUILD_STATUS.md CHANGED
@@ -1,17 +1,20 @@
1
- # Build Status — 2.6.34
1
+ # Build Status — 2.6.35
2
2
 
3
- ## Added
4
- - Experimental shared-socket VoIP engine ported from `@japofc/baileys` 2.4.7-new.
5
- - Group-call join/start APIs, incoming offer handling, audio feeder, relay transport, WASM worker engine, call recovery and recorder.
6
- - Existing Zelynsky VoIP adapter retained under its original `VoipClient` export.
3
+ ## Added and fixed
4
+ - Bundled the supplied WhatsApp Web WASM resource snapshot: `loader.js`, `worker-modules.js`, `whatsapp.wasm`, and `integrity.json` (client revision 1048638736; refresh with `npm run voip:fetch-wasm`).
5
+ - Fixed false-positive worker-bundle loader detection that skipped the standalone WASM loader.
6
+ - Fixed worker-bootstrap lookup for the package `lib/assets/wasm` resource directory.
7
+ - Updated the WASM fetch script to create its destination directory and validate the loader module definition.
8
+ - Release verification checks presence, size, and SHA-256 for all manifest-listed WASM assets; Node test suite includes WASM integrity and loader-detection regression tests.
9
+ - Preserved existing Zelynsky messaging, VoIP, CallManager, and group-call APIs.
7
10
 
8
11
  ## Runtime requirements
9
12
  - Node.js >=20.
10
13
  - `@roamhq/wrtc` optional native dependency for WebRTC relay transport.
11
- - WhatsApp Web WASM resources fetched with `npm run voip:fetch-wasm`.
14
+ - The package includes a pinned WASM resource snapshot. Run `npm run voip:fetch-wasm` to refresh it from WhatsApp Web.
12
15
  - `ffmpeg` available on PATH for file-based audio sources.
13
16
 
14
17
  ## Status
15
- - API port and package wiring added.
16
- - Syntax and package-integrity checks are required before release.
18
+ - Package version and release scripts updated to 2.6.35.
19
+ - Static verification and package tests must pass before release.
17
20
  - Group-call interoperability has not been tested against a live WhatsApp account in this build environment. Treat group calling as experimental.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.6.35
4
+
5
+ - Bundled the supplied WhatsApp Web runtime snapshot (`loader.js`, `worker-modules.js`, `whatsapp.wasm`) with its SHA-256 integrity manifest; the refresh script can update it from WhatsApp Web.
6
+ - Fixed WASM loader detection: worker bundle references no longer incorrectly suppress loading the standalone loader module.
7
+ - Fixed worker-bootstrap resource lookup to search the package `lib/assets/wasm` directory passed by the WASM engine.
8
+ - Made `voip:fetch-wasm` create its destination directory before downloading and validate that the fetched loader actually defines the requested module.
9
+ - Strengthened release verification to validate all bundled WASM resource sizes and SHA-256 hashes; added loader-detection and bundled-resource regression tests.
10
+ - Preserved the existing Zelynsky APIs and experimental CallManager/group-call implementation.
11
+
12
+
3
13
  ## 2.6.34
4
14
 
5
15
  - Added experimental JAPofc 2.4.7-new based shared-socket VoIP engine.
package/NOTICE.md CHANGED
@@ -7,3 +7,6 @@ The bundled `lib/Modded/MessageBuilder.js` is the user-supplied NIXCODE MessageB
7
7
  The optional VoIP engine is a separate MIT-licensed dependency and is loaded only when requested.
8
8
 
9
9
  This project is independent and is not affiliated with or endorsed by WhatsApp or Meta Platforms, Inc.
10
+
11
+
12
+ The `lib/assets/wasm/` directory includes a pinned WhatsApp Web runtime resource snapshot (`whatsapp.wasm`, `worker-modules.js`, and `loader.js`) supplied separately for this integration. These generated WhatsApp Web resources are third-party runtime assets and are not original Zelynsky or JAPofc source code; the JAPofc MIT license does not relicense WhatsApp/Meta assets. The bundled integrity manifest records their SHA-256 hashes and source URLs. The refresh script downloads replacement resources from WhatsApp Web.
package/README.md CHANGED
@@ -175,13 +175,20 @@ API group-call:
175
175
  - `setAudioSource(source)`, `getActiveCall()`, `isBusy()`, `getStats()`, `recoverCall(options)`
176
176
  - `call.setAudioSource(source)`, `call.end()`, `call.mute(boolean)`, `call.waitForEnd()`
177
177
 
178
- Engine group-call ini masih **experimental** dan butuh resource WhatsApp Web WASM serta native WebRTC. Pasang `@roamhq/wrtc` yang cocok dengan platform Node.js lu, lalu ambil resource WASM:
178
+ Engine group-call ini masih **experimental** dan membutuhkan resource WhatsApp Web WASM serta native WebRTC. Paket npm membundel snapshot resource WASM yang checksum-nya diverifikasi saat build. Pasang `@roamhq/wrtc` yang cocok dengan platform Node.js lu:
179
179
 
180
180
  ```sh
181
181
  npm i @roamhq/wrtc
182
+ ```
183
+
184
+ Untuk memperbarui snapshot WASM dari endpoint WhatsApp Web, jalankan:
185
+
186
+ ```sh
182
187
  npm run voip:fetch-wasm
183
188
  ```
184
189
 
190
+ Perintah tersebut otomatis membuat `lib/assets/wasm/` jika belum ada, mengunduh worker, loader, dan WASM yang saling cocok, lalu menulis `integrity.json`. Worker engine memuat loader dari `lib/assets/wasm/loader.js`; loader tidak boleh dilewati hanya karena nama modulnya disebut sebagai dependency di worker bundle.
191
+
185
192
  `ffmpeg` diperlukan untuk memutar sumber audio berbentuk file. `attachVoip()` menggunakan socket Baileys yang sudah login; ia tidak membuat sesi linked-device kedua. Uji di akun/grup percobaan terlebih dahulu. API yang tersedia tidak menjamin WhatsApp akan menerima setiap panggilan atau bahwa koneksi RTC stabil di semua platform.
186
193
 
187
194
  ## Profil performa
@@ -13,3 +13,8 @@ No third-party code is represented as wholly original ZelynskyBail work.
13
13
  The experimental shared-socket VoIP engine under `lib/VoIP/group-call.js` and its supporting modules (`audio-feeder.js`, `call-recorder.js`, `relay-transport.js`, `signaling.js`, `types.js`, `wasm-engine.js`, and `worker-bootstrap.js`) are ported from `@japofc/baileys` version `2.4.7-new`, authored by J.AP (JAPofc).
14
14
 
15
15
  The source project declares the MIT License. The port retains the original JAPofc source attribution/comments. This notice is provided in addition to the upstream Baileys and other third-party notices already included with this package.
16
+
17
+
18
+ ## Bundled WhatsApp Web WASM resources
19
+
20
+ `lib/assets/wasm/whatsapp.wasm`, `worker-modules.js`, and `loader.js` are generated WhatsApp Web runtime resources, provided as a pinned compatibility snapshot for the experimental VoIP engine. They are not covered by the JAPofc MIT license. Their hashes, source URLs, and client revision are recorded in `lib/assets/wasm/integrity.json`. Use of these resources remains subject to the applicable WhatsApp/Meta terms.
@@ -303,12 +303,31 @@ export class WasmEngine {
303
303
  }
304
304
  const diskWorkerCode = fs.existsSync(workerFile) ? fs.readFileSync(workerFile, "utf8") : "";
305
305
  this.#workerModulesCode = this.#config.workerModulesCode ?? diskWorkerCode;
306
- const workerBundleHasLoader = typeof this.#workerModulesCode === "string" && /WAWebVoipWebWasmLoader/.test(this.#workerModulesCode);
307
- // Skip the on-disk loader.js if the worker bundle already has a loader —
308
- // the standalone loader.js is older and would clobber the freshly fetched
309
- // bindings inside worker-modules.js.
306
+
307
+ // A dependency/reference to WAWebVoipWebWasmLoader is NOT proof that the
308
+ // worker bundle registers that module. Only skip loader.js when the
309
+ // bundle contains an actual module definition. Earlier builds used a
310
+ // broad string check here, which skipped loader.js for bundles that only
311
+ // referenced the loader and caused worker-bootstrap to fail resolution.
312
+ const loaderModuleCandidates = [
313
+ this.#config.loaderModuleName,
314
+ "WAWebVoipWebWasmLoader",
315
+ "WAWebVoipWebWasmLoader.worker",
316
+ "WAWebVoipWebWasmLoader_ProdLab_internal.worker",
317
+ "WAWebVoipWebWasmLoader_ProdLabvideo_internal.worker",
318
+ ].filter((value, index, array) => !!value && array.indexOf(value) === index);
319
+ const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
320
+ const workerBundleDefinesLoader = typeof this.#workerModulesCode === "string" &&
321
+ loaderModuleCandidates.some((name) =>
322
+ new RegExp(`(?:__d|__registerModule)\\s*\\(\\s*["']${escapeRegExp(name)}["']`).test(this.#workerModulesCode)
323
+ );
324
+
310
325
  this.#loaderCode = this.#config.loaderCode ??
311
- (workerBundleHasLoader ? "" : fs.existsSync(loaderFile) ? fs.readFileSync(loaderFile, "utf8") : "");
326
+ (!workerBundleDefinesLoader && fs.existsSync(loaderFile) ? fs.readFileSync(loaderFile, "utf8") : "");
327
+
328
+ if (!this.#loaderCode && !workerBundleDefinesLoader) {
329
+ throw new Error(`VoIP loader module is unavailable. Expected ${loaderFile} or an embedded module definition in worker-modules.js.`);
330
+ }
312
331
  if (!this.#loaderCode && !this.#workerModulesCode) {
313
332
  throw new Error("No loader/worker code available to initialize VoIP");
314
333
  }
@@ -546,6 +546,7 @@ const getPreferredLoaderModuleNames = () => {
546
546
  ].filter((value, index, array) => !!value && array.indexOf(value) === index);
547
547
  };
548
548
  const resolveLoaderModule = () => {
549
+ const errors = [];
549
550
  for (const moduleName of getPreferredLoaderModuleNames()) {
550
551
  try {
551
552
  const loaderModule = global.__r(moduleName);
@@ -554,7 +555,12 @@ const resolveLoaderModule = () => {
554
555
  return resolved;
555
556
  }
556
557
  }
557
- catch (e) { console.error(`[VoIP worker-bootstrap] resolveLoaderModule failed for "${moduleName}":`, e); }
558
+ catch (e) {
559
+ errors.push(`${moduleName}: ${e?.message || e}`);
560
+ }
561
+ }
562
+ if (errors.length && typedWorkerData?.enableLogs) {
563
+ console.warn(`[VoIP worker-bootstrap] no loader module resolved (${errors.join("; ")})`);
558
564
  }
559
565
  return null;
560
566
  };
@@ -771,9 +777,15 @@ if (typedWorkerData && (typedWorkerData.loaderCode || typedWorkerData.workerModu
771
777
  catch (e) { console.error("[VoIP worker-bootstrap] loaderCode block failed:", e); }
772
778
  }
773
779
  if (!wasmLoader) {
774
- const resourcesPath = typedWorkerData?.resourcesPath || path.join(__dirname, "wasm-resources");
775
- const rsrcPath = path.join(resourcesPath, "loader.js");
776
- if (fs.existsSync(rsrcPath)) {
780
+ const resourcesBase = typedWorkerData?.resourcesPath || path.resolve(__dirname, "..");
781
+ const loaderCandidates = [
782
+ path.join(resourcesBase, "assets", "wasm", "loader.js"),
783
+ path.join(resourcesBase, "loader.js"),
784
+ path.join(__dirname, "..", "assets", "wasm", "loader.js"),
785
+ path.join(__dirname, "wasm-resources", "loader.js"),
786
+ ];
787
+ const rsrcPath = loaderCandidates.find((candidate) => fs.existsSync(candidate));
788
+ if (rsrcPath) {
777
789
  try {
778
790
  const loaderCode = fs.readFileSync(rsrcPath, "utf8");
779
791
  const savedCallbacks = global.self.WhatsAppVoipWasmWorkerCompatibleCallbacks;
@@ -784,7 +796,12 @@ if (!wasmLoader) {
784
796
  }
785
797
  wasmLoader = resolveLoaderModule();
786
798
  }
787
- catch (e) { console.error(`[VoIP worker-bootstrap] failed to run loader.js from "${rsrcPath}":`, e); }
799
+ catch (e) {
800
+ console.error(`[VoIP worker-bootstrap] failed to run loader.js from "${rsrcPath}":`, e);
801
+ }
802
+ }
803
+ else if (typedWorkerData?.enableLogs) {
804
+ console.error(`[VoIP worker-bootstrap] loader.js not found. Checked: ${loaderCandidates.join(", ")}`);
788
805
  }
789
806
  }
790
807
  let s = {};
@@ -0,0 +1,25 @@
1
+ {
2
+ "generatedAt": "2026-09-28T16:49:19.321Z",
3
+ "verifiedAgainstLiveAt": "2026-09-30T00:00:00.000Z",
4
+ "source": "bootloader-endpoint",
5
+ "clientRevision": 1048638736,
6
+ "urls": {
7
+ "wasm": "https://static.whatsapp.net/rsrc.php/y_/r/XLyfuhDLM3g.wasm",
8
+ "worker": "https://static.whatsapp.net/rsrc.php/v4/yD/r/r-x_ghPDQe2.js",
9
+ "loader": "https://static.whatsapp.net/rsrc.php/v4/y6/r/nZtQhSipHK-.js"
10
+ },
11
+ "files": {
12
+ "whatsapp.wasm": {
13
+ "sha256": "67bc7cefb07b65282640413b25c1ad9712bb19f84663ff40680a1b68d5e693c0",
14
+ "size": 11060464
15
+ },
16
+ "worker-modules.js": {
17
+ "sha256": "2e0db90ffa664ad629dc547bf921f84f793752f211ae0acbfc385ec114334d9d",
18
+ "size": 910184
19
+ },
20
+ "loader.js": {
21
+ "sha256": "7b82ec5d1f10348beadad27569763a28b93c9164ad12b95c6c3e5921e661f288",
22
+ "size": 167807
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,5 @@
1
+ // loader.js is a vendored, minified Meta/FB module-registry bundle consumed by
2
+ // path (see lib/VoIP/wasm-engine.js), not an ESM module — it intentionally
3
+ // exports nothing. This file exists so every .js in the package has a
4
+ // matching .d.ts.
5
+ export {};