feat(contracts): add TokenBreakdownSchema and ContestantShape.token_breakdown
This commit is contained in:
@@ -1,10 +1,23 @@
|
|||||||
/** Arena types — single source of truth for cross-app Arena wire contracts. */
|
/** Arena types — single source of truth for cross-app Arena wire contracts. */
|
||||||
|
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
export type BattleType = 'coding' | 'qa';
|
export type BattleType = 'coding' | 'qa';
|
||||||
export type BattleStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
export type BattleStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
||||||
export type ContestantStatus = 'queued' | 'running' | 'done' | 'error';
|
export type ContestantStatus = 'queued' | 'running' | 'done' | 'error';
|
||||||
export type ContestantLane = 'local' | 'cloud';
|
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.
|
// Pane state — carried on the WorkspacePane row, mirrors OrchestratorState.
|
||||||
export interface ArenaState {
|
export interface ArenaState {
|
||||||
battle_id: string;
|
battle_id: string;
|
||||||
@@ -38,6 +51,7 @@ export interface ContestantShape {
|
|||||||
duration_ms: number | null;
|
duration_ms: number | null;
|
||||||
tokens_per_sec: number | null;
|
tokens_per_sec: number | null;
|
||||||
cost_tokens: number | null;
|
cost_tokens: number | null;
|
||||||
|
token_breakdown: TokenBreakdown | null;
|
||||||
result_path: string | null;
|
result_path: string | null;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user