Documentation
¶
Overview ¶
Package tui implements VORTEX's full-screen terminal UI (a Bubble Tea application). This file defines the shared Lip Gloss color palette and styles used across every view, plus small render helpers (pills, status dots, spinner). Note: unlike the rest of VORTEX (stdlib-only), the TUI depends on the Charm ecosystem (bubbletea/lipgloss/bubbles) — an approved, deliberate departure for this feature.
Index ¶
- Constants
- Variables
- func APIKeyFilePath() string
- func Pill(text, color string) string
- func Spinner() spinner.Model
- func StatusDot(ok bool) string
- type AICostData
- type AgentsData
- type AuditData
- type AuditEntryData
- type Client
- func (c *Client) AICost() (*AICostData, error)
- func (c *Client) Agents() (*AgentsData, error)
- func (c *Client) Approve(sessionID string, approved bool) (string, error)
- func (c *Client) Audit(limit int) (*AuditData, error)
- func (c *Client) ForgeStatus(jobID string) (*ForgeJobData, error)
- func (c *Client) Health() (*HealthData, error)
- func (c *Client) History() ([]SessionSummaryData, error)
- func (c *Client) IsConnected() bool
- func (c *Client) LoadAPIKey() string
- func (c *Client) Metrics() (*MetricsData, error)
- func (c *Client) Namespaces() (*NamespacesData, error)
- func (c *Client) Plugins() (*PluginsData, error)
- func (c *Client) Reload() error
- func (c *Client) Secrets() (*SecretsData, error)
- func (c *Client) SessionHistory(sessionID string) ([]SessionMessageData, error)
- func (c *Client) Status() (*StatusData, error)
- func (c *Client) Submit(msg, sessionID string) (string, error)
- type ClientConfig
- type ForgeJobData
- type ForgeQuestion
- type HealthData
- type MetricsData
- type NamespaceData
- type NamespacesData
- type PluginData
- type PluginsData
- type RouteData
- type SecretStatusData
- type SecretsData
- type SessionMessageData
- type SessionSummaryData
- type StatusData
Constants ¶
const ( ColorPrimary = "#378ADD" // blue ColorSuccess = "#1D9E75" // green ColorWarning = "#EF9F27" // amber ColorDanger = "#D85A30" // red ColorPurple = "#534AB7" ColorText = "#E0E0E0" ColorTextDim = "#8B8B8B" ColorBorder = "#2D2D2D" ColorBackground = "#0D0D0D" ColorSelected = "#1A2A3A" )
Color palette — dark theme matching the web dashboard.
Variables ¶
var ( TitleStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color(ColorPrimary)) SubtitleStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorTextDim)) BorderStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color(ColorBorder)) SelectedStyle = lipgloss.NewStyle(). Background(lipgloss.Color(ColorSelected)). Foreground(lipgloss.Color(ColorText)) ActiveStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color(ColorPrimary)) InactiveStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color(ColorTextDim)) StatusOKStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorSuccess)). Bold(true) StatusWarnStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorWarning)). Bold(true) StatusErrorStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorDanger)). Bold(true) CodeStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorText)). Background(lipgloss.Color(ColorBorder)) TableHeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color(ColorPrimary)) TableRowStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorText)) TableAltRowStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorText)). Background(lipgloss.Color("#151515")) HelpStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorTextDim)) InputStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color(ColorPrimary)). Padding(0, 1) ChatUserStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorPrimary)). Align(lipgloss.Right) ChatAgentStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorSuccess)). Align(lipgloss.Left) ChatSystemStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorTextDim)). Align(lipgloss.Center) )
Shared styles. These are package-level so views share a consistent look.
Functions ¶
func APIKeyFilePath ¶
func APIKeyFilePath() string
APIKeyFilePath returns the path where `vortex setup` persists the plaintext API key for the TUI to read back: <user-config>/vortex/tui-key. The apikeys store only holds bcrypt hashes (the raw secret is unrecoverable from it), so the setup wizard writes the secret here once for the local dashboard/TUI.
Types ¶
type AICostData ¶
type AICostData struct {
Provider string `json:"provider"`
TotalUSD float64 `json:"total_usd"`
RequestsToday int `json:"requests_today"`
DailyBudget float64 `json:"daily_budget"`
RemainingBudget float64 `json:"remaining_budget"`
Free bool `json:"free"`
}
AICostData mirrors GET /api/ai/cost.
type AgentsData ¶
type AgentsData struct {
ActiveAgents int `json:"active_agents"`
TotalMessages int64 `json:"total_messages"`
QueueDepth int `json:"queue_depth"`
}
AgentsData mirrors GET /api/agents/status.
type AuditData ¶
type AuditData struct {
Entries []AuditEntryData `json:"entries"`
}
AuditData mirrors GET /api/audit.
type AuditEntryData ¶
type AuditEntryData struct {
Seq int64 `json:"seq"`
Timestamp string `json:"timestamp"`
Actor string `json:"actor"`
Action string `json:"action"`
Resource string `json:"resource"`
Detail map[string]any `json:"detail"`
}
AuditEntryData is one audit entry.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a running VORTEX management server, returning typed data.
func NewClient ¶
func NewClient(cfg ClientConfig) *Client
NewClient constructs a client with defaults applied.
func (*Client) AICost ¶
func (c *Client) AICost() (*AICostData, error)
AICost fetches today's AI usage and budget.
func (*Client) Agents ¶
func (c *Client) Agents() (*AgentsData, error)
Agents fetches GET /api/agents/status.
func (*Client) Approve ¶
Approve posts an approve/reject decision for a pending agent tool action and returns the result transcript (the action executes server-side on approval, which may call a slow tool, so this uses the long submit timeout).
func (*Client) ForgeStatus ¶
func (c *Client) ForgeStatus(jobID string) (*ForgeJobData, error)
func (*Client) History ¶
func (c *Client) History() ([]SessionSummaryData, error)
History fetches the list of stored conversation sessions.
func (*Client) IsConnected ¶
IsConnected reports whether the server responds 200 to /health within 1s.
func (*Client) LoadAPIKey ¶
LoadAPIKey resolves an API key from VORTEX_API_KEY, then the persisted setup key file (APIKeyFilePath). It returns "" when none is found.
func (*Client) Metrics ¶
func (c *Client) Metrics() (*MetricsData, error)
Metrics fetches and parses the Prometheus /metrics exposition.
func (*Client) Namespaces ¶
func (c *Client) Namespaces() (*NamespacesData, error)
Namespaces fetches GET /api/namespaces (handles array or object form).
func (*Client) Plugins ¶
func (c *Client) Plugins() (*PluginsData, error)
Plugins fetches GET /api/plugins.
func (*Client) Secrets ¶
func (c *Client) Secrets() (*SecretsData, error)
Secrets fetches GET /api/secrets/status.
func (*Client) SessionHistory ¶
func (c *Client) SessionHistory(sessionID string) ([]SessionMessageData, error)
SessionHistory fetches the messages of a past session.
func (*Client) Status ¶
func (c *Client) Status() (*StatusData, error)
Status fetches GET /api/status.
type ClientConfig ¶
type ClientConfig struct {
BaseURL string // default http://localhost:9090
APIKey string
Timeout time.Duration // default 5s
}
ClientConfig configures the TUI's API client.
type ForgeJobData ¶
type ForgeJobData struct {
ID string `json:"id"`
Message string `json:"message"`
State string `json:"state"`
Progress string `json:"progress"`
ProgressHistory []string `json:"progress_history"`
Questions []ForgeQuestion `json:"questions"`
Result string `json:"result"`
DurationMs int64 `json:"duration_ms"`
Error string `json:"error"`
}
ForgeJobData mirrors GET /api/forge/status/{id}.
type ForgeQuestion ¶
type ForgeQuestion struct {
Question string `json:"question"`
Options []string `json:"options"`
Key string `json:"key"`
}
ForgeQuestion is a structured clarifying question (option-selection UI).
type HealthData ¶
type HealthData struct {
Status string `json:"status"`
Version string `json:"version"`
ClusterName string `json:"cluster_name"`
Uptime string `json:"uptime"`
ConfigHash string `json:"config_hash"`
Routes []RouteData `json:"routes"`
}
HealthData mirrors GET /health.
type MetricsData ¶
type MetricsData struct {
RequestsTotal map[string]float64 // by route
ActiveConns map[string]float64 // by route
P99LatencyMs map[string]float64 // by route
ClusterMembers float64
}
MetricsData is parsed from the Prometheus /metrics exposition.
type NamespaceData ¶
type NamespaceData struct {
ID string `json:"id"`
Name string `json:"name"`
OrgID string `json:"org_id"`
}
NamespaceData is one tenant namespace.
type NamespacesData ¶
type NamespacesData struct {
Namespaces []NamespaceData `json:"namespaces"`
}
NamespacesData mirrors GET /api/namespaces (array or {namespaces:[...]}).
type PluginData ¶
type PluginData struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
}
PluginData is one installed plugin.
type PluginsData ¶
type PluginsData struct {
Plugins []PluginData `json:"plugins"`
}
PluginsData mirrors GET /api/plugins.
type RouteData ¶
type RouteData struct {
Name string `json:"name"`
Protocol string `json:"protocol"`
Listen string `json:"listen"`
Active int64 `json:"active"`
}
RouteData is one route's live health (mirrors api.RouteHealth).
type SecretStatusData ¶
SecretStatusData is one declared secret's set/unset state.
type SecretsData ¶
type SecretsData struct {
Secrets []SecretStatusData `json:"secrets"`
}
SecretsData mirrors GET /api/secrets/status.
type SessionMessageData ¶
SessionMessageData mirrors one message of GET /api/agents/history/{id}.
type SessionSummaryData ¶
type SessionSummaryData struct {
SessionID string `json:"session_id"`
Summary string `json:"summary"`
UpdatedAt string `json:"updated_at"`
}
ForgeStatus fetches GET /api/forge/status/{id}. SessionSummaryData mirrors one entry of GET /api/agents/history.
type StatusData ¶
type StatusData struct {
NodeID string `json:"node_id"`
TrustDomain string `json:"trust_domain"`
TLSProvider string `json:"tls_provider"`
SecretBackend string `json:"secret_backend"`
PolicyDefault bool `json:"policy_default"`
PluginCount int `json:"plugin_count"`
AuditCount int64 `json:"audit_entry_count"`
ClusterName string `json:"cluster_name"`
Version string `json:"version"`
WorkingDir string `json:"working_dir"`
}
StatusData mirrors GET /api/status.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package app is the root Bubble Tea application for the VORTEX terminal UI.
|
Package app is the root Bubble Tea application for the VORTEX terminal UI. |
|
Package views implements the individual screens of the VORTEX terminal UI.
|
Package views implements the individual screens of the VORTEX terminal UI. |