server

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgSend           = "send"
	MsgCancel         = "cancel"
	MsgPromptResponse = "prompt_response"
	MsgFocus          = "focus"
)
View Source
const (
	EvtSessionState        = "session_state"
	EvtTextDelta           = "text_delta"
	EvtReasoningDelta      = "reasoning_delta"
	EvtToolCall            = "tool_call"
	EvtToolResult          = "tool_result"
	EvtPhase               = "phase"
	EvtUsage               = "usage"
	EvtError               = "error"
	EvtPrompt              = "prompt"
	EvtPromptCancel        = "prompt_cancel"
	EvtFilesChanged        = "files_changed"
	EvtDiffsChanged        = "diffs_changed"
	EvtCheckpointsChanged  = "checkpoints_changed"
	EvtSessionsChanged     = "sessions_changed"
	EvtDiagnosticsChanged  = "diagnostics_changed"
	EvtCapabilitiesChanged = "capabilities_changed"
	EvtAgentChanged        = "agent_changed"
	EvtModelChanged        = "model_changed"
)
View Source
const (
	PromptKindAsk     = "ask"
	PromptKindConfirm = "confirm"
)

Variables

View Source
var StaticFS, _ = fs.Sub(staticFiles, "static")

Functions

This section is empty.

Types

type AgentEntry added in v0.7.0

type AgentEntry struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type CheckpointEntry

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

type ClientMessage

type ClientMessage struct {
	Type      string   `json:"type"`
	SessionID string   `json:"session,omitempty"`
	Text      string   `json:"text,omitempty"`
	Files     []string `json:"files,omitempty"`
	Images    []string `json:"images,omitempty"`

	PromptID string `json:"prompt_id,omitempty"`
	Approved bool   `json:"approved,omitempty"`
}

type ConversationContent

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

type ConversationImage added in v0.6.9

type ConversationImage struct {
	Data string `json:"data"`
	Name string `json:"name,omitempty"`
}

type ConversationMessage

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

type ConversationReasoning

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

type ConversationResult

type ConversationResult struct {
	ID      string `json:"id,omitempty"`
	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 DiffEntry

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

type FileContent

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

	Binary bool   `json:"binary,omitempty"`
	Mime   string `json:"mime,omitempty"`
	Size   int64  `json:"size"`
}

type FileEntry

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

type Frame added in v0.6.9

type Frame struct {
	Type    string `json:"type"`
	Session string `json:"session,omitempty"`

	Text    string `json:"text,omitempty"`
	ID      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Args    string `json:"args,omitempty"`
	Hint    string `json:"hint,omitempty"`
	Content string `json:"content,omitempty"`
	Phase   string `json:"phase,omitempty"`
	Message string `json:"message,omitempty"`

	PromptID   string `json:"prompt_id,omitempty"`
	PromptKind string `json:"prompt_kind,omitempty"`

	InputTokens  int64 `json:"input_tokens,omitempty"`
	CachedTokens int64 `json:"cached_tokens,omitempty"`
	OutputTokens int64 `json:"output_tokens,omitempty"`

	Messages []ConversationMessage `json:"messages,omitempty"`
}

type Server

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

func New

func New(ctx context.Context, workDir string, opts *ServerOptions) (*Server, error)

func (*Server) Ask added in v0.7.0

func (s *Server) Ask(ctx context.Context, message string) (string, error)

func (*Server) Close added in v0.6.9

func (s *Server) Close()

func (*Server) Confirm added in v0.7.0

func (s *Server) Confirm(ctx context.Context, message string) (bool, error)

func (*Server) Run

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

func (*Server) ServeHTTP added in v0.6.4

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerOptions added in v0.6.9

type ServerOptions struct {
	Port      int
	NoBrowser bool
}

type SessionEntry

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

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"`
}

Jump to

Keyboard shortcuts

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