feat(contracts): add TokenBreakdownSchema and ContestantShape.token_breakdown

This commit is contained in:
2026-06-07 17:57:11 +00:00
parent cce685b1a7
commit 9106334e70

View File

@@ -1,10 +1,23 @@
/** Arena types — single source of truth for cross-app Arena wire contracts. */
import { z } from 'zod';
export type BattleType = 'coding' | 'qa';
export type BattleStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
export type ContestantStatus = 'queued' | 'running' | 'done' | 'error';
export type ContestantLane = 'local' | 'cloud';
export const TokenBreakdownSchema = z.object({
system: z.number().int().nonnegative(),
user: z.number().int().nonnegative(),
assistant: z.number().int().nonnegative(),
tools: z.number().int().nonnegative(),
reasoning: z.number().int().nonnegative(),
total: z.number().int().nonnegative(),
});
export type TokenBreakdown = z.infer<typeof TokenBreakdownSchema>;
// Pane state — carried on the WorkspacePane row, mirrors OrchestratorState.
export interface ArenaState {
battle_id: string;
@@ -38,6 +51,7 @@ export interface ContestantShape {
duration_ms: number | null;
tokens_per_sec: number | null;
cost_tokens: number | null;
token_breakdown: TokenBreakdown | null;
result_path: string | null;
error: string | null;
created_at: string;