binarypiglet

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package binarypiglet holds the Piglet and resolution record embedded in a Piglet Binary. A Piglet Binary always bakes the piglet fields needed to assemble the agent (extensions, skills, MCP, scoping, discovery) and, for a built Piglet Binary, its resolution record so the binary can verify its own build identity at startup. A signed build also embeds its author's signer public keys in signers.txt and carries a signature block after the executable bytes (see coding/piglet/signature). Stock Pig ships piglet.yaml, resolution-record.json, and signers.txt empty: Default returns nil, Verify is a no-op, and startup resolves the piglet exactly as before.

Index

Constants

View Source
const CompiledFrontendMember = "compiled-in"

CompiledFrontendMember is the member path the base of an overlay gives the frontend compiled into the Binary, which has no directory at run time.

Variables

This section is empty.

Functions

func Closed

func Closed() bool

Closed reports whether this executable is a Piglet Binary built with build.closed, or one whose baked Piglet cannot be read (it then accepts nothing). Stock pig is not closed.

pig additive (D202): `pig piglet show` names whether a Piglet Binary is closed.

func Default

func Default() *piglet.Piglet

Default returns the baked piglet, or nil when none was baked. It is intentionally conservative: any parse failure, or a baked piglet with only a name and no agent-defining fields, yields nil so the caller's normal piglet resolution runs unchanged.

func DefaultClosure

func DefaultClosure() (*artifact.Record, error)

DefaultClosure returns the Piglet resolution record baked into this binary, or nil when none was baked (stock pig). A non-empty but malformed closure is a fail-closed condition: it returns an error rather than a nil record so the caller refuses to run a tampered binary.

func IsPigletBinary

func IsPigletBinary() bool

IsPigletBinary reports whether this executable was built as a Piglet Binary bound to one baked Piglet. It keys on the presence of a baked closure, so a stock pig build (no closure) is not a Piglet Binary.

func Name

func Name() string

Name returns the name of the Piglet baked into this Binary, or "" for stock pig.

func OverlayBase

func OverlayBase() *piglet.OverlayBase

OverlayBase returns the baked Piglet as the base of an overlay when this Piglet Binary accepts one (every Piglet Binary does unless its Piglet set build.closed), and nil otherwise, including for stock pig. The flag is part of the baked Piglet, so the digest the record and the signed manifest name covers it.

pig additive (D202): a Piglet Binary accepts overlay Piglets unless built closed.

func Verify

func Verify() (cacheErr, err error)

Verify checks that the closure baked into a Piglet Binary is a valid, untampered resolution record whose effective digest matches the baked Piglet, and checks its signature. Stock pig (no baked closure) verifies trivially. A built Piglet Binary that fails these checks must not run: its recorded build identity or its embedded Piglet has been altered. A signed Binary whose unchanged file passed before skips re-hashing its executable bytes (see signature.CheckCached). cacheErr reports that a passing check could not be remembered; the Binary still runs, and its next start checks it in full again.

func VerifyRegisteredClosure

func VerifyRegisteredClosure(fusedNames, packedNames []string) error

VerifyRegisteredClosure checks that the fused and binary-packed extension components a built Piglet Binary actually registers at startup match its baked plan. A tampered fuse registry or cell manifest, or a PATH/ambient substitute for a component the plan says was built in, fails closed. Stock pig (no baked closure) is a no-op. Components the plan supplies from a release, agentEnv, or an external service are not carried in the binary and are excluded from this check.

Types

This section is empty.

Jump to

Keyboard shortcuts

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