fix(cli): decode daemon replies as streaming UTF-8

Closed
HA
7d ago
+62-1

why

Fixes #3462. The browse CLI prints � instead of non-ASCII page text when a large daemon reply arrives in several socket chunks and a chunk boundary falls inside a multi-byte character. The client decoded each chunk on its own with chunk.toString().

what changed

  • packages/cli/src/lib/driver/daemon/client.ts: call socket.setEncoding("utf8") so Node decodes across chunk boundaries, and append the string chunk.
  • New test packages/cli/tests/daemon-client-decoding.test.ts: a real unix-socket fake daemon writes one reply split inside the 3-byte 日.
  • Changeset: browse patch.

test plan

  • New test fails on main ('���本語 ✓' instead of '日本語 ✓') and passes with the fix.
  • packages/cli: format check, oxlint, typecheck, and the full vitest suite after pnpm build (582 tests) pass.
  • Repo-wide just check / just test not run; checks above are scoped to packages/cli.

🤖 Generated with Claude Code


Summary by cubic

Fixes #3462: the browse CLI printed � instead of non-ASCII page text when a large daemon reply arrived across socket chunks and a chunk boundary fell inside a multi-byte character. The daemon client now calls socket.setEncoding("utf8") so Node decodes across chunk boundaries instead of decoding each chunk separately.

  • Adds a test with a real unix-socket fake daemon that splits a reply inside the 3-byte 日.
  • Adds a browse patch changeset.