Documentation
¶
Index ¶
- type Client
- type Event
- type HeartbeatRequest
- type RegistryServer
- func (s *RegistryServer) GetStreamManager() *StreamManager
- func (s *RegistryServer) GetTool(toolID string) (*ToolRegistration, bool)
- func (s *RegistryServer) ListTools() []*ToolRegistration
- func (s *RegistryServer) Shutdown(ctx context.Context) error
- func (s *RegistryServer) Start() error
- func (s *RegistryServer) StartCleanupTask(interval, timeout time.Duration)
- type StreamManager
- type ToolRegistration
- type ToolType
- type WatcherClient
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 (*Client) Deregister ¶
Deregister removes this tool from 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 ¶
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 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