webui

package
v0.3.29-beta Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package webui provides a web server and HTTP API for kodelet's web interface. It serves the embedded React frontend and provides REST endpoints for conversation management and LLM interactions through a browser interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CWDHint

type CWDHint struct {
	Path string `json:"path"`
}

type CWDHintsResponse

type CWDHintsResponse struct {
	BaseDir string    `json:"baseDir,omitempty"`
	Query   string    `json:"query,omitempty"`
	Hints   []CWDHint `json:"hints"`
}

type ChatContentBlock

type ChatContentBlock struct {
	Type     string              `json:"type"`
	Text     string              `json:"text,omitempty"`
	Source   *ChatImageSource    `json:"source,omitempty"`
	ImageURL *ChatImageURLSource `json:"image_url,omitempty"`
}

ChatContentBlock represents a multimodal user input block from the web UI.

type ChatEvent

type ChatEvent struct {
	Kind           string                          `json:"kind"`
	ConversationID string                          `json:"conversation_id,omitempty"`
	Role           string                          `json:"role,omitempty"`
	Delta          string                          `json:"delta,omitempty"`
	Content        string                          `json:"content,omitempty"`
	ToolName       string                          `json:"tool_name,omitempty"`
	ToolCallID     string                          `json:"tool_call_id,omitempty"`
	Input          string                          `json:"input,omitempty"`
	ToolResult     *tooltypes.StructuredToolResult `json:"tool_result,omitempty"`
	Error          string                          `json:"error,omitempty"`
}

ChatEvent is a single NDJSON event sent to the React chat client.

type ChatEventSink

type ChatEventSink interface {
	Send(ChatEvent) error
}

ChatEventSink receives streamed chat events.

type ChatImageSource

type ChatImageSource struct {
	Data      string `json:"data"`
	MediaType string `json:"media_type"`
}

ChatImageSource represents embedded image data.

type ChatImageURLSource

type ChatImageURLSource struct {
	URL string `json:"url"`
}

ChatImageURLSource represents URL-based image input.

type ChatProfileOption

type ChatProfileOption struct {
	Name   string `json:"name"`
	Scope  string `json:"scope"`
	Active bool   `json:"active,omitempty"`
}

ChatProfileOption represents a selectable profile in the web UI.

type ChatRequest

type ChatRequest struct {
	Message        string             `json:"message"`
	Content        []ChatContentBlock `json:"content,omitempty"`
	ConversationID string             `json:"conversationId,omitempty"`
	Profile        string             `json:"profile,omitempty"`
	CWD            string             `json:"cwd,omitempty"`
}

ChatRequest is the payload for a streamed web chat turn.

type ChatRunner

type ChatRunner interface {
	Run(ctx context.Context, req ChatRequest, sink ChatEventSink) (string, error)
}

ChatRunner executes a single persisted chat turn for the web UI.

type ChatSettingsResponse

type ChatSettingsResponse struct {
	CurrentProfile string              `json:"currentProfile,omitempty"`
	Profiles       []ChatProfileOption `json:"profiles"`
	DefaultCWD     string              `json:"defaultCWD,omitempty"`
}

ChatSettingsResponse contains profile settings for the web chat composer.

type DefaultChatRunner

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

DefaultChatRunner executes chat turns using the same LLM/tool stack as the CLI.

func NewDefaultChatRunner

func NewDefaultChatRunner(defaultCWD string, compactRatio float64, disableAutoCompact bool) *DefaultChatRunner

NewDefaultChatRunner creates a chat runner for the web UI server.

func (*DefaultChatRunner) Run

Run executes a single persisted chat turn and streams events to the sink.

type Server

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

Server represents the web UI server

func NewServer

func NewServer(ctx context.Context, config *ServerConfig) (*Server, error)

NewServer creates a new web UI server

func (*Server) Close

func (s *Server) Close() error

Close closes the server and releases resources

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the web server

func (*Server) Stop

func (s *Server) Stop() error

Stop stops the web server

type ServerConfig

type ServerConfig struct {
	Host               string
	Port               int
	CWD                string
	CompactRatio       float64
	DisableAutoCompact bool
}

ServerConfig holds the configuration for the web server

func (*ServerConfig) Validate

func (c *ServerConfig) Validate() error

Validate validates the server configuration

type WebContentBlock

type WebContentBlock struct {
	Type     string          `json:"type"`
	Text     string          `json:"text,omitempty"`
	Source   *WebImageSource `json:"source,omitempty"`
	ImageURL *WebImageURL    `json:"image_url,omitempty"`
}

WebContentBlock represents a typed content block rendered by the web UI.

type WebConversationResponse

type WebConversationResponse struct {
	ID            string       `json:"id"`
	CreatedAt     time.Time    `json:"createdAt"`
	UpdatedAt     time.Time    `json:"updatedAt"`
	Provider      string       `json:"provider"`
	CWD           string       `json:"cwd,omitempty"`
	CWDLocked     bool         `json:"cwdLocked,omitempty"`
	Profile       string       `json:"profile,omitempty"`
	ProfileLocked bool         `json:"profileLocked,omitempty"`
	Summary       string       `json:"summary,omitempty"`
	Usage         any          `json:"usage"`
	Messages      []WebMessage `json:"messages"`
	ToolResults   any          `json:"toolResults,omitempty"`
	MessageCount  int          `json:"messageCount"`
}

WebConversationResponse represents a conversation response for the web UI.

type WebImageSource

type WebImageSource struct {
	Data      string `json:"data"`
	MediaType string `json:"media_type"`
}

WebImageSource represents inline image data for a web content block.

type WebImageURL

type WebImageURL struct {
	URL string `json:"url"`
}

WebImageURL represents a remote image URL for a web content block.

type WebMessage

type WebMessage struct {
	Role         string        `json:"role"`
	Content      any           `json:"content"`
	ToolCalls    []WebToolCall `json:"toolCalls,omitempty"`
	ThinkingText string        `json:"thinkingText,omitempty"`
}

WebMessage represents a message with structured tool calls for the web UI

type WebToolCall

type WebToolCall struct {
	ID       string              `json:"id"`
	Function WebToolCallFunction `json:"function"`
}

WebToolCall represents a tool call for the web UI

type WebToolCallFunction

type WebToolCallFunction struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

WebToolCallFunction represents the function part of a tool call

Jump to

Keyboard shortcuts

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