registry

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 11 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is used by tools to register with the status registry

func NewClient

func NewClient(registryURL, toolID string) *Client

NewClient creates a new registry client for a tool

func (*Client) Deregister

func (c *Client) Deregister() error

Deregister removes this tool from the registry

func (*Client) Heartbeat

func (c *Client) Heartbeat(status, action string) error

Heartbeat sends a heartbeat update to the registry

func (*Client) Register

func (c *Client) Register(reg ToolRegistration) error

Register registers this tool with the registry

func (*Client) StartHeartbeat

func (c *Client) StartHeartbeat(ctx context.Context, interval time.Duration, getStatus func() (status, action string))

StartHeartbeat begins sending periodic heartbeats

func (*Client) UpdateStatus

func (c *Client) UpdateStatus(status, action string) error

UpdateStatus sends a status update immediately

type Event

type Event struct {
	Type      string      `json:"type"`
	Data      interface{} `json:"data"`
	Timestamp time.Time   `json:"timestamp"`
}

Event represents an SSE event broadcast by the registry

type HeartbeatRequest

type HeartbeatRequest struct {
	Status        string `json:"status"`
	CurrentAction string `json:"current_action,omitempty"`
	Health        string `json:"health,omitempty"`
	Timestamp     string `json:"timestamp,omitempty"`
}

HeartbeatRequest is sent by tools to update their status

type RegistryServer

type RegistryServer struct {
	// contains filtered or unexported fields
}

RegistryServer manages tool registrations and status broadcasting

func NewServer

func NewServer(port int) *RegistryServer

NewServer creates a new status registry server

func (*RegistryServer) GetStreamManager

func (s *RegistryServer) GetStreamManager() *StreamManager

GetStreamManager returns the stream manager

func (*RegistryServer) GetTool

func (s *RegistryServer) GetTool(toolID string) (*ToolRegistration, bool)

GetTool returns a specific tool by ID

func (*RegistryServer) ListTools

func (s *RegistryServer) ListTools() []*ToolRegistration

ListTools returns all registered tools

func (*RegistryServer) Shutdown

func (s *RegistryServer) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server

func (*RegistryServer) Start

func (s *RegistryServer) Start() error

Start begins serving HTTP requests

func (*RegistryServer) StartCleanupTask

func (s *RegistryServer) StartCleanupTask(interval, timeout time.Duration)

StartCleanupTask begins periodic cleanup of inactive tools

type StreamManager

type StreamManager struct {
	// contains filtered or unexported fields
}

StreamManager manages Server-Sent Events subscriptions for status updates

func NewStreamManager

func NewStreamManager() *StreamManager

NewStreamManager creates a new stream manager

func (*StreamManager) Publish

func (sm *StreamManager) Publish(event Event)

Publish sends an event to all subscribers

func (*StreamManager) Subscribe

func (sm *StreamManager) Subscribe() <-chan Event

Subscribe creates a new subscription for status events

func (*StreamManager) SubscriberCount

func (sm *StreamManager) SubscriberCount() int

SubscriberCount returns the number of active subscribers

func (*StreamManager) Unsubscribe

func (sm *StreamManager) Unsubscribe(ch <-chan Event)

Unsubscribe removes a subscription

type ToolRegistration

type ToolRegistration struct {
	ToolID        string                 `json:"tool_id"`
	ToolType      ToolType               `json:"tool_type"`
	PID           int                    `json:"pid"`
	AgentID       string                 `json:"agent_id,omitempty"`
	AgentName     string                 `json:"agent_name,omitempty"`
	AgentRole     string                 `json:"agent_role,omitempty"`
	Status        string                 `json:"status"`
	CurrentAction string                 `json:"current_action,omitempty"`
	Capabilities  map[string]interface{} `json:"capabilities"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
	RegisteredAt  time.Time              `json:"registered_at"`
	LastHeartbeat time.Time              `json:"last_heartbeat"`
}

ToolRegistration represents a registered tool

type ToolType

type ToolType string

ToolType represents the type of tool registered

const (
	ToolTypeAgentServer  ToolType = "agent-server"
	ToolTypeAutoExplorer ToolType = "auto-explorer"
	ToolTypePlayAs       ToolType = "play-as"
)

type WatcherClient

type WatcherClient struct {
	// contains filtered or unexported fields
}

WatcherClient is used by the watcher to discover and monitor tools

func NewWatcherClient

func NewWatcherClient(registryURL string) *WatcherClient

NewWatcherClient creates a new client for watching tools

func (*WatcherClient) GetTool

func (c *WatcherClient) GetTool(toolID string) (*ToolRegistration, error)

GetTool retrieves details for a specific tool

func (*WatcherClient) ListTools

func (c *WatcherClient) ListTools() ([]*ToolRegistration, error)

ListTools returns all registered tools

func (*WatcherClient) Ping

func (c *WatcherClient) Ping() error

Ping checks if the registry is reachable

func (*WatcherClient) StreamStatus

func (c *WatcherClient) StreamStatus() (<-chan Event, error)

StreamStatus subscribes to SSE status updates for all tools

Jump to

Keyboard shortcuts

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