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

nativetask

package
v0.39.0 Latest Latest
Warning

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

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

Documentation

Overview

Package nativetask contains engine-free internal draft protocol primitives. It does not resolve or execute task sources, register a public profile, or certify the authenticity, accounting, runtime or assurance of supplied data.

Index

Constants

View Source
const (
	CollectionExecutableBytes = controlledprojection.CollectionExecutableBytes
	CollectionSourceBytes     = controlledprojection.CollectionSourceBytes
)
View Source
const (
	CollectionStreamBytes = 16 << 20
)

Variables

This section is empty.

Functions

func CollectionRequestDigest

func CollectionRequestDigest(req *execution.ExecutionRequest) (models.EvidenceDigest, error)

func MatchCollectionSnapshot

func MatchCollectionSnapshot(ctx context.Context, admitted *Admitted, expectedKey releasepolicy.AttemptKey, req *execution.ExecutionRequest, sources []CapturedSource) error

MatchCollectionSnapshot admits the separately selected 2.0 collection inventory budget, including the retained evaluator executable.

func MatchSnapshot

func MatchSnapshot(ctx context.Context, admitted *Admitted, expectedKey releasepolicy.AttemptKey, req *execution.ExecutionRequest, sources []CapturedSource) error

MatchSnapshot only compares retained inputs. It performs no source reads, preparation, admission, execution, policy allocation or producer acceptance.

func MatchVerifiedCollectionSnapshot

func MatchVerifiedCollectionSnapshot(ctx context.Context, admitted *Admitted, expectedKey releasepolicy.AttemptKey, req *execution.ExecutionRequest, verified VerifiedCollectionSources) error

MatchVerifiedCollectionSnapshot compares a previously verified immutable descriptor inventory. Its CollectionCapture caller still rechecks current rooted source bytes before every attempted execution.

Types

type Accounting

type Accounting struct {
	SessionKey               *models.EvidenceDigest `json:"session_key"`
	Source                   string                 `json:"source"`
	Complete                 bool                   `json:"complete"`
	ModelAttributionComplete bool                   `json:"model_attribution_complete"`
	Models                   []string               `json:"models"`
	Usage                    *models.UsageStats     `json:"usage"`
	ProviderCurrencyState    string                 `json:"provider_currency_state"`
	Reason                   string                 `json:"reason,omitempty"`
}

type Admission

type Admission struct {
	CollectionID  string                   `json:"collection_id"`
	PolicyDigest  models.EvidenceDigest    `json:"policy_digest"`
	ProfileDigest models.EvidenceDigest    `json:"profile_digest"`
	PlanDigest    models.EvidenceDigest    `json:"resolved_plan_digest"`
	RequestDigest models.EvidenceDigest    `json:"request_digest"`
	Key           releasepolicy.AttemptKey `json:"key"`
}

type Admitted

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

func Admit

func Admit(ctx context.Context, p *Prepared, profile *Profile, key releasepolicy.AttemptKey) (*Admitted, error)

Admit checks internal linkage only, not current policy allocation or sources.

func (*Admitted) Binding

func (a *Admitted) Binding() (Admission, error)

type ArmPlan

type ArmPlan struct {
	PlanDigest models.EvidenceDigest `json:"resolved_plan_digest"`
	Requests   []RequestPlan         `json:"requests"`
}

type Capabilities

type Capabilities struct {
	FullToolTape, Session, RuntimeVersion, ProviderCurrency, Assurance string
}

Capabilities describe this draft reader, independently of legacy row defaults and received model-attribution completeness. None is a producer attestation.

type CapturedSource

type CapturedSource struct {
	Executable bool
	Path       string
	Bytes      string
	Digest     models.EvidenceDigest
}

CapturedSource carries immutable byte values, not roots or supplied seals. Bytes is a string solely to avoid shared mutable byte storage; it is not text. Values supplied directly to MatchSnapshot are not resolver authenticity.

type Diagnostic

type Diagnostic struct {
	Stage      string                 `json:"stage"`
	Code       string                 `json:"code"`
	SessionKey *models.EvidenceDigest `json:"session_key"`
}

Stage and Code are sanitized string projections, not imported native hooks.

type Event

type Event struct {
	Kind         string                 `json:"kind"`
	Version      string                 `json:"version"`
	Sequence     int                    `json:"sequence"`
	Type         string                 `json:"type"`
	Admission    Admission              `json:"admission"`
	State        string                 `json:"state,omitempty"`
	RecordDigest *models.EvidenceDigest `json:"record_digest,omitempty"`
	RowDigest    *models.EvidenceDigest `json:"row_digest,omitempty"`
}

type EventModels

type EventModels struct {
	Models         []string `json:"models"`
	EventsObserved uint64   `json:"events_observed"`
	Complete       bool     `json:"complete"`
}

type Lifecycle

type Lifecycle struct {
	Construction Phase `json:"construction"`
	Initialize   Phase `json:"initialize"`
	Execute      Phase `json:"execute"`
	Grade        Phase `json:"grade"`
	Shutdown     Phase `json:"shutdown"`
}

type Message

type Message struct {
	EventOrdinal    int    `json:"event_ordinal"`
	Content         string `json:"content"`
	ContentPresence string `json:"content_presence"`
}

type Output

type Output struct {
	Availability string    `json:"availability"`
	Value        *string   `json:"value,omitempty"`
	Messages     []Message `json:"messages"`
	Reason       string    `json:"reason,omitempty"`
}

type Phase

type Phase struct {
	State  string `json:"state"`
	Reason string `json:"reason,omitempty"`
}

type Prefix

type Prefix struct {
	Records []Record
	Pending *Admission
}

func InspectCollectionPrefix

func InspectCollectionPrefix(ctx context.Context, events, payload []byte, admissions []*Admitted) (*Prefix, error)

InspectCollectionPrefix selects public 2.0 preparation and stream bounds. It does not widen InspectPrefix's private 1.0 admission limits.

func InspectPrefix

func InspectPrefix(ctx context.Context, events, payload []byte, admissions []*Admitted) (*Prefix, error)

InspectPrefix validates supplied bytes without filesystem access. Nil inputs are unsupplied; nonnil empty inputs are supplied empty tapes. Callers must retain that presence distinction separately from Records and Pending. Torn/orphan data is invalid, and errors never return a partial prefix. This does not establish execution, persistence acknowledgement or authority.

func ReadPrefix

func ReadPrefix(ctx context.Context, root *os.Root, admissions []*Admitted) (*Prefix, error)

ReadPrefix checks local structure only. Pending/crashed collections are not complete evidence; there is no final ledger or pass field in this primitive.

type Prepared

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

func Prepare

func Prepare(ctx context.Context, arm releasepolicy.Arm, taskID string, req *execution.ExecutionRequest, sources []Source) (*Prepared, error)

Prepare freezes supplied resolved inputs, not their native source resolution. The future producer must independently verify declaration/request equivalence.

func PrepareCaptured

func PrepareCaptured(ctx context.Context, arm releasepolicy.Arm, taskID string, req *execution.ExecutionRequest, sources []CapturedSource) (*Prepared, error)

PrepareCaptured binds a retained inventory's exact source digests without duplicating executable/source bytes per attempt. The collection capture owns those bytes; MatchCollectionSnapshot independently rechecks every one.

func PrepareVerifiedCaptured

func PrepareVerifiedCaptured(ctx context.Context, arm releasepolicy.Arm, taskID string, req *execution.ExecutionRequest, verified VerifiedCollectionSources) (*Prepared, error)

PrepareVerifiedCaptured reuses a descriptor inventory admitted by VerifyCollectionSources. Its opaque source list cannot be changed by callers.

func (*Prepared) RequestDigest

func (p *Prepared) RequestDigest() models.EvidenceDigest

type Profile

type Profile struct {
	Kind           string                        `json:"kind"`
	Version        string                        `json:"version"`
	Digest         models.EvidenceDigest         `json:"digest"`
	Nonce          string                        `json:"nonce"`
	Selection      Selection                     `json:"selection"`
	PolicyDigest   models.EvidenceDigest         `json:"policy_digest"`
	PermissionMode string                        `json:"permission_mode"`
	Arms           map[releasepolicy.Arm]ArmPlan `json:"arms"`
}

func DecodeProfile

func DecodeProfile(raw []byte) (*Profile, error)

type Record

type Record struct {
	Kind          string                       `json:"kind"`
	Version       string                       `json:"version"`
	CollectionID  string                       `json:"collection_id"`
	PolicyDigest  models.EvidenceDigest        `json:"policy_digest"`
	ProfileDigest models.EvidenceDigest        `json:"profile_digest"`
	PlanDigest    models.EvidenceDigest        `json:"resolved_plan_digest"`
	RequestDigest models.EvidenceDigest        `json:"request_digest"`
	Key           releasepolicy.AttemptKey     `json:"key"`
	Origin        models.EvidenceOrigin        `json:"origin"`
	Lifecycle     Lifecycle                    `json:"lifecycle"`
	Response      *Response                    `json:"response"`
	Output        Output                       `json:"output"`
	Diagnostics   []Diagnostic                 `json:"diagnostics"`
	EventModels   EventModels                  `json:"event_models"`
	Accounting    Accounting                   `json:"accounting"`
	ActualRow     releasepolicy.ActualRunRow   `json:"actual_row"`
	Summary       releasepolicy.AttemptSummary `json:"summary"`
}

func DecodeRecord

func DecodeRecord(raw []byte, admitted *Admitted) (*Record, error)

DecodeRecord validates supplied draft data; success is not producer admission. In particular, no observed runtime, review, billing or assurance is inferred.

func (*Record) Capabilities

func (*Record) Capabilities() Capabilities

type RequestPlan

type RequestPlan struct {
	TaskID        string                `json:"task_id"`
	RequestDigest models.EvidenceDigest `json:"request_digest"`
}

type Response

type Response struct {
	SessionKey        *models.EvidenceDigest    `json:"session_key"`
	SessionReason     string                    `json:"session_reason,omitempty"`
	Success           bool                      `json:"success"`
	ErrorMsg          string                    `json:"error_msg"`
	FinalOutput       string                    `json:"final_output"`
	DurationMS        int64                     `json:"duration_ms"`
	CanonicalEvents   []json.RawMessage         `json:"canonical_events"`
	ToolPolicyMode    string                    `json:"tool_policy_mode"`
	ToolPolicyDenials []models.ToolPolicyDenial `json:"tool_policy_denials"`
	UsageIsCumulative bool                      `json:"usage_is_cumulative"`
	UsageRevision     uint64                    `json:"usage_revision"`
	Usage             *models.UsageStats        `json:"usage"`
}

type Selection

type Selection struct {
	Operation string `json:"operation"`
	Version   string `json:"version"`
}

type Source

type Source struct {
	Root *os.Root
	Path string
}

type Tape

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

Tape only acknowledges local payload/event persistence. It does not append a core terminal, publish a final ledger, or prove a producer executed anything.

func CreateCollectionTape

func CreateCollectionTape(ctx context.Context, parent *os.Root, name string) (*Tape, error)

CreateCollectionTape selects the public collection's bounded stream contract. Private tape creation retains its existing admission and persistence behavior.

func CreateTape

func CreateTape(ctx context.Context, parent *os.Root, name string) (_ *Tape, err error)

func (*Tape) Close

func (t *Tape) Close() error

func (*Tape) Complete

func (t *Tape) Complete(ctx context.Context, raw []byte) error

Complete requires full raw admission BEFORE any write. A failure poisons the tape: no truncation, repair, next attempt or successful terminal is permitted.

func (*Tape) Start

func (t *Tape) Start(ctx context.Context, admitted *Admitted) error

type VerifiedCollectionSources

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

VerifiedCollectionSources is an immutable descriptor inventory whose byte identities were checked when it was constructed. It is intended for a CollectionCapture that separately rechecks its rooted sources before each attempt; callers with arbitrary inventories must use PrepareCaptured.

func VerifyCollectionSources

func VerifyCollectionSources(ctx context.Context, sources []CapturedSource) (VerifiedCollectionSources, error)

VerifyCollectionSources validates and freezes an immutable descriptor inventory. It does not grant execution permission or replace currentness checks against the source root.

Jump to

Keyboard shortcuts

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