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

resume

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package resume owns what a --resume invocation must match in its checkpoint. The CLI parses flags into a Request, calls Check, and renders the typed *Incompatibility it returns; the flag-versus-checkpoint table lives here so adding a recorded setting is a one-line change.

Index

Constants

View Source
const (
	FieldRoot          = "root"
	FieldToolSignature = "tool_signature"
	FieldTools         = "tools"
)

Field names a workspace Incompatibility reports.

View Source
const Remedy = "start a fresh task"

Remedy is the advice every recorded-setting conflict carries.

Variables

This section is empty.

Functions

func Apply

func Apply(t *trajectory.Trajectory, cfg *config.AgentConfig)

Apply pins every setting the checkpoint recorded onto cfg, so a resumed run's config selects exactly the tools and context the checkpoint was built with. Call it after Check has accepted the command-line flags; the fields it sets are the same ones the flag table in Check compares, which keeps the resumed run's agent.Options built from cfg the same way a fresh run's are.

func Check

func Check(t *trajectory.Trajectory, req Request) error

Check compares every explicitly set flag in req with the checkpoint and, when req.Root is set, the root, tool fingerprint, and tool names. It returns the first conflict as an *Incompatibility, or nil.

func Load

func Load(path string) (*trajectory.Trajectory, error)

Load reads and structurally validates the checkpoint at path. It is the one entry point a resume uses to read a checkpoint, so the size limit, strict decoding, and validation can't differ between callers.

func MemoryToolsOffered

func MemoryToolsOffered(t *trajectory.Trajectory) bool

MemoryToolsOffered reports whether a checkpoint offered the read-only memory_search and memory_list tools (checkpoints from before they existed resume without them).

func RememberOffered

func RememberOffered(t *trajectory.Trajectory) bool

RememberOffered reports whether a checkpoint offered the remember tool: memory was on, the run was not read-only, and remember is in its tool list.

func Selection

func Selection(t *trajectory.Trajectory, set *skills.Set) tools.Selection

Selection is the tool selection a checkpoint recorded. set is the rediscovered skills (nil when skills were off). Command and external tools are not part of it: t.Tools omits command tools, and checkpoints with external tools are refused before this.

Types

type Flags

type Flags struct {
	ReadOnly       Opt
	Plan           Opt
	Images         Opt
	ApplyPatch     Opt
	Subagents      Opt
	Workers        Opt
	AskUser        Opt
	WebFetch       Opt
	LSP            Opt
	ScopedAgentsMD Opt
	Skills         Opt
	Memory         Opt
	NoAgentsMD     Opt
}

Flags holds the boolean settings a checkpoint records. NoAgentsMD is On when AGENTS.md loading is skipped (--no-agents-md); Skills is the resolved --skills/--no-skills value.

type Incompatibility

type Incompatibility struct {
	Flag     string // "--images"
	Field    string // checkpoint JSON field, "images_enabled"
	Recorded string // how the message names the recorded value, "recorded images setting"
	Want     string // the checkpoint's value, "on" or "off"
	Got      string // the flag's value, "on" or "off"
	Remedy   string // "start a fresh task"
	// Usage marks conflicts the CLI reports as usage errors (exit 2);
	// the others exit 1, as they did before this table existed.
	Usage bool
	// Message, when set, is the whole error text. The root, fingerprint,
	// and tool-set checks use it to keep their established wording.
	Message string
}

Incompatibility reports one CLI setting that contradicts the checkpoint.

func (*Incompatibility) Error

func (e *Incompatibility) Error() string

func (*Incompatibility) ExitCode

func (e *Incompatibility) ExitCode() int

ExitCode is the process exit code the CLI uses for this conflict.

type Opt

type Opt struct {
	Set bool
	On  bool
}

Opt is one boolean CLI setting. Set reports whether the flag was given on the command line; an unset flag never conflicts with the checkpoint.

type Request

type Request struct {
	Flags Flags
	// Root is the canonical execution root of this invocation. When it is
	// set, Check also verifies the checkpoint's root, its tool fingerprint,
	// and its tool-name list (including the remember and skills tools).
	// Leave it empty to check only the flags.
	Root string
	// Skills, when non-nil, is the skills set the checkpoint's tools are
	// rebuilt with; nil means Check discovers skills under Root itself.
	// It is ignored when the checkpoint had skills off.
	Skills *skills.Set
}

Request is the CLI-derived input a resume is checked against.

Jump to

Keyboard shortcuts

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