CodeNomad/packages
Pascal André d29dbf75cf
perf(tauri): Rust-native desktop event transport (#242)
## Summary

- switch the Tauri desktop runtime from the browser `EventSource` path
to a native Rust desktop event transport while leaving browser and
Electron unchanged
- restore SSE heartbeat parity by parsing named `event:` frames and
replying to `codenomad.client.ping` with an authenticated
`/api/client-connections/pong`
- add a Tauri-only settings toggle that lets the current device fall
back to the browser `EventSource` transport without leaking that choice
through shared config
- remove the temporary benchmark harness from the shipped code now that
the transport behavior has been validated

## Benchmark

The temporary in-app benchmark harness used during validation has been
removed from the final code, but the measured results are retained here
for review context.

Real Tauri/WebView2 benchmark on Windows using the dedicated session:
- workspace: `D:\CodeNomad`
- session: `ses_21feb15b3ffeLz3uRModK4KKnG`

Short command:
- `node -e "for (let i = 1; i <= 400; i += 1) console.log('line ' + i)"`

Results:
- browser `EventSource` forced in Tauri:
  - timed out after `131479.7ms`
  - `sawWorking=false`
  - `reachedIdle=false`
  - `batchesReceived=84`
  - `eventsReceived=84`
  - `maxBatchSize=1`
- Rust-native transport:
  - completed in `1437.4ms`
  - `sawWorking=true`
  - `reachedIdle=true`
  - `batchesReceived=4`
  - `eventsReceived=45`
  - `maxBatchSize=27`

Long heartbeat / stale-timeout validation:
- command: `powershell -NoProfile -Command Start-Sleep -Seconds 70`
- Rust-native transport:
  - completed in `71689.5ms`
  - `sawWorking=true`
  - `reachedIdle=true`
  - `batchesReceived=13`
  - `eventsReceived=72`
  - `maxBatchSize=25`

Confirmed separately afterward: the native transport also behaves better
on Linux.

## Validation

- `cargo test named_ping_event_is_routed_to_ping_channel`
- `cargo test session_cookie_is_attached_to_requests`
- `cargo test --no-run`
- `npx tsc --noEmit --pretty -p packages/ui/tsconfig.json`
- `npx tsc --noEmit --pretty -p packages/server/tsconfig.json`
- manual Tauri/WebView2 benchmark on Windows
- manual confirmation on Linux after the benchmark phase

## Notes

- this remains a Tauri-only transport; browser and Electron stay on the
browser `EventSource` path
- the Tauri fallback toggle is now genuinely device-local and restarts
the local event stream immediately when changed
- the long run validates heartbeat / stale-timeout robustness, not
headline perf
2026-06-08 18:20:00 +01:00
..
cloudflare Minimum version to 0.17.0 2026-06-04 21:07:53 +01:00
electron-app Bump version to 0.17.0 2026-06-04 21:05:56 +01:00
opencode-plugin Bump version to 0.17.0 2026-06-04 21:05:56 +01:00
server Bump version to 0.17.0 2026-06-04 21:05:56 +01:00
tauri-app perf(tauri): Rust-native desktop event transport (#242) 2026-06-08 18:20:00 +01:00
ui perf(tauri): Rust-native desktop event transport (#242) 2026-06-08 18:20:00 +01:00