adapters

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorityQualified       = authority.TraceQualified
	AuthorityUnavailable     = authority.TraceObjectUnavailable
	AuthorityAncestryBound   = authority.TraceAncestryBound
	AuthorityPathUntracked   = authority.TracePathUntracked
	AuthorityInvalidIdentity = authority.TraceInvalidIdentity
	AuthorityInterrupted     = authority.TraceInterrupted
)
View Source
const MaxConfiguredArtifacts = 10_000

Variables

This section is empty.

Functions

func AggregateTraceMembers

func AggregateTraceMembers(snapshotHead model.RepositoryWitness, input []VerifiedTraceMember) (TraceAggregate, AdapterIssueCode)

func MergeTraceUsageMetrics

func MergeTraceUsageMetrics(inputs []model.MetricInput) ([]model.MetricInput, error)

MergeTraceUsageMetrics groups per-source trace rows by the snapshot's exact metric key and unions their source IDs. Counts and denominators are checked sums, so multiple configured trace sources cannot create duplicate keys.

func Registrations

func Registrations() []model.AdapterRegistration

Registrations converts the closed registry into model inputs. The model is responsible for canonical validation and the registry-domain hash.

func Scan

func Scan(ctx context.Context, request ScanRequest) ([]byte, error)

Scan performs exactly one dashboard acquisition/compile attempt. The caller owns Authority construction, terminal Finish/cleanup, and whole-attempt retry. SourceBudget is caller-owned and is never refunded.

func TraceModelInputs

func TraceModelInputs(configuredOrdinal uint64, aggregate TraceAggregate, members []VerifiedTraceMember, dirtyPathsSHA256 *string, completeness model.Completeness, terminalCounts []TraceTerminalCount) (model.SourceInput, []model.MetricInput, []model.IssueInput, error)

TraceModelInputs translates one fully verified default trace-store aggregate into the model's closed source and retained-usage inputs. Paths, tasks, commands, trace IDs, and verifier errors are absent by construction.

func TraceTerminalIssueInputs

func TraceTerminalIssueInputs(sourceID string, counts []TraceTerminalCount) ([]model.IssueInput, []string, error)

TraceTerminalIssueInputs converts the closed rejected-member count set into exact model inputs and the corresponding sorted exclusion IDs. It cannot represent aggregate controls or zero/duplicate terminal counts.

func ValidateStableTraceContent

func ValidateStableTraceContent(ctx context.Context, content source.StableContent, expectedRevision string, authority TraceAuthority) (TraceSummary, AdapterIssueCode, *ScanError)

ValidateStableTraceContent consumes immutable bytes during source.Read's StableConsumer callback. StableContent must not escape that callback; the caller retains only this normalized summary and the eventual source.Result.

func ValidateTraceArtifact

func ValidateTraceArtifact(ctx context.Context, body []byte, expectedRevision string, authority TraceAuthority) (TraceSummary, AdapterIssueCode, *ScanError)

ValidateTraceArtifact verifies exactly one revision-named local trace artifact. The expected revision comes from the qualified filename grammar, never from a default or current-path discovery.

Types

type AdapterID

type AdapterID string

AdapterID identifies one compiled dashboard adapter. Values are closed by Registry and cannot be selected by artifact contents.

const (
	AdapterStableRead     AdapterID = "stable-read-v0"
	AdapterLocalTrace     AdapterID = "local-trace-v1"
	AdapterCEMOCMBundle   AdapterID = "cem-ocm-bundle-v0"
	AdapterQueryEnvelope  AdapterID = "query-envelope-v1"
	AdapterImpactEnvelope AdapterID = "impact-envelope-v1"
	AdapterHeadSpecIndex  AdapterID = "head-spec-index-v0"
	AdapterBeamfallShadow AdapterID = "beamfall-shadow-v0"
	AdapterPulseDogfood   AdapterID = "pulse-dogfood-v0"
	AdapterHarnessUsage   AdapterID = "harness-usage-v0"
	AdapterGoLiveUsage    AdapterID = "go-live-usage-v0"
	AdapterFrontierUsage  AdapterID = "frontier-usage-v0"
)

type AdapterIssueCode

type AdapterIssueCode string
const (
	IssueVerifierRejected            AdapterIssueCode = "VERIFIER_REJECTED"
	IssueSourceInvalidSchema         AdapterIssueCode = "SOURCE_INVALID_SCHEMA"
	IssueSourceInvalidIdentity       AdapterIssueCode = "SOURCE_INVALID_IDENTITY"
	IssueRepositoryObjectUnavailable AdapterIssueCode = "REPOSITORY_OBJECT_UNAVAILABLE"
	IssueTraceAncestryBound          AdapterIssueCode = "TRACE_ANCESTRY_BOUND"
	IssueTraceStoreBound             AdapterIssueCode = "TRACE_STORE_BOUND"
)

type AuthorityCode

type AuthorityCode = authority.TraceCode

type CEMOCMBinding

type CEMOCMBinding struct {
	CEMPath      string
	OCMPath      string
	ExpectedBase string
	Target       string
	Profile      string
}

type ConfiguredSource

type ConfiguredSource struct {
	AdapterID    AdapterID
	RelativePath string
}

type DeliveryStage

type DeliveryStage string
const (
	DeliveryNotStarted  DeliveryStage = "NOT_STARTED"
	DeliveryUnsupported DeliveryStage = "UNSUPPORTED"
)

type Descriptor

type Descriptor struct {
	AdapterID        AdapterID
	AcceptedProfiles []string
	DefaultLocation  *string
	DeliveryStage    DeliveryStage
	IssueCodes       []string
	MaxBytes         string
	SourceKind       string
	VerifierID       string
}

Descriptor is the complete compiled registry row. Slices returned by Registry are independent copies so callers cannot mutate registry truth.

func Lookup

func Lookup(adapterID AdapterID) (Descriptor, bool)

func Registry

func Registry() []Descriptor

Registry returns all registry rows sorted by adapter ID.

type ScanError

type ScanError struct{ Code string }

func (*ScanError) Error

func (failure *ScanError) Error() string

type ScanRequest

type ScanRequest struct {
	Root         string
	Sources      []ConfiguredSource
	CEMOCM       *CEMOCMBinding
	GeneratedAt  *string
	ClockSource  string
	Authority    authority.Authority
	SourceBudget *source.Budget
}

type TraceAggregate

type TraceAggregate struct {
	Members          []TraceMember
	ByteCount        uint64
	RetainedRows     uint64
	ContentSHA256    string
	ObservationStart *string
	ObservationEnd   *string
	// contains filtered or unexported fields
}

type TraceAuthority

type TraceAuthority = authority.TraceQualifier

type TraceAuthorityResult

type TraceAuthorityResult = authority.TraceQualification

type TraceMember

type TraceMember struct {
	Revision      string `json:"revision"`
	ContentSHA256 string `json:"contentSha256"`
	ByteCount     string `json:"byteCount"`
}

type TraceOutcomeCount

type TraceOutcomeCount struct {
	Outcome string
	Count   uint64
}

type TracePathWitness

type TracePathWitness = authority.PathWitness

type TraceSummary

type TraceSummary struct {
	Revision     string
	TreeRevision string
	ObjectFormat string
	RetainedRows uint64
	Outcomes     []TraceOutcomeCount
	// contains filtered or unexported fields
}

TraceSummary is the only trace-derived adapter output. Raw trace IDs, task text, paths, commands, prompts, and errors are deliberately unrepresentable.

type TraceTerminalCount

type TraceTerminalCount struct {
	Code  AdapterIssueCode
	Count uint64
}

type UnavailableState

type UnavailableState struct {
	AdapterID      AdapterID
	Validity       string
	EpistemicClass string
	AuthorityClass string
	Completeness   string
	DeliveryStage  DeliveryStage
}

func Unavailable

func Unavailable(adapterID AdapterID) (UnavailableState, bool)

Unavailable returns the required fail-closed base state for a registered adapter that has no delivered verifier. It deliberately accepts no path or artifact bytes, so filename discovery cannot upgrade delivery.

type VerifiedTraceMember

type VerifiedTraceMember struct {
	Summary       TraceSummary
	ContentSHA256 string
	ByteCount     uint64
	Start         string
	End           string
}

Jump to

Keyboard shortcuts

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