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
- Variables
- func CheckQuality(quality int) error
- func DefaultOutDir() (string, error)
- func DiagSnapshot(o DiagOpts) model.Snapshot
- func InsideGitTree(p string) (bool, error)
- func Names() []string
- func ParseSize(s string) (w, h int, err error)
- func ResolveFormat(format, out string) (string, error)
- func Snapshot(labColor, personalColor string) model.Snapshot
- func Usage(labColor, personalColor string) *model.Usage
- type DiagOpts
- type Env
- type GuardMode
- type Options
- type Result
- type Scenario
- type Step
- type WebM
Constants ¶
const ( // DiagnoseMin and DiagnoseMax bound the capture's duration: about three minutes. DiagnoseMin = 170 * time.Second DiagnoseMax = 190 * time.Second )
const ( MinSize = 320 MaxSize = 4096 )
Size bounds: a capture is a picture of a window, not an allocation attack.
const ( // WebMFPS is the nominal frame rate. Timestamps come from the scenario's own // holds; this only sizes the last frame's duration. WebMFPS = 25 // WebMCPUUsed is the encoder speed preset. WebMCPUUsed = 4 // DefaultQuality is the VP8 quantizer index held: 1 (best) to 63 (worst). DefaultQuality = 10 // MinQuality and MaxQuality bound the --quality flag: avkit's vp8enc takes // 1 to 63 (the bitstream's own quantizer index is 7 bits, RFC 6386 section 9.6). MinQuality, MaxQuality = 1, 63 )
The WebM encoder settings. CPUUsed 4 is avkit's slow, sharp preset (the default 5 costs about 5 dB), right for UI text; the frames are few and the encode is bounded by Quality, a constant quantizer, so the file size follows the content.
const ( FormatSVG = "svg" FormatWebM = "webm" )
Format names.
const DefaultSize = "1280x720"
DefaultSize is the captured window, in logical pixels.
Variables ¶
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 CheckQuality ¶ added in v0.15.1
CheckQuality refuses a quality outside 1 to 63 (0 is the default). Any size is taken: avkit's vp8enc pads the planes to whole macroblocks itself (v0.20.2).
func DefaultOutDir ¶
DefaultOutDir is the durable directory captures go to: under the user's config directory, never inside a repository.
func DiagSnapshot ¶ added in v0.16.0
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 InsideGitTree ¶
InsideGitTree reports whether p, or a directory above it, holds a .git.
func ResolveFormat ¶ added in v0.15.0
ResolveFormat settles the output format from --format and the --out path. An empty format is inferred from the extension (.svg or .webm) and is svg when the path has neither; a named format must not contradict a known extension.
Types ¶
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
}
DiagOpts picks the diagnostic situation of DiagSnapshot.
type Env ¶
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.
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.
type Step ¶
Step is one beat of a scenario: Do changes the view-model, then the screen is recorded and held for Hold.
type WebM ¶ added in v0.15.0
WebM is one rendered scenario as a video.
func RenderWebM ¶ added in v0.15.0
RenderWebM plays the scenario exactly as Render does and encodes the frames it recorded, rasterised, as a VP8 WebM. quality 0 means DefaultQuality.