agentrun

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitErrIsBenign added in v0.14.0

func ExitErrIsBenign(err error) bool

ExitErrIsBenign reports whether err is the OS-level "process already gone" or "self-signalled exit" shape that surfaces during expected teardown of an agent-run child. Returns false for nil and for any other error. Wrapped errors are unwrapped via errors.Is / errors.As.

Benign classes:

  • syscall.ESRCH (no such process — kill/signal raced child exit)
  • syscall.EPIPE (broken pipe — fd write after child exit)
  • os.ErrClosed (write/close after fd already closed)
  • *exec.ExitError where ExitCode() == 143 (SIGTERM) or 137 (SIGKILL)
  • *exec.ExitError where the child was signal-killed by SIGTERM or SIGKILL (Signaled() with the matching signal — covers the case where the child has no signal handler and ExitCode() returns -1).

func ReapDescendantGroups added in v0.16.0

func ReapDescendantGroups(rootPid int, logger *slog.Logger)

ReapDescendantGroups SIGKILLs every process group that contains a descendant of rootPid, except the caller's own group, rootPid's own group, and the init/invalid group (pgid <= 1). It is the deterministic half of the operator-SIGTERM teardown contract: claude isolates every Bash command into its own detached process group two levels below pyry and does NOT kill that group even when given a graceful SIGTERM, so pyry must reap it here (#565).

Best-effort and content-blind: it reads pid/ppid/pgid triples only — never process command lines — and logs enumeration or signal failures at Warn (pids/pgids only) without propagating them; claude still receives its SIGTERM regardless. Safe to call on the os/exec watcher goroutine: it reads only its arguments, shells out to ps, and issues kills — no shared state.

The caller wires this into cmd.Cancel, which fires only once, at the single teardown moment when rootPid and its whole descendant tree are guaranteed alive and not-yet-signalled — so the ps snapshot sees the live tree and the walk is race-free, not a hopeful defer-time scan.

Types

This section is empty.

Directories

Path Synopsis
Package jsonl parses claude session JSONL output into structured events, surfacing every line (assistant, user, tool_use, tool_result, system, attachment, or unrecognised) with its verbatim bytes, alongside a deterministic end-of-turn signal on assistant entries.
Package jsonl parses claude session JSONL output into structured events, surfacing every line (assistant, user, tool_use, tool_result, system, attachment, or unrecognised) with its verbatim bytes, alongside a deterministic end-of-turn signal on assistant entries.
Package selfcheck implements the verification that the per-agent tool-allowlist enforcement contract still refuses tools NOT in permissions.allow when claude is spawned headlessly on the stream-json surface with a per-spawn deny-default settings file.
Package selfcheck implements the verification that the per-agent tool-allowlist enforcement contract still refuses tools NOT in permissions.allow when claude is spawned headlessly on the stream-json surface with a per-spawn deny-default settings file.
Package settings writes per-spawn deny-default permission JSON files for interactive claude spawned via PTY drive.
Package settings writes per-spawn deny-default permission JSON files for interactive claude spawned via PTY drive.
Package streamrunner spawns claude with the stream-json input/output formats as a plain subprocess (no PTY), writes one user-turn JSON envelope to its stdin, forwards stdout/stderr to caller-supplied writers, and waits for the child to exit.
Package streamrunner spawns claude with the stream-json input/output formats as a plain subprocess (no PTY), writes one user-turn JSON envelope to its stdin, forwards stdout/stderr to caller-supplied writers, and waits for the child to exit.
Package trust pre-answers, in ~/.claude.json, the startup gates a headless claude child cannot answer for itself: the workspace-trust gate, which interactive claude renders as a modal, and the approval that lets a CLAUDE.md `@` import resolving outside the session's working directory expand.
Package trust pre-answers, in ~/.claude.json, the startup gates a headless claude child cannot answer for itself: the workspace-trust gate, which interactive claude renders as a modal, and the approval that lets a CLAUDE.md `@` import resolving outside the session's working directory expand.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL