Help us shape the future of Go! Take the 2026 Go Developer Survey

agentdriver

package
v0.0.77 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package agentdriver resolves the host process argv used to re-exec into agent-run CLI (ForceNew follow-up and TTY __serve_* children).

Callers pass an optional Driver; empty Binary applies DefaultSelf once. Embedding hosts (e.g. spl) set Binary + Args explicitly:

Driver{Binary: abs(spl), Args: []string{"agent-run"}}

Runtime argv is always:

[abs(Binary), Args..., remainder...]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(d Driver, remainder ...string) (*exec.Cmd, error)

Command resolves d (if needed), builds argv with remainder, and returns *exec.Cmd.

func CommandContext

func CommandContext(ctx context.Context, d Driver, remainder ...string) (*exec.Cmd, error)

CommandContext is like Command with a context.

func MustArgv

func MustArgv(d Driver, remainder ...string) ([]string, error)

MustArgv is Argv after Resolve; for tests and call sites that already handle Resolve.

Types

type Driver

type Driver struct {
	// Binary is the executable path or bare name. Empty → DefaultSelf at Resolve.
	Binary string
	// Args are tokens after Binary and before remainder (e.g. "agent-run" for spl).
	Args []string
}

Driver is the host re-exec configuration for agent-run embedding.

func DefaultSelf

func DefaultSelf() (Driver, error)

DefaultSelf returns Driver{Binary: abs path of this process, Args: nil}.

func Resolve

func Resolve(d Driver) (Driver, error)

Resolve returns a Driver with absolute Binary. Empty Binary uses DefaultSelf. Empty Args entries are dropped. Args from DefaultSelf stay nil when input Args empty.

func (Driver) Argv

func (d Driver) Argv(remainder ...string) ([]string, error)

Argv builds [Binary, Args..., remainder...]. Caller should Resolve first so Binary is absolute; Argv does not re-default empty Binary (returns error).

Jump to

Keyboard shortcuts

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