Documentation
¶
Overview ¶
Package autonomy contains the deterministic daily experiment policy. It does not launch agents, change servers, or grant permissions. Callers persist State before dispatching and enforce QuotaGate before and throughout every run.
Index ¶
- Constants
- func InspectCompletionTree(dir string) (string, error)
- func QuotaGate(c Config, providers []ProviderUsage, required []string, now time.Time) error
- func ValidMaintenanceProposal(p Proposal) bool
- func ValidateRequirements(rs []Requirement) error
- type Assignment
- type BuildReport
- type CompletionOverlayReceipt
- type Config
- type DecisionProposal
- type ExpertRecoveryAudit
- type ExplorationFinding
- type GPUResearchLease
- type GPUResearchLedger
- func (l *GPUResearchLedger) Cancel(id string) error
- func (l *GPUResearchLedger) Record(receipt GPUResearchReceipt) error
- func (l *GPUResearchLedger) RecordAt(receipt GPUResearchReceipt, now time.Time) error
- func (l *GPUResearchLedger) Reserve(r GPUResearchRequest, runtimeKey, qualificationSHA string, now time.Time, ...) (*GPUResearchLease, error)
- func (l *GPUResearchLedger) Start(id string, now time.Time, enabled, quotaAllowed bool) error
- type GPUResearchReceipt
- type GPUResearchRequest
- type MaintenanceLimits
- type MaintenanceProposal
- type NoWorkBlocker
- type NoWorkReport
- type Phase
- type PlanReport
- type Proposal
- type ProviderUsage
- type Requirement
- type State
- func (s *State) ActiveTaskIDs() []int64
- func (s *State) ApplyReport(c Config, id int64, raw []byte) error
- func (s *State) NeededRoles() []string
- func (s *State) Pause(reason string)
- func (s *State) RegisterTask(role string, id int64) error
- func (s *State) Resume(c Config, providers []ProviderUsage, required []string, now time.Time) error
- type Usage
- type UsageBucket
- type UsageWindow
- type Verdict
Constants ¶
const CompletionOriginalWorkshop = CompletionSupplementDir + "/original-WORKSHOP.md"
const CompletionOverlayPolicy = "documentary-v1"
const CompletionSupplementDir = ".lectern-completion"
const GPUResearchTarget = "aiserver-amd-research-v1"
Variables ¶
This section is empty.
Functions ¶
func InspectCompletionTree ¶
InspectCompletionTree uses the same path, file and digest rules as overlay reconstruction. The caller must freeze the tree before inspecting it.
func QuotaGate ¶
QuotaGate fails closed for missing, duplicate, invalid, stale, or reset-past data. The five-minute source cache gets only a one-minute delivery allowance. This threshold is headroom, not a guarantee against provider reporting lag.
func ValidMaintenanceProposal ¶ added in v2.5.0
func ValidateRequirements ¶
func ValidateRequirements(rs []Requirement) error
Types ¶
type Assignment ¶
type BuildReport ¶
type BuildReport struct {
Requirements []Requirement `json:"requirements,omitempty"`
Outcome string `json:"outcome,omitempty"`
Summary string `json:"summary"`
Evidence []string `json:"evidence"`
Decision *DecisionProposal `json:"decision,omitempty"`
}
type CompletionOverlayReceipt ¶
type CompletionOverlayReceipt struct {
Policy string `json:"policy"`
BaselineSHA256 string `json:"baseline_sha256"`
OverlaySHA256 string `json:"overlay_sha256"`
DerivedSHA256 string `json:"derived_sha256"`
Documents []string `json:"documents"`
}
func ReconstructCompletionOverlay ¶
func ReconstructCompletionOverlay(baselineDir, candidateDir, outputDir string) (receipt CompletionOverlayReceipt, err error)
ReconstructCompletionOverlay validates an exact candidate tree, then copies the trusted baseline and only validated documentary bytes into a new output tree. Inputs must be frozen controller-owned snapshots; output's parent must likewise be controller-owned. It never executes candidate content. Reviewers must not execute fenced examples or use documentation-driven test discovery. Only flat .md/.txt supplements are allowed (no scripts, configs, dependencies or fixtures). Output root is always private 0700 and is excluded from tree receipts. Generated descendants have exact policy modes independent of process umask. A changed-back production file cannot affect output: production is read only from baseline and checked against its initial digest while copying.
type Config ¶
type Config struct {
Enabled bool `json:"enabled"`
Continuous bool `json:"continuous"`
Timezone string `json:"timezone"`
MorningHour int `json:"morning_hour"`
ReservePercent float64 `json:"reserve_percent"`
MarginPercent float64 `json:"margin_percent"`
MaxRevisionRounds int `json:"max_revision_rounds"`
MaxItemsPerDay int `json:"max_items_per_day"`
}
func DefaultConfig ¶
func DefaultConfig() Config
type DecisionProposal ¶
type ExpertRecoveryAudit ¶ added in v2.5.0
type ExpertRecoveryAudit struct {
SourceTaskID int64 `json:"source_task_id"`
ProgressKey string `json:"progress_key"`
ProbeIDs []string `json:"probe_ids"`
FailureFamily string `json:"failure_family"`
PriorAttempt int `json:"prior_attempt"`
MaterialChange bool `json:"material_change"`
CausalExplanation string `json:"causal_explanation"`
DifferentStrategy string `json:"different_strategy"`
StopCriterion string `json:"stop_criterion"`
}
ExpertRecoveryAudit is a semantic judgment bound to controller-owned probe receipts. Hashes alone do not prove causal relevance or novelty.
type ExplorationFinding ¶
type GPUResearchLease ¶ added in v2.5.0
type GPUResearchLease struct {
SemanticSHA string `json:"semantic_sha256"`
ID string `json:"id"`
Request GPUResearchRequest `json:"request"`
RequestRaw json.RawMessage `json:"request_raw"`
RequestSHA string `json:"request_sha256"`
QualificationSHA string `json:"qualification_sha256"`
ReservedAt time.Time `json:"reserved_at"`
StartedAt time.Time `json:"started_at,omitempty"`
SettledAt time.Time `json:"settled_at,omitempty"`
MaxMS int64 `json:"max_ms"`
StopRequested bool `json:"stop_requested"`
Receipt *GPUResearchReceipt `json:"receipt,omitempty"`
}
type GPUResearchLedger ¶ added in v2.5.0
type GPUResearchLedger struct {
Runs map[string]*GPUResearchLease `json:"runs"`
}
func (*GPUResearchLedger) Cancel ¶ added in v2.5.0
func (l *GPUResearchLedger) Cancel(id string) error
func (*GPUResearchLedger) Record ¶ added in v2.5.0
func (l *GPUResearchLedger) Record(receipt GPUResearchReceipt) error
func (*GPUResearchLedger) RecordAt ¶ added in v2.5.0
func (l *GPUResearchLedger) RecordAt(receipt GPUResearchReceipt, now time.Time) error
func (*GPUResearchLedger) Reserve ¶ added in v2.5.0
func (l *GPUResearchLedger) Reserve(r GPUResearchRequest, runtimeKey, qualificationSHA string, now time.Time, enabled, quotaAllowed bool) (*GPUResearchLease, error)
Reserve requires an independently authenticated qualification and fresh quota decision. Caller pins ExperimentRoot to the retained assignment lineage; a worker cannot choose a new root to reset the rolling resource ledger.
type GPUResearchReceipt ¶ added in v2.5.0
type GPUResearchReceipt struct {
RunID string `json:"run_id"`
RequestSHA string `json:"request_sha256"`
State string `json:"state"`
// nil means the trusted supervisor could not establish whether execution
// started; this consumes the full reserved profile rather than freeing budget.
Executed *bool `json:"executed"`
ChargedMS int64 `json:"charged_ms"`
ElapsedMS int64 `json:"elapsed_ms,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
OutputSHA string `json:"output_sha256,omitempty"`
CleanupConfirmed bool `json:"cleanup_confirmed"`
ReceiptSHA string `json:"receipt_sha256"`
}
type GPUResearchRequest ¶ added in v2.5.0
type GPUResearchRequest struct {
SchemaVersion int `json:"schema_version"`
OwnerJob string `json:"owner_job"`
OwnerTask int64 `json:"owner_task"`
Role string `json:"role"`
ExperimentRoot string `json:"experiment_root"`
SourceJob string `json:"source_job"`
SourceSnapshotID string `json:"source_snapshot_id"`
SourceTreeSHA string `json:"source_tree_sha256"`
SourceArchiveSHA string `json:"source_archive_sha256"`
AdmissionSHA string `json:"admission_sha256"`
AcceptanceSHA string `json:"acceptance_sha256"`
Target string `json:"target"`
RuntimeKey string `json:"runtime_key"`
QualificationSHA string `json:"qualification_sha256"`
Profile string `json:"profile"`
Script string `json:"script"`
Argv []string `json:"argv"`
Trial int `json:"trial"`
}
func (GPUResearchRequest) Validate ¶ added in v2.5.0
func (r GPUResearchRequest) Validate() error
type MaintenanceLimits ¶ added in v2.5.0
type MaintenanceProposal ¶ added in v2.5.0
type MaintenanceProposal struct {
TargetID string `json:"target_id"`
ServiceID string `json:"service_id"`
ObservationID string `json:"observation_id"`
Limits MaintenanceLimits `json:"limits"`
Pin string `json:"pin,omitempty"`
}
type NoWorkBlocker ¶
type NoWorkBlocker struct {
Key string `json:"key"`
Requirement string `json:"requirement"`
Evidence []string `json:"evidence"`
}
NoWorkReport makes declining work an auditable decision, not an implicit shortcut around the two independent plan auditors. Evidence remains claims to inspect; structure alone never proves novelty, feasibility or exhaustion.
type NoWorkReport ¶
type NoWorkReport struct {
Reason string `json:"reason"`
Blockers []NoWorkBlocker `json:"blockers"`
Exploration []ExplorationFinding `json:"exploration"`
}
type PlanReport ¶
type PlanReport struct {
Requirements []Requirement `json:"requirements,omitempty"`
NoWork *NoWorkReport `json:"no_work,omitempty"`
Items []Proposal `json:"items"`
Backlog []Proposal `json:"backlog,omitempty"`
}
type Proposal ¶
type Proposal struct {
Maintenance *MaintenanceProposal `json:"maintenance,omitempty"`
IntegrationTaskID int64 `json:"integration_task_id,omitempty"`
IntegrationPin string `json:"integration_pin,omitempty"`
IntegrationPaths []string `json:"integration_paths,omitempty"`
SourceIntegrationID string `json:"source_integration_id,omitempty"`
ExpertRecoveryTaskID int64 `json:"expert_recovery_task_id,omitempty"`
ExpertProgressKey string `json:"expert_progress_key,omitempty"`
DiagnoseTaskID int64 `json:"diagnose_task_id,omitempty"`
EnvironmentDiagnosisTaskID int64 `json:"environment_diagnosis_task_id,omitempty"`
DiagnoseRequirement string `json:"diagnose_requirement,omitempty"`
DocumentationTaskID int64 `json:"documentation_task_id,omitempty"`
ProjectID int64 `json:"project_id"`
SourceRevision string `json:"source_revision,omitempty"`
RepairTaskID int64 `json:"repair_task_id,omitempty"`
ContinueTaskID int64 `json:"continue_task_id,omitempty"`
Title string `json:"title"`
Why string `json:"why"`
Acceptance []string `json:"acceptance"`
Ambition string `json:"ambition,omitempty"`
Novelty string `json:"novelty,omitempty"`
Score int `json:"score,omitempty"`
Expert bool `json:"expert,omitempty"`
}
type ProviderUsage ¶
type ProviderUsage struct {
ID string `json:"id"`
Status string `json:"status"`
UpdatedAt *float64 `json:"updated_at"`
Buckets []UsageBucket `json:"buckets"`
}
type Requirement ¶
type Requirement struct {
Capability string `json:"capability"`
SchemaVersion int `json:"schema_version"`
Requirements []string `json:"requirements,omitempty"`
Imports []string `json:"imports,omitempty"`
Modules []string `json:"modules,omitempty"`
Binaries []string `json:"binaries,omitempty"`
PackageJSON string `json:"package_json,omitempty"`
PackageLock string `json:"package_lock,omitempty"`
Condition string `json:"condition"`
Evidence []string `json:"evidence"`
}
Requirement is an observation, never permission to execute a remediation. Identities, providers, paths and proof are supplied by the controller/runner.
type State ¶
type State struct {
NoWork *NoWorkReport `json:"no_work,omitempty"`
Date string `json:"date"`
Phase Phase `json:"phase"`
ResumePhase Phase `json:"resume_phase,omitempty"`
Reason string `json:"reason,omitempty"`
Revision int `json:"revision"`
Cycle int `json:"cycle"`
Item int `json:"item"`
Step int `json:"step"`
Items []Proposal `json:"items"`
Backlog []Proposal `json:"backlog,omitempty"`
Decision *DecisionProposal `json:"decision,omitempty"`
DecisionAudits map[string]Verdict `json:"decision_audits,omitempty"`
Assignments []Assignment `json:"assignments"`
Audits map[string]Verdict `json:"audits"`
Reports map[int64]json.RawMessage `json:"reports"`
}
func (*State) ActiveTaskIDs ¶
func (*State) ApplyReport ¶
ApplyReport accepts only the expected, owned task and validates the entire report before changing state. Repeated delivery is rejected without mutation.
func (*State) NeededRoles ¶
NeededRoles is a stable dispatch plan. RegisterTask must be persisted before dispatch; a restart then sees the same outstanding owned task IDs.
type Usage ¶
type Usage struct {
Providers []ProviderUsage `json:"providers"`
RefreshSeconds int `json:"refresh_seconds"`
}
Usage matches homelab-api /api/agent-usage's normalized response. Pointers distinguish absent measurements from legitimate zeroes; all advertised windows, including model-specific ones, constrain dispatch.
type UsageBucket ¶
type UsageBucket struct {
ID string `json:"id"`
Windows []UsageWindow `json:"windows"`
}
type UsageWindow ¶
type Verdict ¶
type Verdict struct {
ExpertRecovery []ExpertRecoveryAudit `json:"expert_recovery,omitempty"`
Requirements []Requirement `json:"requirements,omitempty"`
Outcome string `json:"outcome,omitempty"`
Approve *bool `json:"approve"`
Reason string `json:"reason"`
}
func (Verdict) AcceptsWork ¶
Legacy reports remain interpretable; explicit non-completion never promotes.