diff --git a/CHANGELOG.md b/CHANGELOG.md index 7024f6d9b261..6a8d36ceb2b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- WhatsApp: update Baileys to `7.0.0-rc12`. - Dependencies: update `@openclaw/fs-safe` to `0.2.7` so OpenClaw's default Python-helper-off policy keeps best-effort Node write fallbacks for private stores, secret writes, run logs, and media attachments on Linux/macOS. - Browser: honor the configured image sanitization limit for screenshots and labeled snapshots so browser-captured images follow the same resize policy as other image results. (#84595) - Status: show the configured default, session-selected model, reason, clear hint, and docs link when a session remains pinned to a model that differs from `agents.defaults.model.primary`. diff --git a/extensions/whatsapp/package.json b/extensions/whatsapp/package.json index 88c60a0b7a94..1934dbc74441 100644 --- a/extensions/whatsapp/package.json +++ b/extensions/whatsapp/package.json @@ -9,7 +9,7 @@ "type": "module", "dependencies": { "audio-decode": "2.2.3", - "baileys": "7.0.0-rc11", + "baileys": "7.0.0-rc12", "https-proxy-agent": "9.0.0", "jimp": "1.6.1", "typebox": "1.1.38" diff --git a/patches/baileys@7.0.0-rc11.patch b/patches/baileys@7.0.0-rc11.patch deleted file mode 100644 index 80af506a37e9..000000000000 --- a/patches/baileys@7.0.0-rc11.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/lib/Utils/messages-media.js b/lib/Utils/messages-media.js -index 95f8c63..612b7fb 100644 ---- a/lib/Utils/messages-media.js -+++ b/lib/Utils/messages-media.js -@@ -596,7 +596,10 @@ const uploadWithFetch = async ({ url, filePath, headers, timeoutMs, agent }) => - const nodeStream = createReadStream(filePath); - const webStream = Readable.toWeb(nodeStream); - const response = await fetch(url, { -- dispatcher: agent, -+ // Baileys may pass a generic agent in some runtimes. Undici's dispatcher -+ // option only accepts Dispatcher-compatible implementations, so only wire -+ // it through when the object actually implements dispatch. -+ ...(typeof agent?.dispatch === 'function' ? { dispatcher: agent } : {}), - method: 'POST', - body: webStream, - headers, -diff --git a/lib/Utils/logger.d.ts b/lib/Utils/logger.d.ts -index 4d78996..059f58f 100644 ---- a/lib/Utils/logger.d.ts -+++ b/lib/Utils/logger.d.ts -@@ -7,6 +7,6 @@ export interface ILogger { - info(obj: unknown, msg?: string): void; - warn(obj: unknown, msg?: string): void; - error(obj: unknown, msg?: string): void; - } --declare const _default: import("pino").Logger; -+declare const _default: ILogger; - export default _default; diff --git a/patches/baileys@7.0.0-rc12.patch b/patches/baileys@7.0.0-rc12.patch new file mode 100644 index 000000000000..935eeb183af2 --- /dev/null +++ b/patches/baileys@7.0.0-rc12.patch @@ -0,0 +1,12 @@ +diff --git a/lib/Utils/logger.d.ts b/lib/Utils/logger.d.ts +index 4d78996..059f58f 100644 +--- a/lib/Utils/logger.d.ts ++++ b/lib/Utils/logger.d.ts +@@ -7,6 +7,6 @@ export interface ILogger { + info(obj: unknown, msg?: string): void; + warn(obj: unknown, msg?: string): void; + error(obj: unknown, msg?: string): void; + } +-declare const _default: import("pino").Logger; ++declare const _default: ILogger; + export default _default; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 394e84b5dd67..fe9549a50a20 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,7 +35,7 @@ packageExtensionsChecksum: sha256-oc/FAHkBR844HBfph1RZWyRMHHBpIFya25tyv5SGf6s= patchedDependencies: '@agentclientprotocol/claude-agent-acp@0.33.1': 3995624bb834cc60fea1461c7ef33f1fcdd8fb58b8f43f2f1490bc689f6e1be2 - baileys@7.0.0-rc11: a9aea1790d2c65b1ae543c77faca4119bbfb91ee3b6ca6c38d1cad4f5702ada2 + baileys@7.0.0-rc12: f2bd4db8403598ce9e4efafe859a27443a41c5ce25d97218de69169b4c03e18c importers: @@ -1651,8 +1651,8 @@ importers: specifier: 2.2.3 version: 2.2.3 baileys: - specifier: 7.0.0-rc11 - version: 7.0.0-rc11(patch_hash=a9aea1790d2c65b1ae543c77faca4119bbfb91ee3b6ca6c38d1cad4f5702ada2)(audio-decode@2.2.3)(jimp@1.6.1)(sharp@0.34.5) + specifier: 7.0.0-rc12 + version: 7.0.0-rc12(patch_hash=f2bd4db8403598ce9e4efafe859a27443a41c5ce25d97218de69169b4c03e18c)(audio-decode@2.2.3)(jimp@1.6.1)(sharp@0.34.5) https-proxy-agent: specifier: 9.0.0 version: 9.0.0 @@ -4741,8 +4741,8 @@ packages: bail@2.0.2: resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==} - baileys@7.0.0-rc11: - resolution: {integrity: sha512-yi7An4f5DmShjb75L8eSttrA6HLy7PYoP3XIQBmvQ5yH8vVZWBXZDogDxfGQQL6N98ELRwznG7puhjyLEa5CQg==} + baileys@7.0.0-rc12: + resolution: {integrity: sha512-kttfToIBUKJb5hn57GspFbtlGaOp8wwhij7F8JRtduIL6vIODL5ze7XnsQKT73QwgFOGdJYXAT01x6rz9NNijg==} engines: {node: '>=20.0.0'} peerDependencies: audio-decode: ^2.1.3 @@ -10806,7 +10806,7 @@ snapshots: bail@2.0.2: {} - baileys@7.0.0-rc11(patch_hash=a9aea1790d2c65b1ae543c77faca4119bbfb91ee3b6ca6c38d1cad4f5702ada2)(audio-decode@2.2.3)(jimp@1.6.1)(sharp@0.34.5): + baileys@7.0.0-rc12(patch_hash=f2bd4db8403598ce9e4efafe859a27443a41c5ce25d97218de69169b4c03e18c)(audio-decode@2.2.3)(jimp@1.6.1)(sharp@0.34.5): dependencies: '@cacheable/node-cache': 1.7.6 '@hapi/boom': 9.1.4 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 29698bd1a762..4a37cccc052f 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -14,7 +14,7 @@ minimumReleaseAgeExclude: - "@agentclientprotocol/sdk" - "axios" - "basic-ftp" - - "baileys@7.0.0-rc11" + - "baileys@7.0.0-rc12" - "hono" - "libsignal@6.0.0" - "openclaw" @@ -105,4 +105,4 @@ peerDependencyRules: patchedDependencies: "@agentclientprotocol/claude-agent-acp@0.33.1": "patches/@agentclientprotocol__claude-agent-acp@0.33.1.patch" - "baileys@7.0.0-rc11": "patches/baileys@7.0.0-rc11.patch" + "baileys@7.0.0-rc12": "patches/baileys@7.0.0-rc12.patch" diff --git a/scripts/check-package-patches.mjs b/scripts/check-package-patches.mjs index 76814647ba12..806500403d24 100644 --- a/scripts/check-package-patches.mjs +++ b/scripts/check-package-patches.mjs @@ -11,7 +11,7 @@ const ALLOWED_PATCHED_DEPENDENCIES = new Map([ "@agentclientprotocol/claude-agent-acp@0.33.1", "patches/@agentclientprotocol__claude-agent-acp@0.33.1.patch", ], - ["baileys@7.0.0-rc11", "patches/baileys@7.0.0-rc11.patch"], + ["baileys@7.0.0-rc12", "patches/baileys@7.0.0-rc12.patch"], ]); const ALLOWED_PATCH_FILES = new Set(["patches/.gitkeep", ...ALLOWED_PATCHED_DEPENDENCIES.values()]); diff --git a/scripts/postinstall-bundled-plugins.mjs b/scripts/postinstall-bundled-plugins.mjs index 5d8c8e15a4bd..0fd184114c79 100644 --- a/scripts/postinstall-bundled-plugins.mjs +++ b/scripts/postinstall-bundled-plugins.mjs @@ -651,7 +651,11 @@ export function applyBaileysEncryptedStreamFinishHotfix(params = {}) { ) || patchedText.includes( "...(typeof agent?.dispatch === 'function' ? { dispatcher: agent } : {}),", - ); + ) || + (patchedText.includes( + "const dispatcher = typeof agent?.dispatch === 'function' ? agent : undefined;", + ) && + patchedText.includes("...(dispatcher ? { dispatcher } : {}),")); const legacyDispatcherPatchable = patchedText.includes(BAILEYS_MEDIA_DISPATCHER_NEEDLE) && patchedText.includes(BAILEYS_MEDIA_DISPATCHER_HEADER_NEEDLE); diff --git a/test/scripts/check-package-patches.test.ts b/test/scripts/check-package-patches.test.ts index 93288868d7c5..4466a1278cfc 100644 --- a/test/scripts/check-package-patches.test.ts +++ b/test/scripts/check-package-patches.test.ts @@ -59,7 +59,7 @@ describe("check-package-patches", () => { `packages: - . patchedDependencies: - "baileys@7.0.0-rc11": "patches/baileys@7.0.0-rc11.patch" + "baileys@7.0.0-rc12": "patches/baileys@7.0.0-rc12.patch" "@agentclientprotocol/claude-agent-acp@0.33.1": "patches/@agentclientprotocol__claude-agent-acp@0.33.1.patch" `, "utf8", @@ -69,11 +69,11 @@ patchedDependencies: `lockfileVersion: '9.0' patchedDependencies: '@agentclientprotocol/claude-agent-acp@0.33.1': 3995624bb834cc60fea1461c7ef33f1fcdd8fb58b8f43f2f1490bc689f6e1be2 - baileys@7.0.0-rc11: a9aea1790d2c65b1ae543c77faca4119bbfb91ee3b6ca6c38d1cad4f5702ada2 + baileys@7.0.0-rc12: a9aea1790d2c65b1ae543c77faca4119bbfb91ee3b6ca6c38d1cad4f5702ada2 `, "utf8", ); - writeFileSync(path.join(dir, "patches", "baileys@7.0.0-rc11.patch"), "diff\n", "utf8"); + writeFileSync(path.join(dir, "patches", "baileys@7.0.0-rc12.patch"), "diff\n", "utf8"); writeFileSync( path.join(dir, "patches", "@agentclientprotocol__claude-agent-acp@0.33.1.patch"), "diff\n", diff --git a/test/scripts/postinstall-bundled-plugins.test.ts b/test/scripts/postinstall-bundled-plugins.test.ts index ded782721c95..59c58b9eac0e 100644 --- a/test/scripts/postinstall-bundled-plugins.test.ts +++ b/test/scripts/postinstall-bundled-plugins.test.ts @@ -299,6 +299,40 @@ describe("bundled plugin postinstall", () => { }); }); + it("recognizes Baileys upload helpers with a prepared dispatcher", async () => { + const packageRoot = await createTempDirAsync("openclaw-baileys-postinstall-"); + await writeBaileysMediaFile( + packageRoot, + [ + "import { once } from 'events';", + "const encryptedStream = async () => {", + " encFileWriteStream.write(mac);", + " const encFinishPromise = once(encFileWriteStream, 'finish');", + " const originalFinishPromise = originalFileStream ? once(originalFileStream, 'finish') : Promise.resolve();", + " encFileWriteStream.end();", + " originalFileStream?.end?.();", + " stream.destroy();", + " await encFinishPromise;", + " await originalFinishPromise;", + " logger?.debug('encrypted data successfully');", + "};", + "const uploadWithFetch = async ({ url, filePath, headers, timeoutMs, agent }) => {", + " const dispatcher = typeof agent?.dispatch === 'function' ? agent : undefined;", + " const response = await fetch(url, {", + " ...(dispatcher ? { dispatcher } : {}),", + " method: 'POST',", + " });", + "};", + "", + ].join("\n"), + ); + + expect(applyBaileysEncryptedStreamFinishHotfix({ packageRoot })).toEqual({ + applied: false, + reason: "already_patched", + }); + }); + it("does not classify published packages with source files as source checkouts", () => { const packageRoot = "/pkg"; const existingPaths = new Set([