models

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaVersion = "1.0.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType added in v1.2.0

type EventType string

EventType discriminates stream events emitted in JSONL mode.

const (
	EventResult    EventType = "result"
	EventProgress  EventType = "progress"
	EventSummary   EventType = "summary"
	EventStartMeta EventType = "start"
)

type ProgressEvent added in v1.2.0

type ProgressEvent struct {
	Done       int     `json:"done"`
	Total      int     `json:"total"`
	Valid      int     `json:"valid"`
	Invalid    int     `json:"invalid"`
	RateLimit  int     `json:"rate_limited"`
	Skipped    int     `json:"skipped"`
	SpeedKeys  float64 `json:"keys_per_second"`
	ETASeconds float64 `json:"eta_seconds"`
}

ProgressEvent is emitted periodically while validation runs.

type ProviderTotals added in v1.2.0

type ProviderTotals struct {
	Valid     int `json:"valid"`
	Invalid   int `json:"invalid"`
	RateLimit int `json:"rate_limited"`
	Skipped   int `json:"skipped"`
}

ProviderTotals is a per-provider tally in the summary event.

type StartEvent added in v1.2.0

type StartEvent struct {
	Total   int    `json:"total"`
	Threads int    `json:"threads"`
	Proxy   string `json:"proxy,omitempty"`
}

StartEvent announces total key count and run configuration at start.

type StreamEvent added in v1.2.0

type StreamEvent struct {
	Event     EventType         `json:"event"`
	Timestamp string            `json:"timestamp"`
	Version   string            `json:"schema_version"`
	Result    *ValidationResult `json:"result,omitempty"`
	Progress  *ProgressEvent    `json:"progress,omitempty"`
	Summary   *SummaryEvent     `json:"summary,omitempty"`
	Start     *StartEvent       `json:"start,omitempty"`
}

StreamEvent is the canonical envelope for `--format jsonl`.

Exactly one of Result / Progress / Summary / StartMeta is non-nil based on Type. Fields outside the event payload carry a common envelope: event type, an ISO-8601 timestamp, and a stable schema version.

func NewProgressEvent added in v1.2.0

func NewProgressEvent(p *ProgressEvent) *StreamEvent

NewProgressEvent wraps a progress snapshot.

func NewResultEvent added in v1.2.0

func NewResultEvent(r *ValidationResult) *StreamEvent

NewResultEvent wraps a ValidationResult in the envelope.

func NewStartEvent added in v1.2.0

func NewStartEvent(s *StartEvent) *StreamEvent

NewStartEvent wraps the run-start metadata.

func NewSummaryEvent added in v1.2.0

func NewSummaryEvent(s *SummaryEvent) *StreamEvent

NewSummaryEvent wraps the run summary.

func (*StreamEvent) Marshal added in v1.2.0

func (e *StreamEvent) Marshal() ([]byte, error)

Marshal returns one line of compact JSON with a trailing newline.

type SummaryEvent added in v1.2.0

type SummaryEvent struct {
	Total      int                       `json:"total"`
	Valid      int                       `json:"valid"`
	Invalid    int                       `json:"invalid"`
	RateLimit  int                       `json:"rate_limited"`
	Skipped    int                       `json:"skipped"`
	CacheHits  int                       `json:"cache_hits"`
	DurationMs int64                     `json:"duration_ms"`
	ByProvider map[string]ProviderTotals `json:"by_provider,omitempty"`
}

SummaryEvent is emitted exactly once at end of run.

type ValidationResult

type ValidationResult struct {
	Key           string `json:"key"`
	Provider      string `json:"provider"`
	Endpoint      string `json:"endpoint,omitempty"`
	IsValid       bool   `json:"is_valid"`
	InvalidReason string `json:"invalid_reason,omitempty"`
	StatusCode    int    `json:"status_code"`

	StatusNote   string                 `json:"status_note,omitempty"`
	ResponseTime float64                `json:"response_time_sec"`
	ErrorMessage string                 `json:"error_message,omitempty"`
	ResponseBody string                 `json:"response_body,omitempty"`
	Balance      float64                `json:"balance,omitempty"`
	AccountName  string                 `json:"account_name,omitempty"`
	Email        string                 `json:"email,omitempty"`
	RetryAfter   int                    `json:"-"`
	ModelAccess  []string               `json:"model_access,omitempty"`
	Extra        map[string]interface{} `json:"extra,omitempty"`
	GraphQLInfo  string                 `json:"graphql_info,omitempty"`
}

func (*ValidationResult) GetExtraString

func (r *ValidationResult) GetExtraString(key string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL