server

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgSend           = "send"
	MsgCancel         = "cancel"
	MsgPromptResponse = "prompt_response"
	MsgAskResponse    = "ask_response"
)

Client -> Server message types

Variables

This section is empty.

Functions

This section is empty.

Types

type AskEvent

type AskEvent struct {
	Question string `json:"question"`
}

type CapabilitiesChangedEvent

type CapabilitiesChangedEvent struct{}

type CheckpointEntry

type CheckpointEntry struct {
	Hash    string `json:"hash"`
	Message string `json:"message"`
	Time    string `json:"time"`
}

CheckpointEntry represents a single rewind checkpoint.

type CheckpointsChangedEvent

type CheckpointsChangedEvent struct{}

type ClientMessage

type ClientMessage struct {
	Type     string   `json:"type"`
	Text     string   `json:"text,omitempty"`
	Files    []string `json:"files,omitempty"`
	Approved bool     `json:"approved,omitempty"`
	Answer   string   `json:"answer,omitempty"`
}

ClientMessage is the envelope for all client-to-server WebSocket messages. Inbound messages share one struct because the type isn't known until the frame is unmarshaled.

type ConversationContent

type ConversationContent struct {
	Text       string                 `json:"text,omitempty"`
	Reasoning  *ConversationReasoning `json:"reasoning,omitempty"`
	ToolCall   *ConversationTool      `json:"tool_call,omitempty"`
	ToolResult *ConversationResult    `json:"tool_result,omitempty"`
}

type ConversationMessage

type ConversationMessage struct {
	Role    string                `json:"role"`
	Content []ConversationContent `json:"content"`
}

ConversationMessage is a simplified message for the REST /api/messages endpoint and WebSocket messages payload.

type ConversationReasoning

type ConversationReasoning struct {
	ID      string `json:"id,omitempty"`
	Summary string `json:"summary,omitempty"`
}

type ConversationResult

type ConversationResult struct {
	Name    string `json:"name"`
	Args    string `json:"args,omitempty"`
	Content string `json:"content"`
}

type ConversationTool

type ConversationTool struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
	Args string `json:"args,omitempty"`
	Hint string `json:"hint,omitempty"`
}

type DiagnosticsChangedEvent

type DiagnosticsChangedEvent struct{}

type DiffEntry

type DiffEntry struct {
	Path     string `json:"path"`
	Status   string `json:"status"` // "added", "modified", "deleted"
	Patch    string `json:"patch"`
	Original string `json:"original,omitempty"`
	Modified string `json:"modified,omitempty"`
	Language string `json:"language,omitempty"`
}

DiffEntry represents a file diff from baseline.

type DiffsChangedEvent

type DiffsChangedEvent struct{}

type DoneEvent

type DoneEvent struct{}

type ErrorEvent

type ErrorEvent struct {
	Message string `json:"message"`
}

type FileContent

type FileContent struct {
	Path     string `json:"path"`
	Content  string `json:"content"`
	Language string `json:"language"`
}

FileContent represents the content of a file.

type FileEntry

type FileEntry struct {
	Name  string `json:"name"`
	Path  string `json:"path"`
	IsDir bool   `json:"is_dir"`
	Size  int64  `json:"size"`
}

FileEntry represents a file or directory in the file browser.

type FilesChangedEvent

type FilesChangedEvent struct{}

type MessagesEvent

type MessagesEvent struct {
	Messages []ConversationMessage `json:"messages"`
}

type PhaseEvent

type PhaseEvent struct {
	Phase string `json:"phase"`
	Hint  string `json:"hint,omitempty"`
}

type PromptEvent

type PromptEvent struct {
	Question string `json:"question"`
}

type ReasoningDeltaEvent

type ReasoningDeltaEvent struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

type Server

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

func New

func New(agent *code.Agent, port int) *Server

func (*Server) Run

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

type ServerEvent

type ServerEvent interface {
	// contains filtered or unexported methods
}

ServerEvent is implemented by every outbound WebSocket event. sendMessage emits the wire payload as {"type": <serverEventType>, ...struct fields}.

type SessionEntry

type SessionEntry struct {
	ID        string `json:"id"`
	Title     string `json:"title,omitempty"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

SessionEntry represents a saved chat session in the sidebar list.

type SessionEvent

type SessionEvent struct {
	ID string `json:"id"`
}

type SessionsChangedEvent

type SessionsChangedEvent struct{}

type SkillEntry

type SkillEntry struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	WhenToUse   string   `json:"when_to_use,omitempty"`
	Arguments   []string `json:"arguments,omitempty"`
}

SkillEntry is the wire shape for the slash-command picker.

type TextDeltaEvent

type TextDeltaEvent struct {
	Text string `json:"text"`
}

type ToolCallEvent

type ToolCallEvent struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Args string `json:"args"`
	Hint string `json:"hint,omitempty"`
}

type ToolResultEvent

type ToolResultEvent struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Content string `json:"content"`
}

type UsageEvent

type UsageEvent struct {
	InputTokens  int64 `json:"input_tokens"`
	CachedTokens int64 `json:"cached_tokens"`
	OutputTokens int64 `json:"output_tokens"`
}

Jump to

Keyboard shortcuts

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