repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources15d ago| #1 | /** |
| #2 | * HERMES x402 TUI — Shared Dashboard State |
| #3 | * |
| #4 | * Holds all live data that panels read on each render cycle. |
| #5 | */ |
| #6 | |
| #7 | export type OODAPhase = 'observe' | 'orient' | 'decide' | 'act' | 'learn' | 'idle'; |
| #8 | export type MemoryTier = 'KNOWN' | 'LEARNED' | 'INFERRED'; |
| #9 | export type Protocol = 'x402' | 'mpp' | 'ap2' | 'a2a'; |
| #10 | |
| #11 | export interface TrendingToken { |
| #12 | symbol: string; |
| #13 | change: number; |
| #14 | volume24h?: number; |
| #15 | } |
| #16 | |
| #17 | export interface TradeSignal { |
| #18 | symbol: string; |
| #19 | score: number; |
| #20 | size: string; |
| #21 | side: 'buy' | 'sell' | 'pass'; |
| #22 | timestamp: number; |
| #23 | } |
| #24 | |
| #25 | export interface A2AConnection { |
| #26 | agentId: string; |
| #27 | endpoint: string; |
| #28 | status: 'connected' | 'handshaking' | 'disconnected'; |
| #29 | latencyMs: number; |
| #30 | protocol: Protocol; |
| #31 | } |
| #32 | |
| #33 | export interface PaymentRecord { |
| #34 | amount: number; |
| #35 | asset: 'USDC' | 'CLAWD'; |
| #36 | resource: string; |
| #37 | signature: string; |
| #38 | protocol: Protocol; |
| #39 | timestamp: number; |
| #40 | confidential: boolean; |
| #41 | } |
| #42 | |
| #43 | export interface MemoryStats { |
| #44 | known: number; |
| #45 | learned: number; |
| #46 | inferred: number; |
| #47 | } |
| #48 | |
| #49 | export interface LogEntry { |
| #50 | ts: number; |
| #51 | phase: string; |
| #52 | msg: string; |
| #53 | level: 'info' | 'warn' | 'error' | 'pay' | 'a2a' | 'trade'; |
| #54 | } |
| #55 | |
| #56 | // ─── New interfaces for perps + wallet + SDK ───────────────────────────────── |
| #57 | |
| #58 | export interface PerpMarket { |
| #59 | symbol: string; |
| #60 | markPrice: number; |
| #61 | fundingRate: number; |
| #62 | openInterest: number; |
| #63 | } |
| #64 | |
| #65 | export interface PerpPosition { |
| #66 | market: string; |
| #67 | side: 'long' | 'short'; |
| #68 | size: number; |
| #69 | entryPrice: number; |
| #70 | pnl: number; |
| #71 | liquidationPrice: number; |
| #72 | } |
| #73 | |
| #74 | export interface SdkPackageState { |
| #75 | name: string; |
| #76 | version: string; |
| #77 | status: 'ok' | 'missing' | 'no-dist'; |
| #78 | hasDist: boolean; |
| #79 | } |
| #80 | |
| #81 | export interface WalletVaultState { |
| #82 | available: boolean; |
| #83 | path: string; |
| #84 | walletCount: number; |
| #85 | activeAddress: string | null; |
| #86 | error: string | null; |
| #87 | } |
| #88 | |
| #89 | // ─── Core dashboard state ───────────────────────────────────────────────────── |
| #90 | |
| #91 | export interface DashboardState { |
| #92 | // Market |
| #93 | solPrice: number; |
| #94 | solChange24h: number; |
| #95 | trending: TrendingToken[]; |
| #96 | // P&L |
| #97 | paperPnl: number; |
| #98 | winRate: number; |
| #99 | totalTrades: number; |
| #100 | lastSignal: TradeSignal | null; |
| #101 | // OODA |
| #102 | oodaPhase: OODAPhase; |
| #103 | pulseIntervalSec: number; |
| #104 | cycleCount: number; |
| #105 | // Payments |
| #106 | usdcBalance: number; |
| #107 | clawdBalance: number; |
| #108 | lastPayment: PaymentRecord | null; |
| #109 | totalSpent: number; |
| #110 | // A2A / Protocol |
| #111 | a2aConnections: A2AConnection[]; |
| #112 | confidentialMode: boolean; |
| #113 | darkDefiArmed: boolean; |
| #114 | payshStatus: 'online' | 'degraded' | 'offline'; |
| #115 | // Memory |
| #116 | memory: MemoryStats; |
| #117 | // Model |
| #118 | activeModel: string; |
| #119 | // Log |
| #120 | log: LogEntry[]; |
| #121 | // Runtime |
| #122 | startedAt: number; |
| #123 | lastRefresh: number; |
| #124 | error: string | null; |
| #125 | // Perps |
| #126 | perpMarkets: PerpMarket[]; |
| #127 | perpPositions: PerpPosition[]; |
| #128 | // Wallet |
| #129 | walletPubkey: string; |
| #130 | walletVault: WalletVaultState; |
| #131 | // SDK |
| #132 | sdkVersion: string; |
| #133 | sdkPackages: SdkPackageState[]; |
| #134 | sdkPackageCount: number; |
| #135 | // Automaton |
| #136 | automatonRunning: boolean; |
| #137 | } |
| #138 | |
| #139 | export function createInitialState(): DashboardState { |
| #140 | return { |
| #141 | solPrice: 0, |
| #142 | solChange24h: 0, |
| #143 | trending: [], |
| #144 | paperPnl: 0, |
| #145 | winRate: 0, |
| #146 | totalTrades: 0, |
| #147 | lastSignal: null, |
| #148 | oodaPhase: 'idle', |
| #149 | pulseIntervalSec: 60, |
| #150 | cycleCount: 0, |
| #151 | usdcBalance: 0, |
| #152 | clawdBalance: 0, |
| #153 | lastPayment: null, |
| #154 | totalSpent: 0, |
| #155 | a2aConnections: [], |
| #156 | confidentialMode: true, |
| #157 | darkDefiArmed: false, |
| #158 | payshStatus: 'offline', |
| #159 | memory: { known: 0, learned: 0, inferred: 0 }, |
| #160 | activeModel: 'claude-sonnet-4-6', |
| #161 | log: [], |
| #162 | startedAt: Date.now(), |
| #163 | lastRefresh: 0, |
| #164 | error: null, |
| #165 | perpMarkets: [], |
| #166 | perpPositions: [], |
| #167 | walletPubkey: 'UNSPAWNED', |
| #168 | walletVault: { |
| #169 | available: false, |
| #170 | path: '', |
| #171 | walletCount: 0, |
| #172 | activeAddress: null, |
| #173 | error: null, |
| #174 | }, |
| #175 | sdkVersion: '0.1.0', |
| #176 | sdkPackages: [], |
| #177 | sdkPackageCount: 0, |
| #178 | automatonRunning: false, |
| #179 | }; |
| #180 | } |
| #181 | |
| #182 | export function addLog( |
| #183 | state: DashboardState, |
| #184 | phase: string, |
| #185 | msg: string, |
| #186 | level: LogEntry['level'] = 'info', |
| #187 | ): void { |
| #188 | state.log.unshift({ ts: Date.now(), phase, msg, level }); |
| #189 | if (state.log.length > 50) state.log.length = 50; |
| #190 | } |
| #191 |