demo

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: BSD-3-Clause Imports: 16 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 (
	MinSize = 320
	MaxSize = 4096
)

Size bounds: a capture is a picture of a window, not an allocation attack.

View Source
const DefaultSize = "1280x720"

DefaultSize is the captured window, in logical pixels.

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 DefaultOutDir

func DefaultOutDir() (string, error)

DefaultOutDir is the durable directory captures go to: under the user's config directory, never inside a repository.

func InsideGitTree

func InsideGitTree(p string) (bool, error)

InsideGitTree reports whether p, or a directory above it, holds a .git.

func Names

func Names() []string

Names are the scenarios, sorted.

func ParseSize

func ParseSize(s string) (w, h int, err error)

ParseSize reads "WIDTHxHEIGHT" within [MinSize, MaxSize].

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 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 Options

type Options struct {
	W, H int
}

Options tune Render. The zero value renders DefaultSize.

type Result

type Result struct {
	SVG      []byte
	Frames   int           // frames recorded, one per step
	Duration time.Duration // the loop length
	Stats    svg.Stats     // the assembly: slots, pictures, shared subtrees, sizes
	Raster   int           // elements that embed a PNG; 0 means fully vector
	Doc      *svg.Document // the assembly, whose Frame(i) is the still of slot i
	Texts    []string      // every distinct string drawn: the outlines hide them from a text scan
}

Result is one rendered scenario.

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.

Jump to

Keyboard shortcuts

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