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

api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentDetails

type AgentDetails struct {
	AgentInfo
	CurrentAction  string `json:"current_action,omitempty"`
	LastActionTick int64  `json:"last_action_tick"`
	IsRunning      bool   `json:"is_running"`
	HasCrashed     bool   `json:"has_crashed"`
	CrashCount     int    `json:"crash_count"`
	Faction        string `json:"faction"`
}

AgentDetails extends AgentInfo with additional runtime information

type AgentInfo

type AgentInfo struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Role    string `json:"role"`
	Status  string `json:"status"`
	Empire  string `json:"empire,omitempty"`
	Faction string `json:"faction,omitempty"`
}

AgentInfo represents basic agent information

type Event

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

Event represents an SSE event

type Server

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

Server provides HTTP API for agent-server

func NewServer

func NewServer(manager *agent.Manager, port int) *Server

NewServer creates a new HTTP API server

func (*Server) GetStreamManager

func (s *Server) GetStreamManager() *StreamManager

GetStreamManager returns the stream manager (for integration with runners)

func (*Server) SetLLMClient added in v0.2.0

func (s *Server) SetLLMClient(client *llm.Client)

SetLLMClient sets the LLM client for model hot-swapping via the API.

func (*Server) Shutdown

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

Shutdown gracefully shuts down the HTTP server

func (*Server) Start

func (s *Server) Start() error

Start begins serving HTTP requests

type StreamManager

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

StreamManager manages Server-Sent Events subscriptions for agents

func NewStreamManager

func NewStreamManager() *StreamManager

NewStreamManager creates a new stream manager

func (*StreamManager) Publish

func (sm *StreamManager) Publish(agentID string, event Event)

Publish sends an event to all subscribers of an agent

func (*StreamManager) PublishToAll

func (sm *StreamManager) PublishToAll(event Event)

PublishToAll sends an event to all subscribers across all agents

func (*StreamManager) Subscribe

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

Subscribe creates a new subscription for an agent's events

func (*StreamManager) SubscriberCount

func (sm *StreamManager) SubscriberCount(agentID string) int

SubscriberCount returns the number of active subscribers for an agent

func (*StreamManager) Unsubscribe

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

Unsubscribe removes a subscription

Jump to

Keyboard shortcuts

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