Documentation
¶
Overview ¶
Package views holds the per-connection rolling state and stage view helpers used by the SSE renderer. PLAN-5 / C8.
Index ¶
Constants ¶
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 ¶
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 ¶
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 (*State) AwaitPending ¶
func (*State) Reset ¶
func (s *State) Reset()
Reset clears all stages and resets await state. Used on a fresh pipeline-init.
func (*State) SetAwaitPending ¶
SetAwaitPending records whether a decision-gate is currently open so a reconnect can render the correct decision-gate state.
func (*State) UpsertStage ¶
UpsertStage creates or updates a stage by slug.