protocol

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubjectRegistry     = "sekia.registry"
	SubjectConfigReload = "sekia.config.reload"
)

NATS subject constants and helpers.

Variables

This section is empty.

Functions

func SignCommand added in v0.0.8

func SignCommand(cmd *Command, secret string) error

SignCommand computes an HMAC-SHA256 signature for the command and sets cmd.Signature. If secret is empty, the command is left unsigned.

func SubjectCommands

func SubjectCommands(agentName string) string

func SubjectConfigReloadAgent added in v0.0.14

func SubjectConfigReloadAgent(agentName string) string

SubjectConfigReloadAgent returns the subject for a specific agent's config reload.

func SubjectEvents

func SubjectEvents(source string) string

func SubjectHeartbeat

func SubjectHeartbeat(agentName string) string

func VerifyCommand added in v0.0.8

func VerifyCommand(cmd *Command, secret string) bool

VerifyCommand checks the HMAC-SHA256 signature on a command. If secret is empty, verification is skipped (returns true). If the command has no signature but a secret is configured, returns false.

Types

type AgentInfo

type AgentInfo struct {
	Name            string    `json:"name"`
	Version         string    `json:"version"`
	Status          string    `json:"status"`
	Capabilities    []string  `json:"capabilities"`
	Commands        []string  `json:"commands"`
	RegisteredAt    time.Time `json:"registered_at"`
	LastHeartbeat   time.Time `json:"last_heartbeat"`
	EventsProcessed int64     `json:"events_processed"`
	Errors          int64     `json:"errors"`
}

AgentInfo is one entry in the GET /api/v1/agents response.

type AgentsResponse

type AgentsResponse struct {
	Agents []AgentInfo `json:"agents"`
}

AgentsResponse is returned by GET /api/v1/agents.

type Command added in v0.0.8

type Command struct {
	Command   string         `json:"command"`
	Payload   map[string]any `json:"payload"`
	Source    string         `json:"source"`
	Signature string         `json:"signature,omitempty"`
}

Command is the canonical command envelope published on sekia.commands.<agent>.

type ConfigReloadResponse added in v0.0.14

type ConfigReloadResponse struct {
	Status string `json:"status"`
	Target string `json:"target"`
}

ConfigReloadResponse is returned by POST /api/v1/config/reload.

type Event

type Event struct {
	ID        string         `json:"id"`
	Type      string         `json:"type"`
	Source    string         `json:"source"`
	Timestamp int64          `json:"timestamp"`
	Payload   map[string]any `json:"payload"`
}

Event is the canonical event envelope published on sekia.events.<source>.

func NewEvent

func NewEvent(eventType, source string, payload map[string]any) Event

NewEvent creates an Event with a generated ID and current timestamp.

type Heartbeat

type Heartbeat struct {
	Name            string    `json:"name"`
	Status          string    `json:"status"`
	LastEvent       time.Time `json:"last_event"`
	EventsProcessed int64     `json:"events_processed"`
	Errors          int64     `json:"errors"`
}

Heartbeat is published on sekia.heartbeat.<agent-name> every 30s.

type Registration

type Registration struct {
	Name         string         `json:"name"`
	Version      string         `json:"version"`
	Capabilities []string       `json:"capabilities"`
	Commands     []string       `json:"commands"`
	ConfigSchema map[string]any `json:"config_schema,omitempty"`
}

Registration is published on sekia.registry when an agent starts.

type StatusResponse

type StatusResponse struct {
	Status        string    `json:"status"`
	Uptime        string    `json:"uptime"`
	NATSRunning   bool      `json:"nats_running"`
	StartedAt     time.Time `json:"started_at"`
	AgentCount    int       `json:"agent_count"`
	WorkflowCount int       `json:"workflow_count"`
}

StatusResponse is returned by GET /api/v1/status.

type WorkflowInfo

type WorkflowInfo struct {
	Name     string    `json:"name"`
	FilePath string    `json:"file_path"`
	Handlers int       `json:"handlers"`
	Patterns []string  `json:"patterns"`
	LoadedAt time.Time `json:"loaded_at"`
	Events   int64     `json:"events"`
	Errors   int64     `json:"errors"`
}

WorkflowInfo is one entry in the GET /api/v1/workflows response.

type WorkflowsResponse

type WorkflowsResponse struct {
	Workflows []WorkflowInfo `json:"workflows"`
}

WorkflowsResponse is returned by GET /api/v1/workflows.

Jump to

Keyboard shortcuts

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