nodeagent

package
v0.0.0-...-e99dd18 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 50 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 nodeagent is `fridolin node`: the agent that runs on each machine of the fleet (docs/NODES.md). It holds the node's device key, connects out to the core, reconnects when the connection drops, and serves the capabilities the owner approved: allowlisted commands, files under granted roots, host facts and desktop notifications. It runs on macOS, Linux and Windows.

Index

Constants

View Source
const (
	BoxFride       = "fride:17840"
	BoxFridePort   = 17840
	BoxWebhookPort = 17841
)

The box's fixed addresses (docs/NODES.md, "Node in a box"): FrIDE's service on the box network, and the ports FrIDE and its webhook have on both containers' loopback. container/fride/entrypoint.sh forwards the same ports on FrIDE's side.

View Source
const (
	// BoxUpdateFile is the request the updater picks up.
	BoxUpdateFile = "box-update.json"
	// BoxUpdateTakenFile is the request while the updater checks and applies it.
	BoxUpdateTakenFile = "box-update.taken.json"
	// BoxUpdateResultFile is how the updater's last update ended.
	BoxUpdateResultFile = "box-update-result.json"
	// BoxStatusFile is when the agent last knew itself connected, for the
	// node service's health check (fridolin node health).
	BoxStatusFile = "box-status.json"
)

A box's updates (docs/NODES.md, "Box updates"). The core asks for the images of its version, signed with its update key; the agent checks the signature against the key it pinned and keeps the request in the state dir, where the box's updater on the host finds it. The updater checks it again in a throwaway container of the image the box runs now, with the images' build provenance, pulls them, recreates the services and writes the result back, which the agent reports once it is connected. The agent itself never reaches Docker.

View Source
const (
	// ConfigFile is the node's settings, which its owner may edit: the
	// core's address, the name, and what the node offers. A change that
	// offers more needs the owner's approval again on the core.
	ConfigFile = "node.json"
	// KeyFile is the device's ed25519 key, hex; it never leaves the node.
	KeyFile = "node.key"
)

The files in the node's state dir.

View Source
const (
	// CoreRoleFile holds the box's role: RoleCore or RoleStandby.
	CoreRoleFile = "core-role.json"

	// BoxCoreEnv is set by the box's core settings (container/box-core.yaml):
	// the data and home volumes, the published ports and the sandbox's
	// security profile. A box without them cannot take the core.
	BoxCoreEnv = "FRIDOLIN_BOX_CORE"
)

The core in a box (docs/NODES.md, "The core in a box"; #191 phase 4). A box's node container holds a standby core: the same image's binary, off until a core move hands the core to this box. The core then runs as a child of the agent, inside the node container, on the box's own data volume (/data) with the host secrets from the box's sealed store in its environment. No Docker socket and no second container: the role is a file in the node's volume, which the agent reads when it starts, so that a box that is the core starts it again after a restart.

View Source
const (
	RoleStandby = "standby"
	RoleCore    = "core"
)

The roles of a box.

View Source
const (
	// CoreHostFile is the core-host settings, written only by `fridolin
	// node core-host` on this machine.
	CoreHostFile = "core-host.json"

	// TransferLogFile gets a line, names only, for every transfer.
	TransferLogFile = "secrets-transfer.log"
)

core-host (docs/NODES.md, "core-host"; #187): a machine the core may move to. Every node is one unless its owner turns it off there. Its local settings, that opt-out and the targets this machine pins, live in core-host.json in the state dir, not node.json: the core cannot change them, and the workstation's sandbox denies the state dir.

View Source
const (
	ServiceName        = "fridolin-node"
	ServiceLabelDarwin = "ai.fridolin.node"
)

The node agent's service names. On macOS the launchd label differs from the bridge's (ai.fridolin.bridge), so a core and a node on one Mac are two agents.

View Source
const (
	// DefaultTerminalIdle closes a terminal nobody typed into or read
	// from for this long.
	DefaultTerminalIdle = 30 * time.Minute
	// DefaultAgentMaxRuntime stops a session that ran this long in all.
	DefaultAgentMaxRuntime = 24 * time.Hour
)

Defaults of the workstation family.

View Source
const (
	// CoreKeyFile is the core's update key, hex, pinned when the node
	// joined or at its first update.
	CoreKeyFile = "core.pub"
)

The update files in the state dir.

View Source
const (
	// DefaultFrideCheckEvery is how often the agent asks whether FrIDE
	// answers, and reads its fride settings again.
	DefaultFrideCheckEvery = 30 * time.Second
)

Timing of the FrIDE link.

View Source
const (
	// DefaultFrideInstanceDockerDisk is the size of a sandbox's
	// /var/lib/docker, for compose stacks: sbx's default is 10g. The disk
	// is a sparse file on the host, so it takes only what is used.
	DefaultFrideInstanceDockerDisk = "40g"
)

The instances' Docker disk and shared caches (docs/NODES.md, "Docker disk" and "Shared caches").

View Source
const (
	// DefaultFrideInstancePoll is how often the agent reads the
	// instances' state.
	DefaultFrideInstancePoll = 5 * time.Second
)

The agent keeps each instance's FrIDE running while its state says run: it holds the serve script's exec open (sbx stops a VM 30 s after its last exec ends), starts it again when it ends, waiting longer after each quick end, and lets go of it when run is cleared: whoever cleared it ends FrIDE (a stop, a remake), and with it the exec, which the agent ends itself only when it is still there frideServeStopWait later. It hears each running instance's webhook on the instance's loopback port. When the agent stops, FrIDE runs on until the VM stops, unless the agent's next start holds it again first.

View Source
const DefaultFrideReserveMB = 6144

DefaultFrideReserveMB is the memory a fride_host node keeps for itself unless node.json says otherwise.

View Source
const (
	// DefaultTailscaleGrace is how long the core is out of reach before
	// the node looks at Tailscale.
	DefaultTailscaleGrace = 2 * time.Minute
)
View Source
const ExecProgramsFile = "exec-from-core.json"

ExecProgramsFile holds the programs the core added, and the seq of the list they came in.

View Source
const ExitRestart = 75

ExitRestart is the exit code with which an agent under a service manager ends to be started again (launchd's KeepAlive, systemd's Restart=always, the Windows Service's restart on failure).

View Source
const (
	FrideInstancePortBase = 17850
)

The instances' ports: a pair per instance, FrIDE's and its webhook's, from FrideInstancePortBase up. FrIDE's port is the same in the VM and on the host's loopback, since FrIDE checks the Host header.

View Source
const FrideTokenFile = "fride.token"

FrideTokenFile is the companion token in the node's state dir.

View Source
const LinuxBootTarget = "default.target"

LinuxBootTarget is the target the systemd user unit is enabled into. A user manager starts default.target at boot (with lingering on) and at login; it never reaches multi-user.target, which is the system manager's, so a unit wanted by that one does not start after a reboot.

View Source
const TestedSbxVersion = "v0.50.0"

TestedSbxVersion is the sbx release fridolin's sandboxes were tested with; fride host setup notes another.

Variables

View Source
var BoxCoreArgs = []string{"run", "--container", "--box"}

BoxCoreArgs are the core's arguments in a box: the container's run, its dashboard and site on the loopback.

View Source
var BoxCorePorts = []int{8765, 8780}

BoxCorePorts are the ports a box publishes for the core it runs: the dashboard and the site (container/box-core.yaml).

NodeSecrets are the secrets fridolin node secrets keeps: the Claude token FrIDE's agents log in with.

Functions

func BoxHealthy

func BoxHealthy(dir string, maxAge time.Duration, now time.Time) error

BoxHealthy reports whether the agent of the box in dir was connected to the core within maxAge.

func BoxHostname

func BoxHostname(name string) string

BoxHostname is the tailnet name of a box whose node is called name: fridolin-box-<name>, in lower case, with what the tailnet does not take turned into hyphens.

func BoxSecretStore

func BoxSecretStore(dir string, key []byte) hostsecrets.Store

BoxSecretStore is a box's store of host secrets: sealed files in the node's volume, under a key derived from its device key.

func BwrapProbe

func BwrapProbe(ctx context.Context) error

BwrapProbe checks that bubblewrap can make the namespaces of a brain's run in this container, as the core checks it before its first run.

func CheckClaudeToken

func CheckClaudeToken(token string) (string, error)

CheckClaudeToken is token as `claude setup-token` prints it, without what a copy or Windows PowerShell adds (a byte order mark, carriage returns, spaces), or why it is not one.

func CheckHostToken

func CheckHostToken(token string) (string, error)

CheckHostToken is token without what a copy adds around it (spaces, line ends, a byte order mark), or why it cannot be one.

func CheckTailnetHostname

func CheckTailnetHostname(name string) error

CheckTailnetHostname checks a device name for the tailnet: 1 to 63 lower-case letters, digits and hyphens, not starting or ending with a hyphen.

func CheckWorkRoot

func CheckWorkRoot(root string, allowHome bool, stateDir string) error

CheckWorkRoot reports what is wrong with root as a workstation root on this machine: it must be an absolute folder; never a volume's root, a system folder or a place of deniedPaths, nor lie in one; and never the home folder or a folder above it, but for the home folder itself with allowHome.

func ControlService

func ControlService(cfg *service.Config, action string) error

ControlService installs, starts, stops or uninstalls the service.

func CoreKeyFingerprint

func CoreKeyFingerprint(dir string) string

CoreKeyFingerprint names the core key node dir pinned, "" for none.

func CoreSecretsKey

func CoreSecretsKey(key ed25519.PrivateKey) ([]byte, error)

CoreSecretsKey is the key a box seals its host secrets with, derived from its device key: the volume holds them encrypted at rest.

func DefaultCapabilities

func DefaultCapabilities(goos string) nodeproto.Capabilities

DefaultCapabilities is what a node offers when its owner says nothing else: the OS's report-only commands, host facts and notifications, and no files.

func DeviceID

func DeviceID(key ed25519.PrivateKey) string

DeviceID is the ID of key's device.

func FindSbx

func FindSbx(env []string) string

FindSbx is the sbx program of the user whose environment is env, on Windows (windowsSbxCandidates): "" when none is there.

func FinishBoxUpdate

func FinishBoxUpdate(dir string, r nodeproto.UpdateReport) error

FinishBoxUpdate records how an update ended, for the agent to report, and forgets the taken request. A newer request stays pending.

func FrideHostSetup

func FrideHostSetup(ctx context.Context, o FrideHostSetupOptions) error

FrideHostSetup sets this machine up to run FrIDE instances: it checks sbx (running, signed in), makes sbx's global settings fridolin's, builds the template with FrIDE at the commit the checkout pins unless sbx has it (with NoBuild, it records that the template comes from the core instead), and records it all in fride-host.json, after which the node's agent offers fride_host. Run again, it builds the template of a newer checkout; instances get it when their sandbox is made anew.

func FrideInstanceLogs

func FrideInstanceLogs(ctx context.Context, o FrideInstanceOptions, name string, lines int) ([]byte, error)

FrideInstanceLogs is the last lines of the instance's FrIDE log.

func FrideInstanceSandbox

func FrideInstanceSandbox(name string) string

FrideInstanceSandbox is the sandbox of the instance name.

func FridePin

func FridePin(repo string) (string, error)

FridePin is the FrIDE commit the checkout at repo pins: the template's FRIDE_COMMIT, which a test holds to the fridolin-fride image's.

func FrideSecretStore

func FrideSecretStore(goos string, getenv func(string) string, home, dir string) (hostsecrets.Store, string, error)

FrideSecretStore is where the agent on goos reads FrIDE's Claude token, and how that place is called: the host's store, or on Windows the node's own in dir, which needs the node's key.

func FrideTemplateTag

func FrideTemplateTag(repo, frideRepo string) (string, error)

FrideTemplateTag is the template's name for the checkout at repo and FrIDE's git URL: a hash of the Dockerfile, which pins all that goes in, of the FrIDE config it copies and of the URL.

func HostSecretStore

func HostSecretStore(goos string, getenv func(string) string, home string) (hostsecrets.Store, string)

HostSecretStore is the store a native agent on goos keeps host secrets in, as `fridolin core` does (none on Windows, see coreStore).

func IsNoFrideInstance

func IsNoFrideInstance(err error) bool

IsNoFrideInstance reports whether err is about an instance the node does not have.

func LinuxUnitPath

func LinuxUnitPath(home, name string) string

LinuxUnitPath is where kardianos/service writes the systemd user unit under the home folder home.

func LinuxWantsLink(home, target, name string) string

LinuxWantsLink is the link `systemctl --user enable` makes for the unit in target's .wants folder.

func LoadCoreRole

func LoadCoreRole(dir string) (string, error)

LoadCoreRole is the role of the box whose state dir is dir: RoleStandby when the file is missing.

func LoadKey

func LoadKey(dir string) (ed25519.PrivateKey, error)

LoadKey reads dir's device key.

func NewKey

func NewKey(dir string) (ed25519.PrivateKey, error)

NewKey makes a device key and writes it to dir, replacing one there: a node that joins again is a new device (Join moves the old key aside first).

func NodeServiceConfig

func NodeServiceConfig(goos, exe, dir string) *service.Config

NodeServiceConfig is the service of the node in dir: ServiceConfig, or for a second node (node.json's service) its own service, run from its own binary once that is there.

func OwnBinary

func OwnBinary(dir string) string

OwnBinary is the fridolin a second node (node.json's service) runs from its state dir, so that the core's updates to it never replace the machine's node's binary.

func PrintSbxSecret

func PrintSbxSecret(w io.Writer, file string) error

PrintSbxSecret writes the token in file to w, for sbx: `fridolin node fride host sbx-secret FILE`, which sbx runs on Windows as the signed-in user to read a git host's token (sbx_tokens.go). It prints only a token file of an instance's.

func ReadyAt

func ReadyAt(ctx context.Context, c *http.Client, url string) (bool, string)

ReadyAt asks a core's /ready whether it is ready for a move: WhatsApp connected and, with the lease on, the lease held.

func RemoveFrideInstance

func RemoveFrideInstance(ctx context.Context, o FrideInstanceOptions, name string, skipHistory bool) error

RemoveFrideInstance removes the instance name, saving its history first unless skipHistory.

func RepairBootTarget

func RepairBootTarget(home string, systemctl func(args ...string) error) (bool, error)

RepairBootTarget moves a systemd user unit written before issue #171 was fixed from multi-user.target to LinuxBootTarget: it disables the unit (which removes the old link), rewrites its WantedBy line and enables it again. systemctl runs `systemctl ARGS`. It says whether it changed anything; a missing or already right unit is left alone.

compat: units that `fridolin node install` or `join` wrote with kardianos/service's template say WantedBy=multi-user.target; `node install`, `start`, `join` and `run` call this, so they move once.

func Rollback

func Rollback(exe string) error

Rollback puts exe.prev back in place of exe, for `fridolin node rollback`; the agent then needs a restart.

func RunForeground

func RunForeground(ctx context.Context, a *Agent) error

RunForeground runs the agent until ctx ends, without a service manager: a node in a box, whose container is the service. A revoked or unknown node stays up without reconnecting, as under a service manager, so the container does not restart into the same refusal.

func RunService

func RunService(a *Agent, cfg *service.Config) error

RunService runs the agent under the service manager, or in the foreground until interrupted when started from a terminal.

func SaveConfig

func SaveConfig(dir string, c Config) error

SaveConfig writes dir's node.json.

func SaveCoreHost

func SaveCoreHost(dir string, c CoreHostConfig) error

SaveCoreHost writes dir's core-host.json.

func SbxInstallHint

func SbxInstallHint() string

SbxInstallHint is how to install sbx on this system.

func SbxUnsupported

func SbxUnsupported() string

SbxUnsupported says why this system runs no Docker Sandboxes, "" when it does.

func ServiceConfig

func ServiceConfig(goos, exe, dir string) *service.Config

ServiceConfig is the service that runs `exe node run --state-dir dir` at login (macOS, as a launchd user agent), as a systemd user unit (Linux) or as a Windows Service started at boot, restarted when it stops.

func ServiceConfigNamed

func ServiceConfigNamed(goos, exe, dir, suffix string) *service.Config

ServiceConfigNamed is ServiceConfig for a second node on the machine, whose service is named after suffix ("" for the machine's node).

func ServiceStateDir

func ServiceStateDir(cfg *service.Config) (string, error)

ServiceStateDir is the state dir the installed service runs with, read back from the Windows Service's command line: "" for a service that is not installed, and on macOS and Linux.

func ServiceStatus

func ServiceStatus(cfg *service.Config) (string, error)

ServiceStatus says whether the service is installed and running. On Windows it needs no administrator.

func SignFride

func SignFride(token string, body []byte) string

SignFride is the X-Fride-Signature of body for token: sha256= and the hex HMAC-SHA256 keyed with the token's SHA-256 (its 32 raw bytes).

func StopFrideInstance

func StopFrideInstance(ctx context.Context, o FrideInstanceOptions, name string) error

StopFrideInstance stops the instance name: the agent no longer keeps its FrIDE running, and its VM stops.

func TailscaleCLIEnv

func TailscaleCLIEnv(env []string) []string

TailscaleCLIEnv is env with what the CLI needs to answer as one.

func VerifyBoxUpdate

func VerifyBoxUpdate(dir string, r *BoxUpdateRequest) error

VerifyBoxUpdate checks a request against the core's key the box in dir pinned: its params, and the signature.

Types

type Agent

type Agent struct {
	// Dir is the node's state dir: its config, key and the disk it reports.
	Dir     string
	Config  Config
	Key     ed25519.PrivateKey
	Version string
	// Dial connects to the core, nil with the host's network. A node in a
	// box dials over its own tailnet device.
	Dial func(ctx context.Context, network, addr string) (net.Conn, error)
	// Logf logs; nil logs with the standard logger.
	Logf func(format string, args ...any)
	// Notifier shows a notification; nil shows it the OS's way.
	Notifier func(ctx context.Context, title, message string) (nodeproto.NotifyResult, error)
	// MinBackoff and MaxBackoff bound the wait between reconnects (1s
	// and 1m when zero); HeartbeatEvery is the report interval (20s).
	MinBackoff, MaxBackoff time.Duration
	HeartbeatEvery         time.Duration
	// Volumes lists the machine's drives for fs.roots; nil asks the OS
	// (platform.Volumes). Tests hand in their own.
	Volumes func() []platform.Volume
	// OnState hears every state the core sends, for tests and the CLI.
	OnState func(nodeproto.State)
	// FrideCheckEvery is how often the agent asks whether FrIDE answers
	// (DefaultFrideCheckEvery when zero). FrideToken is the companion
	// token of an agent without a state dir; one with a state dir reads
	// it, and node.json's fride section, from there at every check.
	FrideCheckEvery time.Duration
	FrideToken      string
	// AndroidToolchain finds the JDK and the Android SDK android-build
	// needs; nil looks where platform.FindAndroidToolchain does.
	AndroidToolchain func() (platform.AndroidToolchain, error)
	// Executable is the running binary, which an update from the core
	// replaces (update.go); Args (without the program) and Environ are
	// what it restarts with from a terminal. Updates fail without it.
	Executable    string
	Args, Environ []string
	// Restart starts the agent again after an update or a rollback; nil
	// restarts it the way it runs: in place from a terminal, by exiting
	// with ExitRestart under a service manager. Tests hand in their own.
	Restart func() error
	// UpdateTrial is how long a new binary has to connect before the node
	// puts the old one back (nodeproto.UpdateTrialMinutes when zero).
	UpdateTrial time.Duration
	// CheckBinary runs a new binary to see that it is version; nil runs
	// `<binary> version`.
	CheckBinary func(ctx context.Context, path, version string) error
	// WorkSandbox is the sandbox of workstation sessions ("" finds the
	// platform's; nodeproto.SandboxNone runs them without one).
	// AgentPaths, when set, are the agent CLIs by provider instead of the
	// PATH's; TerminalShell the shell's argv instead of the user's.
	// TerminalIdle and AgentMaxRuntime are the workstation's limits
	// (DefaultTerminalIdle, DefaultAgentMaxRuntime when zero).
	WorkSandbox     string
	AgentPaths      map[string]string
	TerminalShell   []string
	TerminalIdle    time.Duration
	AgentMaxRuntime time.Duration
	// CoreSecrets is where core-host keeps host secrets (CoreSecretsPlace
	// names it); nil is the box's sealed files or the host's store
	// (corehost.go). CoreSetup, when set, is setup-machine --core's
	// checks instead of running the agent's own binary.
	CoreSecrets      hostsecrets.Store
	CoreSecretsPlace string
	// FrideSecrets is where FrIDE instances' Claude token is
	// (FrideSecretStore): nil is CoreSecrets.
	FrideSecrets hostsecrets.Store
	CoreSetup    func(ctx context.Context) ([]nodeproto.CoreCheckItem, bool, string)
	// CoreRunner does what a core move does to the core here; nil is
	// NativeCore with Executable (coremove.go). CoreScan, when set, is the
	// machine-bound scan instead of the files it reads. MovePoll is how
	// often a move reads the lease (10s), MoveGrace how long after the
	// deadline the source starts again on its own data
	// (nodeproto.MoveRollbackGrace), MoveExportWait how long it waits for
	// the target's export once the target released the lease (15m).
	CoreRunner                          CoreRunner
	CoreScan                            func() []string
	MovePoll, MoveGrace, MoveExportWait time.Duration
	// SandboxSbx is the sbx binary of the FrIDE instances ("" for none;
	// `node run` sets what it finds); SandboxDriver, when set, runs sbx
	// instead (tests).
	SandboxSbx    string
	SandboxDriver sbxDriver
	// FrideInstancePoll is how often the agent reads the instances' state
	// to keep their FrIDEs running (DefaultFrideInstancePoll when zero).
	FrideInstancePoll time.Duration
	// Tailscale is the machine's, which the agent switches on when it is
	// off and the core out of reach for TailscaleGrace
	// (DefaultTailscaleGrace when zero); nil leaves it alone, as in a box
	// (tailscale.go). `node run` sets what it finds.
	Tailscale      Tailscale
	TailscaleGrace time.Duration
	// contains filtered or unexported fields
}

Agent is one node's connection to the core.

func Load

func Load(dir, version string) (*Agent, error)

Load makes the agent of the node in dir.

func (*Agent) Connected

func (a *Agent) Connected() bool

Connected reports whether the agent holds a connection to the core.

func (*Agent) ID

func (a *Agent) ID() string

ID is the node's device ID.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context) error

Run connects to the core and serves it until ctx ends, reconnecting with exponential backoff and jitter. It returns nil when ctx ends, and a *CloseError when the core revoked the node or does not know it, after which reconnecting is pointless.

func (*Agent) State

func (a *Agent) State() nodeproto.State

State is what the core last said the node may do.

type BoxConfig

type BoxConfig struct {
	// Hostname is the box's device name on the tailnet.
	Hostname string `json:"hostname"`
	// Fride is FrIDE's service on the box network, host:port (BoxFride);
	// "" for a box without FrIDE. The agent forwards FrIDE's port from
	// its loopback to it, and the webhook port from the box network to
	// its loopback, so that FrIDE's section in node.json keeps its
	// loopback addresses.
	Fride string `json:"fride,omitempty"`
}

BoxConfig is node.json's box section, set for a node in a box: a container of the fridolin-core image, which reaches the core over a tailnet device of its own (tsnet, its state in the state dir's tailnet folder) instead of the host's Tailscale.

func (*BoxConfig) Check

func (b *BoxConfig) Check() error

Check reports what is wrong with the section.

type BoxCore

type BoxCore struct {
	// Exe is the agent's binary; Entrypoint the image's entrypoint.sh,
	// which starts the core as the core container does ("" runs Exe).
	Exe, Entrypoint string
	// StateDir is the node's (/node), DataDir the box's data volume
	// (/data), which the core runs on.
	StateDir, DataDir string
	// Secrets is the box's sealed store (BoxSecretStore).
	Secrets hostsecrets.Store
	// Environ is the container's environment, which the core and the
	// commands get with the data dir and the host secrets added.
	Environ []string
	// ReadyURL is the core's /ready; http://127.0.0.1:8765/ready when "".
	ReadyURL string
	// Fride is FrIDE's service on the box network, host:port ("" for a
	// box without FrIDE): its address never reaches the published ports.
	Fride string
	// Ports are the published ports the agent forwards from the box's
	// network to the core on the loopback (BoxCorePorts; none when nil).
	Ports []int
	Logf  func(format string, args ...any)
	// Exec runs Exe with args and env, stdin when not nil, and returns
	// its standard output; nil runs it. Spawn starts the core; nil runs
	// Entrypoint. Tests hand in their own.
	Exec  func(ctx context.Context, env []string, stdin []byte, args ...string) ([]byte, error)
	Spawn func(env []string, args ...string) (BoxProcess, error)
	// StopWait is how long a stop waits for the core to end before it is
	// killed (30s when zero); RestartWait how long the supervisor waits
	// before it starts a core that ended by itself or did not start again
	// (10s).
	StopWait, RestartWait time.Duration
	// Probe checks that bubblewrap can make a brain's namespaces in this
	// container; nil runs it (BwrapProbe).
	Probe func(ctx context.Context) error
	// contains filtered or unexported fields
}

BoxCore is the CoreRunner of a box: every step runs the agent's own binary with a fixed `fridolin core` subcommand in this container, its arguments from typed, checked values only; the core itself runs as the agent's child (Supervise).

func (*BoxCore) Export

func (b *BoxCore) Export(ctx context.Context, move string) (nodeproto.CoreExportInfo, error)

func (*BoxCore) ExportFiles

func (b *BoxCore) ExportFiles(ctx context.Context) (string, map[string][]byte, error)

ExportFiles reads the secret files of the core's credentials folder, under the home of this container (the box's home volume).

func (*BoxCore) ForgetData

func (b *BoxCore) ForgetData(ctx context.Context) ([]string, error)

ForgetData empties the box's data volume (fridolin core forget-data, #266), which checks the lease itself; never while the core runs here.

func (*BoxCore) ForgetFiles

func (b *BoxCore) ForgetFiles(ctx context.Context, dir string, names []string) ([]string, error)

ForgetFiles removes the named secret files a move wrote into the box's home (fridolin core files forget, #266).

func (*BoxCore) Image

Image is the coreImage's business on a box: a box runs its image pinned by digest, which a box update changes.

func (*BoxCore) Import

func (b *BoxCore) Import(ctx context.Context) error

Import imports the latest export into the box's data volume, moving what is there aside (core import --force), while no core runs.

func (*BoxCore) ImportFiles

func (b *BoxCore) ImportFiles(ctx context.Context, dir string, files map[string][]byte) (stored, kept []string, err error)

ImportFiles writes them under the box's home, keeping any there.

func (*BoxCore) Promote

func (b *BoxCore) Promote(ctx context.Context) error

func (*BoxCore) Ready

func (b *BoxCore) Ready(ctx context.Context) (bool, string)

func (*BoxCore) Rehearse

func (b *BoxCore) Rehearse(ctx context.Context, move string) (nodeproto.CoreRehearsal, error)

Rehearse imports the latest export into a scratch data dir in the node's volume, with the rehearsal's settings, and removes it: never the box's data volume, never the lease.

func (*BoxCore) Release

func (b *BoxCore) Release(ctx context.Context) error

func (*BoxCore) Running

func (b *BoxCore) Running() bool

Running reports whether the core runs in this box.

func (*BoxCore) Start

func (b *BoxCore) Start(ctx context.Context) error

Start makes this box the core: the role first, so that a box that restarts on the way starts the core again, then the core itself.

func (*BoxCore) Status

func (b *BoxCore) Status(ctx context.Context) (nodeproto.CoreRuntime, error)

func (*BoxCore) Stop

func (b *BoxCore) Stop(ctx context.Context) error

Stop stands the box down: the role first, then the core, which releases the lease as it stops cleanly.

func (*BoxCore) Supervise

func (b *BoxCore) Supervise(ctx context.Context)

Supervise runs as long as the agent: it publishes the core's ports, starts the core when the box is the core, and stops it (keeping the role) when ctx ends, as a container stop would.

type BoxProcess

type BoxProcess interface {
	Signal(os.Signal) error
	Kill() error
	Wait() error
}

BoxProcess is the core's process in the box.

type BoxStatus

type BoxStatus struct {
	Connected bool      `json:"connected"`
	Version   string    `json:"version"`
	At        time.Time `json:"at"`
}

BoxStatus is BoxStatusFile.

type BoxUpdateRequest

type BoxUpdateRequest struct {
	nodeproto.BoxUpdateParams
	From        string    `json:"from"`
	RequestedAt time.Time `json:"requested_at"`
}

BoxUpdateRequest is BoxUpdateFile: the core's params and when and from which version they were asked for.

func ReadBoxUpdate

func ReadBoxUpdate(dir string) (*BoxUpdateRequest, error)

ReadBoxUpdate reads the box's pending request in dir; nil when there is none.

func TakeBoxUpdate

func TakeBoxUpdate(dir string) (*BoxUpdateRequest, error)

TakeBoxUpdate marks the pending request as being applied, so that the next round of the updater does not apply it again, and returns it; nil when none is pending. The agent may write a newer request at any time, which waits in BoxUpdateFile for the next round, so the updater checks and applies what this returns and never reads BoxUpdateFile again.

type CloseError

type CloseError struct {
	Reason, Message string
}

CloseError is the core closing the connection with a reason.

func (*CloseError) Error

func (e *CloseError) Error() string

func (*CloseError) Final

func (e *CloseError) Final() bool

Final reports whether the agent should stop reconnecting.

type Config

type Config struct {
	// Core is the core's node port, host:port (ws://host:port and
	// wss://host:port work too).
	Core string `json:"core"`
	Name string `json:"name"`
	// Capabilities is what the node declares; the core approves it.
	// FrIDE is not among them: the agent declares it while FrIDE answers.
	Capabilities nodeproto.Capabilities `json:"capabilities"`
	// Fride is FrIDE on this machine, paired with `fridolin node fride
	// pair`; nil for none.
	Fride *FrideConfig `json:"fride,omitempty"`
	// AndroidBuild false keeps the node from offering android-build where
	// it finds a JDK and the Android SDK; unset or true offers it then.
	AndroidBuild *bool `json:"android_build,omitempty"`
	// Update false keeps the node from offering update, so the core never
	// replaces its fridolin; unset or true offers it (update.go).
	Update *bool `json:"update,omitempty"`
	// Box is set for a node in a box (box.go); nil for a native node.
	Box *BoxConfig `json:"box,omitempty"`
	// Service names the service of a second node on this machine:
	// fridolin-node-<service>, ai.fridolin.node.<service> on macOS, run
	// from the state dir's own fridolin (OwnBinary). Empty: the machine's
	// node, fridolin-node.
	Service string `json:"service,omitempty"`
	// AgentMaxRuntime is how long an agent session may run in all, a Go
	// duration ("48h"); empty is DefaultAgentMaxRuntime (24h).
	AgentMaxRuntime string `json:"agent_max_runtime,omitempty"`
	// FrideHost tunes fride_host, which the agent declares once `fridolin
	// node fride host setup` ran (fride_instances.go); nil for defaults.
	FrideHost *FrideHostConfig `json:"fride_host,omitempty"`
}

Config is node.json.

func LoadConfig

func LoadConfig(dir string) (Config, error)

LoadConfig reads dir's node.json.

func (Config) Check

func (c Config) Check() error

Check reports what is wrong with the config.

type CoreForgetter

type CoreForgetter interface {
	// ForgetFiles removes the named secret files from dir (a folder
	// under ~) in the core's home (fridolin core files forget), and
	// returns those it removed as ~/dir/name; one not there is no error.
	// Local files ("local:gitlab.json") go from the core's data dir,
	// with dir "".
	ForgetFiles(ctx context.Context, dir string, names []string) ([]string, error)
	// ForgetData empties the core's data dir (fridolin core forget-data),
	// which refuses while a core runs on it or no other device's core
	// holds the lease, and returns the entries it removed.
	ForgetData(ctx context.Context) ([]string, error)
}

CoreForgetter is a CoreRunner that also removes what moves brought.

type CoreHostConfig

type CoreHostConfig struct {
	// Enabled is false once `fridolin node core-host off` ran here; a
	// machine without core-host.json is a core host.
	Enabled bool `json:"enabled"`
	// SendTo are the targets this machine encrypts host secrets to
	// (`fridolin node core-host trust ID --key KEY`).
	SendTo []CoreHostPin `json:"send_to,omitempty"`
}

CoreHostConfig is core-host.json.

func LoadCoreHost

func LoadCoreHost(dir string) (CoreHostConfig, error)

LoadCoreHost reads dir's core-host.json; a missing file is core-host on, with no pins.

func (CoreHostConfig) Check

func (c CoreHostConfig) Check() error

Check reports what is wrong with the settings.

func (CoreHostConfig) Hash

func (c CoreHostConfig) Hash() string

Hash is what the agent declares of the settings: the SHA-256 of their JSON as fridolin writes it.

func (CoreHostConfig) Pin

func (c CoreHostConfig) Pin(id string) (CoreHostPin, bool)

Pin is the pin of target id, if this machine trusts it.

type CoreHostPin

type CoreHostPin struct {
	ID string `json:"id"`
	// PublicKey is the device's ed25519 key, hex.
	PublicKey string    `json:"public_key"`
	Name      string    `json:"name,omitempty"`
	PinnedAt  time.Time `json:"pinned_at"`
}

CoreHostPin is one trusted target: its device id and key, as the target's `fridolin node core-host show` prints them.

func (CoreHostPin) Key

func (p CoreHostPin) Key() (ed25519.PublicKey, error)

Key is the pin's public key.

type CoreLeftovers

type CoreLeftovers struct {
	// Secrets, Files (~/dir/name) and DataMove (the move whose import
	// put the data dir into an empty one, "" for none) are what
	// forgetting would remove.
	Secrets  []string
	Files    []string
	DataMove string
	// OwnDataMove is the move that found the data dir holding the
	// machine's own data, which stays; Unrecorded is a move that
	// imported here before the record said whether it brought the data
	// dir (a version before #266).
	OwnDataMove string
	Unrecorded  bool
	// DataForgotten is when forgetting removed the data dir a move had
	// brought.
	DataForgotten time.Time
	// LastMove is the latest move on this machine, and Former whether the
	// core went away in it: this machine was its source and it is done,
	// or its target and the core did not stay.
	LastMove string
	Former   bool
}

CoreLeftovers is what moves left in a node's state dir, as `fridolin doctor --node` reports it: read from the record alone, without asking the core.

func ReadCoreLeftovers

func ReadCoreLeftovers(dir string) CoreLeftovers

ReadCoreLeftovers reads what moves left in state dir dir.

func (CoreLeftovers) Holds

func (l CoreLeftovers) Holds() bool

Holds reports whether forgetting would remove anything.

type CoreRunner

type CoreRunner interface {
	// Status reads this data dir's device id, the lease and the latest
	// export.
	Status(ctx context.Context) (nodeproto.CoreRuntime, error)
	// Stop stops the core cleanly (which releases the lease), Start
	// starts it.
	Stop(ctx context.Context) error
	Start(ctx context.Context) error
	// Export exports the data dir, tagged with move.
	Export(ctx context.Context, move string) (nodeproto.CoreExportInfo, error)
	// Import imports the latest export, moving a data dir with data in
	// it aside first.
	Import(ctx context.Context) error
	// Promote takes the lease for this data dir; Release frees it when
	// this data dir holds it.
	Promote(ctx context.Context) error
	Release(ctx context.Context) error
	// Ready reports whether the core here is ready: WhatsApp connected,
	// the lease held.
	Ready(ctx context.Context) (bool, string)
	// Rehearse imports the latest export into a scratch place, checks it
	// and removes it.
	Rehearse(ctx context.Context, move string) (nodeproto.CoreRehearsal, error)
	// Image makes sure the host can start image (by digest) of version,
	// pulling it unless checkOnly.
	Image(ctx context.Context, version, image string, checkOnly bool) (nodeproto.CoreImageResult, error)
}

type FrideConfig

type FrideConfig struct {
	// URL is FrIDE's loopback address, http://127.0.0.1:<port>.
	URL string `json:"url"`
	// Webhook is the loopback host:port the agent hears FrIDE's webhook
	// on; FrIDE was given http://<Webhook>/fride when it was paired.
	Webhook string `json:"webhook"`
	// Base is the folder fride.repo_clone and fride.repo_new add
	// repositories to: one of FrIDE's base folders, as an absolute path.
	// Empty: FrIDE's only base folder, read from its settings at each
	// call (with several, the call is refused until Base names one).
	Base string `json:"base,omitempty"`
}

FrideConfig is node.json's fride section, which `fridolin node fride pair` writes.

func (*FrideConfig) Check

func (f *FrideConfig) Check() error

Check reports what is wrong with the section.

type FrideError

type FrideError struct {
	Status  int
	Message string
}

FrideError is FrIDE's answer to a call that failed.

func (*FrideError) Error

func (e *FrideError) Error() string

type FrideHostConfig

type FrideHostConfig struct {
	// ReserveMB is the memory kept for the machine itself, which no
	// instance is started into (DefaultFrideReserveMB when 0).
	ReserveMB int `json:"reserve_mb,omitempty"`
}

FrideHostConfig is node.json's fride_host section.

func (*FrideHostConfig) Check

func (c *FrideHostConfig) Check() error

Check reports what is wrong with the section.

type FrideHostReport

type FrideHostReport struct {
	// Host is fride-host.json, nil before setup.
	Host *FrideHostState
	// Declared is what the agent declares now; nil when it does not.
	Declared *nodeproto.FrideHostCap
}

FrideHostReport is what `fridolin node fride host status` says.

func FrideHostStatus

func FrideHostStatus(ctx context.Context, dir, sbx string, secrets hostsecrets.Store) (FrideHostReport, error)

FrideHostStatus looks at fride_host on the node in dir with the sbx at sbx ("" for none) and FrIDE's Claude token in secrets (nil for none), as the agent would declare it.

type FrideHostSetupOptions

type FrideHostSetupOptions struct {
	// Dir is the node's state dir; the node must have joined.
	Dir string
	// Sbx, Docker and Git are the programs; Git "" needs FrideRepo.
	Sbx, Docker, Git string
	// Repo is a fridolin checkout: the template's Dockerfile, FrIDE's
	// pinned commit and the companion config.
	Repo string
	// FrideRepo is FrIDE's git URL ("": Repo's origin with fridolin
	// replaced by fride, on GitHub).
	FrideRepo string
	// DockerDisk is the size of a new sandbox's /var/lib/docker (""
	// DefaultFrideInstanceDockerDisk); Caches the host folder of the
	// instances' Go and npm caches, a folder of its own for each ("":
	// none).
	DockerDisk, Caches string
	// ReserveMB, when not 0, is the memory the node keeps for itself
	// (node.json's fride_host.reserve_mb).
	ReserveMB int
	// NoBuild builds no template: each start names the core's published
	// one, which sbx pulls (Docker, Git, Repo and FrideRepo are unused).
	NoBuild bool
	// Out gets what is done, for the person who runs it.
	Out io.Writer
	// contains filtered or unexported fields
}

FrideHostSetupOptions are what `fridolin node fride host setup` works with.

type FrideHostState

type FrideHostState struct {
	// Template is the sbx template instances are made from, which setup
	// built here: FrIDE at FrideCommit from FrideRepo, Claude Code and
	// ponytail. "" when FromCore.
	Template    string `json:"template"`
	FrideRepo   string `json:"fride_repo,omitempty"`
	FrideCommit string `json:"fride_commit,omitempty"`
	// FromCore says the node built no template (setup --no-build): each
	// start names the core's published one, which sbx pulls.
	FromCore bool `json:"template_from_core,omitempty"`
	// Companion is the FrIDE config a new instance starts from
	// (container/fride/companion.json); nil for the template's own
	// (/opt/fride/companion.json), which a template from the core has.
	Companion json.RawMessage `json:"companion,omitempty"`
	// DockerDisk is the size of a new sandbox's Docker disk, Caches the
	// host folder of the shared Go and npm caches ("" for none).
	DockerDisk string    `json:"docker_disk"`
	Caches     string    `json:"caches,omitempty"`
	SetUp      time.Time `json:"set_up,omitzero"`
}

FrideHostState is fride-host.json: what `fridolin node fride host setup` set up on the machine. The node offers fride_host while it is there.

func LoadFrideHost

func LoadFrideHost(dir string) (*FrideHostState, error)

LoadFrideHost reads fride-host.json; nil before setup.

type FrideInfo

type FrideInfo struct {
	Mode         string   `json:"mode"`
	Configured   bool     `json:"configured"`
	Repos        []string `json:"repos"`
	Profiles     []string `json:"profiles"`
	WebhookURL   string   `json:"webhook_url"`
	Orchestrator bool     `json:"orchestrator"`
	// GitIdentities says FrIDE takes git identities from its companion
	// (fride_identities.go).
	GitIdentities bool `json:"git_identities"`
}

FrideInfo is FrIDE's answer to GET /api/companion/info.

func PairFride

func PairFride(ctx context.Context, o FridePairOptions) (FrideInfo, error)

PairFride trades the code for FrIDE's companion token, gives FrIDE the webhook, and keeps both in the state dir: the token in fride.token (0600), the addresses in node.json. A running agent picks them up at its next check of FrIDE, and the token already when FrIDE refuses the old one.

func ProbeFride

func ProbeFride(ctx context.Context, base, token string) (FrideInfo, error)

ProbeFride asks the FrIDE at base whether it answers in companion mode with token.

type FrideInstanceIdentity

type FrideInstanceIdentity struct {
	ID    string `json:"id"`
	Kind  string `json:"kind"`
	Host  string `json:"host"`
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

FrideInstanceIdentity is a git identity an instance has: never its token.

type FrideInstanceOptions

type FrideInstanceOptions struct {
	// Dir is the node's state dir, Sbx the sbx program.
	Dir, Sbx string
	// Out gets what is done.
	Out io.Writer
	// contains filtered or unexported fields
}

FrideInstanceOptions are what `fridolin node fride instance` works with.

type FrideInstanceReport

type FrideInstanceReport struct {
	nodeproto.FrideInstance
	Sandbox     string
	Port        int
	WebhookPort int
	// Sbx is sbx's status of the sandbox, "" for none.
	Sbx string
	// Hosts are the git hosts it has tokens for.
	Hosts []string
}

FrideInstanceReport is one instance as `fridolin node fride instance ls` shows it.

func ListFrideInstances

func ListFrideInstances(ctx context.Context, o FrideInstanceOptions) ([]FrideInstanceReport, error)

ListFrideInstances reports the node's instances.

type FrideInstanceState

type FrideInstanceState struct {
	Name    string `json:"name"`
	Sandbox string `json:"sandbox"`
	// MemoryMB is the sandbox's memory, Template what it was made from.
	MemoryMB int    `json:"memory_mb"`
	Template string `json:"template"`
	// Port is FrIDE's, WebhookPort the one the node hears its news on.
	Port        int `json:"port"`
	WebhookPort int `json:"webhook_port"`
	// DockerDisk is the size of its Docker disk, Caches the host folder of
	// the shared caches ("" for none), both from the host's setup when the
	// sandbox was made.
	DockerDisk string `json:"docker_disk,omitempty"`
	Caches     string `json:"caches,omitempty"`
	// Run says the agent keeps FrIDE running (start sets it, stop clears
	// it).
	Run bool `json:"run"`
	// Repos are the git URLs the core asked for last.
	Repos []string `json:"repos,omitempty"`
	// Rules are the network rules the sandbox has (sbx policy allow).
	Rules []string `json:"rules,omitempty"`
	// Identities are the git identities FrIDE has, without their tokens;
	// Pushed is the fingerprint of what it took.
	Identities []FrideInstanceIdentity `json:"identities,omitempty"`
	Pushed     string                  `json:"pushed,omitempty"`
	// Problem says why the last start failed; "" when it did not. Notes
	// say what did not work in the last start that did (a repository that
	// did not clone, no Claude login), for as long as it runs.
	Problem string `json:"problem,omitempty"`
	Notes   string `json:"notes,omitempty"`
	// NoLogin says why its agents did not log in to Claude in the last
	// start that worked; "" when they did.
	NoLogin string `json:"no_login,omitempty"`
	// LentLogin says its agents logged in with the token the core lent in
	// the last start that worked, which holds while it runs, also after
	// the agent restarted.
	LentLogin bool      `json:"lent_login,omitempty"`
	Made      time.Time `json:"made,omitzero"`
	Started   time.Time `json:"started,omitzero"`
}

FrideInstanceState is instance.json: how the instance was made, and what the node gave it.

type FridePairOptions

type FridePairOptions struct {
	// Dir is the node's state dir; the node must have joined.
	Dir string
	// URL is FrIDE's loopback address.
	URL string
	// Code is the code of `fride pair-companion`.
	Code string
	// Webhook is the loopback host:port to hear FrIDE's webhook on; ""
	// keeps the one paired before, or picks a free port.
	Webhook string
	// Base is the folder new repositories go to (FrideConfig.Base); ""
	// keeps the one set before.
	Base string
}

FridePairOptions are what `fridolin node fride pair` was given.

type JoinOptions

type JoinOptions struct {
	// Dir is the node's state dir.
	Dir string
	// Core is the core's node port, host:port.
	Core string
	// Code is the single-use code of `fridolin nodes join-code`.
	Code         string
	Name         string
	Capabilities nodeproto.Capabilities
	// AndroidBuild is node.json's android_build: false keeps the node from
	// offering android-build where it finds a JDK and the Android SDK
	// (tests whose nodes must not depend on the machine's tools); nil
	// offers it then.
	AndroidBuild *bool
	// Box makes the node a node in a box; Dial is how it reaches the core
	// (nil: the host's network).
	Box     *BoxConfig
	Dial    func(ctx context.Context, network, addr string) (net.Conn, error)
	Version string
	Logf    func(string, ...any)
}

JoinOptions are what `fridolin node join` was given.

type Joined

type Joined struct {
	ID    string
	State nodeproto.State
}

Joined is what joining did.

func Join

func Join(ctx context.Context, o JoinOptions) (Joined, error)

Join makes the node a new device of the core: a new key, node.json, and one connection that hands the core the join code. The device then waits for the owner's approval on the core, which the agent (Run) hears. A node that has a key moves the old device's files aside first (rejoinAside).

type NativeCore

type NativeCore struct {
	Exe string
	// ReadyURL is the core's /ready; http://127.0.0.1:8765/ready when "".
	ReadyURL string
}

NativeCore runs the core of a native core host: the agent's own binary with a fixed `fridolin core` subcommand for each step, whose arguments come from typed, checked values only (a move id, an image by digest), never from the call. The agent runs as the owner (a launchd agent, a systemd user unit), so these reach the owner's Docker and secret store as `fridolin core` in a terminal would.

func (NativeCore) Export

func (NativeCore) ExportFiles

func (n NativeCore) ExportFiles(ctx context.Context) (string, map[string][]byte, error)

ExportFiles reads the secret files of the core's credentials folder through the core's container (fridolin core files export, #187).

func (NativeCore) ForgetData

func (n NativeCore) ForgetData(ctx context.Context) ([]string, error)

ForgetData empties the core's data dir through a one-off container on its volume (fridolin core forget-data, #266), which checks the lease itself.

func (NativeCore) ForgetFiles

func (n NativeCore) ForgetFiles(ctx context.Context, dir string, names []string) ([]string, error)

ForgetFiles removes the named secret files from dir through the core's container (fridolin core files forget, on stdin, #266).

func (NativeCore) Image

func (n NativeCore) Image(ctx context.Context, version, image string, checkOnly bool) (nodeproto.CoreImageResult, error)

func (NativeCore) Import

func (n NativeCore) Import(ctx context.Context) error

func (NativeCore) ImportFiles

func (n NativeCore) ImportFiles(ctx context.Context, dir string, files map[string][]byte) (stored, kept []string, err error)

ImportFiles writes them through the core's container (fridolin core files import, on stdin), keeping any that are there already.

func (NativeCore) Promote

func (n NativeCore) Promote(ctx context.Context) error

func (NativeCore) Ready

func (n NativeCore) Ready(ctx context.Context) (bool, string)

func (NativeCore) Rehearse

func (n NativeCore) Rehearse(ctx context.Context, move string) (nodeproto.CoreRehearsal, error)

func (NativeCore) Release

func (n NativeCore) Release(ctx context.Context) error

func (NativeCore) Start

func (n NativeCore) Start(ctx context.Context) error

func (NativeCore) Status

func (NativeCore) Stop

func (n NativeCore) Stop(ctx context.Context) error

type SecretFiler

type SecretFiler interface {
	// ExportFiles reads them, with the folder under ~ config names
	// (sandbox.credentials_dir; "" for none).
	ExportFiles(ctx context.Context) (dir string, files map[string][]byte, err error)
	// ImportFiles writes them into dir under the core's home, keeping
	// any there already.
	ImportFiles(ctx context.Context, dir string, files map[string][]byte) (stored, kept []string, err error)
}

CoreRunner is what core-host does to the core on this machine. Every method does one fixed thing; NativeCore runs the agent's own binary with a fixed `fridolin core` subcommand for each. SecretFiler is a CoreRunner that also moves the secret files of the core's credentials folder (sandbox.credentials_dir) with the host secrets.

type Tailscale

type Tailscale interface {
	// State is its backend state: Running, Stopped, NeedsLogin, …
	State(ctx context.Context) (string, error)
	// Up switches it on with the settings it has.
	Up(ctx context.Context) error
}

Tailscale is the machine's Tailscale as the node drives it.

func TailscaleCLI

func TailscaleCLI(path string, env []string) Tailscale

TailscaleCLI is the machine's Tailscale driven through its CLI at path (`node run` finds it), run with env (nil: the agent's own). The macOS app's binary is its CLI too, but started without a terminal, as a launchd agent is, it tries to open the app instead and answers "The Tailscale GUI failed to start"; TAILSCALE_BE_CLI=1 makes it the CLI (tailscaleCLIEnv), and other systems' tailscale ignores it.

Jump to

Keyboard shortcuts

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