← Catalog

@pi-in-go/pigpen-herdr

PiG agent-state reporter (Go extension) for the herdr terminal workspace manager, with a Skill for driving Herdr Desktop

ExtensionSkillPigpen

Install

Install with PiG

pig install npm:@pi-in-go/pigpen-herdr
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package. This one is published by the PiG project from the Pigpen repository; that is not a verification claim.

Pi manifest JSON

The pi field of package.json.

{
  "skills": [
    "skills/pigpen-herdr-desktop"
  ],
  "extensions": [
    "extensions/herdr"
  ]
}

README

Written by the package's publisher, shown as published in version 0.3.0 (README.md). PiG does not review it.

herdr reporter Package

Go extension, written against PiG's public Go extension SDK, that reports PiG's idle, working and blocked state to herdr, the terminal workspace manager, over herdr's socket, as herdr-pig does. Outside a herdr pane the reporter registers nothing. It needs no Node.js: PiG builds it from source with a Go toolchain, and a Piglet Binary fuses it. It reports state, the resume command (herdr 0.9.2+) and release. See the herdr Piglet for what it reports and how it behaves.

It works on its own. Installing this Package is enough: no Piglet is needed. The herdr Piglet is an optional composition that selects this same Package. Use it directly from the Pigpen checkout root:

pig package validate ./components/herdr
pig install ./components/herdr

The local install references this checkout; keep it at its installed path and remove it with pig remove using the same path. The herdr Piglet selects this Package through npm run stage.

PIG_BIN=/path/to/pig npm run test:go runs go test in extensions/herdr against a fake herdr socket (a unix socket server) and a wire-level fake PiG host that also dispatches pi.events; it needs a Go toolchain and PiG's SDK (PIG_SDK_DIR, PIG_SOURCE_ROOT or PIG_BIN selects it).

It does what herdr-pig does. The original is herdr-pig at 3ec680471e82 (extensions/herdr-agent-state.ts, Apache-2.0, vendored unmodified in port/oracle). The Go extension talks to herdr the way it does: newline-delimited JSON over herdr's socket (pane.report_agent, pane.release_agent), source and agent pig, one connection per request, a retry of the same request after 0.5 s and then 1.5 s, the resume command pig --session <session file> (or <id>), and a release only on a quit. HERDR_ENV=1, HERDR_SOCKET_PATH and HERDR_PANE_ID switch it on; herdr itself need not be on PATH. Its seven tests are twins, a replay of 98 event sequences against the original in Node must give the same request lines byte for byte, and pigeq scenarios run both under Pi and PiG. port/PORT.md is the record, with the contract table and every difference.

What the port adds or does differently, and why it does not change what herdr sees from the original:

AdditionBehavior
Prompt-based blockedOff by default. PIGPEN_HERDR_UI_PROMPTS=1 also reports blocked while a PiG dialog (ui_prompt_start / ui_prompt_end) is open, with its title as the message. Pi has no such event, so without the opt-in the port reports what the original reports
A stderr lineOne line when herdr did not take a request, repeated only after a request was delivered in between
session_startChanges nothing but the session: the blocked counters carry over, as in the original (Pi loads a fresh copy of the extension for every session)

agent_settled reports idle only when isIdle() succeeds and returns true, as in the original.

herdr:blocked. The extension listens for herdr:blocked on pi.events ({ active, label }), the bus herdr's own Pi integration handles, so another extension can mark a block that is not a UI prompt. It uses PiG's Go SDK bridge (Extension.Events(), PiG 0.4.0 and later). The label is sent as given, and active is read with JavaScript's truthiness, as in herdr-pig by Christian Polzer and Hai-Fai Solutions (Apache-2.0). It does not run on Pi: Pi users keep herdr's own Pi integration.

To install it from herdr instead, use the herdr plugin in piglets/herdr/herdr-plugin.

Herdr Desktop. Herdr Desktop (the Herdr app with herdr-core, hc) is not herdr, and needs no reporter:

  • Its terminals carry HC_TERMINAL_ID and HC_TERMINAL_SOCKET, not HERDR_*, so the reporter stays inactive there.
  • PiG writes its own status as OSC 7501: working, blocked while a dialog is open, done, error and idle, with app pig. Checked with PiG 0.5.3, the Herdr app 0.1.11 and herdr-core 0.1.16.
  • Not carried over: the herdr:blocked event on pi.events, and the resume command. Herdr Desktop keeps its terminals running across window restarts, and a lost program gets a shell, not its command again.
  • The Package's pigpen-herdr-desktop Skill teaches PiG to drive Herdr Desktop: hc to start, read, message and wait on agents, and herdr-app to change the window when the person asks. It applies only when HC_TERMINAL_ID is set.
  • With pigpen-subagents 0.3.0 or later, "subagents": { "herdrPanes": true } opens the subagent tool's children as panes beside the parent.

MIT, by Michael Kinsy, with the port of herdr-pig's extension under the Apache License 2.0 (LICENSE-herdr-pig, NOTICE); see provenance.json.