config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config admits one project-local configuration and projects the fixed runtime policy consumed by review composition.

Index

Constants

View Source
const (
	ConfigVersion            = 1
	DefaultKimiModel         = "kimi-code/kimi-for-coding"
	DefaultAGYPermissionMode = "safe"
	ConfigRelativePath       = ".mulgae/config.yaml"
	MaximumConfigBytes       = 1 << 20
	ProjectKindNonUI         = "non_ui"
	ProjectKindUI            = "ui"
	DefaultArtistBriefPath   = "ux-ui-info.md"
)

Variables

View Source
var DefaultArtistDesignSpecGlobs = []string{
	"design-specs/**/*.png",
	"design-specs/**/*.jpg",
	"design-specs/**/*.jpeg",
	"design-specs/**/*.webp",
}

Functions

func DefaultKimiDataHome

func DefaultKimiDataHome(nativeHome string) string

func NewAdmissionError

func NewAdmissionError(reason ReasonCode) error

func RunTotalOutputCapBytes

func RunTotalOutputCapBytes(config Config) (int64, error)

Types

type AGYProviderConfig

type AGYProviderConfig struct {
	Executable     string `yaml:"executable" json:"executable"`
	PermissionMode string `yaml:"permission_mode,omitempty" json:"permission_mode"`
}

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 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 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"`
	Execution  ExecutionConfig  `yaml:"execution" json:"execution"`
	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 sole project-local Mulgae configuration authority.

type EvidenceConfig

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

type ExecutionConfig

type ExecutionConfig struct {
	WorkspaceAccess string `yaml:"workspace_access" json:"workspace_access"`
}

type KimiProviderConfig

type KimiProviderConfig struct {
	Executable string `yaml:"executable" json:"executable"`
	Model      string `yaml:"model,omitempty" json:"model"`
	DataHome   string `yaml:"data_home,omitempty" json:"data_home"`
}

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 {
	Kimi  *KimiProviderConfig  `yaml:"kimi,omitempty" json:"kimi,omitempty"`
	ZCode *ZCodeProviderConfig `yaml:"zcode,omitempty" json:"zcode,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"
	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"`
	RequiredRoles          []domain.Role            `json:"required_roles" yaml:"required_roles"`
	WorkspaceAccess        WorkspaceAccess          `json:"workspace_access" yaml:"workspace_access"`
	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"`
	RunTotalOutputCapBytes int64                    `json:"run_total_output_cap_bytes" yaml:"run_total_output_cap_bytes"`
	CIFailOnSeverity       []domain.Severity        `json:"ci_fail_on_severity" yaml:"ci_fail_on_severity"`
	DegradedReviewFails    bool                     `json:"degraded_review_fails" yaml:"degraded_review_fails"`
}

type RedactedRoleAssignment

type RedactedRoleAssignment struct {
	Role             domain.Role `json:"role" yaml:"role"`
	PrimaryProvider  string      `json:"primary_provider" yaml:"primary_provider"`
	FallbackProvider *string     `json:"fallback_provider" yaml:"fallback_provider"`
}

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) 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) RunTotalOutputCapBytes

func (resolved ResolvedConfig) RunTotalOutputCapBytes() int64

func (ResolvedConfig) Runtime

func (resolved ResolvedConfig) Runtime() RuntimePolicy

func (ResolvedConfig) WorkspaceAccess

func (resolved ResolvedConfig) WorkspaceAccess() WorkspaceAccess

type ResolvedRole

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

func (ResolvedRole) Enabled

func (role ResolvedRole) Enabled() bool

func (ResolvedRole) FallbackProvider

func (role ResolvedRole) FallbackProvider() (string, 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"`
	FallbackRepairAttempts int    `yaml:"fallback_repair_attempts" json:"fallback_repair_attempts"`
	RoleMaxInvocations     int    `yaml:"role_max_invocations" json:"role_max_invocations"`
	RunMaxInvocations      int    `yaml:"run_max_invocations" json:"run_max_invocations"`
	RunTotalOutputCap      string `yaml:"run_total_output_cap" json:"run_total_output_cap"`
}

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"`
	FallbackProvider string              `yaml:"fallback_provider,omitempty" json:"fallback_provider,omitempty"`
	Inputs           *ArtistInputsConfig `yaml:"inputs,omitempty" json:"inputs,omitempty"`
}

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(families []string) (RolesConfig, error)

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

func CanonicalRolesConfigForSelection

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

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

func CanonicalRolesConfigForUI

func CanonicalRolesConfigForUI(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 ValidationConfig

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

type WorkspaceAccess

type WorkspaceAccess string
const (
	WorkspaceNone             WorkspaceAccess = "none"
	WorkspaceReadonlySnapshot WorkspaceAccess = "readonly_snapshot"
)

func (WorkspaceAccess) Valid

func (access WorkspaceAccess) Valid() bool

type ZCodeProviderConfig

type ZCodeProviderConfig struct {
	NodeExecutable string `yaml:"node_executable" json:"node_executable"`
	Launcher       string `yaml:"launcher" json:"launcher"`
}

Jump to

Keyboard shortcuts

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