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
- Variables
- type ActivityDTO
- type ActivityListDTO
- type AgentDTO
- type AgentOpt
- type App
- func (a *App) Activity() (*ActivityListDTO, error)
- func (a *App) AddCLIToPath() (string, error)
- func (a *App) AddHost(name, destination string, password, remember bool) error
- func (a *App) Apply() (*DoneDTO, error)
- func (a *App) CancelPassword(id string)
- func (a *App) CheckUpdate() (*UpdateDTO, error)
- func (a *App) ChooseFolder(title string) (string, error)
- func (a *App) ClosePlan()
- func (a *App) CopyText(text string) bool
- func (a *App) DismissCLIOffer() error
- func (a *App) DismissSkillOffer() error
- func (a *App) ForgetPassword(name string) error
- func (a *App) Info() Info
- func (a *App) InstallCLI(force bool) (integrate.CLIStatus, error)
- func (a *App) InstallSkill(force, addRules bool) (app.SkillReport, error)
- func (a *App) InstallUpdate() error
- func (a *App) Machines() MachinesDTO
- func (a *App) OpenLocalNetworkSettings() error
- func (a *App) OpenResult() error
- func (a *App) OpenURL(url string) error
- func (a *App) PendingPasswords() []PasswordRequest
- func (a *App) Plan(machine, key, target string, o OptsDTO) (*PlanDTO, error)
- func (a *App) ProvidePassword(id, password string, remember bool) error
- func (a *App) PushApply() (*DoneDTO, error)
- func (a *App) PushPlan(key, machine, target string, o OptsDTO) (*PlanDTO, error)
- func (a *App) RemoveHost(name string) error
- func (a *App) RemoveSkill(force bool) (app.SkillReport, error)
- func (a *App) ResumeEntry(machine, key string, inApp bool) error
- func (a *App) RetryLocalNetwork()
- func (a *App) Reveal(path string) error
- func (a *App) SaveSettings(in SettingsInput) error
- func (a *App) Scan() (*ScanDTO, error)
- func (a *App) ScanKeys(name string) (*KeysDTO, error)
- func (a *App) SetAgent(id string, enabled, remoteControl, imp bool) error
- func (a *App) SetAllowed(name, destination string, allowed bool) error
- func (a *App) SetAuth(name, auth string, remember bool) error
- func (a *App) SetReceive(on bool) error
- func (a *App) SetReposDir(dir string) error
- func (a *App) SetUpdateCheck(on bool) error
- func (a *App) Settings() SettingsDTO
- func (a *App) SetupKeyLogin(name string, createKey bool) (*KeyLoginDTO, error)
- func (a *App) Shutdown()
- func (a *App) SkillPreview() (string, error)
- func (a *App) StartFresh() (string, error)
- func (a *App) TrustHost(name string) error
- func (a *App) Undo(journal string, force bool) error
- func (a *App) UndoLast() (string, error)
- func (a *App) UninstallCLI() (integrate.CLIStatus, error)
- type CanDTO
- type ContinueDTO
- type CopyDTO
- type DoneDTO
- type EntryDTO
- type FoundRow
- type GroupDTO
- type HereDTO
- type HopDTO
- type Info
- type KeyLoginDTO
- type KeysDTO
- type MachineDTO
- type MachineRow
- type MachinesDTO
- type OptsDTO
- type OwedDTO
- type PasswordRequest
- type PlanDTO
- type ScanDTO
- type SettingsDTO
- type SettingsInput
- type UpdateDTO
Constants ¶
const MenuEvent = "hopsesh:menu"
MenuEvent carries a menu-bar command to the window ("palette", "refresh", "sessions", "activity", "machines", "settings", "undo-last").
const PasswordEvent = "hopsesh:password"
PasswordEvent is the event the window gets when ssh asks for a machine's password.
const ProgressEvent = "hopsesh:progress"
ProgressEvent carries the steps of a move or continuation to the window.
Variables ¶
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 ¶
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 ¶
AddCLIToPath adds ~/.local/bin to the login shell's PATH (only on the user's click).
func (*App) AddHost ¶
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) CancelPassword ¶
CancelPassword declines a password question; that machine is skipped this time.
func (*App) CheckUpdate ¶
CheckUpdate looks for a newer release, at most once a day, and only when allowed.
func (*App) ChooseFolder ¶
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) DismissCLIOffer ¶
DismissCLIOffer stops the app from offering to link the command-line tool.
func (*App) DismissSkillOffer ¶
DismissSkillOffer stops the app from offering the skill (it stays in Settings).
func (*App) ForgetPassword ¶
ForgetPassword removes a machine's remembered password (it is asked for again).
func (*App) InstallCLI ¶
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 ¶
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 ¶
OpenLocalNetworkSettings opens System Settings at Privacy & Security, where the Local Network list is (macOS offers no link to the list itself).
func (*App) OpenResult ¶
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 ¶
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 ¶
Plan works out how a session comes here: in its own agent (target "") or continued in another. Nothing changes.
func (*App) ProvidePassword ¶
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) PushPlan ¶
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 ¶
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 ¶
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) SaveSettings ¶
func (a *App) SaveSettings(in SettingsInput) error
SaveSettings stores the user's choices.
func (*App) SetAgent ¶
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 ¶
SetAllowed records consent for a machine.
func (*App) SetAuth ¶
SetAuth switches a machine between key login ("key") and password login ("password").
func (*App) SetReceive ¶
SetReceive lets (or stops letting) hopsesh on your other machines send sessions here.
func (*App) SetReposDir ¶
SetReposDir changes the clone folder.
func (*App) SetUpdateCheck ¶
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) SkillPreview ¶
SkillPreview returns the SKILL.md this build installs.
func (*App) StartFresh ¶
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 ¶
TrustHost re-scans and records the machine's host keys (after the user confirmed).
func (*App) Undo ¶
Undo reverses a move or continuation by its journal id; force undoes it even when the session was used since.
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 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.