walkthrough

package
v0.143.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

README

pkg/walkthrough — declaration, pin and checkpoint contracts

Pure Go implementation of the walkthrough contracts owned by spec/features/project-walkthroughs/declaration-format.md in datatug/backstage:

  • the ordinary datatug-walkthrough/1 declaration;
  • the opt-in datatug-walkthrough/2 training declaration additions;
  • immutable asset/package references and source pins;
  • the public story registry entry shape and owner-context alias admission;
  • the external checkpoint envelope shape, its owner-resolved admission and pure match decisions.

It validates bytes supplied by a caller and returns typed projections or structured recoverable issues. It never reads a project, navigates, publishes or consumes activity, stores progress, runs SQL or checks, mutates Work or renders UI. This package is a contract, not the walkthrough runtime.

/1 API

result := walkthrough.ParseDeclaration(directoryID, declarationBytes)
if result.NewerClient {
    // the declaration names a schema major this client cannot parse
}
if !result.Accepted {
    // result.Definition is nil; result.Issues is a stable {Code, Path, Message}
}
definition := result.Definition // typed, fully validated, defensively owned
revision := result.Digest       // SHA-256 of the exact input bytes

Declaration.Projection() is the stable, language-neutral normalized view shared with the TypeScript contract and the conformance corpus. It exposes defaults, capture references, support status, entry steps and the digest; it does not expose presentation prose.

A /2 declaration passed to ParseDeclaration is still reported as Result.NewerClient, exactly as before the /2 entry point existed.

/2 training API

parsed := walkthrough.ParseTrainingDeclaration(directoryID, declarationBytes)
if !parsed.Accepted {
    // parsed.Definition is nil; the /2-only fields were refused
}
declaration := parsed.Definition // structurally valid only

resolution := walkthrough.ResolveTraining(
    declaration,
    walkthrough.SourceContext{Project: identity, ContentPin: pin, DeclarationSHA256: digest},
    projectAuthority, // trusted opaque owner adapter
    trainingOwners,   // trusted validated package/asset/challenge lookup
)
if !resolution.Admitted {
    // structured refusal; no admitted executable bundle is exposed
}
bundle := resolution.Bundle

ParseTrainingDeclaration is a distinct explicit entry point. It shares the JSON/variant machinery without widening ordinary /1 admission: an unknown target or condition kind stays step-local needs-newer, while an unknown step kind, a wrong variant pairing, a malformed checkpoint mapping or an unsafe pin refuses the package. A structurally valid parse is never called "render-ready": package, Case, asset and challenge authority come only from ResolveTraining.

TrainingDeclaration.Projection() extends the ordinary normalized view with the package and narrative references, the step kind/segmentId and the checkpoint mapping. TrainingDeclaration.WalkthroughIdentity() returns the declared walkthrough identity used by registry admission.

Source pins and owner contexts

  • AssetReference is exactly path, sha256 (64 lowercase hex) and bytes (positive canonical lexeme). PackageReference adds id and revision. VerifyBytes checks the exact length and SHA-256 before any parse.
  • ContentPin is exactly one {kind: git, commit: <40 hex>} (normalized lowercase) or {kind: digest, sha256: <64 lowercase hex>}. A digest pin identifies the exact declaration bytes, so it must equal the parsed declaration digest at every binding point: ResolveTraining, registry admission, envelope admission and an active wait refuse a shape-valid record whose digest pin and declaration digest disagree.
  • ProjectIdentity is opaque. This package never interprets it, never builds a canonical project serialization and never compares identities itself: ProjectAuthority supplies BindProject/AdmitProject/EqualProject. Production adapters reuse the owning project-context normalization; test doubles prove wiring only. Snapshotting the opaque identity value stays the owner adapter's responsibility.
  • Admission takes an independent snapshot of every contract-owned input. A parsed declaration remains caller-owned and mutable, but an admitted bundle never aliases it, and the envelope owns a copy of the exact project byte span it was parsed from.
  • TrainingOwnerContext supplies the admitted package inventory, asset admission and the exact owner-validated challenge manifest. There is no fallback to an ordinary service, no invented package document and no trusted "passed" boolean.

Story registry and checkpoint envelope

ParseStoryRegistryEntry reads the closed shape storyId/revision/projectUrl/walkthroughId/contentPin/declarationSha256. AdmitStoryChapter then requires an owner-established canonical immutable URL, an owner-established public scope, exact pin agreement and a declared chapter; it returns a RouteDescriptor and never invents a walkthrough URL. Private/unknown scope refuses, and a historical pin mismatch never falls back to latest.

ParseCheckpointEnvelope reads exactly the owner fields, including the opaque project value (copied at parse and handed to the adapter as the exact input bytes). Inconsistent outcome/complete summaries refuse. AdmitCheckpointEnvelope resolves the project through the owner adapter and retains an independent copy of the project span; an inconsistent digest pin refuses. MatchCheckpointEnvelope and MatchRetainedCompletion return only a consume/revisit/no-match decision: consuming once, pause/scheduling, retained completion storage and authority lifecycle remain runtime owner work. There is no namespace field on the validation envelope, so a reference/Test-labelled payload is an unknown-field refusal, never a match.

Boundaries

  • Only /1 through ParseDeclaration, /2 through ParseTrainingDeclaration. Later majors are NewerClient for both explicit entry points; /1 rejects every /2-only field and /2 refuses a /1 document rather than down-converting it.
  • An unknown target or condition kind is step-local: the step is kept with SupportNeedsNewer, its opaque body is discarded rather than exposed or executed, and unrelated steps remain usable. Unknown target/condition kinds inside a /2 dialogue/challenge step keep that policy instead of becoming a fatal variant-pairing error.
  • Captures may be produced only by parameter-value, record-selected and incident-open, and never by a /2 dialogue or challenge step.
  • A finish/exit { "walkthrough": "<id>" } is checked against the ID grammar. Whether that walkthrough exists, and whether any target asset exists or is readable, is caller-owned external context.
  • Unknown fields reject at every object level. Field names are matched exactly; JSON decoding is hand-written because standard Go decoding is case-folding, replaces malformed UTF-8 and cannot enforce field presence or nested unions.
  • Escaped surrogates use the repository's established Go-compatible treatment: valid pairs become one code point, unpaired surrogates become U+FFFD in both values and keys. Character budgets count code points after normalization; byte budgets count exact input bytes.
  • Positive integers keep their canonical decimal lexeme with no machine-integer cap, so 2^53, the uint64 boundary and larger values survive exactly. Fractions, exponents, signs, zero and null refuse where a positive integer is required.

Shared locale profile

AdmitAuthoredLocale and NormalizeVisitorLocale are separate pure entry points for the /2 locale contract. Authored fields (sidecar defaults, catalogue references and catalogue documents) must use values registered in the pinned IANA snapshots, including the registered private-use ranges; an unknown but well-formed value is a recoverable unsupported_registry_version naming the snapshot. Visitor requests keep syntactically well-formed unknown values for the later exact / primary-language / fallback selector, while malformed syntax is a structured refusal rather than an ambient language.

Both paths enforce the 64-character input and canonical-output bound, ASCII hyphen-separated grammar, duplicate-variant and duplicate-singleton rejection, grandfathered/private-use recognition, registered whole-tag and subtag Preferred-Value mappings, contextual extlang replacement, explicit script and private-tail preservation, and extension-block ordering by singleton. Extension payloads stay opaque. The returned Tag is the canonical comparison key, so aliases that collide (for example iw-IL/he-IL) can be rejected as duplicate catalogue tags. PrimaryLanguage is the genuine regular primary language, or empty for private-use-only and unreplaced irregular grandfathered tags; this package does not implement the later catalogue selector.

The data lives in testdata/locale/: the exact official registry bytes, the checked-in table generator, locale-tables.json, its provenance and the independently authored expected-value corpus. Tests assert complete runtime inventory equality with the committed table and every registered grandfathered and redundant record. Regenerate only after an intentional pinned-snapshot change:

python3 pkg/walkthrough/testdata/locale/generate_locale_tables.py
go test ./pkg/walkthrough

Narrative sidecar, catalogues and closure

The pure /2 narrative slice is split into three modules:

  • narrative.go — ParseNarrativeSidecar (closed schema 1 shape, bounds, event registry, payloads, presentation hints and sidecar-local references) and ParseMessageCatalogue (closed catalogue with stable keys and plain text). Both return a typed snapshot or structured recoverable issues.
  • catalogue.go — SelectNarrativeLocale implements exactly the declared exact/primary-language/fallback selection using the accepted locale profile; accountNarrativeText deduplicates canonical source+path aliases, rejects conflicting pins, counts different paths separately and enforces the 6 MiB combined and 64 KiB per-text-asset budgets.
  • closure.go — AdmitNarrative binds the parsed sidecar to the admitted declaration, every pinned byte reference, the package text inventory and the trusted NarrativeOwnerContext. That extension composes the accepted a2 port and adds only typed Check, proposal, presentation-target and accounting snapshots. Every returned binding carries the exact project/source/ declaration/package key; a missing, kind-mismatched or drifting binding refuses before any admitted executable projection.

A3 is explicitly not a package loader. It neither reads a package index nor interprets native Check/query/manifest definitions, and it never runs SQL, Checks or Watches or creates Work. A test double proves closure against its declared typed inventories only. The caller must construct the context after the normative package-index/child-byte/codec/native-validation pipeline and keep it stable for the admission call.

Corpus

testdata/corpus.json is the canonical, language-neutral /1 conformance corpus (119 vectors, unchanged). testdata/corpus-v2.json is the separately versioned training corpus; each vector's operation selects the explicit entry point (training-declaration, checkpoint-envelope, story-registry-entry). Raw bytes live in testdata/declarations/ and testdata/declarations-v2/. Expected normalized projections are authored from the owner tables by the independent normalizer in testdata/generate_corpus.py; they are never produced by this package.

provenance-v2.json records every file hash, the training corpus hash and the hash of the unchanged base /1 corpus. testdata/corpus-v3.json is the separately versioned narrative/catalogue/closure corpus; its operation field selects narrative-sidecar, message-catalogue, locale-selection or narrative-admission. provenance-v3.json records every new raw byte file and the unchanged v2 corpus hash. Raw bytes live under testdata/narrative/. Regenerate fixtures after an intentional corpus change:

python3 pkg/walkthrough/testdata/generate_corpus.py
python3 pkg/walkthrough/testdata/generate_narrative_corpus.py
go test ./pkg/walkthrough

The TypeScript mirror copies these bytes identically and records the Core commit and per-file SHA-256 in its fixture provenance.

Documentation

Overview

Package walkthrough owns the pure walkthrough contracts: the ordinary `datatug-walkthrough/1` declaration, the opt-in `datatug-walkthrough/2` training declaration additions, immutable asset/package references and source pins, the public story registry shape and the external checkpoint envelope with its pure match decisions.

The package is deliberately passive. It reads bytes supplied by a caller, validates them against the normative owner tables in `datatug/backstage` `spec/features/project-walkthroughs/declaration-format.md` and returns either typed definitions or structured recoverable issues. It never reads a project, opens a route, publishes or consumes activity signals, records progress, runs SQL or checks, mutates Work, or renders UI. Owner authority (project identity, package inventory, Case and challenge admission) enters only through the explicit trusted ports in ProjectAuthority and TrainingOwnerContext.

Admission boundaries

  • A declaration is a UTF-8 JSON object of at most MaxDeclarationBytes.
  • The declaration ID must equal the directory ID in `walkthroughs/<id>/walkthrough.json` (DeclarationPath).
  • The revision is the SHA-256 of the exact bytes supplied. It is never a hash of a reserialized object.
  • ParseDeclaration admits ordinary /1 only; a /2 document is reported as Result.NewerClient exactly as before the explicit /2 entry point existed. ParseTrainingDeclaration admits exactly /2 and reports a later major as TrainingResult.NewerClient.
  • A structurally valid /2 parse is not a resolved admission. Package, Case, asset, challenge, project and source-pin authority require ResolveTraining; a refused resolution never exposes a bundle.
  • An unknown target or condition `kind` is a step-local newer-client boundary: the step is retained as SupportNeedsNewer, its opaque body is neither exposed nor executed, and unrelated steps remain usable.
  • Unknown fields on known variants are fatal. `/1` rejects every /2-only top-level or step field. Unknown step kinds and wrong /2 variant pairings reject the training package.
  • A refused declaration never yields a partially admitted executable definition.

Source pins

An asset reference is a safe project-root-relative path, a lowercase 64-hex digest and a positive byte count; a package reference adds its ID and revision. Supplied bytes are verified against the pin before any parse. A content pin is one immutable Git commit (normalized lowercase) or one exact content digest. A digest pin identifies the exact declaration bytes, so wherever it binds (resolution, registry admission, envelope admission and an active wait) it must equal the parsed declaration digest itself; a shape-valid record whose two digest fields disagree is never admitted. No canonical project serialization is invented here: project identity is an opaque value owned by the injected adapter, which also owns its snapshot.

Defensive snapshots

A parsed declaration, registry entry or envelope draft stays caller-owned and mutable. Admission takes an independent deep snapshot of every contract-owned input (chapters, steps, target/condition mappings, references, pins and the envelope's exact project byte span) and returns projections that never alias the caller's structures. Only the opaque project identity value itself remains the trusted owner adapter's snapshot responsibility.

Escaped surrogates

JSON permits unpaired UTF-16 surrogate escapes. Both this package and the TypeScript contract deliberately follow the repository's existing Go-compatible treatment: a valid high/low pair is one code point, and an unpaired surrogate becomes U+FFFD. The same treatment applies to object keys and to every string value, so a lone surrogate and a literal U+FFFD compare equal in both languages. Character budgets count Unicode code points after that normalization; byte budgets always count the exact input bytes.

Not in this package

Narrative/catalogue JSON schemas, events, presentation and branches, segment/chapter/event/reference closure, catalogue selection and localisation catalogues, aggregate text accounting, `/2` generation, seek and adapter handoffs, navigation, progress storage, activity delivery, target existence checks and Walkthrough UI are owned by later slices and other packages. The pure locale admission/canonicalization profile in AdmitAuthoredLocale and NormalizeVisitorLocale returns canonical data only; the exact/primary/fallback catalogue selector remains later work. The ordinary /1 user journey and the training runtime do not exist merely because these contracts do.

Index

Constants

View Source
const (
	MaxDeclarationBytes = 64 << 10
	MaxChapters         = 20
	MaxStepsPerChapter  = 30
	MaxSteps            = 200
	MaxTitleChars       = 120
	MaxTextChars        = 400
)

Ordinary /1 bounds from the normative owner declaration table.

View Source
const (
	ReasonMatched             = "matched"
	ReasonMissingContext      = "missing_context"
	ReasonWaitInvalid         = "wait_invalid"
	ReasonBindingUnvalidated  = "binding_not_validated"
	ReasonProjectMismatch     = "project_mismatch"
	ReasonAuthorityStale      = "authority_stale"
	ReasonPinMismatch         = "pin_mismatch"
	ReasonDeclarationMismatch = "declaration_mismatch"
	ReasonNarrativeMismatch   = "narrative_mismatch"
	ReasonPackageMismatch     = "package_mismatch"
	ReasonWalkthroughMismatch = "walkthrough_mismatch"
	ReasonChapterMismatch     = "chapter_mismatch"
	ReasonStepMismatch        = "step_mismatch"
	ReasonChallengeMismatch   = "challenge_mismatch"
	ReasonRevisionMismatch    = "revision_mismatch"
	ReasonCheckpointMismatch  = "checkpoint_mismatch"
	ReasonAttemptMismatch     = "attempt_mismatch"
	ReasonSubmissionStale     = "submission_stale"
	ReasonOutcomeNotPassed    = "outcome_not_passed"
	ReasonAttemptIncomplete   = "attempt_incomplete"
)

Stable matching reasons. They are decisions, not refusal issues.

View Source
const (
	// LocaleRegistryFileDate is the pinned IANA Language Subtag Registry File-Date.
	LocaleRegistryFileDate = "2026-09-17"
	// LocaleRegistrySHA256 is the SHA-256 of the exact retained registry bytes.
	LocaleRegistrySHA256 = "755fad43283be7b41ebe3c89ad054b6eaf928f404f9c0edb74799e0eab74beb1"
	// LocaleRegistryURL is the official source of LocaleRegistrySHA256.
	LocaleRegistryURL = "https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry"
	// LocaleExtensionsRegistryFileDate is the pinned extension registry File-Date.
	LocaleExtensionsRegistryFileDate = "2014-04-02"
	// LocaleExtensionsRegistrySHA256 is the SHA-256 of the retained extension bytes.
	LocaleExtensionsRegistrySHA256 = "fdf7764455c493c245a9b3b5b9cd3938391f0637302c3e943fde86aee652e376"
	// LocaleExtensionsRegistryURL is the official source of that snapshot.
	LocaleExtensionsRegistryURL = "https://www.iana.org/assignments/language-tag-extensions-registry/language-tag-extensions-registry"
	// LocaleTablesSHA256 is the SHA-256 of testdata/locale/locale-tables.json.
	LocaleTablesSHA256 = "7328cbddaa0f4450eeb730ebca222cedf9bd9c7a16a8037f3d3ad22a4e5ccad6"
)
View Source
const (
	MaxTextAssetBytes        = 64 << 10
	MaxNarrativeSidecarBytes = MaxTextAssetBytes
	MaxNarrativeTextBytes    = 6 << 20
	MaxCatalogueBytes        = 64 << 10
	MaxCatalogueMessages     = 1000
	MaxNarrativeCatalogues   = 20
	MaxNarrativeChapterRefs  = 20
	MaxNarrativeActors       = 50
	MaxNarrativeAssets       = 100
	MaxNarrativeSegments     = 200
	MaxNarrativeEvents       = 1000
	MaxNarrativeNameChars    = 120
	MaxNarrativeMediaType    = 120
	MaxPresentationDelayMs   = 10000
	MaxTypingCharsPerSecond  = 200
	MinTypingCharsPerSecond  = 5
)

Sidecar, catalogue and presentation bounds from the owner declaration and training-package formats. Every text asset, including the narrative sidecar, is bound by the independent 64 KiB per-text-asset cap. The parser applies it to the sidecar directly and admission accounting applies it to every other contributed text asset; the combined 6 MiB aggregate is likewise enforced during admission.

View Source
const (
	// PinGit is an immutable Git commit pin.
	PinGit = "git"
	// PinDigest is an immutable content-digest pin for cloud/local sources.
	PinDigest = "digest"
)
View Source
const (
	MaxPackageIndexBytes          = 1 << 20
	MaxPackageAssets              = 1000
	MaxPackageRecords             = 200
	MaxPackagePresentationTargets = 1000
	MaxCaseFindings               = 1000
	MaxCaseTimeline               = 1000
	MaxPackageTextBytes           = MaxNarrativeTextBytes
	MaxPackageBinaryBytes         = 64 << 20
	MaxTrainingTitleChars         = MaxTitleChars
	MaxTrainingDescriptionChars   = MaxTextChars
)

Package inventory bounds from the owner training-package format. They are separate from the declaration, narrative and challenge-owner bounds.

View Source
const CompletionWholeChallenge = "whole-challenge"

CompletionWholeChallenge is the only checkpoint completion kind this version admits. Part-level, multiple or alternative mappings require a separately reviewed owning contract.

View Source
const LocaleProfile = "datatug-bcp47-profile/1"

LocaleProfile identifies the deterministic BCP-47 profile implemented by AdmitAuthoredLocale and NormalizeVisitorLocale.

View Source
const MaxAttemptIDLen = 128

MaxAttemptIDLen is the owner limit for the external checkpoint envelope's opaque execution-owned attempt id: 1..128 printable ASCII characters.

View Source
const MaxChallengeFixtureBytes = challenge.MaxFixtureBytes

MaxChallengeFixtureBytes is the unchanged execution-owner fixture bound, re-exported so callers of package admission see the exact value used.

View Source
const MaxLocaleCharacters = 64

MaxLocaleCharacters is the inclusive bound on both an input tag and the canonical tag produced from it. Locale tags are US-ASCII, so this is also the byte bound.

View Source
const NarrativeSchemaVersion = 1

NarrativeSchemaVersion is the only narrative sidecar schema version this package admits. It is distinct from the declaration schema major.

View Source
const PackageSchemaV1 = "datatug-training-package/1"

PackageSchemaV1 is the only training package index schema this package admits.

View Source
const SchemaV1 = "datatug-walkthrough/1"

SchemaV1 is the ordinary schema this package admits through ParseDeclaration. Any other major is reported as needing a newer DataTug rather than parsed.

View Source
const SchemaV2 = "datatug-walkthrough/2"

SchemaV2 is the opt-in training extension admitted only through ParseTrainingDeclaration. The ordinary entry point keeps reporting it as a newer-client declaration.

Variables

View Source
var ErrNewerClient = errors.New("walkthrough: declaration needs a newer DataTug")

ErrNewerClient is returned by Result.Err and TrainingResult.Err when the declaration bytes name a schema this entry point cannot parse. It is a recoverable newer-client boundary, not a malformed declaration.

View Source
var ErrNewerTrainingPackage = errors.New("walkthrough: training package needs a newer DataTug")

ErrNewerTrainingPackage is returned by TrainingPackageResult.Err when the index names a later schema major. It is a recoverable newer-client boundary, not a malformed package, and no codec or native validation runs.

View Source
var NarrativeEventTypes = []string{
	"chat.message",
	"detective.create",
	"detective.open",
	"evidence.reveal",
	"challenge.prompt",
	"challenge.await_validation",
	"check.run",
	"postmortem.recommend",
	"camera.focus",
	"branch",
	"checkpoint",
}

NarrativeEventTypes is the closed sidecar event registry.

View Source
var NarrativeOutcomes = []string{"passed", "failed", "cancelled", "timed-out", "error"}

NarrativeOutcomes is the closed outcome registry shared by the checkpoint envelope, check.run references and branch results. Assistance is always orthogonal.

View Source
var Outcomes = []string{"passed", "failed", "cancelled", "timed-out", "error"}

Outcomes is the closed checkpoint-result outcome set. Assistance is orthogonal and never a replacement outcome.

Functions

func DeclarationPath

func DeclarationPath(id string) string

DeclarationPath returns the exact project-relative location of a walkthrough declaration.

func KnownConditionKind

func KnownConditionKind(kind string) bool

KnownConditionKind reports whether kind is in the ordinary /1 condition registry.

func KnownTargetKind

func KnownTargetKind(kind string) bool

KnownTargetKind reports whether kind is in the ordinary /1 target registry.

Types

type ActiveWait added in v0.83.0

type ActiveWait struct {
	Project               ProjectIdentity
	AuthorityGeneration   Integer
	ContentPin            ContentPin
	DeclarationSHA256     string
	NarrativeSHA256       string
	TrainingPackageSHA256 string
	WalkthroughID         string
	ChapterID             string
	ChallengeStepID       string
	ChallengeID           string
	ChallengeRevision     Integer
	CheckpointID          string
	AttemptID             string
	SubmissionGeneration  Integer
	Dialogue              DialogueChallengeBinding
}

ActiveWait is the explicit runtime wait a result must match field for field.

type AdmittedChallengeStep added in v0.83.0

type AdmittedChallengeStep struct {
	ChapterID    string
	StepID       string
	ChallengeID  string
	Revision     Integer
	CheckpointID string
}

AdmittedChallengeStep is one structurally valid challenge step whose target and checkpoint the owner context has admitted.

type AdmittedNarrative added in v0.85.0

type AdmittedNarrative struct {
	Sidecar    *NarrativeSidecar
	Package    PackageReference
	Locale     NarrativeLocaleChoice
	TextBytes  Integer
	Catalogues []NarrativeCatalogues
	Events     []ResolvedNarrativeEvent
}

AdmittedNarrative is the immutable result of narrative admission. No timing, settled state or executable projection is constructed here.

func (*AdmittedNarrative) Projection added in v0.85.0

func (n *AdmittedNarrative) Projection() map[string]any

Projection renders the stable, language-neutral admission view used by the shared conformance corpus.

type AdmittedTraining added in v0.83.0

type AdmittedTraining struct {
	Declaration           *TrainingDeclaration
	Project               ProjectIdentity
	ContentPin            ContentPin
	DeclarationSHA256     string
	Narrative             AssetReference
	NarrativeSHA256       string
	Package               PackageReference
	TrainingPackageSHA256 string
	WalkthroughID         string
	Chapters              []string
	ChallengeSteps        []AdmittedChallengeStep
	Cases                 []string
}

AdmittedTraining is the resolved, immutable training identity: no file has been read, but every pin, package, Case, challenge and checkpoint identity is bound together and admitted by its owner.

type AdmittedTrainingPackage added in v0.123.0

type AdmittedTrainingPackage struct {
	Schema              string
	ID                  string
	Revision            Integer
	Reference           PackageReference
	Binding             TrainingPackageBinding
	Assets              []TrainingPackageAsset
	FictionalActors     []TrainingFictionalActor
	Sources             []TrainingSourceBinding
	Cases               []TrainingCase
	Incidents           []TrainingIncident
	Checks              []TrainingCheckRecord
	Queries             []TrainingQueryRecord
	Challenges          []TrainingChallengeRecord
	Proposals           []TrainingProposal
	PresentationTargets []TrainingPresentationTarget
	TextBytes           Integer
	BinaryBytes         Integer
	Contributions       []TrainingAssetContribution
}

AdmittedTrainingPackage is the defensive, read-only package-stage snapshot. It retains typed projections and pins only; caller byte slices are never aliased and raw fixture bytes are not retained.

func (*AdmittedTrainingPackage) Projection added in v0.123.0

func (p *AdmittedTrainingPackage) Projection() map[string]any

Projection renders the complete deterministic, language-neutral conformance view used by the independent corpus. It exposes every admitted codec/native field, pin and closure result but never opaque project identity or executable state. Optional native fields follow the owner DTO's omitempty normalization. Callers receive a fresh mutable tree; this is not a tamper-proof capability.

func (*AdmittedTrainingPackage) TrustedNarrativeInventory added in v0.123.0

func (p *AdmittedTrainingPackage) TrustedNarrativeInventory() NarrativeInventory

TrustedNarrativeInventory returns this snapshot in the accepted NarrativeInventory owner shape so a later orchestration adapter can consume it directly. It is an intentionally reduced identity projection, not the complete conformance view. It carries no fabricated owner verdict: the live NarrativeOwnerContext must still admit every Check, proposal and presentation target.

func (*AdmittedTrainingPackage) TrustedPackageInventory added in v0.123.0

func (p *AdmittedTrainingPackage) TrustedPackageInventory() PackageInventory

TrustedPackageInventory returns this snapshot in the accepted a2 PackageInventory port shape. It is an intentionally reduced identity projection: only the verified package, asset and Case identity are exposed. It is not a live authority witness and not the complete conformance view.

type AssetExistsCondition

type AssetExistsCondition struct {
	Asset string
	ID    string
}

AssetExistsCondition observes that an asset is readable in the resolved project.

type AssetReference added in v0.83.0

type AssetReference struct {
	Path   string
	SHA256 string
	Bytes  Integer
}

AssetReference pins one immutable UTF-8 JSON asset of the declaring project: a safe project-root-relative path, the lowercase SHA-256 of its exact bytes and its positive byte length.

func (AssetReference) Equal added in v0.83.0

func (r AssetReference) Equal(other AssetReference) bool

Equal reports field-for-field equality of two asset references.

func (AssetReference) VerifyBytes added in v0.83.0

func (r AssetReference) VerifyBytes(data []byte) error

VerifyBytes checks supplied bytes against this reference before any parse: the byte length must match exactly and the SHA-256 must equal the pinned digest. A mismatch is a recoverable refusal with no partially admitted asset.

type BoardTarget

type BoardTarget struct {
	BoardID    string
	Parameters []NamedValue
	Tutorial   bool
}

BoardTarget is a saved board; Tutorial adds the board-action tutorial mode.

type BoardTutorialCondition

type BoardTutorialCondition struct {
	UntilCard string
}

BoardTutorialCondition observes board tutorial progress.

type BranchPayload added in v0.85.0

type BranchPayload struct {
	StepID        string
	CheckpointID  string
	Outcome       string
	Assisted      bool
	TargetEventID string
}

BranchPayload is a finite declarative branch within one segment.

type CameraFocusPayload added in v0.85.0

type CameraFocusPayload struct {
	TargetID string
}

CameraFocusPayload points at a registered presentation target.

type CardTarget

type CardTarget struct {
	CardID     string
	Parameters []NamedValue
}

CardTarget is a saved card with optional parameter values.

type CatalogueReference added in v0.85.0

type CatalogueReference struct {
	Locale string
	Path   string
	SHA256 string
	Bytes  Integer
}

CatalogueReference pins one immutable message catalogue. Locale is stored in canonical BCP-47 form after owner-profile admission.

func (CatalogueReference) Asset added in v0.85.0

Asset returns the reference's asset view.

type CatalogueResult added in v0.85.0

type CatalogueResult struct {
	Accepted  bool
	Digest    string
	Catalogue *MessageCatalogue
	Issues    []Issue
}

CatalogueResult is the outcome of one closed catalogue parse.

func ParseMessageCatalogue added in v0.85.0

func ParseMessageCatalogue(data []byte) CatalogueResult

ParseMessageCatalogue validates one closed message catalogue from exact bytes. The file bound applies before parsing.

func (CatalogueResult) Err added in v0.85.0

func (r CatalogueResult) Err() error

Err returns nil for an accepted catalogue or the aggregate refusal.

type ChallengeAwaitValidationPayload added in v0.85.0

type ChallengeAwaitValidationPayload struct {
	StepID       string
	CheckpointID string
}

ChallengeAwaitValidationPayload waits for the step's single whole-challenge checkpoint.

type ChallengeBinding added in v0.83.0

type ChallengeBinding struct {
	ChallengeID string
	Revision    Integer
}

ChallengeBinding is one owner-validated immutable challenge revision.

type ChallengePassedCondition added in v0.83.0

type ChallengePassedCondition struct {
	Checkpoints []CheckpointMapping
}

ChallengePassedCondition observes whole-attempt completion of the step's exact challenge target. It carries exactly one walkthrough-owned checkpoint mapping.

type ChallengePromptPayload added in v0.85.0

type ChallengePromptPayload struct {
	StepID string
}

ChallengePromptPayload presents a declared challenge step's pinned challenge.

type ChallengeTarget added in v0.83.0

type ChallengeTarget struct {
	ChallengeID string
	Revision    Integer
}

ChallengeTarget is the exact published challenge revision this step targets. The id/revision follow the challenge-execution owner contract, not the shorter walkthrough ID grammar.

type Chapter

type Chapter struct {
	ID             string
	FormerIDs      []string
	Title          string
	Why            string
	Requires       string
	RequiresReason string
	ContinuesFrom  string
	Readiness      *Condition
	Steps          []Step
	EntryStepID    string
}

Chapter is one ordered chapter. EntryStepID is the first Explore step whose target is not none (an unknown target kind still declares the entry).

type ChatMessagePayload added in v0.85.0

type ChatMessagePayload struct {
	ActorID       string
	MessageKey    string
	AttachmentIDs []string
}

ChatMessagePayload carries a catalogue key and declared attachments. A literal message field is not representable.

type CheckBinding added in v0.85.0

type CheckBinding struct {
	Binding           OwnerBindingKey
	CheckID           string
	DefinitionAssetID string
}

CheckBinding is an owner-valid Check identity and its check-definition asset. The owner has already run native Check/catalog validation; this package only closes the package-local reference.

type CheckRunCondition

type CheckRunCondition struct {
	Outcome string
}

CheckRunCondition observes a Check completion with an optional outcome.

type CheckRunPayload added in v0.85.0

type CheckRunPayload struct {
	CheckID           string
	ReferenceOutcome  string
	ReferenceAssisted bool
}

CheckRunPayload carries a labelled reference outcome. It never runs a Check during reconstruction.

type CheckTarget

type CheckTarget struct {
	CheckID string
}

CheckTarget is a Check and its runs.

type CheckpointEnvelope added in v0.83.0

type CheckpointEnvelope struct {
	Project ProjectIdentity
	EnvelopeDraft
}

CheckpointEnvelope is an admitted envelope: the owner-resolved project identity plus every verified field.

type CheckpointMapping added in v0.83.0

type CheckpointMapping struct {
	ID         string
	Completion string
}

CheckpointMapping is the walkthrough-owned whole-challenge checkpoint mapping. Completion is always "whole-challenge"; part-level or narrative-defined mappings are not representable.

type CheckpointPayload added in v0.85.0

type CheckpointPayload struct {
	StateKey string
}

CheckpointPayload is a pure reconstruction marker.

type Code

type Code string

Code is a stable refusal code for a declaration problem. Callers may switch on it; human wording is not part of the contract.

const (
	// CodeTooLarge means the input exceeds MaxDeclarationBytes.
	CodeTooLarge Code = "too_large"
	// CodeInvalidUTF8 means the input bytes are not valid UTF-8.
	CodeInvalidUTF8 Code = "invalid_utf8"
	// CodeInvalidJSON means the bytes are not one JSON value with JSON syntax.
	CodeInvalidJSON Code = "invalid_json"
	// CodeDuplicateKey means a JSON object repeats a key (including an escaped
	// spelling of the same key).
	CodeDuplicateKey Code = "duplicate_key"
	// CodeTrailingData means non-whitespace bytes follow the JSON value.
	CodeTrailingData Code = "trailing_data"
	// CodeNotObject means the root JSON value is not an object.
	CodeNotObject Code = "not_object"
	// CodeMissingField means a required field is absent.
	CodeMissingField Code = "missing_field"
	// CodeUnknownField means an object carries a field outside its closed set.
	CodeUnknownField Code = "unknown_field"
	// CodeInvalidType means a value has the wrong JSON type (including explicit
	// null where a value is required).
	CodeInvalidType Code = "invalid_type"
	// CodeInvalidValue means a string, enum, integer lexeme or identity does
	// not satisfy its declared rule.
	CodeInvalidValue Code = "invalid_value"
	// CodeTooLong means a text value exceeds its character limit.
	CodeTooLong Code = "too_long"
	// CodeTooMany means an array or total count exceeds its limit.
	CodeTooMany Code = "too_many"
	// CodeDuplicateID means a chapter, former, step or captured identity is
	// repeated in a scope that requires uniqueness.
	CodeDuplicateID Code = "duplicate_id"
	// CodeInvalidReference means a static reference (continuesFrom, chapter
	// exit, readiness/needs pairing) does not resolve.
	CodeInvalidReference Code = "invalid_reference"
	// CodeMissingDefault means a captured value object omits its mandatory
	// literal default.
	CodeMissingDefault Code = "missing_default"
	// CodeUnknownCapture means a captured value names no declared producer.
	CodeUnknownCapture Code = "unknown_capture"
	// CodeCaptureNotEarlier means a captured value references a producer that
	// is not earlier in document order.
	CodeCaptureNotEarlier Code = "capture_not_earlier"
	// CodeCaptureNotAllowed means a capture is attached to a known condition
	// kind that cannot produce a value.
	CodeCaptureNotAllowed Code = "capture_not_allowed"
	// CodeMissingExploreEntry means a chapter has no step available in Explore.
	CodeMissingExploreEntry Code = "missing_explore_entry"
	// CodeInvalidEntryTarget means a chapter's first Explore step targets none.
	CodeInvalidEntryTarget Code = "invalid_entry_target"
	// CodeInvalidPath means an asset path is not a safe project-relative path.
	CodeInvalidPath Code = "invalid_path"
	// CodeMissingContext means a required owner adapter or resolved source
	// context is absent. Nothing may be admitted from a refused context.
	CodeMissingContext Code = "missing_context"
	// CodeNotAdmitted means the trusted owner context does not admit the named
	// package, asset, Case or challenge manifest.
	CodeNotAdmitted Code = "not_admitted"
	// CodeMismatch means two bound identities or references must be equal field
	// for field and are not.
	CodeMismatch Code = "mismatch"
	// CodePinMismatch means a source pin is not the one exact immutable pin its
	// source requires (for example a branch or HEAD where a commit is required).
	CodePinMismatch Code = "pin_mismatch"
	// CodeDigestMismatch means supplied bytes or a repeated digest disagree with
	// the pinned SHA-256.
	CodeDigestMismatch Code = "digest_mismatch"
	// CodeByteCountMismatch means supplied bytes disagree with the pinned byte
	// length.
	CodeByteCountMismatch Code = "byte_count_mismatch"
	// CodeInconsistentSummary means a checkpoint envelope's outcome and
	// whole-attempt completion contradict each other.
	CodeInconsistentSummary Code = "inconsistent_summary"
	// CodeIneligible means a registry entry or namespace may not be used here:
	// a non-public scope or a reference/Test-only result.
	CodeIneligible Code = "ineligible"
	// CodeMissingAsset means a declared package asset's verified child bytes
	// were not supplied. Nothing was read or fetched.
	CodeMissingAsset Code = "missing_asset"
)

func ErrorCode

func ErrorCode(err error) Code

ErrorCode returns the first stable issue code, or "" when err is not a walkthrough refusal.

type CompletionRecord added in v0.83.0

type CompletionRecord struct {
	Project               ProjectIdentity
	AuthorityGeneration   Integer
	ContentPin            ContentPin
	DeclarationSHA256     string
	NarrativeSHA256       string
	TrainingPackageSHA256 string
	WalkthroughID         string
	ChapterID             string
	ChallengeStepID       string
	ChallengeID           string
	ChallengeRevision     Integer
	CheckpointID          string
	Outcome               string
	Complete              bool
}

CompletionRecord is one runtime-retained execution completion. Revisit never creates an envelope or replays an external effect.

type Condition

type Condition struct {
	Kind             string
	Supported        bool
	ParameterValue   *ParameterValueCondition
	RecordSelected   *RecordSelectedCondition
	QueryRun         *QueryRunCondition
	PanelOpen        *PanelOpenCondition
	FilterApplied    *FilterAppliedCondition
	CheckRun         *CheckRunCondition
	AssetExists      *AssetExistsCondition
	BoardTutorial    *BoardTutorialCondition
	DialogueFinished *DialogueFinishedCondition
	ChallengePassed  *ChallengePassedCondition
}

Condition is one closed-registry completion condition. Exactly the pointer matching Kind is populated for a supported kind; an unknown kind has Supported false and no variant data.

type ContentPin added in v0.83.0

type ContentPin struct {
	Kind   string
	Commit string
	SHA256 string
}

ContentPin is the resolved source pin. Exactly one variant is populated: KindGit pins a 40-hex commit (normalized lowercase); KindDigest pins the lowercase SHA-256 of the exact declaration bytes.

func (ContentPin) Equal added in v0.83.0

func (p ContentPin) Equal(other ContentPin) bool

Equal compares two pins after their parsers normalized hex spelling.

func (ContentPin) Valid added in v0.83.0

func (p ContentPin) Valid() bool

Valid reports whether the pin is one exact, immutable variant.

type Declaration

type Declaration struct {
	Schema   string
	ID       string
	Version  Integer
	Title    string
	Summary  string
	Chapters []Chapter
	Finish   Exit
	Revision string
}

Declaration is a fully validated ordinary /1 walkthrough. Revision is the lowercase SHA-256 of the exact input bytes.

func (*Declaration) Projection

func (d *Declaration) Projection() map[string]any

Projection renders the stable, language-neutral normalized view used by the shared conformance corpus. It exposes defaults, references, support status and the exact digest-related identity, but no presentation prose.

type DeclaredWalkthrough added in v0.83.0

type DeclaredWalkthrough struct {
	ID       string
	Revision string
	Chapters []string
}

DeclaredWalkthrough is the admitted walkthrough identity a registry entry must resolve to: exact ID, exact revision and ordered declared chapters.

type DetectivePayload added in v0.85.0

type DetectivePayload struct {
	ManifestCaseID string
}

DetectivePayload creates or opens a package-local training Case projection.

type DialogueChallengeBinding added in v0.83.0

type DialogueChallengeBinding struct {
	Validated       bool
	SegmentID       string
	ChapterID       string
	DialogueStepID  string
	ChallengeStepID string
}

DialogueChallengeBinding is the a3 narrative validator's verdict that the pinned dialogue segment bound to this chapter/step waits for this exact challenge step. This slice cannot validate a sidecar, so an unvalidated binding never matches.

type DialogueFinishedCondition added in v0.83.0

type DialogueFinishedCondition struct{}

DialogueFinishedCondition is presentation-step completion of the pinned Play segment. It never awards a challenge pass.

type EnvelopeAdmission added in v0.83.0

type EnvelopeAdmission struct {
	Envelope *CheckpointEnvelope
	Issues   []Issue
}

EnvelopeAdmission is the outcome of owner resolution.

func AdmitCheckpointEnvelope added in v0.83.0

func AdmitCheckpointEnvelope(draft EnvelopeDraft, authority ProjectAuthority) EnvelopeAdmission

AdmitCheckpointEnvelope resolves the envelope's opaque project reference through the trusted owner authority. A missing or refusing adapter admits nothing.

func (EnvelopeAdmission) Err added in v0.83.0

func (r EnvelopeAdmission) Err() error

Err returns nil for an admitted envelope or the aggregate recoverable refusal.

type EnvelopeDraft added in v0.83.0

type EnvelopeDraft struct {
	ProjectRaw            []byte
	AuthorityGeneration   Integer
	ContentPin            ContentPin
	DeclarationSHA256     string
	NarrativeSHA256       string
	TrainingPackageSHA256 string
	WalkthroughID         string
	ChapterID             string
	StepID                string
	ChallengeID           string
	ChallengeRevision     Integer
	CheckpointID          string
	AttemptID             string
	SubmissionGeneration  Integer
	Outcome               string
	Complete              bool
	Assisted              bool
}

EnvelopeDraft is the strictly parsed shape of one external checkpoint envelope, before the owner resolves the opaque project reference. No SQL, rows, evidence, transcript, token or any other extra field is representable.

func (EnvelopeDraft) Projection added in v0.83.0

func (d EnvelopeDraft) Projection() map[string]any

Projection is the stable normalized view used by the shared corpus.

type EnvelopeResult added in v0.83.0

type EnvelopeResult struct {
	Draft  *EnvelopeDraft
	Issues []Issue
}

EnvelopeResult is the outcome of the strict envelope shape parse.

func ParseCheckpointEnvelope added in v0.83.0

func ParseCheckpointEnvelope(data []byte) EnvelopeResult

ParseCheckpointEnvelope parses exactly one closed envelope shape. An inconsistent outcome/complete summary refuses here: the adapter must never hand an inconsistent summary to matching.

func (EnvelopeResult) Err added in v0.83.0

func (r EnvelopeResult) Err() error

Err returns nil for a parsed draft or the aggregate recoverable refusal.

type Error

type Error struct {
	Issues []Issue `json:"issues"`
}

Error is the aggregate refusal returned by Result.Err. It is recoverable: reloading a supported schema or fixing the named declaration fields can succeed, and no completion may be recorded from a refused parse.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Recoverable

func (e *Error) Recoverable() bool

Recoverable reports whether retrying with a supported schema or corrected bytes can succeed. Every refusal produced by this package is recoverable.

type EvidenceRevealPayload added in v0.85.0

type EvidenceRevealPayload struct {
	AssetID string
}

EvidenceRevealPayload reveals one declared sidecar asset.

type Exit

type Exit struct {
	Kind        string
	Chapter     string
	Walkthrough string
	Target      *Target
}

Exit is the walkthrough finish (or a chapter's next exit). Exactly one variant is set.

type FilterAppliedCondition

type FilterAppliedCondition struct {
	Field  string
	Equals *Scalar
}

FilterAppliedCondition observes a log or table filter.

type IncidentTarget

type IncidentTarget struct {
	Incident *Value
}

IncidentTarget is an incident in the resolved project, or its incident list when Incident is absent or null.

type Integer

type Integer string

Integer is a canonical, non-negative decimal integer lexeme. Keeping the lexeme rather than a machine integer preserves versions and row thresholds exactly in both Go and TypeScript without inventing a representability cap.

func (Integer) String

func (i Integer) String() string

type Issue

type Issue struct {
	Code    Code   `json:"code"`
	Path    string `json:"path"`
	Message string `json:"message"`
}

Issue is one structured, recoverable declaration problem. Path is a JSON Pointer into the input ("" is the root).

func ValidateActiveWait added in v0.83.0

func ValidateActiveWait(wait ActiveWait) []Issue

ValidateActiveWait reports every structural problem that would make a wait unable to consume or revisit a result.

func (Issue) Error

func (i Issue) Error() string

type LocaleCode added in v0.84.0

type LocaleCode string

LocaleCode is a stable refusal code for locale admission or normalization. Callers may switch on it; human wording is not part of the contract.

const (
	// LocaleCodeEmpty means the explicit locale string is empty. Caller
	// absence is not an empty string; default selection belongs to the later
	// catalogue resolver.
	LocaleCodeEmpty LocaleCode = "empty_locale"
	// LocaleCodeTooLong means the input or its canonical form exceeds
	// [MaxLocaleCharacters].
	LocaleCodeTooLong LocaleCode = "too_long"
	// LocaleCodeNonASCII means the input contains a non-ASCII byte.
	LocaleCodeNonASCII LocaleCode = "non_ascii"
	// LocaleCodeMalformed means the input does not match the profile's
	// hyphen-separated ASCII BCP-47 grammar.
	LocaleCodeMalformed LocaleCode = "malformed_locale"
	// LocaleCodeDuplicateVariant means one variant subtag appears twice.
	LocaleCodeDuplicateVariant LocaleCode = "duplicate_variant"
	// LocaleCodeDuplicateSingleton means one extension singleton appears twice.
	LocaleCodeDuplicateSingleton LocaleCode = "duplicate_singleton"
	// LocaleCodeReservedExtlangPosition means a second or third extlang
	// position was used; RFC 5646 permanently reserves those positions.
	LocaleCodeReservedExtlangPosition LocaleCode = "reserved_extlang_position"
	// LocaleCodeExtlangPrefixMismatch means a registered extlang does not
	// follow its registered Prefix primary language.
	LocaleCodeExtlangPrefixMismatch LocaleCode = "extlang_prefix_mismatch"
	// LocaleCodeUnsupportedRegistryVersion means an authored value is not
	// recognized in the pinned registry snapshot. It is recoverable and says
	// nothing about validity in a later registry.
	LocaleCodeUnsupportedRegistryVersion LocaleCode = "unsupported_registry_version"
)

func LocaleErrorCode added in v0.84.0

func LocaleErrorCode(err error) LocaleCode

LocaleErrorCode returns the first stable locale issue code, or "" when err is not a locale refusal.

type LocaleError added in v0.84.0

type LocaleError struct {
	Issues []LocaleIssue `json:"issues"`
}

LocaleError is the aggregate, recoverable refusal returned by LocaleResult.Err.

func (*LocaleError) Error added in v0.84.0

func (e *LocaleError) Error() string

func (*LocaleError) Recoverable added in v0.84.0

func (e *LocaleError) Recoverable() bool

Recoverable reports whether retrying with corrected input or a later registry snapshot can succeed. Every refusal produced by this profile is recoverable.

type LocaleIssue added in v0.84.0

type LocaleIssue struct {
	Code     LocaleCode `json:"code"`
	Subtag   string     `json:"subtag,omitempty"`
	Snapshot string     `json:"snapshot,omitempty"`
	Message  string     `json:"message"`
}

LocaleIssue is one structured locale refusal. Subtag is the offending subtag when there is one; Snapshot names the pinned registry File-Date for LocaleCodeUnsupportedRegistryVersion.

func (LocaleIssue) Error added in v0.84.0

func (i LocaleIssue) Error() string

type LocaleResult added in v0.84.0

type LocaleResult struct {
	Accepted        bool          `json:"accepted"`
	Tag             string        `json:"tag,omitempty"`
	PrimaryLanguage string        `json:"primaryLanguage,omitempty"`
	Issues          []LocaleIssue `json:"issues,omitempty"`
}

LocaleResult is the outcome of one locale operation. Accepted is true only when Tag is canonical. PrimaryLanguage is the genuine regular primary language of the canonical tag, or "" for a private-use-only tag and for an irregular grandfathered tag without a replacement. Tag is also the canonical comparison key: equivalent spellings collide on it, so catalogue admission can reject duplicate tags before selection.

func AdmitAuthoredLocale added in v0.84.0

func AdmitAuthoredLocale(input string) LocaleResult

AdmitAuthoredLocale admits and canonicalizes one authored `/2` locale field (a sidecar default, a catalogue reference or a catalogue document locale). Every language, script, region, variant, registered extlang and extension singleton must exist in the pinned registry snapshots; recognized private-use ranges are admitted too. An unknown but well-formed value is a recoverable LocaleCodeUnsupportedRegistryVersion naming the snapshot, never a silent rewrite and never a claim about a future registry.

func NormalizeVisitorLocale added in v0.84.0

func NormalizeVisitorLocale(input string) LocaleResult

NormalizeVisitorLocale normalizes one visitor request. Syntactically well-formed unknown values are preserved for the later exact / primary / fallback selection instead of being rejected merely because the pinned snapshot lacks them. Malformed syntax is a structured refusal, never an ambient browser language. A registered extlang still has to match its registered Prefix, and reserved extlang positions stay invalid.

func (LocaleResult) Err added in v0.84.0

func (r LocaleResult) Err() error

Err returns nil for an admitted tag or an aggregate recoverable LocaleError.

type LogSourceTarget

type LogSourceTarget struct {
	Source string
	Stream string
	Filter []NamedValue
}

LogSourceTarget is the generic log reader grid.

type MatchDecision added in v0.83.0

type MatchDecision struct {
	Verdict MatchVerdict
	Reason  string
}

MatchDecision is the result of one pure match. Reason is stable and machine-readable; human wording is the runtime's.

func MatchCheckpointEnvelope added in v0.83.0

func MatchCheckpointEnvelope(
	wait ActiveWait,
	envelope CheckpointEnvelope,
	authority ProjectAuthority,
) MatchDecision

MatchCheckpointEnvelope compares every envelope field with the explicit active wait. Only a validated, fully consistent, fully matching pass may be consumed. The validation envelope type has no reference/Test namespace field, so such a payload is an unknown-field refusal rather than a match.

func MatchRetainedCompletion added in v0.83.0

func MatchRetainedCompletion(
	record CompletionRecord,
	wait ActiveWait,
	authority ProjectAuthority,
) MatchDecision

MatchRetainedCompletion decides whether a stored completion may satisfy a revisit with identical pins, checkpoint and live authority.

type MatchVerdict added in v0.83.0

type MatchVerdict string

MatchVerdict is a pure matching decision. Consuming, retaining for revisit, pausing/scheduling and authority lifecycle remain runtime owner work.

const (
	// MatchConsume means the envelope satisfies the active wait and may be
	// consumed once by the runtime.
	MatchConsume MatchVerdict = "consume"
	// MatchRevisit means a retained execution completion satisfies the same
	// wait without a new envelope, resubmission or replayed external effect.
	MatchRevisit MatchVerdict = "revisit"
	// MatchNoMatch means wrong, stale, duplicate, non-passing or unvalidated
	// input: do nothing and keep waiting.
	MatchNoMatch MatchVerdict = "no-match"
)

type MessageCatalogue added in v0.85.0

type MessageCatalogue struct {
	SchemaVersion Integer
	Locale        string
	Values        map[string]string
}

MessageCatalogue is one pinned catalogue. Keys returns the stable sorted key order; Values keeps the exact plain text.

func (*MessageCatalogue) Keys added in v0.85.0

func (c *MessageCatalogue) Keys() []string

Keys returns the catalogue keys in code-point order.

func (*MessageCatalogue) Projection added in v0.85.0

func (c *MessageCatalogue) Projection() map[string]any

Projection renders the stable catalogue view with sorted message keys.

type NamedValue

type NamedValue struct {
	Name  string
	Value Value
}

NamedValue is one entry of a parameters, key or filter object. Entries are kept sorted by name so normalized projections are deterministic.

type NarrativeActor added in v0.85.0

type NarrativeActor struct {
	ID   string
	Name string
}

NarrativeActor is one fictional presentation identity.

type NarrativeAdmissionInput added in v0.85.0

type NarrativeAdmissionInput struct {
	Sidecar    NarrativeAssetBytes
	Catalogues []NarrativeAssetBytes
	Request    *string
}

NarrativeAdmissionInput is the caller-supplied raw bytes for one admission. Request is nil when the visitor made no explicit locale choice.

type NarrativeAsset added in v0.85.0

type NarrativeAsset struct {
	ID        string
	MediaType string
	Path      string
	SHA256    string
	Bytes     Integer
}

NarrativeAsset is one pinned sidecar asset. MediaType is descriptive and never decides text/binary accounting.

func (NarrativeAsset) Asset added in v0.85.0

func (a NarrativeAsset) Asset() AssetReference

Asset returns the asset's reference view.

type NarrativeAssetBytes added in v0.85.0

type NarrativeAssetBytes struct {
	Reference AssetReference
	Bytes     []byte
}

NarrativeAssetBytes is one raw supplied asset and the reference it claims to satisfy. Catalogue references must match the sidecar's pinned reference; the sidecar's own bytes are checked against the admitted declaration reference.

type NarrativeCatalogues added in v0.85.0

type NarrativeCatalogues struct {
	Locale string
	Values map[string]string
}

NarrativeCatalogues is one resolved catalogue snapshot. Values is copied.

type NarrativeEvent added in v0.85.0

type NarrativeEvent struct {
	ID                       string
	ChapterID                string
	Type                     string
	ChatMessage              *ChatMessagePayload
	Detective                *DetectivePayload
	EvidenceReveal           *EvidenceRevealPayload
	ChallengePrompt          *ChallengePromptPayload
	ChallengeAwaitValidation *ChallengeAwaitValidationPayload
	CheckRun                 *CheckRunPayload
	PostmortemRecommend      *PostmortemRecommendPayload
	CameraFocus              *CameraFocusPayload
	Branch                   *BranchPayload
	Checkpoint               *CheckpointPayload
	Presentation             *Presentation
}

NarrativeEvent is one closed-registry sidecar event. Exactly the payload pointer matching Type is populated.

type NarrativeInventory added in v0.85.0

type NarrativeInventory struct {
	Binding             OwnerBindingKey
	Assets              []PackageAssetBinding
	Cases               []string
	Incidents           []string
	Checks              []string
	Queries             []string
	Proposals           []string
	PresentationTargets []string
}

NarrativeInventory is the coherent owner snapshot of one admitted package: reviewed codec assets, package-local inventories and their binding key. Its asset set must exactly cover the accepted a2 package inventory.

type NarrativeLocaleChoice added in v0.85.0

type NarrativeLocaleChoice struct {
	RequestedLocale string
	SelectedLocale  string
	Matched         string // exact, primary or fallback
	FallbackLocale  string
}

NarrativeLocaleChoice is the deterministic result of /2 narrative locale selection: an absent visitor request uses the sidecar default, then exactly the declared requested tag, the declared primary-language tag and finally the declared fallback. Tags are canonical BCP-47 comparison keys.

func (NarrativeLocaleChoice) Projection added in v0.85.0

func (c NarrativeLocaleChoice) Projection() map[string]any

Projection renders the stable selection view.

type NarrativeLocaleResult added in v0.85.0

type NarrativeLocaleResult struct {
	Accepted bool
	Choice   NarrativeLocaleChoice
	Issues   []Issue
}

NarrativeLocaleResult is the outcome of one pure selection.

func SelectNarrativeLocale added in v0.85.0

func SelectNarrativeLocale(
	request *string,
	declaredLocales []string,
	defaultLocale string,
	fallbackLocale string,
) NarrativeLocaleResult

SelectNarrativeLocale applies the owner selection algorithm to canonical declared catalogue tags. request is nil when the visitor made no explicit choice; an empty string is an explicit malformed request, not absence.

func (NarrativeLocaleResult) Err added in v0.85.0

func (r NarrativeLocaleResult) Err() error

Err returns nil for an accepted selection or the aggregate refusal.

type NarrativeOwnerContext added in v0.85.0

type NarrativeOwnerContext interface {
	TrainingOwnerContext
	// AdmitNarrativeInventory returns one coherent package snapshot for the
	// current admission. The caller must keep it stable for the whole call;
	// a changed reread refuses rather than mixing inventories.
	AdmitNarrativeInventory(ref PackageReference) (NarrativeInventory, error)
	// AdmitCheck resolves an owner-valid package Check within the exact
	// admitted package binding.
	AdmitCheck(ref PackageReference, checkID string) (CheckBinding, error)
	// AdmitProposal resolves one package proposal within the exact admitted
	// package binding.
	AdmitProposal(ref PackageReference, proposalID string) (ProposalBinding, error)
	// AdmitPresentationTarget resolves one registered presentation target and
	// its already-validated typed closure.
	AdmitPresentationTarget(ref PackageReference, targetID string) (PresentationTargetBinding, error)
}

NarrativeOwnerContext is the narrative-specific trusted lookup extension. It composes the accepted a2 port without widening ordinary declaration or source callers, and adds only the Check, proposal, presentation-target and accounting snapshots this narrative closure needs.

type NarrativeResolution added in v0.85.0

type NarrativeResolution struct {
	Admitted  bool
	Narrative *AdmittedNarrative
	Issues    []Issue
}

NarrativeResolution is the outcome of narrative admission. Narrative is non-nil only when Admitted is true.

func AdmitNarrative added in v0.85.0

func AdmitNarrative(
	bundle *AdmittedTraining,
	authority ProjectAuthority,
	owners NarrativeOwnerContext,
	input NarrativeAdmissionInput,
) NarrativeResolution

AdmitNarrative binds a structurally valid sidecar to its admitted /2 declaration, catalogues, package inventory and typed owner lookups. It verifies every supplied byte pin before parsing, performs complete local reference closure and text accounting, and returns no partial narrative on any refusal.

func (NarrativeResolution) Err added in v0.85.0

func (r NarrativeResolution) Err() error

Err returns nil for an admitted narrative or the aggregate refusal.

type NarrativeResult added in v0.85.0

type NarrativeResult struct {
	Accepted bool
	Digest   string
	Sidecar  *NarrativeSidecar
	Issues   []Issue
}

NarrativeResult is the outcome of one closed sidecar parse.

func ParseNarrativeSidecar added in v0.85.0

func ParseNarrativeSidecar(data []byte) NarrativeResult

ParseNarrativeSidecar validates one narrative sidecar schema 1 from exact bytes. It checks closed shape, bounds, uniqueness and sidecar-local references; declaration binding, catalogues, owner lookups and budgets are AdmitNarrative's job. No partially admitted sidecar is exposed.

func (NarrativeResult) Err added in v0.85.0

func (r NarrativeResult) Err() error

Err returns nil for an accepted sidecar or the aggregate recoverable refusal.

type NarrativeSegment added in v0.85.0

type NarrativeSegment struct {
	ID                          string
	ChapterID                   string
	StepID                      string
	EventIDs                    []string
	PrerequisiteContextEventIDs []string
}

NarrativeSegment binds one declared scripted-dialogue step to its ordered normal events and visibly labelled prerequisite context events.

type NarrativeSidecar added in v0.85.0

type NarrativeSidecar struct {
	SchemaVersion     Integer
	ScenarioID        string
	Revision          Integer
	Locale            string
	FallbackLocale    string
	MessageCatalogues []CatalogueReference
	ChapterRefs       []string
	Actors            []NarrativeActor
	Assets            []NarrativeAsset
	Segments          []NarrativeSegment
	Events            []NarrativeEvent
}

NarrativeSidecar is a structurally valid narrative sidecar schema 1. It is not an admitted narrative: chapter/step binding, owner references, catalogue resolution and text budgets require AdmitNarrative.

func (*NarrativeSidecar) Projection added in v0.85.0

func (s *NarrativeSidecar) Projection() map[string]any

Projection renders the stable, language-neutral normalized view used by the shared conformance corpus.

type OwnerBindingKey added in v0.85.0

type OwnerBindingKey struct {
	Project           ProjectIdentity
	ContentPin        ContentPin
	DeclarationSHA256 string
	Package           PackageReference
}

OwnerBindingKey ties one trusted lookup result to the exact admitted project, source pin, declaration digest and package. Returning only a package-local ID is never enough: the same spelling in another source or package is a different binding.

type PackageAssetBinding added in v0.85.0

type PackageAssetBinding struct {
	AssetID   string
	Kind      string
	Reference AssetReference
	Bytes     Integer
}

PackageAssetBinding is one owner-admitted package asset with its reviewed codec kind and actual supplied byte count. Kind, never an author mediaType, decides text/binary accounting.

type PackageInventory added in v0.83.0

type PackageInventory struct {
	Ref    PackageReference
	Assets []AssetReference
	Cases  []string
}

PackageInventory is the owner-established inventory of one admitted package.

type PackageReference added in v0.83.0

type PackageReference struct {
	ID       string
	Revision Integer
	Path     string
	SHA256   string
	Bytes    Integer
}

PackageReference pins the immutable fictional training package. It carries the same three asset fields plus the package's own ID and revision.

func (PackageReference) Asset added in v0.83.0

func (p PackageReference) Asset() AssetReference

Asset returns the package's asset-reference view.

func (PackageReference) Equal added in v0.83.0

func (p PackageReference) Equal(other PackageReference) bool

Equal reports field-for-field equality of two package references.

func (PackageReference) VerifyBytes added in v0.83.0

func (p PackageReference) VerifyBytes(data []byte) error

VerifyBytes checks supplied package bytes against the package reference.

type PanelOpenCondition

type PanelOpenCondition struct {
	Panel string
}

PanelOpenCondition observes a panel belonging to the target asset.

type ParameterValueCondition

type ParameterValueCondition struct {
	Name   string
	Equals *Scalar
}

ParameterValueCondition observes a query, board or card parameter.

type PostmortemRecommendPayload added in v0.85.0

type PostmortemRecommendPayload struct {
	ProposalID string
}

PostmortemRecommendPayload presents an unsaved package proposal.

type Presentation added in v0.85.0

type Presentation struct {
	DelayBeforeMs             int
	PauseAfterMs              int
	TypingSpeedPreset         string
	TypingSpeedCharsPerSecond int
	TypingIndicator           bool
	Transition                string
	CameraTargetID            string
}

Presentation is the optional per-event presentation hint. Defaults are materialized so the projection is stable across languages.

type PresentationClosure added in v0.85.0

type PresentationClosure struct {
	Kind     string
	ID       string
	Check    *CheckBinding
	Proposal *ProposalBinding
}

PresentationClosure is the trusted owner's typed closure for a presentation target's referenced object. Absence or a kind/identity mismatch refuses the target; a bare target ID is not closure.

type PresentationTargetBinding added in v0.85.0

type PresentationTargetBinding struct {
	Binding  OwnerBindingKey
	TargetID string
	Kind     string
	RefID    string
	Closure  *PresentationClosure
}

PresentationTargetBinding is a manifest-to-view descriptor backed by an already-validated typed owner closure. It is never selector, component, router or focus authority.

type ProjectAuthority added in v0.83.0

type ProjectAuthority interface {
	// BindProject admits a canonical project URL or reference spelling and
	// reports the owner's verdicts.
	BindProject(raw string) (ProjectBinding, error)
	// AdmitProject admits an opaque project-reference JSON value, as carried by
	// an external checkpoint envelope, and returns only its snapshot.
	AdmitProject(raw []byte) (ProjectIdentity, error)
	// EqualProject is the owner's full identity equality; this package never
	// compares opaque identities by itself.
	EqualProject(a, b ProjectIdentity) bool
}

ProjectAuthority is the trusted opaque project-identity adapter port. The production Apps adapter reuses the owning project-context normalization; a test double only proves wiring, never authority.

type ProjectBinding added in v0.83.0

type ProjectBinding struct {
	Identity ProjectIdentity
	// CanonicalURL is the owner's one canonical address of the project.
	CanonicalURL string
	// Public is the owner-established public-scope verdict. A URL spelling never
	// implies it.
	Public bool
	// Commit is the exact lowercase 40-hex commit the reference pins, or "" when
	// the reference does not name an immutable Git commit (a branch, HEAD, the
	// default branch or a non-Git source).
	Commit string
	// DigestAddressed reports whether the source serves exact bytes by content
	// digest (cloud/local), which is the only valid content pin for it.
	DigestAddressed bool
}

ProjectBinding is the owner's admission verdict for one project URL or reference. Only the owner adapter may populate it; this package only reads the verdicts the training contracts need.

type ProjectIdentity added in v0.83.0

type ProjectIdentity struct {
	Value any
}

ProjectIdentity is an opaque snapshot owned by the injected ProjectAuthority. This package never interprets Value, never builds a canonical project serialization and never compares identities itself.

type ProposalBinding added in v0.85.0

type ProposalBinding struct {
	Binding      OwnerBindingKey
	ProposalID   string
	Kind         string
	DefinitionID string
	EvidenceIDs  []string
	Rationale    string
}

ProposalBinding is one unsaved package proposal with its typed definition and evidence references.

type PublicDataProviderTarget

type PublicDataProviderTarget struct {
	Provider string
}

PublicDataProviderTarget is a provider's OVDB Directory entry.

type QueryRunCondition

type QueryRunCondition struct {
	MinRows *Integer
}

QueryRunCondition observes a completed saved-query run.

type QueryTarget

type QueryTarget struct {
	QueryID    string
	Parameters []NamedValue
}

QueryTarget is a saved query with optional parameter values. It never runs the query.

type RecordSelectedCondition

type RecordSelectedCondition struct {
	Field  string
	Equals *Scalar
}

RecordSelectedCondition observes a selected record or query result row.

type RegistryAdmission added in v0.83.0

type RegistryAdmission struct {
	Route  *RouteDescriptor
	Issues []Issue
}

RegistryAdmission is the owner-context admission outcome. Route is non-nil only when the alias may resolve.

func AdmitStoryChapter added in v0.83.0

func AdmitStoryChapter(
	entry StoryRegistryEntry,
	chapterID string,
	declared DeclaredWalkthrough,
	authority ProjectAuthority,
) RegistryAdmission

AdmitStoryChapter admits one public alias for one declared chapter. It requires an owner-established canonical immutable project address, an owner-established public scope, exact pin agreement and a declared chapter. A private or unknown scope, a branch/HEAD/default address, a historical pin mismatch or an undeclared chapter refuses; nothing falls back to latest.

func (RegistryAdmission) Err added in v0.83.0

func (r RegistryAdmission) Err() error

Err returns nil for an admitted alias or the aggregate recoverable refusal.

type RelatedTarget

type RelatedTarget struct {
	Source  string
	Table   string
	Key     []NamedValue
	Meaning string
}

RelatedTarget is a record with its Related panel open.

type Resolution added in v0.83.0

type Resolution struct {
	Admitted bool
	Bundle   *AdmittedTraining
	Issues   []Issue
}

Resolution is the outcome of owner-context admission. Admitted is true only when Bundle is non-nil; a partially resolved bundle is never exposed.

func ResolveTraining added in v0.83.0

func ResolveTraining(
	declaration *TrainingDeclaration,
	source SourceContext,
	authority ProjectAuthority,
	owners TrainingOwnerContext,
) Resolution

ResolveTraining binds a structurally valid /2 declaration to the resolved declaring-project context and to its owner-admitted package, asset, Case and challenge identities. Missing authority or context refuses; nothing is read.

func (Resolution) Err added in v0.83.0

func (r Resolution) Err() error

Err returns nil for an admitted bundle or the aggregate recoverable refusal.

type ResolvedMessage added in v0.85.0

type ResolvedMessage struct {
	Key          string
	Text         string
	Locale       string
	FromFallback bool
}

ResolvedMessage is one chat event's resolved plain text and the catalogue that supplied it.

type ResolvedNarrativeEvent added in v0.85.0

type ResolvedNarrativeEvent struct {
	ID                 string
	ChapterID          string
	Type               string
	Message            *ResolvedMessage
	Check              *CheckBinding
	Proposal           *ProposalBinding
	PresentationTarget *PresentationTargetBinding
}

ResolvedNarrativeEvent is one admitted event with its resolved text and any owner-typed binding the closure established.

type Result

type Result struct {
	Accepted    bool         `json:"accepted"`
	NewerClient bool         `json:"newerClient"`
	Digest      string       `json:"digest"`
	Definition  *Declaration `json:"definition,omitempty"`
	Issues      []Issue      `json:"issues,omitempty"`
}

Result is the outcome of one ordinary declaration parse. Definition is non-nil only when Accepted is true. Digest is always the SHA-256 of the exact bytes supplied.

func ParseDeclaration

func ParseDeclaration(directoryID string, data []byte) Result

ParseDeclaration validates one ordinary /1 declaration. directoryID is the `<id>` in `walkthroughs/<id>/walkthrough.json`; it must equal the declaration ID. The input slice is never retained or mutated. A /2 declaration is reported as Result.NewerClient exactly as before the explicit /2 entry point existed.

func (Result) Err

func (r Result) Err() error

Err returns nil for an admitted declaration, ErrNewerClient for a newer schema major, or an aggregate recoverable Error.

type RouteDescriptor added in v0.83.0

type RouteDescriptor struct {
	StoryID           string
	Revision          Integer
	ProjectURL        string
	WalkthroughID     string
	ChapterID         string
	ContentPin        ContentPin
	DeclarationSHA256 string
}

RouteDescriptor is the resolved public alias target. It names the declared project, walkthrough and chapter and retains the pins; it deliberately does not invent another walkthrough URL or router.

type Scalar

type Scalar struct {
	Kind   ScalarKind
	Bool   bool
	Number string
	Text   string
}

Scalar is one JSON scalar. Number retains the exact input lexeme.

type ScalarKind

type ScalarKind string

ScalarKind is the closed JSON scalar kind of a literal value.

const (
	ScalarNull    ScalarKind = "null"
	ScalarBoolean ScalarKind = "boolean"
	ScalarNumber  ScalarKind = "number"
	ScalarString  ScalarKind = "string"
)

type SourceContext added in v0.83.0

type SourceContext struct {
	Project           ProjectIdentity
	ContentPin        ContentPin
	DeclarationSHA256 string
}

SourceContext is the resolved declaring-project context. It is deliberately not a declaration field: the caller's owner adapter establishes the project identity, the exact content pin and the verified declaration digest.

type Step

type Step struct {
	ID        string
	Kind      string
	SegmentID string
	Title     string
	Why       string
	Hint      string
	Modes     []string
	Target    Target
	Done      Condition
	Capture   string
	Needs     string
	Support   Support
}

Step is one ordered walkthrough step. Kind and SegmentID exist only in the /2 training profile; ordinary /1 steps leave Kind empty.

type StoryRegistryEntry added in v0.83.0

type StoryRegistryEntry struct {
	StoryID           string
	Revision          Integer
	ProjectURL        string
	WalkthroughID     string
	ContentPin        ContentPin
	DeclarationSHA256 string
}

StoryRegistryEntry is the strict structural shape of one public story registry entry. Shape admission only: canonical immutable URL, public scope and chapter lookup are owner-established by AdmitStoryChapter.

func (StoryRegistryEntry) Projection added in v0.83.0

func (e StoryRegistryEntry) Projection() map[string]any

Projection is the stable normalized view used by the shared corpus.

type StoryRegistryResult added in v0.83.0

type StoryRegistryResult struct {
	Entry  *StoryRegistryEntry
	Issues []Issue
}

StoryRegistryResult is the outcome of the strict shape parse.

func ParseStoryRegistryEntry added in v0.83.0

func ParseStoryRegistryEntry(data []byte) StoryRegistryResult

ParseStoryRegistryEntry parses exactly one closed registry entry shape.

func (StoryRegistryResult) Err added in v0.83.0

func (r StoryRegistryResult) Err() error

Err returns nil for a parsed entry or the aggregate recoverable refusal.

type Support

type Support string

Support is the admission status of a target, condition or step.

const (
	// SupportSupported is a fully validated /1 variant.
	SupportSupported Support = "supported"
	// SupportNeedsNewer is an unknown target/condition kind retained only so
	// the rest of the walkthrough stays usable. Its opaque body is not exposed
	// or executed.
	SupportNeedsNewer Support = "needs-newer"
)

type TableRecordTarget

type TableRecordTarget struct {
	Source string
	Table  string
	Key    []NamedValue
}

TableRecordTarget is a table of a project source, optionally with a record open.

type Target

type Target struct {
	Kind               string
	Supported          bool
	TableRecord        *TableRecordTarget
	Query              *QueryTarget
	Board              *BoardTarget
	Card               *CardTarget
	Related            *RelatedTarget
	LogSource          *LogSourceTarget
	PublicDataProvider *PublicDataProviderTarget
	Incident           *IncidentTarget
	Check              *CheckTarget
	None               *struct{}
	Challenge          *ChallengeTarget
	TrainingCase       *TrainingCaseTarget
}

Target is one closed-registry target variant. Exactly the pointer matching Kind is populated for a supported kind; an unknown kind has Supported false and no variant data.

type TrainingAssetContribution added in v0.123.0

type TrainingAssetContribution struct {
	Path     string   `json:"path"`
	SHA256   string   `json:"sha256"`
	Class    string   `json:"class"`
	Bytes    Integer  `json:"bytes"`
	AssetIDs []string `json:"assetIds"`
}

TrainingAssetContribution is one unique canonical source+path contribution. Identical aliases share one contribution; the AssetIDs record every declaration that resolved to it.

type TrainingCase added in v0.123.0

type TrainingCase struct {
	ID          string
	Title       string
	Status      string
	Context     map[string]detective.InputValue
	IncidentIDs []string
	EvidenceIDs []string
	Findings    []TrainingFinding
	Timeline    []TrainingTimelineEntry
}

TrainingCase is one package-local Case read projection.

type TrainingCaseTarget added in v0.83.0

type TrainingCaseTarget struct {
	ManifestCaseID  string
	TrainingPackage PackageReference
}

TrainingCaseTarget is existing generic Case presentation through a training adapter. TrainingPackage must equal the declaration's top-level package reference field for field.

type TrainingChallengeFixture added in v0.123.0

type TrainingChallengeFixture struct {
	FixtureID string
	AssetID   string
}

TrainingChallengeFixture binds one manifest fixture id to an asset.

type TrainingChallengeRecord added in v0.123.0

type TrainingChallengeRecord struct {
	ID              string
	Revision        Integer
	ManifestAssetID string
	Fixtures        []TrainingChallengeFixture
}

TrainingChallengeRecord binds one immutable challenge revision to its verified manifest and fixture suite.

type TrainingCheckRecord added in v0.123.0

type TrainingCheckRecord struct {
	ID                string
	DefinitionAssetID string
}

TrainingCheckRecord binds a package Check id to its definition asset.

type TrainingDeclaration added in v0.83.0

type TrainingDeclaration struct {
	Schema          string
	ID              string
	Version         Integer
	Title           string
	Summary         string
	TrainingPackage PackageReference
	Narrative       AssetReference
	Chapters        []Chapter
	Finish          Exit
	Revision        string
}

TrainingDeclaration is a structurally valid datatug-walkthrough/2 declaration. It is not a resolved admission: package, Case, challenge and source-context authority are established by ResolveTraining.

func (*TrainingDeclaration) Projection added in v0.83.0

func (d *TrainingDeclaration) Projection() map[string]any

Projection renders the stable, language-neutral normalized view of a /2 declaration used by the shared conformance corpus. It extends the ordinary projection with the package and narrative references, the step kind, the dialogue segment id and the checkpoint mapping.

func (*TrainingDeclaration) WalkthroughIdentity added in v0.83.0

func (d *TrainingDeclaration) WalkthroughIdentity() DeclaredWalkthrough

WalkthroughIdentity is the declared walkthrough identity used by registry admission: the ID, the exact revision and the ordered chapter IDs.

type TrainingFictionalActor added in v0.123.0

type TrainingFictionalActor struct {
	ID   string
	Name string
}

TrainingFictionalActor is a fictional presentation identity. It is not an actor UID, credential or notification address.

type TrainingFinding added in v0.123.0

type TrainingFinding struct {
	ID              string
	Text            string
	Status          string
	EvidenceRefs    []string
	HasEvidenceRefs bool
}

TrainingFinding is one Case-local native Finding projection.

type TrainingIncident added in v0.123.0

type TrainingIncident struct {
	ID          string
	Title       string
	Description string
	Status      string
	EvidenceIDs []string
}

TrainingIncident is one package-local incident read projection.

type TrainingLogEntry added in v0.123.0

type TrainingLogEntry struct {
	ID      string
	At      string
	ActorID string
	Kind    string
	Message string
}

TrainingLogEntry is one fictional evidence-log line.

type TrainingOwnerContext added in v0.83.0

type TrainingOwnerContext interface {
	// AdmitPackage returns the exact admitted package and its declared asset and
	// Case inventory.
	AdmitPackage(ref PackageReference) (PackageInventory, error)
	// AdmitAsset admits one exact project-relative asset reference.
	AdmitAsset(ref AssetReference) error
	// AdmitChallenge resolves the exact challenge manifest through the challenge
	// owner. A manifest that has not passed the owning validator is not admitted.
	AdmitChallenge(challengeID string, revision Integer) (ChallengeBinding, error)
}

TrainingOwnerContext is the trusted validated-owner lookup port. It never reads files, loads a package document this package would have to invent, or falls back to an ordinary (non-training) service.

type TrainingPackageAsset added in v0.123.0

type TrainingPackageAsset struct {
	ID        string
	Kind      string
	MediaType string
	Reference AssetReference

	Text     string
	Records  *TrainingRecords
	Log      []TrainingLogEntry
	Metadata *TrainingQueryMetadata
	Check    *detective.Check
	Manifest *challenge.Manifest
	Watch    *TrainingWatchRecommendation
	Binary   bool
}

TrainingPackageAsset is the verified inventory entry and its codec projection. Exactly the fields named by Kind are populated: Text for evidence-text and query-body-sql, the matching pointer for the other JSON codecs, and Binary for challenge-fixture (whose raw bytes are deliberately not retained).

type TrainingPackageAssetBytes added in v0.123.0

type TrainingPackageAssetBytes struct {
	Path  string
	Bytes []byte
}

TrainingPackageAssetBytes is one caller-supplied child file. The declared package index owns the pin; Path only identifies which declaration the bytes satisfy, so an index/byte disagreement is a verification refusal.

type TrainingPackageBinding added in v0.123.0

type TrainingPackageBinding struct {
	Project           ProjectIdentity
	ContentPin        ContentPin
	DeclarationSHA256 string
	NarrativeSHA256   string
	PackageSHA256     string
	ScenarioID        string
	ScenarioRevision  Integer
}

TrainingPackageBinding is the trusted external owner context that is never duplicated inside package JSON: the resolving project, the exact content pin and the verified declaration, narrative and package digests, plus the admitted sidecar scenario identity. The package stage compares these values but cannot verify the declaration or narrative bytes themselves.

type TrainingPackageInput added in v0.123.0

type TrainingPackageInput struct {
	Reference  PackageReference
	IndexBytes []byte
	Assets     []TrainingPackageAssetBytes
	Binding    TrainingPackageBinding
}

TrainingPackageInput is one pure package-stage admission request. No file is fetched and nothing executes.

type TrainingPackageResult added in v0.123.0

type TrainingPackageResult struct {
	Admitted    bool                     `json:"admitted"`
	NewerClient bool                     `json:"newerClient"`
	Reference   PackageReference         `json:"reference"`
	Package     *AdmittedTrainingPackage `json:"package,omitempty"`
	Issues      []Issue                  `json:"issues,omitempty"`
}

TrainingPackageResult is the outcome of package admission. Package is non-nil only when Admitted is true.

func AdmitTrainingPackage added in v0.123.0

func AdmitTrainingPackage(input TrainingPackageInput) TrainingPackageResult

AdmitTrainingPackage performs pure package-stage admission. The caller supplies the exact pinned index bytes, the declared child bytes and a trusted external binding. The result is either a closed, native-valid, locally reference-closed defensive snapshot with exact text/binary contributions, or a precise recoverable refusal with no partial package.

This stage proves neither reservation-before-read, concurrent-reader limits, streaming/deadline/cache/copy/transfer ledgers, live authority, pin or disposal revocation, nor production loading. Those remain transport and orchestration gates.

Ownership: every admitted string and typed value is an independent copy; the caller's byte slices are not retained or aliased. Challenge fixture bytes are verified through the native Open path, whose retained snapshots are discarded before return, so no raw handle or executable capability is exposed.

func (TrainingPackageResult) Err added in v0.123.0

func (r TrainingPackageResult) Err() error

Err returns nil for an admitted package, ErrNewerTrainingPackage for a later schema major, or an aggregate recoverable Error.

type TrainingParameter added in v0.123.0

type TrainingParameter struct {
	ID         string
	Type       string
	Title      *string
	IsRequired *bool
	Default    *TrainingParameterDefault
}

TrainingParameter is one closed training SQL parameter record.

type TrainingParameterDefault added in v0.123.0

type TrainingParameterDefault struct {
	Kind   string
	Text   string
	Bool   bool
	Number string
	Float  float64
}

TrainingParameterDefault is one exact scalar SQL parameter default.

type TrainingPresentationTarget added in v0.123.0

type TrainingPresentationTarget struct {
	ID    string
	Kind  string
	RefID string
}

TrainingPresentationTarget is a manifest-to-view descriptor. It is never a selector, router command, component or focus authority.

type TrainingProposal added in v0.123.0

type TrainingProposal struct {
	ID           string
	Kind         string
	DefinitionID string
	EvidenceIDs  []string
	Rationale    string
}

TrainingProposal is one unsaved training recommendation.

type TrainingQueryMetadata added in v0.123.0

type TrainingQueryMetadata struct {
	ID           string
	Title        string
	Type         string
	ConnectionID string
	Parameters   []TrainingParameter
}

TrainingQueryMetadata is the closed query-metadata codec projection. It is not a hydrated native request.

type TrainingQueryRecord added in v0.123.0

type TrainingQueryRecord struct {
	ID              string
	MetadataAssetID string
	BodyAssetID     string
	SourceID        string
	// Hydrated is the native query produced only after the separately pinned
	// metadata and body verified. It was validated but never executed.
	Hydrated datatug.QueryDef
}

TrainingQueryRecord binds the separately pinned query metadata and SQL body to one fixture-only source.

type TrainingRecordColumn added in v0.123.0

type TrainingRecordColumn struct {
	Name string
	Type investigation.ValueType
}

TrainingRecordColumn is one declared evidence-records column.

type TrainingRecords added in v0.123.0

type TrainingRecords struct {
	Columns []TrainingRecordColumn
	Rows    [][]investigation.TypedValue
}

TrainingRecords is the typed evidence-records projection.

type TrainingResult added in v0.83.0

type TrainingResult struct {
	Accepted    bool                 `json:"accepted"`
	NewerClient bool                 `json:"newerClient"`
	Digest      string               `json:"digest"`
	Definition  *TrainingDeclaration `json:"definition,omitempty"`
	Issues      []Issue              `json:"issues,omitempty"`
}

TrainingResult is the outcome of one explicit /2 declaration parse. It is a structural admission only; owner-context admission is ResolveTraining.

func ParseTrainingDeclaration added in v0.83.0

func ParseTrainingDeclaration(directoryID string, data []byte) TrainingResult

ParseTrainingDeclaration validates one explicit datatug-walkthrough/2 declaration. It shares the ordinary JSON and variant machinery without widening ordinary /1 admission. The returned definition is structurally valid only: a parsed declaration is never claimed render-ready, and package, Case, challenge and source-context authority still require ResolveTraining.

func (TrainingResult) Err added in v0.83.0

func (r TrainingResult) Err() error

Err returns nil for an admitted declaration, ErrNewerClient for a later schema major, or an aggregate recoverable Error.

type TrainingSourceBinding added in v0.123.0

type TrainingSourceBinding struct {
	ID             string
	FixtureAssetID string
}

TrainingSourceBinding binds one package query to its fixture-only source.

type TrainingTimelineEntry added in v0.123.0

type TrainingTimelineEntry struct {
	ID      string
	At      string
	ActorID string
	Type    string
	Ref     TrainingTimelineRef
}

TrainingTimelineEntry is one fictional display-only timeline record.

type TrainingTimelineRef added in v0.123.0

type TrainingTimelineRef struct {
	Kind string
	ID   string
}

TrainingTimelineRef is the closed timeline reference.

type TrainingWatchRecommendation added in v0.123.0

type TrainingWatchRecommendation struct {
	Title              string
	CheckID            string
	CheckVersion       string
	Inputs             map[string]detective.InputValue
	IntervalSeconds    Integer
	Trigger            string
	InitialObservation string
	Mode               string
	CooldownSeconds    Integer
	Recovery           bool
}

TrainingWatchRecommendation is an unsaved, display-only Watch proposal. It never creates, enrols, notifies or evaluates a production Watch.

type Value

type Value struct {
	Captured string
	Literal  *Scalar
	Default  *Scalar
}

Value is either a literal scalar or a captured reference with its mandatory literal default.

func (Value) IsCaptured

func (v Value) IsCaptured() bool

IsCaptured reports whether the value references an earlier capture.

Jump to

Keyboard shortcuts

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