evolution

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusProvisional = "provisional"
	StatusActive      = "active"
	StatusVerified    = "verified"
	StatusQuarantine  = "quarantine"
	StatusRetired     = "retired"
)
View Source
const (
	RelationSupport       = "support"
	RelationContradict    = "contradict"
	RelationNone          = "none"
	RelationNotApplicable = "not_applicable"
	RelationUncertain     = "uncertain"
)
View Source
const PolicyVersion = "v1"

Variables

View Source
var ErrRevisionConflict = errors.New("evolution revision conflict")
View Source
var ErrSelfProof = errors.New("rejected_self_proof")

Functions

This section is empty.

Types

type AppliedOperation

type AppliedOperation struct {
	ID     string `json:"id"`
	Digest string `json:"digest"`
}

type Candidate

type Candidate struct {
	Type         string   `json:"type"`
	Statement    string   `json:"statement"`
	Scope        string   `json:"scope,omitempty"`
	Project      string   `json:"project,omitempty"`
	Device       string   `json:"device,omitempty"`
	CanonicalKey string   `json:"canonical_key,omitempty"`
	Source       string   `json:"source,omitempty"`
	Tags         []string `json:"tags,omitempty"`
}

type Evidence

type Evidence struct {
	Ref            string `json:"ref"`
	Relation       string `json:"relation"`
	TaskID         string `json:"task_id,omitempty"`
	ReviewRevision string `json:"review_revision,omitempty"`
	Rationale      string `json:"rationale,omitempty"`
	RecordedAt     string `json:"recorded_at"`
}

type LearningCheck

type LearningCheck struct {
	OnSuccess string `json:"on_success"`
	OnFailure string `json:"on_failure"`
}

type Query

type Query struct {
	Query       string   `json:"query"`
	EvolutionID string   `json:"evolution_id,omitempty"`
	Statuses    []string `json:"statuses,omitempty"`
	Types       []string `json:"types,omitempty"`
	Scope       string   `json:"scope,omitempty"`
	Project     string   `json:"project,omitempty"`
	Device      string   `json:"device,omitempty"`
	Limit       int      `json:"limit,omitempty"`
}

type Record

type Record struct {
	EvolutionID       string             `json:"evolution_id"`
	Title             string             `json:"title"`
	Statement         string             `json:"statement"`
	Type              string             `json:"type"`
	Scope             string             `json:"scope"`
	Project           string             `json:"project"`
	Device            string             `json:"device,omitempty"`
	CanonicalKey      string             `json:"canonical_key,omitempty"`
	Status            string             `json:"status"`
	PolicyVersion     string             `json:"policy_version"`
	Revision          int64              `json:"revision"`
	SupportCount      int                `json:"support_count"`
	ContradictCount   int                `json:"contradict_count"`
	Source            string             `json:"source,omitempty"`
	Tags              []string           `json:"tags,omitempty"`
	Evidence          []Evidence         `json:"evidence,omitempty"`
	SupersededBy      string             `json:"superseded_by,omitempty"`
	AppliedOperations []AppliedOperation `json:"applied_operations,omitempty"`
	CreatedAt         string             `json:"created_at"`
	UpdatedAt         string             `json:"updated_at"`
}

type Request

type Request struct {
	Intent         string         `json:"intent"`
	Candidate      *Candidate     `json:"candidate,omitempty"`
	LearningCheck  *LearningCheck `json:"learning_check,omitempty"`
	EvolutionID    string         `json:"evolution_id,omitempty"`
	TaskID         string         `json:"task_id,omitempty"`
	ReviewRevision string         `json:"review_revision,omitempty"`
	Relation       string         `json:"relation,omitempty"`
	EvidenceRefs   []string       `json:"evidence_refs,omitempty"`
	Rationale      string         `json:"rationale,omitempty"`
	SupersededBy   string         `json:"superseded_by,omitempty"`
}

type Result

type Result struct {
	Intent     string  `json:"intent"`
	Record     *Record `json:"record,omitempty"`
	Relation   string  `json:"relation,omitempty"`
	Changed    bool    `json:"changed"`
	Idempotent bool    `json:"idempotent,omitempty"`
	Message    string  `json:"message,omitempty"`
}

type Service

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

func New

func New(configProvider func() config.Config, tasks *taskstate.Store) *Service

func (*Service) Candidates

func (s *Service) Candidates(ctx context.Context, task taskstate.Task) ([]taskstate.EvolutionContextItem, error)

func (*Service) Guidance

func (*Service) Manage

func (s *Service) Manage(ctx context.Context, req Request) (Result, error)

func (*Service) ResolveBindings

func (s *Service) ResolveBindings(ctx context.Context, task taskstate.Task) error

ResolveBindings 只消费执行前已经绑定的 learning check。final_review 的 pass/failed 只用于选择预声明的分支,本身不带 support/contradict 语义。

func (*Service) ValidateBindings

func (s *Service) ValidateBindings(ctx context.Context, task taskstate.Task, bindings []taskstate.EvolutionBinding) ([]taskstate.EvolutionBinding, error)

ValidateBindings validates create-time learning checks before a Task is persisted. A support-bearing check is an explicit blinded validation: the target Evolution will be withheld from this Task's Guidance for its whole lifetime, while the normal anti-self-proof rule still rejects any target the Task has already seen or derives from.

Jump to

Keyboard shortcuts

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