Commit Graph

919 Commits

Author SHA1 Message Date
sjg 80aadf54ab [feat](trx-frontend-http): add interactive Map tab with Leaflet
Add a Map sub-tab under Plugins that displays an interactive
OpenStreetMap via Leaflet.js showing:
- Receiver location (blue marker) from server config lat/lon
- APRS station positions (green markers) updated in real-time

The map lazy-initializes on first tab switch, handles tile rendering
on tab visibility changes, and deduplicates station markers by
callsign. Also includes the fallback snapshot lat/lon fields in the
API layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 21:44:55 +01:00
sjg e4db312814 [feat](trx-client): propagate server_latitude/longitude from snapshot
Map server_latitude and server_longitude from RigSnapshot to RigState
in remote_client and set None defaults in standalone client init.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 21:44:47 +01:00
sjg 6e34323cb1 [feat](trx-server): add latitude/longitude config and propagation
Add latitude and longitude Option<f64> fields to [general] config
section and propagate through ResolvedConfig, RigTaskConfig, and
build_initial_state into the RigState/RigSnapshot pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 21:44:43 +01:00
sjg df409a2cd3 [feat](trx-core): add server_latitude and server_longitude to RigState and RigSnapshot
Propagate receiver location (WGS84 decimal degrees) through the state
pipeline so frontends can display the server position on a map.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 21:44:38 +01:00
sjg 7828402ab6 [feat](trx-frontend-http): add APRS symbols, map links, and correlation demodulator
- Add APRS symbol icons using hessu/aprs-symbols sprite sheets
- Parse uncompressed and compressed position formats for lat/lon
- Render clickable OpenStreetMap links for position packets
- Replace delay-and-multiply discriminator with mark/space correlation
  detector for more robust AFSK decoding
- Reduce PLL gain from 0.7 to 0.4 for stable clock recovery
- Move plugin JS files to plugins/ subdirectory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 21:19:14 +01:00
sjg ef1ffb11ec [feat](trx-frontend-http): add clear button to CW decoder output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 15:31:28 +01:00
sjg af50c2b6ee [feat](trx-frontend-http): add auto tone and WPM detection to CW decoder
Add Auto checkboxes (checked by default) next to WPM and Tone inputs.
Auto Tone uses a multi-bin Goertzel scan across 300-1200 Hz with
stability tracking. Auto WPM collects on-durations in a rolling buffer
and uses k-means-style clustering to separate dits from dahs.
Unchecking Auto allows manual control.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 15:30:42 +01:00
sjg 62471c0336 [feat](trx-frontend-http): extract APRS to separate file and add CW decoder plugin
Extract the APRS decoder from app.js into its own aprs.js file and add
a new CW (Morse code) decoder plugin in cw.js. The CW decoder uses a
Goertzel tone detector with configurable WPM, tone frequency, and
signal threshold. The Plugins tab now has three sub-tabs: Overview,
APRS, and CW.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 15:24:52 +01:00
sjg 5205c067fc [fix](trx-frontend-http): improve APRS demodulator with pre-filter and moving-average LPF
Replace bandpass filter envelope detector with delay-and-multiply
frequency discriminator. Add biquad bandpass pre-filter centered at
1700 Hz to remove out-of-band noise. Replace IIR low-pass with
moving-average LPF over half a bit period, which places a null at
2x mark frequency for clean discriminator artifact removal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 15:05:17 +01:00
sjg 1a88a5e5de [feat](trx-server): serve GetSnapshot from watch channel in listener
Add fast path in the TCP listener to serve GetSnapshot requests
directly from the state watch channel, so clients get a response
even while the rig task is initializing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 15:00:28 +01:00
sjg 964a131408 [fix](trx-frontend-http): rewrite APRS demodulator with bandpass filter approach
Replace the coherent correlation detector with a non-coherent
bandpass filter + envelope detection approach for significantly
better frequency discrimination between mark (1200Hz) and space
(2200Hz) tones. Uses two cascaded 2nd-order IIR biquad filters
per tone with IIR-smoothed envelope detection.

Replace hard clock reset with PLL-style gradual correction for
smoother bit timing recovery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 15:00:24 +01:00
sjg 4c5e04bfc3 [fix](trx-frontend-http): add energy gate and show CRC-failing APRS frames
Add silence detection that resets the demodulator state when RMS
drops below threshold, so burst-mode APRS packets after squelch
activation start with a clean correlator and clock recovery.

Display CRC-failing frames at reduced opacity with a [CRC] tag to
aid debugging. Enhanced CRC-fail console logging now includes
attempted address decode, bit count, and hex dump.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 14:55:52 +01:00
sjg b5f40fc58a [feat](trx-frontend-http): color VFOs and rework header title
Assign green to VFO A, yellow to VFO B, and deterministic hues
to additional VFOs. The active VFO color is also applied to the
main frequency display. Rework the header title to show
"trx-rs <version> @ <callsign>'s <rig>" instead of "<rig> status".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 14:44:45 +01:00
sjg b042d679fa [fix](trx-frontend-http): fix APRS HDLC decoder and add debug logging
Fix three bugs in the Bell 202 AFSK demodulator preventing frame
decoding:
- Separate NRZI state from clock recovery (shared lastBit variable
  caused NRZI to always output 1)
- Buffer 1-bits in ones counter instead of pushing to frameBits
  immediately, preventing flag/stuff bits from contaminating frame
  data and corrupting byte alignment
- Detect flags via ones-count on decoded bits instead of shift
  register on raw bits

Also add framed packet log container styling, remove redundant
description text, and add debug counters logging pipeline health
to the browser console.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 14:29:35 +01:00
sjg d44390db00 [feat](trx-frontend-http): add APRS decoder plugin with sub-tab navigation
Replace server-side /frontends endpoint with client-side plugin system.
The Plugins tab now has Overview and APRS sub-tabs. The APRS plugin
decodes packets from RX audio using Bell 202 AFSK demodulation (1200
baud), AX.25 frame decoding with NRZI/HDLC, and CRC-16-CCITT
validation. Decoded packets are displayed in a scrolling log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 14:11:58 +01:00
sjg 7eaa39ea4a [feat](trx-frontend-http): add Plugins tab showing registered frontends
Add GET /frontends API endpoint returning registered frontend names as
JSON. Add Plugins tab to the web UI that fetches and displays the list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:59:51 +01:00
sjg d7d5674683 [style](trx-frontend-http): increase header logo size to 5em
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:54:02 +01:00
sjg 494d8979a8 [feat](trx-frontend-http): fix tab panel nesting, enrich About tab, move logo
Close #tab-main properly so the footer and About tab are not nested
inside it — footer is now visible on all tabs.

Add server address, rig connection method, supported modes, and VFO
count to the About tab.

Move logo from translucent centered overlay to solid image in the
top-right of the header.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:52:14 +01:00
sjg 9a4a238dcf [fix](trx-frontend-http): add spacing between content and footer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:46:50 +01:00
sjg e60f3db4b2 [feat](trx-frontend-http): add tab navigation with Main and About tabs
Add a tab bar to the HTTP frontend card. All existing controls stay in
the Main tab. A new About tab shows server version, callsign, rig info,
client version, and connected client count, updated live via SSE.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:40:05 +01:00
sjg 91e599cae0 [fix](trx-frontend-http): handle plain GET on /audio endpoint
Return 204 for non-WebSocket GET requests to /audio instead of
letting actix-ws reject with 400. This allows the browser's audio
availability probe to work correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:15:19 +01:00
sjg 245e025134 [fix](trx-server): apply --listen flag to audio TCP listener
The audio listener was ignoring the CLI --listen override and always
binding to the config default (127.0.0.1), making it unreachable
from remote clients.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:12:04 +01:00
sjg ee7f0360fb [fix](trx-server): pause audio playback stream when idle
Start the output stream paused and only play when TX packets
arrive. Pause again when the packet queue drains to prevent
continuous ALSA buffer underruns (EPIPE errno -32) on Linux.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 13:07:28 +01:00
sjg 22482a34c3 (fix)[trx-rs]: remove Rust crate dependencies from README.md
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 12:16:10 +01:00
sjg 0a1447bb4d [feat](trx-backend): fluctuate dummy rig signal strength randomly
Use subsecond nanosecond jitter to return a varying signal strength
(2-8) from the dummy backend instead of a static value of 5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 12:14:43 +01:00
sjg c67e8feb9c [feat](trx-frontend-http): replace signal graph with measurement mode
Replace the rolling canvas signal graph with a practical signal
measurement feature. The operator can start/stop measurement to
collect signal samples, then view averaged and peak S-unit results.

Also fix signal display to correctly convert dBm wire format to
S-units using standard S-meter scale (S1=-121dBm, S9=-73dBm,
6dB per S-unit).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 12:14:30 +01:00
sjg 822a19588f [style](trx-frontend-http): update copyright footer with callsign link
Shorten to "Built by SP2SJG" and link callsign to qrzcq.com.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 10:45:09 +01:00
sjg a0ca4ceeda [feat](trx-frontend-http): callsign link, centered freq, title, jog lock
- Make server callsign a clickable link to qrzcq.com
- Center frequency input text and use DSEG14 Classic font
- Include callsign in page title (e.g. N0CALL - trx-frontend-http v0.1.0)
- Block jog wheel when rig lock is active

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 10:43:34 +01:00
sjg a8e09f2f0b [feat](trx-frontend-http): use DSEG14 Classic font for frequency display
Load DSEG14 Classic 14-segment LCD font from CDN and apply it to
the frequency input at 2x size for a realistic radio display look.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 10:37:59 +01:00
sjg be497b78cb [feat](trx-frontend-http): volume controls, server callsign, UI improvements
- Add RX/TX volume sliders with GainNode audio chain integration,
  scroll wheel support, and percentage display
- Display server callsign and version from SSE event data
- Merge TX Limit hint into its label line
- Add copyright footer with link to haxx.space
- Uniform section spacing via flex gap on #content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 10:32:23 +01:00
sjg a3b1702710 [feat](trx-client): preserve server callsign/version and default to N0CALL
Carry server_callsign and server_version through from received
snapshots into the local RigState. Default client callsign is
N0CALL when not configured.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 10:32:12 +01:00
sjg 454ff94e47 [feat](trx-server): populate server callsign/version and default to N0CALL
Set server_callsign and server_version on the rig state so they
are included in snapshots sent to clients. Default callsign is
N0CALL when not configured.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 10:32:02 +01:00
sjg e5428209d8 [feat](trx-core): add server_callsign and server_version to RigState/RigSnapshot
Add optional server_callsign and server_version fields to both
RigState and RigSnapshot so that server identity information can
flow through the protocol to clients and frontends.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 10:31:55 +01:00
sjg 37c36d196e [fix](trx-frontend-http): uniform buttons, jog wheel, VFO picker, signal graph, and client count
Reorganize layout: frequency row with jog wheel on top, mode and
transmit/power side by side below. Replace VFO text box with segmented
picker. Add rolling signal history canvas. Track connected SSE clients
and display count in status hint. Unify button heights and add Enter
key support for TX limit input.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 09:53:33 +01:00
sjg b142d68ca2 [fix](trx-server): fix busy-loop in rig polling caused by interval recreation
time::interval() fires its first tick immediately. Recreating it on
every loop iteration made the select! always resolve instantly,
turning the main polling loop into a busy-loop (~13% CPU idle).

Replace with a Box::pin(sleep()) that is only reset after it
completes or when the poll duration changes (rx/tx transition).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:14:31 +01:00
sjg 75de1e50b9 [fix](trx-server): pause audio capture when no clients are connected
Instead of running the cpal input stream continuously, start it
paused and only activate when broadcast subscribers are present.
When the last client disconnects, pause the stream and sleep at
100ms intervals polling for new receivers.

This eliminates idle CPU usage from continuous CoreAudio callbacks,
channel allocations, and sample processing when nobody is listening.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:14:16 +01:00
sjg 90b981ef49 [fix](trx-client): enable audio by default
Enable audio streaming by default in AudioClientConfig so the
client connects to the server audio port without requiring
explicit configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:05:34 +01:00
sjg 3b606688bc [fix](trx-server): enable audio by default and fix playback thread panic
Enable audio streaming by default in AudioConfig.

Fix panic in audio playback thread caused by calling
tokio::runtime::Handle::current() from a plain std::thread.
Use rx.blocking_recv() instead, which is the correct API for
consuming a tokio mpsc receiver from a synchronous context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:05:25 +01:00
sjg 96edf7fc09 [fix](trx-frontend-http): misc JS cleanup and UX polish
Move window._opusDecoder, window._txEncoder, window._nextPlayTime
into closure-scoped variables to avoid polluting the global namespace.

Add showHint() helper to debounce status hint text, preventing
multiple button handlers from fighting over powerHint.textContent.

Throttle audio level indicator updates to max 10/sec instead of
updating on every Opus packet (~50/sec).

Hide audio controls row if the server has no audio configured
(checks /audio endpoint on load).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:00:10 +01:00
sjg 57d5b0633c [fix](trx-frontend-http): add PTT safety timeout and audio compatibility fallback
Add a 120-second TX safety timeout that auto-releases PTT if no mic
data flows (browser crash, disconnect). Timer resets on each audio
callback. Shows countdown in status when < 10s remaining.

Add beforeunload handler that releases PTT via navigator.sendBeacon
when the browser tab is closed during TX.

Detect WebCodecs support on page load and show "Audio requires
Chrome/Edge" on non-Chromium browsers instead of silently failing.

Remove dead playBuffer/playNode variables that were declared but
never used. Fix TX AudioData to always use mono (channel 0) with
numberOfChannels: 1 matching the f32-planar format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:52:51 +01:00
sjg 83342628fa [fix](trx-frontend-http): add CSS variables, focus states, and mobile breakpoints
Replace all hardcoded colors with CSS custom properties on :root for
easier theming. Add focus-visible outlines for keyboard accessibility.
Add mobile breakpoints for screens <= 480px.

Fix PTT button styling to use theme-aware colors (var(--accent-red))
instead of hardcoded light-theme colors (#ffefef, #f3f3f3).

Remove unused .value, .controls, and .section-title CSS classes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:51:18 +01:00
sjg 20fbd3c2cd [fix](trx-frontend-http): compress images and fix SSE heartbeat timing
Resize favicon from 1024x1024 to 64x64 and logo from 1024x1024 to
256x256, reducing total image size from ~3 MB to ~70 KB.

Fix SSE heartbeat race condition where the 10s ping interval competed
with the 8s stale threshold, causing spurious reconnects. Now pings
every 5s server-side, with a 15s stale threshold and 5s check interval
client-side.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:50:25 +01:00
sjg 2bda78d724 [refactor](trx-frontend-http): extract HTML/CSS/JS into separate asset files
Split the monolithic status.rs string template into three files under
assets/web/ (index.html, style.css, app.js) loaded via include_str!.
Add /style.css and /app.js endpoints with correct content types.

This makes the frontend editable with proper syntax highlighting and
linting support in editors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:49:06 +01:00
sjg e9830adaea [docs](trx-rs): document audio streaming and new dependencies
Add Audio streaming section and Dependencies table covering system
libraries (libopus, cmake, pkgconf) and new Rust crates (cpal, opus,
bytes, actix-ws).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:23:14 +01:00
sjg 079310fcc4 [feat](trx-frontend-http): add audio WebSocket endpoint with auto-PTT
Add /audio WebSocket endpoint that streams RX Opus frames to the
browser and accepts TX frames back. Browser UI includes RX/TX Audio
toggle buttons with WebCodecs Opus decode/encode and a level indicator.
TX audio automatically engages PTT on start and releases on stop or
WebSocket disconnect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:23:07 +01:00
sjg a8aeeaca4e [feat](trx-client): add audio TCP proxy with auto-reconnect
Connect to the server audio TCP port, relay RX Opus frames into a
broadcast channel and TX frames from an mpsc channel. Pass audio
channels to the HTTP frontend via set_audio_channels. Reconnects
with exponential backoff on disconnect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:22:56 +01:00
sjg eba13ac2c2 [feat](trx-server): add audio capture and TCP streaming
Add AudioConfig to server configuration with support for RX capture
and TX playback via cpal and Opus encoding. Run a dedicated TCP
listener (default port 4533) that sends StreamInfo on connect, streams
RX Opus frames to clients, and receives TX frames back.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:21:59 +01:00
sjg 771cbd1987 [feat](trx-core): add audio protocol types and framing helpers
Add audio streaming wire protocol: message type constants (StreamInfo,
RxFrame, TxFrame), AudioStreamInfo struct, and async read/write helpers
for length-prefixed frames over AsyncRead/AsyncWrite.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:21:42 +01:00
sjg a664a5f1a1 [fix](trx-client): give AppKit the process main thread
Replace #[tokio::main] with a manual fn main() that builds the tokio
runtime explicitly. All async initialization moves into async_init().

When the appkit frontend is requested, the runtime context is entered
on the main thread and run_appkit_main_thread() is called directly,
giving AppKit thread 0 as required by MainThreadMarker. Ctrl+C is
handled via a spawned task that calls process::exit.

When appkit is not requested, behaviour is unchanged: block on Ctrl+C.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 13:36:54 +01:00
sjg e7ddaa7300 [fix](trx-frontend-appkit): run AppKit event loop on calling thread
Extract the AppKit event loop from FrontendSpawner::spawn_frontend into
a new public run_appkit_main_thread() function that blocks on the
calling thread. This allows the process main thread (thread 0) to drive
the UI, which is required for MainThreadMarker::new() to succeed.

The FrontendSpawner impl now only spawns the async state watcher task.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 13:36:32 +01:00