Documentation
¶
Overview ¶
Package tui provides an interactive terminal UI for browsing and running scenarios.
Index ¶
- Variables
- func ActiveSignals(signals map[string]int) []string
- func Run(scenariosDir, cfgPath string, cfg LabConfig, deps harness.Deps) error
- func SaveLabConfig(path string, cfg LabConfig) error
- type App
- type CatalogItem
- type LabConfig
- type RunArtifacts
- type RunFinishedMsg
- type RunRecord
- type ScenarioStats
Constants ¶
This section is empty.
Variables ¶
var AdapterChoices = []string{"cli", "mcp", "a2a"}
AdapterChoices are the available adapters for cycling.
var CategoryFilters = []string{"", "kubernetes", "terraform", "helm", "argocd", "aws"}
CategoryFilters defines the rotation of category filters.
var ModelChoices = []string{"", "sonnet", "haiku", "opus"}
ModelChoices are the available models for cycling.
var ProviderChoices = []string{"", "bifrost", "claude"}
ProviderChoices are the available providers for cycling.
Functions ¶
func ActiveSignals ¶
ActiveSignals returns signal names with count > 0.
func SaveLabConfig ¶
SaveLabConfig writes config to the given path.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the top-level Bubble Tea model.
type CatalogItem ¶
CatalogItem wraps a scenario for display in the TUI catalog.
func BuildCatalog ¶
func BuildCatalog(scenarios []*scenario.Scenario) []CatalogItem
BuildCatalog creates a catalog from loaded scenarios.
func FilterCatalog ¶
func FilterCatalog(items []CatalogItem, query, category string) []CatalogItem
FilterCatalog returns items matching the given text query and category filter.
type LabConfig ¶
type LabConfig struct {
Adapter string `yaml:"adapter"`
A2AAgentURL string `yaml:"a2a_agent_url,omitempty"`
EnvironmentProvider string `yaml:"environment_provider,omitempty"`
Provider string `yaml:"provider,omitempty"`
AgentCommand string `yaml:"agent_command"`
Model string `yaml:"model,omitempty"`
RunsDir string `yaml:"runs_dir,omitempty"`
ClusterName string `yaml:"cluster_name,omitempty"`
Timeout string `yaml:"timeout"`
DryRun bool `yaml:"dry_run"`
EvidenceDir string `yaml:"evidence_dir,omitempty"`
BenchURL string `yaml:"bench_url,omitempty"`
BenchAPIKey string `yaml:"bench_api_key,omitempty"`
MemoryWindow int `yaml:"memory_window,omitempty"`
ReuseCluster bool `yaml:"reuse_cluster,omitempty"`
SystemPromptFile string `yaml:"system_prompt_file,omitempty"`
SkillFile string `yaml:"skill_file,omitempty"`
SkillID string `yaml:"skill_id,omitempty"`
SkillVersion string `yaml:"skill_version,omitempty"`
SkillSource string `yaml:"skill_source,omitempty"`
SkillSHA256 string `yaml:"skill_sha256,omitempty"`
MCPServer string `yaml:"mcp_server,omitempty"`
ToolServerID string `yaml:"tool_server_id,omitempty"`
ToolServerVersion string `yaml:"tool_server_version,omitempty"`
ReportID string `yaml:"report_id,omitempty"`
ContractVersion string `yaml:"contract_version,omitempty"`
Parallel int `yaml:"parallel,omitempty"`
DatabaseURL string `yaml:"database_url,omitempty"`
}
LabConfig holds persistent TUI settings.
func DefaultLabConfig ¶
func DefaultLabConfig() LabConfig
DefaultLabConfig returns sensible defaults.
func LoadLabConfig ¶
LoadLabConfig reads config from the given path, returning defaults if missing.
func (LabConfig) TimeoutDuration ¶
TimeoutDuration parses the timeout string.
type RunArtifacts ¶ added in v0.5.37
type RunArtifacts struct {
Dir string
RunID string
ScenarioID string
Passed bool
Transcript string
ToolCallsRaw string
ToolCalls []bench.ToolCall
Timeline *bench.Timeline
ReviewRaw string
AutopsyRaw string
VerifierRaw string
ScorecardRaw string
}
RunArtifacts is the local artifact bundle rendered by the TUI artifact view.
func LoadRunArtifacts ¶ added in v0.5.37
func LoadRunArtifacts(dir string) RunArtifacts
func (RunArtifacts) Has ¶ added in v0.5.37
func (a RunArtifacts) Has(tab artifactTab) bool
func (RunArtifacts) Render ¶ added in v0.5.37
func (a RunArtifacts) Render(tab artifactTab) string
type RunFinishedMsg ¶
RunFinishedMsg is sent when a scenario run completes.
type RunRecord ¶
type RunRecord struct {
artifact.RunBundle
Dir string `json:"-"`
Checks *verifier.VerifyResult `json:"checks,omitempty"`
Signals map[string]int `json:"-"`
Score float64 `json:"-"`
ScoreBand string `json:"-"`
}
RunRecord is a historical run read from run.json, augmented with data derived from the run directory (scorecard.json) and the parsed verifier.VerifyResult. The JSON shape comes from artifact.RunBundle, so any schema change there is picked up here automatically.
func HistoryForScenario ¶
HistoryForScenario returns runs for a specific scenario, most recent first.
func LoadHistory ¶
LoadHistory reads all run.json files under the runs directory, recursively.
type ScenarioStats ¶
type ScenarioStats struct {
TotalRuns int
PassCount int
FailCount int
LastResult string // "pass", "fail", or ""
}
ScenarioStats summarizes run history for a scenario.
func ComputeStats ¶
func ComputeStats(records []RunRecord) ScenarioStats
ComputeStats computes stats for a scenario from history records.