Documentation
¶
Overview ¶
Package paths resolves where stagent keeps its binary, state, sockets and scrollback on the current host. Every other package takes a *Layout rather than computing paths itself, so tests and the load bench can isolate a whole installation by setting STAGENT_HOME.
Index ¶
Constants ¶
const EnvHome = "STAGENT_HOME"
EnvHome overrides the home directory. Tests and the bench point it at a temporary directory; it also namespaces the IPC endpoints so an isolated installation never talks to the real daemon.
const KeepFreshInterval = time.Hour
KeepFreshInterval is how often KeepFresh touches its paths: well below the age (days) after which tmp cleaners such as systemd-tmpfiles delete unused entries of /tmp.
Variables ¶
This section is empty.
Functions ¶
func KeepFresh ¶ added in v0.3.0
KeepFresh sets the access and modification times of every existing path to now every KeepFreshInterval until ctx is done, so that a tmp cleaner does not delete the run directory or a socket of a process that is still serving. Missing paths and errors are ignored. It is a no-op on Windows: RunDir is not in a temporary directory there, and opening a named pipe path to set its times would connect to the pipe.
func ToolDirs ¶
ToolDirs lists the per-user and common install directories of CLI tools (npm/bun/pnpm globals, version managers, Homebrew, …) that are often only on PATH in interactive or login shells — not in the environment an SSH exec channel starts with. goos and getenv are parameters so callers can fake another platform in tests.
Types ¶
type Layout ¶
type Layout struct {
Home string // user home (or STAGENT_HOME)
Root string // <Home>/.ssh-term/agent
BinDir string // <Root>/bin
Bin string // <BinDir>/stagent[.exe]
Manifest string // <Root>/manifest.json
Config string // <Root>/config.json
StateDir string // <Root>/state
EventLog string // <StateDir>/events.log (segments get a numeric suffix)
Index string // <StateDir>/index.json — conversation list cache
DataDir string // per-session scrollback segments; local disk even when Home is on NFS
LogDir string // <Root>/log — stderr of detached processes
RunDir string // sockets (unix) / lock and pid files (all OSes), 0700
DaemonAddr string // IPC address of the daemon
UploadsDir string // <Home>/.ssh-term/uploads — files sent from the app
// DataOnNetworkFS reports that Home is on a network file system and
// DataDir was moved to local disk.
DataOnNetworkFS bool
// Isolated reports that STAGENT_HOME is set.
Isolated bool
// contains filtered or unexported fields
}
Layout is the resolved file-system layout of one installation.
func Resolve ¶
Resolve computes the layout for the current user. It does not create anything; call EnsureDirs for that.
func (*Layout) EnsureDirs ¶
EnsureDirs creates every directory of the layout with owner-only access. A RunDir in the shared temporary directory is validated instead of repaired (ensurePrivateDir).
func (*Layout) HolderAddr ¶
HolderAddr is the IPC address a session holder listens on.
func (*Layout) HolderSocketDir ¶
HolderSocketDir is the directory holding holder sockets on unix (empty on Windows, where holders use named pipes). The daemon scans it on start.
func (*Layout) SessionDataDir ¶
SessionDataDir is where one session's scrollback segments live.