agentruncli

package
v0.0.112 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendEventBusFlags added in v0.0.112

func AppendEventBusFlags(args []string, url, token string) []string

AppendEventBusFlags appends --event-bus-url / --event-bus-token to args when URL is non-empty. Empty URL returns a copy of args unchanged (no flags added). Token is appended only when non-empty.

func ClearProcessHostDriver added in v0.0.72

func ClearProcessHostDriver()

ClearProcessHostDriver clears the process default (tests).

func Handle

func Handle(args []string) error

Handle is the full agent-run CLI entrypoint for args after the program name (os.Args[1:]). Same command surface as today's cmd/agent-run: web, run, resume, attach, send, msg, snapshot, watch, sessions, status, kill, tty, pty, top-level help, --agent-runner, and internal serve/stub paths. Success (including help) returns nil; failures return an error for the thin main to print and exit 1.

func NotifyOnOpenPath added in v0.0.112

func NotifyOnOpenPath(kind string, opts EventBusOpts, sessionID, runner, workspace string)

NotifyOnOpenPath dispatches open-path publish policy:

  • "new-terminal" — after successful ForceNew / open-profile → NotifyTTYStarted once
  • "send" — live send path → no-op (never publishes)

func NotifyTTYStarted added in v0.0.112

func NotifyTTYStarted(opts EventBusOpts, sessionID, runner, workspace string)

NotifyTTYStarted publishes type=agent.tty.started source=agent-run with payload {session_id, runner, workspace}. Best-effort: empty URL is a no-op; publish errors write a "warning:" line and never return to the caller.

func RunFocus added in v0.0.89

func RunFocus(args []string, stdout, stderr io.Writer) error

RunFocus implements `agent-run focus` with injectable writers for L2 tests. CLI surface: focus <session-id> [--index N] [--dry-run] [--session-id ID] [-h]

func RunHelpText added in v0.0.112

func RunHelpText() string

RunHelpText returns the `agent-run run -h` help body (same text flags.Help uses). Always ends with a trailing newline.

func SetProcessHostDriver added in v0.0.72

func SetProcessHostDriver(d agentdriver.Driver)

SetProcessHostDriver sets the default host Driver for this process when Opts leave Driver zero. Used by embedding hosts (spl agent-run); bare agent-run leaves this unset so serve falls back to agentdriver.DefaultSelf.

Types

type EventBusOpts added in v0.0.112

type EventBusOpts struct {
	URL   string
	Token string
	// PublishHook, when set, replaces the production HTTP publisher (tests).
	// Signature matches wire type/source + payload only (no eventbus import in harness).
	PublishHook func(ctx context.Context, eventType, source string, payload json.RawMessage) error
	// WarnWriter receives best-effort failure lines (prefix "warning:"). Nil → os.Stderr.
	WarnWriter io.Writer
}

EventBusOpts configures best-effort publish of agent.tty.started events. Empty URL disables publish (no HTTP, no warning). PublishHook is the L2 inject seam; when nil, production uses eventbus.NewPublisher.

type FrontendSource added in v0.0.71

type FrontendSource string

FrontendSource names where the SPA tree came from.

const (
	FrontendSourceEmbed    FrontendSource = "embed"
	FrontendSourceCache    FrontendSource = "cache"
	FrontendSourceDownload FrontendSource = "download"
	FrontendSourceA1       FrontendSource = "a1"
)

type ResolvedFrontend added in v0.0.71

type ResolvedFrontend struct {
	FS       fs.FS
	Source   FrontendSource
	CacheDir string
	// EnsureErr is set when download was attempted and failed (A1 fallback).
	EnsureErr error
}

ResolvedFrontend is the result of resolveAgentRunFrontend. When Source is FrontendSourceA1, FS is nil and callers should serve the A1 shell.

type TakeoverDeps added in v0.0.112

type TakeoverDeps struct {
	ListProcs func() []procresolve.Proc
	Lsof      func(pid int) []string
	Kill      func(pid int, sig syscall.Signal) error
	WaitDead  func(pid int, timeout time.Duration) bool
	OpenIterm func(dir string, followUp string) error
	// HooksActive is true when AGENT_RUN_TAKEOVER_TEST_HOOKS was loaded (synthetic PIDs).
	HooksActive bool
	// ProcsSnapshot is the full ListProcs result used for ancestry walks.
	ProcsSnapshot []procresolve.Proc
	// KillLog path from hooks file (may be empty).
	KillLog string
}

TakeoverDeps injects process/kill/iTerm behavior for tests. When nil fields are present, production defaults are used unless hooks env is set.

Jump to

Keyboard shortcuts

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