autopilot

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package autopilot runs queued work items to completion with as little supervision as the task allows: each card is taken into its own isolated workspace, worked by the agent, verified, and recorded — so a backlog can be ground through unattended and every outcome is auditable afterwards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	ID           string    `json:"id"`
	Title        string    `json:"title"`
	Prompt       string    `json:"prompt"`
	Status       Status    `json:"status"`
	Result       string    `json:"result,omitempty"`        // the agent's final reply
	VerifyOutput string    `json:"verify_output,omitempty"` // the verification command's output
	Branch       string    `json:"branch,omitempty"`        // the worktree branch, if kept
	PR           string    `json:"pr,omitempty"`            // the PR url, if opened
	Error        string    `json:"error,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

Card is one unit of work.

type Isolation

type Isolation func(ctx context.Context, label string) (path string, keep func(dirty bool), cleanup func(), err error)

Isolation makes an isolated workspace for a card and returns the path plus a cleanup. When it returns "", the shared workspace is used.

type Runner

type Runner struct {
	// Work runs the agent on a prompt in a workspace and returns its reply.
	Work func(ctx context.Context, prompt, workspace string) (string, error)
	// Verify runs the verification (build/test/lint) in a workspace, returning
	// its output and whether it passed. Nil means "always verified".
	Verify func(ctx context.Context, workspace string) (output string, ok bool)
	// Isolate provides a per-card workspace. Nil runs in Workspace directly.
	Isolate Isolation
	// Workspace is the fallback when Isolate is nil.
	Workspace string
	// Publish opens a PR for a verified, dirty worktree. Nil skips publishing.
	Publish func(ctx context.Context, c Card, workspace string) (prURL string, err error)
}

Runner drives one card through the pipeline. Its collaborators are injected so the orchestration is testable without a real agent, git, or CI.

func (*Runner) Process

func (r *Runner) Process(ctx context.Context, store *Store, c Card) Card

Process takes one card from pending to a terminal state, updating the store as it goes.

func (*Runner) RunAll

func (r *Runner) RunAll(ctx context.Context, store *Store) []Card

RunAll processes every pending card in order and returns the finished cards.

type Status

type Status string

Status is where a card sits in the pipeline.

const (
	Pending  Status = "pending"
	Running  Status = "running"
	Verified Status = "verified" // worked and passed verification
	Failed   Status = "failed"   // errored or failed verification
	Merged   Status = "merged"   // a PR was opened/merged
)

type Store

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

Store persists cards as one JSON file each.

func NewStore

func NewStore(dir string) *Store

NewStore opens (creating if needed) a card store under dir.

func (*Store) Add

func (s *Store) Add(title, prompt string) (Card, error)

Add stores a new card and returns it with its id and timestamps set.

func (*Store) Get

func (s *Store) Get(id string) (Card, bool)

Get returns one card.

func (*Store) List

func (s *Store) List() []Card

List returns every card, newest first.

func (*Store) Pending

func (s *Store) Pending() []Card

Pending returns the cards still waiting to run, oldest first.

func (*Store) Update

func (s *Store) Update(c Card) error

Update writes a card back, stamping UpdatedAt.

Jump to

Keyboard shortcuts

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