Documentation
¶
Overview ¶
Package localrun is the machine-local registry of running gofastr apps. Every App writes one record when its listener binds and removes it when the server stops, so a tool on the same machine (the gofastr-runs example, an agent) can list what is running, where, and how to reach its MCP server, with no port scanning.
Records live in Dir, one owner-only JSON file per run. A run that dies without shutting down leaves its file behind; List drops a record whose pid is gone. Registration is best-effort: a run that cannot write its record serves anyway.
Index ¶
Constants ¶
View Source
const ( // EnvDir overrides the registry directory. EnvDir = "GOFASTR_RUNS_DIR" // EnvOff set to "off" (or 0/false/no) stops this process from // registering. Listing is unaffected. EnvOff = "GOFASTR_RUNS" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Record ¶
type Record struct {
Version int `json:"version"`
// ID names the record file: "<pid>-<8 hex>".
ID string `json:"id"`
Name string `json:"name"`
PID int `json:"pid"`
// URL is the base URL a local client dials: http://127.0.0.1:<port>
// for a wildcard bind.
URL string `json:"url"`
// MCPPath is the path the app serves MCP over HTTP on ("/mcp"),
// empty when it serves none. Under `gofastr dev` it answers on
// loopback with no credential; elsewhere the app's own auth
// applies.
MCPPath string `json:"mcp_path,omitempty"`
// MCPCommand, when set, is an argv that speaks stdio MCP to this
// run (battery/service sets `<exe> service mcp --state-dir <dir>`).
// An agent should prefer it over MCPPath: it carries its own
// credential.
MCPCommand []string `json:"mcp_command,omitempty"`
// Service is the battery/service Config.ID when the run is a
// service daemon or its dev run.
Service string `json:"service,omitempty"`
Dev bool `json:"dev,omitempty"`
Dir string `json:"dir,omitempty"`
Exe string `json:"exe,omitempty"`
Started time.Time `json:"started"`
}
Record is one running app.
Click to show internal directories.
Click to hide internal directories.