Skip to content

feat(cec): claimed-KVM Wi-Fi setup + fix the customer not seeing the technician's chat#42

Merged
mrjeeves merged 2 commits into
mainfrom
claude/kvm-wifi-settings-cecsupport-bpmpi6
Jul 15, 2026
Merged

feat(cec): claimed-KVM Wi-Fi setup + fix the customer not seeing the technician's chat#42
mrjeeves merged 2 commits into
mainfrom
claude/kvm-wifi-settings-cecsupport-bpmpi6

Conversation

@mrjeeves

@mrjeeves mrjeeves commented Jul 15, 2026

Copy link
Copy Markdown
Owner

This PR now carries two CEC customer-app changes.


1. Fix: the customer couldn't see the technician's chat replies

Symptom: the technician sees the customer's messages, but the customer sees none of the technician's.

Root cause (client-side): the customer only ever received a technician's lines via the best-effort live cec://chat event, plus a single loadChatHistory when the panel opens. There was no re-sync after that. So any line whose live event was missed — a dropped emit, a node event-stream reconnect gap, or an event that landed before the panel bound to the peer — was lost to the customer forever, even though the node keeps the full transcript. The customer's own lines always showed because they're appended optimistically, which masked the gap and made it look one-directional.

Not a version/pin issue: allmystuff v0.2.43 (already bundled by CECSupport 0.1.22) contains the full tech↔customer chat relay and the P2P send fix, so no new AllMyStuff cut is needed.

Fix: make the node transcript the source of truth — re-sync the connected technician's history on a slow poll and on window refocus. The re-sync is made safe to run repeatedly:

  • a still-pending optimistic line the fetched transcript already carries (same side + text) is collapsed, so the sender's own bubble isn't doubled;
  • the write is skipped when nothing changed, so the poll doesn't churn the thread array and re-fire the panel's scroll-to-end effect.

Connected-only and idempotent; a no-op in demo. Files: gui/src/store.svelte.ts.


2. Feature: set a claimed KVM's Wi-Fi from the customer app

The KVM & Claiming card's Wi‑Fi button was a disabled "Soon" placeholder. This makes it real: once a customer has claimed a KVM, they can read and set the appliance's own Wi‑Fi from the app.

It reuses the exact mechanism the existing Reboot button relies on — site_map opens a localhost tunnel to the KVM's own web UI, and the KVM server authenticates a tunneled request by mesh roster (WithMeshAuth), so its login is bypassed on the mesh path. No device‑side changes and no new node/Tauri commands.

  • One flow spans both models: connect is identical ({ssid,password}); the status read is normalized across NanoKVM's ssid string and the Pro's wifi{…} object; the Pro-only network scan is a pure enhancement a plain NanoKVM cleanly 404s (manual SSID entry always remains).
  • Checks the web API's code field (responses are HTTP 200 even on failure); a dropped reply after connect is reported as "sent, may take a moment" rather than a false failure (Wi‑Fi can be the KVM's own uplink). Disconnect is gated behind the in‑app confirm.
  • Files: new gui/src/ui/KvmWifiModal.svelte, plus gui/src/ui/KvmClaimCard.svelte, gui/src/store.svelte.ts, gui/src/types.ts.

Verification

pnpm check (svelte‑check — 0 errors, 0 warnings) and pnpm build both pass — the repo's hard front‑end gates, exactly as CI runs them. The Tauri backend and device repos are untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_017uti8uqD9JC5aVfTVSNppw

claude added 2 commits July 15, 2026 19:31
The KVM & Claiming card's Wi-Fi button was a "coming soon" placeholder.
Wire it to a real panel that reads and sets the appliance's own Wi-Fi
over the SAME mesh "sites" tunnel the Reboot uses — site_map to a
localhost port, then the KVM's web API, which the device authenticates
by mesh roster (no KVM login needed, exactly like the reboot POST to a
CheckToken-protected /api/vm/gpio).

- One flow spans both models: the connect request ({ ssid, password })
  is identical on NanoKVM and NanoKVM-Pro; the status read is normalized
  across the plain (`ssid`) and Pro (`wifi { … }`) shapes; the Pro-only
  scan is a pure enhancement a plain NanoKVM simply 404s (manual SSID
  entry always remains).
- Checks the web API's `code` field (responses are HTTP 200 even on
  failure), and treats a dropped reply after connect as "sent, may take
  a moment" rather than a hard error — Wi-Fi can be the KVM's own uplink.
- Disconnect is gated behind the in-app confirm (it can strand a
  Wi-Fi-only KVM).
- Frontend-only: no new node/Tauri commands and no device changes; the
  appliance already owns the Wi-Fi system and bypasses its login on the
  mesh path. Demo-mode canned data keeps the browser preview explorable.

Verified with `pnpm check` (0 errors, 0 warnings) and `pnpm build`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uti8uqD9JC5aVfTVSNppw
…'s replies

The customer only ever saw a technician's chat lines via the best-effort
live `cec://chat` event plus a single history fetch when the panel opens.
A dropped emit, a node event-stream reconnect gap, or an event that lands
before the panel has bound to the peer left that line lost to the customer
forever — it was only appended live, never re-fetched — even though the
node keeps the full transcript. The customer's OWN lines always showed
(they're appended optimistically), which masked the gap and made it look
one-directional.

Make the node transcript the source of truth: re-sync the connected
technician's history on a slow poll and on window refocus. To keep the
re-sync safe to run repeatedly:
- collapse a still-pending optimistic line the fetched transcript already
  carries (same side + text), so the sender's own bubble isn't doubled;
- skip the write when nothing changed, so the poll doesn't churn the
  thread array and re-fire the panel's scroll-to-end effect.

Connected-only and idempotent; a no-op in demo. The node relay itself
(allmystuff v0.2.43, already bundled) carries tech<->customer chat both
ways — this closes the client-side gap where a delivered line was never
re-fetched, so no new AllMyStuff cut is needed.

Verified with `pnpm check` (0 errors, 0 warnings) and `pnpm build`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uti8uqD9JC5aVfTVSNppw
@mrjeeves mrjeeves changed the title feat(cec): set a claimed KVM's Wi-Fi from the customer app feat(cec): claimed-KVM Wi-Fi setup + fix the customer not seeing the technician's chat Jul 15, 2026
@mrjeeves
mrjeeves merged commit 8071650 into main Jul 15, 2026
4 checks passed
@mrjeeves
mrjeeves deleted the claude/kvm-wifi-settings-cecsupport-bpmpi6 branch July 15, 2026 20:21
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.

2 participants