Skip to content

Conversation

@ardeshir
Copy link
Member

@ardeshir ardeshir commented Jan 1, 2026

Summary

Wires all 4 ENR Bridge panels to the WebSocket backend for full real-time integration:

  • GradientPanel: Report resource gradients (CPU, memory, bandwidth, storage) with slider modal
  • ElectionPanel: Start elections, register candidacy, vote for candidates
  • SeptalPanel: View circuit breaker states with auto-refresh and health indicators
  • EnrCreditPanel: Send ENR credits with transfer form modal

Changes

Backend (Rust)

  • Added 5 ClientMessage variants in messages.rs:
    • ReportGradient { cpu_available, memory_available, bandwidth_available, storage_available }
    • StartElection { region_id }
    • RegisterCandidacy { election_id, uptime, cpu_available, memory_available, reputation }
    • VoteElection { election_id, candidate }
    • SendEnrCredit { to, amount }
  • Added WebSocket handlers in websocket.rs for all ENR message types

Frontend (TypeScript)

  • Added 5 send functions to useP2P.ts: reportGradient, startElection, registerCandidacy, voteElection, sendEnrCredit
  • Enhanced all 4 ENR panels with interactive controls and modals
  • Wired all callbacks in App.tsx

Test plan

  • TypeScript type-check passes (npx tsc --noEmit)
  • Rust workspace check passes (cargo check --workspace)
  • GradientPanel shows slider modal when "Report Gradient" clicked
  • ElectionPanel allows starting elections and voting
  • EnrCreditPanel shows transfer modal for sending credits
  • SeptalPanel displays health states with auto-refresh

🤖 Generated with Claude Code

ardeshir and others added 4 commits January 1, 2026 12:32
Phase 4 ENR UI Integration - connects all ENR panels to real backend:

Backend (Rust):
- Add 5 ENR ClientMessage variants: ReportGradient, StartElection,
  RegisterCandidacy, VoteElection, SendEnrCredit
- Add WebSocket handlers for all ENR message types with timestamp
  and gossipsub broadcast

Frontend (TypeScript):
- Add 5 ENR send functions to useP2P hook
- Wire GradientPanel with slider modal for reporting resource gradients
- Wire ElectionPanel with start, register, and vote functionality
- Wire EnrCreditPanel with transfer form modal
- Enhance SeptalPanel with auto-refresh and visual improvements
- Connect all callbacks in App.tsx

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use derived Default for NodeConfig and IdentityConfig
- Replace or_insert_with(Vec::new) with or_default()
- Fix collapsible_match patterns in service.rs and main.rs
- Remove useless .into() conversions in websocket.rs
- Add allow attributes for intentional patterns (await_holding_lock, too_many_arguments)
- Replace >= 1 with !is_empty() in nexus.rs
- Use struct initialization instead of field reassignment in main.rs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ardeshir ardeshir merged commit deb5966 into main Jan 1, 2026
4 checks passed
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