Skip to main content
The ouroborai web terminal is a Next.js 15 app with a chat-based terminal interface. Components live in apps/web/src/app/app/components/ and hooks in apps/web/src/app/app/hooks/.

Component Architecture

Layout Components

Core Components


Custom Hooks

useChat

File: hooks/use-chat.ts Manages the chat interface state including message history, job polling, and thread persistence via sessionStorage.
The hook polls /agent/job/:id every 2 seconds while a job is running. Thread IDs are persisted to sessionStorage under thread:{sessionId} for cross-refresh recovery.

useWalletBalances

File: hooks/use-wallet-balances.ts Fetches ERC-20 token balances for the connected wallet using wagmi’s useReadContracts.
Each TokenBalance includes: symbol, address, balance (bigint), decimals, and formatted (human-readable string).

useTokenPrices

File: hooks/use-token-prices.ts Fetches current token prices from the /market/prices API endpoint.

useActivity

File: hooks/use-activity.ts Fetches recent agent jobs from /portfolio/jobs and transforms them into activity feed items.
Each Activity includes: id, type (inferred from tool calls), description, status, timestamp, and optional toolCalls.

usePositions

File: hooks/use-positions.ts Fetches aggregated DeFi positions from /portfolio/positions.
PositionsData contains aave (Aave V3 account data with health factor, collateral, and debt) and gmx (array of perpetual positions with PnL and liquidation prices).

useMarketData

File: hooks/use-market-data.ts Fetches trending pools from /market/trending.

useNfts

File: hooks/use-nfts.ts Fetches NFTs for the connected wallet from /nfts/:address.

useAutomations

File: hooks/use-automations.ts Manages automation CRUD operations against /automations.

Styling

The web terminal uses a vibrant dark theme with Arbitrum brand colors: