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 ¶
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 ¶
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 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 ¶
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.