Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildArgs ¶
BuildArgs maps RunOpts to agent-run CLI arguments after the binary name. The returned slice always starts with "run".
func IsSessionReady ¶
IsSessionReady reports whether tty status stdout is banner + sendable yes.
func ParseTTYStatus ¶
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, 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 ¶
Run resolves the binary, builds argv, launches agent-run, and optionally polls tty status until the session is ready.
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")