views

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package views holds the per-connection rolling state and stage view helpers used by the SSE renderer. PLAN-5 / C8.

Index

Constants

View Source
const HookBufferCap = 20

HookBufferCap matches the spike behaviour: last 20 hook lines per stage so the per-stage details panel does not grow without bound. PLAN-5 / C8.

Variables

This section is empty.

Functions

func TruncateMid

func TruncateMid(s string, n int) string

TruncateMid keeps the first n/2 and last n/2 runes joined by `…`. PLAN-5 / C8 — hook envelopes can carry long `tool_input.command` values; truncate at render time so the activity feed stays narrow.

Types

type Stage

type Stage struct {
	Slug        string
	Name        string
	Status      string // running / done / failed / stopped / pending
	Duration    string
	Cost        string
	LastHook    string
	Hooks       []string // ring buffer of the last 20 hook lines (PLAN-5 / C8)
	StatusClass string
	Glyph       string
}

Stage is the typed input to the `stage-card` template. The SSE renderer fills the StatusClass / Glyph fields from Stage.Status.

func (*Stage) AppendHook

func (s *Stage) AppendHook(line string)

AppendHook pushes one hook line into Stage.Hooks, dropping the oldest if the buffer is full. Also updates LastHook.

func (*Stage) ApplyStatus

func (s *Stage) ApplyStatus()

ApplyStatus computes StatusClass + Glyph from Status. Pure: no access to broker state, easy to test.

type State

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

State is the broker-side view of pipeline progress. The broker updates it as ape publishes events; the SSE handler reads it on every new client connection to emit a fresh pipeline-init.

func NewState

func NewState() *State

func (*State) AwaitPending

func (s *State) AwaitPending() bool

func (*State) Reset

func (s *State) Reset()

Reset clears all stages and resets await state. Used on a fresh pipeline-init.

func (*State) SetAwaitPending

func (s *State) SetAwaitPending(b bool)

SetAwaitPending records whether a decision-gate is currently open so a reconnect can render the correct decision-gate state.

func (*State) Stages

func (s *State) Stages() []*Stage

Stages returns a snapshot in original order.

func (*State) UpsertStage

func (s *State) UpsertStage(slug string, fn func(*Stage))

UpsertStage creates or updates a stage by slug.

Jump to

Keyboard shortcuts

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