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

runcmd

package
v0.2.6 Latest Latest
Warning

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

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

Documentation

Overview

Package runcmd is `steerloop run`. Start at run.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

Command is `steerloop run`. It implements cli.Command.

func New

func New(env cli.Environment) *Command

func (*Command) Run

func (c *Command) Run(ctx context.Context, args []string) int

Run reads top to bottom: parse, validate, build, execute.

type EventSink

type EventSink interface {
	Write(evt event.Event)
}

EventSink receives every event the loop emits. → cmd/steerloop/internal/render (people), steerloop/internal/eventlog (machines)

type Options

type Options struct {
	// Prompt Options
	SystemPromptPath string
	UserPrompt       string
	// Model Options
	Model       string
	Temperature float64 // below 0: not sent, so the provider's default applies
	MaxTokens   int
	// Loop Options
	MaxIterations    int
	IterationTimeout time.Duration
	TotalTimeout     time.Duration
	StopCondition    string
	Reflect          string // "on-iteration" or "on-finish"
	// Tool Options
	ToolsManifestPath string
	AutoApprove       bool
	AskUser           bool
	// Output Options
	Output           string
	OutputRecordPath string // also write every event to a JSONL file
	Debug            bool
	// Steering/Loop Control Options
	ControlPath string // give the loop a stream of commands that arrive over time, same as if a person typed it at the terminal
}

Options is the `steerloop run` command line.

func ParseOptions

func ParseOptions(args []string, stderr io.Writer) (Options, error)

ParseOptions reads flags into Options and reports its own errors to stderr. It rejects leftover arguments: the flag package stops at the first one, so `--user-prompt fix the bug --debug` would otherwise run with the prompt "fix" and drop the rest without a word.

func (Options) Validate

func (o Options) Validate() error

Validate rejects options the loop cannot run with, and flags that would be silently ignored. It reports every problem at once, not just the first. Files (--system-prompt, --tools) and the model spec are checked when the run is built, still before any network call.

type Recording

type Recording struct {
	// contains filtered or unexported fields
}

Recording is the JSONL file a run writes every event to, for `steerloop replay`. It is an EventSink.

func OpenRecording

func OpenRecording(path string, now time.Time) (*Recording, error)

OpenRecording creates the file for path:

  • a path ending in .jsonl is that file, created or truncated;
  • anything else is a folder, created if needed, that gets one new <timestamp>-<random>.jsonl file per run. A relative folder sits under the repo root.

Files in a folder are created readable by the owner only: a recording holds prompts and tool output.

func (*Recording) Close

func (r *Recording) Close() error

func (*Recording) Path

func (r *Recording) Path() string

Path is where the recording is, to pass to `steerloop replay --path`.

func (*Recording) Write

func (r *Recording) Write(evt event.Event)

type Run

type Run struct {
	// contains filtered or unexported fields
}

Run is one fully wired run, ready to execute. wire.go builds it.

func NewRun

func NewRun(ctx context.Context, env cli.Environment, opts Options) (*Run, error)

Wire builds a Run from options. It is the only place that picks a concrete type for each interface run.go declares, so this function alone tells you which implementation runs.

func (*Run) Execute

func (r *Run) Execute(parent context.Context) int

Execute runs one turn. Exactly three goroutines take part, all started here:

  1. the loop itself — loop.Start; it closes events when it is done
  2. steering input — r.steering.Steer
  3. Ctrl-C handling — r.interrupts.Watch

cancel (deferred) ends 2 and 3 once the loop has finished.

type SteeringSource

type SteeringSource interface {
	Steer(ctx context.Context, loop *loop.Loop)
}

SteeringSource feeds a person's input into a running loop. → cmd/steerloop/internal/steering

type Toolset

type Toolset struct {
	Infos    []*schema.ToolInfo
	Executor loop.ToolExecutor
	Gates    map[string]pause.Handler // tool name → the gate that handles it
}

Toolset is what the model can call, and the gates in front of some of it. Gates are loop pause.Handlers, so they go straight into loop.Config with no conversion.

func NewToolset

func NewToolset(opts Options, humanAvailable bool) (Toolset, error)

Jump to

Keyboard shortcuts

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