gui

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 38 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 gui is the backend of the hopsesh desktop app (Wails v3). The frontend in assets/ calls these methods; every use case is the app layer's, as for the command line.

Index

Constants

View Source
const MenuEvent = "hopsesh:menu"

MenuEvent carries a menu-bar command to the window ("palette", "refresh", "sessions", "activity", "machines", "settings", "undo-last").

View Source
const PasswordEvent = "hopsesh:password"

PasswordEvent is the event the window gets when ssh asks for a machine's password.

View Source
const ProgressEvent = "hopsesh:progress"

ProgressEvent carries the steps of a move or continuation to the window.

Variables

View Source
var Assets embed.FS

Assets is the frontend (plain HTML, CSS and JS; no build step).

Functions

This section is empty.

Types

type ActivityDTO

type ActivityDTO struct {
	ID      string   `json:"id"`
	Kind    string   `json:"kind"` // move | continue | push | mark
	Title   string   `json:"title"`
	When    string   `json:"when"` // RFC 3339
	Changes int      `json:"changes"`
	Remote  []string `json:"remote"` // other machines whose part it undoes too
	CanUndo bool     `json:"canUndo"`
	Undone  bool     `json:"undone"`
	Why     string   `json:"why,omitempty"` // why it cannot be undone now
}

ActivityDTO is one operation in the Activity list.

type ActivityListDTO

type ActivityListDTO struct {
	Items []ActivityDTO `json:"items"`
	Owed  []OwedDTO     `json:"owed"`
}

ActivityListDTO is the Activity screen.

type AgentDTO

type AgentDTO struct {
	ID            agent.ID           `json:"id"`
	Name          string             `json:"name"`
	Stability     agent.Stability    `json:"stability"`
	Enabled       bool               `json:"enabled"`
	RemoteControl bool               `json:"remoteControl"`
	Import        bool               `json:"import"`  // continued sessions go through its own importer
	Version       string             `json:"version"` // installed here ("" when not)
	Folder        string             `json:"folder"`  // its data folder here
	Tested        []string           `json:"tested"`
	Capabilities  []agent.Capability `json:"capabilities"`
	Icon          string             `json:"icon,omitempty"` // a data URL: the installed app's icon or the module's mark ("": initials)
}

AgentDTO is one agent module.

type AgentOpt

type AgentOpt struct {
	ID           agent.ID `json:"id"`
	Name         string   `json:"name"`
	Experimental bool     `json:"experimental,omitempty"`
}

AgentOpt is an agent a session can continue in here.

type App

type App struct {

	// Wails is the running application (events, clipboard, dialogs).
	Wails *application.App `json:"-"`
	// contains filtered or unexported fields
}

App is the service bound to the frontend.

func NewApp

func NewApp(reg *registry.Registry) *App

NewApp loads the configuration for the modules in reg. A configuration an older hopsesh wrote is reported by Info, not returned: the window offers to start fresh.

func (*App) Activity

func (a *App) Activity() (*ActivityListDTO, error)

Activity lists what hopsesh did, newest first, and the marks still owed.

func (*App) AddCLIToPath

func (a *App) AddCLIToPath() (string, error)

AddCLIToPath adds ~/.local/bin to the login shell's PATH (only on the user's click).

func (*App) AddHost

func (a *App) AddHost(name, destination string, password, remember bool) error

AddHost adds and allows a machine by ssh destination. password: it logs in with a password (asked for when hopsesh connects; remember keeps it in the Keychain).

func (*App) Apply

func (a *App) Apply() (*DoneDTO, error)

Apply carries out the last plan, sending each step to the window.

func (*App) CancelPassword

func (a *App) CancelPassword(id string)

CancelPassword declines a password question; that machine is skipped this time.

func (*App) CheckUpdate

func (a *App) CheckUpdate() (*UpdateDTO, error)

CheckUpdate looks for a newer release, at most once a day, and only when allowed.

func (*App) ChooseFolder

func (a *App) ChooseFolder(title string) (string, error)

ChooseFolder asks for a directory.

func (*App) ClosePlan

func (a *App) ClosePlan()

ClosePlan drops the plan the window closed, and ends a send's connection.

func (*App) CopyText

func (a *App) CopyText(text string) bool

CopyText puts text on the clipboard.

func (*App) DismissCLIOffer

func (a *App) DismissCLIOffer() error

DismissCLIOffer stops the app from offering to link the command-line tool.

func (*App) DismissSkillOffer

func (a *App) DismissSkillOffer() error

DismissSkillOffer stops the app from offering the skill (it stays in Settings).

func (*App) ForgetPassword

func (a *App) ForgetPassword(name string) error

ForgetPassword removes a machine's remembered password (it is asked for again).

func (*App) Info

func (a *App) Info() Info

Info returns app and machine information.

func (*App) InstallCLI

func (a *App) InstallCLI(force bool) (integrate.CLIStatus, error)

InstallCLI links the hopsesh command into ~/.local/bin.

func (*App) InstallSkill

func (a *App) InstallSkill(force, addRules bool) (app.SkillReport, error)

InstallSkill installs or updates the hopsesh skill in every installed agent, the same files in each; addRules also adds each agent's approval rules (read-only commands run without asking, moves always ask).

func (*App) InstallUpdate

func (a *App) InstallUpdate() error

InstallUpdate downloads the newest release, verifies it (release signature and checksum; on macOS also the same Apple developer and notarization), installs it over this app, opens the new version and quits this one.

func (*App) Machines

func (a *App) Machines() MachinesDTO

Machines lists this machine, the machines you added (with the last scan's findings) and the ones discovery found (connecting to none).

func (*App) OpenLocalNetworkSettings

func (a *App) OpenLocalNetworkSettings() error

OpenLocalNetworkSettings opens System Settings at Privacy & Security, where the Local Network list is (macOS offers no link to the list itself).

func (*App) OpenResult

func (a *App) OpenResult() error

OpenResult starts the session that was just moved or continued: in the agent's desktop app when that was chosen, otherwise in a new terminal window.

func (*App) OpenURL

func (a *App) OpenURL(url string) error

OpenURL opens a web page in the default browser: hopsesh's release pages, and Tailscale's sign-in check for a machine.

func (*App) PendingPasswords

func (a *App) PendingPasswords() []PasswordRequest

PendingPasswords lists unanswered password questions (for a window that missed the event).

func (*App) Plan

func (a *App) Plan(machine, key, target string, o OptsDTO) (*PlanDTO, error)

Plan works out how a session comes here: in its own agent (target "") or continued in another. Nothing changes.

func (*App) ProvidePassword

func (a *App) ProvidePassword(id, password string, remember bool) error

ProvidePassword answers a password question. remember stores it in the Keychain and sets the machine to remember it; false forgets any remembered one.

func (*App) PushApply

func (a *App) PushApply() (*DoneDTO, error)

PushApply carries out the planned push.

func (*App) PushPlan

func (a *App) PushPlan(key, machine, target string, o OptsDTO) (*PlanDTO, error)

PushPlan asks hopsesh on another machine to plan receiving a session from this one, in its own agent (target "") or another. The connection stays open for PushApply.

func (*App) RemoveHost

func (a *App) RemoveHost(name string) error

RemoveHost forgets a machine: hopsesh stops connecting to it and drops its remembered password (discovery may still list it).

func (*App) RemoveSkill

func (a *App) RemoveSkill(force bool) (app.SkillReport, error)

RemoveSkill removes every copy of the skill and the approval rules.

func (*App) ResumeEntry

func (a *App) ResumeEntry(machine, key string, inApp bool) error

ResumeEntry continues a session that is already on this machine, in a terminal or (inApp) the agent's desktop app.

func (*App) RetryLocalNetwork

func (a *App) RetryLocalNetwork()

RetryLocalNetwork makes the next scan wait for the macOS prompt again, for someone who just changed the setting or wants to answer a prompt they dismissed.

func (*App) Reveal

func (a *App) Reveal(path string) error

Reveal shows a file or folder in Finder, Explorer or the system file manager.

func (*App) SaveSettings

func (a *App) SaveSettings(in SettingsInput) error

SaveSettings stores the user's choices.

func (*App) Scan

func (a *App) Scan() (*ScanDTO, error)

Scan reads this machine and every allowed machine, for every enabled agent.

func (*App) ScanKeys

func (a *App) ScanKeys(name string) (*KeysDTO, error)

ScanKeys fetches a machine's host keys for the trust dialog.

func (*App) SetAgent

func (a *App) SetAgent(id string, enabled, remoteControl, imp bool) error

SetAgent turns an agent on or off (an agent that is off is not scanned and cannot be moved into), and sets whether sessions continued in it turn its remote control on and go through its own importer.

func (*App) SetAllowed

func (a *App) SetAllowed(name, destination string, allowed bool) error

SetAllowed records consent for a machine.

func (*App) SetAuth

func (a *App) SetAuth(name, auth string, remember bool) error

SetAuth switches a machine between key login ("key") and password login ("password").

func (*App) SetReceive

func (a *App) SetReceive(on bool) error

SetReceive lets (or stops letting) hopsesh on your other machines send sessions here.

func (*App) SetReposDir

func (a *App) SetReposDir(dir string) error

SetReposDir changes the clone folder.

func (*App) SetUpdateCheck

func (a *App) SetUpdateCheck(on bool) error

SetUpdateCheck records whether the app may look for new releases once a day.

func (*App) Settings

func (a *App) Settings() SettingsDTO

Settings returns the current settings and integration state.

func (*App) SetupKeyLogin

func (a *App) SetupKeyLogin(name string, createKey bool) (*KeyLoginDTO, error)

SetupKeyLogin adds this Mac's public key to a password machine, checks that key login works and switches the machine to it. Without createKey it fails with "no-key" when this Mac has no key ssh would use (the window then asks before one is made).

func (*App) Shutdown

func (a *App) Shutdown()

Shutdown closes connections.

func (*App) SkillPreview

func (a *App) SkillPreview() (string, error)

SkillPreview returns the SKILL.md this build installs.

func (*App) StartFresh

func (a *App) StartFresh() (string, error)

StartFresh sets aside a configuration file an older hopsesh wrote and starts with defaults (machines are added again). It returns where the old file went.

func (*App) TrustHost

func (a *App) TrustHost(name string) error

TrustHost re-scans and records the machine's host keys (after the user confirmed).

func (*App) Undo

func (a *App) Undo(journal string, force bool) error

Undo reverses a move or continuation by its journal id; force undoes it even when the session was used since.

func (*App) UndoLast

func (a *App) UndoLast() (string, error)

UndoLast undoes the newest operation that can still be undone and returns its title.

func (*App) UninstallCLI

func (a *App) UninstallCLI() (integrate.CLIStatus, error)

UninstallCLI removes the link the app made (and its PATH block).

type CanDTO

type CanDTO struct {
	Fork          bool `json:"fork"`
	RemoteControl bool `json:"remoteControl"`
	App           bool `json:"app"`
	Notify        bool `json:"notify"`
	Native        bool `json:"native"`
	Import        bool `json:"import"`
}

CanDTO is what the receiving agent can do, for the options shown.

type ContinueDTO

type ContinueDTO struct {
	From     string         `json:"from"`
	Fidelity string         `json:"fidelity"`
	Relation string         `json:"relation"`
	AppendTo string         `json:"appendTo,omitempty"` // the title of the copy here that gets the new work
	Report   convert.Report `json:"report"`
	Briefing string         `json:"briefing"`
	Via      string         `json:"via,omitempty"`
}

ContinueDTO is the conversion part of a plan.

type CopyDTO

type CopyDTO struct {
	Machine   string      `json:"machine"`
	Agent     agent.ID    `json:"agent"`
	AgentName string      `json:"agentName"`
	Key       string      `json:"key"` // agent/session, as EntryDTO.Key
	Local     bool        `json:"local"`
	Mark      *agent.Mark `json:"mark,omitempty"`
	Newest    bool        `json:"newest"`
}

CopyDTO is one copy of a session, on some machine and in some agent.

type DoneDTO

type DoneDTO struct {
	Kind       string   `json:"kind"`
	Title      string   `json:"title"`
	Agent      string   `json:"agent"`
	Command    string   `json:"command"`
	Files      int      `json:"files"`
	Bytes      string   `json:"bytes"`
	Paths      int      `json:"paths"`
	Secrets    int      `json:"secrets"`
	Redacted   bool     `json:"redacted"`
	Cloned     bool     `json:"cloned"`
	Worktree   string   `json:"worktree"`
	Journal    string   `json:"journal"`
	SourceHost string   `json:"sourceHost"`
	Stopped    bool     `json:"stopped"`
	Pushed     string   `json:"pushed"`
	PushError  string   `json:"pushError"`
	SyncNote   string   `json:"syncNote"`
	SyncState  string   `json:"syncState"`
	Mark       string   `json:"mark"`
	MarkError  string   `json:"markError"`
	Notice     string   `json:"notice"`
	Warnings   []string `json:"warnings"`
	InApp      bool     `json:"inApp"`             // it opens in the agent's desktop app
	Machine    string   `json:"machine,omitempty"` // a push: where it went (start it there)
	AuditDir   string   `json:"auditDir"`
}

DoneDTO reports a finished move or continuation.

type EntryDTO

type EntryDTO struct {
	Machine    string     `json:"machine"`
	Agent      agent.ID   `json:"agent"`
	AgentName  string     `json:"agentName"`
	Key        string     `json:"key"` // agent/session
	Title      string     `json:"title"`
	Status     string     `json:"status"`
	Live       bool       `json:"live"`
	LastActive string     `json:"lastActive"`
	LastPrompt string     `json:"lastPrompt"`
	CWD        string     `json:"cwd"`
	Branch     string     `json:"branch"`
	Worktree   string     `json:"worktree"`
	MainBranch string     `json:"mainBranch"`
	Unpushed   int        `json:"unpushed"`
	Dirty      int        `json:"dirty"`
	SizeKB     int64      `json:"sizeKB"`
	Copies     []CopyDTO  `json:"copies,omitempty"` // every copy, across machines and agents
	HereNewest bool       `json:"hereNewest"`       // the newest copy is on this machine
	StaleHere  bool       `json:"staleHere"`        // an older copy is on this machine
	ContinueIn []AgentOpt `json:"continueIn"`       // other agents here it can continue in
	Needs      bool       `json:"needs"`            // the agent waits for the person (an approval)
	History    []HopDTO   `json:"history"`          // where it has been, oldest first
}

EntryDTO is one session row.

type FoundRow

type FoundRow struct {
	Name        string   `json:"name"`
	Destination string   `json:"destination"`
	Via         []string `json:"via"`
	OS          string   `json:"os"`
	Online      *bool    `json:"online"`
	Owner       string   `json:"owner"` // shared by someone else
}

FoundRow is a machine discovery found that is not added.

type GroupDTO

type GroupDTO struct {
	Name     string     `json:"name"`
	Remote   string     `json:"remote"`
	Local    string     `json:"local"`
	NoRepo   bool       `json:"noRepo"`   // not in a git checkout
	NoRemote bool       `json:"noRemote"` // a checkout without a remote (matched by path only)
	Entries  []EntryDTO `json:"entries"`
}

GroupDTO is one repository.

type HereDTO

type HereDTO struct {
	Name    string   `json:"name"`
	Agents  []string `json:"agents"`
	Hopsesh string   `json:"hopsesh"`
	Receive bool     `json:"receive"`
}

HereDTO is this machine on the Machines screen.

type HopDTO

type HopDTO struct {
	When string `json:"when"` // RFC 3339
	What string `json:"what"`
}

HopDTO is one step of a session's history.

type Info

type Info struct {
	Version     string     `json:"version"`
	OS          string     `json:"os"` // runtime.GOOS: the window words things for its system
	Host        string     `json:"host"`
	ReposDir    string     `json:"reposDir"`
	AuditDir    string     `json:"auditDir"`
	HasHosts    bool       `json:"hasHosts"`
	ConfigError string     `json:"configError,omitempty"`
	Agents      []AgentDTO `json:"agents"`
	// LocalNetwork describes macOS local network privacy: gated (macOS 15+) and firstRun
	// (the prompt has probably not been answered yet).
	LocalNetwork struct {
		Gated    bool `json:"gated"`
		FirstRun bool `json:"firstRun"`
	} `json:"localNetwork"`
	UpdateCheck string `json:"updateCheck"` // "", "on" or "off"
	SkillState  string `json:"skillState"`  // across every agent: absent | current | stale | modified | foreign | broken
	SkillPrompt string `json:"skillPrompt"` // "declined" once the user said not now
	CLIOffer    bool   `json:"cliOffer"`    // offer to link the command-line tool
	Receive     bool   `json:"receive"`     // other machines' hopsesh may send sessions here
	Defaults    struct {
		MarkMoved  bool `json:"markMoved"`
		SyncCode   bool `json:"syncCode"`
		PushSource bool `json:"pushSource"`
	} `json:"defaults"`
}

Info is static information for the window.

type KeyLoginDTO

type KeyLoginDTO struct {
	PublicKey string `json:"publicKey"`
	Created   bool   `json:"created"`
	Added     bool   `json:"added"`
}

KeyLoginDTO is what SetupKeyLogin did.

type KeysDTO

type KeysDTO struct {
	Host         string   `json:"host"`
	Address      string   `json:"address"`
	Fingerprints []string `json:"fingerprints"`
	Verified     string   `json:"verified"` // how it was verified, "" if not
}

KeysDTO describes host keys awaiting confirmation.

type MachineDTO

type MachineDTO struct {
	Name     string   `json:"name"`
	Status   string   `json:"status"`
	Hint     string   `json:"hint"`
	Error    string   `json:"error"`
	OS       string   `json:"os"`
	Sessions int      `json:"sessions"`
	Local    bool     `json:"local"`
	Agents   []string `json:"agents"`  // "Claude Code 2.1.284"
	Hopsesh  string   `json:"hopsesh"` // hopsesh's version there ("" when not installed)
}

MachineDTO summarises one scanned machine.

type MachineRow

type MachineRow struct {
	Name        string   `json:"name"`
	Destination string   `json:"destination"`
	OS          string   `json:"os"`
	Auth        string   `json:"auth"`     // key | password
	Keychain    bool     `json:"keychain"` // the password is remembered
	CanRemember bool     `json:"canRemember"`
	Scanned     bool     `json:"scanned"` // the last scan reached for it
	Status      string   `json:"status"`  // the last scan's (app.Status*)
	Hint        string   `json:"hint"`
	Error       string   `json:"error"`
	Agents      []string `json:"agents"`
	Hopsesh     string   `json:"hopsesh"`
	Sessions    int      `json:"sessions"`
}

MachineRow is a machine you added: how hopsesh logs in, and what the last scan found.

type MachinesDTO

type MachinesDTO struct {
	Here     HereDTO      `json:"here"`
	Machines []MachineRow `json:"machines"`
	Found    []FoundRow   `json:"found"`
}

MachinesDTO is the Machines screen.

type OptsDTO

type OptsDTO struct {
	TargetDir     string `json:"targetDir"`
	Clone         bool   `json:"clone"`
	ReposDir      string `json:"reposDir"`
	Worktree      string `json:"worktree"`
	Fork          bool   `json:"fork"`
	RemoteControl bool   `json:"remoteControl"`
	Notify        bool   `json:"notify"`
	Redact        bool   `json:"redact"`
	Mark          bool   `json:"mark"`
	SyncCode      bool   `json:"syncCode"`
	Push          bool   `json:"push"`
	StopLocal     bool   `json:"stopLocal"`
	Conflict      string `json:"conflict"` // "", "replace" or "keep-both"
	App           bool   `json:"app"`
	// Continuing in another agent.
	Fidelity   string `json:"fidelity"` // history | note
	Native     bool   `json:"native"`
	Note       string `json:"note"`
	Go         bool   `json:"go"`
	CarryRules bool   `json:"carryRules"`
	Via        string `json:"via"` // "" or "import"
}

OptsDTO are the choices on the plan screen.

type OwedDTO

type OwedDTO struct {
	Title    string `json:"title"`
	Location string `json:"location"`
	Mark     string `json:"mark"` // "moved to studio", "continued in Codex on studio"
	Since    string `json:"since"`
}

OwedDTO is a mark waiting for a copy left behind to end.

type PasswordRequest

type PasswordRequest struct {
	ID          string `json:"id"`
	Machine     string `json:"machine"`
	Destination string `json:"destination"`
	Retry       bool   `json:"retry"`       // the last password was refused
	CanRemember bool   `json:"canRemember"` // the Keychain is available
	Remember    bool   `json:"remember"`    // the machine is set to remember it
}

PasswordRequest asks the window for a machine's password.

type PlanDTO

type PlanDTO struct {
	Kind        string           `json:"kind"` // move | continue
	Title       string           `json:"title"`
	Agent       string           `json:"agent"`     // the agent it lands in
	FromAgent   string           `json:"fromAgent"` // the agent it comes from
	SourceHost  string           `json:"sourceHost"`
	SourceOS    string           `json:"sourceOs"`
	SourceCWD   string           `json:"sourceCwd"`
	TargetCWD   string           `json:"targetCwd"`
	Live        bool             `json:"live"`
	Repo        move.RepoPlan    `json:"repo"`
	Mappings    []agent.Mapping  `json:"mappings"`
	Files       int              `json:"files"`
	Bytes       int64            `json:"bytes"`
	Mark        string           `json:"mark"`
	Sync        string           `json:"sync"`
	FromSource  bool             `json:"syncFromSource"`
	Push        bool             `json:"push"`
	StopHere    bool             `json:"stopHere"`
	Conflict    string           `json:"conflict"`
	Warnings    []string         `json:"warnings"`
	Blockers    []string         `json:"blockers"`
	NewName     string           `json:"newName"`
	OtherAcct   bool             `json:"otherAccount"`
	Continue    *ContinueDTO     `json:"continue,omitempty"`
	NativeCopy  *move.NativeCopy `json:"nativeCopy,omitempty"`
	Can         CanDTO           `json:"can"`
	SetAside    int              `json:"setAside"`
	Options     move.Options     `json:"-"`
	SessionKey  agent.SessionKey `json:"-"`
	SourceAgent agent.ID         `json:"sourceAgent"`
	Machine     string           `json:"machine,omitempty"` // a push: the machine it goes to
}

PlanDTO is a plan as the window shows it.

type ScanDTO

type ScanDTO struct {
	Machines []MachineDTO `json:"machines"`
	Groups   []GroupDTO   `json:"groups"`
	Total    int          `json:"total"`
	Peers    []string     `json:"peers"`   // reached machines with hopsesh, a session here can be sent to
	Updated  string       `json:"updated"` // when the scan finished (RFC 3339)
}

ScanDTO is the result of a scan.

type SettingsDTO

type SettingsDTO struct {
	Version    string     `json:"version"`
	ReposDir   string     `json:"reposDir"`
	Layout     string     `json:"layout"` // flat | ghq
	MarkMoved  bool       `json:"markMoved"`
	SyncCode   bool       `json:"syncCode"`
	PushSource bool       `json:"pushSource"`
	UpdateChk  string     `json:"updateCheck"`
	AppIcons   bool       `json:"appIcons"` // installed desktop apps' icons picture the agents
	Agents     []AgentDTO `json:"agents"`

	CLI         integrate.CLIStatus `json:"cli"`
	Skill       app.SkillReport     `json:"skill"`
	SkillBin    string              `json:"skillBin"`
	SkillPrompt string              `json:"skillPrompt"`

	LocalNetworkGated bool   `json:"localNetworkGated"`
	ConfigDir         string `json:"configDir"`
	StateDir          string `json:"stateDir"`
}

SettingsDTO is everything the Settings screen shows.

type SettingsInput

type SettingsInput struct {
	Layout     string `json:"layout"`
	MarkMoved  bool   `json:"markMoved"`
	SyncCode   bool   `json:"syncCode"`
	PushSource bool   `json:"pushSource"`
	UpdateChk  string `json:"updateCheck"`
	AppIcons   bool   `json:"appIcons"`
}

SettingsInput are the settings the user can change.

type UpdateDTO

type UpdateDTO struct {
	Latest string `json:"latest"`
	Newer  bool   `json:"newer"`
	URL    string `json:"url"`
	// CanInstall: this app can install the update itself (a release build, not managed by
	// a package manager); otherwise the window offers the release page.
	CanInstall bool `json:"canInstall"`
}

UpdateDTO is the result of an update check.

Jump to

Keyboard shortcuts

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