app

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 48 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 app is what hopsesh does, for every front end (command line, terminal UI, desktop app, the agents' skill): scan machines for sessions of every agent, plan and carry out moves and continuations, undo them, and keep the agents' integration current.

Index

Constants

View Source
const (
	BranchHandoff = "handoff" // the branch hopsesh pushed for a hand-off
	BranchVendor  = "vendor"  // the cloud's own branch, brought home
)

Branch kinds.

View Source
const (
	CloudReady       = "ready"
	CloudCLIMissing  = "cli-missing"  // the driver is not installed here
	CloudCLIOld      = "cli-old"      // the driver is older than any version the cloud was tested with
	CloudSignedOut   = "signed-out"   // the driver is not signed in with the account the cloud needs
	CloudNotEligible = "not-eligible" // the plan or the organization does not allow cloud sessions
	CloudNotAllowed  = "not-allowed"  // the user has not allowed hopsesh to use it
	CloudError       = "error"
)

Cloud statuses.

View Source
const (
	GuardBlock  = config.OriginalBlock
	GuardAdvise = config.OriginalAdvise
	GuardOff    = config.OriginalOff
)

Guard modes (config "original").

View Source
const (
	StatusOK          = "ok"
	StatusUnreachable = "unreachable"
	StatusAuth        = "auth"
	StatusHostKey     = "host-key"
	StatusKeyChanged  = "host-key-changed"
	StatusTSCheck     = "tailscale-check"
	StatusLocalNet    = "local-network" // macOS local network privacy blocked it
	StatusError       = "error"
)

Machine statuses.

View Source
const DefaultCloudTimeout = 8 * time.Second

DefaultCloudTimeout is how long a scan waits for one cloud's listing.

Variables

View Source
var ErrAmbiguous = errors.New("several sessions match")

ErrAmbiguous means a reference matches several sessions.

View Source
var ErrNoLocalKey = errors.New("this machine has no SSH key that ssh would use for it")

ErrNoLocalKey means this machine has no SSH key that ssh would offer to the machine; SetupKeyLogin can create one (createKey).

View Source
var ErrNoPreview = errors.New("this agent's conversations can't be previewed")

ErrNoPreview means the session's agent cannot show the end of its conversation.

View Source
var ErrOpenElsewhere = errors.New("it is already open")

ErrOpenElsewhere means a session already runs in a tab: show that one instead of a second copy writing to the same conversation.

Functions

func AccountLabel added in v0.4.1

func AccountLabel(p *agent.RuntimeProfile) string

AccountLabel describes the current sign-in for a root, never its historical owner.

func BlockReason added in v0.4.2

func BlockReason(notice string, key agent.SessionKey) string

BlockReason is what the agent shows when it refuses a prompt in a blocked original.

func CleanupDecision added in v0.4.0

func CleanupDecision(c BranchCandidate, f BranchFacts) (offer bool, why string)

CleanupDecision decides whether hopsesh offers to delete a branch, and says why (not).

func EntryIdentity added in v0.4.0

func EntryIdentity(machine, key string) string

func GuardBlocks added in v0.4.2

func GuardBlocks(status string) bool

GuardBlocks reports whether a movement status keeps the original blocked: the work was prepared or continued elsewhere, or both copies already differ. A separate fork never blocks: the original is meant to go on.

func LocalName

func LocalName() string

LocalName is this machine's name in lineage: $HOPSESH_MACHINE, else its short host name.

func Rules

func Rules(bin string) agent.Rules

Rules are the hopsesh commands agents may run without asking (read-only) and the ones that always ask.

func StepCommand added in v0.4.0

func StepCommand(s move.TermStep) (*exec.Cmd, error)

StepCommand is a terminal step's driver run on the terminal itself, unwatched (where this system has no pseudo-terminal), with the relay's environment; on Windows an npm command shim runs as the program behind it, as in the relay.

func StepRelay added in v0.4.0

func StepRelay(s move.TermStep) *term.Relay

StepRelay is the relay that runs a terminal step in a terminal: the driver's argument list in its folder, with this process's environment less the cloud's Unset and plus the step's Env, and a capture for the module's reader.

func StepTab added in v0.4.0

func StepTab(s move.TermStep) pty.Spec

StepTab is the app's terminal tab for a terminal step: the driver's argument list in its folder, with the user's environment less the cloud's Unset (and other terminals' variables, see pty.Env) plus the step's Env, its output captured for the module's reader. The tab says what it runs and where.

func TabArgv added in v0.4.0

func TabArgv(argv []string) ([]string, error)

TabArgv is a command's argument list as the app's terminal tabs run it: the program found on this process's PATH, else on the login shell's, and on Windows a command shim (npm's codex.cmd) replaced by the program it starts, since a tab never runs a batch file (see internal/core/winshim).

Types

type Activity

type Activity struct {
	Journal *journal.Journal `json:"journal"`
	CanUndo bool             `json:"canUndo"`
	Why     string           `json:"why,omitempty"` // why not: undone, or what changed since
	// Part: it is a leg of a hop (Journal.PartOf), undone with it.
	Part bool `json:"part,omitempty"`
}

Activity is one operation hopsesh carried out, and whether it can be undone now.

type AgentState

type AgentState struct {
	Agent   agent.ID      `json:"agent"`
	Name    string        `json:"name"`
	Install agent.Install `json:"install"`
	Error   string        `json:"error,omitempty"`
}

AgentState is an agent as found on a machine.

type App

type App struct {
	Catalog *catalog.Store

	Cfg      config.Config
	Reg      *registry.Registry // every compiled-in module
	StateDir string
	Audit    *audit.Log
	Log      *slog.Logger
	// Passwords answers ssh password questions for machines that log in with one (nil:
	// such machines are reported, not scanned).
	Passwords func(h config.Host) transport.PasswordFunc
	// PeerDial reaches hopsesh on a configured machine (nil: over SSH).
	PeerDial func(ctx context.Context, h config.Host) (*PeerConn, error)
	// CloudTimeout bounds one cloud's listing in a scan (0: DefaultCloudTimeout).
	CloudTimeout time.Duration
	// Steps runs a cloud driver's terminal step where the user answers it (the command
	// line's and the terminal UI's relay, the app's terminal window); nil: this front end
	// has none, and a hand-off to a cloud that needs one is blocked with the reason.
	Steps move.StepRunner
	// RunHere runs a driver's command in this front end's terminal and waits for it (the
	// teleport that brings a hop's session here); nil: the front end opens it itself, and the
	// hop waits for ContinueHop.
	RunHere RunHere
	// Terminals are the terminal apps launches open in (empty: this system's), and Procs
	// what finding a session's tab reads of the process table (nil: this machine's).
	Terminals termapp.Set
	Procs     termapp.Procs
	// contains filtered or unexported fields
}

App holds what every use case needs.

func New

func New(cfg config.Config, reg *registry.Registry, stateDir string, log *audit.Log) *App

New returns an App for the modules and configuration.

func (*App) AccountLogin added in v0.4.0

func (a *App) AccountLogin(ctx context.Context, id string) (agent.Command, error)

AccountLogin returns a vendor-owned login command; callers explicitly run it in a terminal. Desktop deep links are not used because they cannot select this profile.

func (*App) Accounts added in v0.4.0

func (a *App) Accounts() ([]agent.RuntimeProfile, error)

func (*App) Activities

func (a *App) Activities() ([]Activity, error)

Activities lists what hopsesh did, newest first. Whether each can still be undone is checked on this machine's files only (other machines, remotes and clouds are checked when undoing).

func (*App) Adopt added in v0.4.0

func (a *App) Adopt(ctx context.Context, journal string, exited bool) (*move.Fetch, error)

Adopt looks for what the driver wrote for a fetch (by its journal) and adopts it once it is there; exited: the driver has ended. The fetch says whether it is still waiting.

func (*App) Apply

func (a *App) Apply(ctx context.Context, p *move.Plan, in move.Input, progress func(string)) (*move.Result, error)

Apply carries out a plan.

func (*App) ArchiveLineage added in v0.4.0

func (a *App) ArchiveLineage(ctx context.Context, inv *Inventory, e Entry) (*journal.Journal, error)

ArchiveLineage explicitly removes unsupported metadata from the active namespace. It retains the original sidecar beside the transcript; Activity can undo the rename.

func (*App) AwaitStep added in v0.4.0

func (a *App) AwaitStep(ctx context.Context, s move.TermStep, sess *pty.Session) (move.StepResult, error)

AwaitStep waits for a terminal step running in the app's tab sess (started from StepTab) to end, and reads the session it started, as RunStepHere does for a relay. A step whose output names no session ends with agent.ErrNoSession; the window then offers to paste the link (PastedStep).

func (*App) BringTarget added in v0.4.0

func (a *App) BringTarget(inv *Inventory, e Entry) agent.ID

BringTarget is the local agent that gets a cloud-only module's session (Copilot's log, Amp's thread) when the user names none: the agent it was handed off from, by its lineage, else Claude Code, else the first agent here that takes sessions; "" when none here can.

func (*App) Brought added in v0.4.0

func (a *App) Brought(f *move.Fetch) Brought

Brought describes a fetch with its module's name.

func (*App) CachedInventory added in v0.4.1

func (a *App) CachedInventory() *Inventory

func (*App) CanRename added in v0.4.0

func (a *App) CanRename(e Entry) bool

CanRename reports whether a session can be renamed in its agent's own data.

func (*App) CatalogScope added in v0.4.1

func (a *App) CatalogScope() string

func (*App) ClaimMovementNotice added in v0.4.0

func (a *App) ClaimMovementNotice(ctx context.Context, id agent.ID, profile, sessionID, event, notice string, identity ...MovementNoticeIdentity) (*MovementNoticeClaim, error)

ClaimMovementNotice starts a resume generation or prepares a changed prompt notice. An abandoned, failed, or timed-out attempt remains pending. Old receipts that predate write acknowledgments are deliberately not delivery evidence.

func (*App) CleanupCandidates added in v0.4.0

func (a *App) CleanupCandidates(ctx context.Context) []BranchCandidate

CleanupCandidates lists the branches hand-offs and bring-backs left on their remotes, asks each remote (read-only: ls-remote, and a fetch of the commits it needs into no ref) whether their work is merged into its default branch, and says which hopsesh offers to delete. Where gh is installed, a pull request GitHub merged (a squash or a rebase) counts too. It changes nothing.

func (*App) CloudModule added in v0.4.0

func (a *App) CloudModule(name string) (agent.Module, agent.Cloud, bool)

CloudModule is the enabled module that reaches a cloud, with the cloud's declaration.

func (*App) Connect

func (a *App) Connect(ctx context.Context, h config.Host) (*host.Machine, error)

Connect reaches a configured machine and probes it (one round trip).

func (*App) ContinueHop added in v0.4.0

func (a *App) ContinueHop(ctx context.Context, id string, progress func(string)) (*move.Result, error)

ContinueHop takes a waiting hop on once the copy is here: it adopts the copy if it has appeared, then hands it off. A hop still waiting is returned as it is.

func (*App) DefaultOptions

func (a *App) DefaultOptions() move.Options

DefaultOptions are move options from the configuration.

func (*App) DeleteBranches added in v0.4.0

func (a *App) DeleteBranches(ctx context.Context, ids []string) (*CleanupResult, error)

DeleteBranches deletes the branches the user picked (by id) among the ones hopsesh offers, each with a lease at the commit it was checked at, under one journal: undo pushes them back. A branch that moved, or is no longer offered, is left alone and reported.

func (*App) DropStep added in v0.4.0

func (a *App) DropStep(id string)

DropStep removes a written step and its outcome.

func (*App) DropTicket added in v0.4.0

func (a *App) DropTicket(id string)

DropTicket removes a ticket whose terminal did not open.

func (*App) EditAccount added in v0.4.0

func (a *App) EditAccount(id, name string, tags []string, generation int) error

func (*App) EndDestination added in v0.4.2

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

EndDestination uses the reviewed module/profile and checks its registration before asking the module to end the original. It never applies the transfer.

func (*App) EnrichMovement added in v0.4.0

func (a *App) EnrichMovement(ctx context.Context, inv *Inventory)

EnrichMovement joins receipt metadata and observes native content in memory. It never writes remote files or alters journaled sidecars during a scan.

func (*App) EnvChoices added in v0.4.0

func (a *App) EnvChoices(inv *Inventory, cloud, repo string) []move.EnvChoice

EnvChoices are the environments a hand-off to a cloud can run in, for a repository: the one configured for it first, then the ones the cloud's listing shows (the most used first), then the ones configured for other repositories.

func (*App) Fetches added in v0.4.0

func (a *App) Fetches() ([]*move.Fetch, error)

Fetches lists what was brought from clouds, newest first.

func (*App) FollowUp added in v0.4.0

func (a *App) FollowUp(ctx context.Context, cloud string, id agent.SessionID, text string) (agent.CloudSession, error)

FollowUp sends a message to a cloud session through its module (it starts a model turn there, on the user's plan).

func (*App) ForgetAccount added in v0.4.0

func (a *App) ForgetAccount(id string, generation int) error

func (*App) FreshSelection added in v0.4.1

func (a *App) FreshSelection(ctx context.Context, e Entry) (*Inventory, Entry, error)

FreshSelection bypasses browsing summaries and only reaches the source and destination.

func (*App) GitFor added in v0.4.0

func (a *App) GitFor(r Ref) func(Entry) bool

GitFor narrows a scan's git probe (ScanOptions.GitFor) to what working with the sessions r names needs: the folders of every session r could match, and of the sessions whose lineage names a cloud copy (a cloud session's repository and checkout come from them). Other folders are left alone, so one that git cannot read in time (offloaded to a cloud drive, say) does not hold up a command about another session.

func (*App) HandoffDefaults added in v0.4.0

func (a *App) HandoffDefaults(cloud string) move.Options

HandoffDefaults are the options a hand-off starts with, from the configuration.

func (*App) HandoffTargets added in v0.4.0

func (a *App) HandoffTargets(inv *Inventory, e Entry) []HandoffTarget

HandoffTargets are the clouds a session could be handed off to, each enabled or with its reason: an option is refused with its reason, never hidden.

func (*App) HopTargets added in v0.4.0

func (a *App) HopTargets(inv *Inventory, e Entry) []HandoffTarget

HopTargets are the clouds a cloud session could be handed on to, each enabled or with its reason (never hidden).

func (*App) Hops added in v0.4.0

func (a *App) Hops() []*Hop

Hops lists the hops, newest first.

func (*App) InstallNoticeHooks added in v0.4.0

func (a *App) InstallNoticeHooks(ctx context.Context, id agent.ID, profile string) ([]MovementHookStatus, error)

InstallNoticeHooks is an explicit setup action; defaults being on does not bypass the user's/vendor's hook trust flow. Empty selectors cover all local profiles.

func (*App) InstallSkill

func (a *App) InstallSkill(ctx context.Context, files map[string][]byte, version, bin string, force, rules bool) (SkillReport, error)

InstallSkill writes the same files into every agent's skills folder in one go (and, with rules, each agent's approval rules). A copy the user edited stops the install unless force.

func (*App) IsCloud added in v0.4.0

func (a *App) IsCloud(name string) bool

IsCloud reports whether a name is a cloud's.

func (*App) Journals

func (a *App) Journals() ([]*journal.Journal, error)

Journals lists what can be undone, newest first.

func (*App) KeepPartial added in v0.4.0

func (a *App) KeepPartial(journal string) error

KeepPartial records that the user keeps a partial copy as it is.

func (*App) LiveHere added in v0.4.0

func (a *App) LiveHere(ctx context.Context, inv *Inventory) map[agent.SessionKey]agent.LiveInfo

LiveHere asks the agents on this machine which of its sessions in inv are open now (their own registries and locks, no scan): by session key, for the sessions whose agent can tell.

func (*App) LoadHop added in v0.4.0

func (a *App) LoadHop(id string) (*Hop, error)

LoadHop reads a hop's record by its journal.

func (*App) LocalAccountEndpoint added in v0.4.1

func (a *App) LocalAccountEndpoint(ctx context.Context) (string, error)

LocalAccountEndpoint reads identity without launching an agent or contacting peers.

func (*App) LocalRoots

func (a *App) LocalRoots() []string

LocalRoots are folders searched for checkouts on this machine.

func (*App) Module

func (a *App) Module(id agent.ID) (agent.Module, bool)

Module returns an enabled module by id.

func (*App) Modules

func (a *App) Modules() []agent.Module

Modules returns the enabled modules.

func (*App) MovementNoticeDelivery added in v0.4.0

func (a *App) MovementNoticeDelivery(id agent.ID, profile, sessionID, notice string, identity ...MovementNoticeIdentity) bool

MovementNoticeDelivery is evidence that this exact notice was supplied to the lifecycle hook. It never means the model or user read it. Read-only: no new directories, receipts, account probes, or scan, even when nothing was delivered.

func (*App) MovementNoticeDetailsForPath added in v0.4.0

func (a *App) MovementNoticeDetailsForPath(ctx context.Context, id agent.ID, profile, sessionID, path string) (MovementNoticeDetails, error)

MovementNoticeDetailsForPath is deliberately local-only and bounded: no Scan, agent process, network, account probe or hook-supplied command is executed. Lookup never writes scan evidence: a concurrent refresh may have newer facts.

func (*App) MovementNoticeHooks added in v0.4.0

func (a *App) MovementNoticeHooks(ctx context.Context, action string, id agent.ID, profile, bin string) ([]MovementHookStatus, error)

MovementNoticeHooks manages hooks only on this machine. A nonempty profile is an exact registered ID (never a prefix, label, path, or remote registration). An empty profile selects all registered local profiles plus an unregistered default root. Empty id selects all enabled agents; a profile requires an agent. bin must be the absolute installed CLI executable, including when called by GUI.

func (*App) MyTerminal added in v0.4.0

func (a *App) MyTerminal(ctx context.Context) termapp.Terminal

MyTerminal is the terminal app launches open in: the configured one when installed, else the best installed one.

func (*App) NewTicket added in v0.4.0

func (a *App) NewTicket(l Launch) (string, error)

NewTicket writes the ticket for a launch. The agent's program is resolved here, where the login shell's PATH is known, so the tab finds it whatever its own PATH is.

func (*App) NoticeHooks added in v0.4.0

func (a *App) NoticeHooks(ctx context.Context) ([]MovementHookStatus, error)

NoticeHooks is the GUI's local hook setup status. Installed means the exact current integration is present; it does not imply vendor trust or delivery.

func (*App) NoticeHooksFor added in v0.4.2

func (a *App) NoticeHooksFor(ctx context.Context, id agent.ID, profile string) ([]MovementHookStatus, error)

NoticeHooksFor reports one agent's (or every agent's) hooks, as installed by this app.

func (*App) OpenElsewhere added in v0.4.0

func (a *App) OpenElsewhere(ctx context.Context, key agent.SessionKey, live agent.LiveInfo) error

OpenElsewhere says where a session already runs, when it does: in a tab hopsesh can show (found), or in a terminal it cannot (live).

func (*App) OpenInTerminal added in v0.4.0

func (a *App) OpenInTerminal(ctx context.Context, prog string, t termapp.Terminal, l Launch) (termapp.Opened, error)

OpenInTerminal writes a launch's ticket and opens `<prog> terminal-open <ticket>` in t (nil: MyTerminal), falling back to another installed terminal when t is missing or macOS denies hopsesh control of it. When nothing opens, the error wraps termapp.ErrNoTerminal (copy the command instead).

func (*App) OpenStepInTerminal added in v0.4.0

func (a *App) OpenStepInTerminal(ctx context.Context, prog string, t termapp.Terminal, stepID, dir string) (termapp.Opened, error)

OpenStepInTerminal opens `<prog> terminal-step <id>` (a hand-off's step the app wrote) in t (nil: MyTerminal), with the same fallback: beside the session the user is in where the terminal can (iTerm2 with its Python API on), else as a tab.

func (*App) OriginalGuard added in v0.4.2

func (a *App) OriginalGuard(key agent.SessionKey, operation, status string) string

OriginalGuard is how the copy left behind is protected for this movement: block, advise or off (released originals are advised once, never blocked).

func (a *App) ParseCloudLink(s string) (agent.Module, string, agent.SessionID, bool)

ParseCloudLink reads a cloud session's link or id with the modules that know their vendor's links: the module, the cloud and the id.

func (*App) Paste added in v0.4.0

func (a *App) Paste(ctx context.Context, link, checkout string) (Pasted, error)

Paste remembers a cloud session by its link or id, with the checkout here it works on ("" when not known yet), so scans list it.

func (*App) Pasted added in v0.4.0

func (a *App) Pasted() []Pasted

Pasted returns the pasted cloud sessions.

func (*App) PastedStep added in v0.4.0

func (a *App) PastedStep(s move.TermStep, link string) (agent.CloudSession, error)

PastedStep is the session a link the user pasted names, for a terminal step whose output named none (or that ran where hopsesh could not watch it).

func (*App) Plan

func (a *App) Plan(ctx context.Context, inv *Inventory, e Entry, target agent.ID, opt move.Options) (*move.Plan, move.Input, error)

Plan works out how a session comes here, in the same agent or (target set) another. A cloud session is brought from its cloud (a fetch).

func (*App) PlanHandoff added in v0.4.0

func (a *App) PlanHandoff(ctx context.Context, inv *Inventory, e Entry, cloud string, opt move.Options) (*move.Plan, error)

PlanHandoff works out handing a session off to a cloud. Nothing changes.

func (*App) PlanHop added in v0.4.0

func (a *App) PlanHop(ctx context.Context, inv *Inventory, e Entry, to string, via agent.ID, opt move.Options) (*move.Plan, error)

PlanHop works out handing a cloud session on to another cloud through this machine: the bring-back (into via, or the cloud's own agent: "" picks as Bring here does) and the hand-off, as far as it can be planned before the session is here. opt holds the hand-off's choices (the environment, the clean-up); opt.TargetDir chooses the repository's checkout here. Nothing changes.

func (*App) Preview added in v0.4.0

func (a *App) Preview(ctx context.Context, inv *Inventory, e Entry, n int) (agent.Preview, error)

Preview reads the end of a session's conversation on its machine: the last n messages (the module's Previewer reads only the end of the file).

func (*App) PreviewSelected added in v0.4.1

func (a *App) PreviewSelected(ctx context.Context, e Entry, n int) (agent.Preview, error)

PreviewSelected resolves a registered source without enumerating sessions or borrowing a background scan's connection. It never reads saved transcript text.

func (*App) ReadStep added in v0.4.0

func (a *App) ReadStep(s move.TermStep, r *term.Relay) (agent.CloudSession, error)

ReadStep reads the session a terminal step started from what its relay saw, through the module (agent.CloudStepReader), and forgets the output.

func (*App) ReadStepOutput added in v0.4.0

func (a *App) ReadStepOutput(s move.TermStep, out agent.StepOutput) (agent.CloudSession, error)

ReadStepOutput reads the session a terminal step started from what it printed (a relay's or an app tab's capture), through the module's agent.CloudStepReader.

func (*App) RecoverReceipts added in v0.4.0

func (a *App) RecoverReceipts(ctx context.Context, id string) error

RecoverReceipts retries only the durable metadata acknowledgments of one journal. Native destination guards remain mandatory, and an undone journal cannot be revived.

func (*App) RefreshAccount added in v0.4.1

func (a *App) RefreshAccount(ctx context.Context, id string) (agent.RuntimeProfile, error)

RefreshAccount probes exactly one registered profile and preserves the last known account when the check fails. It never reads credential files or copies logins.

func (*App) RegisterAccount added in v0.4.0

func (a *App) RegisterAccount(ctx context.Context, machine string, id agent.ID, name, root string, tags []string) (agent.RuntimeProfile, error)

RegisterAccount adopts a known root, or creates an empty private root on this machine. Authentication is a separate explicit vendor CLI action. No credentials are copied.

func (*App) ReleaseOriginal added in v0.4.2

func (a *App) ReleaseOriginal(key agent.SessionKey, operation string) error

ReleaseOriginal removes the block (or advice) from one original for its current movement. Continuing there afterwards makes the copies diverge: moving back then needs a comparison or a separate fork instead of a clean return.

func (*App) Released added in v0.4.2

func (a *App) Released(key agent.SessionKey, operation string) bool

Released reports whether the user removed the block for this movement of key.

func (*App) RememberEnv added in v0.4.0

func (a *App) RememberEnv(p *move.Plan) bool

RememberEnv records, after a hand-off worked, the environment it ran in as its repository's, when the configuration named none (the caller saves the configuration). It reports whether it changed anything.

func (*App) RemoveNoticeHooks added in v0.4.0

func (a *App) RemoveNoticeHooks(ctx context.Context, id agent.ID, profile string) ([]MovementHookStatus, error)

func (*App) RemoveSkill

func (a *App) RemoveSkill(ctx context.Context, files map[string][]byte, bin string, force bool) error

RemoveSkill removes every copy hopsesh owns, and the approval rules.

func (*App) Rename added in v0.4.0

func (a *App) Rename(ctx context.Context, inv *Inventory, e Entry, title string) (string, error)

Rename gives a session a new title in its agent's own data, the way the agent's own rename does, in a journal (Activity undoes it). It returns the journal's id.

func (*App) RepoEnvs added in v0.4.0

func (a *App) RepoEnvs(inv *Inventory, cloud string) []RepoEnv

RepoEnvs are the repositories hopsesh knows (configured for the cloud, or a session's checkout) with the environment configured for each, for a cloud that needs one.

func (*App) RestoreBlock added in v0.4.2

func (a *App) RestoreBlock(key agent.SessionKey) error

RestoreBlock undoes ReleaseOriginal.

func (*App) Resume

func (a *App) Resume(inv *Inventory, e Entry, o agent.ResumeOptions) (agent.Command, error)

Resume is the command that continues a session that is already on this machine.

func (*App) ResumeShell

func (a *App) ResumeShell(inv *Inventory, e Entry) (string, error)

ResumeShell is Resume as a line for this machine's shell.

func (*App) Role added in v0.4.2

func (a *App) Role(e Entry) *RoleInfo

Role describes entry e, or nil for a copy that never moved.

func (*App) RunInThisTerminal added in v0.4.0

func (a *App) RunInThisTerminal(l Launch, tio TerminalIO) (int, error)

RunInThisTerminal runs a launch in this terminal (the command line's and the terminal UI's --run): labels when Out is a terminal, the record while a session runs, and the agent's exit code.

func (*App) RunStepFile added in v0.4.0

func (a *App) RunStepFile(id string, tio TerminalIO) error

RunStepFile runs a written step in this terminal (the hidden `hopsesh terminal-step <id>`) and writes its outcome for the app: the session's id and link, or what stopped it. It says in the terminal what is going on, before and after, and labels the tab (tio.Labels) while the step runs.

func (*App) RunStepHere added in v0.4.0

func (a *App) RunStepHere(s move.TermStep, in io.Reader, out io.Writer, ask func() string) (move.StepResult, error)

RunStepHere runs a terminal step in this process's terminal (in, out) through a relay, and reads the session from what it printed. Where this system has no pseudo-terminal, the driver runs on the terminal directly, unwatched, and the session's link comes from the user (ask; nil: no session).

func (*App) RunTicket added in v0.4.0

func (a *App) RunTicket(id string, tio TerminalIO) error

RunTicket runs a ticket in this terminal (the hidden `hopsesh terminal-open <id>`): labels, the agent's command, a record while it runs, and its exit code after.

func (*App) Running added in v0.4.0

func (a *App) Running(key agent.SessionKey) bool

Running reports whether hopsesh started a session that still runs (a record whose process is alive): a session the agent's own files may not show as open (Codex).

func (*App) SaveStep added in v0.4.0

func (a *App) SaveStep(s move.TermStep) (string, error)

SaveStep writes a terminal step for `hopsesh terminal-step <id>` and returns its id.

func (*App) Scan

func (a *App) Scan(ctx context.Context, o ScanOptions) *Inventory

Scan reads this machine, the allowed machines and the clouds in parallel. A machine or a cloud that cannot be read is returned with a status and a hint, not an error. The clouds are listed through this machine once its own sessions are listed (their lineage names the cloud copies hopsesh made), alongside the other machines.

func (*App) Serve

func (a *App) Serve(ctx context.Context, r io.Reader, w io.Writer) error

Serve answers another machine's hopsesh on r and w until r ends (hopsesh peer --stdio). It receives sessions only when this machine opted in (peer receive = true).

func (*App) SessionMovementNotice added in v0.4.0

func (a *App) SessionMovementNotice(ctx context.Context, id agent.ID, profile, sessionID string) (string, error)

func (*App) SessionMovementNoticeForPath added in v0.4.0

func (a *App) SessionMovementNoticeForPath(ctx context.Context, id agent.ID, profile, sessionID, path string) (string, error)

func (*App) SessionTab added in v0.4.0

func (a *App) SessionTab(ctx context.Context, key agent.SessionKey, livePID int) (termapp.Found, bool, error)

SessionTab finds the tab a session on this machine runs in: from the agent's own process id (livePID, from its registry; 0 when it has none) and hopsesh's records of the launches it started. False with a nil error: no tab hopsesh can show.

func (*App) SetupKeyLogin

func (a *App) SetupKeyLogin(ctx context.Context, h config.Host, createKey bool) (*KeyLogin, error)

SetupKeyLogin moves a password machine to key login: it logs in once with the password, adds this machine's public key to the account's authorized_keys, and checks that a login without a password now works. It does not change the configuration; the caller switches the machine to key login when this succeeds.

func (*App) ShowTab added in v0.4.0

func (a *App) ShowTab(ctx context.Context, f termapp.Found) error

ShowTab brings a session's found tab forward, after checking its process is still on that tab.

func (*App) Skill

func (a *App) Skill(ctx context.Context, files map[string][]byte, bin string) SkillReport

Skill reports the skill copies and rules against files (this build's rendering).

func (*App) Specs

func (a *App) Specs() []agent.Spec

Specs returns the enabled modules' Specs.

func (*App) StartPush

func (a *App) StartPush(ctx context.Context, inv *Inventory, e Entry, to config.Host, target agent.ID, opt move.Options) (*Push, error)

StartPush connects to hopsesh on another machine and has it plan receiving a session from this machine, in its own agent or (target) another. Nothing changes until Commit.

func (*App) StepOutcomeOf added in v0.4.0

func (a *App) StepOutcomeOf(id string) (*StepOutcome, error)

StepOutcomeOf is a written step's outcome once its terminal wrote one (nil until then).

func (*App) TerminalApps added in v0.4.0

func (a *App) TerminalApps(ctx context.Context) []termapp.Info

TerminalApps lists the terminal apps hopsesh can open launches in here, and whether each is installed.

func (*App) TerminalByID added in v0.4.0

func (a *App) TerminalByID(id string) (termapp.Terminal, error)

TerminalByID is one of the terminal apps by its id.

func (*App) TestCloud added in v0.4.0

func (a *App) TestCloud(ctx context.Context, name string) (agent.CloudTest, error)

TestCloud probes a cloud through its module, read-only: the login and the driver's flags. The result is kept for a little while for the hand-off plans.

func (*App) Undo

func (a *App) Undo(ctx context.Context, match string, force bool) (*journal.Journal, error)

Undo reverses a journal: by id, by a session id it concerns, or the newest when match is "". Writes on other machines are undone over SSH. Unless force, it refuses when a file the operation wrote changed since (that later work would be lost).

func (*App) WatchLaunch added in v0.4.0

func (a *App) WatchLaunch(ctx context.Context, h termapp.Handle) (<-chan int, error)

WatchLaunch reports a launch's exit code once it ends (see termapp.Watcher): from hopsesh's own records, and -1 when its tab was closed first. It errors when the launch's terminal cannot watch (only iTerm2 with its Python API turned on can); callers then do without.

func (*App) WatchSessions added in v0.4.1

func (a *App) WatchSessions(ctx context.Context, changed func(), current ...func() *App)

WatchSessions uses the same bounded directory watcher as the 0.5 runtime. Reconciliation still covers network filesystems, overflow, and missed events.

type Arrival added in v0.4.2

type Arrival struct {
	Operation string    `json:"operation"`
	Kind      string    `json:"kind"` // moved | continued | fetched | handoff | returned | continuation
	Fork      bool      `json:"fork,omitempty"`
	Machine   string    `json:"machine"`
	Agent     agent.ID  `json:"agent"`
	AgentName string    `json:"agentName"`
	At        time.Time `json:"at"`
}

Arrival is how this copy came to be where it is: moved or continued here from another place, brought back from a cloud, handed off, or moved back (returned) to a copy that had left. It is the moved copy's side of a Departure.

type BranchCandidate added in v0.4.0

type BranchCandidate struct {
	ID         string `json:"id"`
	Kind       string `json:"kind"` // BranchHandoff | BranchVendor
	Branch     string `json:"branch"`
	Repo       string `json:"repo,omitempty"`
	Checkout   string `json:"checkout"`
	Remote     string `json:"remote"`
	Cloud      string `json:"cloud"`
	CloudTitle string `json:"cloudTitle"`
	Session    string `json:"session,omitempty"`
	Title      string `json:"title,omitempty"`
	Source     string `json:"source"` // the journal of the hand-off or bring-back
	// Policy is the cloud's delete_branch for it (after-merge | on-undo | never).
	Policy string `json:"policy"`
	// Sha is where the branch is on the remote ("" : gone); Into, the default branch it was
	// checked against; Merged and By say whether and how its work is in it ("history": its
	// commit is in the default branch's history; "pull request #12": GitHub says so).
	Sha    string `json:"sha,omitempty"`
	Into   string `json:"into,omitempty"`
	Merged bool   `json:"merged"`
	By     string `json:"by,omitempty"`
	// Brought is when the cloud's work came here, when it did.
	Brought time.Time `json:"brought,omitzero"`
	// Offer: hopsesh offers to delete it now; Why says why (not), for people.
	Offer bool   `json:"offer"`
	Why   string `json:"why"`
}

BranchCandidate is a branch a hand-off or a bring-back left on a remote, and whether hopsesh offers to delete it now.

type BranchFacts added in v0.4.0

type BranchFacts struct {
	Exists bool   // on the remote
	Merged bool   // its work is in the default branch
	By     string // how that is known
	Into   string // the default branch
	Error  string // the remote could not be asked
}

BranchFacts are what git and the remote say about a candidate.

type Brought added in v0.4.0

type Brought struct {
	Journal    string `json:"journal"`
	Cloud      string `json:"cloud"`
	CloudTitle string `json:"cloudTitle"`
	Session    string `json:"session,omitempty"` // the cloud session's id
	URL        string `json:"url,omitempty"`
	Title      string `json:"title"`
	Agent      string `json:"agent"` // the agent it is in here
	Worktree   string `json:"worktree"`
	// Outcome is waiting, complete, partial, empty, or code (the code only).
	Outcome  string `json:"outcome"`
	Restored int    `json:"restored,omitempty"`
	Expected int    `json:"expected,omitempty"`
	Stated   bool   `json:"stated,omitempty"`
	// Check is how a copy with no stated count was checked (move.Checked*); Note, what the
	// user must do in the driver's terminal for the copy to be saved (while it waits).
	Check string `json:"check,omitempty"`
	Note  string `json:"note,omitempty"`
	// Branch is the branch the code is on here; Renamed, the cloud's own name for it.
	Branch   string `json:"branch,omitempty"`
	Renamed  string `json:"renamed,omitempty"`
	NoBranch bool   `json:"noBranch,omitempty"`
	// Command is what to run next: the driver's command while waiting, the command that
	// resumes the copy once it is here.
	Command string        `json:"command,omitempty"`
	Run     agent.Command `json:"run"`
	Key     string        `json:"key,omitempty"` // the copy here (agent/session)
	// Message is the outcome in words; Issue, the upstream problem it points to.
	Message  string `json:"message"`
	Issue    string `json:"issue,omitempty"`
	IssueRef string `json:"issueRef,omitempty"`
	MirrorOf string `json:"mirrorOf,omitempty"`
	// Written: hopsesh wrote the copy from what the driver brought as text, at Fidelity;
	// Changes sums up the code; Loss is what stayed in the cloud; Noun, what the cloud calls
	// its sessions.
	Written  bool     `json:"written,omitempty"`
	Fidelity string   `json:"fidelity,omitempty"`
	Changes  string   `json:"changes,omitempty"`
	Loss     []string `json:"loss,omitempty"`
	Noun     string   `json:"noun,omitempty"`
	Continue string   `json:"continue,omitempty"` // the agent to continue in now (id)
	// ContinueName is that agent's name.
	ContinueName string   `json:"continueName,omitempty"`
	Appended     bool     `json:"appended,omitempty"`
	Kept         bool     `json:"kept,omitempty"`
	Warnings     []string `json:"warnings,omitempty"`
}

Brought is a fetch from a cloud as every front end shows it (and the command line's --json prints it): waiting for the user's terminal, or what came back.

func BroughtOf added in v0.4.0

func BroughtOf(f *move.Fetch, agentName string) Brought

BroughtOf describes a fetch; agentName is the module's name ("Claude Code").

type CleanupResult added in v0.4.0

type CleanupResult struct {
	Journal string            `json:"journal"`
	Deleted []BranchCandidate `json:"deleted"`
	// Failed are the branches hopsesh did not delete, with why.
	Failed map[string]string `json:"failed,omitempty"`
}

CleanupResult is what deleting branches did.

type Cloud added in v0.4.0

type Cloud struct {
	Name      string   `json:"name"`
	Title     string   `json:"title"`
	Agent     agent.ID `json:"agent"`
	AgentName string   `json:"agentName"`
	Driver    string   `json:"driver"`
	Version   string   `json:"version,omitempty"` // the driver's version here
	// Tested: the driver's version is one the cloud was tested with.
	Tested bool   `json:"tested"`
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
	Hint   string `json:"hint,omitempty"`
	// Listable: the module can list this cloud's sessions; otherwise Sessions is 0 because
	// nothing was asked.
	Listable bool `json:"listable"`
	Sessions int  `json:"sessions"`
	// Partial: the vendor cannot list everything, so the sessions are the ones hopsesh
	// could find.
	Partial bool `json:"partial,omitempty"`
	// Fetchable: the module can bring this cloud's sessions here.
	Fetchable bool `json:"fetchable"`
	// Mirrors are local sessions the vendor mirrors (Remote Control), among Sessions.
	Mirrors int `json:"mirrors,omitempty"`
	// Allowed: the user allowed hopsesh to use this cloud.
	Allowed bool `json:"allowed"`
	// Noun is what the cloud calls its sessions ("task"); Limits, what hopsesh cannot reach
	// there; NeedsEnv: a hand-off runs in an environment the user picks (EnvHint says how to
	// make one).
	Noun     string   `json:"noun"`
	Limits   []string `json:"limits,omitempty"`
	NeedsEnv bool     `json:"needsEnv,omitempty"`
	EnvHint  string   `json:"envHint,omitempty"`
}

Cloud is a vendor cloud as a scan found it. Clouds are reached from this machine only: the vendor's login lives with the driver here.

type Copy

type Copy struct {
	Profile    *agent.RuntimeProfile `json:"profile,omitempty"`
	Machine    string                `json:"machine"`
	Agent      agent.ID              `json:"agent"`
	AgentName  string                `json:"agentName"`
	Key        agent.SessionKey      `json:"key"`
	Local      bool                  `json:"local,omitempty"`
	LastActive time.Time             `json:"lastActive"`
	LeftBehind bool                  `json:"leftBehind,omitempty"` // moved on since (Entry.MovedOn)
	Live       bool                  `json:"live,omitempty"`
	Newest     bool                  `json:"newest,omitempty"`
}

Copy is one copy of a session that exists in several places or agents.

type Entry

type Entry struct {
	Cached             bool              `json:"cached,omitempty"`
	NativeRelationship bool              `json:"nativeRelationship,omitempty"` // verified during this scan; no persisted family receipt
	Returns            []ReturnCandidate `json:"returns,omitempty"`
	Movement           *MovementNotice   `json:"movement,omitempty"`
	// Departure is where this copy's branch went since, from lineage (whether or not
	// movement notices are on): this copy was moved on.
	Departure *MovementNotice `json:"departure,omitempty"`
	// Arrival is how this copy came here (when it has not moved on since).
	Arrival    *Arrival  `json:"arrival,omitempty"`
	ObservedAt time.Time `json:"observedAt,omitempty"`
	// Location is where the session lives. Machine is the machine whose files hold it, or
	// the cloud's name for a cloud session (so "claude-cloud:<id>" names one).
	Location          agent.Location    `json:"location"`
	Machine           string            `json:"machine"`
	Agent             agent.ID          `json:"agent"`
	AgentName         string            `json:"agentName"`
	Session           agent.Summary     `json:"session"`
	Live              agent.LiveInfo    `json:"live"`
	Git               *repos.GitState   `json:"git,omitempty"`
	GitError          string            `json:"gitError,omitempty"` // the checkout could not be read
	CanArchiveLineage bool              `json:"canArchiveLineage,omitempty"`
	LineageError      string            `json:"lineageError,omitempty"`
	Lineage           *lineage.Manifest `json:"lineage,omitempty"`
	// Cloud is a cloud session as its cloud listed it.
	Cloud *agent.CloudSession `json:"cloud,omitempty"`
	// Checkout is a cloud session's repository checked out here, when known.
	Checkout string `json:"checkout,omitempty"`
	// Original is the session a cloud session was handed off from ("machine:agent/id").
	Original string                `json:"original,omitempty"`
	Profile  *agent.RuntimeProfile `json:"profile,omitempty"`
}

Entry is one session at one location: a machine, or a cloud.

func (Entry) MovedOn added in v0.4.2

func (e Entry) MovedOn() bool

MovedOn reports whether this copy was left behind by a move: lineage records a departure, or, for a copy without lineage, an older hopsesh labelled its title.

func (Entry) Status

func (e Entry) Status() string

Status is a session's state in words: "live …", where it went ("moved to studio"), "ended", or a cloud session's state ("running", "state unknown").

type Group

type Group struct {
	Identity string `json:"identity"`
	Name     string `json:"name"`
	Remote   string `json:"remote,omitempty"`
	Local    string `json:"localCheckout,omitempty"` // a checkout on this machine
	Items    []Item `json:"items"`
}

Group is sessions of one repository.

type HandoffTarget added in v0.4.0

type HandoffTarget struct {
	Cloud string `json:"cloud"`
	Title string `json:"title"`
	Agent string `json:"agent"` // the agent that runs there
	OK    bool   `json:"ok"`
	Why   string `json:"why,omitempty"` // why not, in words
	// Note says what the cloud gets ("a briefing and the code on a branch"), and what it
	// cannot do here.
	Note   string `json:"note,omitempty"`
	Bundle bool   `json:"bundle,omitempty"` // it goes as an upload (the remote is not one the cloud clones)
	// Limits are what hopsesh cannot reach in that cloud (agent.Cloud.Limits), said beside it.
	Limits []string `json:"limits,omitempty"`
}

HandoffTarget is a cloud a session can be handed off to, or the reason it cannot.

type Hop added in v0.4.0

type Hop struct {
	Journal string          `json:"journal"`
	Time    time.Time       `json:"time"`
	Title   string          `json:"title"`
	From    string          `json:"from"`
	Session agent.SessionID `json:"session"`
	To      string          `json:"to"`
	ToTitle string          `json:"toTitle"`
	Fetch   string          `json:"fetch,omitempty"`
	Handoff string          `json:"handoff,omitempty"`
	Options move.Options    `json:"options"`
	Result  move.HopResult  `json:"result"`
}

Hop is the record of a hop, kept in the state folder: its legs' journals, the hand-off's choices, and where it stands (a hop whose first leg waits for the user's terminal goes on with ContinueHop).

type Inventory

type Inventory struct {
	Discovering bool       `json:"discovering,omitempty"`
	Machines    []*Machine `json:"machines"`
	Clouds      []*Cloud   `json:"clouds"`
	Entries     []Entry    `json:"entries"`
	// Adopted are sessions brought from a cloud that this scan found and adopted (their
	// driver wrote them since); Waiting, the ones still waiting for it.
	Adopted []*move.Fetch `json:"adopted,omitempty"`
	Waiting []*move.Fetch `json:"waiting,omitempty"`
}

Inventory is the result of a scan.

func MergeDiscovery added in v0.4.1

func MergeDiscovery(old *Inventory, u ScanUpdate) *Inventory

MergeDiscovery removes unseen rows only after a successful complete source scan.

func (*Inventory) AccountGroups added in v0.4.1

func (inv *Inventory) AccountGroups() []Group

AccountGroups keeps roots distinct even when emails or native session IDs match.

func (*Inventory) Close

func (inv *Inventory) Close()

Close ends every connection the scan opened.

func (*Inventory) Cloud added in v0.4.0

func (inv *Inventory) Cloud(name string) *Cloud

Cloud returns a scanned cloud by name.

func (*Inventory) CloudEntry added in v0.4.0

func (inv *Inventory) CloudEntry(a *App, cloud string, id agent.SessionID) (Entry, error)

CloudEntry is a cloud session as an entry: the scanned one, or, for an id the scan did not list (a link pasted on the command line), one made from the id.

func (*Inventory) FamilyGroups added in v0.4.0

func (inv *Inventory) FamilyGroups() []Group

FamilyGroups uses the same verified relationships as the desktop. Copies already combined by Items count once; unrelated titles remain separate.

func (*Inventory) Find

func (inv *Inventory) Find(r Ref) (Entry, error)

Find returns the session a reference names. Without a machine, the newest copy of the session is chosen.

func (*Inventory) Groups

func (inv *Inventory) Groups(localRoots []string) []Group

Groups arranges sessions by repository; sessions outside git are in a group with no identity. localRoots are searched for checkouts on this machine.

func (*Inventory) Items

func (inv *Inventory) Items() []Item

Items combines only verified copies. Unknown native identities remain scoped to their endpoint, profile and installation, even when titles or IDs match.

func (*Inventory) Local

func (inv *Inventory) Local() *Machine

Local returns this machine.

func (*Inventory) Machine

func (inv *Inventory) Machine(name string) *Machine

Machine returns a scanned machine by name.

func (*Inventory) Relationships added in v0.4.0

func (inv *Inventory) Relationships() map[string]Relationship

type Item

type Item struct {
	Entry  Entry  `json:"entry"`
	Copies []Copy `json:"copies,omitempty"`
}

Item is one session, shown as its newest copy, with every copy when there are several.

type KeyLogin

type KeyLogin struct {
	PublicKey string `json:"publicKey"` // the local key file whose public half was installed
	Created   bool   `json:"created"`   // the key was made for this
	Added     bool   `json:"added"`     // false: the machine already had it
}

KeyLogin is what SetupKeyLogin did.

type Launch added in v0.4.0

type Launch struct {
	Kind   termapp.Kind
	Run    agent.Command
	Key    agent.SessionKey // the session a KindSession launch resumes
	Labels termapp.Labels
}

Launch is a command to open in a terminal app.

type Machine

type Machine struct {
	Kind        agent.LocationKind `json:"kind"` // always agent.AtMachine (clouds are in Inventory.Clouds)
	Name        string             `json:"name"`
	Destination string             `json:"destination,omitempty"`
	Local       bool               `json:"local"`
	Status      string             `json:"status"`
	Error       string             `json:"error,omitempty"`
	Hint        string             `json:"hint,omitempty"`
	OS          string             `json:"os,omitempty"`
	Phase       string             `json:"phase,omitempty"`
	CheckedAt   time.Time          `json:"checkedAt,omitempty"`
	Agents      []AgentState       `json:"agents"`
	// Hopsesh is the version of hopsesh installed there ("" when none was found).
	Hopsesh string `json:"hopsesh,omitempty"`
	// contains filtered or unexported fields
}

Machine is a scanned machine.

func (*Machine) Host

func (m *Machine) Host() *host.Machine

Host returns the machine's connection (nil when it was not reached).

func (*Machine) Install

func (m *Machine) Install(id agent.ID) (agent.Install, bool)

Install returns an agent's install there.

func (*Machine) InstallProfile added in v0.4.0

func (m *Machine) InstallProfile(id agent.ID, profile string) (agent.Install, bool)

InstallProfile selects the exact registered root. An empty selector means the default.

type MovementHookStatus added in v0.4.0

type MovementHookStatus struct {
	Agent        agent.ID `json:"agent"`
	Profile      string   `json:"profile"`
	ProfileLabel string   `json:"profileLabel,omitempty"`
	Path         string   `json:"path,omitempty"`
	Installed    bool     `json:"installed"`
	Enabled      bool     `json:"enabled"`
	Supported    bool     `json:"supported"`
	Reason       string   `json:"reason,omitempty"`
	Evidence     string   `json:"evidence,omitempty"`
	// Trust is the agent's own answer for agents that skip untrusted hooks (Codex): an
	// installed hook delivers nothing until the user trusts it there.
	Trust *agent.HookTrust `json:"trust,omitempty"`
}

MovementHookStatus reports installation, not vendor trust or actual delivery. Vendor/session/project policy can still disable an installed hook.

type MovementNotice added in v0.4.0

type MovementNotice struct {
	ProfileLabel string   `json:"profileLabel,omitempty"`
	Operation    string   `json:"operation"`
	Status       string   `json:"status"`
	Text         string   `json:"text"`
	Machine      string   `json:"machine"`
	Agent        agent.ID `json:"agent"`
	AgentName    string   `json:"agentName"`
	// Cloud is the destination cloud's title, when the session went to a cloud.
	Cloud     string    `json:"cloud,omitempty"`
	Key       string    `json:"key"`
	Profile   string    `json:"profile"`
	CheckedAt time.Time `json:"checkedAt"`
	Delivery  string    `json:"delivery"`
}

type MovementNoticeClaim added in v0.4.0

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

MovementNoticeClaim is an attempted delivery. Only Written, called after a complete successful stdout write, records supplied-to-hook evidence. Attempts never suppress retries; the token fences concurrent/resumed attempts.

func (*MovementNoticeClaim) Written added in v0.4.0

func (c *MovementNoticeClaim) Written(ctx context.Context) error

type MovementNoticeDetails added in v0.4.0

type MovementNoticeDetails struct {
	Key       agent.SessionKey
	Text      string
	Summary   string // where the session went, without the advice (for a block reason)
	Operation string
	Status    string
}

MovementNoticeDetails keeps delivery identity and text in the same validated lookup snapshot. Receipt writers must use this source Key and Operation/Status, not reread the scan cache, which may be absent, older, or concurrently refreshed. Empty Text means no notice; a successfully resolved Key is still returned.

type MovementNoticeIdentity added in v0.4.0

type MovementNoticeIdentity struct {
	Operation string
	Status    string
}

MovementNoticeIdentity comes from the same validated lookup as the notice text, or from the inventory notice itself. Delivery never reads scan caches.

type Pasted added in v0.4.0

type Pasted struct {
	Cloud    string          `json:"cloud"`
	ID       agent.SessionID `json:"id"`
	Repo     string          `json:"repo,omitempty"`
	Checkout string          `json:"checkout,omitempty"`
	Title    string          `json:"title,omitempty"`
	Time     time.Time       `json:"time"`
}

Pasted is a cloud session the user named by its link or id ("Paste a link…"), which hopsesh then lists with what it knows.

type PeerConn

type PeerConn struct {
	Out    io.Reader
	In     io.Writer
	Close  func()
	Stderr func() string
}

PeerConn is a connection to hopsesh on another machine: its output, its input, and how to end it (stderr is what it reported, for errors).

type Push

type Push struct {
	Plan   *move.Plan
	Peer   peer.HelloReply
	Pushed string // the branch was pushed first ("" when not)
	// contains filtered or unexported fields
}

Push is a session on this machine on its way to another machine's hopsesh: planned there, not yet carried out.

func (*Push) Close

func (p *Push) Close()

Close ends the connection (an uncommitted push changes nothing).

func (*Push) Commit

func (p *Push) Commit(ctx context.Context) (*PushResult, error)

Commit carries out the push: the other machine installs or converts the session, then this machine records, in its own journal, what changes for its copy (its lineage).

type PushResult

type PushResult struct {
	Result  *move.Result `json:"result"`
	Journal string       `json:"journal"` // undo here undoes both machines
	Machine string       `json:"machine"`
	Pushed  string       `json:"pushed,omitempty"`
}

PushResult is a finished push.

type Ref

type Ref struct {
	Machine string
	Agent   agent.ID
	Profile string
	Query   string
}

Ref names a session: [machine:][agent/]<id, id prefix or title>.

func ParseRef

func ParseRef(s string) Ref

ParseRef reads a session reference.

type Relationship added in v0.4.0

type Relationship struct {
	Family     string   `json:"family"`
	Branch     string   `json:"branch"`
	Parent     string   `json:"parent,omitempty"`
	Name       string   `json:"name"`
	BranchName string   `json:"branchName"`
	Depth      int      `json:"depth"`
	Evidence   string   `json:"evidence"`
	Issue      string   `json:"issue,omitempty"`
	Ancestors  []string `json:"ancestors,omitempty"`
	Branches   int      `json:"branches"`
}

Relationship is presentation metadata. Only verified lineage provides a shared family ID; an untracked native copy gets its own namespaced identity. It is never an append/merge authority and scanning does not persist it.

type Release added in v0.4.2

type Release struct {
	Operation string    `json:"operation"`
	At        time.Time `json:"at"`
}

Release is the user's choice to continue one original despite its movement.

type RepoEnv added in v0.4.0

type RepoEnv struct {
	Repo string `json:"repo"`
	Env  string `json:"env,omitempty"` // configured ("": the plan asks)
	// Unsupported says why the cloud cannot take the repository ("" when it can).
	Unsupported string `json:"unsupported,omitempty"`
}

RepoEnv is one repository's environment in a cloud, for the Machines page's table.

type ReturnCandidate added in v0.4.0

type ReturnCandidate struct {
	Replica      string   `json:"replica"`
	Machine      string   `json:"machine"`
	Agent        agent.ID `json:"agent"`
	AgentName    string   `json:"agentName"`
	Profile      string   `json:"profile"`
	ProfileLabel string   `json:"profileLabel"`
	Title        string   `json:"title,omitempty"`
	Key          string   `json:"key"`
	Status       string   `json:"status"`
	Reason       string   `json:"reason"`
	Local        bool     `json:"local"`
}

type RoleInfo added in v0.4.2

type RoleInfo struct {
	Kind  string `json:"kind"`  // blocked | moved-out | diverged | forked-out | moved | returned | fork
	Glyph string `json:"glyph"` // ◆ ◇ ! ⑂ ● ↩
	Word  string `json:"word"`  // Moved out, Moved copy, Returned, …
	Line  string `json:"line"`  // where it went or came from, and the protection
}

RoleInfo is what a copy is in its session's journey, in the words and glyphs the command line and terminal UI share with the app (always a word with the glyph).

type RuleState

type RuleState struct {
	Agent   string `json:"agent"`
	Path    string `json:"path"`
	Present bool   `json:"present"`
}

RuleState is one agent's approval rules.

type RunHere added in v0.4.0

type RunHere func(ctx context.Context, run agent.Command) error

RunHere runs a driver's command in this front end's own terminal and waits for it (the teleport a hop's first leg needs); nil: the front end opens it itself, and the hop waits.

type ScanOptions

type ScanOptions struct {
	NoCache       bool             // fresh action validation never reads cached summaries
	Progress      func(ScanUpdate) // serialized immutable batches; never owns transports
	ForceAccounts bool             // explicitly refresh public login metadata
	Hosts         []string         // only these machines and clouds ("" or none: every allowed one)
	NoLocal       bool             // leave this machine out
	SkipGit       bool             // no git state (faster)
	// GitFor, when set, limits the git probe to the folders of the sessions it accepts (the
	// others get no git state); see App.GitFor.
	GitFor func(Entry) bool
}

ScanOptions narrow a scan.

type ScanUpdate added in v0.4.1

type ScanUpdate struct {
	Machine  *Machine
	Clouds   []*Cloud
	Entries  []Entry
	Complete bool
	Listed   bool // summaries and lineage are ready, before slower enrichment
}

ScanUpdate describes one independently progressing source. Preliminary rows have unknown presence and require fresh validation before an action.

type SkillCopy

type SkillCopy struct {
	Dir    string                `json:"dir"`
	Agents []string              `json:"agents"` // display names
	Status integrate.SkillStatus `json:"status"`
}

SkillCopy is one place the skill goes, shared by every agent that reads that folder.

type SkillReport

type SkillReport struct {
	Copies []SkillCopy `json:"copies"`
	Rules  []RuleState `json:"rules"`
	InSync bool        `json:"inSync"` // every copy is current
	State  string      `json:"state"`  // the worst copy's state
}

SkillReport is the skill and rules across every agent installed here.

type StepOutcome added in v0.4.0

type StepOutcome struct {
	Session   *agent.CloudSession `json:"session,omitempty"`
	Error     string              `json:"error,omitempty"`
	NoSession bool                `json:"noSession,omitempty"`
	Code      int                 `json:"code"`
}

StepOutcome is how a step handed to a terminal ended: the session it started, or what stopped it (NoSession: it ended without a session or a refusal, so a pasted link may still come).

type TerminalIO added in v0.4.0

type TerminalIO struct {
	In       io.Reader
	Out, Err io.Writer
	// Labels: Out is a terminal (not a pipe, not JSON), so labels may be printed.
	Labels bool
	// Hold keeps the tab open once the agent ends, as a shell (a terminal whose tab
	// closes with its command).
	Hold   bool
	Getenv func(string) string
}

TerminalIO is the terminal hopsesh's verb runs in.

Jump to

Keyboard shortcuts

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