agentrunner

package
v0.0.219 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 5 Imported by: 2 modules, 1 package

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

Overview

Package agentrunner provides lean parent-agent detection with no heavy deps. Consumers (e.g. tsk status auto-format) can import this package without pulling in subagent, logging, or UI code.

Index

Constants

This section is empty.

Variables

View Source
var TestProcessNameFunc func(pid int) string

TestProcessNameFunc, when non-nil, overrides PID → process-name lookup used during parent-process detection. Tests set this to inject a fake process tree.

Functions

func Detect

func Detect(opts Options) (runner string, ok bool)

Detect reports the parent agent runner if one is found. Priority:

  1. Options.AgentRunnerEnv env override (if name non-empty and set)
  2. CODEX_THREAD_ID → "codex"
  3. PI_CODING_AGENT → "pi"
  4. parent process name: opencode|pi|crush|codex|grok
  5. grandparent: pi|grok

Types

type Options

type Options struct {
	// AgentRunnerEnv is the env var name for explicit override (empty = skip).
	AgentRunnerEnv string
	// EnvLookup, when non-nil, is consulted before os.Getenv for detection env
	// keys. Return (value, true) to force a value (empty = treat as unset);
	// ("", false) falls through to the process environment. Request-scoped.
	EnvLookup func(key string) (string, bool)
}

Options configures detection.

Jump to

Keyboard shortcuts

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