demo

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: BSD-3-Clause Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package demo renders the agentscope screen from a SYNTHETIC, deterministic scenario into one animated SVG, for demo videos and documentation.

The scenario drives the SAME view-model as the live screen (ui.ViewModel): a step applies a snapshot, switches a tab, picks a theme or a language, exactly as the browser or the server would. Nothing is drawn by hand and nothing is read from this machine: every account, plan, session and repository below is invented, and the clock is a constant, so the same scenario yields the same bytes on every run.

Index

Constants

View Source
const (
	// DiagnoseMin and DiagnoseMax bound the capture's duration: about three minutes
	// and a half (the sum of the holds is 3m17.25s with the tools and clones steps,
	// 3m09.75s before them, against the former ceiling of 3m10s).
	DiagnoseMin = 170 * time.Second
	DiagnoseMax = 200 * time.Second
)

Variables

View Source
var Epoch = time.Date(2030, 1, 15, 10, 0, 0, 0, time.UTC)

Epoch is the demo's fixed "now". Nothing in the output reads the real clock.

Functions

func DiagSnapshot added in v0.16.0

func DiagSnapshot(o DiagOpts) model.Snapshot

DiagSnapshot is the picture a diagnosis starts from, at Epoch: Snapshot's five sessions, changed so that every kind of trouble the screen can show is in it. Session 0 is near compaction (95 % of its window) and its reviewer sub-agent is hot; session 1 is hot; session 3 is idle for hours yet still holds a repository; session 5 has no transcript and holds a lease; four leases have expired; three anomalies are listed; the Acme Lab account is at 97 % of its week; one account's reading is stale and one is not counted.

func Names

func Names() []string

Names are the scenarios, sorted.

func Snapshot

func Snapshot(labColor, personalColor string) model.Snapshot

Snapshot is the invented picture of the agent network at Epoch: five sessions in two organisations, their sub-agents, leases and one tell.

func Usage

func Usage(labColor, personalColor string) *model.Usage

Usage is the Quota tab's data: two invented accounts. A non-empty colour is the one the owner gave that account.

Types

type BudgetMode added in v0.21.0

type BudgetMode int

BudgetMode says what the REST budget pane has to show.

const (
	// BudgetNone: the view has not been built yet (nil data).
	BudgetNone BudgetMode = iota
	// BudgetRunning: the budget is low and someone is spending it.
	BudgetRunning
	// BudgetUnread: no token file and an empty ledger: nothing is claimed.
	BudgetUnread
)

type CloneMode added in v0.25.0

type CloneMode int

CloneMode says what the clones pane has to show.

const (
	// CloneNone: the view has not been built yet (nil data).
	CloneNone CloneMode = iota
	// CloneTrouble: commits only on this disk, an orphan worktree, dirty and behind clones.
	CloneTrouble
)

type DiagOpts added in v0.16.0

type DiagOpts struct {
	LabColor, PersonalColor string
	PersonalAlias           string // "" keeps "Personal"
	QuotaErr                bool   // the quota API refused: the notes say so
	Guard                   GuardMode
	Budget                  BudgetMode
	Queues                  QueueMode
	Refusals                RefusalMode
	Tools                   ToolMode
	Clones                  CloneMode
}

DiagOpts picks the diagnostic situation of DiagSnapshot.

type Env

type Env struct {
	Scene *ui.Scene
	VM    *ui.ViewModel
}

Env is what a step may touch: the screen and its view-model, the only door the live UI has too.

type GuardMode added in v0.16.0

type GuardMode int

GuardMode says what the Guardrails tab has to show.

const (
	// GuardNone: the first pass has not ended (nil data).
	GuardNone GuardMode = iota
	// GuardMeasured: the ledger was read and gates refuse.
	GuardMeasured
	// GuardUnread: `recur` could not be read, so nothing is claimed about it.
	GuardUnread
)

type HTML added in v0.19.0

type HTML struct {
	*Result
	Bytes []byte
}

HTML is one rendered scenario as a self-contained player page: the same SVG, inlined, with play/pause, a seek bar and the keyboard controls.

func RenderHTML added in v0.19.0

func RenderHTML(name string, o Options) (*HTML, error)

RenderHTML renders the scenario and wraps its SVG in the player page of go-widgets/svg. The page chrome is in the language the capture was recorded in (read from the view-model), so diagnose is English and diagnose-fr French.

func WriteHTML added in v0.19.0

func WriteHTML(name, out string, o Options) (*HTML, error)

WriteHTML renders the scenario to out, refusing a path inside a git work tree.

type Options

type Options struct {
	W, H int
	// Zone is the location the drawn times are written in. nil means UTC, never
	// the machine's zone: a capture is the same bytes everywhere.
	Zone *time.Location
}

Options tune Render. The zero value renders capture.DefaultSize.

type QueueMode added in v0.22.0

type QueueMode int

QueueMode says what the lease queue pane has to show.

const (
	// QueueNone: the view has not been built yet (nil data).
	QueueNone QueueMode = iota
	// QueueWaiting: sessions wait behind an idle holder and a queue file is torn.
	QueueWaiting
)

type RefusalMode added in v0.23.0

type RefusalMode int

RefusalMode says what the refusals pane has to show.

const (
	// RefusalNone: the view has not been built yet (nil data).
	RefusalNone RefusalMode = iota
	// RefusalBurst: a session was refused three times by one gate, another once.
	RefusalBurst
)

type Result

type Result struct {
	*capture.Result
	LangSel []int // the view-model's language setting when each frame was recorded
}

Result is one rendered scenario: the recording, and what the view-model said about the language when each frame was taken.

func Render

func Render(name string, o Options) (*Result, error)

Render plays the scenario against a fresh Scene and view-model and assembles the recorded frames into one animated SVG. It is deterministic: no clock, no file and no network is read.

func Write

func Write(name, out string, o Options) (*Result, error)

Write renders the scenario and writes it to out, refusing a path inside a git work tree. The directory is created when missing.

type Scenario

type Scenario struct {
	Name, Title string
	Steps       func() []Step
}

Scenario is a named, ordered list of steps.

func Lookup

func Lookup(name string) (Scenario, error)

Lookup returns the scenario called name, or an error naming the valid ones.

type Step

type Step struct {
	Hold time.Duration
	Do   func(*Env)
}

Step is one beat of a scenario: Do changes the view-model, then the screen is recorded and held for Hold.

type ToolMode added in v0.24.0

type ToolMode int

ToolMode says what the tools pane has to show.

const (
	// ToolNone: the view has not been built yet (nil data).
	ToolNone ToolMode = iota
	// ToolTrouble: one tool unverified, one built from a working tree, one behind.
	ToolTrouble
)

type WebM added in v0.15.0

type WebM struct {
	*Result
	Bytes   []byte
	Quality int
}

WebM is one rendered scenario as a video.

func RenderWebM added in v0.15.0

func RenderWebM(name string, o Options, quality int) (*WebM, error)

RenderWebM plays the scenario exactly as Render does and encodes the frames it recorded, rasterised, as a VP8 WebM. quality 0 means webm.DefaultQuality.

func WriteWebM added in v0.15.0

func WriteWebM(name, out string, o Options, quality int) (*WebM, error)

WriteWebM renders the scenario to out, refusing a path inside a git work tree.

Jump to

Keyboard shortcuts

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