@devries-cameron20 / t3code Mirror · read-only / commits / 7767a95b57
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 04:30 UTC

fix(server): html_preview no longer splits an emoji in a long console line (#29844)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Alex Southwell committed Nov 3, 2026 at 23:29 UTC 7767a95b57a9e5fab1b7b9d38d7a15893d99afa4
2 files changed +15 -4
apps/server/src/htmlRender/HtmlRender.test.ts
+10 -2
@@ -351,16 +351,24 @@ fs.createReadStream(null, { fd: 3 }).on("end", quit).on("data", (chunk) => {
351 for (const { id, method, sessionId } of messages.map((raw) => JSON.parse(raw))) {
352 if (method === "Browser.close") quit();
353 reply({ id, sessionId, result: results[method] ?? {} });
354 - if (method === "Page.navigate") reply({ sessionId, method: "Page.loadEventFired", params: {} });
354 + if (method === "Page.navigate") {
355 + const value = "x" + "\u{1F600}".repeat(300);
356 + const params = { type: "log", args: [{ type: "string", value }] };
357 + reply({ sessionId, method: "Runtime.consoleAPICalled", params });
358 + reply({ sessionId, method: "Page.loadEventFired", params: {} });
359 + }
360 }
361 });
362 `,
363 { mode: 0o755 },
364 );
365
361 - yield* HtmlRender.HtmlRender.use((htmlRender) =>
366 + const preview = yield* HtmlRender.HtmlRender.use((htmlRender) =>
367 htmlRender.preview({ html: "<p>x</p>" }),
368 ).pipe(Effect.provide(layerHtmlRender(executable)));
369 + const logged = preview.consoleMessages[0]?.text ?? "";
370 + expect(logged.isWellFormed()).toBe(true);
371 + expect(logged).toHaveLength(500);
372
373 const exitedBy = yield* fileSystem.readFileString(exitRecord).pipe(Effect.option);
374 expect(Option.getOrElse(exitedBy, () => "killed by a signal")).toBe("asked to close");
apps/server/src/htmlRender/headlessChrome.ts
+5 -2
@@ -316,10 +316,13 @@ const launchBrowser = Effect.fnUntraced(function* (input: {
316 return yield* Effect.void;
317 }
318 const text = consoleMessage.text.replaceAll(PAGE_URL, PAGE_NAME);
319 + // Half an emoji serializes to a lone surrogate escape, which provider JSON parsers reject.
320 + const last = text.charCodeAt(MAX_CONSOLE_TEXT_CHARS - 1);
321 + const end =
322 + last >= 0xd800 && last <= 0xdbff ? MAX_CONSOLE_TEXT_CHARS - 1 : MAX_CONSOLE_TEXT_CHARS;
323 page.consoleMessages.push({
324 level: consoleMessage.level,
321 - text:
322 - text.length > MAX_CONSOLE_TEXT_CHARS ? `${text.slice(0, MAX_CONSOLE_TEXT_CHARS)}…` : text,
325 + text: text.length > MAX_CONSOLE_TEXT_CHARS ? `${text.slice(0, end)}…` : text,
326 });
327 return yield* Effect.void;
328 });