web

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package web provides the HTTP server and SSE event streaming for the Arena web UI.

Package web provides the HTTP server and SSE event streaming for the Arena web UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadResultsIntoStore added in v1.3.25

func LoadResultsIntoStore(outDir string, store *statestore.ArenaStateStore) int

LoadResultsIntoStore loads existing JSON run results from outDir into the state store. Returns the number of results successfully loaded.

Types

type EventAdapter

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

EventAdapter subscribes to an events.Bus and fans out JSON-serialized events to registered SSE client channels.

func NewEventAdapter

func NewEventAdapter() *EventAdapter

NewEventAdapter creates a new EventAdapter.

func (*EventAdapter) HandleEvent

func (a *EventAdapter) HandleEvent(event *events.Event)

HandleEvent converts a runtime event to JSON and broadcasts to all clients.

func (*EventAdapter) Register

func (a *EventAdapter) Register() chan []byte

Register adds a new SSE client and returns its event channel.

func (*EventAdapter) Subscribe

func (a *EventAdapter) Subscribe(bus events.Bus)

Subscribe subscribes the adapter to an event bus.

func (*EventAdapter) Unregister

func (a *EventAdapter) Unregister(ch chan []byte)

Unregister removes an SSE client. The caller is responsible for draining or discarding the channel after unregistering.

type RunRequest

type RunRequest struct {
	Providers []string `json:"providers,omitempty"`
	Scenarios []string `json:"scenarios,omitempty"`
	Regions   []string `json:"regions,omitempty"`
}

RunRequest is the JSON body for POST /api/run.

type SSEEvent

type SSEEvent struct {
	Type           string      `json:"type"`
	Timestamp      time.Time   `json:"timestamp"`
	ExecutionID    string      `json:"executionId,omitempty"`
	ConversationID string      `json:"conversationId,omitempty"`
	Data           interface{} `json:"data,omitempty"`
}

SSEEvent is the JSON structure sent to SSE clients.

type Server

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

Server is the Arena web UI HTTP server.

func NewServer

func NewServer(adapter *EventAdapter, eng *engine.Engine, store *statestore.ArenaStateStore, outputDir string) *Server

NewServer creates a new web server. eng and store may be nil (for testing SSE in isolation). outputDir is the path to the results directory (for DELETE /api/results).

func (*Server) Handler

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

Handler returns the http.Handler for the server.

Jump to

Keyboard shortcuts

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