Add this Piglet
Add the Piglet source
pig piglet add npm:@pi-in-go/pigpen-piglet-pig-ternPiG copies the Piglet source into ~/.pig/piglets/ and validates it. Start it with pig --piglet pig-tern.
Piglets run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party Piglet. This one is published by the PiG project from the Pigpen repository; that is not a verification claim.
What this Piglet is
Pigpen index status: planned (it records no signed Binary release for this Piglet). Source in the Pigpen repository ↗
- Not released yet: no signed Piglet Binary is published and no remote install command is offered. The source composition is in this repository; see RELEASE-BLOCKERS.md.
- Needs a PiG with Piglet frontend members (D91) and the component kit (D103), which first ship in PiG 0.5.0. Pigpen builds it on PiG 0.5.3, and the member requires SDK v0.5.3. PiG 0.4.1 rejects slots.frontend.
- The frontend member draws only when PiG runs directly in a Tern pane (TERM_PROGRAM=tern) with no multiplexer between them (TMUX, STY, ZELLIJ and HERDR_ENV unset). Anywhere else, with PIG_TUI_NATIVE=0 or TERN_TSP=0, or when Tern does not answer the surface protocol hello within a second, PiG draws with its own ANSI renderer.
- Native today: user and assistant messages as Markdown, thinking, tool cards (with cancelled status and edit diffs), the working indicator as a Tern spinner, the footer as a Tern status strip, selectors such as /model and /resume as picker sheets, /settings as a prefs sheet, overlays as cards, and the input editor, which takes Tern's edit, undo and send events, so Tern agent blocks and Carly can prompt it. It reports working and idle to Tern with OSC 9;4 terminal progress and names the session file in a hidden pig.session node. Extension components drawn with PiG's component kit (D103), such as pig-music's, become Tern elements, and clicks on them reach the extension as PiG's terminal clicks with the view path, list item and click count. A view's theme overrides are corrected for contrast on Tern's light and dark surfaces. PiG's theme goes to Tern as the program palette and follows Tern's appearance; PiG's mark draws in the settings brand tile; the fullscreen easter eggs play on a Tern screen surface; the footer folder opens in Tern's Files pane; an external editor gets the pane and the surface comes back after. Widgets drawn as raw lines and other extension output still appear as plain lines inside the native surface.
- The member uses PiG's component kit and extension mouse delivery (D103), which are in PiG's SDK from 0.5.0 on. A frontend member is fused into a Piglet Binary, so a build needs PiG's source (PIG_SOURCE_ROOT) as for any Piglet with a frontend slot.
- It is a Go frontend member on PiG's public SDK and Stencil's Go SDK for Tern (github.com/stencil-hq/tern-sdk/go/tern v0.1.0, MIT): building the Piglet needs a Go toolchain, not Node.js, and network access to the Go module proxy or a warm Go module cache for tern-sdk.
- A local Piglet Binary builds and runs in Tern on darwin/arm64, but none is signed or published. The other targets are listed in the manifest and compile-checked only, so no platform is a support claim.
This Piglet selects no extensions or skills of its own.
Binary targets
linux/amd64linux/arm64darwin/arm64darwin/amd64windows/amd64
These are the targets the manifest lists for pig piglet build. Which of them have been built and run is in the notes above.
Signing
- Signed Piglet Binary: none published. Nothing has been signed for this Piglet yet, so
pig piglet pullhas no release to pull. - npm package: 2 registry signatures.
piglet.yaml
# GENERATED by scripts/npm-piglets.mjs from piglets/pig-tern/piglet.yaml. Do not edit.
name: pig-tern
description: "PiG drawn natively in Tern: the transcript, tool cards, diffs, pickers, settings, the input editor and the footer become Tern Surface Protocol nodes. Outside Tern, PiG draws as usual."
release:
version: 0.1.0
build:
targets:
- linux/amd64
- linux/arm64
- darwin/arm64
- darwin/amd64
- windows/amd64
slots:
frontend:
member: ./frontend
skills: []
discovery:
extensions:
- user
- workspace
skills:
- user
- workspace
PiG manifest JSON
The pig field of package.json.
{
"piglet": "piglet.yaml"
}README
Written by the package's publisher, shown as published in version 0.1.0 (README.md). PiG does not review it.
pig-tern
PiG drawn natively in Tern. Run directly in a Tern pane, PiG's interactive mode becomes a Tern Surface Protocol surface: messages render as Markdown, tool calls as tool cards, edits as diffs, selectors as pickers, settings as a prefs sheet, and the input editor as a Tern editor. Outside Tern, PiG draws as usual.
Needs PiG 0.5.3 or later (the member requires SDK v0.5.3). The Piglet fills the frontend slot (slots.frontend, PiG D91) and the member uses PiG's component kit and extension mouse delivery (D103), all in PiG's SDK since 0.5.0. Pigpen builds and tests it on PiG 0.5.3, its pinned release. PiG 0.4.1 rejects slots.frontend.
Source only, not a published release. No release Binary is published. A frontend member is fused into a Piglet Binary, so build one with the reviewed PiG (set PIG_SOURCE_ROOT to a git checkout of it):
npm run stage
pig piglet validate dist/staged/piglets/pig-tern/piglet.yaml
PIG_SOURCE_ROOT=/path/to/pig-git-checkout \
pig piglet build dist/staged/piglets/pig-tern/piglet.yaml --format binary --out ./pig-tern
Then run ./pig-tern in a Tern pane. Building needs a Go toolchain, not Node.js. The member links Stencil's Go SDK for Tern (github.com/stencil-hq/tern-sdk/go/tern), a module outside PiG, so the build needs network access to the Go module proxy or a Go module cache that already holds tern-sdk v0.1.0 and its golang.org/x requirements. See the root release blockers.
When it draws natively
The member draws only when all of these hold. Otherwise it declines and PiG uses its own ANSI renderer, with no difference in behavior.
- PiG runs in a Tern pane (
TERM_PROGRAM=tern). - No multiplexer sits between them:
TMUX,STY,ZELLIJandHERDR_ENVare unset. A multiplexer swallows the protocol's APC strings. PIG_TUI_NATIVEis not0, and neither is the SDK'sTERN_TSP. Set either to0to opt out.- Tern answers the protocol hello within one second. If it does not, PiG falls back for the rest of the run.
What is native
| PiG | Tern |
|---|---|
| User messages | a card around an md node |
| Assistant messages | md nodes; streamed text arrives as appends |
| Thinking | a collapsible card that follows PiG's thinking toggle |
| Tool calls | collapsible tool nodes with name, target, status (including cancelled), elapsed time and output |
| Edit results | diff nodes inside the tool card, with the added and removed line counts |
| Input editor | an editor node with edit, undo and send, without PiG's border lines; it reports sendable when PiG can take a prompt |
| Working indicator | a spinner above the editor that Tern animates, so spinner ticks send no frames; a retry countdown has the warning tone |
| Working and idle state | OSC 9;4 terminal progress while PiG works, repeated every second, and cleared when it stops, so Tern's agent list and cx.agents:wait see a working PiG whatever PiG's showTerminalProgress setting says |
| Footer | a status strip: directory, branch, session name, token usage and cost, context with a meter (warning above 70%, error above 90%), model with an effort for the thinking level, and extension statuses |
Selectors (for example /model, /resume, the session tree, fork, thinking level, login, and an extension's selects) | a picker sheet over the transcript: title, description, search query, tabs, nested rows as a tree, and Cancel and Select actions. Clicks pick, choose, dismiss, clear the search and switch tabs |
/settings | a prefs sheet: on/off settings as switches, settings with a submenu as buttons, the rest as a choice of values |
| Overlays | a card over the transcript around the overlay's lines |
| Session file | a hidden text node with id and role pig.session whose href is the session file PiG writes (none while the session is not persisted), so a Tern plugin can find a pane's session |
| Extension components drawn with PiG's component kit (D103), for example pig-music | Tern elements: text, Markdown, boxes as cards, stacks, lists, select and settings lists, progress bars, loaders, images in their cells, and a titled overlay's frame as its card. A view's theme overrides apply to its own element only |
| Clicks on an extension's view | PiG's terminal click, with the view path, the clicked list item and the click count (so a double click counts), reaches the extension's component as a mouse click does in PiG's own renderer |
| Footer folder | a path span that opens in Tern's Files pane on click |
| PiG's theme | Tern's program palette, sent before the first frame and whenever PiG's colors change. PiG picks a light or dark theme from Tern's appearance, so switching Tern's appearance switches PiG's theme |
| Contrast | an extension view's theme overrides are corrected as Tern corrects a palette: text reads at least 4.5:1 (3:1 for muted, dim and border tokens) on every Tern surface it can land on, in light and dark, so a theme made for a dark terminal stays readable on Tern's light surface |
| PiG's mark | the pig head of PiG's active sprite in the settings sheet's brand tile, as pixel art in place of Tern's π icon |
| Fullscreen easter eggs | a Tern screen surface that plays the animation as one ansi node, with the dock (editor and footer) kept under it |
| External editor | PiG lends the pane to the editor: the surface closes, keeping its transcript, and is adopted again when the editor exits |
| Everything else (widgets drawn as raw lines, an extension's own footer, other extension output) | plain lines inside the surface |
Keys still reach PiG directly, so a picker or prefs sheet behaves like PiG's own selector; Tern's pointer events on it become the same actions.
Because the editor takes send, Tern agent blocks and Carly can prompt PiG. A prompt that arrives while PiG cannot take input, for example during first-time setup, waits until it can.
Frames respect Tern's credits. Tern acknowledges no frame while a pane is hidden, so PiG's startup fits in two frames and later frames wait until the pane shows: an agent started in a background tab still receives its prompt.
Credits
The composition and the frontend member are MIT, Michael Kinsy. The member is built on tern-sdk, Stencil's official Go SDK for Tern (github.com/stencil-hq/tern-sdk/go/tern v0.1.0, MIT, © Stencil Labs, Inc., https://github.com/stencil-hq/tern-sdk). A Binary that fuses the member redistributes it; see CREDITS.md and licenses/tern-sdk-LICENSE.
Signed Binary
This npm package is the Piglet's source: pig piglet add npm:@pi-in-go/pigpen-piglet-pig-tern registers it, and its Packages install from npm. The signed per-platform Binary is published separately on GitHub Releases (release pig-tern/v0.1.0):
pig piglet pull 'github:MichaelKinsy/pigpen/pig-tern@0.1.0'