web

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

ABOUTME: Embedded filesystem for spec builder templates and static assets. ABOUTME: Exports ContentFS for use by the unified server without runtime filesystem paths.

ABOUTME: Web handlers for agent swarm lifecycle: start, pause, resume, and status. ABOUTME: Serves HTMX partials for agent LED indicators and status panels.

ABOUTME: Web handlers for the kanban board: viewing, creating, editing, and deleting cards. ABOUTME: Serves HTMX partials that update the board in-place via swap targets.

ABOUTME: Web handlers for document view, activity transcript, chat, and mission ticker. ABOUTME: Serves HTMX partials for the content tabs and handles chat/answer form submissions.

ABOUTME: Web handlers for exporting specs as Markdown, YAML, and DOT files. ABOUTME: Serves both in-page artifact views and downloadable file attachments.

ABOUTME: Web handler for the undo operation on the kanban board. ABOUTME: Sends an Undo command and re-renders the board partial.

ABOUTME: Web handlers for spec listing, creation, import, and viewing. ABOUTME: Serves HTMX partials and full pages for the spec management UI.

ABOUTME: Template loading, rendering, and FuncMap for the mammoth spec builder web UI. ABOUTME: Provides TemplateRenderer that parses base + partials and renders named templates.

Index

Constants

This section is empty.

Variables

View Source
var ContentFS embed.FS

Functions

func Activity

func Activity(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Activity renders the activity partial with the full transcript.

func ActivityTranscript

func ActivityTranscript(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

ActivityTranscript renders only the transcript entries + question widget. Used as the SSE refresh target so chat input is preserved during live updates.

func AgentLEDs

func AgentLEDs(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

AgentLEDs renders the agent LED indicators for the command bar.

func AgentStatus

func AgentStatus(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

AgentStatus returns the current agent status as an HTMX partial.

func AnswerQuestion

func AnswerQuestion(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

AnswerQuestion handles a response to a pending question from the user.

func Artifacts

func Artifacts(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Artifacts renders the artifacts tab with all three export formats.

func Board

func Board(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Board renders the board partial showing all lanes and cards.

func Chat

func Chat(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Chat handles a free-text message from the human, appends it to the transcript, and returns the refreshed transcript partial.

func ChatPanel

func ChatPanel(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

ChatPanel renders the full-width Chat tab content.

func CreateCard

func CreateCard(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

CreateCard creates a new card from form data and returns the refreshed board.

func CreateCardForm

func CreateCardForm(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

CreateCardForm renders an empty card creation form.

func CreateSpec

func CreateSpec(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

CreateSpec creates a spec from form data and returns the spec_view partial.

func CreateSpecForm

func CreateSpecForm(renderer *TemplateRenderer) http.HandlerFunc

CreateSpecForm renders the create_spec_form partial.

func DeleteCard

func DeleteCard(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

DeleteCard deletes a card and returns empty content so HTMX removes the element.

func Diagram

func Diagram(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Diagram renders the diagram tab with a DOT graph visualization.

func Document

func Document(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Document renders the spec as a narrative document with markdown-rendered fields.

func EditCardForm

func EditCardForm(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

EditCardForm renders the card edit form pre-filled with existing card data.

func ExportDOT

func ExportDOT(state *server.AppState) http.HandlerFunc

ExportDOT serves the spec as a downloadable DOT graph file.

func ExportMarkdown

func ExportMarkdown(state *server.AppState) http.HandlerFunc

ExportMarkdown serves the spec as a downloadable Markdown file.

func ExportYAML

func ExportYAML(state *server.AppState) http.HandlerFunc

ExportYAML serves the spec as a downloadable YAML file.

func ImportSpec

func ImportSpec(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

ImportSpec handles spec import from pasted content. Stub for now.

func ImportSpecForm

func ImportSpecForm(renderer *TemplateRenderer) http.HandlerFunc

ImportSpecForm renders the import_spec_form partial.

func Index

func Index(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Index renders the full index.html page.

func PauseAgents

func PauseAgents(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

PauseAgents pauses the agent swarm and returns the agent_status partial.

func ProviderStatus

func ProviderStatus(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

ProviderStatus renders the provider status partial showing available LLM providers.

func Regenerate

func Regenerate(state *server.AppState) http.HandlerFunc

Regenerate exports all formats to disk and returns a confirmation HTML snippet.

func RenderMarkdown

func RenderMarkdown(input string) string

RenderMarkdown is an exported helper that converts markdown to HTML. Used by handlers that need pre-rendered HTML before template execution. The output is sanitized to remove script tags and dangerous URL schemes.

func ResumeAgents

func ResumeAgents(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

ResumeAgents resumes a paused agent swarm and returns the agent_status partial.

func SpecList

func SpecList(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

SpecList renders the spec_list partial with spec summaries.

func SpecView

func SpecView(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

SpecView renders the spec_view partial for a given spec.

func StartAgents

func StartAgents(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

StartAgents starts the agent swarm for a spec and returns the agent_status partial. Uses TryStartAgents for atomic check-and-set to prevent concurrent requests from creating duplicate orchestrators.

func Ticker

func Ticker(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Ticker renders the mission ticker with the last 10 transcript entries.

func Undo

func Undo(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

Undo reverts the last undoable operation and re-renders the board.

func UpdateCard

func UpdateCard(state *server.AppState, renderer *TemplateRenderer) http.HandlerFunc

UpdateCard updates an existing card and returns the single card partial.

Types

type ActivityData

type ActivityData struct {
	SpecID          string
	ContainerID     string
	Transcript      []TranscriptEntry
	PendingQuestion *QuestionData
}

ActivityData is the view-model for the activity partial.

type AgentLEDsData

type AgentLEDsData struct {
	SpecID  string
	Running bool
	Started bool
}

AgentLEDsData is the view-model for the agent_leds partial.

type AgentStatusData

type AgentStatusData struct {
	SpecID     string
	Running    bool
	Started    bool
	AgentCount int
}

AgentStatusData is the view-model for the agent_status partial.

type ArtifactsData

type ArtifactsData struct {
	SpecID          string
	MarkdownContent string
	YAMLContent     string
	DOTContent      string
}

ArtifactsData is the view-model for the artifacts tab partial.

type BoardData

type BoardData struct {
	SpecID string
	Lanes  []LaneData
}

BoardData is the view-model for the board partial.

type CardData

type CardData struct {
	SpecID    string
	CardID    string
	CardType  string
	Title     string
	Body      string
	BodyHTML  template.HTML
	Lane      string
	Order     float64
	CreatedBy string
	UpdatedAt string
}

CardData is the view-model for a single card in a template.

type CardFormData

type CardFormData struct {
	SpecID   string
	CardID   *string
	Title    string
	CardType string
	Body     string
	Lane     string
}

CardFormData is the view-model for the card creation/edit form.

type DiagramData

type DiagramData struct {
	SpecID     string
	DOTContent string
	Steps      []DiagramStep
}

DiagramData is the view-model for the diagram tab partial.

type DiagramStep

type DiagramStep struct {
	Index    int
	NodeID   string
	Label    string
	NodeType string
	Prompt   string
	Outgoing []DiagramStepEdge
}

DiagramStep is a per-node execution summary shown under the diagram graph.

type DiagramStepEdge

type DiagramStepEdge struct {
	To    string
	Label string
}

DiagramStepEdge represents one outgoing edge from a node in the step list.

type DocumentData

type DocumentData struct {
	SpecID              string
	Title               string
	OneLiner            string
	Goal                string
	GoalHTML            template.HTML
	Description         *string
	DescriptionHTML     *template.HTML
	Constraints         *string
	ConstraintsHTML     *template.HTML
	SuccessCriteria     *string
	SuccessCriteriaHTML *template.HTML
	Risks               *string
	RisksHTML           *template.HTML
	Notes               *string
	NotesHTML           *template.HTML
	Lanes               []LaneData
}

DocumentData is the view-model for the document partial.

type LaneData

type LaneData struct {
	Name  string
	Cards []CardData
}

LaneData groups cards by lane name for template rendering.

type ProviderInfoView

type ProviderInfoView struct {
	Name      string
	HasAPIKey bool
	Model     string
}

ProviderInfoView is the view-model for a single provider in the status partial.

type ProviderStatusData

type ProviderStatusData struct {
	DefaultProvider string
	DefaultModel    *string
	Providers       []ProviderInfoView
	AnyAvailable    bool
}

ProviderStatusData is the view-model for the provider_status partial.

type QuestionData

type QuestionData struct {
	Type        string // "boolean", "multiple_choice", "freeform"
	QuestionID  string
	Question    string
	Default     *bool
	Choices     []string
	AllowMulti  bool
	Placeholder string
}

QuestionData is the view-model for a pending question widget.

type SpecSummaryView

type SpecSummaryView struct {
	SpecID    string
	Title     string
	OneLiner  string
	UpdatedAt string
}

SpecSummaryView is the view-model for a spec in the list.

type SpecViewData

type SpecViewData struct {
	SpecID                string
	Title                 string
	OneLiner              string
	Goal                  string
	Lanes                 []LaneData
	ShowStartAgentsBanner bool
}

SpecViewData is the view-model for the full spec view partial.

type TemplateRenderer

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

TemplateRenderer loads and renders HTML templates for the web UI. Templates are parsed once at construction and reused for each request.

func NewTemplateRenderer

func NewTemplateRenderer(templatesDir string) (*TemplateRenderer, error)

NewTemplateRenderer parses all templates from the given directory. It expects a base.html layout and a partials/ subdirectory with partial templates.

func NewTemplateRendererFromFS

func NewTemplateRendererFromFS(fsys fs.FS) (*TemplateRenderer, error)

NewTemplateRendererFromFS parses all templates from an fs.FS, reading from the "templates/" subtree. This allows the unified server to use the embedded filesystem instead of runtime filesystem paths.

func (*TemplateRenderer) Render

func (r *TemplateRenderer) Render(w http.ResponseWriter, templateName string, data any)

Render executes a named template (full page) and writes the result to w. The template is rendered inside the base layout.

func (*TemplateRenderer) RenderPartial

func (r *TemplateRenderer) RenderPartial(w http.ResponseWriter, partialName string, data any)

RenderPartial executes a named partial template and writes the result to w. No base layout wrapping is applied.

type TranscriptEntry

type TranscriptEntry struct {
	Sender         string
	SenderLabel    string
	Initial        string
	IsHuman        bool
	IsStep         bool
	IsContinuation bool
	RoleClass      string
	Content        string
	ContentHTML    template.HTML
	Timestamp      string
}

TranscriptEntry is the view-model for a single transcript message.

Jump to

Keyboard shortcuts

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