move

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 30 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 move moves a session between locations with the same agent: plan (pure decisions, nothing written) and apply (stage, rewrite, verify, install with a journal, record lineage). Every agent-specific step is the module's.

Index

Constants

View Source
const (
	CheckedBrief = "brief" // it begins with the briefing hopsesh sent
	CheckedNone  = "none"  // nothing to check it against
)

Checks of a copy whose vendor states no count.

View Source
const (
	RelationNew      = "new"      // no copy there yet: a new session
	RelationAppend   = "append"   // the copy there is as it was left: add the new work to it
	RelationSame     = "same"     // nothing new on either side
	RelationBehind   = "behind"   // only the copy there changed
	RelationDiverged = "diverged" // both changed
)

Relations between a session and its copy in the other agent.

View Source
const (
	FetchWaiting  = "waiting"  // the driver has not written its copy yet
	FetchComplete = "complete" // every message the cloud sent is here
	FetchPartial  = "partial"  // fewer messages than the cloud said it sent
	FetchEmpty    = "empty"    // a copy with no messages
	FetchCode     = "code"     // the code only, as asked
	// FetchUnchecked: a copy with messages that nothing can be checked against (the vendor
	// states no count, and hopsesh did not start the cloud session, so no briefing either).
	FetchUnchecked = "unchecked"
)

Outcomes of a fetch.

View Source
const (
	BranchPushed  = "pushed"
	BranchMissing = "missing" // the session never pushed its work
	BranchUnknown = "unknown" // the driver finds it itself
)

States of a fetch's cloud branch.

View Source
const (
	StepSnapshot = "snapshot"
	StepPush     = "push"
	StepStart    = "start"
	StepLineage  = "lineage"
)

Steps of a hand-off, in order.

View Source
const (
	StepTodo    = "todo"
	StepDone    = "done"
	StepFailed  = "failed"
	StepSkipped = "skipped"
)

Step states.

View Source
const (
	CleanupNever      = "never"
	CleanupAfterMerge = "after-merge"
	CleanupOnUndo     = "on-undo"
)

Branch cleanup choices.

View Source
const (
	HopWaiting = "waiting" // the first leg waits for the driver in the user's terminal
	HopDone    = "done"
	HopFailed  = "failed"
)

Where a hop stands.

View Source
const (
	ViaImport  = "import"
	ViaHopsesh = "hopsesh"
)

Via choices: the target agent's own importer, or hopsesh's conversion even when the configuration prefers the importer.

View Source
const (
	ConflictReplace  = "replace"
	ConflictKeepBoth = "keep-both"
)

Conflict choices when the copy here changed too.

View Source
const (
	KindMove     = "move"     // the same agent, another place
	KindContinue = "continue" // another agent

)

Kinds of plans.

View Source
const (
	RepoUse        = "use"         // an existing checkout here
	RepoClone      = "clone"       // clone it
	RepoNeedsClone = "needs-clone" // not here and cloning was not asked for
	RepoDir        = "dir"         // the folder the user chose
	RepoNone       = "none"        // not a git repository: the same path
)

Repository actions.

View Source
const HistoryPath = ".hopsesh/handoff.md"

HistoryPath is where the conversation goes on the handoff branch when the user asks.

View Source
const KindFetch = "fetch"

KindFetch is a session brought from a cloud.

View Source
const KindHandoff = "handoff"

KindHandoff is a session handed off to a cloud.

View Source
const KindHop = "hop"

KindHop is a cloud session handed on to another cloud through this machine.

Variables

View Source
var ErrBlocked = errors.New("the move cannot go ahead")

ErrBlocked means the plan has blockers.

View Source
var ErrUndone = errors.New("the fetch was undone")

ErrUndone means the fetch was undone before its copy appeared.

Functions

func CanEndDestination added in v0.4.2

func CanEndDestination(p *Plan, in Input) bool

CanEndDestination advertises recovery for an exact, reviewed append destination. Process handling belongs to the module's Stopper, never to the move engine.

func Crosses added in v0.5.0

func Crosses(s agent.Summary, a *agent.Account) (crosses, ok bool)

Crosses reports whether continuing s as account a crosses accounts: a run under another account, or no record at all. ok is false when a is unknown (nothing can be said).

func DescribeSync

func DescribeSync(r repos.SyncResult, branch, source string) string

DescribeSync turns a sync result into a line for people.

func EndDestination added in v0.4.2

func EndDestination(ctx context.Context, p *Plan, in Input) error

EndDestination ends only the reviewed original session. It does not apply the transfer or write a receipt. Callers must discard the plan and replan afterwards: the module can save final transcript records while it exits.

func HasCopy added in v0.4.0

func HasCopy(outcome string) bool

HasCopy reports whether a fetch's outcome left a copy here to resume (complete, partial or unchecked).

func Human

func Human(n int64) string

Human formats a byte count.

func IssueRef added in v0.4.0

func IssueRef(url string) string

IssueRef is a known problem's link as "#94836".

func Plural added in v0.4.0

func Plural(n int, one string) string

Plural is "1 message", "3 messages".

func SaveFetch added in v0.4.0

func SaveFetch(stateDir string, f *Fetch) error

SaveFetch writes a fetch's record.

func SaveHandoff added in v0.4.0

func SaveHandoff(stateDir string, h *Handoff) error

SaveHandoff keeps a hand-off's record.

func ValidateProfiles added in v0.4.0

func ValidateProfiles(ctx context.Context, in Input) error

func ValidateSource added in v0.4.4

func ValidateSource(ctx context.Context, p *Plan, in Input) error

ValidateSource rejects a changed source before a caller closes a destination. Apply also checks this snapshot immediately before applying a new operation.

Types

type Adopted added in v0.4.0

type Adopted struct {
	Time     time.Time        `json:"time"`
	Outcome  string           `json:"outcome"` // complete | partial | empty
	Key      agent.SessionKey `json:"key"`     // the copy here
	Path     string           `json:"path"`
	Restored int              `json:"restored"`
	Expected int              `json:"expected"`
	Stated   bool             `json:"stated"` // the cloud said how many it sent
	// Check says how the copy was checked, when the vendor stated no count: against the
	// briefing hopsesh sent, or not at all; Why says what is missing from a partial copy.
	Check string `json:"check,omitempty"`
	Why   string `json:"why,omitempty"`
	// Branch is the branch the code is on here; Renamed, the cloud's own name for it
	// (before hopsesh renamed it); NoBranch: the driver checked out none.
	Branch   string `json:"branch,omitempty"`
	Renamed  string `json:"renamed,omitempty"`
	NoBranch bool   `json:"noBranch,omitempty"`
	// Appended: the cloud's work was added to the session it was handed off from (Key).
	Appended bool          `json:"appended,omitempty"`
	Resume   agent.Command `json:"resume"`
	Command  string        `json:"command"` // Resume for the user's shell
	Issue    string        `json:"issue,omitempty"`
	Warnings []string      `json:"warnings,omitempty"`
	// Written: hopsesh wrote the copy itself from what the driver brought as text, at
	// Fidelity (text, or code: the task's title and summary); Changes sums up the code.
	Written  bool   `json:"written,omitempty"`
	Fidelity string `json:"fidelity,omitempty"`
	Changes  string `json:"changes,omitempty"`
}

Adopted is what a fetch brought, once the driver wrote it.

func AdoptFetch added in v0.4.0

func AdoptFetch(ctx context.Context, f *Fetch, side Side, env Env, exited bool) (*Adopted, error)

AdoptFetch adopts what the driver wrote for a fetch, once it is there: it journals the copy, renames the cloud's own branch (claude/… → hopsesh/from/<cloud>/…), records lineage, tells a complete copy from a partial or an empty one, and (when asked) adds the cloud's work to the session it was handed off from. It returns nil while the copy is not there yet. exited: the driver has ended, so the copy is complete as it is.

type Check added in v0.4.0

type Check struct {
	State string `json:"state"`
	Text  string `json:"text"`
}

Check is one thing a plan checked, for people: ok, warn or err (a blocker).

type Choice added in v0.4.0

type Choice struct {
	Value string `json:"value"`
	Label string `json:"label"`
}

Choice is one option of a choice, for people.

type Comparison added in v0.4.2

type Comparison struct {
	Classification  string         `json:"classification"`
	Verified        bool           `json:"verified"`
	Reason          string         `json:"reason"`
	SharedRevisions int            `json:"sharedRevisions"`
	Source          ComparisonSide `json:"source"`
	Destination     ComparisonSide `json:"destination"`
}

Comparison describes conversation coverage, never filesystem or code conflicts. Only verified coverage can establish independent work. An unavailable comparison must not be presented as evidence that both sessions changed.

func BuildComparison added in v0.4.2

func BuildComparison(p *Plan, in Input, c Copy, sourceSegment, targetSegment ir.Segment, st lineage.State, targetErr error) *Comparison

BuildComparison consumes the full segments already read by planning. Call it immediately after targetState, before missingNodes or forkLine changes the planning view. It performs no I/O, writes, stops, or changes to Plan/Input/IR. Pass targetState's error through even if it returned a partial target segment. Without a uniquely selected Copy the caller should leave its comparison nil.

type ComparisonCounts added in v0.4.2

type ComparisonCounts struct {
	Nodes             int `json:"nodes"`
	Messages          int `json:"messages"`
	UserMessages      int `json:"userMessages"`
	AssistantMessages int `json:"assistantMessages"`
	Tools             int `json:"tools"`
	Other             int `json:"other"`
}

ComparisonCounts are exact even when previews are shortened or omitted. Other includes private/opaque records without exposing their contents.

type ComparisonIdentity added in v0.4.2

type ComparisonIdentity struct {
	Agent       agent.ID         `json:"agent"`
	AgentName   string           `json:"agentName"`
	Profile     string           `json:"profile"`
	ProfileName string           `json:"profileName"`
	Machine     string           `json:"machine"`
	MachineID   string           `json:"machineId"`
	Title       string           `json:"title"`
	Key         agent.SessionKey `json:"key"`
}

ComparisonIdentity keeps stable identity keys separate from display labels.

type ComparisonPreview added in v0.4.2

type ComparisonPreview struct {
	Kind      ir.Kind    `json:"kind"`
	Role      string     `json:"role,omitempty"`
	Text      string     `json:"text,omitempty"`
	Tool      string     `json:"tool,omitempty"`
	Time      *time.Time `json:"time,omitempty"`
	Truncated bool       `json:"truncated"`
}

ComparisonPreview is an allowlist: ordinary user/assistant text, tool names, and timestamps only. No native payload, reasoning, tool input/output or paths are exported. Role is "user" or "assistant", independent of the IR actor name.

type ComparisonSide added in v0.4.2

type ComparisonSide struct {
	Identity       ComparisonIdentity  `json:"identity"`
	Status         string              `json:"status"`
	Reason         string              `json:"reason,omitempty"`
	ExclusiveKnown bool                `json:"exclusiveKnown"`
	Revisions      int                 `json:"revisions"`
	Counts         ComparisonCounts    `json:"counts"`
	Preview        []ComparisonPreview `json:"preview"`
	Truncated      bool                `json:"truncated"`
	PreviewOmitted int                 `json:"previewOmitted"`
	PreviewBasis   string              `json:"previewBasis,omitempty"` // saved-history when exclusivity is unknown
}

ComparisonSide counts exclusive native IR nodes; Revisions counts exclusive logical revisions, which may be represented by fewer coalesced native nodes. Counts and Revisions are meaningful only when ExclusiveKnown is true.

type ContinuePlan

type ContinuePlan struct {
	Comparison     *Comparison         `json:"comparison,omitempty"`
	Instructions   []InstructionSource `json:"instructions"`
	From           string              `json:"from"` // source agent name
	Fidelity       convert.Fidelity    `json:"fidelity"`
	Relation       string              `json:"relation"`
	AppendTo       *agent.Summary      `json:"appendTo,omitempty"`
	Report         convert.Report      `json:"report"`
	Briefing       string              `json:"briefing"`
	RolloverCursor ir.Cursor           `json:"rolloverCursor,omitempty"`
	Rollover       *agent.Summary      `json:"rollover,omitempty"`

	Via string `json:"via,omitempty"` // ViaImport: the target agent's importer converts it
	// contains filtered or unexported fields
}

ContinuePlan is how a session continues in another agent.

type Copy

type Copy struct {
	Summary agent.Summary
	Live    agent.LiveInfo
	Lineage *lineage.Manifest
}

Copy is a copy of the session already at the target.

type Endpoint

type Endpoint struct {
	Profile     string `json:"profile,omitempty"`
	Binding     string `json:"binding,omitempty"`
	ProfileName string `json:"profileName,omitempty"`
	ID          string `json:"id"`
	Location    string `json:"location"`
	OS          string `json:"os"`
	CWD         string `json:"cwd"`
	Path        string `json:"path,omitempty"`
	Version     string `json:"agentVersion,omitempty"`
}

Endpoint describes one end for people and JSON.

type Env

type Env struct {
	// Failpoint injects interrupted-transfer failures in scenario tests.
	Failpoint func(string) error
	StateDir  string
	Audit     *audit.Log
	Progress  func(step string)
	// Step runs a driver's terminal step (a hand-off's Sent.Run) where the user sees and
	// answers it, and returns the session it started, as the module read it from what the
	// step printed (or as the user pasted its link). nil: this front end has no terminal for
	// it, and the plan said so.
	Step StepRunner
}

Env is where apply keeps its state and logs.

type EnvChoice added in v0.4.0

type EnvChoice struct {
	Value string `json:"value"` // what the driver gets: the id, else the name
	Name  string `json:"name"`  // for people: "acme-api"
	// Label is the choice in a list: "acme-api (used by your last 3 tasks)".
	Label string `json:"label"`
	// Tasks is how many of the listed sessions ran in it.
	Tasks int `json:"tasks,omitempty"`
	// Configured: the configuration names it for this repository.
	Configured bool `json:"configured,omitempty"`
}

EnvChoice is a cloud environment the user can pick for a hand-off.

type Fetch added in v0.4.0

type Fetch struct {
	Profile    *agent.RuntimeProfile `json:"profile,omitempty"`
	Journal    string                `json:"journal"`
	Time       time.Time             `json:"time"`
	Machine    string                `json:"machine"`
	Agent      agent.ID              `json:"agent"`
	Cloud      string                `json:"cloud"`
	CloudTitle string                `json:"cloudTitle"`
	Session    agent.SessionID       `json:"session,omitempty"` // "" until the vendor's picker chose
	URL        string                `json:"url,omitempty"`
	Title      string                `json:"title"`
	// Untitled: hopsesh knew no title for it before the copy came (Title is made up).
	Untitled bool   `json:"untitled,omitempty"`
	Repo     string `json:"repo,omitempty"`
	Checkout string `json:"checkout"`
	Worktree string `json:"worktree"`
	Base     string `json:"base"`
	// CloudBranch is the cloud's branch, when known before the driver ran.
	CloudBranch  string `json:"cloudBranch,omitempty"`
	VendorPrefix string `json:"vendorPrefix,omitempty"`
	Rename       bool   `json:"rename,omitempty"`
	// Before are the vendor's branches here before the driver ran (a branch it makes is the
	// fetch's to undo).
	Before   map[string]string `json:"before,omitempty"`
	Adopt    agent.Adopt       `json:"adopt"`
	Lineage  *lineage.Manifest `json:"lineage,omitempty"`
	Command  string            `json:"command"` // the driver's command for the user's shell
	Run      agent.Command     `json:"run"`
	Continue agent.ID          `json:"continue,omitempty"` // continue in this agent once here
	// ContinueName is that agent's name.
	ContinueName string `json:"continueName,omitempty"`
	// Original is the session the cloud's work is added to (Options.AppendOriginal), as it
	// was when planned.
	Original     *agent.Summary `json:"original,omitempty"`
	OriginalHead ir.Cursor      `json:"originalHead,omitempty"`
	Adopted      *Adopted       `json:"adopted,omitempty"`
	// Kept: the user chose to keep a partial copy.
	Kept bool `json:"kept,omitempty"`
	// Problems are the cloud's known upstream issues by outcome (agent.Cloud.Problems).
	Problems map[string]string `json:"problems,omitempty"`
	// Mirror: the cloud session is a Remote Control mirror of MirrorOf
	// ("machine:agent/id"), when known.
	Mirror   bool   `json:"mirror,omitempty"`
	MirrorOf string `json:"mirrorOf,omitempty"`
	// Loss is what stayed in the cloud, for a copy hopsesh wrote; Noun, what the cloud calls
	// its sessions.
	Loss []string `json:"loss,omitempty"`
	Noun string   `json:"noun,omitempty"`
	// Note is what the user must do in the driver's terminal for the copy to be saved;
	// Brief, the first prompt hopsesh sent the cloud session (state folder only), which the
	// copy must begin with when the vendor states no count.
	Note  string `json:"note,omitempty"`
	Brief string `json:"brief,omitempty"`
}

Fetch is a fetch from a cloud, kept in the state folder: waiting for the driver the user runs (Claude Code's teleport) to write its copy, then what the adoption found.

func LoadFetch added in v0.4.0

func LoadFetch(stateDir, journalID string) (*Fetch, error)

LoadFetch reads a fetch's record by its journal.

func LoadFetches added in v0.4.0

func LoadFetches(stateDir string) ([]*Fetch, error)

LoadFetches returns every fetch's record, newest first.

func (*Fetch) Waiting added in v0.4.0

func (f *Fetch) Waiting() bool

Waiting reports whether the fetch still waits for the driver.

type FetchInput added in v0.4.0

type FetchInput struct {
	Machine *host.Machine // this machine
	Module  agent.Module
	Install agent.Install
	// Host is the module's Host here for its cloud capabilities (it runs the driver
	// without the cloud's Unset variables).
	Host    agent.Host
	Cloud   agent.Cloud
	Session agent.CloudSession // Key.Session "" leaves the choice to the vendor's own picker
	// Checkout is the repository's checkout here ("" when unknown).
	Checkout string
	Account  *agent.Account // the login here, when known
	Lineage  *lineage.Manifest
	// Original is the local session the cloud session was handed off from, when it is
	// here.
	Original *Copy
	// Continue is the agent to continue in once it is here (nil: its own).
	Continue  agent.Module
	Worktrees []string
	// MirrorOf is the session a Remote Control mirror mirrors ("machine:agent/id"), when
	// the cloud session is one.
	MirrorOf string
	// ContinueInstall is Continue's install here.
	ContinueInstall agent.Install
	// Prompt is the first prompt the cloud session got, when hopsesh started it (a cloud
	// that brings back no prompt of its own shows its title in its place).
	Prompt string
}

FetchInput is what planning a fetch needs.

type FetchPlan added in v0.4.0

type FetchPlan struct {
	Cloud      string          `json:"cloud"`
	CloudTitle string          `json:"cloudTitle"`
	Session    agent.SessionID `json:"session,omitempty"` // "" : the vendor's own picker chooses
	URL        string          `json:"url,omitempty"`
	Fidelity   agent.Fidelity  `json:"fidelity"`
	// Conversation says what comes of the conversation, for people.
	Conversation string `json:"conversation"`
	Repo         string `json:"repo,omitempty"`
	Checkout     string `json:"checkout,omitempty"`
	CloudBranch  string `json:"cloudBranch,omitempty"`
	BranchState  string `json:"branchState"`
	Ref          string `json:"ref,omitempty"`  // refs/hopsesh/<cloud>/<branch>, when the branch is known
	Base         string `json:"base,omitempty"` // the commit the worktree starts at
	BaseNote     string `json:"baseNote,omitempty"`
	Worktree     string `json:"worktree"`
	// LocalBranch is the branch the code is on here: the cloud's branch renamed under
	// hopsesh/from/<cloud>/ (Rename), or kept.
	LocalBranch string `json:"localBranch,omitempty"`
	// FastForward: LocalBranch is here already, from an earlier fetch of the code: it moves
	// forward to the cloud's work (fast-forward only; a new branch when it cannot).
	FastForward bool `json:"fastForward,omitempty"`
	// Diff: the code comes as the cloud's patch (CodeDown ViaDiff), committed on LocalBranch
	// in the new worktree, on top of the branch the session started from (or of the
	// checkout's HEAD when hopsesh does not know it).
	Diff bool `json:"diff,omitempty"`
	// Write: the driver needs no terminal and brings the conversation as text (or, for a
	// code-only cloud, the task's title and summary); hopsesh writes it here as a new
	// session of the agent it goes to (Writer), with Messages messages.
	Write    bool   `json:"write,omitempty"`
	Writer   string `json:"writer,omitempty"` // the agent that gets it ("Codex")
	Messages int    `json:"messages,omitempty"`
	// Changes sums up the patch ("+12 −3 · 2 files").
	Changes string `json:"changes,omitempty"`
	Noun    string `json:"noun"` // what the cloud calls its sessions ("task")
	// Terminal: the driver needs the user's terminal (Claude Code's teleport); otherwise
	// hopsesh brings it all by itself.
	Terminal bool          `json:"terminal,omitempty"`
	Rename   bool          `json:"rename"`
	CodeOnly bool          `json:"codeOnly,omitempty"`
	Run      agent.Command `json:"run"`
	Command  string        `json:"command,omitempty"` // Run for the user's shell
	Adopt    *agent.Adopt  `json:"adopt,omitempty"`
	// Note is what the user must do in the driver's terminal for the copy to be saved.
	Note   string   `json:"note,omitempty"`
	Loss   []string `json:"loss,omitempty"`
	Checks []Check  `json:"checks"`
	// ContinueIn is the agent it continues in once it is here ("" : its own).
	ContinueIn   agent.ID `json:"continueIn,omitempty"`
	ContinueName string   `json:"continueName,omitempty"`
	// Original is the local session it was handed off from, here; CanAppend: it is as it
	// was left, so the cloud's work can be added to it instead (Append).
	Original  *agent.Summary `json:"original,omitempty"`
	CanAppend bool           `json:"canAppend,omitempty"`
	Append    bool           `json:"append,omitempty"`
	Relation  string         `json:"relation"`
	// contains filtered or unexported fields
}

FetchPlan is the cloud part of a fetch plan.

type FetchResult added in v0.4.0

type FetchResult struct {
	Outcome  string `json:"outcome"` // waiting, or code (the code only)
	Worktree string `json:"worktree"`
	Branch   string `json:"branch,omitempty"` // the branch the code is on (code only)
	// FastForwarded: that branch was here already and moved forward to the cloud's work.
	FastForwarded bool   `json:"fastForwarded,omitempty"`
	Ref           string `json:"ref,omitempty"`
	Base          string `json:"base"`
	// Key is the session hopsesh wrote here (agent/session), when it wrote one.
	Key string `json:"key,omitempty"`
}

FetchResult is what applying a fetch did.

type Handoff added in v0.4.0

type Handoff struct {
	Journal  string           `json:"journal"`
	Time     time.Time        `json:"time"`
	Machine  string           `json:"machine"`
	Checkout string           `json:"checkout"`
	Remote   string           `json:"remote"`
	Branch   string           `json:"branch"`
	Snapshot string           `json:"snapshot,omitempty"`
	Pushed   bool             `json:"pushed,omitempty"`
	Cleanup  string           `json:"cleanup"`
	Cloud    string           `json:"cloud"`
	Session  agent.SessionKey `json:"session"`
	URL      string           `json:"url,omitempty"`
	Title    string           `json:"title"`
	// Brief is the first prompt the cloud got (kept here only, never pushed), so a cloud that
	// brings back no prompt of its own can show it; Env is the environment it ran in; Repo,
	// the repository's identity.
	Brief string `json:"brief,omitempty"`
	Env   string `json:"env,omitempty"`
	Repo  string `json:"repo,omitempty"`
}

Handoff is the record of a hand-off, kept beside its journal: where the branch is and what the user chose for it, for the done screen and for cleaning the branch up later.

func FindHandoff added in v0.4.0

func FindHandoff(stateDir, cloud string, id agent.SessionID) *Handoff

FindHandoff is the hand-off that started a cloud session, when it was made here (nil otherwise).

func LoadHandoff added in v0.4.0

func LoadHandoff(stateDir, journal string) (*Handoff, error)

LoadHandoff reads a hand-off's record.

type HandoffInput added in v0.4.0

type HandoffInput struct {
	Source  Side // the session's machine, module and install
	Session agent.Summary
	Live    agent.LiveInfo
	Git     *repos.GitState
	GitErr  string
	Lineage *lineage.Manifest
	// Runner is git on the session's machine (nil when hopsesh cannot run git there).
	Runner repos.Git
	// Here is this machine, which runs the cloud's driver (the vendor login is here).
	Here    *host.Machine
	Module  agent.Module  // the module that reaches the cloud
	Install agent.Install // its install here
	Host    agent.Host    // its Host here for the cloud capabilities (scrubbed environment)
	Cloud   agent.Cloud
	// Checkout is a checkout of the repository here, for the driver's worktree ("": a
	// temporary clone).
	Checkout  string
	Settings  HandoffSettings
	Allowed   bool
	Worktrees []string
	// Env is the cloud environment configured for the repository ("" for none); Envs, the
	// ones the cloud's listing shows (suggestions), for a cloud that needs one.
	Env  string
	Envs []EnvChoice
	// Tester probes the cloud read-only in the module's place (a recent probe, so replanning
	// does not ask the vendor each time); nil: the module's CloudTester runs.
	Tester func(context.Context) (agent.CloudTest, error)
	// Folder is the repository's hand-off folder here, where the driver runs
	// (repos.HandoffFolder; "": a temporary one).
	Folder string
	// Terminal: the front end can run a terminal step (Env.Step); a cloud whose driver needs
	// one (NeedTerminal) cannot be handed off without it.
	Terminal bool
	// FromBranch is the branch on the remote the session's code came from, when it was
	// brought from a cloud (claude/…, copilot/…, kept here under another name): when the
	// checkout is still exactly that branch, the next cloud clones it as it is and nothing
	// is pushed.
	FromBranch string
}

HandoffInput is what planning a hand-off needs.

type HandoffPlan added in v0.4.0

type HandoffPlan struct {
	Cloud      string         `json:"cloud"`
	CloudTitle string         `json:"cloudTitle"`
	Agent      string         `json:"agent"` // the agent that runs there ("Claude Code")
	Fidelity   agent.Fidelity `json:"fidelity"`
	// Conversation says what becomes of the conversation, for people.
	Conversation string `json:"conversation"`
	// Brief is the first prompt; Tokens, its size; Masked, the secrets masked in it (and
	// MaskedRules, which kinds); Edited: the user's own text.
	Brief       string   `json:"brief"`
	Tokens      int      `json:"tokens"`
	Masked      int      `json:"masked"`
	MaskedRules []string `json:"maskedRules,omitempty"`
	Shortened   bool     `json:"shortened,omitempty"`
	Edited      bool     `json:"edited,omitempty"`
	// Carried, Changed and Stays sum up the conversation's part (the plan's boxes).
	Carried []string `json:"carried"`
	Changed []string `json:"changed"`
	Stays   []string `json:"stays"`
	// The code: how it goes (branch or bundle), on which branch, from which commit.
	Code agent.CodeWay `json:"code"`
	// Reuse: the session's own branch is clean and on the remote, so the cloud clones it
	// and nothing is pushed.
	Reuse      bool   `json:"reuse,omitempty"`
	Branch     string `json:"branch,omitempty"`
	BranchURL  string `json:"branchUrl,omitempty"`
	Base       string `json:"base,omitempty"`       // the commit it builds on (HEAD)
	BaseBranch string `json:"baseBranch,omitempty"` // the session's branch
	Remote     string `json:"remote"`               // the remote's name ("origin")
	Repo       string `json:"repo,omitempty"`       // host/owner/repo
	Host       string `json:"host,omitempty"`
	Unpushed   int    `json:"unpushed,omitempty"`
	// Tracked and Untracked are the files the snapshot carries; Offered, untracked files
	// it carries only when chosen; Withheld, files that stay on the machine whatever is
	// chosen.
	Tracked   []string          `json:"tracked,omitempty"`
	Untracked []string          `json:"untracked,omitempty"`
	Offered   []repos.Candidate `json:"offered,omitempty"`
	Withheld  []repos.Withheld  `json:"withheld,omitempty"`
	// HistoryFile: the conversation is committed as HistoryPath on the branch;
	// HistoryWarning says why that may expose it.
	HistoryFile    bool   `json:"historyFile"`
	HistoryPath    string `json:"historyPath"`
	HistoryWarning string `json:"historyWarning"`
	// Cleanup is when hopsesh deletes the handoff branch; the choices for the user.
	Cleanup  string   `json:"cleanup"`
	Cleanups []Choice `json:"cleanups"`
	Checks   []Check  `json:"checks"`
	Usage    string   `json:"usage"`
	Notes    []string `json:"notes,omitempty"`
	// CanBundle: the cloud takes an upload; BundleOffer says why it is the way to go here
	// (a repository it cannot clone), "" when the branch works.
	CanBundle   bool   `json:"canBundle"`
	BundleOffer string `json:"bundleOffer,omitempty"`
	// CanStartingDiff: the session's branch is on the remote as it is here and the changes
	// are small, so they can go with the cloud session as a starting diff instead of on a
	// new branch (Options.StartingDiff); StartingDiffOffer says so for people.
	CanStartingDiff   bool   `json:"canStartingDiff,omitempty"`
	StartingDiffOffer string `json:"startingDiffOffer,omitempty"`
	// EnvNeeded: the cloud runs in an environment the user picks (Env, its name EnvName);
	// Envs are the choices hopsesh knows of; EnvNote says what to do when none is picked.
	EnvNeeded bool        `json:"envNeeded,omitempty"`
	Env       string      `json:"env,omitempty"`
	EnvName   string      `json:"envName,omitempty"`
	Envs      []EnvChoice `json:"envs,omitempty"`
	EnvNote   string      `json:"envNote,omitempty"`
	// Remember: the picked environment becomes the repository's in the configuration once
	// the hand-off works (none was configured).
	Remember bool `json:"remember,omitempty"`
	Attempts int  `json:"attempts,omitempty"` // asked of the cloud (0: its default)
	// Noun is what the cloud calls its sessions ("task"); Follow: it takes follow-ups from
	// hopsesh, else NoFollowUp may say why; Limits are what hopsesh cannot reach there.
	Noun       string   `json:"noun"`
	Follow     bool     `json:"follow,omitempty"`
	NoFollowUp string   `json:"noFollowUp,omitempty"`
	Limits     []string `json:"limits,omitempty"`
	// Terminal says, for a cloud whose driver starts the session in the user's terminal,
	// what happens there (the driver may ask whether Folder is trusted; the user answers).
	Terminal string `json:"terminal,omitempty"`
	Folder   string `json:"folder,omitempty"`
	// Steps are what applying does, in order (Step*).
	Steps []string `json:"steps"`
	// Loss is everything that stays here, for the loss list.
	Loss []string `json:"loss"`
	// Tally counts what the conversation holds.
	Tally convert.Tally `json:"tally"`
	// contains filtered or unexported fields
}

HandoffPlan is the cloud part of a hand-off plan.

type HandoffResult added in v0.4.0

type HandoffResult struct {
	Cloud      string `json:"cloud"`
	CloudTitle string `json:"cloudTitle"`
	Agent      string `json:"agent"`
	Session    string `json:"session,omitempty"` // the cloud session's id
	URL        string `json:"url,omitempty"`
	State      string `json:"state,omitempty"`
	Repo       string `json:"repo,omitempty"`
	Branch     string `json:"branch,omitempty"`
	BranchURL  string `json:"branchUrl,omitempty"`
	Code       string `json:"code"`
	Reuse      bool   `json:"reuse,omitempty"`
	Pushed     bool   `json:"pushed,omitempty"` // the handoff branch went to the remote
	Snapshot   string `json:"snapshot,omitempty"`
	Tokens     int    `json:"tokens"`
	Masked     int    `json:"masked"`
	// Stayed is what stayed on the machine.
	Stayed []string      `json:"stayed"`
	Steps  []HandoffStep `json:"steps"`
	// Failed is the step that failed; Message, what happened, in words.
	Failed  string `json:"failed,omitempty"`
	Message string `json:"message"`
	// Retry is another way that may work after a failure ("bundle": as an upload).
	Retry string `json:"retry,omitempty"`
	// Manual is what undo cannot do and the user may: the cloud session stays there.
	Manual string `json:"manual"`
	Hint   string `json:"hint"`
	// Noun is what the cloud calls its sessions ("task"); Follow: it takes follow-ups, else
	// NoFollowUp may say why.
	Noun       string `json:"noun"`
	Follow     bool   `json:"follow,omitempty"`
	NoFollowUp string `json:"noFollowUp,omitempty"`
	// Pasted: the session's link came from the user, not from what the driver printed.
	Pasted bool `json:"pasted,omitempty"`
	// Env and EnvName are the environment it runs in; Attempts, how many were asked for.
	Env      string `json:"env,omitempty"`
	EnvName  string `json:"envName,omitempty"`
	Attempts int    `json:"attempts,omitempty"`
}

HandoffResult is what a hand-off did (the done screen, and the command line's JSON).

type HandoffSettings added in v0.4.0

type HandoffSettings struct {
	Code         string   // "branch" or "bundle"
	Untracked    []string // untracked files (globs) carried by default
	BranchPrefix string
	DeleteBranch string // never | after-merge | on-undo
}

HandoffSettings are a cloud's hand-off settings (the configuration's [clouds.<name>]).

type HandoffStep added in v0.4.0

type HandoffStep struct {
	Name   string `json:"name"`
	Label  string `json:"label"`
	State  string `json:"state"`
	Detail string `json:"detail,omitempty"`
}

HandoffStep is one step of a hand-off as it went.

type HopLeg added in v0.4.0

type HopLeg struct {
	Verb string `json:"verb"` // "Bring here", "Hand off"
	From string `json:"from"`
	To   string `json:"to"`
	// FromTitle and ToTitle are From and To for people: a cloud's title ("Claude Code
	// cloud"), a machine's name.
	FromTitle string `json:"fromTitle,omitempty"`
	ToTitle   string `json:"toTitle,omitempty"`
	Fidelity  string `json:"fidelity"`
	Words     string `json:"words"`
}

HopLeg is one leg of a hop, for people.

type HopPlan added in v0.4.0

type HopPlan struct {
	From      string `json:"from"`
	FromTitle string `json:"fromTitle"`
	To        string `json:"to"`
	ToTitle   string `json:"toTitle"`
	// Via is this machine, where the session stops between the legs; Agent is the agent it
	// is in here ("Claude Code").
	Via   string `json:"via"`
	Agent string `json:"agent"`
	// Fidelity is each leg's ("native → brief"); Conversation says what reaches the second
	// cloud, for people.
	Fidelity     string   `json:"fidelity"`
	Conversation string   `json:"conversation"`
	Legs         []HopLeg `json:"legs"`
	// Code says how the code reaches the second cloud.
	Code  string       `json:"code"`
	Bring *Plan        `json:"bring"`
	Then  *HandoffPlan `json:"then"`
	// Terminal says what the first leg needs of the user's terminal ("" : nothing).
	Terminal string `json:"terminal,omitempty"`
	// Loss is everything the trip leaves behind, both legs.
	Loss []string `json:"loss"`
}

HopPlan is a hop: the bring-back (Bring, a fetch plan) and the hand-off as far as it can be planned before the session is here (Then: the cloud, its driver and login, the environment, what it gets).

type HopResult added in v0.4.0

type HopResult struct {
	State   string `json:"state"`
	Message string `json:"message"`
	From    string `json:"from"`
	To      string `json:"to"`
	ToTitle string `json:"toTitle"`
	Fetch   string `json:"fetch,omitempty"`   // the first leg's journal
	Handoff string `json:"handoff,omitempty"` // the second leg's journal
	// Command and Run are the first leg's driver command while it waits; Note, what the
	// user must do in it.
	Command string        `json:"command,omitempty"`
	Run     agent.Command `json:"run"`
	Note    string        `json:"note,omitempty"`
	// Key is the copy here the second leg handed on (agent/session).
	Key string `json:"key,omitempty"`
	// Remembered: the second leg's environment became the repository's in the configuration
	// (the front end saves it).
	Remembered bool `json:"remembered,omitempty"`
}

HopResult is where a hop stands: the journals of its legs, and while the first leg waits, the command the user runs (and what to do in it).

type Input

type Input struct {
	Source  Side
	Session agent.Summary
	Live    agent.LiveInfo
	Git     *repos.GitState // the session's checkout on the source (nil when unknown)
	GitErr  string          // why the checkout could not be read ("" when it was)
	Lineage *lineage.Manifest
	Target  Side
	// Copies are the target agent's sessions with the same key at the target.
	Copies []Copy
	// Worktrees are agent-managed worktree folders (from every module).
	Worktrees []string
	// Push pushes the session's branch on the source machine; GitFetch reaches the
	// source's repository over SSH. Both are nil when the source is this machine.
	Push     func(ctx context.Context, dir string) (string, error)
	GitFetch func(dir string) *repos.FetchSource
	// Native is the source's own agent on the target, for a continuation on another
	// machine: the session is also kept there byte for byte (nil: it is not installed).
	Native *NativeSide
}

Input is what planning needs.

func ProfileInput added in v0.4.0

func ProfileInput(p *Plan, in Input) Input

ProfileInput includes the pinned local driver roots of cloud operations too.

type InstructionSource added in v0.4.0

type InstructionSource struct {
	Path      string `json:"path"`
	Scope     string `json:"scope"`
	Text      string `json:"text"`
	Bytes     int    `json:"bytes"`
	Selected  bool   `json:"selected"`
	Shortened bool   `json:"shortened"`
	Error     string `json:"error,omitempty"`
}

InstructionSource is a declared source file, never a destination file to overwrite.

func InstructionSources added in v0.4.0

func InstructionSources(spec agent.Spec, h agent.Host, in agent.Install, cwd string) []InstructionSource

InstructionSources enumerates the supported files for preview and peer packaging. It deliberately does not follow imports, search unrelated directories, or include automatically generated memories, credentials, skills or settings.

type NativeCopy

type NativeCopy struct {
	Agent    string           `json:"agent"` // its name
	Key      agent.SessionKey `json:"key"`
	Replaces bool             `json:"replaces,omitempty"` // an older copy there makes way
}

NativeCopy is the source agent's own copy kept next to a continuation, so a later return to that agent there adds only the new work to the original turns.

type NativeSide

type NativeSide struct {
	Target Side
	Copies []Copy
}

NativeSide is the source agent on the target and its copies of the session there.

type Options

type Options struct {
	// OpenBlockedOriginal names an original that is open in its agent but blocked by
	// hopsesh: apply closes its exact native client and rebuilds the append plan.
	// A block does not prevent that client from writing stale bookkeeping.
	OpenBlockedOriginal string `json:"openBlockedOriginal,omitempty"`
	Bounded             bool   `json:"bounded,omitempty"`    // new bounded replica on the same logical branch
	NewReplica          bool   `json:"newReplica,omitempty"` // explicitly create a new native session; never auto-select an existing one
	TargetProfile       string `json:"targetProfile,omitempty"`
	OperationID         string `json:"operationId,omitempty"`
	TargetSession       string `json:"targetSession,omitempty"`
	TargetDir           string // resume here (skips repository matching)
	Clone               bool   // clone the repository when it is not here
	ReposDir            string
	ExtraRoots          []string // more folders to look for checkouts in
	GHQLayout           bool
	Worktree            WorktreeMode
	Fork                bool // keep the source session running (both continue)
	RemoteControl       bool
	Notify              bool // tell the old session it moved on
	Redact              bool
	App                 bool // open in the agent's desktop app
	SyncCode            bool // bring the checkout to the session's commit
	Push                bool // push unpushed commits on the source first
	StopLocal           bool // quit a copy of this session that is open here
	Conflict            string
	OtherAccount        bool // the target is signed in to another account (set by the planner)
	// Continuing in another agent.
	Fidelity convert.Fidelity // history (default) or note
	Native   bool             // render exact tool calls as the target's own (when it can)
	Note     string           // a handoff note the source agent wrote
	// CarryRules adds the user's global instructions for the source agent to the briefing.
	CarryRules bool
	RuleFiles  []string // explicit subset of discovered source instruction paths
	// Via is how another agent gets the session: "" (hopsesh converts it) or ViaImport (the
	// target agent's own importer converts it; hopsesh adds its briefing).
	Via string
	Go  bool // start the continued session with "Continue."
	// Bringing a session from a cloud.
	CodeOnly       bool // the cloud's branch only, without the conversation
	RenameVendor   bool // the cloud's own branch (claude/…) comes home as hopsesh/from/<cloud>/…
	AppendOriginal bool // add the cloud's work to the session it was handed off from
	// Handing a session off to a cloud.
	Bundle      bool     // the cloud's driver uploads the repository; nothing is pushed
	HistoryFile bool     // also commit the conversation as .hopsesh/handoff.md
	Untracked   []string // untracked files (globs) to carry
	Brief       string   // the briefing as the user edited it ("": hopsesh's)
	Cleanup     string   // when the handoff branch is deleted (Cleanup*)
	// Env is the cloud's environment (an id or a name), for a cloud that needs one ("": the
	// one configured for the repository).
	Env string
	// Attempts asks the cloud for that many attempts at once (0: its default).
	Attempts int
	// StartingDiff sends the changes with the cloud session as a starting diff, on a branch
	// already on the remote, instead of pushing a handoff branch.
	StartingDiff bool
	// Limits is the history and resource policy for this operation (ir.Limits). Readers,
	// writers and the archive see it through the operation's context.
	Limits ir.Limits `json:"limits,omitempty"`
}

Options are the user's choices.

type Plan

type Plan struct {
	// ReviewNewSession offers a fresh portable plan, not permission to apply this
	// blocked one. The new plan must still check destination coverage and divergence.
	ReviewNewSession bool `json:"reviewNewSession,omitempty"`

	NoWork       bool             `json:"noWork,omitempty"`
	SyncTo       *agent.Summary   `json:"syncTo,omitempty"`
	OperationID  string           `json:"operationId"`
	Destinations []agent.Summary  `json:"destinations,omitempty"`
	Kind         string           `json:"kind"`
	Key          agent.SessionKey `json:"key"`
	Title        string           `json:"title"`
	Agent        string           `json:"agent"` // display name
	Source       Endpoint         `json:"source"`
	Target       Endpoint         `json:"target"`
	Live         bool             `json:"live"`
	Repo         RepoPlan         `json:"repo"`
	Placement    agent.Placement  `json:"placement"`
	// ResumeHere: the session is already in the destination; continue it where it is.
	ResumeHere bool `json:"resumeHere,omitempty"`
	// Unprotected: the original stays on a machine without hopsesh, where nothing can
	// keep it from being continued too.
	Unprotected bool           `json:"unprotected,omitempty"`
	Files       agent.MovePlan `json:"files"`
	Bytes       int64          `json:"bytes"`
	// SetAside are copies at the target that make way (kept by the journal for undo).
	SetAside []agent.Summary `json:"setAside,omitempty"`
	Conflict string          `json:"conflict,omitempty"`
	Warnings []string        `json:"warnings,omitempty"`
	Blockers []string        `json:"blockers,omitempty"`
	StopHere bool            `json:"stopHere,omitempty"` // quit the copy open here first
	Push     bool            `json:"push,omitempty"`
	Sync     string          `json:"sync,omitempty"`
	// SyncFromSource: unpushed commits are fetched straight from the source machine.
	SyncFromSource bool          `json:"syncFromSource,omitempty"`
	NewName        string        `json:"newName"`
	Resume         agent.Command `json:"resume"`
	StartPrompt    string        `json:"-"`
	Options        Options       `json:"options"`
	OldName        string        `json:"oldName,omitempty"`
	Continue       *ContinuePlan `json:"continue,omitempty"`
	NativeCopy     *NativeCopy   `json:"nativeCopy,omitempty"`
	Fetch          *FetchPlan    `json:"fetch,omitempty"`
	Handoff        *HandoffPlan  `json:"handoff,omitempty"`
	Hop            *HopPlan      `json:"hop,omitempty"`

	ExpectedDestination map[string]ir.Cursor `json:"expectedDestination,omitempty"`
	ExpectedAbsent      []string             `json:"expectedAbsent,omitempty"`
	// contains filtered or unexported fields
}

Plan is a move, worked out without changing anything.

func Build

func Build(ctx context.Context, in Input, opt Options) (*Plan, error)

Build works out a move. It reads (the bundle's file list, the target's copies) but writes nothing.

func BuildFetch added in v0.4.0

func BuildFetch(ctx context.Context, in FetchInput, opt Options) (*Plan, error)

BuildFetch works out a fetch. It asks git and the driver read-only questions; it writes nothing.

func BuildHandoff added in v0.4.0

func BuildHandoff(ctx context.Context, in HandoffInput, opt Options) (*Plan, error)

BuildHandoff works out a hand-off. It reads (git's state, the conversation, the driver's login, the remote's branches) and writes nothing.

func PreviewHandoff added in v0.4.0

func PreviewHandoff(ctx context.Context, in HandoffInput, repo string, opt Options) *Plan

PreviewHandoff plans a hand-off to a cloud before the session exists here (the second leg of a hop): the cloud's consent, its driver and login, the repository's host, the environment, the terminal. The code and the briefing are planned once the session is here. It writes nothing.

func (*Plan) ContinuationHint added in v0.4.0

func (p *Plan) ContinuationHint() string

ContinuationHint distinguishes a prepared transcript from an agent turn. Opening an app does not submit a message; a terminal command may include the first prompt.

func (*Plan) SourceCursor added in v0.4.4

func (p *Plan) SourceCursor() ir.Cursor

SourceCursor is the native source snapshot captured by the reviewed plan.

type RepoPlan

type RepoPlan struct {
	Identity     string   `json:"identity,omitempty"`
	Remote       string   `json:"remote,omitempty"`
	SourceTop    string   `json:"sourceTop,omitempty"`
	SourceMain   string   `json:"sourceMain,omitempty"`
	SourceBranch string   `json:"sourceBranch,omitempty"`
	MainBranch   string   `json:"sourceMainBranch,omitempty"`
	InWorktree   bool     `json:"sourceInWorktree,omitempty"`
	AgentWT      bool     `json:"sourceAgentWorktree,omitempty"`
	Unpushed     int      `json:"unpushed,omitempty"`
	Dirty        int      `json:"dirty,omitempty"`
	Action       string   `json:"action"`
	LocalPath    string   `json:"localPath,omitempty"`
	Alternatives []string `json:"alternatives,omitempty"`
	LocalBranch  string   `json:"localBranch,omitempty"`
	Worktree     string   `json:"worktree,omitempty"` // to create
	SourceHead   string   `json:"sourceHead,omitempty"`
	HasUpstream  bool     `json:"sourceUpstream,omitempty"`
}

RepoPlan is how the session's repository is found or made here.

type Result

type Result struct {
	Journal    string            `json:"journal"` // id for undo
	Files      int               `json:"files"`
	Bytes      int64             `json:"bytes"`
	Rewrite    rewrite.Stats     `json:"rewrite"`
	Secrets    scan.Summary      `json:"secrets"`
	Cloned     bool              `json:"cloned,omitempty"`
	Worktree   string            `json:"worktree,omitempty"`
	SetAside   []string          `json:"setAside,omitempty"`
	Stopped    bool              `json:"stopped,omitempty"`
	Pushed     string            `json:"pushed,omitempty"`
	PushError  string            `json:"pushError,omitempty"`
	Sync       *repos.SyncResult `json:"sync,omitempty"`
	SyncNote   string            `json:"syncNote,omitempty"`
	PromptFile string            `json:"promptFile,omitempty"`
	Command    string            `json:"command"` // to resume, for this machine's shell
	// Key is the session as it is now at the destination.
	Key agent.SessionKey `json:"key,omitzero"`
	// Run is Command as an argument list (with the start prompt as its last argument when
	// PromptFile is set), for a terminal hopsesh opens on it.
	Run      agent.Command `json:"run"`
	Notice   string        `json:"notice,omitempty"`
	Warnings []string      `json:"warnings,omitempty"`
	// Fetch is what a fetch from a cloud did.
	Fetch *FetchResult `json:"fetch,omitempty"`
	// Handoff is what a hand-off to a cloud did (also when a step failed).
	Handoff *HandoffResult `json:"handoff,omitempty"`
	// Hop is where a hop from one cloud to another stands (Fetch is its first leg's result,
	// Handoff its second's).
	Hop *HopResult `json:"hop,omitempty"`
}

Result is what a move did.

func Apply

func Apply(ctx context.Context, p *Plan, in Input, env Env) (result *Result, failure error)

Apply is idempotent for its stable operation ID. A restarted caller recovers durable receipts and verifies a native write through the module before committing its graph.

type Side

type Side struct {
	Machine *host.Machine
	Module  agent.Module
	Install agent.Install
	Account *agent.Account // nil when unknown
}

Side is one end of a move: a machine, the agent module and its install there.

type StepResult added in v0.4.0

type StepResult struct {
	Session agent.CloudSession
	// Pasted: the user pasted its link (hopsesh saw none in what the step printed).
	Pasted bool
}

StepResult is the session a terminal step started.

type StepRunner added in v0.4.0

type StepRunner func(ctx context.Context, s TermStep) (StepResult, error)

StepRunner runs a terminal step (Env.Step).

type TermStep added in v0.4.0

type TermStep struct {
	Agent      agent.ID `json:"agent"` // the module that reads what it printed
	Cloud      string   `json:"cloud"`
	CloudTitle string   `json:"cloudTitle"`
	Title      string   `json:"title"` // the session handed off, for people
	// Run is the command; its Argv[0] is the driver's path here when hopsesh found it.
	Run agent.Command `json:"run"`
	// Folder is the hand-off folder it runs in, which the driver may ask the user to trust.
	Folder string `json:"folder"`
}

TermStep is a cloud driver's command that needs the user's terminal (claude --cloud "<briefing>"): the user sees it and answers what it asks; hopsesh only watches what it prints and its exit code, and the module reads the session from them.

type WorktreeMode

type WorktreeMode string

WorktreeMode chooses between the main checkout and a worktree.

const (
	WorktreeAuto   WorktreeMode = "auto"   // recreate the worktree if the session used one
	WorktreeCreate WorktreeMode = "create" // always work in a worktree on the session's branch
	WorktreeMain   WorktreeMode = "main"   // use the main checkout as it is
)

Jump to

Keyboard shortcuts

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