Help us shape the future of Go! Take the 2026 Go Developer Survey

instanceregistry

package
v0.610.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Announce

func Announce(entry *Entry) error

Announce writes the Entry to /tmp/pando-instances/<instanceID>.json. Call this on startup after determining ports and the primary/secondary role.

func Revoke

func Revoke(instanceID string) error

Revoke removes the instance's JSON file from /tmp/pando-instances/. Call this on shutdown. It is a no-op if the file does not exist.

Types

type Entry

type Entry struct {
	// InstanceID is a UUID that uniquely identifies this process.
	InstanceID string `json:"instance_id"`
	// Path is the canonical absolute path of the working directory.
	Path string `json:"path"`
	// PID is the operating system process ID.
	PID int `json:"pid"`
	// PubPort is the ZMQ PUB port used for broadcasting events.
	PubPort int `json:"pub_port"`
	// RPCPort is the ZMQ ROUTER/RPC port used for request-response communication.
	RPCPort int `json:"rpc_port"`
	// StartedAt is when this instance was started.
	StartedAt time.Time `json:"started_at"`
	// Mode identifies how the instance was launched.
	Mode Mode `json:"mode"`
	// IsPrimary is true if this instance holds the ipc.lock file.
	IsPrimary bool `json:"is_primary"`
}

Entry describes a running Pando instance. It is serialized as JSON and written to /tmp/pando-instances/<instanceID>.json on startup.

type Mode

type Mode string

Mode identifies how the instance was launched.

const (
	// ModeTUI identifies a terminal UI instance.
	ModeTUI Mode = "tui"
	// ModeWebUI identifies a web UI instance.
	ModeWebUI Mode = "webui"
	// ModeDesktop identifies a desktop (Wails) instance.
	ModeDesktop Mode = "desktop"
	// ModeACP identifies an ACP server instance.
	ModeACP Mode = "acp"
	// ModeNonInteractive identifies a non-interactive (script/pipe) instance.
	ModeNonInteractive Mode = "noninteractive"
	// ModeProxy identifies an LLM proxy server instance.
	ModeProxy Mode = "proxy"
)

type Registry

type Registry struct{}

Registry scans instancesDir for instance JSON files and provides methods to discover live Pando instances.

func New

func New() *Registry

New returns a new Registry.

func (*Registry) Get

func (r *Registry) Get(instanceID string) (*Entry, error)

Get returns the entry for the given instanceID, or nil if not found/alive.

func (*Registry) List

func (r *Registry) List() ([]*Entry, error)

List returns all live instances whose PID is still running. Stale entries (process no longer running) are pruned automatically.

func (*Registry) ListByPath

func (r *Registry) ListByPath(absPath string) ([]*Entry, error)

ListByPath returns live instances with the given working directory path.

Jump to

Keyboard shortcuts

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