inspect

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inspect publishes immutable, authorized experiment evidence.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound does not disclose unknown or unauthorized identities.
	ErrNotFound = errors.New("inspect: not found")
	// ErrInvalidInput reports invalid host configuration or read bounds.
	ErrInvalidInput = errors.New("inspect: invalid input")
	// ErrIntegrity reports evidence whose persisted identity cannot be verified.
	ErrIntegrity = errors.New("inspect: integrity failure")
)

Functions

This section is empty.

Types

type ArtifactContent

type ArtifactContent struct {
	Role         Role
	Kind         Kind
	Name         string
	MediaType    string
	SourceDigest string
	Data         []byte
}

ArtifactContent supplies owned artifact bytes to a publication-time host redactor.

type ArtifactRedactor

type ArtifactRedactor func(ArtifactContent) (data []byte, include bool, err error)

ArtifactRedactor approves, transforms or withholds artifact data without changing scope.

type Attachment

type Attachment struct {
	Name       string
	Kind       Kind // TaskSource, DecisionNote, EvaluatorReference only
	MediaType  string
	Data       []byte
	Audiences  []Role
	Provenance string
}

Attachment submits owned host bytes with explicit audience grants.

type ComponentChange

type ComponentChange struct {
	Name          string `json:"name"`
	Operation     string `json:"operation"` // add/delete/modify
	BeforeDigest  string `json:"before_digest,omitempty"`
	AfterDigest   string `json:"after_digest,omitempty"`
	BeforeLocator string `json:"before_locator,omitempty"`
	AfterLocator  string `json:"after_locator,omitempty"`
}

ComponentChange links a deterministic component change to its exact before and after contents.

type Entry

type Entry struct {
	Locator         string      `json:"locator"`
	Kind            Kind        `json:"kind"`
	Label           string      `json:"label"`
	MediaType       string      `json:"media_type,omitempty"`
	State           State       `json:"state"`
	Size            *int64      `json:"size,omitempty"`          // pointer preserves available zero bytes
	Digest          string      `json:"digest,omitempty"`        // SHA256 of RETURNED full body
	SourceDigest    string      `json:"source_digest,omitempty"` // original source, editor/evaluator only
	RendererVersion string      `json:"renderer_version,omitempty"`
	SourceLocator   string      `json:"source_locator,omitempty"`
	Links           []string    `json:"links,omitempty"` // authorized view-local locators only
	Provenance      *Provenance `json:"provenance,omitempty"`
	Incomplete      bool        `json:"incomplete,omitempty"`
	Code            string      `json:"code,omitempty"` // safe fixed diagnostic, never OS/callback text
}

Entry describes one role-approved artifact; missing sizes and digests remain absent.

type Kind

type Kind string

Kind identifies a structurally authorized evidence category.

const (
	// TaskSource identifies a host-retained task attachment.
	TaskSource Kind = "task_source"
	// BaselineComponent identifies immutable baseline bytes.
	BaselineComponent Kind = "baseline_component"
	// CandidateComponent identifies immutable candidate bytes.
	CandidateComponent Kind = "candidate_component"
	// ComponentDiff identifies deterministic structured component changes.
	ComponentDiff Kind = "component_diff"
	// RunView identifies an approved canonical root-run projection.
	RunView Kind = "run_view"
	// CallView identifies one approved canonical model call.
	CallView Kind = "call_view"
	// Deliverable identifies declared retained output bytes.
	Deliverable Kind = "deliverable"
	// DecisionNote identifies opaque application-owned decision data.
	DecisionNote Kind = "decision_note"
	// EvaluatorReference identifies structurally evaluator-only reference data.
	EvaluatorReference Kind = "evaluator_reference"
	// Rendered identifies a versioned host rendering of an exact source.
	Rendered Kind = "rendered"
)

type Limits

type Limits struct {
	MaxArtifactBytes int64
	MaxEntries       int
	MaxPageEntries   int
	MaxReadBytes     int
}

Limits sets positive host ceilings; no field supports unlimited access.

func DefaultLimits

func DefaultLimits() Limits

DefaultLimits returns 16 MiB per body, 4096 entries, 100 rows and 64 KiB per read.

type ListQuery

type ListQuery struct {
	Offset int `json:"offset,omitempty"`
	Limit  int `json:"limit,omitempty"`
}

ListQuery pages rows within an already authorized view.

type ManifestRef

type ManifestRef string

ManifestRef is an immutable semantic manifest SHA256 handle.

type Origin

type Origin struct {
	ExperimentID string
	Key          eval.AttemptKey
}

Origin binds evidence to one complete experiment attempt identity.

type Page

type Page struct {
	Entries    []Entry `json:"entries"`
	Total      int     `json:"total"`
	NextOffset *int    `json:"next_offset,omitempty"`
	Truncated  bool    `json:"truncated"`
}

Page returns bounded rows and an explicit continuation offset.

type Policy

type Policy struct {
	Role            Role
	Name            string // nonblank exact versioned policy identity
	RunContent      func(runrecord.ProjectionContent) (jsontext.Value, bool, error)
	ArtifactContent ArtifactRedactor
}

Policy materializes one named role projection using host-owned callbacks.

type Provenance

type Provenance struct {
	ExperimentID    string           `json:"experiment_id,omitempty"`
	Key             *eval.AttemptKey `json:"attempt,omitempty"`
	RunID           string           `json:"run_id,omitempty"`
	Step            int              `json:"step,omitempty"`
	CallSeq         int              `json:"call_seq,omitempty"`
	CallAttempt     int              `json:"call_attempt,omitempty"`
	CandidateDigest string           `json:"candidate_digest,omitempty"`
	BaselineDigest  string           `json:"baseline_digest,omitempty"`
	Note            string           `json:"note,omitempty"`
}

Provenance attributes evidence for editor and evaluator views only.

type Publication

type Publication struct {
	Origin               Origin
	BaselineDigest       string
	CandidateDigest      string
	ExpectedDeliverables []eval.Deliverable
	Attachments          []Attachment
	Renderings           []Rendering
	Policies             []Policy // unique roles; each materializes immutable role bytes
	// Provisional means bytes were retained without confirmed quiescence.
	Provisional bool // explicit host truth for capture-only/unfinalized evidence
}

Publication retains exact source evidence and materializes immutable role views.

type ReadQuery

type ReadQuery struct {
	Locator  string `json:"locator"`
	Offset   int64  `json:"offset,omitempty"`
	MaxBytes int    `json:"max_bytes,omitempty"`
}

ReadQuery pages exact bytes from an authorized opaque locator.

type ReadResult

type ReadResult struct {
	Entry      Entry  `json:"entry"`
	Data       []byte `json:"data,omitempty"` // JSON base64; Go caller receives bytes
	Offset     int64  `json:"offset"`
	Total      *int64 `json:"total,omitempty"`
	NextOffset *int64 `json:"next_offset,omitempty"`
	Truncated  bool   `json:"truncated"`
}

ReadResult returns bounded owned bytes; nil Total means missing or withheld content.

type Rendering

type Rendering struct {
	Name            string
	SourceKind      Kind // TaskSource, Deliverable or the two component kinds
	SourceName      string
	SourceDigest    string // exact raw source SHA256; verified before publication
	MediaType       string
	Data            []byte
	RendererVersion string
	Audiences       []Role
}

Rendering submits host-rendered bytes tied to an exact source digest and renderer version.

type Role

type Role string

Role identifies a host-selected evidence audience.

const (
	// Solver permits only explicitly granted task inputs.
	Solver Role = "solver"
	// Editor permits authorized sources, components, observations and notes.
	Editor Role = "editor"
	// Selector permits sources and outputs under opaque labels.
	Selector Role = "selector"
	// Evaluator permits authorized observations and explicit reference attachments.
	Evaluator Role = "evaluator"
)

type Scope

type Scope struct{ Manifests []ManifestRef }

Scope names a finite set of immutable manifests, without wildcard expansion.

type State

type State string

State distinguishes retained, missing, withheld and provisional content.

const (
	// Available means exact retained bytes are readable.
	Available State = "available"
	// Missing means evidence is unavailable; empty content is separate.
	Missing State = "missing"
	// Withheld means a host-granted entry was intentionally omitted.
	Withheld State = "withheld"
	// Provisional means bytes were retained without confirmed quiescence.
	Provisional State = "provisional"
)

type View

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

View binds a finite manifest scope to one host-authorized role and policy.

func (*View) List

func (v *View) List(ctx context.Context, q ListQuery) (Page, error)

List returns only rows authorized by the host-bound view, under server caps.

func (*View) Read

func (v *View) Read(ctx context.Context, q ReadQuery) (ReadResult, error)

Read returns exact bytes from one authorized locator with bounded pagination.

type ViewPolicy

type ViewPolicy struct {
	Role Role
	Name string // must match role policy materialized in every scoped manifest
}

ViewPolicy rebinds a previously published role and exact policy identity.

type Workspace

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

Workspace retains immutable evidence while reusing candidate and experiment stores.

func Open

func Open(dir string, experiments *eval.Store, candidates *candidate.Store, limits Limits) (*Workspace, error)

Open opens a host-owned workspace without changing original evidence stores.

func (*Workspace) Publish

func (w *Workspace) Publish(ctx context.Context, input Publication) (ManifestRef, error)

Publish retains role-approved evidence as one immutable, content-addressed manifest.

func (*Workspace) View

func (w *Workspace) View(scope Scope, policy ViewPolicy) (*View, error)

View binds a finite immutable scope and a previously materialized host policy.

Jump to

Keyboard shortcuts

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