server

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package server provides HTTP server functionality for the sketch loop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitPushInfoResponse added in v0.0.15

type GitPushInfoResponse struct {
	Hash    string   `json:"hash"`
	Subject string   `json:"subject"`
	Remotes []Remote `json:"remotes"`
}

GitPushInfoResponse represents the response from /git/pushinfo

type GitPushRequest added in v0.0.15

type GitPushRequest struct {
	Remote string `json:"remote"`
	Branch string `json:"branch"`
	Commit string `json:"commit"`
	DryRun bool   `json:"dry_run"`
	Force  bool   `json:"force"`
}

GitPushRequest represents the request body for /git/push

type GitPushResponse added in v0.0.15

type GitPushResponse struct {
	Success bool   `json:"success"`
	Output  string `json:"output"`
	DryRun  bool   `json:"dry_run"`
	Error   string `json:"error,omitempty"`
}

GitPushResponse represents the response from /git/push

type InitRequest

type InitRequest struct {
	// Passed to agent so that the URL it prints in the termui prompt is correct (when skaband is not used)
	HostAddr string `json:"host_addr"`

	// POST /init will start the SSH server with these configs
	SSHAuthorizedKeys  []byte `json:"ssh_authorized_keys"`
	SSHServerIdentity  []byte `json:"ssh_server_identity"`
	SSHContainerCAKey  []byte `json:"ssh_container_ca_key"`
	SSHHostCertificate []byte `json:"ssh_host_certificate"`
	SSHAvailable       bool   `json:"ssh_available"`
	SSHError           string `json:"ssh_error,omitempty"`
}

type Port added in v0.0.2

type Port struct {
	Proto   string `json:"proto"`   // "tcp" or "udp"
	Port    uint16 `json:"port"`    // port number
	Process string `json:"process"` // optional process name
	Pid     int    `json:"pid"`     // process ID
}

Port represents an open TCP port

type Remote added in v0.0.15

type Remote struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	DisplayName string `json:"display_name"`
	IsGitHub    bool   `json:"is_github"`
}

Remote represents a git remote with display information.

type Server

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

Server serves sketch HTTP. Server implements http.Handler.

func New

func New(agent loop.CodingAgent, logFile *os.File) (*Server, error)

New creates a new HTTP server.

func (*Server) ParsePortProxyHost

func (s *Server) ParsePortProxyHost(host string) string

ParsePortProxyHost checks if host matches "p<port>.localhost" pattern and returns the port

func (*Server) ServeHTTP

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

func (*Server) ServeSSH

func (s *Server) ServeSSH(ctx context.Context, hostKey, authorizedKeys []byte, containerCAKey, hostCertificate []byte) error

type State

type State struct {
	// null or 1: "old"
	// 2: supports SSE for message updates
	StateVersion         int                           `json:"state_version"`
	MessageCount         int                           `json:"message_count"`
	TotalUsage           *conversation.CumulativeUsage `json:"total_usage,omitempty"`
	InitialCommit        string                        `json:"initial_commit"`
	Slug                 string                        `json:"slug,omitempty"`
	BranchName           string                        `json:"branch_name,omitempty"`
	BranchPrefix         string                        `json:"branch_prefix,omitempty"`
	Hostname             string                        `json:"hostname"`    // deprecated
	WorkingDir           string                        `json:"working_dir"` // deprecated
	OS                   string                        `json:"os"`          // deprecated
	GitOrigin            string                        `json:"git_origin,omitempty"`
	GitUsername          string                        `json:"git_username,omitempty"`
	OutstandingLLMCalls  int                           `json:"outstanding_llm_calls"`
	OutstandingToolCalls []string                      `json:"outstanding_tool_calls"`
	SessionID            string                        `json:"session_id"`
	SSHAvailable         bool                          `json:"ssh_available"`
	SSHError             string                        `json:"ssh_error,omitempty"`
	InContainer          bool                          `json:"in_container"`
	FirstMessageIndex    int                           `json:"first_message_index"`
	AgentState           string                        `json:"agent_state,omitempty"`
	OutsideHostname      string                        `json:"outside_hostname,omitempty"`
	InsideHostname       string                        `json:"inside_hostname,omitempty"`
	OutsideOS            string                        `json:"outside_os,omitempty"`
	InsideOS             string                        `json:"inside_os,omitempty"`
	OutsideWorkingDir    string                        `json:"outside_working_dir,omitempty"`
	InsideWorkingDir     string                        `json:"inside_working_dir,omitempty"`
	TodoContent          string                        `json:"todo_content,omitempty"`          // Contains todo list JSON data
	SkabandAddr          string                        `json:"skaband_addr,omitempty"`          // URL of the skaband server
	LinkToGitHub         bool                          `json:"link_to_github,omitempty"`        // Enable GitHub branch linking in UI
	SSHConnectionString  string                        `json:"ssh_connection_string,omitempty"` // SSH connection string for container
	DiffLinesAdded       int                           `json:"diff_lines_added"`                // Lines added from sketch-base to HEAD
	DiffLinesRemoved     int                           `json:"diff_lines_removed"`              // Lines removed from sketch-base to HEAD
	OpenPorts            []Port                        `json:"open_ports,omitempty"`            // Currently open TCP ports
	TokenContextWindow   int                           `json:"token_context_window,omitempty"`
	Model                string                        `json:"model,omitempty"` // Name of the model being used
	SessionEnded         bool                          `json:"session_ended,omitempty"`
	CanSendMessages      bool                          `json:"can_send_messages,omitempty"`
	EndedAt              time.Time                     `json:"ended_at,omitempty"`
}

type SystemPromptDebugData added in v0.0.29

type SystemPromptDebugData struct {
	SystemPrompt string
	Length       int
	Lines        int
}

SystemPromptDebugData holds the data for the system prompt debug template

type TerminalMessage

type TerminalMessage struct {
	Type string `json:"type"`
	Cols uint16 `json:"cols"`
	Rows uint16 `json:"rows"`
}

TerminalMessage represents a message sent from the client for terminal resize events

type TerminalResponse

type TerminalResponse struct {
	SessionID string `json:"sessionId"`
}

TerminalResponse represents the response for a new terminal creation

type TodoItem

type TodoItem struct {
	ID     string `json:"id"`
	Task   string `json:"task"`
	Status string `json:"status"` // queued, in-progress, completed
}

TodoItem represents a single todo item for task management

type TodoList

type TodoList struct {
	Items []TodoItem `json:"items"`
}

TodoList represents a collection of todo items

Directories

Path Synopsis
Package gzhandler provides an HTTP file server implementation that serves pre-compressed files when available to clients that support gzip encoding.
Package gzhandler provides an HTTP file server implementation that serves pre-compressed files when available to clients that support gzip encoding.

Jump to

Keyboard shortcuts

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