handler

package
v0.0.1-alpha83 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicExchangeRequest

type AnthropicExchangeRequest struct {
	Code         string `json:"code"`
	CodeVerifier string `json:"verifier"`
}

AnthropicExchangeRequest is the request for exchanging code for tokens

type ChatRequest

type ChatRequest struct {
	// Messages is optional for create-only requests. When omitted or [], the
	// handler creates/validates the session and returns an immediate empty SSE completion.
	Messages []json.RawMessage `json:"messages"`
	// Trigger indicates the type of request: "submit-message" or "regenerate-message"
	Trigger string `json:"trigger,omitempty"`
	// WorkspaceID is optional for new sessions.
	// If omitted, the server creates a local workspace under Discobot's data directory.
	WorkspaceID string `json:"workspaceId,omitempty"`
	// Model is optional for new sessions.
	Model string `json:"model,omitempty"`
	// Reasoning controls extended thinking. This is passed through as a string
	// reasoning level such as "auto", "low", "medium", "high", "xhigh",
	// "none", "default", or "" for model/provider default behavior.
	Reasoning string `json:"reasoning,omitempty"`
	// Mode is the permission mode: "plan" for planning mode, "" for default (build mode)
	Mode string `json:"mode,omitempty"`
}

ChatRequest represents the request body for the chat endpoint. This matches the AI SDK's DefaultChatTransport format. Each element is a single UIMessage encoded as JSON.

type ChatResponse

type ChatResponse struct {
	WorkspaceID    string `json:"workspaceId"`
	SessionID      string `json:"sessionId"`
	ThreadID       string `json:"threadId"`
	SubmissionID   string `json:"submissionId,omitempty"`
	MessageID      string `json:"messageId,omitempty"`
	CompletionID   string `json:"completionId,omitempty"`
	Status         string `json:"status,omitempty"`
	QueuedPromptID string `json:"queuedPromptId,omitempty"`
}

type CodexAuthorizeRequest

type CodexAuthorizeRequest struct {
	RedirectURI string `json:"redirectUri"`
}

type CodexAuthorizeResponse

type CodexAuthorizeResponse struct {
	URL               string `json:"url"`
	Verifier          string `json:"verifier"`
	State             string `json:"state"`
	RedirectURI       string `json:"redirectUri"`
	CallbackListening bool   `json:"callbackListening"`
}

type CodexCallbackServer

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

CodexCallbackServer handles the OAuth callback on localhost:1455

func NewCodexCallbackServer

func NewCodexCallbackServer(h *Handler) *CodexCallbackServer

NewCodexCallbackServer creates a new callback server

func (*CodexCallbackServer) RegisterPending

func (s *CodexCallbackServer) RegisterPending(state, verifier, projectID, redirectURI string)

RegisterPending registers a pending OAuth session

func (*CodexCallbackServer) Start

func (s *CodexCallbackServer) Start() bool

Start attempts to start the callback server. Returns true if started successfully.

func (*CodexCallbackServer) Status

func (s *CodexCallbackServer) Status(state string) (string, string)

func (*CodexCallbackServer) Stop

func (s *CodexCallbackServer) Stop()

Stop stops the callback server

type CodexCallbackStatusRequest

type CodexCallbackStatusRequest struct {
	State string `json:"state"`
}

type CodexDeviceCodeResponse

type CodexDeviceCodeResponse struct {
	DeviceAuthID    string `json:"deviceAuthId"`
	UserCode        string `json:"userCode"`
	VerificationURI string `json:"verificationUri"`
	Interval        int    `json:"interval"`
}

type CodexExchangeRequest

type CodexExchangeRequest struct {
	Code         string `json:"code"`
	RedirectURI  string `json:"redirectUri"`
	CodeVerifier string `json:"verifier"`
}

type CodexExchangeResponse

type CodexExchangeResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

type CodexPollRequest

type CodexPollRequest struct {
	DeviceAuthID string `json:"deviceAuthId"`
	UserCode     string `json:"userCode"`
}

type ConfigInfo

type ConfigInfo struct {
	Port               int      `json:"port"`
	HTTPSPort          int      `json:"https_port,omitempty"`
	HTTPSTLSMode       string   `json:"https_tls_mode,omitempty"`
	DatabaseDriver     string   `json:"database_driver"`
	AuthEnabled        bool     `json:"auth_enabled"`
	WorkspaceDir       string   `json:"workspace_dir"`
	SandboxImage       string   `json:"sandbox_image"`
	TauriMode          bool     `json:"tauri_mode"`
	SSHEnabled         bool     `json:"ssh_enabled"`
	SSHPort            int      `json:"ssh_port"`
	DispatcherEnabled  bool     `json:"dispatcher_enabled"`
	AvailableProviders []string `json:"available_providers"`
	VZ                 *VZInfo  `json:"vz,omitempty"`
}

ConfigInfo contains sanitized configuration information

type CreateCredentialRequest

type CreateCredentialRequest struct {
	Provider     string                          `json:"provider,omitempty"`
	CredentialID string                          `json:"credentialId,omitempty"`
	Name         string                          `json:"name"`
	Description  string                          `json:"description,omitempty"`
	AuthType     string                          `json:"authType"` // "api_key", "id", or "oauth"
	APIKey       string                          `json:"apiKey,omitempty"`
	EnvVars      []createCredentialEnvVarRequest `json:"envVars,omitempty"`
	AgentVisible *bool                           `json:"agentVisible,omitempty"`
	Visibility   *service.CredentialVisibility   `json:"visibility,omitempty"`
	Inactive     *bool                           `json:"inactive,omitempty"`
}

type CreateSessionRequest

type CreateSessionRequest struct {
	ID          string `json:"id"`
	WorkspaceID string `json:"workspaceId,omitempty"`
}

CreateSessionRequest represents the request body for creating a session without sending a message.

type DataDiskFileInfo

type DataDiskFileInfo struct {
	Path          string `json:"path"`
	ApparentBytes uint64 `json:"apparent_bytes"` // Logical file size
	ActualBytes   uint64 `json:"actual_bytes"`   // Actual disk usage (sparse-aware)
}

DataDiskFileInfo contains size information for a sparse data disk file

type DebugDockerServer

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

DebugDockerServer runs a standalone HTTP server that proxies Docker API requests to the Docker daemon inside a VZ VM. This allows using standard Docker CLI:

DOCKER_HOST=tcp://localhost:2375 docker ps

func NewDebugDockerServer

func NewDebugDockerServer(sandboxManager *sandbox.Manager, projectID string, port int) (*DebugDockerServer, error)

NewDebugDockerServer creates a new debug Docker proxy server for the given project.

func (*DebugDockerServer) Start

func (s *DebugDockerServer) Start()

Start starts the debug Docker proxy server in the background.

func (*DebugDockerServer) Stop

func (s *DebugDockerServer) Stop()

Stop stops the debug Docker proxy server.

type DiskUsageInfo

type DiskUsageInfo struct {
	TotalBytes     uint64  `json:"total_bytes"`
	UsedBytes      uint64  `json:"used_bytes"`
	AvailableBytes uint64  `json:"available_bytes"`
	UsedPercent    float64 `json:"used_percent"`
}

DiskUsageInfo contains filesystem usage statistics

type GitHubCopilotDeviceCodeRequest

type GitHubCopilotDeviceCodeRequest struct {
	DeploymentType string `json:"deploymentType"` // "github.com" or "enterprise"
	EnterpriseURL  string `json:"enterpriseUrl,omitempty"`
}

GitHubCopilotDeviceCodeRequest is the request for initiating device flow

type GitHubCopilotDeviceCodeResponse

type GitHubCopilotDeviceCodeResponse struct {
	DeviceCode      string `json:"deviceCode"`
	UserCode        string `json:"userCode"`
	VerificationURI string `json:"verificationUri"`
	ExpiresIn       int    `json:"expiresIn"`
	Interval        int    `json:"interval"`
	Domain          string `json:"domain"`
}

GitHubCopilotDeviceCodeResponse is the camelCase response for frontend

type GitHubCopilotPollRequest

type GitHubCopilotPollRequest struct {
	DeviceCode string `json:"deviceCode"`
	Domain     string `json:"domain"`
}

GitHubCopilotPollRequest is the request for polling device authorization

type GitHubCopilotPollResponse

type GitHubCopilotPollResponse struct {
	Status string `json:"status"` // "pending", "success", or "error"
	Error  string `json:"error,omitempty"`
}

GitHubCopilotPollResponse is the response for poll requests

type GitHubDeviceCodeRequest

type GitHubDeviceCodeRequest struct {
	EnterpriseURL string `json:"enterpriseUrl,omitempty"`
}

GitHubDeviceCodeRequest is the request for initiating GitHub device flow

type GitHubPollRequest

type GitHubPollRequest struct {
	DeviceCode string `json:"deviceCode"`
	Domain     string `json:"domain"`
}

GitHubPollRequest is the request for polling GitHub device authorization

type Handler

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

Handler contains all HTTP handlers

func New

func New(s *store.Store, cfg *config.Config, gitProvider git.Provider, sandboxProvider sandbox.Provider, sandboxManager *sandbox.Manager, eventBroker *events.Broker, jobQueue *jobs.Queue, systemManager *startup.SystemManager) *Handler

New creates a new Handler with the required git and sandbox providers.

func (*Handler) AcceptInvitation

func (h *Handler) AcceptInvitation(w http.ResponseWriter, r *http.Request)

AcceptInvitation accepts a project invitation

func (*Handler) AnthropicAuthorize

func (h *Handler) AnthropicAuthorize(w http.ResponseWriter, _ *http.Request)

AnthropicAuthorize generates PKCE and returns OAuth URL

func (*Handler) AnthropicExchange

func (h *Handler) AnthropicExchange(w http.ResponseWriter, r *http.Request)

AnthropicExchange exchanges code for tokens or accepts direct access tokens

func (*Handler) AuthCallback

func (h *Handler) AuthCallback(w http.ResponseWriter, r *http.Request)

AuthCallback handles OIDC callback

func (*Handler) AuthLogin

func (h *Handler) AuthLogin(w http.ResponseWriter, r *http.Request)

AuthLogin handles OIDC login redirect

func (*Handler) AuthLogout

func (h *Handler) AuthLogout(w http.ResponseWriter, r *http.Request)

AuthLogout handles user logout

func (*Handler) AuthMe

func (h *Handler) AuthMe(w http.ResponseWriter, r *http.Request)

AuthMe returns current user info

func (*Handler) BeginShutdown

func (h *Handler) BeginShutdown()

BeginShutdown closes long-lived HTTP connections owned by the handler.

func (*Handler) Chat

func (h *Handler) Chat(w http.ResponseWriter, r *http.Request)

Chat handles AI chat initiation. POST /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}/chat Request body: { messages, workspaceId?, trigger?, messageId?, model?, reasoning?, mode? } Response: JSON metadata for the initiated chat request

func (*Handler) ChatAnswer

func (h *Handler) ChatAnswer(w http.ResponseWriter, r *http.Request)

ChatAnswer submits answers to a pending AskUserQuestion for a session thread. POST /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}/answer/{questionId}

func (*Handler) ChatCancel

func (h *Handler) ChatCancel(w http.ResponseWriter, r *http.Request)

ChatCancel handles cancelling an in-progress chat completion. POST /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}/cancel

func (*Handler) ChatQuestion

func (h *Handler) ChatQuestion(w http.ResponseWriter, r *http.Request)

ChatQuestion returns the current pending AskUserQuestion for a session thread. GET /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}/question/{questionId} Returns { status: "pending", question: {...} } if that question is still waiting Returns { status: "answered", question: null } if already answered or unknown

func (*Handler) ChatStream

func (h *Handler) ChatStream(w http.ResponseWriter, r *http.Request)

ChatStream proxies the reusable thread chat SSE stream. GET /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}/stream

func (*Handler) ChatWebSocket

func (h *Handler) ChatWebSocket(w http.ResponseWriter, r *http.Request)

ChatWebSocket multiplexes project-scoped realtime streams over a single WebSocket.

Client messages:

  • {"type":"subscribe","stream":"chat","sessionId":"...","threadId":"...","replay":true,"lastEventId":"..."}
  • {"type":"unsubscribe","stream":"chat","sessionId":"...","threadId":"..."}
  • {"type":"subscribe","stream":"service","sessionId":"...","serviceId":"..."}
  • {"type":"unsubscribe","stream":"service","sessionId":"...","serviceId":"..."}
  • {"type":"subscribe","stream":"project-events","afterId":"..."}
  • {"type":"unsubscribe","stream":"project-events"}

Server messages:

  • {"type":"subscribed",...}
  • {"type":"event",...}
  • {"type":"complete",...}
  • {"type":"error",...}
  • {"type":"unsubscribed",...}

func (*Handler) CheckoutWorkspace

func (h *Handler) CheckoutWorkspace(w http.ResponseWriter, r *http.Request)

CheckoutWorkspace checks out a specific ref in a workspace

func (*Handler) Close

func (h *Handler) Close()

Close cleans up handler resources

func (*Handler) CodexAuthorize

func (h *Handler) CodexAuthorize(w http.ResponseWriter, r *http.Request)

CodexAuthorize starts the standard authorization-code flow for Codex/OpenAI OAuth.

func (*Handler) CodexCallbackStatus

func (h *Handler) CodexCallbackStatus(w http.ResponseWriter, r *http.Request)

CodexCallbackStatus reports whether the localhost:1455 callback completed.

func (*Handler) CodexDeviceCode

func (h *Handler) CodexDeviceCode(w http.ResponseWriter, r *http.Request)

CodexDeviceCode initiates the device-code flow for Codex/OpenAI OAuth.

func (*Handler) CodexExchange

func (h *Handler) CodexExchange(w http.ResponseWriter, r *http.Request)

CodexExchange exchanges a standard OAuth authorization code for tokens.

func (*Handler) CodexPoll

func (h *Handler) CodexPoll(w http.ResponseWriter, r *http.Request)

CodexPoll polls the device-code flow for completion and stores the resulting credential.

func (*Handler) CommitSession

func (h *Handler) CommitSession(w http.ResponseWriter, r *http.Request)

CommitSession initiates async commit of a session

func (*Handler) CommitWorkspace

func (h *Handler) CommitWorkspace(w http.ResponseWriter, r *http.Request)

CommitWorkspace creates a commit in a workspace

func (*Handler) CreateCredential

func (h *Handler) CreateCredential(w http.ResponseWriter, r *http.Request)

CreateCredential creates or updates a credential

func (*Handler) CreateInvitation

func (h *Handler) CreateInvitation(w http.ResponseWriter, r *http.Request)

CreateInvitation creates a project invitation

func (*Handler) CreateProject

func (h *Handler) CreateProject(w http.ResponseWriter, r *http.Request)

CreateProject creates a new project

func (*Handler) CreateSession

func (h *Handler) CreateSession(w http.ResponseWriter, r *http.Request)

CreateSession creates a new session without sending a chat message. This spins up a sandbox but does not invoke the LLM. POST /api/projects/{projectId}/sessions

func (*Handler) CreateThread

func (h *Handler) CreateThread(w http.ResponseWriter, r *http.Request)

CreateThread creates a thread in a session's sandbox. POST /api/projects/{projectId}/sessions/{sessionId}/threads

func (*Handler) CreateWorkspace

func (h *Handler) CreateWorkspace(w http.ResponseWriter, r *http.Request)

CreateWorkspace creates a new workspace

func (*Handler) DecodeJSON

func (h *Handler) DecodeJSON(r *http.Request, v any) error

DecodeJSON helper to decode request body

func (*Handler) DeleteCredential

func (h *Handler) DeleteCredential(w http.ResponseWriter, r *http.Request)

DeleteCredential deletes a credential.

func (*Handler) DeletePreference

func (h *Handler) DeletePreference(w http.ResponseWriter, r *http.Request)

DeletePreference deletes a preference by key

func (*Handler) DeleteProject

func (h *Handler) DeleteProject(w http.ResponseWriter, r *http.Request)

DeleteProject deletes a project

func (*Handler) DeleteProjectCacheVolume

func (h *Handler) DeleteProjectCacheVolume(w http.ResponseWriter, r *http.Request)

DeleteProjectCacheVolume deletes the cache volume for a project

func (*Handler) DeleteQueuedPrompt

func (h *Handler) DeleteQueuedPrompt(w http.ResponseWriter, r *http.Request)

DeleteQueuedPrompt deletes a queued prompt in a session's sandbox thread. DELETE /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}/queue/{queueId}

func (*Handler) DeleteSession

func (h *Handler) DeleteSession(w http.ResponseWriter, r *http.Request)

DeleteSession initiates async deletion of a session

func (*Handler) DeleteSessionFile

func (h *Handler) DeleteSessionFile(w http.ResponseWriter, r *http.Request)

DeleteSessionFile deletes a file or directory in a session's workspace. POST /api/projects/{projectId}/sessions/{sessionId}/files/delete

func (*Handler) DeleteThread

func (h *Handler) DeleteThread(w http.ResponseWriter, r *http.Request)

DeleteThread deletes a thread in a session's sandbox. DELETE /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}

func (*Handler) DeleteWorkspace

func (h *Handler) DeleteWorkspace(w http.ResponseWriter, r *http.Request)

DeleteWorkspace deletes a workspace Query params:

  • deleteFiles: if "true", also delete the workspace files from disk

func (*Handler) DownloadHookOutput

func (h *Handler) DownloadHookOutput(w http.ResponseWriter, r *http.Request)

DownloadHookOutput returns the full output log for a specific hook as an attachment. GET /api/projects/{projectId}/sessions/{sessionId}/hooks/{hookId}/output/download

func (*Handler) Error

func (h *Handler) Error(w http.ResponseWriter, status int, message string)

Error helper to write error responses

func (*Handler) EventBroker

func (h *Handler) EventBroker() *events.Broker

EventBroker returns the handler's event broker for SSE.

func (*Handler) Events

func (h *Handler) Events(w http.ResponseWriter, r *http.Request)

Events handles SSE event streaming for a project. GET /api/projects/{projectId}/events Query parameters:

  • since: RFC3339 timestamp to get events after (e.g., "2024-01-15T10:30:00Z")
  • after: Event ID to get events after (alternative to since)

If neither is provided, only new events from the time of connection are streamed.

func (*Handler) FetchWorkspace

func (h *Handler) FetchWorkspace(w http.ResponseWriter, r *http.Request)

FetchWorkspace fetches updates from remote for a workspace

func (*Handler) GetAuthProviders

func (h *Handler) GetAuthProviders(w http.ResponseWriter, _ *http.Request)

GetAuthProviders returns available auth providers from models.dev data

func (*Handler) GetCredential

func (h *Handler) GetCredential(w http.ResponseWriter, r *http.Request)

GetCredential returns a single credential.

func (*Handler) GetCredentialTypes

func (h *Handler) GetCredentialTypes(w http.ResponseWriter, _ *http.Request)

GetCredentialTypes returns the credential choices used by the current UI.

func (*Handler) GetHookOutput

func (h *Handler) GetHookOutput(w http.ResponseWriter, r *http.Request)

GetHookOutput returns the output log for a specific hook in a session's sandbox. GET /api/projects/{projectId}/sessions/{sessionId}/hooks/{hookId}/output

func (*Handler) GetHooksStatus

func (h *Handler) GetHooksStatus(w http.ResponseWriter, r *http.Request)

GetHooksStatus returns hook evaluation status for a session's sandbox. GET /api/projects/{projectId}/sessions/{sessionId}/hooks/status

func (*Handler) GetPreference

func (h *Handler) GetPreference(w http.ResponseWriter, r *http.Request)

GetPreference returns a single preference by key

func (*Handler) GetProject

func (h *Handler) GetProject(w http.ResponseWriter, r *http.Request)

GetProject returns a single project

func (*Handler) GetProjectModels

func (h *Handler) GetProjectModels(w http.ResponseWriter, r *http.Request)

GetProjectModels returns available models for a project based on configured credentials.

func (*Handler) GetProvider

func (h *Handler) GetProvider(w http.ResponseWriter, r *http.Request)

GetProvider returns the status of a specific sandbox provider. GET /api/projects/{projectId}/workspaces/providers/{provider}

func (*Handler) GetProviders

func (h *Handler) GetProviders(w http.ResponseWriter, _ *http.Request)

GetProviders returns all sandbox providers with their status. GET /api/projects/{projectId}/workspaces/providers

func (*Handler) GetRoutes

func (h *Handler) GetRoutes(w http.ResponseWriter, _ *http.Request)

GetRoutes returns all registered API routes with their metadata. This endpoint powers the API UI's dynamic route listing.

func (*Handler) GetServerConfig

func (h *Handler) GetServerConfig(w http.ResponseWriter, _ *http.Request)

GetServerConfig returns public server configuration

func (*Handler) GetServiceOutput

func (h *Handler) GetServiceOutput(w http.ResponseWriter, r *http.Request)

GetServiceOutput streams the output of a service via SSE. GET /api/projects/{projectId}/sessions/{sessionId}/services/{serviceId}/output

func (*Handler) GetSession

func (h *Handler) GetSession(w http.ResponseWriter, r *http.Request)

GetSession returns a single session

func (*Handler) GetSessionDiff

func (h *Handler) GetSessionDiff(w http.ResponseWriter, r *http.Request)

GetSessionDiff returns diff information for a session's workspace. GET /api/projects/{projectId}/sessions/{sessionId}/diff?format=files&path=...

func (*Handler) GetSessionModels

func (h *Handler) GetSessionModels(w http.ResponseWriter, r *http.Request)

GetSessionModels returns available models for a session based on its credentials

func (*Handler) GetSuggestions

func (h *Handler) GetSuggestions(w http.ResponseWriter, r *http.Request)

GetSuggestions returns autocomplete suggestions for directory paths. Only works when suggestions are enabled via SUGGESTIONS_ENABLED env var. Returns directories containing .git subdirectories. GET /api/projects/{projectId}/suggestions?q=/home/user&type=path

func (*Handler) GetSupportInfo

func (h *Handler) GetSupportInfo(w http.ResponseWriter, _ *http.Request)

GetSupportInfo returns comprehensive diagnostic information for debugging

func (*Handler) GetSystemStatus

func (h *Handler) GetSystemStatus(w http.ResponseWriter, _ *http.Request)

GetSystemStatus checks system requirements and returns status (including startup tasks)

func (*Handler) GetTerminalHistory

func (h *Handler) GetTerminalHistory(w http.ResponseWriter, r *http.Request)

GetTerminalHistory returns terminal history for a session

func (*Handler) GetTerminalStatus

func (h *Handler) GetTerminalStatus(w http.ResponseWriter, r *http.Request)

GetTerminalStatus returns the sandbox status

func (*Handler) GetThread

func (h *Handler) GetThread(w http.ResponseWriter, r *http.Request)

GetThread returns a single thread from a session's sandbox. GET /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}

func (*Handler) GetWorkspace

func (h *Handler) GetWorkspace(w http.ResponseWriter, r *http.Request)

GetWorkspace returns a single workspace

func (*Handler) GetWorkspaceBranches

func (h *Handler) GetWorkspaceBranches(w http.ResponseWriter, r *http.Request)

GetWorkspaceBranches returns all branches for a workspace

func (*Handler) GetWorkspaceDiff

func (h *Handler) GetWorkspaceDiff(w http.ResponseWriter, r *http.Request)

GetWorkspaceDiff returns the diff for a workspace

func (*Handler) GetWorkspaceFileContent

func (h *Handler) GetWorkspaceFileContent(w http.ResponseWriter, r *http.Request)

GetWorkspaceFileContent returns the content of a file in a workspace

func (*Handler) GetWorkspaceFileTree

func (h *Handler) GetWorkspaceFileTree(w http.ResponseWriter, r *http.Request)

GetWorkspaceFileTree returns the file tree for a workspace

func (*Handler) GetWorkspaceGitStatus

func (h *Handler) GetWorkspaceGitStatus(w http.ResponseWriter, r *http.Request)

GetWorkspaceGitStatus returns the git status for a workspace

func (*Handler) GetWorkspaceLog

func (h *Handler) GetWorkspaceLog(w http.ResponseWriter, r *http.Request)

GetWorkspaceLog returns commit history for a workspace

func (*Handler) GitHubCopilotDeviceCode

func (h *Handler) GitHubCopilotDeviceCode(w http.ResponseWriter, r *http.Request)

GitHubCopilotDeviceCode initiates device flow

func (*Handler) GitHubCopilotPoll

func (h *Handler) GitHubCopilotPoll(w http.ResponseWriter, r *http.Request)

GitHubCopilotPoll polls for device authorization

func (*Handler) GitHubDeviceCode

func (h *Handler) GitHubDeviceCode(w http.ResponseWriter, r *http.Request)

GitHubDeviceCode initiates device flow for GitHub git operations (repo scope)

func (*Handler) GitHubPoll

func (h *Handler) GitHubPoll(w http.ResponseWriter, r *http.Request)

GitHubPoll polls for GitHub device authorization

func (*Handler) JSON

func (h *Handler) JSON(w http.ResponseWriter, status int, data any)

JSON helper to write JSON responses

func (*Handler) JobQueue

func (h *Handler) JobQueue() *jobs.Queue

JobQueue returns the handler's job queue. Used by main.go to wire up dispatcher notifications.

func (*Handler) ListCredentials

func (h *Handler) ListCredentials(w http.ResponseWriter, r *http.Request)

ListCredentials returns all credentials for a project (safe info only)

func (*Handler) ListPreferences

func (h *Handler) ListPreferences(w http.ResponseWriter, r *http.Request)

ListPreferences returns all preferences for the authenticated user

func (*Handler) ListProjectCacheVolumes

func (h *Handler) ListProjectCacheVolumes(w http.ResponseWriter, r *http.Request)

ListProjectCacheVolumes lists cache volumes for a project

func (*Handler) ListProjectMembers

func (h *Handler) ListProjectMembers(w http.ResponseWriter, r *http.Request)

ListProjectMembers returns project members

func (*Handler) ListProjects

func (h *Handler) ListProjects(w http.ResponseWriter, r *http.Request)

ListProjects returns all projects for the current user

func (*Handler) ListServices

func (h *Handler) ListServices(w http.ResponseWriter, r *http.Request)

ListServices lists all services in the session's sandbox. GET /api/projects/{projectId}/sessions/{sessionId}/services

func (*Handler) ListSessionCredentialAssignments

func (h *Handler) ListSessionCredentialAssignments(w http.ResponseWriter, r *http.Request)

ListSessionCredentialAssignments returns credentials assigned to a session.

func (*Handler) ListSessionFiles

func (h *Handler) ListSessionFiles(w http.ResponseWriter, r *http.Request)

ListSessionFiles lists directory contents for a session's workspace. GET /api/projects/{projectId}/sessions/{sessionId}/files?path=.&hidden=true

func (*Handler) ListSessions

func (h *Handler) ListSessions(w http.ResponseWriter, r *http.Request)

ListSessions returns all sessions for a project.

func (*Handler) ListThreads

func (h *Handler) ListThreads(w http.ResponseWriter, r *http.Request)

ListThreads lists all threads in a session's sandbox. GET /api/projects/{projectId}/sessions/{sessionId}/threads

func (*Handler) ListWorkspaces

func (h *Handler) ListWorkspaces(w http.ResponseWriter, r *http.Request)

ListWorkspaces returns all workspaces for a project

func (*Handler) PostMCPToken

func (h *Handler) PostMCPToken(w http.ResponseWriter, r *http.Request)

PostMCPToken stores an MCP OAuth token posted by the agent after completing an OAuth exchange. The token is keyed by resource URL so it can be reused across sessions that share the same MCP server URL. Body: { "url": "https://api.example.com/mcp",

"accessToken": "...", "refreshToken": "...", "expiresAt": 1234567890 }

func (*Handler) ReadSessionFile

func (h *Handler) ReadSessionFile(w http.ResponseWriter, r *http.Request)

ReadSessionFile reads a file from a session's workspace. GET /api/projects/{projectId}/sessions/{sessionId}/files/read?path=...&fromBase=true

func (*Handler) RebaseSession

func (h *Handler) RebaseSession(w http.ResponseWriter, r *http.Request)

RebaseSession initiates async rebase of a session

func (*Handler) RefreshCredential

func (h *Handler) RefreshCredential(w http.ResponseWriter, r *http.Request)

RefreshCredential manually refreshes OAuth tokens for a credential

func (*Handler) RemoveProjectMember

func (h *Handler) RemoveProjectMember(w http.ResponseWriter, r *http.Request)

RemoveProjectMember removes a member from a project

func (*Handler) RenameSessionFile

func (h *Handler) RenameSessionFile(w http.ResponseWriter, r *http.Request)

RenameSessionFile renames/moves a file or directory in a session's workspace. POST /api/projects/{projectId}/sessions/{sessionId}/files/rename

func (*Handler) RerunHook

func (h *Handler) RerunHook(w http.ResponseWriter, r *http.Request)

RerunHook manually reruns a specific hook in a session's sandbox. POST /api/projects/{projectId}/sessions/{sessionId}/hooks/{hookId}/rerun

func (*Handler) SearchSessionFiles

func (h *Handler) SearchSessionFiles(w http.ResponseWriter, r *http.Request)

SearchSessionFiles performs a fuzzy search over a session's workspace files. GET /api/projects/{projectId}/sessions/{sessionId}/files/search?q=...&limit=50

func (*Handler) SetPreference

func (h *Handler) SetPreference(w http.ResponseWriter, r *http.Request)

SetPreference creates or updates a preference

func (*Handler) SetPreferences

func (h *Handler) SetPreferences(w http.ResponseWriter, r *http.Request)

SetPreferences sets multiple preferences at once

func (*Handler) SetSessionCredentialAssignments

func (h *Handler) SetSessionCredentialAssignments(w http.ResponseWriter, r *http.Request)

SetSessionCredentialAssignments replaces credentials assigned to a session.

func (*Handler) StageWorkspaceFiles

func (h *Handler) StageWorkspaceFiles(w http.ResponseWriter, r *http.Request)

StageWorkspaceFiles stages files for commit

func (*Handler) StartService

func (h *Handler) StartService(w http.ResponseWriter, r *http.Request)

StartService starts a service in the session's sandbox. POST /api/projects/{projectId}/sessions/{sessionId}/services/{serviceId}/start

func (*Handler) StopService

func (h *Handler) StopService(w http.ResponseWriter, r *http.Request)

StopService stops a service in the session's sandbox. POST /api/projects/{projectId}/sessions/{sessionId}/services/{serviceId}/stop

func (*Handler) TerminalWebSocket

func (h *Handler) TerminalWebSocket(w http.ResponseWriter, r *http.Request)

TerminalWebSocket handles WebSocket terminal connections.

Each (sandboxSession, user) pair has one persistent PTY managed by h.terminalManager. Navigating away and returning reconnects to the same shell — the output buffer is replayed so the client sees recent history.

func (*Handler) UpdateProject

func (h *Handler) UpdateProject(w http.ResponseWriter, r *http.Request)

UpdateProject updates a project

func (*Handler) UpdateSession

func (h *Handler) UpdateSession(w http.ResponseWriter, r *http.Request)

UpdateSession updates a session

func (*Handler) UpdateThread

func (h *Handler) UpdateThread(w http.ResponseWriter, r *http.Request)

UpdateThread updates a thread in a session's sandbox. PUT/PATCH /api/projects/{projectId}/sessions/{sessionId}/threads/{threadId}

func (*Handler) UpdateWorkspace

func (h *Handler) UpdateWorkspace(w http.ResponseWriter, r *http.Request)

UpdateWorkspace updates a workspace

func (*Handler) ValidateWorkspace

func (h *Handler) ValidateWorkspace(w http.ResponseWriter, r *http.Request)

ValidateWorkspace validates a workspace path/repo and returns suggestions. POST /api/projects/{projectId}/workspaces/validate

func (*Handler) WriteSessionFile

func (h *Handler) WriteSessionFile(w http.ResponseWriter, r *http.Request)

WriteSessionFile writes a file to a session's workspace. PUT /api/projects/{projectId}/sessions/{sessionId}/files/write

func (*Handler) WriteWorkspaceFile

func (h *Handler) WriteWorkspaceFile(w http.ResponseWriter, r *http.Request)

WriteWorkspaceFile writes content to a file in a workspace

type ModelInfo

type ModelInfo struct {
	ID               string   `json:"id"`
	Name             string   `json:"name"`
	Provider         string   `json:"provider"`
	Description      string   `json:"description,omitempty"`
	Reasoning        bool     `json:"reasoning,omitempty"` // Whether model supports extended thinking
	ReasoningLevels  []string `json:"reasoningLevels,omitempty"`
	DefaultReasoning string   `json:"defaultReasoning,omitempty"`
}

ModelInfo represents a model in the API response

type ModelsResponse

type ModelsResponse struct {
	Models []ModelInfo `json:"models"`
}

ModelsResponse contains the list of available models

type ResizeData

type ResizeData struct {
	Rows int `json:"rows"`
	Cols int `json:"cols"`
}

ResizeData contains terminal resize dimensions

type RuntimeInfo

type RuntimeInfo struct {
	OS           string `json:"os"`
	Arch         string `json:"arch"`
	GoVersion    string `json:"go_version"`
	NumCPU       int    `json:"num_cpu"`
	NumGoroutine int    `json:"num_goroutine"`
}

RuntimeInfo contains Go runtime information

type ServerConfigResponse

type ServerConfigResponse struct {
	SSHPort       int    `json:"ssh_port"`
	HTTPPort      int    `json:"http_port"`
	HTTPSPort     int    `json:"https_port,omitempty"`
	HTTPSTLSMode  string `json:"https_tls_mode,omitempty"`
	PublicBaseURL string `json:"public_base_url"`
}

ServerConfigResponse contains public server configuration for the frontend

type Suggestion

type Suggestion struct {
	Value          string `json:"value"`
	Type           string `json:"type"`
	Valid          bool   `json:"valid"`
	Classification string `json:"classification,omitempty"`
}

Suggestion represents an autocomplete suggestion

type SupportInfoResponse

type SupportInfoResponse struct {
	Version    string                       `json:"version"`
	Runtime    RuntimeInfo                  `json:"runtime"`
	Config     ConfigInfo                   `json:"config"`
	ServerLog  string                       `json:"server_log"`
	LogPath    string                       `json:"log_path"`
	LogExists  bool                         `json:"log_exists"`
	SystemInfo startup.SystemStatusResponse `json:"system_info"`
}

SupportInfoResponse contains diagnostic information for debugging and support

type TerminalMessage

type TerminalMessage struct {
	Type string          `json:"type"` // "input", "output", "resize", "error"
	Data json.RawMessage `json:"data,omitempty"`
}

TerminalMessage represents a message sent over the WebSocket

type VZInfo

type VZInfo struct {
	ImageRef     string             `json:"image_ref"`
	DataDir      string             `json:"data_dir"`
	CPUCount     int                `json:"cpu_count"`
	MemoryMB     int                `json:"memory_mb"`
	DataDiskGB   int                `json:"data_disk_gb"`
	DiskUsage    *DiskUsageInfo     `json:"disk_usage,omitempty"`
	DataDisks    []DataDiskFileInfo `json:"data_disks,omitempty"`
	KernelPath   string             `json:"kernel_path,omitempty"`
	InitrdPath   string             `json:"initrd_path,omitempty"`
	BaseDiskPath string             `json:"base_disk_path,omitempty"`
}

VZInfo contains VZ-specific configuration and disk usage information

Jump to

Keyboard shortcuts

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