Documentation
¶
Overview ¶
Package ui is the agentscope screen: a ViewModel that holds ALL state as go-widgets/mvvm primitives and never references a widget, and a View (scene.go) that builds toolkit widgets and binds them to it. Both are tagless, so a native `go test` covers them; the browser host is cmd/agentscope-web.
Index ¶
- Constants
- type Row
- type Scene
- func (s *Scene) Dirty() bool
- func (s *Scene) Draw(buf []byte)
- func (s *Scene) HandleChar(ch string) bool
- func (s *Scene) HandleClick(x, y int) bool
- func (s *Scene) HandleKeyDown(code string) bool
- func (s *Scene) HandleMove(x, y int) bool
- func (s *Scene) HandleRelease(x, y int) bool
- func (s *Scene) HandleScroll(x, y, delta int) bool
- func (s *Scene) VM() *ViewModel
- type ViewModel
Constants ¶
const ( // MaxGraphSessions is how many session clusters are drawn, newest first. MaxGraphSessions = 32 // MaxGraphAgents is how many sub-agent nodes a session cluster shows; the // rest are one "+N more" node. MaxGraphAgents = 3 // MaxGraphRepos is how many repositories the repositories cluster shows, // live leases first. MaxGraphRepos = 9 )
The GraphView lays every cluster out at the size of the largest one, so the number of members a cluster may have is what keeps the picture on one screen. These bounds are the screen's, not the collector's: the table and the detail pane list everything.
const ( SurfaceW = 1680 SurfaceH = 940 )
Surface is the canvas size. Fixed: the graph, the table and the detail pane each sit in a fixed box and scroll or clip inside it.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Row ¶
type Row struct {
ID string // session short id
State string
Repo string
Task string
Last string
Agent string // sub-agent count
}
Row is one line of the sessions table.
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
Scene is the View: the widgets, their layout, and the bindings to the ViewModel. It never assigns a widget's state field itself.
func (*Scene) HandleChar ¶
HandleChar routes a printable character to the focused widget.
func (*Scene) HandleClick ¶
HandleClick dispatches a click at surface (x, y) to the widget under it.
func (*Scene) HandleKeyDown ¶
HandleKeyDown routes a named key to the focused widget.
func (*Scene) HandleMove ¶
HandleMove routes pointer motion to the widget grabbed on press.
func (*Scene) HandleRelease ¶
HandleRelease routes a button release to the grabbed widget and drops it.
func (*Scene) HandleScroll ¶
HandleScroll routes a wheel scroll (Delta in rows, positive = down).
type ViewModel ¶
type ViewModel struct {
// Graph is what the GraphView shows; its Selected and Filter are the
// widget's own observables.
Graph *toolkit.GraphViewModel
// Query is the search entry's text. It dims the graph (Graph.Filter) and
// narrows the table.
Query *mvvm.Observable[string]
// Rows is the sessions table; TableSel is its selected row index.
Rows *mvvm.ObservableList[Row]
TableSel *mvvm.Observable[int]
// Detail is the detail pane: the selection's facts, or the anomalies when
// nothing is selected.
Detail *mvvm.ObservableList[string]
// Status is the one-line summary; Conn is the connection state.
Status *mvvm.Observable[string]
Conn *mvvm.Observable[string]
// contains filtered or unexported fields
}
ViewModel is the whole screen's state.
func NewViewModel ¶
func NewViewModel() *ViewModel
NewViewModel returns a ViewModel showing nothing yet.