From c9d1605b1e3b8dbe88cd3674a9256aa0465f3e6d Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Sat, 2 May 2026 16:53:34 +0530 Subject: chore: address final-review minors — surface event-consumer crashes, document IIFE-wrap heuristic, log shutdown failures, fix CHANGELOG file-size claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Five tweaks from the whole-implementation review: - session.ts: log unexpected event-consumer rejections instead of silent swallow - client.ts: comment the return-substring IIFE-wrap false-positive case - transport.ts: comment that ws.onclose post-open settle is no-op-by-design - index.ts: log client.stop() failures during shutdown - CHANGELOG.md: correct largest-file claim (transport.ts and client.ts are ~220 each, not "client.ts at ~180") Co-Authored-By: Claude Opus 4.7 (1M context) --- src/client.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/client.ts') diff --git a/src/client.ts b/src/client.ts index 1fcef67..51dfa9f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -117,6 +117,10 @@ export const createBrowserClient = (opts: BrowserClientOptions): BrowserClient = }; const evaluateJs = async (expression: string, sessionId?: string): Promise> => { + // Heuristic IIFE wrap: legacy convenience that lets agents write + // `return foo` instead of `(() => foo)()`. False-positive on substring + // `"return "` inside string literals or comments — agents that hit this + // can pass an explicit IIFE instead. const wrapped = expression.includes("return ") && !expression.trim().startsWith("(") ? `(function(){${expression}})()` : expression; -- cgit v1.2.3