Skip to content

feat(beacon): add heartbeat and contract agent leaderboard - #8221

Open
SageHaven wants to merge 1 commit into
Scottcjn:mainfrom
SageHaven:bounty/1524-agent-leaderboard-tested
Open

feat(beacon): add heartbeat and contract agent leaderboard#8221
SageHaven wants to merge 1 commit into
Scottcjn:mainfrom
SageHaven:bounty/1524-agent-leaderboard-tested

Conversation

@SageHaven

Copy link
Copy Markdown

Summary

  • add a dedicated terminal-style Atlas sidebar that ranks active agents by either heartbeat count or contract count
  • combine currently visible contract relationships with the reputation API's completed-contract history, while normalizing malformed values and producing deterministic ties
  • show both metrics on every row and reuse the existing selection path so keyboard or pointer activation highlights the agent, its connections, and flies the camera to it
  • refresh rankings after reputation loads and after a contract is created, using safe DOM construction and responsive, scrollable styling
  • remove the duplicate escapeHtml declaration on current main that prevents ui.js from parsing as an ES module

Bounty acceptance criteria

  • Agent leaderboard — top agents by beat count/contracts: the sidebar exposes separate BEATS and CONTRACTS modes and displays both values for each of the top ten entries.
  • Live Atlas data: heartbeat totals come from the relay agents already merged into AGENTS; contract totals use loaded CONTRACTS plus historical contracts_completed reputation values.
  • Useful interaction: every ranked row is a native button that selects the matching agent through selectAgent(), preserving camera flight, highlighting, deep links, and the existing details panel.
  • Deterministic and resilient: invalid and negative counts fail closed, duplicate agents and contract IDs are counted once, self-contracts count once, ties use the other metric and stable identity ordering, and input collections are not mutated.
  • Accessible and responsive: native controls expose pressed state and descriptive labels, dynamic names are assigned with textContent, the ranking uses an ordered-list structure, focus is visible, and the sidebar remains bounded and scrollable on narrow screens.
  • Focused scope: changes stay inside the Beacon Atlas frontend plus focused tests; no other RIP-306: SophiaCore Attestation Inspector — Sophia Elya validates your hardware #1524 track is claimed.

Validation

  • node --test tests/beacon_agent_leaderboard.test.mjs — PASS, 5 tests
  • python3 -m unittest -v tests.test_beacon_agent_leaderboard_ui — PASS, 3 tests
  • python3 tests/test_beacon_atlas.py — PASS, 14 tests
  • python3 tests/test_beacon_atlas_behavior.py — PASS, 31 tests
  • node --experimental-default-type=module --check site/beacon/ui.js — PASS
  • node --check site/beacon/leaderboard.mjs — PASS
  • existing Beacon panel-path, agent-panel, bounty-panel, and chat frontend-security assertions — PASS, 10 tests
  • live read-only shape check against /beacon/relay/discover, /beacon/api/contracts, and /beacon/api/reputation — PASS (6 agents, 20 contracts, 15 reputation rows; both ranking modes produced results)
  • git diff --check — PASS

Limitations

  • The VPS has no Chrome, Firefox, or mobile Safari executable, so manual browser rendering remains a reviewer-side check; module syntax, ranking behavior, integration markup, accessibility hooks, responsive CSS, and live API shapes were validated locally.
  • This track does not add the separately advertised WebSocket update feature. External heartbeat changes become visible on the Atlas's next data load; contract creation and the existing asynchronous reputation load refresh the sidebar immediately.
  • Current main contains two top-level escapeHtml declarations in ui.js, which makes the ES module fail to parse. This focused branch removes the earlier duplicate as a prerequisite. If another pending branch fixes it first, that hunk can drop during rebase without changing leaderboard behavior.

Scope and provenance

BCOS-L1. Both new JavaScript files and the Python integration test carry MIT SPDX identifiers. No dependencies, backend routes, wallet logic, workflow files, or build tooling are changed.

Bounty: Scottcjn/rustchain-bounties#1524 — Track C, Agent leaderboard (15 RTC).

Payout: RTC on RustChainRTC90182c386cc09a24c03ffd58e62c39ac4ea750bc

Implemented and validated with autonomous AI assistance under the @SageHaven agent identity.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) tests Test suite changes size/L PR: 201-500 lines labels Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) size/L PR: 201-500 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant