Documentation
¶
Index ¶
- Variables
- type App
- type Backend
- type ChatMessageInfo
- type CommandLeg
- type CommandSpecInfo
- type DebugConnection
- type DebugInfo
- type DebugPeer
- type DebugService
- type DirectBackend
- func (b *DirectBackend) AcceptConnection(_ context.Context, addr string) error
- func (b *DirectBackend) AcceptFile(_ context.Context, transferID, savePath string) error
- func (b *DirectBackend) AddContact(_ context.Context, addr, alias string, pubKey []byte) error
- func (b *DirectBackend) AddNode(ctx context.Context, onionAddr string) (int, error)
- func (b *DirectBackend) CancelTransfer(_ context.Context, transferID string) error
- func (b *DirectBackend) ClearConversation(_ context.Context, addr string) error
- func (b *DirectBackend) Close() error
- func (b *DirectBackend) Connect(ctx context.Context, addr string) (bool, string, error)
- func (b *DirectBackend) DeleteMessage(_ context.Context, addr, messageID string) error
- func (b *DirectBackend) Disconnect(_ context.Context, addr string) error
- func (b *DirectBackend) GetDebugInfo(_ context.Context) (*DebugInfo, error)
- func (b *DirectBackend) GetIdentity(_ context.Context) (*IdentityInfo, error)
- func (b *DirectBackend) GetMessages(_ context.Context, addr string, limit int) ([]ChatMessageInfo, error)
- func (b *DirectBackend) GetStatus(_ context.Context) (*StatusInfo, error)
- func (b *DirectBackend) InvokeCommand(ctx context.Context, addr, name, args string) (<-chan CommandLeg, error)
- func (b *DirectBackend) ListCommands(ctx context.Context, addr string) ([]CommandSpecInfo, error)
- func (b *DirectBackend) ListContacts(_ context.Context) ([]*contacts.Contact, error)
- func (b *DirectBackend) ListPeers(_ context.Context) ([]PeerInfo, error)
- func (b *DirectBackend) RejectConnection(_ context.Context, addr string) error
- func (b *DirectBackend) RejectFile(_ context.Context, transferID string) error
- func (b *DirectBackend) RemoveContact(_ context.Context, addr string) error
- func (b *DirectBackend) SendFile(ctx context.Context, addr, filePath string) (<-chan FileProgress, error)
- func (b *DirectBackend) SendMessage(ctx context.Context, addr, text string) (string, error)
- func (b *DirectBackend) SetCommandInvoker(c commandInvoker)
- func (b *DirectBackend) Subscribe(ctx context.Context) (<-chan node.Event, error)
- type FileProgress
- type GRPCBackend
- func (b *GRPCBackend) AcceptConnection(ctx context.Context, address string) error
- func (b *GRPCBackend) AcceptFile(ctx context.Context, transferID, savePath string) error
- func (b *GRPCBackend) AddContact(ctx context.Context, address, alias string, pubKey []byte) error
- func (b *GRPCBackend) AddNode(ctx context.Context, onionAddr string) (int, error)
- func (b *GRPCBackend) CancelTransfer(ctx context.Context, transferID string) error
- func (b *GRPCBackend) ClearConversation(ctx context.Context, address string) error
- func (b *GRPCBackend) Close() error
- func (b *GRPCBackend) Connect(ctx context.Context, address string) (bool, string, error)
- func (b *GRPCBackend) DeleteMessage(ctx context.Context, address, messageID string) error
- func (b *GRPCBackend) Disconnect(ctx context.Context, address string) error
- func (b *GRPCBackend) GetDebugInfo(ctx context.Context) (*DebugInfo, error)
- func (b *GRPCBackend) GetIdentity(ctx context.Context) (*IdentityInfo, error)
- func (b *GRPCBackend) GetMessages(ctx context.Context, address string, limit int) ([]ChatMessageInfo, error)
- func (b *GRPCBackend) GetStatus(ctx context.Context) (*StatusInfo, error)
- func (b *GRPCBackend) InvokeCommand(ctx context.Context, address, name, args string) (<-chan CommandLeg, error)
- func (b *GRPCBackend) ListCommands(ctx context.Context, address string) ([]CommandSpecInfo, error)
- func (b *GRPCBackend) ListContacts(ctx context.Context) ([]*contacts.Contact, error)
- func (b *GRPCBackend) ListPeers(ctx context.Context) ([]PeerInfo, error)
- func (b *GRPCBackend) RejectConnection(ctx context.Context, address string) error
- func (b *GRPCBackend) RejectFile(ctx context.Context, transferID string) error
- func (b *GRPCBackend) RemoveContact(ctx context.Context, address string) error
- func (b *GRPCBackend) SendFile(ctx context.Context, address, filePath string) (<-chan FileProgress, error)
- func (b *GRPCBackend) SendMessage(ctx context.Context, address, text string) (string, error)
- func (b *GRPCBackend) Subscribe(ctx context.Context) (<-chan node.Event, error)
- type GRPCOption
- type IdentityInfo
- type KeyMap
- type PeerInfo
- type Screen
- type StatusInfo
Constants ¶
This section is empty.
Variables ¶
var ( ColorPrimary = lipgloss.Color("#7C3AED") // purple ColorSecondary = lipgloss.Color("#6366F1") // indigo ColorAccent = lipgloss.Color("#22D3EE") // cyan ColorSuccess = lipgloss.Color("#34D399") // green ColorWarning = lipgloss.Color("#FBBF24") // amber ColorError = lipgloss.Color("#F87171") // red ColorMuted = lipgloss.Color("#6B7280") // gray ColorText = lipgloss.Color("#E5E7EB") // light gray ColorBg = lipgloss.Color("#111827") // dark bg )
Color palette.
var ( StyleTitle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary). MarginBottom(1) StyleSubtle = lipgloss.NewStyle(). Foreground(ColorMuted) StyleAccent = lipgloss.NewStyle(). Foreground(ColorAccent) StyleSuccess = lipgloss.NewStyle(). Foreground(ColorSuccess) StyleError = lipgloss.NewStyle(). Foreground(ColorError) StyleBorder = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorMuted). Padding(0, 1) StyleStatusBar = lipgloss.NewStyle(). Foreground(ColorText). Background(lipgloss.Color("#1F2937")). Padding(0, 1) StyleKey = lipgloss.NewStyle(). Foreground(ColorAccent). Bold(true) StyleKeyDesc = lipgloss.NewStyle(). Foreground(ColorMuted) StyleSelected = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true) )
Common styles.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the root Bubble Tea model.
func NewApp ¶
NewApp creates the root TUI model. tap is used to surface the most recent daemon log line above the status bar; pass a discard-sink tap if there's no local daemon to log.
type Backend ¶
type Backend interface {
GetIdentity(ctx context.Context) (*IdentityInfo, error)
GetStatus(ctx context.Context) (*StatusInfo, error)
GetDebugInfo(ctx context.Context) (*DebugInfo, error)
ListContacts(ctx context.Context) ([]*contacts.Contact, error)
// ListPeers returns the unified peers list: saved contacts ∪ peers with
// live/in-flight connections, one entry per address, sorted by address.
// Inbound-only non-contacts appear unsaved (ADR-0004).
ListPeers(ctx context.Context) ([]PeerInfo, error)
AddContact(ctx context.Context, address, alias string, pubKey []byte) error
RemoveContact(ctx context.Context, address string) error
Connect(ctx context.Context, address string) (accepted bool, msg string, err error)
// Disconnect tears down every live path to a peer (direct and/or Tor).
// The contact entry, if any, is untouched.
Disconnect(ctx context.Context, address string) error
AcceptConnection(ctx context.Context, address string) error
RejectConnection(ctx context.Context, address string) error
SendMessage(ctx context.Context, address, text string) (messageID string, err error)
// InvokeCommand runs a slash-command for a conversation (daemon built-in
// and/or the active service, per the daemon's augment dispatch) and STREAMS
// the reply legs: the instant built-in line, then the service reply (or a
// timeout) when it lands. The channel closes when the dispatch completes.
// Commands never go through the chat send path — they are control-plane, not
// conversation.
InvokeCommand(ctx context.Context, address, name, args string) (<-chan CommandLeg, error)
// ListCommands returns the commands available in a conversation (built-ins +
// the service's declared set, deduped) for /-autocomplete.
ListCommands(ctx context.Context, address string) ([]CommandSpecInfo, error)
GetMessages(ctx context.Context, address string, limit int) ([]ChatMessageInfo, error)
DeleteMessage(ctx context.Context, address, messageID string) error
ClearConversation(ctx context.Context, address string) error
SendFile(ctx context.Context, address, filePath string) (<-chan FileProgress, error)
AcceptFile(ctx context.Context, transferID, savePath string) error
RejectFile(ctx context.Context, transferID string) error
CancelTransfer(ctx context.Context, transferID string) error
AddNode(ctx context.Context, onionAddr string) (peersFound int, err error)
Subscribe(ctx context.Context) (<-chan node.Event, error)
Close() error
}
Backend abstracts daemon access so the TUI works identically whether running in-process or attached to a remote daemon.
type ChatMessageInfo ¶
type ChatMessageInfo struct {
ID string
From string
To string
Text string
SentAt time.Time
Acked bool
Outgoing bool // true = sent by this node
}
ChatMessageInfo is a stored chat message surfaced to the TUI. It is the backend-agnostic shape of internal/chat.Message: DirectBackend reads it from the in-process history, GRPCBackend from the GetChatHistory RPC.
type CommandLeg ¶
CommandLeg is one streamed leg of an invoked slash-command's reply (E3): the instant daemon built-in line, the service reply when it lands, or a daemon- rendered timeout. Leg is "builtin" | "service" | "timeout". Error carries a transport/stream failure (empty on normal legs) so the UI can render it.
type CommandSpecInfo ¶
CommandSpecInfo is one slash-command available in a conversation — a daemon built-in or a service-declared command, as returned by the ListServiceCommands discovery RPC. The TUI uses it to drive /-autocomplete.
type DebugConnection ¶
DebugConnection represents a connection state.
type DebugInfo ¶
type DebugInfo struct {
RTSize int
RTPeers []DebugPeer
Connections []DebugConnection
OnionAddr string
// Services lists the currently-registered services on this daemon, in
// name order. W3 #a137ce40: surfaced in `ensemble debug` so squatting
// is one call away from being visible.
Services []DebugService
}
DebugInfo holds diagnostic information for the Network screen and the `ensemble debug` CLI (both sourced from the GetDebugInfo RPC).
type DebugService ¶
DebugService describes one registered service for the debug surface.
type DirectBackend ¶
type DirectBackend struct {
// contains filtered or unexported fields
}
DirectBackend wraps a node.Node for in-process TUI access (no serialization).
func NewDirectBackend ¶
func NewDirectBackend(n directNode, history *chat.History) *DirectBackend
NewDirectBackend creates a backend that talks to the node directly. history is the daemon's chat message store (nil-safe — chat history methods degrade to empty/no-op when it's absent).
func (*DirectBackend) AcceptConnection ¶
func (b *DirectBackend) AcceptConnection(_ context.Context, addr string) error
func (*DirectBackend) AcceptFile ¶
func (b *DirectBackend) AcceptFile(_ context.Context, transferID, savePath string) error
func (*DirectBackend) AddContact ¶
func (*DirectBackend) CancelTransfer ¶
func (b *DirectBackend) CancelTransfer(_ context.Context, transferID string) error
func (*DirectBackend) ClearConversation ¶
func (b *DirectBackend) ClearConversation(_ context.Context, addr string) error
func (*DirectBackend) Close ¶
func (b *DirectBackend) Close() error
func (*DirectBackend) DeleteMessage ¶
func (b *DirectBackend) DeleteMessage(_ context.Context, addr, messageID string) error
func (*DirectBackend) Disconnect ¶
func (b *DirectBackend) Disconnect(_ context.Context, addr string) error
func (*DirectBackend) GetDebugInfo ¶
func (b *DirectBackend) GetDebugInfo(_ context.Context) (*DebugInfo, error)
func (*DirectBackend) GetIdentity ¶
func (b *DirectBackend) GetIdentity(_ context.Context) (*IdentityInfo, error)
func (*DirectBackend) GetMessages ¶
func (b *DirectBackend) GetMessages(_ context.Context, addr string, limit int) ([]ChatMessageInfo, error)
func (*DirectBackend) GetStatus ¶
func (b *DirectBackend) GetStatus(_ context.Context) (*StatusInfo, error)
func (*DirectBackend) InvokeCommand ¶
func (b *DirectBackend) InvokeCommand(ctx context.Context, addr, name, args string) (<-chan CommandLeg, error)
func (*DirectBackend) ListCommands ¶
func (b *DirectBackend) ListCommands(ctx context.Context, addr string) ([]CommandSpecInfo, error)
func (*DirectBackend) ListContacts ¶
func (*DirectBackend) ListPeers ¶
func (b *DirectBackend) ListPeers(_ context.Context) ([]PeerInfo, error)
func (*DirectBackend) RejectConnection ¶
func (b *DirectBackend) RejectConnection(_ context.Context, addr string) error
func (*DirectBackend) RejectFile ¶
func (b *DirectBackend) RejectFile(_ context.Context, transferID string) error
func (*DirectBackend) RemoveContact ¶
func (b *DirectBackend) RemoveContact(_ context.Context, addr string) error
func (*DirectBackend) SendFile ¶
func (b *DirectBackend) SendFile(ctx context.Context, addr, filePath string) (<-chan FileProgress, error)
func (*DirectBackend) SendMessage ¶
func (*DirectBackend) SetCommandInvoker ¶
func (b *DirectBackend) SetCommandInvoker(c commandInvoker)
SetCommandInvoker wires the in-process command seam (the daemon's *api.Server) so the embedded TUI can run slash-commands and list them. Optional: without it, InvokeCommand/ListCommands degrade to a clear "not available" error / the empty set. Call once after construction.
type FileProgress ¶
type FileProgress struct {
TransferID string
Filename string
TotalBytes uint64
SentBytes uint64
Percent float32
Complete bool
Error string
}
FileProgress reports file transfer progress.
type GRPCBackend ¶
type GRPCBackend struct {
// contains filtered or unexported fields
}
GRPCBackend wraps a gRPC client for attach mode (TUI → remote daemon).
func NewGRPCBackend ¶
func NewGRPCBackend(target string, privKey ed25519.PrivateKey, options ...GRPCOption) (*GRPCBackend, error)
NewGRPCBackend dials the given target and returns a gRPC-backed Backend. For a Unix socket, use "unix:///path/to/socket". privKey is optional — if non-nil, each RPC is signed with this Ed25519 key. By default the connection is plaintext h2c. Pass WithTLS() or WithTLSInsecureSkipVerify() to wrap in TLS (e.g. when going via an HTTPS ingress).
func (*GRPCBackend) AcceptConnection ¶
func (b *GRPCBackend) AcceptConnection(ctx context.Context, address string) error
func (*GRPCBackend) AcceptFile ¶
func (b *GRPCBackend) AcceptFile(ctx context.Context, transferID, savePath string) error
func (*GRPCBackend) AddContact ¶
func (*GRPCBackend) CancelTransfer ¶
func (b *GRPCBackend) CancelTransfer(ctx context.Context, transferID string) error
CancelTransfer aborts an in-flight transfer (send or receive) over the attach (gRPC) backend via the CancelTransfer RPC.
func (*GRPCBackend) ClearConversation ¶
func (b *GRPCBackend) ClearConversation(ctx context.Context, address string) error
func (*GRPCBackend) Close ¶
func (b *GRPCBackend) Close() error
func (*GRPCBackend) DeleteMessage ¶
func (b *GRPCBackend) DeleteMessage(ctx context.Context, address, messageID string) error
func (*GRPCBackend) Disconnect ¶
func (b *GRPCBackend) Disconnect(ctx context.Context, address string) error
func (*GRPCBackend) GetDebugInfo ¶
func (b *GRPCBackend) GetDebugInfo(ctx context.Context) (*DebugInfo, error)
func (*GRPCBackend) GetIdentity ¶
func (b *GRPCBackend) GetIdentity(ctx context.Context) (*IdentityInfo, error)
func (*GRPCBackend) GetMessages ¶
func (b *GRPCBackend) GetMessages(ctx context.Context, address string, limit int) ([]ChatMessageInfo, error)
func (*GRPCBackend) GetStatus ¶
func (b *GRPCBackend) GetStatus(ctx context.Context) (*StatusInfo, error)
func (*GRPCBackend) InvokeCommand ¶
func (b *GRPCBackend) InvokeCommand(ctx context.Context, address, name, args string) (<-chan CommandLeg, error)
func (*GRPCBackend) ListCommands ¶
func (b *GRPCBackend) ListCommands(ctx context.Context, address string) ([]CommandSpecInfo, error)
func (*GRPCBackend) ListContacts ¶
func (*GRPCBackend) ListPeers ¶
func (b *GRPCBackend) ListPeers(ctx context.Context) ([]PeerInfo, error)
func (*GRPCBackend) RejectConnection ¶
func (b *GRPCBackend) RejectConnection(ctx context.Context, address string) error
func (*GRPCBackend) RejectFile ¶
func (b *GRPCBackend) RejectFile(ctx context.Context, transferID string) error
func (*GRPCBackend) RemoveContact ¶
func (b *GRPCBackend) RemoveContact(ctx context.Context, address string) error
func (*GRPCBackend) SendFile ¶
func (b *GRPCBackend) SendFile(ctx context.Context, address, filePath string) (<-chan FileProgress, error)
func (*GRPCBackend) SendMessage ¶
type GRPCOption ¶
type GRPCOption func(*grpcOpts)
GRPCOption configures NewGRPCBackend.
func WithTLSInsecureSkipVerify ¶
func WithTLSInsecureSkipVerify() GRPCOption
WithTLSInsecureSkipVerify enables TLS but does not verify the server certificate. Useful for LAN deployments behind a private CA without distributing the CA cert.
type IdentityInfo ¶
IdentityInfo holds the node's address and public key.
type KeyMap ¶
type KeyMap struct {
Quit key.Binding
Back key.Binding
Up key.Binding
Down key.Binding
AddContact key.Binding
Settings key.Binding
Enter key.Binding
}
KeyMap holds all key bindings for the TUI.
type PeerInfo ¶
type PeerInfo struct {
Address string
Alias string // empty when unsaved
Saved bool // true when in the contact store
State string // "none" | "connecting" | "direct" | "tor" | "failed"
Online bool // a live data path exists (State direct or tor)
}
PeerInfo is one row of the unified peers list (ADR-0004): a peer that is a saved contact, has a live or in-flight connection, or both. The home screen renders these directly — badges come from Saved/State/Online.