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 + checkpoints)
GET /api/summary -> Summary (counts + pending gates)
GET /api/runs/{id} -> RunDetail (run + nodes + events; replayable)
GET /api/gates -> []GateItem
GET /api/profiles -> []ProfileOption (closed agent/model choices)
POST /api/gate <- GateDecision -> 202 ActionResult + Location (reject may carry a note)
POST /api/chat <- ChatRequest -> 202 ChatResult + Location
GET /api/backlog -> []BacklogItem
POST /api/backlog <- BacklogRequest -> BacklogItem
PATCH /api/backlog/{id} <- BacklogPatch -> BacklogItem (reassign, spec 033)
POST /api/backlog/{id}/dispatch -> ChatResult
DELETE /api/backlog/{id}
POST /api/breakdown <- BreakdownRequest -> BreakdownResult
GET /api/metrics[?days=N&lane=L] -> MetricsResponse (spec 033)
GET /api/playbooks -> []Playbook (latest immutable revisions)
PUT /api/playbooks <- Playbook -> Playbook (new revision)
POST /api/playbooks/{id}/duplicate -> Playbook
POST /api/route <- RouteRequest -> RoutePreview (pure; spec 036)
POST /api/openclaw <- OpenClawMessage-> ChatResult
GET /api/events[?since=N] -> text/event-stream of Event frames
Index ¶
- type AcceptedDispatcher
- type AcceptedFlowRunner
- type AcceptedPlaybookRunner
- type ActionResult
- type AgentChannelDetail
- type AgentChannelPort
- type AgentChannelSummary
- type AgentChannelsMode
- type AgentConversationDetail
- type AgentFirstTurnResult
- type AgentMetrics
- type AgentNeedsYouItem
- type AgentOption
- type BacklogItem
- type BacklogPatch
- type BacklogRequest
- type Board
- type BreakdownRequest
- type BreakdownResult
- type CapabilitiesResponse
- type CapabilityLister
- type ChatRequest
- type ChatResult
- type CheckpointSummary
- type ConversationDetail
- type ConversationPort
- type ConversationSeatRechecker
- type Deps
- type Dispatcher
- type Event
- type FlowNode
- type FlowRunner
- type GateDecision
- type GateItem
- type MachineLister
- type MachineStatus
- type MetricsResponse
- type NodeSummary
- type OccurrencePage
- type OpenClawMessage
- type Planner
- type Playbook
- type PlaybookAssignment
- type PlaybookCatalog
- type PlaybookRunResult
- type PlaybookRunner
- type PlaybookStage
- type PlaybookTrigger
- type PrimaryAgentOption
- type PrimaryAgentView
- type PrimaryChannelDetail
- type PrimaryChannelPort
- type PrimaryChannelReadiness
- type PrimaryChannelsMode
- type PrimaryNeedsYouItem
- type ProductMode
- type ProfileOption
- type RelatedChannel
- type ResolvedPlaybookStage
- type RoutePreview
- type RouteRequest
- type RunDetail
- type RunRef
- type RunResult
- type RunSummary
- type ScheduleDetail
- type ScheduleFilter
- type ScheduleInventory
- type ScheduleInventoryItem
- type ScheduleInventoryPort
- type ScheduleInventoryState
- type ScheduleItem
- type ScheduleList
- type SchedulePort
- type ScheduleReadPort
- type SchedulerOwnership
- type Server
- func (s *Server) HasExecution() bool
- func (s *Server) Register(mux *http.ServeMux)
- func (s *Server) RegisterAgentChannelRoutes(mux *http.ServeMux)
- func (s *Server) RegisterMode(mux *http.ServeMux, mode PrimaryChannelsMode) error
- func (s *Server) RegisterNativeProductRoutes(mux *http.ServeMux, mode ProductMode) error
- func (s *Server) RegisterNativeRelayRoutes(mux *http.ServeMux, mode PrimaryChannelsMode) error
- func (s *Server) RegisterPrimaryRoutes(mux *http.ServeMux)
- func (s *Server) RegisterProductMode(mux *http.ServeMux, mode ProductMode) error
- func (s *Server) RegisterScheduleReadRoutes(mux *http.ServeMux)
- func (s *Server) Run(ctx context.Context, addr string) error
- type Summary
- type TodayPort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptedDispatcher ¶ added in v0.13.0
AcceptedDispatcher durably boards a routed run before provider startup and returns without waiting for Dispatch. HTTP handlers prefer this optional seam so slow provider preflight cannot hold a gateway request open.
type AcceptedFlowRunner ¶ added in v0.13.0
type AcceptedFlowRunner interface {
StartFlowAsync(ctx context.Context, flowID, runID, payload string) (RunResult, error)
ResumeFlowAsync(ctx context.Context, flowID, runID string) error
}
AcceptedFlowRunner is the asynchronous HTTP seam for flows. Start persists the run before returning; Resume validates the existing run before scheduling exactly one detached continuation.
type AcceptedPlaybookRunner ¶ added in v0.13.0
type AcceptedPlaybookRunner interface {
StartPlaybookAsync(ctx context.Context, route RoutePreview, runID, direction string) (PlaybookRunResult, error)
}
AcceptedPlaybookRunner persists the exact immutable playbook run and returns its canonical flow identity before any provider stage completes.
type ActionResult ¶
type ActionResult struct {
State string `json:"state"`
PausedNode string `json:"paused_node,omitempty"`
}
ActionResult is a generic command result (gate decisions).
type AgentChannelDetail ¶ added in v1.0.4
type AgentChannelDetail = AgentChannelSummary
type AgentChannelPort ¶ added in v1.0.4
type AgentChannelPort interface {
AgentOptions(context.Context) ([]AgentOption, error)
RecheckAgentOptions(context.Context) ([]AgentOption, error)
ListAgentChannels(context.Context, string) ([]AgentChannelSummary, error)
GetAgentChannel(context.Context, string) (AgentChannelDetail, error)
CreateAgentChannel(context.Context, string, string) (AgentChannelDetail, error)
RenameAgentChannel(context.Context, string, string) error
SetAgentChannelState(context.Context, string, conversation.AgentChannelState) error
ListAgentConversations(context.Context, string, string) ([]conversation.AgentConversationSummary, error)
GetAgentConversation(context.Context, string, string) (AgentConversationDetail, error)
CreateAgentConversation(context.Context, string, string) (AgentConversationDetail, error)
RenameAgentConversation(context.Context, string, string, string) error
SetAgentConversationState(context.Context, string, string, conversation.ConversationState) error
SetAgentConversationPinned(context.Context, string, string, bool) error
PostFirstAgentTurn(context.Context, string, string, string, string) (AgentFirstTurnResult, error)
PostAgentTurn(context.Context, string, string, string, string) (conversation.TurnResult, error)
RetryAgentTarget(context.Context, string, string, string) (conversation.Target, error)
CancelAgentTarget(context.Context, string, string, string) error
AgentNeedsYou(context.Context) ([]AgentNeedsYouItem, error)
}
AgentChannelPort is the new agent-first product seam. The legacy PrimaryChannelPort remains unchanged for rollback and older clients.
type AgentChannelSummary ¶ added in v1.0.4
type AgentChannelSummary struct {
Channel conversation.AgentChannel `json:"channel"`
Conversations []conversation.AgentConversationSummary `json:"conversations"`
Readiness PrimaryChannelReadiness `json:"readiness"`
}
AgentChannelSummary is sufficient for the agent-first rail: one immutable agent destination plus its pinned/recent Conversation shortcuts and current observational readiness. The conversations remain separate transcripts.
type AgentChannelsMode ¶ added in v1.0.4
type AgentChannelsMode string
const ( AgentChannelsOff AgentChannelsMode = "off" AgentChannelsPrimary AgentChannelsMode = "primary" )
type AgentConversationDetail ¶ added in v1.0.4
type AgentConversationDetail struct {
ChannelID string `json:"agent_channel_id"`
Conversation conversation.Conversation `json:"conversation"`
Participant conversation.Participant `json:"participant"`
Messages []conversation.Message `json:"messages"`
Turns []conversation.Turn `json:"turns"`
Targets []conversation.Target `json:"targets"`
Readiness PrimaryChannelReadiness `json:"readiness"`
Binding conversation.AgentBinding `json:"binding"`
Pinned bool `json:"pinned"`
PinnedAt time.Time `json:"pinned_at,omitempty"`
}
AgentConversationDetail is the canonical transcript projection beneath one owning Agent Channel. Parent-qualified service methods prevent a client from using a valid Conversation through the wrong agent identity.
type AgentFirstTurnResult ¶ added in v1.0.4
type AgentFirstTurnResult struct {
Conversation AgentConversationDetail `json:"conversation"`
Turn conversation.Turn `json:"turn"`
Targets []conversation.Target `json:"targets"`
}
type AgentMetrics ¶ added in v0.11.0
type AgentMetrics struct {
Agent string `json:"agent"`
Assignments int `json:"assignments"` // routed runs + flow task-node executions
Decided int `json:"decided"` // sign-offs that reached a decision
FirstPass int `json:"first_pass"` // approved first try, no note
FirstPassPct float64 `json:"first_pass_pct"` // 0 when Decided==0
Accepted int `json:"accepted"` // finally-approved sign-offs
Redirects int `json:"redirects"` // rejects + approves-with-edits
RedirectsPer float64 `json:"redirects_per_assignment"` // 0 when Assignments==0
CostUSD float64 `json:"cost_usd"` // parsed engine cost; 0 = unknown
CostPerAccept float64 `json:"cost_per_accepted"` // 0 = unknown
CostKnown bool `json:"cost_known"`
Trend string `json:"trend"` // improving | steady | slipping
TrendDelta float64 `json:"trend_delta"` // pct-point change between window halves
Spark []float64 `json:"spark"` // 7 first-pass-% buckets, carried forward
Best []string `json:"best"` // strongest routing lanes (≥3 terminal runs)
Weak []string `json:"weak"`
}
AgentMetrics is one agent's scorecard over the metrics window (spec 033). Everything is derived from the append-only event log + run rows — sign-off counts are human decisions, never agent estimates. Sample sizes (Assignments, Decided) ship alongside every ratio because 30-day windows are small.
type AgentNeedsYouItem ¶ added in v1.0.4
type AgentNeedsYouItem struct {
AgentChannel conversation.AgentChannel `json:"agent_channel"`
Conversation conversation.Conversation `json:"conversation"`
Target conversation.Target `json:"target"`
Actions []string `json:"recovery_actions"`
}
type AgentOption ¶ added in v1.0.4
type AgentOption struct {
ID string `json:"agent_option_id"`
State string `json:"state"`
Reason string `json:"reason,omitempty"`
DisplayName string `json:"display_name"`
Binding conversation.AgentBinding `json:"binding"`
}
AgentOption is one provider-neutral, server-resolved option for creating an Agent Channel. Clients submit only ID; Binding is inspectable evidence and cannot be reconstructed from independently selected fields.
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 BacklogPatch ¶ added in v0.11.0
type BacklogPatch struct {
Agent string `json:"agent"`
}
BacklogPatch is the command body for PATCH /api/backlog/{id} (spec 033): reassign an Up-next item to another agent ("" clears the pin).
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 CapabilitiesResponse ¶ added in v0.13.0
type CapabilitiesResponse struct {
Generation uint64 `json:"generation"`
Snapshot corecap.Snapshot `json:"snapshot"`
}
CapabilitiesResponse is the current capability inventory generation. The snapshot contains only the closed public projection defined by spec 039.
type CapabilityLister ¶ added in v0.13.0
CapabilityLister returns the latest immutable, secret-free capability snapshot. Refresh and probing stay behind control/exec adapters.
type ChatRequest ¶
type ChatRequest struct {
Text string `json:"text"`
Agent string `json:"agent,omitempty"` // force a specific agent
Profile string `json:"profile,omitempty"` // exact Fort-owned execution profile
Machine string `json:"machine,omitempty"` // pin a target host (spec 022)
PlaybookID string `json:"playbook_id,omitempty"` // exact route override (spec 036)
PlaybookRevision int `json:"playbook_revision,omitempty"` // immutable preview revision
TaskType string `json:"task_type,omitempty"` // explicit deterministic signal
PlanGate *bool `json:"plan_gate,omitempty"` // per-handoff plan-gate override
}
ChatRequest is the command body for POST /api/chat.
type ChatResult ¶
type ChatResult struct {
Kind string `json:"kind"` // task | flow | answer
RunID string `json:"run_id"`
Accepted bool `json:"accepted,omitempty"` // true when work was durably accepted for asynchronous execution
Delivery string `json:"delivery,omitempty"` // assignment | answer for accepted chat work
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/playbook kind
Paused string `json:"paused,omitempty"` // gate id if the flow paused
Answer string `json:"answer,omitempty"` // inline Quick answer delivery
PlaybookID string `json:"playbook_id,omitempty"` // executed immutable route
PlaybookRevision int `json:"playbook_revision,omitempty"`
}
ChatResult is the response for chat/openclaw. Production chat accepts durable work with HTTP 202 and a Location pointing at this run; terminal output and errors arrive through run detail/events. Legacy synchronous adapters may still include Paused or Answer in an HTTP 200 response.
type CheckpointSummary ¶ added in v0.11.0
type CheckpointSummary struct {
Total int `json:"total"` // gate nodes in the plan (executed-only when no plan is known)
Accepted int `json:"accepted"` // approved gates
Waiting int `json:"waiting"` // gates awaiting sign-off
Rejected int `json:"rejected"` // rejected gates
Done int `json:"done"` // non-gate nodes finished (for in-progress inference)
}
CheckpointSummary is a run's human-checkpoint progress: checkpoints are the flow's gate nodes — progress is what the human accepted, never an agent estimate (spec 033).
type ConversationDetail ¶ added in v1.0.4
type ConversationDetail struct {
Conversation conversation.Conversation `json:"conversation"`
Participants []conversation.Participant `json:"participants"`
Messages []conversation.Message `json:"messages"`
Turns []conversation.Turn `json:"turns"`
Targets []conversation.Target `json:"targets"`
}
ConversationDetail is the bounded conversation wire projection. Persistence aggregates are adapted to this type by package control before reaching ui.
type ConversationPort ¶ added in v0.13.0
type ConversationPort interface {
ConversationSeats(context.Context) ([]conversation.Seat, error)
ListProjects(context.Context) ([]conversation.Project, error)
CreateProject(context.Context, string) (conversation.Project, error)
RenameProject(context.Context, string, string) error
DeleteProject(context.Context, string) error
ListConversations(context.Context, string) ([]conversation.Conversation, error)
GetConversation(context.Context, string) (ConversationDetail, error)
CreateConversation(context.Context, string, string, []string) (ConversationDetail, error)
AddConversationParticipant(context.Context, string, string) (conversation.Participant, error)
MoveConversation(context.Context, string, string) error
RenameConversation(context.Context, string, string) error
SetConversationState(context.Context, string, conversation.ConversationState) error
DeleteConversation(context.Context, string) error
RemoveConversationParticipant(context.Context, string, string) error
PostTurn(context.Context, string, string, string, []string) (conversation.TurnResult, error)
RetryTarget(context.Context, string) (conversation.Target, error)
CancelTarget(context.Context, string) error
}
type ConversationSeatRechecker ¶ added in v1.0.4
ConversationSeatRechecker runs the already-bounded functional probes used to project shared-conversation seats. It must not install, authenticate, or dispatch an agent runtime.
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)
Capabilities CapabilityLister // nil until capability inventory is wired (spec 039)
Planner Planner // nil in control-only mode (spec 026)
Playbooks PlaybookCatalog // deterministic catalog + preview (spec 036)
PlaybookRunner PlaybookRunner // nil in control-only mode
Conversations ConversationPort // durable shared conversations (spec 041)
Primary PrimaryChannelPort // private subscription-backed Channels (spec 044)
AgentChannels AgentChannelPort // agent-first Channels and their nested conversations (spec 046)
SeatRechecker ConversationSeatRechecker // nil without functional capability probes (spec 041)
Today TodayPort // truthful right-rail projection (spec 041)
TodayLocation *time.Location // one Fort-configured IANA display timezone (spec 041)
Schedules SchedulePort // durable daemon scheduler (spec 041)
ScheduleRead ScheduleReadPort // Phase 1 read-only schedule projection
ScheduleInventory ScheduleInventoryPort // Phase 1 promotion/review boundary
AcceptedScheduleInventory string // exact operator-reviewed digest
}
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 FlowNode ¶ added in v0.11.0
type FlowNode struct {
ID string `json:"id"`
Type string `json:"type"` // task | gate | check | transform | fanout
}
FlowNode is one node of a flow plan as exposed to the control plane (spec 033): just enough to know a run's checkpoint total.
type FlowRunner ¶
type FlowRunner interface {
StartFlow(ctx context.Context, flowID, runID, payload string) (RunResult, error)
Approve(runID, nodeID, edit string) error
Reject(runID, nodeID, note string) error
ResumeFlow(ctx context.Context, flowID, runID string) (RunResult, error)
// Plan returns the flow's node list (nil for an unknown id).
Plan(flowID string) []FlowNode
}
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"`
Note string `json:"note,omitempty"` // redirect note on reject (spec 033)
}
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"`
Since string `json:"since,omitempty"` // RFC3339 — when the gate began waiting (spec 033)
}
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 MetricsResponse ¶ added in v0.11.0
type MetricsResponse struct {
WindowDays int `json:"window_days"`
Assignments int `json:"assignments"`
Agents []AgentMetrics `json:"agents"`
Lanes []string `json:"lanes"` // distinct matched_rule values seen in the window
}
MetricsResponse is the payload of GET /api/metrics (spec 033).
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 OccurrencePage ¶ added in v1.0.4
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 Playbook ¶ added in v0.12.0
type Playbook struct {
ID string `json:"id"`
Name string `json:"name"`
Revision int `json:"revision"`
IsDefault bool `json:"is_default,omitempty"`
PlanGate bool `json:"plan_gate,omitempty"`
Delivery string `json:"delivery"` // assignment | answer
Trigger PlaybookTrigger `json:"trigger"`
Stages []PlaybookStage `json:"stages"`
}
Playbook is the latest (or an explicitly requested immutable) revision of a reusable agent/model pipeline.
type PlaybookAssignment ¶ added in v0.12.0
type PlaybookAssignment struct {
TaskType string `json:"task_type,omitempty"`
Profile string `json:"profile,omitempty"`
Agent string `json:"agent"`
Model string `json:"model,omitempty"`
}
PlaybookAssignment chooses an exact Fort-owned profile for a task-type branch. Agent/model remain as derived wire fields and preserve legacy saved revisions. An empty TaskType is the required default branch for that stage.
type PlaybookCatalog ¶ added in v0.12.0
type PlaybookCatalog interface {
List(ctx context.Context) ([]Playbook, error)
Save(ctx context.Context, p Playbook) (Playbook, error)
Duplicate(ctx context.Context, id string) (Playbook, error)
Route(ctx context.Context, req RouteRequest) (RoutePreview, error)
}
PlaybookCatalog owns immutable playbook revisions and deterministic route resolution. It is available in both full and control-only modes; Route must never invoke a model or dispatch runtime work.
type PlaybookRunResult ¶ added in v0.12.0
type PlaybookRunResult struct {
State string `json:"state"`
PausedNode string `json:"paused_node,omitempty"`
FlowID string `json:"flow_id"`
Answer string `json:"answer,omitempty"`
}
PlaybookRunResult is a Start result. Async starts return accepted without an inline Answer; synchronous delivery=answer starts populate Answer. Either form retains inspectable event history.
type PlaybookRunner ¶ added in v0.12.0
type PlaybookRunner interface {
StartPlaybook(ctx context.Context, route RoutePreview, runID, direction string) (PlaybookRunResult, error)
}
PlaybookRunner compiles and executes an already-resolved immutable route. It is nil in control-only mode.
type PlaybookStage ¶ added in v0.12.0
type PlaybookStage struct {
Order int `json:"order"`
Name string `json:"name"`
Prompt string `json:"prompt,omitempty"`
Description string `json:"description,omitempty"`
Assignments []PlaybookAssignment `json:"assignments"`
Memory bool `json:"memory,omitempty"`
}
PlaybookStage is one reusable pipeline stage.
type PlaybookTrigger ¶ added in v0.12.0
type PlaybookTrigger struct {
Kind string `json:"kind"` // question | bug | research | feature | manual
Enabled bool `json:"enabled"`
}
PlaybookTrigger is a deterministic task-type binding. Enabled is exposed so the Turn-4 shortcut toggles can be persisted without changing the route grammar.
type PrimaryAgentOption ¶ added in v1.0.4
type PrimaryAgentOption struct {
ID string `json:"option_id"`
State string `json:"state"`
Reason string `json:"reason,omitempty"`
Seat conversation.Seat `json:"seat"`
Offer corecap.TextOnlyOptionOffer `json:"authority"`
DisplayName string `json:"display_name"`
}
PrimaryAgentOption is one visible profile/model/computer inventory row. Only ready subscription-backed rows carry selectable authority; ordinary and unready profiles remain visible with a closed state and reason. Clients select only OptionID and cannot combine independent seat and policy fields.
type PrimaryAgentView ¶ added in v1.0.4
type PrimaryAgentView struct {
Selection *conversation.PrimaryAgentSetting `json:"selection"`
State string `json:"state"`
Reason string `json:"reason,omitempty"`
Options []PrimaryAgentOption `json:"options"`
ScheduleInventory *ScheduleInventory `json:"schedule_inventory,omitempty"`
}
type PrimaryChannelDetail ¶ added in v1.0.4
type PrimaryChannelDetail struct {
Conversation conversation.Conversation `json:"conversation"`
Participants []conversation.Participant `json:"participants"`
Messages []conversation.Message `json:"messages"`
Turns []conversation.Turn `json:"turns"`
Targets []conversation.Target `json:"targets"`
PrimaryChannel *conversation.PrimaryChannel `json:"primary_identity,omitempty"`
Readiness PrimaryChannelReadiness `json:"readiness"`
}
PrimaryChannelDetail is the bounded wire projection for one marked private Channel. Persistence remains behind the control adapter.
type PrimaryChannelPort ¶ added in v1.0.4
type PrimaryChannelPort interface {
PrimaryAgent(context.Context) (PrimaryAgentView, error)
SetPrimaryAgent(context.Context, string) (PrimaryAgentView, error)
ClearPrimaryAgent(context.Context) error
RecheckPrimaryAgent(context.Context) (PrimaryAgentView, error)
ListChannels(context.Context, string) ([]conversation.PrimaryChannelSummary, error)
GetChannel(context.Context, string) (PrimaryChannelDetail, error)
CreateChannel(context.Context, string) (PrimaryChannelDetail, error)
RenameChannel(context.Context, string, string) error
SetChannelState(context.Context, string, conversation.ConversationState) error
SetChannelPinned(context.Context, string, bool) error
PostTurn(context.Context, string, string, string) (conversation.TurnResult, error)
RetryTarget(context.Context, string, string) (conversation.Target, error)
RecheckAndRetryTarget(context.Context, string, string) (conversation.Target, error)
CancelTarget(context.Context, string, string) error
NeedsYou(context.Context) ([]PrimaryNeedsYouItem, error)
}
PrimaryChannelPort deliberately has no generic participant selection or execution method. Its implementation resolves the one stored Primary Agent and sole Channel participant server-side.
type PrimaryChannelReadiness ¶ added in v1.0.4
type PrimaryChannelReadiness struct {
State string `json:"state"`
Reason string `json:"reason,omitempty"`
ObservedAt time.Time `json:"observed_at"`
}
PrimaryChannelReadiness is a read-only projection of the latest capability inventory for a Channel's immutable stored identity. It never retargets or rewrites the participant or authority snapshot.
type PrimaryChannelsMode ¶ added in v1.0.4
type PrimaryChannelsMode string
const ( PrimaryChannelsOff PrimaryChannelsMode = "off" PrimaryChannelsPreview PrimaryChannelsMode = "preview" PrimaryChannelsPrimary PrimaryChannelsMode = "primary" )
type PrimaryNeedsYouItem ¶ added in v1.0.4
type PrimaryNeedsYouItem struct {
Channel conversation.PrimaryChannelSummary `json:"channel"`
Target conversation.Target `json:"target"`
RecoveryActions []string `json:"recovery_actions"`
}
type ProductMode ¶ added in v1.0.4
type ProductMode struct {
PrimaryChannels PrimaryChannelsMode
AgentChannels AgentChannelsMode
}
ProductMode selects the Agent Channels cutover while retaining Primary Channels as its one-switch rollback surface. AgentChannelsOff is the compatibility default.
type ProfileOption ¶ added in v0.13.0
type ProfileOption struct {
ID string `json:"id"`
Agent string `json:"agent"`
Model string `json:"model,omitempty"`
DisplayName string `json:"display_name"`
State corecap.OfferState `json:"state"`
Reason corecap.Reason `json:"reason,omitempty"`
Machines []string `json:"machines"`
}
ProfileOption is one closed, Fort-owned agent/model choice for a direct conversation turn. State and Reason are the latest aggregate readiness projection; Machines names only targets that currently report the profile ready. Unknown/setup-required choices remain visible and are never silently substituted at dispatch.
type RelatedChannel ¶ added in v1.0.4
type ResolvedPlaybookStage ¶ added in v0.12.0
type ResolvedPlaybookStage struct {
Order int `json:"order"`
Name string `json:"name"`
Prompt string `json:"prompt,omitempty"`
Profile string `json:"profile,omitempty"`
Agent string `json:"agent"`
Model string `json:"model,omitempty"`
Memory bool `json:"memory,omitempty"`
}
ResolvedPlaybookStage is the one selected branch for a stage.
type RoutePreview ¶ added in v0.12.0
type RoutePreview struct {
PlaybookID string `json:"playbook_id"`
PlaybookRevision int `json:"playbook_revision"`
PlaybookName string `json:"playbook_name"`
TaskType string `json:"task_type"`
Source string `json:"source"` // manual | trigger | default
PlanGate bool `json:"plan_gate"`
Delivery string `json:"delivery"` // assignment | answer
Stages []ResolvedPlaybookStage `json:"stages"`
}
RoutePreview is the immutable route card shown before handoff.
type RouteRequest ¶ added in v0.12.0
type RouteRequest struct {
Text string `json:"text"`
PlaybookID string `json:"playbook_id,omitempty"`
PlaybookRevision int `json:"playbook_revision,omitempty"`
TaskType string `json:"task_type,omitempty"`
PlanGate *bool `json:"plan_gate,omitempty"`
}
RouteRequest asks Fort to resolve a route without dispatching. The result is a pure function of this request and the immutable catalog revision.
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"`
Profile string `json:"profile,omitempty"`
Model string `json:"model,omitempty"`
Status string `json:"status"`
Machine string `json:"machine,omitempty"` // host the run is placed on (spec 022)
FlowID string `json:"flow_id,omitempty"`
CreatedAt string `json:"created_at,omitempty"` // RFC3339 (spec 033)
UpdatedAt string `json:"updated_at,omitempty"` // RFC3339 (spec 033)
Checkpoints *CheckpointSummary `json:"checkpoints,omitempty"`
}
RunSummary is a board card.
type ScheduleDetail ¶ added in v1.0.4
type ScheduleDetail struct {
Item ScheduleItem `json:"item"`
Upcoming []scheduler.Occurrence `json:"upcoming"`
Recent []scheduler.Occurrence `json:"recent"`
}
type ScheduleFilter ¶ added in v1.0.4
type ScheduleFilter string
const ( ScheduleFilterAll ScheduleFilter = "all" ScheduleFilterActive ScheduleFilter = "active" ScheduleFilterPaused ScheduleFilter = "paused" )
type ScheduleInventory ¶ added in v1.0.4
type ScheduleInventory struct {
CurrentDigest string `json:"current_digest"`
AcceptedDigest string `json:"accepted_digest,omitempty"`
State ScheduleInventoryState `json:"state"`
Items []ScheduleInventoryItem `json:"items"`
}
type ScheduleInventoryItem ¶ added in v1.0.4
type ScheduleInventoryPort ¶ added in v1.0.4
type ScheduleInventoryPort interface {
Inventory(context.Context, string) (ScheduleInventory, error)
}
type ScheduleInventoryState ¶ added in v1.0.4
type ScheduleInventoryState string
const ( ScheduleInventoryAccepted ScheduleInventoryState = "accepted" ScheduleInventoryUnaccepted ScheduleInventoryState = "unaccepted" ScheduleInventoryDrift ScheduleInventoryState = "drift" )
type ScheduleItem ¶ added in v1.0.4
type ScheduleItem struct {
ID string `json:"id"`
Title string `json:"title"`
Enabled bool `json:"enabled"`
Kind scheduler.Kind `json:"kind"`
Expression string `json:"expression"`
Recurrence string `json:"recurrence"`
Timezone string `json:"timezone"`
NextFireAt *time.Time `json:"next_fire_at"`
LastFireAt *time.Time `json:"last_fire_at"`
TargetKind string `json:"target_kind"`
TargetID string `json:"target_id"`
RelatedChannel *RelatedChannel `json:"related_channel,omitempty"`
LatestOccurrence *scheduler.Occurrence `json:"latest_occurrence,omitempty"`
SchedulerOwnership SchedulerOwnership `json:"scheduler_ownership"`
ObservedAt time.Time `json:"observed_at"`
}
type ScheduleList ¶ added in v1.0.4
type ScheduleList struct {
SnapshotID string `json:"snapshot_id"`
ObservedAt time.Time `json:"observed_at"`
Items []ScheduleItem `json:"items"`
}
type SchedulePort ¶ added in v0.13.0
type SchedulePort interface {
Create(context.Context, scheduler.Definition) (scheduler.Definition, error)
}
type ScheduleReadPort ¶ added in v1.0.4
type ScheduleReadPort interface {
List(context.Context, ScheduleFilter) (ScheduleList, error)
Get(context.Context, string) (ScheduleDetail, error)
Occurrences(context.Context, string, OccurrencePage) ([]scheduler.Occurrence, error)
}
type SchedulerOwnership ¶ added in v1.0.4
type SchedulerOwnership string
const ( SchedulerOwnershipActive SchedulerOwnership = "active" SchedulerOwnershipInactive SchedulerOwnership = "inactive" SchedulerOwnershipUnknown SchedulerOwnership = "unknown" )
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).
func (*Server) RegisterAgentChannelRoutes ¶ added in v1.0.4
RegisterAgentChannelRoutes mounts only the additive agent-first contract. The legacy /api/channels and /api/needs-you handlers remain separate.
func (*Server) RegisterMode ¶ added in v1.0.4
func (s *Server) RegisterMode(mux *http.ServeMux, mode PrimaryChannelsMode) error
RegisterMode mounts the one closed Phase 1 presentation mode. Register is retained as the off/default entry point for existing embeddings and tests.
func (*Server) RegisterNativeProductRoutes ¶ added in v1.0.4
func (s *Server) RegisterNativeProductRoutes(mux *http.ServeMux, mode ProductMode) error
RegisterNativeProductRoutes is the native-relay counterpart to RegisterProductMode. The compatibility wrapper always supplies Agent off.
func (*Server) RegisterNativeRelayRoutes ¶ added in v1.0.4
func (s *Server) RegisterNativeRelayRoutes(mux *http.ServeMux, mode PrimaryChannelsMode) error
RegisterNativeRelayRoutes mounts the Phase 1 native-client contract without any HTML, legacy control-plane route, node route, or mesh route. The relay transport marks requests trusted only after opening the authenticated sealed session; the handlers retain their own transport checks.
func (*Server) RegisterPrimaryRoutes ¶ added in v1.0.4
RegisterPrimaryRoutes mounts only the Phase 1 private Channel surface. Composition calls it in preview/primary mode; Register deliberately does not expose these routes in off mode.
func (*Server) RegisterProductMode ¶ added in v1.0.4
func (s *Server) RegisterProductMode(mux *http.ServeMux, mode ProductMode) error
RegisterProductMode mounts the selected product surface. Agent Channels changes only the root presentation here; the legacy Primary Channels routes remain mounted according to their independent compatibility mode.
func (*Server) RegisterScheduleReadRoutes ¶ added in v1.0.4
RegisterScheduleReadRoutes mounts only the Phase 1 read surface. Composition calls this in preview/primary mode; the legacy schedule POST exists only in the separate off-mode route set.
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.