headless

package
v0.228.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 9 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
	Heartbeat  bool
	ResultFile string
	ExtraEnv   []string
	Stdin      *os.File
	KeepAlive  bool
	OnLine     func(line []byte)
}

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 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