Documentation
¶
Overview ¶
Package agentrun provides workdir-encoding helpers used by the JSONL session-file watcher (#349) to locate claude's per-session output under ~/.claude/projects/<encoded-cwd>/.
MUST NOT log file contents. Callers that consume the resolved paths must uphold the same constraint at their layer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeProjectDir ¶
EncodeProjectDir returns the dashed directory-name segment claude uses under ~/.claude/projects/ for the given workdir. Chains ResolveWorkdir then maps '/' and '.' to '-' in the resolved absolute path. The result does NOT include the ~/.claude/projects/ prefix or any .jsonl suffix.
func ResolveWorkdir ¶
ResolveWorkdir returns the resolved absolute path of workdir, mirroring how claude resolves a workdir before reading ~/.claude.json's projects map. Resolves symlinks (macOS /var → /private/var). Wraps fs.ErrNotExist when the path does not exist.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package budget enforces the pyry-side --max-turns cap for agent-run by counting assistant JSONL entries and signalling the claude child when the budget is reached.
|
Package budget enforces the pyry-side --max-turns cap for agent-run by counting assistant JSONL entries and signalling the claude child when the budget is reached. |
|
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. |
|
tail
Package tail watches ~/.claude/projects/<encoded-cwd>/<sid>.jsonl for claude's per-session JSONL output, opens the file as it appears, and feeds appended bytes into a jsonl.Reader until the deterministic end-of-turn signal fires or the caller cancels.
|
Package tail watches ~/.claude/projects/<encoded-cwd>/<sid>.jsonl for claude's per-session JSONL output, opens the file as it appears, and feeds appended bytes into a jsonl.Reader until the deterministic end-of-turn signal fires or the caller cancels. |
|
Package selfcheck implements the boot-time verification that the per-agent tool-allowlist enforcement contract still refuses Bash when claude is spawned with `--allowed-tools "Read" --dangerously-skip-permissions` in stream-json mode and asked for Bash.
|
Package selfcheck implements the boot-time verification that the per-agent tool-allowlist enforcement contract still refuses Bash when claude is spawned with `--allowed-tools "Read" --dangerously-skip-permissions` in stream-json mode and asked for Bash. |
|
Package streamjson re-emits the parsed claude session-JSONL Event stream onto a writer (typically pyry's stdout) and composes a single `type:"result"` trailer line when the run terminates.
|
Package streamjson re-emits the parsed claude session-JSONL Event stream onto a writer (typically pyry's stdout) and composes a single `type:"result"` trailer line when the run terminates. |
|
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. |