agentrunner

package
v0.222.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAgentMessage

func FormatAgentMessage(line []byte) string

FormatAgentMessage parses a JSON line from the agent's stdout and returns a human-readable message to send to the channel. Returns empty string for messages that should not be forwarded (status messages, tool results, etc.).

Types

type ExecFunc

type ExecFunc = func(ctx context.Context, name string, args ...string) *exec.Cmd

ExecFunc matches exec.CommandContext. It is a type alias (not a defined type) so callers' own named exec-override types stay assignable without conversion.

type Options

type Options struct {
	BinaryPath      string
	Exec            ExecFunc
	SessionID       string
	Prompt          string
	Model           string
	Files           []string
	RequireApproval bool
	Remote          bool
	Heartbeat       bool
	ResultFile      string
	ExtraEnv        []string
	Stdin           *os.File
	KeepAlive       bool
	OnLine          func(line []byte)
	Approval        func(ipc.ApprovalRequest) ipc.ApprovalResponse
}

Options configures a single `infer headless` subprocess run.

type Result

type Result struct {
	FinalAssistant string
	Stderr         string
}

Result is the outcome of a subprocess run.

func Run

func Run(ctx context.Context, opts Options) (Result, error)

Run spawns `infer headless ...`, streams stdout line-by-line, optionally brokers tool approval over stdin, and returns the harvested final assistant message. The run logs JSON to stderr, collected into this process's log as it runs. The returned error is the subprocess setup/exit error. Callers format their own user-facing messages from it.

Jump to

Keyboard shortcuts

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