Documentation
¶
Overview ¶
Package script runs one walk-through three ways (docs/scripts.md):
- guide: on the owner's desk as an ADE guide, moved on by the owner (onboarding);
- demo: on its own, step after step, pointing as it goes, for a recording;
- test: without a page, checking what each step expects, and putting the desk back.
A script is a guide with two additions per step: do (look-only tool calls that drive the desk, as a reflex may) and expect (what the desk should show after). Because every desk action is a tool here, the same script drives the app in all three modes; a recorder only has to watch.
Index ¶
- func HoldFor(st Step) time.Duration
- type Call
- type Expect
- type Report
- type Script
- type Service
- func (s *Service) Close(context.Context) error
- func (s *Service) Delete(ctx context.Context, name string) error
- func (s *Service) Demo(ctx context.Context, name string) (Script, error)
- func (s *Service) Get(ctx context.Context, name string) (Script, error)
- func (s *Service) Guide(ctx context.Context, name string) (any, error)
- func (s *Service) List(ctx context.Context) ([]Script, error)
- func (s *Service) Mount(mux *http.ServeMux)
- func (s *Service) Run(ctx context.Context, name, mode string) (any, error)
- func (s *Service) Save(ctx context.Context, sc Script) error
- func (s *Service) Stop() bool
- func (s *Service) Test(ctx context.Context, name string) (Report, error)
- func (s *Service) Tools() []kernel.BoundTool
- type Step
- type StepResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Call ¶
type Call struct {
Tool string `json:"tool"`
Input json.RawMessage `json:"input,omitempty"`
}
Call is one tool call a step makes.
type Expect ¶
type Expect struct {
Focused string `json:"focused,omitempty"` // the view in front
Open []string `json:"open,omitempty"` // views with a window open
Closed []string `json:"closed,omitempty"` // views with none
Mode string `json:"mode,omitempty"`
Layout string `json:"layout,omitempty"`
// Tool calls a look-only tool; its answer, as text, must contain Contains.
Tool *Call `json:"tool,omitempty"`
Contains string `json:"contains,omitempty"`
}
Expect is what the desk should show after a step. Every field set must hold.
type Report ¶
type Report struct {
Script string `json:"script"`
Mode string `json:"mode"`
Status string `json:"status"` // running | passed | failed | done | stopped
Steps []StepResult `json:"steps,omitempty"`
}
Report is how a run went.
type Script ¶
type Script struct {
Name string `json:"name"`
About string `json:"about,omitempty"`
Steps []Step `json:"steps"`
Updated string `json:"updated,omitempty"`
}
Script is a named walk-through.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service keeps scripts and runs them.
func (*Service) Demo ¶
Demo runs a script on its own, step after step, in the background: each step's calls, then what it points at and says, held long enough to read. It announces each step (script.step) so a recorder can follow, and script.done at the end.
func (*Service) Guide ¶
Guide puts a script on the owner's desk as an ADE guide: the owner moves it on, and each step's calls run as it comes up. The first step's calls run before the guide starts, so what it points at is there.
func (*Service) Mount ¶
Mount serves the scripts for the page and for a recorder:
GET /api/scripts every script
GET /api/scripts/{name} one
POST /api/scripts/{name}/run {mode}: guide | demo | test
POST /api/scripts/stop stop the demo
type Step ¶
type Step struct {
Say string `json:"say"`
Point []json.RawMessage `json:"point,omitempty"` // ADE targets: {window|view, anchor?, label?}
Style string `json:"style,omitempty"` // highlight or spotlight
Await json.RawMessage `json:"await,omitempty"` // as an ADE guide step: {kind: ack|open|focus, view}
Hint string `json:"hint,omitempty"`
Do []Call `json:"do,omitempty"`
Expect *Expect `json:"expect,omitempty"`
// HoldMS is how long a demo shows the step; 0 is worked out from what it says.
HoldMS int `json:"hold_ms,omitempty"`
// Zoom asks a recorder or the page to move the camera in on what the step points at.
Zoom bool `json:"zoom,omitempty"`
}
Step is one step: what the owner is told, what is pointed at, what the step does first and what should hold after it.