Help us shape the future of Go! Take the 2026 Go Developer Survey

team

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package team coordinates bounded local master/reviewer tasks through one authoritative broker. Roles propose text; they do not edit files or publish external actions. Model review is advisory and never human acceptance.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPending = errors.New("role is pending or uncertain; inspect state, do not automatically retry generation")
	ErrQuality = errors.New("team quality checks did not pass; no fallback was attempted")
	ErrExpired = errors.New("approved snapshot reuse window expired; explicitly review a new revision")
	ErrRecord  = errors.New("invalid shared team record")
)

Functions

func Describe

func Describe(r Request) (map[string]any, error)

Describe is offline and reveals the stable shared-state keys, never credentials.

func Fingerprint

func Fingerprint(r Request) (string, error)

func MasterPrompt

func MasterPrompt(r Request) (string, error)

MasterPrompt is the exact provider-independent master prompt, suitable for an explicitly authorized separate Codex subscription baseline. Producing it does not start a hosted model, import authentication or enable fallback.

func TaskDigest

func TaskDigest(r Request) string

TaskDigest excludes provider settings while pinning the same task, context, revision and quality contract on both sides of a comparison.

func Validate

func Validate(r Request) error

Types

type Baseline

type Baseline struct {
	Schema        int             `json:"schema"`
	TaskSHA256    string          `json:"task_sha256"`
	PromptSHA256  string          `json:"prompt_sha256"`
	Model         string          `json:"model"`
	Source        string          `json:"source"`
	Complete      bool            `json:"complete"`
	UsageKnown    bool            `json:"usage_known"`
	Usage         inference.Usage `json:"usage"`
	Text          string          `json:"text,omitempty"`
	ErrorCategory string          `json:"error_category,omitempty"`
}

type Case

type Case struct {
	ID         string  `json:"id"`
	Complexity string  `json:"complexity"`
	Request    Request `json:"request"`
}

type Comparison

type Comparison struct {
	WorkflowComparison           string          `json:"workflow_comparison,omitempty"`
	Schema                       int             `json:"schema"`
	Metric                       string          `json:"metric"`
	Scope                        string          `json:"scope"`
	Cases                        []ComparisonRow `json:"cases"`
	Eligible                     bool            `json:"eligible"`
	BaselineHostedTokens         int64           `json:"baseline_hosted_tokens"`
	LocalHostedTokens            int64           `json:"local_hosted_tokens"`
	ReductionPercent             *float64        `json:"hosted_token_reduction_percent"`
	Target99Established          bool            `json:"target_99_percent_established"`
	HostedCreditReductionPercent *float64        `json:"hosted_credit_reduction_percent"`
	InvoiceSavingsUSD            *float64        `json:"invoice_savings_usd"`
	CostPerAcceptedTaskUSD       *float64        `json:"cost_per_accepted_task_usd"`
	HumanRework                  string          `json:"human_rework"`
	BootstrapHostedUsage         string          `json:"bootstrap_hosted_usage"`
}

func Compare

func Compare(pairs []Pair) (Comparison, error)

type ComparisonRow

type ComparisonRow struct {
	AdditionalLocalOutputTypes map[string]string `json:"additional_local_output_types,omitempty"`
	AdditionalLocalFieldRoles  map[string]string `json:"additional_local_field_roles,omitempty"`
	CaseID                     string            `json:"case_id"`
	Complexity                 string            `json:"complexity"`
	Matched                    bool              `json:"matched"`
	LocalPassed                bool              `json:"local_passed"`
	BaselinePassed             bool              `json:"baseline_passed"`
	UsageKnown                 bool              `json:"usage_known"`
	BaselineHostedTokens       int64             `json:"baseline_hosted_tokens"`
	LocalHostedTokens          int64             `json:"local_hosted_tokens"`
	Eligible                   bool              `json:"eligible"`
}

type Engine

type Engine struct {
	Broker   inference.Broker
	Factory  Factory
	WorkerID string
	Now      func() time.Time
	// Admit may wait for local capacity before executing a new role's claim and
	// model call. Cache reads/finalization do not need inference admission.
	Admit func(context.Context, func(context.Context) error) error
}

func (Engine) Run

func (e Engine) Run(ctx context.Context, r Request, selected string) (Report, error)

Run executes only the selected role ("all" selects the ordered local pipeline). A remote reviewer may call it before the master is ready: it returns waiting without claiming work or making a model call. Workers share HTTP, never SQLite.

type Factory

type Factory func(context.Context, Role) (delegation.Runner, error)

type Pair

type Pair struct {
	Case     Case
	Local    Report
	Baseline Baseline
}

type Report

type Report struct {
	AccountingComplete  bool                     `json:"accounting_complete"`
	Schema              int                      `json:"schema"`
	RequestSHA256       string                   `json:"request_sha256"`
	Status              string                   `json:"status"`
	Steps               []Step                   `json:"steps"`
	Text                string                   `json:"text,omitempty"` // exposed only after every gate passes
	OutputSHA256        string                   `json:"output_sha256,omitempty"`
	Checks              []evaluation.CheckResult `json:"checks,omitempty"`
	LocalUsage          Usage                    `json:"this_run_local_usage"`
	HostedTokens        int64                    `json:"this_run_hosted_tokens"`
	HostedUsageKnown    bool                     `json:"hosted_usage_known"`
	ProviderCostUSD     float64                  `json:"provider_cost_usd"`
	PaidFallbackEnabled bool                     `json:"paid_fallback_enabled"`
	HumanAcceptance     string                   `json:"human_acceptance"`
}

type Request

type Request struct {
	// PolicyRevision names a reviewed execution-policy change without changing
	// the task/data revision bound to a previously measured baseline.
	PolicyRevision  string                  `json:"policy_revision,omitempty"`
	Schema          int                     `json:"schema"`
	Task            string                  `json:"task"`
	Revision        string                  `json:"revision"`
	Instructions    string                  `json:"instructions"`
	Input           string                  `json:"input"`
	Context         []inference.ContextItem `json:"context,omitempty"`
	Master          Role                    `json:"master"`
	Reviewers       []Role                  `json:"reviewers"`
	Checks          []evaluation.Check      `json:"checks"`
	ReuseForSeconds int64                   `json:"reuse_for_seconds"`
}

func Load

func Load(reader io.Reader) (Request, error)

type Role

type Role struct {
	Ollama          *inference.OllamaOptions `json:"ollama,omitempty"`
	ID              string                   `json:"id"`
	Driver          string                   `json:"driver"` // ollama or codex-oss; no hosted driver
	Model           string                   `json:"model"`
	ModelDigest     string                   `json:"model_digest"`
	Instructions    string                   `json:"instructions"`
	MaxInputTokens  int64                    `json:"max_input_tokens"`
	MaxOutputTokens int64                    `json:"max_output_tokens"`
}

type Step

type Step struct {
	OutcomeTrackingStatus string `json:"outcome_tracking_status"`
	Role                  string `json:"role"`
	State                 string `json:"state"`
	WorkerID              string `json:"worker_id,omitempty"`
	Reused                bool   `json:"reused"`
	OutputSHA256          string `json:"output_sha256,omitempty"`
	Usage                 Usage  `json:"this_run_local_usage"`
}

type Suite

type Suite struct {
	Schema int    `json:"schema"`
	ID     string `json:"id"`
	Cases  []Case `json:"cases"`
}

func DefaultSuite

func DefaultSuite(template Request) Suite

DefaultSuite is deliberately bounded policy/extraction reasoning, not a claim that six fixtures represent real repository-sized software engineering.

type Usage

type Usage struct {
	InputTokens     int64 `json:"input_tokens"`
	OutputTokens    int64 `json:"output_tokens"`
	Known           bool  `json:"known"`
	GenerationCalls int   `json:"generation_calls"`
}

Jump to

Keyboard shortcuts

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