api

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 17 Imported by: 0 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

Overview

Package api implements the AgentGraph REST API and web dashboard (PRD sections 60 and 29).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DashboardHandler

func DashboardHandler() http.Handler

DashboardHandler serves the embedded web dashboard and its vendored static assets (cytoscape, app.js) - no external CDN, works air-gapped.

Types

type AlertHub added in v0.5.0

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

AlertHub fans out runtime-detection alerts to SSE subscribers and keeps a bounded history for late joiners.

func NewAlertHub added in v0.5.0

func NewAlertHub() *AlertHub

NewAlertHub builds an empty hub.

func (*AlertHub) History added in v0.5.0

func (h *AlertHub) History() []rt.Alert

History returns a copy of the alert history.

func (*AlertHub) Publish added in v0.5.0

func (h *AlertHub) Publish(a rt.Alert)

Publish records an alert and broadcasts it to all subscribers.

func (*AlertHub) Subscribe added in v0.5.0

func (h *AlertHub) Subscribe() (chan rt.Alert, func(), bool)

Subscribe registers a subscriber channel; the returned func unsubscribes. Returns false when the subscriber cap is reached.

type Server

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

Server serves the REST API. Heavy analysis (path enumeration, blast radii) is computed once and cached; request handlers only read the cache. The remediation endpoint never mutates the served graph.

func NewServer

func NewServer(g *graph.Graph) *Server

NewServer builds the server for a graph.

func NewServerWithAlerts added in v0.5.0

func NewServerWithAlerts(g *graph.Graph, hub *AlertHub) *Server

NewServerWithAlerts builds the server with a runtime-detection alert hub (enables the /api/v1/alerts endpoints).

func NewServerWithOptions added in v0.5.1

func NewServerWithOptions(opts ServerOptions) *Server

NewServerWithOptions builds a configured server.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler (auth + rate limit enforced on /api/*).

type ServerOptions added in v0.5.1

type ServerOptions struct {
	Graph *graph.Graph
	// Hub is an optional alert hub enabling the /api/v1/alerts endpoints.
	Hub *AlertHub
	// Token enables bearer-token authentication when non-empty. Requests
	// must present it via "Authorization: Bearer <token>" or "?token=".
	Token string
}

ServerOptions configures the API server.

Jump to

Keyboard shortcuts

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