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

bootstrap

package
v0.2.7 Latest Latest
Warning

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

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

Documentation

Overview

Package bootstrap is what `steerloop run` and `steerloop chat` share: the flags they both take, the loop each turn runs, its tools and the recording. How turns are run is each command's own business.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitialMessages

func InitialMessages(opts Options) ([]*schema.Message, error)

InitialMessages is the conversation the first turn starts from: the --system-prompt file, if any, then the user prompt, if any.

func ParseFlags

func ParseFlags(flags *flag.FlagSet, args []string, stderr io.Writer) error

ParseFlags parses args 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.

Types

type Loops

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

Loops builds the loop for a turn. A loop runs once, so a command that runs several turns asks for a fresh one each time, all with the same settings and the same model; the command carries the conversation over.

func NewLoops

func NewLoops(ctx context.Context, env cli.Environment, opts Options, humanAvailable bool) (Loops, error)

NewLoops connects to the model and loads the tools. humanAvailable says whether someone can answer an ask_user or confirm question.

func (Loops) New

func (f Loops) New() (*loop.Loop, error)

New builds a loop, ready to start.

func (Loops) StopCondition

func (f Loops) StopCondition() loop.StopCondition

StopCondition is how every loop ends, which the trace shows.

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
	OutputRecordPath string // also write every event to a JSONL file
	Debug            bool
}

Options are the flags of every command that runs the loop. Each command adds its own --user-prompt, since only `run` requires one.

func (*Options) AddFlags

func (o *Options) AddFlags(flags *flag.FlagSet)

AddFlags registers the shared flags on flags, filling o.

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 loops are built, still before any network call.

type Recording

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

Recording is the JSONL file a run, or every turn of a chat, writes each 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 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