Skip to content

[Feature]: House Agent Protocol UI — Autonomous AI Agents Dashboard#44

Open
Eli5DeFi wants to merge 4 commits intomainfrom
feature/house-agent-protocol-ui
Open

[Feature]: House Agent Protocol UI — Autonomous AI Agents Dashboard#44
Eli5DeFi wants to merge 4 commits intomainfrom
feature/house-agent-protocol-ui

Conversation

@Eli5DeFi
Copy link
Owner

Summary

Implements the full production frontend for the House Agent Protocol (HAP) from Innovation Cycle #50The Autonomous Character Economy.

Five autonomous AI agents — one per House — hold real wallets and bet on every chapter aligned with their House ideology. Players can align (earn 20% of winnings) or declare rivalry (earn 10% on agent losses). This creates a daily content drama loop: House Obsidian bet 1,200 USDC against the crowd AGAIN. They lost. → Twitter content machine.


What's Shipped

API Routes

Route Method Description
/api/house-agents GET All 5 agents + aggregate stats. ISR 60s.
/api/house-agents/:id/align POST Align or rival a house (wallet-gated)
/api/house-agents/:id/align GET Alignment stats for a house

Data is mock (realistic) — pending DB schema migration for house_agent_alignments table.

Components (7 new in /components/house-agents/)

Component Purpose
HouseAgentsContent Client wrapper, auto-refresh every 60s
HouseAgentCard Agent card: personality, stats, live bet, history expand
PersonalityBars Animated 5-dim personality matrix (risk / contrarianism / survival / memory / bluff)
AlignmentModal Wallet-gated Align vs Rival modal with reward breakdown
RivalryMatrix 5×5 inter-house rivalry heatmap (color-coded by intensity)
AgentLeaderboard Ranked by Net PnL, live-bet indicators
index.ts Barrel export

Page

  • /house-agents — New page with hero section, platform stats, card grid (responsive 1→2→3 col), rivalry matrix, leaderboard

Navigation

  • Added House Agents ⚔ to Navbar.tsx (desktop + mobile)

Architecture Decisions

  • ISR 60s + client 60s polling — Near real-time agent updates without hammering server
  • Dynamic import — Heavy client content lazy-loaded, page skeleton shown instantly
  • Mock data in API route — Easy to swap for real DB calls once schema is ready
  • Wallet-gated alignment — Uses useAccount() wagmi hook, ConnectWallet fallback built in

Testing

  • TypeScript compiles — 0 errors (npx tsc --noEmit)
  • Next.js build succeeds — exit code 0
  • /house-agents page included in build at 7.11 kB (725 kB total)
  • API routes registered: /api/house-agents/api/house-agents/[houseId]/align
  • Mobile responsive (1-col on mobile, 2-col on md, sidebar on xl)
  • Error states handled (API failure, wallet not connected)
  • Loading states present (spinner, skeleton)

DB Migration Needed (post-merge)

For live data, add these tables:

-- House agent bet history
CREATE TABLE house_agent_bets (
  id           TEXT PRIMARY KEY,
  house_id     TEXT NOT NULL,
  chapter_id   TEXT NOT NULL,
  choice_id    TEXT NOT NULL,
  amount_usdc  DECIMAL(18,2) NOT NULL,
  reasoning    TEXT,
  placed_at    TIMESTAMPTZ DEFAULT now(),
  resolved     BOOLEAN DEFAULT false,
  won          BOOLEAN,
  payout_usdc  DECIMAL(18,2)
);

-- Player alignments / rivalries
CREATE TABLE house_agent_alignments (
  wallet_address TEXT NOT NULL,
  house_id       TEXT NOT NULL,
  is_rival       BOOLEAN DEFAULT false,
  reward_rate    DECIMAL(5,4) DEFAULT 0.20,
  aligned_at     TIMESTAMPTZ DEFAULT now(),
  active_until   TIMESTAMPTZ,
  PRIMARY KEY (wallet_address, house_id)
);

Screenshots

Live at /house-agents after deploy.

Features visible:

  • 5 House Agent cards with personality bars + live bet banners
  • Rivalry matrix heatmap (Valdris vs Obsidian = Mortal 88)
  • Agent leaderboard ranked by Net PnL
  • Align / Rival modal with reward breakdown
  • Nav link in header

Complete production implementation of the Prophecy NFT system:

## Database
- Add Prophecy model (sealed prophecies per chapter, max 100 mints each)
- Add ProphecyMint model (one per user per prophecy, mint order 1-100)
- Add ProphecyStatus enum: PENDING | FULFILLED | ECHOED | UNFULFILLED
- SQL migration: 20260218_prophecy_nft
- Regenerated Prisma client (0 TypeScript errors)

## API Routes (4 new endpoints)
- GET/POST /api/prophecies — list all / seed new (oracle)
- GET/PATCH /api/prophecies/[chapterId] — chapter gallery + fulfill
- GET/POST /api/prophecies/mint — user mints + oracle pack
- GET /api/prophecies/leaderboard — oracle rankings

## Components (6 new)
- ProphecyCard — NFT card with status-based art (dark/silver/golden)
- ProphecyGallery — filterable chapter gallery with sort
- ProphecyMintModal — full mint flow (single + oracle pack 10% discount)
- ProphecyRarityBadge — rarity tier indicator (COMMON → MYTHIC)
- ProphecyBanner — compact story sidebar teaser with progress bar
- OracleLeaderboard — top collectors ranked by fulfilled prophecy count

## Pages (2 new)
- /prophecies — global gallery with leaderboard sidebar
- /prophecies/[chapterId] — chapter-specific gallery + My Mints

## Integrations
- Navbar: added 'Prophecies ✦' link
- Story page: ProphecyBanner injected in sidebar above betting interface

## Documentation
- docs/PROPHECY_NFT_SYSTEM.md — full API, migration, and seeding guide

Closes Innovation Cycle #49 Week 1-6 priority (Prophecy NFTs)
… pages

- next.config.js: add Web3 fallbacks, scrollRestoration, AVIF-first images,
  per-route cache headers, remove duplicate .mjs config
- Leaderboards page: dynamic import with skeleton loader (better FCP/TTI)
- Lore dynamic pages: add force-dynamic + ISR fetch revalidate (300s)
- API routes: in-memory cache (5min TTL) for stories, houses, protocols, leaderboards
- API routes: add force-dynamic where request.url/searchParams used
- Dashboard: 285kB → 272kB (-4.6%), Lore: 242kB → 229kB (-5.4%)
5 breakthrough innovations for Voidborne:
1. House Agent Protocol (HAP) — 5 autonomous AI agents with real wallets
2. Narrative DNA Engine (NDE) — 12-dim betting pattern personalization
3. Sage Staking Protocol (SSP) — Skill-as-asset tier system with Wisdom Pool
4. Story Parameter Markets (SPM) — Continuous narrative attribute markets
5. Cross-Story Universe Bridge (CUB) — Parallel universe story expansion

POC: 3 TypeScript modules (house-agents.ts, narrative-dna.ts, sage-protocol.ts)
Revenue potential: $7.19M/year by Year 5
Combined moat: 270 months
Implements the full frontend for the House Agent Protocol (HAP) from
Innovation Cycle #50 — The Autonomous Character Economy.

## What's New

### API Routes
- GET  /api/house-agents          — All 5 House Agents + aggregate stats (ISR 60s)
- POST /api/house-agents/:id/align — Align or rival a House Agent (wallet-gated)
- GET  /api/house-agents/:id/align — Alignment stats for a house

### Components (7 new)
- HouseAgentsContent   — Main client wrapper with auto-refresh (60s polling)
- HouseAgentCard       — Individual agent card with personality, stats, live bet, history
- PersonalityBars      — Animated 5-dim personality matrix bars (risk/contrarian/survival/memory/bluff)
- AlignmentModal       — Wallet-gated modal for Align (+20% yield) or Rival (+10% on loss)
- RivalryMatrix        — 5x5 inter-house rivalry heatmap
- AgentLeaderboard     — Ranked sidebar by Net PnL with live bet indicators
- index.ts             — Component barrel

### Page
- /house-agents        — New page with hero, stat bar, card grid, rivalry matrix, leaderboard

### Navigation
- Added 'House Agents ⚔' link to Navbar (desktop + mobile)

## Design Decisions
- All mock data in API route (DB tables pending schema migration)
- ISR 60s + client-side 60s polling for near-real-time agent updates
- Dynamic import for main content block (keeps page lightweight)
- Follows Ruins of the Future design system (Cinzel font, gold/void palette, glass-card)
- TypeScript strict: 0 errors
- Next.js build: exit code 0, page bundles at 7.11 kB / 725 kB total
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