tui

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the TUI application state.

func NewApp

func NewApp(client *RPCClient) *App

NewApp creates a new TUI application.

func (*App) Init

func (a *App) Init() tea.Cmd

Init initializes the application.

func (*App) Update

func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates state.

func (*App) View

func (a *App) View() string

View renders the UI.

type ConversationMessage

type ConversationMessage struct {
	ID        string    `json:"id"`
	Type      string    `json:"type"` // user, assistant, system, turn_lifecycle
	Timestamp time.Time `json:"timestamp"`
	Content   string    `json:"content"`
	State     string    `json:"state,omitempty"`
}

ConversationMessage represents a timeline/event message.

type LogEntry

type LogEntry struct {
	Level   string    `json:"level"`
	Time    time.Time `json:"time"`
	Message string    `json:"message"`
}

LogEntry represents a single log line

type LogStreamResponse

type LogStreamResponse struct {
	StreamID string     `json:"stream_id"`
	Logs     []LogEntry `json:"logs"`
}

LogStreamResponse is the response for holon/logStream

type NotificationHandler

type NotificationHandler func(StreamNotification)

NotificationHandler is called for each decoded stream notification.

type PauseResponse

type PauseResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

PauseResponse is the response for holon/pause

type RPCClient

type RPCClient struct {
	// contains filtered or unexported fields
}

RPCClient is a JSON-RPC client for the TUI

func NewRPCClient

func NewRPCClient(rpcURL string) *RPCClient

NewRPCClient creates a new RPC client

func (*RPCClient) GetLogs

func (c *RPCClient) GetLogs(maxLines int) (*LogStreamResponse, error)

GetLogs retrieves logs from the server

func (*RPCClient) GetStatus

func (c *RPCClient) GetStatus() (*StatusResponse, error)

GetStatus retrieves the current runtime status

func (*RPCClient) InterruptTurn

func (c *RPCClient) InterruptTurn(turnID, reason string) (*TurnInterruptResponse, error)

InterruptTurn requests interruption for a specific turn.

func (*RPCClient) Pause

func (c *RPCClient) Pause() (*PauseResponse, error)

Pause pauses the runtime

func (*RPCClient) Resume

func (c *RPCClient) Resume() (*ResumeResponse, error)

Resume resumes the runtime

func (*RPCClient) SetRPCTimeout

func (c *RPCClient) SetRPCTimeout(timeout time.Duration)

SetRPCTimeout updates JSON-RPC request timeout for non-stream calls.

func (*RPCClient) StartThread

func (c *RPCClient) StartThread() (*ThreadStartResponse, error)

StartThread starts a new thread

func (*RPCClient) StartTurn

func (c *RPCClient) StartTurn(threadID string, message string) (*TurnStartResponse, error)

StartTurn starts a new turn with a user message

func (*RPCClient) StreamNotifications

func (c *RPCClient) StreamNotifications(ctx context.Context, handler NotificationHandler) error

StreamNotifications consumes JSON-RPC notifications from the server stream endpoint.

func (*RPCClient) TestConnection

func (c *RPCClient) TestConnection() error

TestConnection tests if the RPC endpoint is reachable

type ResumeResponse

type ResumeResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

ResumeResponse is the response for holon/resume

type StatusResponse

type StatusResponse struct {
	State           string    `json:"state"`
	EventsProcessed int64     `json:"events_processed"`
	LastEventAt     time.Time `json:"last_event_at"`
	SessionID       string    `json:"session_id"`
	PausedAt        time.Time `json:"paused_at,omitempty"`
	ResumedAt       time.Time `json:"resumed_at,omitempty"`
}

StatusResponse is the response for holon/status

type StreamNotification

type StreamNotification struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
}

StreamNotification represents one JSON-RPC notification from /rpc/stream.

type ThreadStartResponse

type ThreadStartResponse struct {
	ThreadID  string `json:"thread_id"`
	SessionID string `json:"session_id"`
	StartedAt string `json:"started_at"`
}

ThreadStartResponse is the response for thread/start

type TurnConversation

type TurnConversation struct {
	TurnID        string
	ThreadID      string
	StartedAt     time.Time
	UpdatedAt     time.Time
	State         string
	ProgressText  string
	ProgressState string
	ElapsedMS     int64
	UserText      string
	AssistantText string
}

TurnConversation groups one user turn and the assistant response.

type TurnInputContentPart

type TurnInputContentPart struct {
	Type string `json:"type,omitempty"`
	Text string `json:"text,omitempty"`
}

TurnInputContentPart represents content in a message

type TurnInputMessage

type TurnInputMessage struct {
	Type    string                 `json:"type,omitempty"`
	Role    string                 `json:"role,omitempty"`
	Content []TurnInputContentPart `json:"content,omitempty"`
}

TurnInputMessage represents a user message

type TurnInterruptRequest

type TurnInterruptRequest struct {
	TurnID string `json:"turn_id,omitempty"`
	Reason string `json:"reason,omitempty"`
}

TurnInterruptRequest represents a targeted turn interruption request.

type TurnInterruptResponse

type TurnInterruptResponse struct {
	TurnID        string `json:"turn_id"`
	State         string `json:"state"`
	InterruptedAt string `json:"interrupted_at"`
	Message       string `json:"message,omitempty"`
}

TurnInterruptResponse is the response for turn/interrupt.

type TurnStartRequest

type TurnStartRequest struct {
	ThreadID string             `json:"thread_id,omitempty"`
	Input    []TurnInputMessage `json:"input,omitempty"`
}

TurnStartRequest represents a request to start a new turn

type TurnStartResponse

type TurnStartResponse struct {
	TurnID    string `json:"turn_id"`
	State     string `json:"state"`
	StartedAt string `json:"started_at"`
}

TurnStartResponse is the response for turn/start

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL