Skip to content

fix: comprehensive Windows support, event system fix, and UX improvements#457

Open
BruceChenZebra wants to merge 1 commit intowinfunc:mainfrom
BruceChenZebra:fix/windows-support
Open

fix: comprehensive Windows support, event system fix, and UX improvements#457
BruceChenZebra wants to merge 1 commit intowinfunc:mainfrom
BruceChenZebra:fix/windows-support

Conversation

@BruceChenZebra
Copy link
Copy Markdown

Summary

This PR fixes critical issues that prevent opcode from working properly on Windows, along with several UX improvements.

Critical Fixes

  • Fix Tauri event system (root cause of chat not responding): Replace require("@tauri-apps/api/event") with ES importrequire() fails silently in Vite ESM production builds, causing ALL Tauri IPC events to fall back to DOM listeners that never receive backend messages. This is the root cause of the chat "spinning forever" bug.
  • Add withGlobalTauri: true to tauri.conf.json for reliable window.__TAURI__ availability.
  • Prevent console window flashing on Windows: Add CREATE_NO_WINDOW flag to all subprocess spawns (where.exe, claude --version, chat sessions, agents, process management). Introduces hidden_command() helper.
  • Fix stdin hang: Set stdin(Stdio::null()) on Claude subprocess to prevent 3-second stdin timeout.
  • Disable transparent window: transparent: false fixes severe WebView2 rendering performance issues on Windows.
  • Add Windows bundle targets: nsis and msi for proper Windows installer generation.

New Features

  • Image support: Send images to Claude via --input-format stream-json with stdin pipe. Automatically detects @"data:image/..." references and constructs proper base64 content blocks. Works across execute, continue, and resume commands.
  • Image placeholder in input: Show [Image #N] + thumbnail in text input instead of raw base64 data.
  • Long text collapse: Pasted text >10 lines is displayed as ▶ [Pasted text +XX lines] with expandable preview.

UX Improvements

  • Remove duplicate result messages: "Execution Complete" card now only shows metadata (cost, duration, tokens), no longer duplicates the assistant response text.
  • Suppress debug output in production: console.log suppressed in prod builds; Rust println! wrapped in trace_log! macro (debug-only).

Test plan

  • Text chat works on Windows (messages sent and received in real-time)
  • No console window flashing when sending messages
  • Image paste shows [Image #N] in input box
  • Image sending works (Claude receives and responds to images)
  • Long pasted text collapses properly
  • No duplicate messages in chat
  • "Execution Complete" shows only metadata

🤖 Generated with Claude Code

## Windows Platform Fixes
- Fix Tauri event system: replace `require()` with ES `import` for
  `@tauri-apps/api/event` — `require()` fails silently in Vite ESM builds,
  causing all Tauri IPC events to fall back to DOM listeners that never
  receive backend messages. This was the root cause of the chat "spinning
  forever" bug on all platforms using production builds.
- Add `withGlobalTauri: true` to tauri.conf.json for reliable `window.__TAURI__`
  availability.
- Add `CREATE_NO_WINDOW` (0x08000000) flag to all subprocess spawns on Windows
  to prevent console windows from flashing when launching claude, `where.exe`,
  or other CLI tools. Introduces `hidden_command()` helper in claude_binary.rs.
- Set `stdin(Stdio::null())` on Claude subprocess to prevent 3-second stdin
  wait timeout.
- Disable transparent window rendering (`transparent: false`) which causes
  severe performance issues with WebView2 on Windows.
- Add `nsis` and `msi` to bundle targets for Windows installer generation.

## Image Support
- Add image sending support via `--input-format stream-json` with stdin pipe.
  When prompts contain `@"data:image/..."` references, automatically switch
  from `-p` flag to stdin-based content blocks with proper base64 image data.
- Works across all entry points: execute, continue, and resume commands.

## UX Improvements
- Show `[Image #N]` placeholder + thumbnail in input box instead of raw base64.
- Collapse long pasted text (>10 lines) as `[Pasted text +XX lines]` with
  expandable preview in message display.
- Remove duplicate content in result messages — "Execution Complete" card now
  only shows metadata (cost, duration, tokens) since the assistant message
  above already displays the response text.
- Suppress console.log/debug output in production builds to reduce overhead.
- Wrap all Rust `println!` in web_server.rs with `trace_log!` macro that only
  prints in debug builds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant