Documentation
¶
Overview ¶
Package runfile manages JSON port files at ~/.ggcode/run/<sessionID>.json that allow external processes to discover and query running ggcode instances.
Each port file is keyed by session ID (not workspace), so multiple instances in the same workspace each get their own file. The port file contains the WebUI listen address, auth token, PID, session ID, and workspace.
External tools read these files, then query the WebUI's /api/status endpoint:
curl -H "Authorization: Bearer <token>" http://<addr>/api/status
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAddr ¶
FormatAddr is a convenience helper that joins host and port.
Types ¶
type PortFile ¶
type PortFile struct {
Addr string `json:"addr"` // WebUI listen address (e.g. "127.0.0.1:54321")
Token string `json:"token"` // Bearer auth token for WebUI API
PID int `json:"pid"` // OS process ID
SessionID string `json:"session_id"` // ggcode session ID
Workspace string `json:"workspace"` // working directory
Mode string `json:"mode"` // startup permission mode (supervised, auto, etc.)
}
PortFile is the JSON structure written to disk.
func Read ¶
Read reads and parses the port file for the given session ID. Returns an error if the file doesn't exist or is stale (PID not alive).
func ReadAll ¶
ReadAll reads all non-stale port files in ~/.ggcode/run/. Useful for listing all running instances.
func ReadForWorkspace ¶
ReadForWorkspace reads all non-stale port files matching the given workspace. Returns all instances running in that workspace.