diff --git a/src/auto-reply/reply/agent-runner.ts b/src/auto-reply/reply/agent-runner.ts index b3e8cea65..833f40245 100644 --- a/src/auto-reply/reply/agent-runner.ts +++ b/src/auto-reply/reply/agent-runner.ts @@ -669,20 +669,17 @@ export async function runReplyAgent(params: { runId, blockReplyBreak: resolvedBlockStreamingBreak, blockReplyChunking, - onPartialReply: - allowPartialStream - ? async (payload) => { - const textForTyping = await handlePartialForTyping( - payload, - ); - if (!opts?.onPartialReply || textForTyping === undefined) - return; - await opts.onPartialReply({ - text: textForTyping, - mediaUrls: payload.mediaUrls, - }); - } - : undefined, + onPartialReply: allowPartialStream + ? async (payload) => { + const textForTyping = await handlePartialForTyping(payload); + if (!opts?.onPartialReply || textForTyping === undefined) + return; + await opts.onPartialReply({ + text: textForTyping, + mediaUrls: payload.mediaUrls, + }); + } + : undefined, onReasoningStream: typingSignals.shouldStartOnReasoning || opts?.onReasoningStream ? async (payload) => { diff --git a/src/browser/pw-tools-core.test.ts b/src/browser/pw-tools-core.test.ts index 008a8054e..f47d413f3 100644 --- a/src/browser/pw-tools-core.test.ts +++ b/src/browser/pw-tools-core.test.ts @@ -1,3 +1,4 @@ +import path from "node:path"; import { beforeEach, describe, expect, it, vi } from "vitest"; let currentPage: Record | null = null; @@ -306,10 +307,11 @@ describe("pw-tools-core", () => { currentPage = { on, off }; const mod = await importModule(); + const targetPath = path.resolve("/tmp/file.bin"); const p = mod.waitForDownloadViaPlaywright({ cdpUrl: "http://127.0.0.1:18792", targetId: "T1", - path: "/tmp/file.bin", + path: targetPath, timeoutMs: 1000, }); @@ -318,8 +320,8 @@ describe("pw-tools-core", () => { downloadHandler?.(download); const res = await p; - expect(saveAs).toHaveBeenCalledWith("/tmp/file.bin"); - expect(res.path).toBe("/tmp/file.bin"); + expect(saveAs).toHaveBeenCalledWith(targetPath); + expect(res.path).toBe(targetPath); }); it("clicks a ref and saves the resulting download", async () => { @@ -342,11 +344,12 @@ describe("pw-tools-core", () => { currentPage = { on, off }; const mod = await importModule(); + const targetPath = path.resolve("/tmp/report.pdf"); const p = mod.downloadViaPlaywright({ cdpUrl: "http://127.0.0.1:18792", targetId: "T1", ref: "e12", - path: "/tmp/report.pdf", + path: targetPath, timeoutMs: 1000, }); @@ -357,8 +360,8 @@ describe("pw-tools-core", () => { downloadHandler?.(download); const res = await p; - expect(saveAs).toHaveBeenCalledWith("/tmp/report.pdf"); - expect(res.path).toBe("/tmp/report.pdf"); + expect(saveAs).toHaveBeenCalledWith(targetPath); + expect(res.path).toBe(targetPath); }); it("waits for a matching response and returns its body", async () => {