Documentation
¶
Overview ¶
Package ui is Fort's interface module (backlog Phase 3): the event/command contract (AO-031), the live board (AO-032), the SSE live-feed transport (AO-033), the chat surface (AO-034), the gate inbox (AO-035), and the OpenClaw inbound channel (AO-036). It imports core; core never imports ui.
Contract summary (published for clients, incl. the iOS shell, AO-037):
GET /api/board -> Board (runs + waiting gates)
GET /api/runs/{id} -> RunDetail (run + nodes + events; replayable)
GET /api/gates -> []GateItem
POST /api/gate <- GateDecision -> ActionResult
POST /api/chat <- ChatRequest -> ChatResult
POST /api/openclaw <- OpenClawMessage-> ChatResult
GET /api/events[?since=N] -> text/event-stream of Event frames
Index ¶
- type ActionResult
- type BacklogItem
- type BacklogRequest
- type Board
- type BreakdownRequest
- type BreakdownResult
- type ChatRequest
- type ChatResult
- type Deps
- type Dispatcher
- type Event
- type FlowRunner
- type GateDecision
- type GateItem
- type MachineLister
- type MachineStatus
- type NodeSummary
- type OpenClawMessage
- type Planner
- type RunDetail
- type RunRef
- type RunResult
- type RunSummary
- type Server
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionResult ¶
type ActionResult struct {
State string `json:"state"`
PausedNode string `json:"paused_node,omitempty"`
}
ActionResult is a generic command result (gate decisions).
type BacklogItem ¶ added in v0.7.0
type BacklogItem struct {
ID string `json:"id"`
Title string `json:"title"`
Body string `json:"body,omitempty"`
Agent string `json:"agent,omitempty"`
Machine string `json:"machine,omitempty"`
Labels []string `json:"labels,omitempty"`
Source string `json:"source"` // "user" | "agent"
}
BacklogItem is a pending task queued on the board (spec 025).
type BacklogRequest ¶ added in v0.7.0
type BacklogRequest struct {
Title string `json:"title"`
Body string `json:"body,omitempty"`
Agent string `json:"agent,omitempty"`
Machine string `json:"machine,omitempty"`
Labels []string `json:"labels,omitempty"`
Source string `json:"source,omitempty"` // defaults to "user"
}
BacklogRequest is the command body for POST /api/backlog.
type Board ¶
type Board struct {
Runs []RunSummary `json:"runs"`
Gates []GateItem `json:"gates"`
}
Board is the live board payload.
type BreakdownRequest ¶ added in v0.8.0
type BreakdownRequest struct {
Text string `json:"text"`
Agent string `json:"agent,omitempty"`
Machine string `json:"machine,omitempty"`
}
BreakdownRequest is the command body for POST /api/breakdown.
type BreakdownResult ¶ added in v0.8.0
type BreakdownResult struct {
RunID string `json:"run_id"`
}
BreakdownResult is the response for POST /api/breakdown: the visible planner run's id. Sub-tasks appear in the backlog when that run completes.
type ChatRequest ¶
type ChatRequest struct {
Text string `json:"text"`
Agent string `json:"agent,omitempty"` // force a specific agent
Machine string `json:"machine,omitempty"` // pin a target host (spec 022)
}
ChatRequest is the command body for POST /api/chat.
type ChatResult ¶
type ChatResult struct {
Kind string `json:"kind"` // task | flow
RunID string `json:"run_id"`
Route string `json:"route,omitempty"` // agent, for task kind (execution plane)
Machine string `json:"machine,omitempty"` // resolved host (spec 022)
Queued bool `json:"queued,omitempty"` // true when only boarded (control-only)
FlowID string `json:"flow_id,omitempty"` // for flow kind
Paused string `json:"paused,omitempty"` // gate id if the flow paused
}
ChatResult is the response for chat/openclaw.
type Deps ¶
type Deps struct {
Dispatcher Dispatcher // required
Runner FlowRunner // nil in control-only mode
Store *store.Store // required
FlowIDs []string // available flow ids (for chat templates); empty in control-only
Machines MachineLister // nil in single-machine mode (spec 022)
Planner Planner // nil in control-only mode (spec 026)
}
Deps are the control-plane collaborators — ports only. With no Runner and a queue Dispatcher this serves a full control plane (board, chat, scheduler, gate inbox) that needs none of the deterministic execution components.
type Dispatcher ¶
Dispatcher accepts a task. With an execution plane it routes + dispatches; in control-only mode it simply boards the task (Queued=true).
type Event ¶
type Event struct {
ID int64 `json:"id"`
RunID string `json:"run_id"`
NodeID string `json:"node_id,omitempty"`
Type string `json:"type"`
Data string `json:"data,omitempty"`
Code int `json:"code,omitempty"`
Time string `json:"time"`
}
Event is the wire form of one append-only event-log row (the live-feed unit).
type FlowRunner ¶
type FlowRunner interface {
StartFlow(ctx context.Context, flowID, runID, payload string) (RunResult, error)
Approve(runID, nodeID, edit string) error
Reject(runID, nodeID string) error
ResumeFlow(ctx context.Context, flowID, runID string) (RunResult, error)
}
FlowRunner runs flows by id. It is nil in control-only mode (no DAG engine); chat "ship X" then degrades to a boarded task and gate actions return 409.
type GateDecision ¶
type GateDecision struct {
RunID string `json:"run_id"`
NodeID string `json:"node_id"`
Decision string `json:"decision"` // approve | reject
Edit string `json:"edit,omitempty"`
}
GateDecision is the command body for POST /api/gate.
type GateItem ¶
type GateItem struct {
RunID string `json:"run_id"`
NodeID string `json:"node_id"`
Input string `json:"input,omitempty"`
}
GateItem is a gate awaiting a human decision (the gate inbox).
type MachineLister ¶
type MachineLister interface {
Machines() []MachineStatus
}
MachineLister reports the machine roster + reachability for the control plane (GET /api/machines, spec 022). It is nil in single-machine mode, in which case the endpoint returns an empty roster. Implemented by package control.
type MachineStatus ¶
type MachineStatus struct {
Name string `json:"name"`
URL string `json:"url,omitempty"`
Agents []string `json:"agents"`
Local bool `json:"local"`
Reachable bool `json:"reachable"`
}
MachineStatus is one host in the roster (GET /api/machines, spec 022).
type NodeSummary ¶
type NodeSummary struct {
NodeID string `json:"node_id"`
Type string `json:"type"`
Status string `json:"status"`
Attempts int `json:"attempts,omitempty"`
}
NodeSummary is a node's state within a run.
type OpenClawMessage ¶
OpenClawMessage is an inbound OpenClaw message (AO-036).
type Planner ¶ added in v0.8.0
type Planner interface {
Breakdown(ctx context.Context, goal, agent, machine string) (runID string, err error)
}
Planner decomposes a goal into backlog sub-tasks by running a planner agent (spec 026). It is nil in control-only mode (planning needs an execution plane); the /api/breakdown endpoint 409s when it is nil. Breakdown returns the planner run's id immediately; the sub-tasks land in the backlog asynchronously when that run completes.
type RunDetail ¶
type RunDetail struct {
Run RunSummary `json:"run"`
Nodes []NodeSummary `json:"nodes"`
Events []Event `json:"events"`
}
RunDetail makes a run replayable from the event log.
type RunRef ¶
type RunRef struct {
RunID string `json:"run_id"`
Route string `json:"route,omitempty"` // agent, when an execution plane routed it
Machine string `json:"machine,omitempty"` // host it was placed on (spec 022)
Queued bool `json:"queued,omitempty"` // true when only boarded (no execution plane)
}
RunRef identifies the run a submitted task produced.
type RunResult ¶
type RunResult struct {
State string `json:"state"`
PausedNode string `json:"paused_node,omitempty"`
}
RunResult is a flow run's state after a Start/Resume.
type RunSummary ¶
type RunSummary struct {
ID string `json:"id"`
Title string `json:"title"`
Body string `json:"body,omitempty"`
Agent string `json:"agent"`
Status string `json:"status"`
Machine string `json:"machine,omitempty"` // host the run is placed on (spec 022)
FlowID string `json:"flow_id,omitempty"`
}
RunSummary is a board card.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the ui handlers.
func (*Server) HasExecution ¶
HasExecution reports whether an execution plane is wired (for diagnostics).
type Summary ¶
type Summary struct {
Total int `json:"total"`
Running int `json:"running"`
Queued int `json:"queued"`
Blocked int `json:"blocked"` // paused at a gate
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Execution bool `json:"execution"` // whether an execution plane is attached
Gates []GateItem `json:"gates"`
}
Summary is the glanceable control-plane snapshot for constrained surfaces (watch complication, CarPlay). Served at GET /api/summary.