binarypiglet

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 13 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

This section is empty.

Variables

This section is empty.

Functions

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 SignatureStatus

func SignatureStatus(record *artifact.Record) (signature.Status, error)

SignatureStatus checks this Piglet Binary's signature block against the author's embedded signer keys and the user's Piglet trust store, offline. An unsigned binary reports Signed=false with no error unless its author embedded a signer or the user's policy requires a signature. A signed manifest must also name this binary's own record, Piglet, target, and Pig version. pig additive (D18): signed Piglet Binaries refuse to start when altered.

func Verify

func Verify() error

Verify checks that the closure baked into a Piglet Binary is a valid, untampered resolution record whose effective digest matches the baked Piglet. 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.

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