Repository navigation
v0.5.3
v0.5.3
PiG 0.5.3 is a security, fix and Pi-catch-up release. It follows Pi v1.4.0 plus the 13 commits on Pi's main branch up to 74f46864. Install it with go install github.com/MichaelKinsy/PiG/cmd/pig@latest or npm i -g @pi-in-go/pig.
PiG is a Go implementation of Pi, the reference. Pi's behavior is the contract, and every place PiG differs is a numbered divergence. PiG is not an official Pi project.
Security
pig piglet validate and pig piglet add no longer run npm lifecycle scripts (preinstall, install, postinstall, prepare) of the Packages a Piglet names, their dependencies, or the Piglet source itself. Before, validating or adding a Piglet ran a publisher's postinstall before you had looked at it. If a Package really needs its install script, pass --allow-install-scripts for that one command.
Upgrading
- Go API
durable:Storage.Committakes an adopt callback, as Pi'scommit(writes, adopt, context). Before:storage.Commit(ctx, writes). After:storage.Commit(ctx, writes, func(seq durable.Seq) {}). A Storage calls it once, synchronously, when the batch is durable and before its next commit, and never for a commit that fails; a Storage that resolves without calling it fails the Session. Code that wraps or implements Storage must pass it through. - Go API
durable,chord:WatchHandle,WatchEndand the end reasons move tochord;durable.WatchHandle,durable.WatchEndand theWatch*reason constants are aliases of them. The reasonssession_closedandsession_failedare nowended(WatchEnded) andfailed(WatchFailed). - Go API
durable:Session.DocumentStateErased,DocumentState,DocumentStateOf,Conversation.ViewStateandHarness.TaskGraphare removed, as in Pi. UseWatchDoc,Conversation.WatchandHarness.WatchTaskGraph; start the watch to keep its value current, and stop it where the state was disposed. - A document watch ends
retiredonly when its document is retired, not on a null value.
Added
durable.HarnessOptions.ReadOnlyopens a Harness as a viewer of a session another process drives: open leaves running tasks as committed instead of recovering them, every commit with writes fails with the newdurable.ReadOnlySessionbefore it reaches Storage (the Session stays healthy, and a commit that writes nothing succeeds),Resume()panics with it and every call that enables scheduling returns it,Wake()is always inactive andOnWakeis never called. Reads, snapshots and watches keep working; reopen withoutReadOnlyto write. Ports Pi'sHarnessOptions.readOnly.ai.UsageCost.TotalFromProvider(usage.cost.totalFromProvideron the wire) records whethercost.totalis the billed cost the provider reported or an estimate from the model's catalog rates. Catalog-priced usage writesfalse, an absent value in a recorded session also meansfalse, and a combined usage is provider-reported only when both parts are. Ports Pi'sUsage.cost.totalFromProvider.
Changed
- The Durable example tests are renumbered as in Pi (
TestExample04WatchesthroughTestExample30ReloadAndRestart); the chord-state example is gone. pig piglet validateandpig piglet addaccept--allow-install-scripts, which installs a Piglet's Packages with lifecycle scripts for that one command. Migration: a Piglet whose Package needs its install script to produce files must be validated or added with the flag.pig install,pig updateand the other Package commands are unchanged and still run lifecycle scripts, as Pi does.
Fixed
- A fused Go extension's built-in tool
executewithout an extension context (createBashTool(cwd).execute(id, params)and the othercreate<Tool>Toolforms) no longer fails with "extension stopped while waiting for builtinTool.execute response" when another extension in the same process stops while the tool runs. The call has noContext, so it was sent over the connection of the first running extension in the process. The host now runs the tool for a fused extension directly, reaching back into the extension in the same process for the functions of its options and its streamed updates. - Extensions'
ui_prompt_startandui_prompt_endnotifications are recorded in order when the host is slow to apply the start event'sctx.ui.notify: the dialog's answer is no longer let through, and the end event no longer sent, before the handler's own host call has applied. A blocked-on-a-host-call report from an extension runtime admitted the UI prompt drain as soon as it was read, while the call it announced was still queued; the admission now waits for that call. - A fused Go extension's
createLocalBashOperations().exec(andcreateLocalPowerShellOperations) no longer fails with "extension stopped while waiting for builtinTool.localExec response" when another extension in the same process stops while the command runs; a command past itstimeoutrejects with Pi'stimeout:<seconds>. The call has noContext, so it was sent over the connection of the first running extension in the process, and ended with that extension, whichever made the call. The host now runs the command for a fused extension directly, as it already does for the other helpers that have noContext, so the command depends on no extension, as Pi's exec depends on none. - The Piglet JSON Schema that
pig piglet schemaprints rejectedpowershellintools, whichpig piglet validateaccepts as a built-in tool, and stated nothing for most of the other closed vocabulary. It now lists all eight built-in tools, the strip IDs of each strip list, theagentEnvruntime modes (inject,image) and policy presets (minimal,standard,elevated), and carries the parser's name, build target, output name, release version and secret patterns, the requiredsourceandtargetof a mount, and the rule thatagentEnvnames exactly one ofimage,devContainerandsource.make piglet-strip-idswrites the strip ID enums, and tests that read the parser's sets from code fail when the schema and the parser disagree. - OpenRouter turns (the built-in provider and custom providers on OpenRouter's endpoint) now take OpenRouter's reported total as
usage.cost.totalfor OpenAI Completions and Anthropic Messages streams, plus the upstream inference cost for a BYOK request, instead of the catalog estimate, and mark it provider-reported. The export HTML header uses the recorded total. Replaces PiG's earlier D124 form of this fix with Pi's. - An Anthropic request holds a mid-conversation system update until an assistant message that is actually sent, so an assistant message that converts to no blocks no longer moves the update before a user message.
pig install <source> --validate-onlynow validates git and npm sources that are not installed yet. It fetches them into a temporary directory that is removed afterwards, and no longer reportsstat …/git/<host>/<owner>/<repo>: no such file or directory. Installed packages and settings are not touched.- Installing a Package or Piglet from a local
git:file://source on Windows no longer fails withfatal: '$GIT_DIR' too big. A file URL now checks out to<install root>/localhost/<12 hex of the path's sha256>/<basename>instead of re-nesting the whole absolute path, which pushed$GIT_DIRpast Git for Windows' own path limit thatcore.longpathsdoes not lift. Sources Pi accepts keep Pi's exact layout. A file URL checkout made by an earlier version is not reused and is cloned again.