





















@@ -299,6 +299,40 @@ describe("bundled plugin postinstall", () => {
299299});
300300});
301301302+it("recognizes Baileys upload helpers with a prepared dispatcher", async () => {
303+const packageRoot = await createTempDirAsync("openclaw-baileys-postinstall-");
304+await writeBaileysMediaFile(
305+packageRoot,
306+[
307+"import { once } from 'events';",
308+"const encryptedStream = async () => {",
309+" encFileWriteStream.write(mac);",
310+" const encFinishPromise = once(encFileWriteStream, 'finish');",
311+" const originalFinishPromise = originalFileStream ? once(originalFileStream, 'finish') : Promise.resolve();",
312+" encFileWriteStream.end();",
313+" originalFileStream?.end?.();",
314+" stream.destroy();",
315+" await encFinishPromise;",
316+" await originalFinishPromise;",
317+" logger?.debug('encrypted data successfully');",
318+"};",
319+"const uploadWithFetch = async ({ url, filePath, headers, timeoutMs, agent }) => {",
320+" const dispatcher = typeof agent?.dispatch === 'function' ? agent : undefined;",
321+" const response = await fetch(url, {",
322+" ...(dispatcher ? { dispatcher } : {}),",
323+" method: 'POST',",
324+" });",
325+"};",
326+"",
327+].join("\n"),
328+);
329+330+expect(applyBaileysEncryptedStreamFinishHotfix({ packageRoot })).toEqual({
331+applied: false,
332+reason: "already_patched",
333+});
334+});
335+302336it("does not classify published packages with source files as source checkouts", () => {
303337const packageRoot = "/pkg";
304338const existingPaths = new Set([
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。