branchforge / app /models.py
SSHdotCodes
Make live Nemotron tournament fast and transparent
7852159
Raw History Blame Contribute Delete
1.85 kB
from __future__ import annotations
from enum import Enum
from typing import Literal
from pydantic import BaseModel, Field
class RunStatus(str, Enum):
queued = "queued"
planning = "planning"
branching = "branching"
testing = "testing"
judging = "judging"
complete = "complete"
failed = "failed"
class RunRequest(BaseModel):
repository: str = Field(default="branchforge-labs/ledger-lite", max_length=200)
issue: str = Field(min_length=12, max_length=4000)
source: str | None = Field(default=None, max_length=30_000)
tests: str | None = Field(default=None, max_length=30_000)
mode: Literal["sample", "custom"] = "sample"
class Candidate(BaseModel):
id: str
name: str
thesis: str
risk: str
source: str
accent: str = "cyan"
class TestResult(BaseModel):
passed: int
total: int
exit_code: int
duration_ms: int
stdout: str
stderr: str = ""
checkpoint: str
runtime: Literal["nebius-sandbox", "local-fallback"]
class BranchResult(BaseModel):
candidate: Candidate
tests: TestResult
score: int = 0
verdict: Literal["winner", "viable", "rejected"] = "rejected"
evidence: list[str] = Field(default_factory=list)
diff: str = ""
class RunEvent(BaseModel):
at_ms: int
stage: RunStatus
message: str
class RunRecord(BaseModel):
id: str
status: RunStatus
request: RunRequest
progress: int = 0
events: list[RunEvent] = Field(default_factory=list)
branches: list[BranchResult] = Field(default_factory=list)
winner_id: str | None = None
synthesis: str | None = None
model: str = "nvidia/Nemotron-3_5-Lightning"
provider: str = "Nebius Token Factory"
planner_mode: str = "pending"
judge_mode: str = "pending"
sandbox_mode: str = "pending"
error: str | None = None