Documentation
¶
Index ¶
- Variables
- func CORSMiddleware(next http.Handler, allowedOrigins ...string) http.Handler
- func RegisterReleaseRoutes(mux *http.ServeMux, directory string)
- func RegisterRoutes(mux *http.ServeMux, store RunStore)
- func RegisterRoutesWithStorage(mux *http.ServeMux, store RunStore, cfg *StorageConfig)
- type ConfidenceIntervalResponse
- type ErrorResponse
- type EvidenceRunResponse
- type FileStore
- type GraderResult
- type Handlers
- func (h *Handlers) HandleHealth(w http.ResponseWriter, _ *http.Request)
- func (h *Handlers) HandleLabRuns(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) HandleLatestRunEvents(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) HandleRunDetail(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) HandleRunEvents(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) HandleRuns(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) HandleStorageStatus(w http.ResponseWriter, _ *http.Request)
- func (h *Handlers) HandleSummary(w http.ResponseWriter, _ *http.Request)
- type HealthResponse
- type ModelUsageResponse
- type PromptJudgeUsageResponse
- type PromptJudgingRunResponse
- type ReleaseCollection
- type ReleaseDecision
- type ReleaseUsage
- type ReliabilitySummaryResponse
- type ResponderInfoResponse
- type RunDetail
- type RunEvent
- type RunEventData
- type RunEventType
- type RunStore
- type RunSummary
- type SessionDigestResponse
- type StorageAdapter
- type StorageConfig
- type StorageStatusResponse
- type SummaryResponse
- type TaskResult
- type TranscriptEventResponse
- type TrialCountsResponse
Constants ¶
This section is empty.
Variables ¶
var ErrRunNotFound = errors.New("run not found")
ErrRunNotFound is returned when a run ID does not match any stored run.
var Version = "0.4.0-alpha.1"
Version is set at build time or defaults to dev.
Functions ¶
func CORSMiddleware ¶
CORSMiddleware wraps a handler with CORS headers. If allowedOrigins is empty, no CORS header is set (same-origin only). Otherwise, the request Origin is checked against the allowed list.
func RegisterReleaseRoutes ¶ added in v0.39.0
RegisterReleaseRoutes uses only the configured local results root; the dashboard never supplies an arbitrary filesystem path or assesses summaries as ordinary runs. Each response re-verifies the collection artifacts.
func RegisterRoutes ¶
RegisterRoutes registers all web API routes on the given mux.
func RegisterRoutesWithStorage ¶
func RegisterRoutesWithStorage(mux *http.ServeMux, store RunStore, cfg *StorageConfig)
RegisterRoutesWithStorage registers all web API routes with storage config.
Types ¶
type ConfidenceIntervalResponse ¶
type ConfidenceIntervalResponse struct {
Lower float64 `json:"lower"`
Upper float64 `json:"upper"`
Mean float64 `json:"mean"`
ConfidenceLevel float64 `json:"confidenceLevel"`
}
ConfidenceIntervalResponse represents either a score or a binomial interval.
type ErrorResponse ¶
ErrorResponse is returned for errors.
type EvidenceRunResponse ¶ added in v0.39.0
type EvidenceRunResponse struct {
RunNumber int `json:"runNumber"`
Attempts int `json:"attempts"`
Cached bool `json:"cached"`
Assessment string `json:"assessment"`
Manifest *models.EvidenceManifest `json:"manifest,omitempty"`
Explanations []models.RequirementExplanation `json:"explanations,omitempty"`
Message string `json:"message,omitempty"`
}
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore reads EvaluationOutcome JSON files from a directory.
func NewFileStore ¶
NewFileStore creates a FileStore that reads results from dir.
func (*FileStore) ListRuns ¶
func (fs *FileStore) ListRuns(sortField, order string) ([]RunSummary, error)
ListRuns returns all runs sorted by the given field and order.
func (*FileStore) Summary ¶
func (fs *FileStore) Summary() (*SummaryResponse, error)
Summary returns aggregate metrics across all runs.
type GraderResult ¶
type GraderResult struct {
Name string `json:"name"`
Type string `json:"type"`
Passed bool `json:"passed"`
Score float64 `json:"score"`
Weight float64 `json:"weight"`
Message string `json:"message"`
}
GraderResult is a single grader/validator result.
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers holds the HTTP handler methods for the web API.
func NewHandlers ¶
NewHandlers creates a new Handlers with the given store.
func NewHandlersWithStorage ¶
func NewHandlersWithStorage(store RunStore, cfg *StorageConfig) *Handlers
NewHandlersWithStorage creates a new Handlers with storage configuration.
func (*Handlers) HandleHealth ¶
func (h *Handlers) HandleHealth(w http.ResponseWriter, _ *http.Request)
HandleHealth returns a simple health check response.
func (*Handlers) HandleLabRuns ¶ added in v0.39.0
func (h *Handlers) HandleLabRuns(w http.ResponseWriter, r *http.Request)
HandleLabRuns refreshes local artifacts for the opt-in dashboard.
func (*Handlers) HandleLatestRunEvents ¶ added in v0.38.0
func (h *Handlers) HandleLatestRunEvents(w http.ResponseWriter, r *http.Request)
HandleLatestRunEvents preserves the legacy /api/events stream by replaying the newest run in the same SSE format as the v1 per-run endpoint.
func (*Handlers) HandleRunDetail ¶
func (h *Handlers) HandleRunDetail(w http.ResponseWriter, r *http.Request)
HandleRunDetail returns full run detail with per-task results.
func (*Handlers) HandleRunEvents ¶ added in v0.38.0
func (h *Handlers) HandleRunEvents(w http.ResponseWriter, r *http.Request)
HandleRunEvents streams replayable Server-Sent Events for a run.
func (*Handlers) HandleRuns ¶
func (h *Handlers) HandleRuns(w http.ResponseWriter, r *http.Request)
HandleRuns returns a list of all runs, with optional sort/order query params.
func (*Handlers) HandleStorageStatus ¶
func (h *Handlers) HandleStorageStatus(w http.ResponseWriter, _ *http.Request)
HandleStorageStatus returns the current storage configuration status.
func (*Handlers) HandleSummary ¶
func (h *Handlers) HandleSummary(w http.ResponseWriter, _ *http.Request)
HandleSummary returns aggregate KPI metrics across all runs.
type HealthResponse ¶
HealthResponse is the health check response.
type ModelUsageResponse ¶ added in v0.38.9
type ModelUsageResponse struct {
Model string `json:"model"`
AICredits *float64 `json:"aiCredits,omitempty"`
InputTokens int `json:"inputTokens"`
CacheReadTokens int `json:"cacheReadTokens"`
CacheWriteTokens int `json:"cacheWriteTokens"`
OutputTokens int `json:"outputTokens"`
}
ModelUsageResponse is the per-model usage breakdown for a run. AICredits is omitted when the Copilot SDK did not report a final AI-credit total for the model.
type PromptJudgeUsageResponse ¶ added in v0.39.0
type PromptJudgeUsageResponse = judgeevidence.UsageMetadata
type PromptJudgingRunResponse ¶ added in v0.39.0
type PromptJudgingRunResponse = judgeevidence.RunMetadata
type ReleaseCollection ¶ added in v0.39.0
type ReleaseCollection struct {
Path string `json:"path"`
Decision ReleaseDecision `json:"decision"`
Error string `json:"error,omitempty"`
}
type ReleaseDecision ¶ added in v0.39.0
type ReleaseDecision struct {
releasepolicy.Decision
Kind string `json:"kind"`
Usage map[releasepolicy.Arm][]ReleaseUsage `json:"usage"`
}
type ReleaseUsage ¶ added in v0.39.0
type ReleaseUsage struct {
releasepolicy.UsageAxis
Value *string `json:"value,omitempty"`
}
ReleaseUsage transports exact numeric tokens as strings so JavaScript does not round large integer token counts before rendering them.
type ReliabilitySummaryResponse ¶ added in v0.39.0
type ReliabilitySummaryResponse struct {
SuccessRateCI *ConfidenceIntervalResponse `json:"successRateCI,omitempty"`
PassHatK []float64 `json:"passHatK,omitempty"`
}
ReliabilitySummaryResponse carries recorded estimates, never reconstructed ones.
type ResponderInfoResponse ¶ added in v0.37.0
type ResponderInfoResponse struct {
FollowupsSent int `json:"followupsSent"`
Outcome string `json:"outcome"`
Reason string `json:"reason,omitempty"`
}
ResponderInfoResponse is the API representation of a responder-driven run summary.
type RunDetail ¶
type RunDetail struct {
RunSummary
Tasks []TaskResult `json:"tasks"`
Statistics *ReliabilitySummaryResponse `json:"statistics,omitempty"`
RegradeUsage *PromptJudgeUsageResponse `json:"regradeUsage,omitempty"`
}
RunDetail is the API response for a single run with per-task results.
func (RunDetail) MarshalJSON ¶ added in v0.39.0
type RunEvent ¶ added in v0.38.0
type RunEvent struct {
SchemaVersion string `json:"schemaVersion"`
Sequence int64 `json:"sequence"`
RunID string `json:"runId"`
Type RunEventType `json:"type"`
Data RunEventData `json:"data"`
Timestamp time.Time `json:"timestamp"`
}
RunEvent is the JSON payload sent in each Server-Sent Event.
type RunEventData ¶ added in v0.38.0
type RunEventData struct {
Spec string `json:"spec,omitempty"`
Model string `json:"model,omitempty"`
TaskName string `json:"taskName,omitempty"`
Outcome string `json:"outcome,omitempty"`
Score float64 `json:"score,omitempty"`
Duration float64 `json:"duration,omitempty"`
GraderName string `json:"graderName,omitempty"`
GraderType string `json:"graderType,omitempty"`
Passed *bool `json:"passed,omitempty"`
Message string `json:"message,omitempty"`
TotalTasks int `json:"totalTasks,omitempty"`
CompletedTasks int `json:"completedTasks,omitempty"`
PassCount int `json:"passCount,omitempty"`
FailCount int `json:"failCount,omitempty"`
Tokens int `json:"tokens,omitempty"`
Cost float64 `json:"cost,omitempty"`
}
RunEventData carries event-specific progress details.
type RunEventType ¶ added in v0.38.0
type RunEventType string
RunEventType identifies a live progress event in a run SSE stream.
const ( RunEventStarted RunEventType = "run_started" RunEventTaskStarted RunEventType = "task_started" RunEventStepExecuted RunEventType = "step_executed" RunEventTaskCompleted RunEventType = "task_completed" RunEventCompleted RunEventType = "run_completed" RunEventFailed RunEventType = "run_failed" )
type RunStore ¶
type RunStore interface {
// ListRuns returns all runs, sorted by the given field and order.
ListRuns(sortField, order string) ([]RunSummary, error)
// GetRun returns a single run with full task details.
GetRun(id string) (*RunDetail, error)
// Summary returns aggregate metrics across all runs.
Summary() (*SummaryResponse, error)
}
RunStore provides access to evaluation run data.
type RunSummary ¶
type RunSummary struct {
ID string `json:"id"`
Spec string `json:"spec"`
Model string `json:"model"`
JudgeModel string `json:"judgeModel,omitempty"`
Outcome string `json:"outcome"`
PassCount int `json:"passCount"`
TaskCount int `json:"taskCount"`
Tokens int `json:"tokens"`
PremiumRequests float64 `json:"premiumRequests"`
// AICredits is the final AI-credit total reported by the Copilot SDK for the
// Copilot usage this run initiated. It is omitted for legacy artifacts and
// runtimes that do not report final AI-credit metrics; clients must render
// that as an unavailable state rather than substituting an estimate.
AICredits *float64 `json:"aiCredits,omitempty"`
// ModelUsage is the per-model usage breakdown for the run, sorted by model ID.
ModelUsage []ModelUsageResponse `json:"modelUsage,omitempty"`
Cost float64 `json:"cost"`
// CostSource records how Cost was computed: "sdk" (reported by the Copilot
// SDK), "table" (priced from the embedded model rate table), or "estimate"
// (flat-rate fallback). Empty for legacy summaries that carry no token/cost
// data.
CostSource string `json:"costSource,omitempty"`
Duration float64 `json:"duration"`
Timestamp time.Time `json:"timestamp"`
Source string `json:"source,omitempty"` // "local" or "azure-blob"
Skill string `json:"skill,omitempty"`
Repetitions int `json:"repetitions,omitempty"`
WeightedScore *float64 `json:"weightedScore,omitempty"`
// contains filtered or unexported fields
}
RunSummary is the API response for a single run in the list.
func (RunSummary) MarshalJSON ¶ added in v0.39.0
func (s RunSummary) MarshalJSON() ([]byte, error)
type SessionDigestResponse ¶
type SessionDigestResponse struct {
ToolPolicyMode string `json:"toolPolicyMode,omitempty"`
ToolPolicyDenials []models.ToolPolicyDenial `json:"toolPolicyDenials,omitempty"`
TotalTurns int `json:"totalTurns"`
ToolCallCount int `json:"toolCallCount"`
TokensIn int `json:"tokensIn"`
TokensOut int `json:"tokensOut"`
TokensTotal int `json:"tokensTotal"`
ToolsUsed []string `json:"toolsUsed"`
Errors []string `json:"errors"`
}
SessionDigestResponse is the API representation of a session digest.
type StorageAdapter ¶
type StorageAdapter struct {
// contains filtered or unexported fields
}
StorageAdapter adapts storage.ResultStore to the webapi.RunStore interface. It provides a bridge between the storage layer and the web API layer.
func NewStorageAdapter ¶
func NewStorageAdapter(store storage.ResultStore, source string) *StorageAdapter
NewStorageAdapter creates a RunStore backed by the given storage.ResultStore.
func (*StorageAdapter) GetRun ¶
func (sa *StorageAdapter) GetRun(id string) (*RunDetail, error)
GetRun returns a single run with full task details.
func (*StorageAdapter) ListRuns ¶
func (sa *StorageAdapter) ListRuns(sortField, order string) ([]RunSummary, error)
ListRuns returns all runs, sorted by the given field and order.
func (*StorageAdapter) Reload ¶ added in v0.39.0
func (sa *StorageAdapter) Reload() error
Reload refreshes backends with local snapshot support; remote behavior is unchanged.
func (*StorageAdapter) Summary ¶
func (sa *StorageAdapter) Summary() (*SummaryResponse, error)
Summary returns aggregate metrics across all runs.
type StorageConfig ¶
StorageConfig holds storage configuration for the status endpoint.
type StorageStatusResponse ¶
type StorageStatusResponse struct {
Configured bool `json:"configured"`
Provider string `json:"provider,omitempty"`
Account string `json:"account,omitempty"`
}
StorageStatusResponse is the storage configuration status.
type SummaryResponse ¶
type SummaryResponse struct {
TotalRuns int `json:"totalRuns"`
TotalTasks int `json:"totalTasks"`
PassRate float64 `json:"passRate"`
AvgTokens float64 `json:"avgTokens"`
AvgPremiumRequests float64 `json:"avgPremiumRequests"`
// AvgAICredits is the mean final AI-credit total across the runs that
// reported one. It is omitted when no run carries AI-credit metrics.
AvgAICredits *float64 `json:"avgAICredits,omitempty"`
AvgCost float64 `json:"avgCost"`
// CostSource records the source of AvgCost across runs: "sdk", "table",
// "estimate", or "mixed" when different runs were priced from different
// sources. Empty when there are no runs, or when every aggregated run lacks
// cost data (e.g. legacy ResultSummary rows that don't carry token usage).
CostSource string `json:"costSource,omitempty"`
AvgDuration float64 `json:"avgDuration"`
}
SummaryResponse is the aggregate KPI response.
type TaskResult ¶
type TaskResult struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Prompt string `json:"prompt,omitempty"`
Outcome string `json:"outcome"`
Score float64 `json:"score"`
WeightedScore *float64 `json:"weightedScore,omitempty"`
Duration float64 `json:"duration"`
GraderResults []GraderResult `json:"graderResults"`
DependencyModes []models.DependencyMode `json:"dependencyModes,omitempty"`
CommandInvocations []models.CommandInvocation `json:"commandInvocations,omitempty"`
Transcript []TranscriptEventResponse `json:"transcript,omitempty"`
SessionDigest *SessionDigestResponse `json:"sessionDigest,omitempty"`
Responder *ResponderInfoResponse `json:"responder,omitempty"`
BootstrapCI *ConfidenceIntervalResponse `json:"bootstrapCI,omitempty"`
PassRateCI *ConfidenceIntervalResponse `json:"passRateCI,omitempty"`
Trials *TrialCountsResponse `json:"trials,omitempty"`
EvidenceRuns []EvidenceRunResponse `json:"evidenceRuns,omitempty"`
PromptJudgingRuns []PromptJudgingRunResponse `json:"promptJudgingRuns,omitempty"`
}
TaskResult is a per-task result within a run.
type TranscriptEventResponse ¶
type TranscriptEventResponse struct {
Type string `json:"type"`
Content string `json:"content,omitempty"`
Message string `json:"message,omitempty"`
ToolCallID string `json:"toolCallId,omitempty"`
ToolName string `json:"toolName,omitempty"`
Arguments any `json:"arguments,omitempty"`
ToolResult any `json:"toolResult,omitempty"`
Success *bool `json:"success,omitempty"`
}
TranscriptEventResponse is the API representation of a transcript event.