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

config

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package config admits the project-local Config v5 pair and projects the fixed runtime policy consumed by review composition.

Index

Constants

View Source
const (
	ConfigVersion           = 5
	DefaultProviderTimeout  = 60 * time.Minute
	MinimumProviderTimeout  = time.Minute
	MaximumProviderTimeout  = 60 * time.Minute
	ConfigRelativePath      = ".mulgae/config.yaml"
	LocalConfigRelativePath = ".mulgae/local.yaml"
	MaximumConfigBytes      = 1 << 20
	ProjectKindNonUI        = "non_ui"
	ProjectKindUI           = "ui"
)

Variables

View Source
var ErrRoleProviderUnsupported = errors.New("role provider unsupported")

ErrRoleProviderUnsupported identifies a valid role selection that none of the configured provider families can run.

Functions

func AdmitConfiguredNativeAccount added in v0.1.26

func AdmitConfiguredNativeAccount(configuredHome string, account AccountObservation) (string, uint32, error)

func BundleSHA256 added in v0.1.13

func BundleSHA256(project, local []byte) string

BundleSHA256 returns the stable identity of an ordered Config v5 pair.

func ConfirmLocality added in v0.1.26

ConfirmLocality retains both source confirmations around attestor confirmation. Callers retain dependency checks and error projection; causes pass through unchanged.

func EffectiveAccountUID added in v0.1.26

func EffectiveAccountUID(account AccountObservation) (uint32, error)

EffectiveAccountUID preserves the native-account comparison used by init and review.

func NewAdmissionError

func NewAdmissionError(reason ReasonCode) error

func ParseProviderTimeout added in v0.1.2

func ParseProviderTimeout(value string) (time.Duration, error)

ParseProviderTimeout resolves an optional Config v5 provider timeout. An omitted value uses the fixed 60-minute default, which is also the admitted maximum; explicit values are bounded inclusively between one and sixty minutes, so a project may only shorten a provider window.

func ProviderTimeoutText added in v0.1.2

func ProviderTimeoutText(timeout time.Duration) string

ProviderTimeoutText returns the stable Config v5 spelling for a valid provider timeout. Whole-minute values use the concise "30m" form.

func SameNativeHomeAuthority added in v0.1.26

func SameNativeHomeAuthority(left, right ports.NativeHomeLaunchAuthority) bool

func ValidAgyModel added in v0.1.26

func ValidAgyModel(value string) bool

ValidAgyModel reports whether value has the model grammar the AGY adapter admits. The spelling is validated as supplied and is never normalized.

func ValidAgyReasoningEffort added in v0.1.26

func ValidAgyReasoningEffort(value string) bool

ValidAgyReasoningEffort reports whether value is one effort of the closed enum the installed AGY CLI lists for --effort. The empty value means omitted, never an invented default.

func ValidGrokModel added in v0.1.23

func ValidGrokModel(value string) bool

ValidGrokModel reports whether value has the exact Config v5 Grok model grammar. The spelling is validated as supplied and is never normalized.

func ValidGrokReasoningEffort added in v0.1.23

func ValidGrokReasoningEffort(value string) bool

ValidGrokReasoningEffort reports whether value has the exact Config v5 Grok reasoning-effort grammar.

func ValidZCodeModel added in v0.1.24

func ValidZCodeModel(value string) bool

ValidZCodeModel reports whether value is one provider-qualified ZCode model selection in the exact provider/model form consumed by app-server.

func ValidZCodeReasoningEffort added in v0.1.24

func ValidZCodeReasoningEffort(value string) bool

ValidZCodeReasoningEffort reports whether value is a syntactically valid app-server thought level. Availability remains owned by the selected model.

Types

type AccountObservation added in v0.1.26

type AccountObservation struct {
	Available    bool
	Home         string
	UID          string
	EffectiveUID int
	Err          error
}

AccountObservation contains raw installed-account facts, without OS types or policy.

type AccountObserver added in v0.1.26

type AccountObserver interface{ ObserveAccount() AccountObservation }

type AdmissionError

type AdmissionError struct {
	// contains filtered or unexported fields
}

func AsAdmissionError

func AsAdmissionError(err error) (*AdmissionError, bool)

func (*AdmissionError) Error

func (err *AdmissionError) Error() string

func (*AdmissionError) Reason

func (err *AdmissionError) Reason() ReasonCode

type AgyProviderConfig added in v0.1.26

type AgyProviderConfig struct {
	Executable      string `yaml:"executable" json:"executable"`
	Model           string `yaml:"model,omitempty" json:"model,omitempty"`
	ReasoningEffort string `yaml:"reasoning_effort,omitempty" json:"reasoning_effort,omitempty"`
	Timeout         string `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

AgyProviderConfig is the single-account AGY provider block. The executable is machine-local; model, reasoning effort, and timeout are project policy. AGY admits no credential profile, credential home, or account fields: the one default Gemini account is the only credential source.

type ArtistInputsConfig

type ArtistInputsConfig struct {
	TaskPath        string   `yaml:"task_path" json:"task_path"`
	DesignSpecGlobs []string `yaml:"design_spec_globs" json:"design_spec_globs"`
}

type CIConfig

type CIConfig struct {
	FailOnSeverity      []string `yaml:"fail_on_severity" json:"fail_on_severity"`
	DegradedReviewFails bool     `yaml:"degraded_review_fails" json:"degraded_review_fails"`
}

type Codec

type Codec interface {
	Decode([]byte) (Config, error)
	EncodeCanonical(Config) ([]byte, error)
}

Codec keeps serialization mechanics outside the application layer.

type CodexCredentialHomeConfig added in v0.1.14

type CodexCredentialHomeConfig struct {
	Profile string `yaml:"profile" json:"profile"`
	Home    string `yaml:"home" json:"home"`
}

type CodexProviderConfig added in v0.1.14

type CodexProviderConfig struct {
	Executable               string                      `yaml:"executable" json:"executable"`
	DefaultCredentialProfile string                      `yaml:"default_credential_profile,omitempty" json:"default_credential_profile,omitempty"`
	CredentialHomes          []CodexCredentialHomeConfig `yaml:"credential_homes,omitempty" json:"credential_homes,omitempty"`
	Model                    string                      `yaml:"model,omitempty" json:"model,omitempty"`
	ReasoningEffort          string                      `yaml:"reasoning_effort,omitempty" json:"reasoning_effort,omitempty"`
	Timeout                  string                      `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

func (CodexProviderConfig) CredentialHome added in v0.1.14

func (provider CodexProviderConfig) CredentialHome(profile string) (string, bool)

type Config

type Config struct {
	Version    int              `yaml:"version" json:"version"`
	Project    ProjectConfig    `yaml:"project" json:"project"`
	NativeUser NativeUserConfig `yaml:"native_user" json:"native_user"`
	Providers  ProvidersConfig  `yaml:"providers" json:"providers"`
	Roles      RolesConfig      `yaml:"roles" json:"roles"`
	Review     ReviewConfig     `yaml:"review" json:"review"`
	Validation ValidationConfig `yaml:"validation" json:"validation"`
	Resources  ResourcesConfig  `yaml:"resources" json:"resources"`
	CI         CIConfig         `yaml:"ci" json:"ci"`
}

Config is the admitted effective value merged from Config v5's project and machine-local authorities.

type CursorProviderConfig added in v0.1.26

type CursorProviderConfig struct {
	Executable string `yaml:"executable" json:"executable"`
	Timeout    string `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

type EvidenceConfig

type EvidenceConfig struct {
	RequireVerifiedFor []string `yaml:"require_verified_for" json:"require_verified_for"`
}

type ExtractionConfig added in v0.1.16

type ExtractionConfig struct {
	Enabled         bool `yaml:"enabled" json:"enabled"`
	EnabledExplicit bool `yaml:"-" json:"-"`
}

ExtractionConfig enables the Mulgae-owned structured extraction trailer. It consumes the same single second invocation retry and repair compete for, so enabling it never widens a role path.

type GrokProviderConfig added in v0.1.22

type GrokProviderConfig struct {
	Executable      string `yaml:"executable" json:"executable"`
	Model           string `yaml:"model,omitempty" json:"model,omitempty"`
	ReasoningEffort string `yaml:"reasoning_effort,omitempty" json:"reasoning_effort,omitempty"`
	Timeout         string `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

type LocalitySelector added in v0.1.26

LocalitySelector chooses the existing Git or filesystem attestor at the caller's observation point. The boolean reports that independent Git binding is unavailable.

type NativeUserConfig

type NativeUserConfig struct {
	Home string `yaml:"home" json:"home"`
}

type ProjectConfig

type ProjectConfig struct {
	Name    string `yaml:"name" json:"name"`
	Context string `yaml:"context,omitempty" json:"context,omitempty"`
	Kind    string `yaml:"kind,omitempty" json:"kind,omitempty"`
}

type ProvenanceRow

type ProvenanceRow struct {
	Field       string `json:"field"`
	Source      string `json:"source"`
	Disposition string `json:"disposition"`
	ValueClass  string `json:"value_class"`
}

type ProvidersConfig

type ProvidersConfig struct {
	ZCode  *ZCodeProviderConfig  `yaml:"zcode,omitempty" json:"zcode,omitempty"`
	Grok   *GrokProviderConfig   `yaml:"grok,omitempty" json:"grok,omitempty"`
	Codex  *CodexProviderConfig  `yaml:"codex,omitempty" json:"codex,omitempty"`
	Cursor *CursorProviderConfig `yaml:"cursor,omitempty" json:"cursor,omitempty"`
	Agy    *AgyProviderConfig    `yaml:"agy,omitempty" json:"agy,omitempty"`
}

func (ProvidersConfig) Count

func (providers ProvidersConfig) Count() int

func (ProvidersConfig) Families

func (providers ProvidersConfig) Families() []string

func (ProvidersConfig) HasFamily

func (providers ProvidersConfig) HasFamily(family string) bool

HasFamily reports whether a provider family is explicitly configured.

type ReasonCode

type ReasonCode string
const (
	ReasonYAMLInvalid             ReasonCode = "config_yaml_invalid"
	ReasonSizeInvalid             ReasonCode = "config_size_invalid"
	ReasonProviderTimeoutInvalid  ReasonCode = "config_provider_timeout_invalid"
	ReasonProviderIdentityInvalid ReasonCode = "config_provider_identity_invalid"
	ReasonProviderRetired         ReasonCode = "config_provider_retired"
	ReasonRoleMappingInvalid      ReasonCode = "config_role_mapping_invalid"
	ReasonCredentialKeyDetected   ReasonCode = "config_credential_key_detected"
	ReasonCredentialValueDetected ReasonCode = "config_credential_value_detected"
)

type RedactedConfig

type RedactedConfig struct {
	ConfiguredProviderIDs []string       `json:"configured_provider_ids" yaml:"configured_provider_ids"`
	Policy                RedactedPolicy `json:"policy" yaml:"policy"`
}

func Redact

func Redact(resolved ResolvedConfig) RedactedConfig

type RedactedPolicy

type RedactedPolicy struct {
	RoleAssignments     []RedactedRoleAssignment  `json:"role_assignments" yaml:"role_assignments"`
	ProviderTimeouts    []RedactedProviderTimeout `json:"provider_timeouts" yaml:"provider_timeouts"`
	Warnings            []string                  `json:"warnings" yaml:"warnings"`
	RequiredRoles       []domain.Role             `json:"required_roles" yaml:"required_roles"`
	RequestChangesOn    []domain.Severity         `json:"request_changes_on" yaml:"request_changes_on"`
	RequireVerifiedFor  []domain.Severity         `json:"require_verified_for" yaml:"require_verified_for"`
	RoleMaxInvocations  int                       `json:"role_max_invocations" yaml:"role_max_invocations"`
	RunMaxInvocations   int                       `json:"run_max_invocations" yaml:"run_max_invocations"`
	ExtractionEnabled   bool                      `json:"extraction_enabled" yaml:"extraction_enabled"`
	CIFailOnSeverity    []domain.Severity         `json:"ci_fail_on_severity" yaml:"ci_fail_on_severity"`
	DegradedReviewFails bool                      `json:"degraded_review_fails" yaml:"degraded_review_fails"`
}

type RedactedProviderTimeout added in v0.1.2

type RedactedProviderTimeout struct {
	Family  string `json:"family" yaml:"family"`
	Timeout string `json:"timeout" yaml:"timeout"`
}

type RedactedRoleAssignment

type RedactedRoleAssignment struct {
	Role              domain.Role `json:"role" yaml:"role"`
	PrimaryProvider   string      `json:"primary_provider" yaml:"primary_provider"`
	CredentialProfile string      `json:"credential_profile,omitempty" yaml:"credential_profile,omitempty"`
}

type RepairConfig

type RepairConfig struct {
	Enabled      bool `yaml:"enabled" json:"enabled"`
	MaxAttempts  int  `yaml:"max_attempts" json:"max_attempts"`
	SameProvider bool `yaml:"same_provider" json:"same_provider"`
}

type Resolution

type Resolution struct {
	// contains filtered or unexported fields
}

func (Resolution) CanonicalYAML

func (resolution Resolution) CanonicalYAML() []byte

func (Resolution) Config

func (resolution Resolution) Config() ResolvedConfig

func (Resolution) Provenance

func (resolution Resolution) Provenance() []ProvenanceRow

func (Resolution) RedactedJSON

func (resolution Resolution) RedactedJSON() []byte

func (Resolution) Revalidate

func (resolution Resolution) Revalidate() error

func (Resolution) SHA256

func (resolution Resolution) SHA256() string

func (Resolution) URI

func (resolution Resolution) URI() string

type ResolveRequest

type ResolveRequest struct {
	Source ports.ConfigSource
}

type ResolvedConfig

type ResolvedConfig struct {
	// contains filtered or unexported fields
}

func ResolveConfiguration

func ResolveConfiguration(raw Config) (ResolvedConfig, error)

func (ResolvedConfig) CIFailOnSeverity

func (resolved ResolvedConfig) CIFailOnSeverity() []domain.Severity

func (ResolvedConfig) DegradedReviewFails

func (resolved ResolvedConfig) DegradedReviewFails() bool

func (ResolvedConfig) ExtractionEnabled added in v0.1.16

func (resolved ResolvedConfig) ExtractionEnabled() bool

ExtractionEnabled reports whether Mulgae may run its structured extraction trailer after accepting a free-form role report.

func (ResolvedConfig) ProviderTimeout added in v0.1.2

func (resolved ResolvedConfig) ProviderTimeout(family string) (time.Duration, bool)

ProviderTimeout returns the effective timeout for a configured provider family. The boolean is false for an absent or unknown family.

func (ResolvedConfig) Providers

func (resolved ResolvedConfig) Providers() ProvidersConfig

func (ResolvedConfig) Raw

func (resolved ResolvedConfig) Raw() Config

func (ResolvedConfig) Redacted

func (resolved ResolvedConfig) Redacted() RedactedConfig

func (ResolvedConfig) RequestChangesOn

func (resolved ResolvedConfig) RequestChangesOn() []domain.Severity

func (ResolvedConfig) RequireVerifiedFor

func (resolved ResolvedConfig) RequireVerifiedFor() []domain.Severity

func (ResolvedConfig) RequiredRoles

func (resolved ResolvedConfig) RequiredRoles() []domain.Role

func (ResolvedConfig) Role

func (resolved ResolvedConfig) Role(role domain.Role) (ResolvedRole, bool)

func (ResolvedConfig) RoleMaxInvocations

func (resolved ResolvedConfig) RoleMaxInvocations() int

func (ResolvedConfig) RunMaxInvocations

func (resolved ResolvedConfig) RunMaxInvocations() int

func (ResolvedConfig) Runtime

func (resolved ResolvedConfig) Runtime() RuntimePolicy

type ResolvedRole

type ResolvedRole struct {
	// contains filtered or unexported fields
}

func (ResolvedRole) CredentialProfile added in v0.1.14

func (role ResolvedRole) CredentialProfile() string

func (ResolvedRole) Enabled

func (role ResolvedRole) Enabled() bool

func (ResolvedRole) PrimaryProvider

func (role ResolvedRole) PrimaryProvider() string

type ResourcesConfig

type ResourcesConfig struct {
	MaxActiveLanes        int `yaml:"max_active_lanes" json:"max_active_lanes"`
	PrimaryRepairAttempts int `yaml:"primary_repair_attempts" json:"primary_repair_attempts"`
	RoleMaxInvocations    int `yaml:"role_max_invocations" json:"role_max_invocations"`
	RunMaxInvocations     int `yaml:"run_max_invocations" json:"run_max_invocations"`
}

type ReviewConfig

type ReviewConfig struct {
	RequiredRoles    []string `yaml:"required_roles" json:"required_roles"`
	RequestChangesOn []string `yaml:"request_changes_on" json:"request_changes_on"`
}

type RoleConfig

type RoleConfig struct {
	Enabled           bool                `yaml:"enabled" json:"enabled"`
	PrimaryProvider   string              `yaml:"primary_provider" json:"primary_provider"`
	CredentialProfile string              `yaml:"credential_profile,omitempty" json:"credential_profile,omitempty"`
	Inputs            *ArtistInputsConfig `yaml:"inputs,omitempty" json:"inputs,omitempty"`
}

type RoleDefault added in v0.1.4

type RoleDefault struct {
	ProviderPreferences   []string
	ArtistTaskPath        string
	ArtistDesignSpecGlobs []string
}

RoleDefault is one role's build-owned generation-time default.

ProviderPreferences is an ordered family preference: the first configured family becomes the role's provider. Later entries keep the derivation total when a project configures a different provider set; they are not a fallback route, because a role runs on exactly one provider. The artist fields are populated only for the artist role.

type RoleDefaults added in v0.1.4

type RoleDefaults struct {
	// contains filtered or unexported fields
}

RoleDefaults is the validated, immutable set of build-owned defaults for every fixed role. It is the sole source of init's default provider routing and of the artist input defaults; no default assignment is spelled in Go.

func NewRoleDefaults added in v0.1.4

func NewRoleDefaults(entries map[domain.Role]RoleDefault) (RoleDefaults, error)

NewRoleDefaults validates and deep-copies a complete set of role defaults.

Every core role must name all provider families. That keeps the derivation total: the intersection with any non-empty configured family set is never empty, so a role can never resolve to no primary provider.

func (RoleDefaults) Role added in v0.1.4

func (defaults RoleDefaults) Role(role domain.Role) (RoleDefault, bool)

Role returns a caller-owned copy of one role's defaults.

func (RoleDefaults) Valid added in v0.1.4

func (defaults RoleDefaults) Valid() bool

Valid reports whether the defaults carry every fixed role.

type RolesConfig

type RolesConfig struct {
	Logic           RoleConfig `yaml:"logic" json:"logic"`
	Security        RoleConfig `yaml:"security" json:"security"`
	Maintainability RoleConfig `yaml:"maintainability" json:"maintainability"`
	Product         RoleConfig `yaml:"product" json:"product"`
	Documentation   RoleConfig `yaml:"documentation" json:"documentation"`
	Testing         RoleConfig `yaml:"testing" json:"testing"`
	Artist          RoleConfig `yaml:"artist,omitempty" json:"artist,omitempty"`
}

func CanonicalRolesConfig

func CanonicalRolesConfig(defaults RoleDefaults, families []string) (RolesConfig, error)

CanonicalRolesConfig derives init's deterministic role assignments from the build-owned role defaults and the selected provider subset. Persisted configs remain explicit; runtime never calls this function to invent an assignment.

func CanonicalRolesConfigForSelection

func CanonicalRolesConfigForSelection(defaults RoleDefaults, families, selectedRoles []string) (RolesConfig, error)

CanonicalRolesConfigForSelection derives the deterministic assignments for every Config v5 role while enabling only the canonical project role set. Logic forms the project-level floor, not a per-run selection.

Each role resolves independently from its own build-owned preference order, so editing one role's defaults never moves another role's assignment.

func CanonicalRolesConfigForUI

func CanonicalRolesConfigForUI(defaults RoleDefaults, families []string) (RolesConfig, error)

func (RolesConfig) Ordered

func (roles RolesConfig) Ordered() []RoleConfig

Ordered returns the role configurations in canonical role order.

type RuntimePolicy

type RuntimePolicy struct{ MaxActiveLanes int }

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(codec Codec) *Service

func (*Service) Resolve

func (service *Service) Resolve(ctx context.Context, request ResolveRequest) (Resolution, error)

type SplitCodec added in v0.1.13

type SplitCodec interface {
	Codec
	DecodeSplit([]byte, []byte) (Config, error)
	EncodeSplit(Config) ([]byte, []byte, error)
	ProjectProviderIDs([]byte) ([]string, error)
	MergeProjectConfig([]byte, Config) (Config, error)
}

SplitCodec owns the disk projection and merge rules for Config v5's paired authorities.

type ValidationConfig

type ValidationConfig struct {
	Evidence   EvidenceConfig   `yaml:"evidence" json:"evidence"`
	Repair     RepairConfig     `yaml:"repair" json:"repair"`
	Extraction ExtractionConfig `yaml:"extraction" json:"extraction"`
}

type ZCodeProviderConfig

type ZCodeProviderConfig struct {
	AppBundle       string `yaml:"app_bundle" json:"app_bundle"`
	Model           string `yaml:"model,omitempty" json:"model,omitempty"`
	ReasoningEffort string `yaml:"reasoning_effort,omitempty" json:"reasoning_effort,omitempty"`
	Timeout         string `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

Jump to

Keyboard shortcuts

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