ui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package ui serves the awf visual graph tool: a localhost HTTP server that renders a workflow's graph (via the Slice-1 graph package) and overlays run state. Slice 2a is read-only and request-driven (static graph + snapshot overlay); the live SSE overlay is Slice 2b.

Request flow:

GET /                     -> embedded SPA (ui/dist)
GET /api/runs             -> runs for the loaded workflow (digest-filtered)
GET /api/graph?run=<id>   -> graph.Projection (static, or static + snapshot overlay)

projectionFor is the single place a (workflow, run) becomes a Projection; Slice 2b's SSE watch loop will call it too.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(port int) (net.Listener, error)

Listen binds a TCP listener on 127.0.0.1 (loopback only -- no remote exposure, which is why the server needs no auth). port 0 picks an ephemeral port.

Types

type RunRow

type RunRow struct {
	RunID    string `json:"run_id"`
	Status   string `json:"status"`
	Workflow string `json:"workflow"`
	// VersionMatch is true when the run's recorded definition digest equals the digest of the
	// workflow file the UI was launched against — i.e. the run executed against the current
	// version. When false, the run is an earlier (or later) version of the same workflow; the
	// SPA badges it. The run still renders faithfully against its own snapshot.
	VersionMatch bool `json:"version_match"`
}

RunRow is one entry in GET /api/runs.

type Server

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

Server holds the immutable loaded workflow and an overlay cache. The workflow is loaded once at startup (editing the file requires a restart -- documented).

func New

func New(wf *ir.Workflow, digest, stateDir string) *Server

New builds a Server for an already-loaded workflow. digest is the workflow's content digest (used to filter /api/runs); stateDir is the runs/ base.

func NewLoaded

func NewLoaded(ld *ir.LoadedDefinition, digest, stateDir string) *Server

NewLoaded builds a Server for a loaded workflow definition, preserving imported workflow modules for graph projection under call sites.

func (*Server) Handler

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

Handler returns the HTTP routes. Exposed (not bound) so tests drive it via httptest.

Jump to

Keyboard shortcuts

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