agentrunbridge

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArgs

func BuildArgs(opts RunOpts) []string

BuildArgs maps RunOpts to agent-run CLI arguments after the binary name. The returned slice always starts with "run".

func IsSessionReady

func IsSessionReady(stdout string) bool

IsSessionReady reports whether tty status stdout is banner + sendable yes.

func ParseTTYStatus

func ParseTTYStatus(stdout string) (screen, sendable string)

ParseTTYStatus extracts screen status and sendable token from `agent-run tty status` human stdout.

Lines:

  • "screen status: <value>" → screen (trimmed value after colon)
  • "sendable: <token> ..." → first whitespace-separated token of the value

Types

type InteractiveOpenOpts

type InteractiveOpenOpts struct {
	SessionID, Prompt, WorkspaceDir, Binary, AgentRunner, RunnerConfigHome string
	NoSubmit                                                               bool
	// AllowRelocateResumeSessionDir maps to agent-run
	// --allow-relocate-resume-session-dir when resuming with a different --dir.
	AllowRelocateResumeSessionDir bool
	// Env is forwarded to RunOpts (each "KEY=VALUE" → agent-run -e KEY=VALUE).
	Env []string
	// ReadyTimeout / ReadyPollInterval optional; 0 → Run defaults (60s / 500ms).
	ReadyTimeout      time.Duration
	ReadyPollInterval time.Duration
	LookPath          func(file string) (string, error)
	RunCommand        func(name string, args ...string) error
	RunOutput         func(name string, args ...string) (string, error)
	Logf              func(format string, args ...any)
}

InteractiveOpenOpts is the minimal interactive --open profile. RunInteractiveOpen fills assumed RunOpts flags and calls Run only.

type RunOpts

type RunOpts struct {
	Prompt, SessionID, Binary, AgentRunner, RunnerConfigHome, WorkspaceDir    string
	AutoSendOrResume, KeepTTY, NewTerminal, Open, Detach, NoSubmit, Stateless bool
	// AllowRelocateResumeSessionDir maps to agent-run
	// --allow-relocate-resume-session-dir (resume --dir vs grok session cwd).
	AllowRelocateResumeSessionDir   bool
	WaitReady                       bool
	ReadyTimeout, ReadyPollInterval time.Duration
	CaptureStdout                   bool
	// Env is a list of "KEY=VALUE" pairs passed to agent-run as repeatable -e flags.
	Env        []string
	LookPath   func(file string) (string, error)
	RunCommand func(name string, args ...string) error
	RunOutput  func(name string, args ...string) (string, error)
	Logf       func(format string, args ...any)
}

RunOpts is the full-config entrypoint for launching agent-run.

type RunResult

type RunResult struct {
	Stdout string
}

RunResult holds optional captured launch stdout.

func Run

func Run(opts RunOpts) (RunResult, error)

Run resolves the binary, builds argv, launches agent-run, and optionally polls tty status until the session is ready.

func RunInteractiveDetach added in v0.0.67

func RunInteractiveDetach(opts InteractiveOpenOpts) (RunResult, error)

RunInteractiveDetach fills the interactive detach RunOpts profile and calls Run.

Defaults filled:

AutoSendOrResume, Detach, WaitReady = true
NewTerminal, Open, CaptureStdout = false
AgentRunner = firstNonEmpty(opts.AgentRunner, "grok-tty")

Uses the same InteractiveOpenOpts input shape as RunInteractiveOpen.

func RunInteractiveOpen

func RunInteractiveOpen(opts InteractiveOpenOpts) (RunResult, error)

RunInteractiveOpen fills the interactive open RunOpts profile and calls Run.

Defaults filled:

AutoSendOrResume, NewTerminal, Open, WaitReady = true
CaptureStdout = false
AgentRunner = firstNonEmpty(opts.AgentRunner, "grok-tty")

Jump to

Keyboard shortcuts

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