gateway

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message string `json:"message"`
	Type    string `json:"type"`
	Code    string `json:"code"`
}

APIError is a detailed error with type and code (OpenAI-compatible).

type AcceptedResponse

type AcceptedResponse struct {
	Status string `json:"status"`
}

AcceptedResponse indicates an async task was accepted.

type ChannelCheck

type ChannelCheck struct {
	Name      string `json:"name"`
	Connected bool   `json:"connected"`
}

ChannelCheck is one channel's connectivity report inside HealthResponse.

type ChannelStatusProvider

type ChannelStatusProvider interface {
	ChannelName() string
	IsConnected() bool
	Username() string
	PairedCount() int
}

ChannelStatusProvider reports whether a channel bot is connected.

type CronHistoryResponse

type CronHistoryResponse struct {
	Entries any  `json:"entries"`
	Total   int  `json:"total"`
	HasMore bool `json:"hasMore"`
}

CronHistoryResponse wraps paginated cron run history.

type CronJobResponse

type CronJobResponse struct {
	Job any `json:"job"`
}

CronJobResponse wraps a created/updated job.

type CronListResponse

type CronListResponse struct {
	Jobs any `json:"jobs"`
}

CronListResponse wraps the job list.

type Deliverer

type Deliverer = agentapi.Deliverer

Deliverer is an alias for agentapi.Deliverer.

type DetailedHealthResponse

type DetailedHealthResponse struct {
	Status     string      `json:"status"`
	Components any         `json:"components"`
	Tasks      TaskSummary `json:"tasks"`
}

DetailedHealthResponse is the response for /api/health/detail.

type ErrorResponse

type ErrorResponse struct {
	Error any `json:"error"`
}

ErrorResponse is the standard error envelope for all API error responses.

type HealthResponse

type HealthResponse struct {
	Status  string         `json:"status"`
	Version string         `json:"version"`
	Checks  map[string]any `json:"checks"`
}

HealthResponse is the structured health check result.

type LogBroadcaster

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

LogBroadcaster is a zapcore.WriteSyncer that fans log lines out to SSE clients. Slow clients that can't keep up have messages dropped (non-blocking send).

func NewLogBroadcaster

func NewLogBroadcaster() *LogBroadcaster

NewLogBroadcaster creates a new broadcaster.

func (*LogBroadcaster) Subscribe

func (lb *LogBroadcaster) Subscribe() chan string

Subscribe returns a buffered channel that receives log lines.

func (*LogBroadcaster) Sync

func (lb *LogBroadcaster) Sync() error

Sync implements zapcore.WriteSyncer (no-op).

func (*LogBroadcaster) Unsubscribe

func (lb *LogBroadcaster) Unsubscribe(ch chan string)

Unsubscribe removes a client channel and closes it.

func (*LogBroadcaster) Write

func (lb *LogBroadcaster) Write(p []byte) (int, error)

Write implements io.Writer (used as a zap WriteSyncer). Each call fans the log line out to all subscribed clients.

type ModelListResponse

type ModelListResponse struct {
	Object string `json:"object"`
	Data   any    `json:"data"`
}

ModelListResponse wraps a list of model objects.

type ModelResponse

type ModelResponse struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	Created int64  `json:"created"`
	OwnedBy string `json:"owned_by"`
}

ModelResponse describes a single model.

type OKResponse

type OKResponse struct {
	OK      bool   `json:"ok"`
	Enabled *bool  `json:"enabled,omitempty"`
	Result  string `json:"result,omitempty"`
}

OKResponse is the standard success envelope for mutation endpoints.

type Server

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

Server is the HTTP gateway.

func New

func New(logger *zap.SugaredLogger, cfg *config.Root, ag agent.PrimaryAgent, sessions *session.Manager, cronMgr *cron.Manager, taskMgr *taskqueue.Manager, tools []agent.Tool, logBroadcaster *LogBroadcaster) *Server

New creates the gateway server.

func (*Server) AddChannel

func (s *Server) AddChannel(c ChannelStatusProvider)

AddChannel registers a channel bot for status reporting in the control UI.

func (*Server) AddDeliverer

func (s *Server) AddDeliverer(d Deliverer)

AddDeliverer registers a channel deliverer for system event routing.

func (*Server) SetHealthTracker

func (s *Server) SetHealthTracker(t *health.Tracker)

SetHealthTracker registers the health state tracker for the detailed health endpoint.

func (*Server) SetSkillManager

func (s *Server) SetSkillManager(lister SkillLister, toggler SkillToggler)

SetSkillManager registers skill list/toggle callbacks for the dashboard.

func (*Server) SetSurfaces

func (s *Server) SetSurfaces(handler *surfaces.Handler, store *surfaces.Store)

SetSurfaces registers the surfaces handler and store for the dashboard.

func (*Server) SetVersion

func (s *Server) SetVersion(v string)

SetVersion sets the version string shown in the dashboard.

func (*Server) Start

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

Start begins listening (blocks until context cancelled or error).

type SkillInfo

type SkillInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Origin      string `json:"origin"`
	Enabled     bool   `json:"enabled"`
	Verified    bool   `json:"verified"`
}

SkillInfo is a minimal skill descriptor for the UI.

type SkillLister

type SkillLister func() []SkillInfo

SkillLister returns the current skill list for the dashboard.

type SkillToggler

type SkillToggler func(name string, enabled bool) bool

SkillToggler toggles a skill's enabled state. Returns true if found.

type TaskListResponse

type TaskListResponse struct {
	Tasks any `json:"tasks"`
}

TaskListResponse wraps the task list.

type TaskSummary

type TaskSummary struct {
	Running int `json:"running"`
	Pending int `json:"pending"`
}

TaskSummary reports the current task queue state.

type ToolInvokeResponse

type ToolInvokeResponse struct {
	OK     bool   `json:"ok"`
	Result string `json:"result"`
}

ToolInvokeResponse wraps a tool execution result.

type UsageAllResponse

type UsageAllResponse struct {
	Sessions  any `json:"sessions"`
	Aggregate any `json:"aggregate"`
}

UsageAllResponse is the aggregate usage response.

type UsageSessionResponse

type UsageSessionResponse struct {
	Session string `json:"session"`
	Usage   any    `json:"usage"`
	Calls   int    `json:"calls"`
}

UsageSessionResponse is a single-session usage response.

Jump to

Keyboard shortcuts

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