api

package
v0.260213.1830-hotfix Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminHandler

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

AdminHandler handles admin API requests

func NewAdminHandler

func NewAdminHandler(sessionMgr *session.Manager, auditLogger *audit.Logger, rateLimiter *middleware.RateLimiter, cfg *config.Config) *AdminHandler

NewAdminHandler creates a new admin handler

func (*AdminHandler) GenerateToken

func (h *AdminHandler) GenerateToken(c *gin.Context)

GenerateToken handles POST /admin/tokens/generate

func (*AdminHandler) GetAuditLogs

func (h *AdminHandler) GetAuditLogs(c *gin.Context)

GetAuditLogs handles GET /admin/logs Query params: page, limit, action, user_id, start_date, end_date

func (*AdminHandler) GetRateLimitStats

func (h *AdminHandler) GetRateLimitStats(c *gin.Context)

GetRateLimitStats handles GET /admin/ratelimit/stats

func (*AdminHandler) GetStats

func (h *AdminHandler) GetStats(c *gin.Context)

GetStats handles GET /admin/stats

func (*AdminHandler) ResetRateLimit

func (h *AdminHandler) ResetRateLimit(c *gin.Context)

ResetRateLimit handles POST /admin/ratelimit/reset

func (*AdminHandler) RevokeToken

func (h *AdminHandler) RevokeToken(c *gin.Context)

RevokeToken handles POST /admin/tokens/revoke

func (*AdminHandler) ValidateToken

func (h *AdminHandler) ValidateToken(c *gin.Context)

ValidateToken handles POST /admin/tokens/validate

type AuditLogEntry

type AuditLogEntry struct {
	Timestamp  string                 `json:"timestamp"`
	Level      string                 `json:"level"`
	Action     string                 `json:"action"`
	UserID     string                 `json:"user_id"`
	ClientIP   string                 `json:"client_ip"`
	SessionID  string                 `json:"session_id"`
	RequestID  string                 `json:"request_id"`
	Success    bool                   `json:"success"`
	DurationMs int64                  `json:"duration_ms"`
	Details    map[string]interface{} `json:"details,omitempty"`
}

AuditLogEntry represents an audit log entry for API response

type BotSettingsHandler

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

func NewBotSettingsHandler

func NewBotSettingsHandler(store *bot.Store) *BotSettingsHandler

func (*BotSettingsHandler) GetSettings

func (h *BotSettingsHandler) GetSettings(c *gin.Context)

func (*BotSettingsHandler) UpdateSettings

func (h *BotSettingsHandler) UpdateSettings(c *gin.Context)

type BotSettingsPayload

type BotSettingsPayload struct {
	Token         string   `json:"token"`
	Platform      string   `json:"platform"`
	ProxyURL      string   `json:"proxy_url"`
	ChatID        string   `json:"chat_id"`
	BashAllowlist []string `json:"bash_allowlist"`
}

type CloseRequest

type CloseRequest struct {
	SessionID string `json:"session_id" binding:"required"`
}

CloseRequest represents the close request body

type CloseResponse

type CloseResponse struct {
	SessionID string `json:"session_id"`
	Status    string `json:"status"`
	Message   string `json:"message,omitempty"`
}

CloseResponse represents the close response

type ExecuteRequest

type ExecuteRequest struct {
	SessionID string `json:"session_id" binding:"required"`
	Request   string `json:"request" binding:"required"`
}

ExecuteRequest represents the execute request body

type ExecuteResponse

type ExecuteResponse struct {
	SessionID string `json:"session_id"`
	Status    string `json:"status"`
	Summary   string `json:"summary"`
	Error     string `json:"error,omitempty"`
}

ExecuteResponse represents the execute response

type GenerateTokenRequest

type GenerateTokenRequest struct {
	ClientID    string `json:"client_id" binding:"required"`
	Description string `json:"description,omitempty"`
	ExpiryHours int    `json:"expiry_hours,omitempty"` // 0 = no expiry
}

GenerateTokenRequest represents the request body for generating a token

type Handler

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

Handler handles API requests

func NewHandler

func NewHandler(sessionMgr *session.Manager, claude *launcher.ClaudeCodeLauncher, summary *summarizer.Engine, auditLogger *audit.Logger) *Handler

NewHandler creates a new API handler

func (*Handler) Close

func (h *Handler) Close(c *gin.Context)

Close handles POST /remote-coder/close

func (*Handler) Execute

func (h *Handler) Execute(c *gin.Context)

Execute handles POST /remote-coder/execute

func (*Handler) Handshake

func (h *Handler) Handshake(c *gin.Context)

Handshake handles POST /remote-coder/handshake

func (*Handler) Status

func (h *Handler) Status(c *gin.Context)

Status handles GET /remote-coder/status/:session_id

type HandshakeRequest

type HandshakeRequest struct {
}

HandshakeRequest represents the handshake request body

type HandshakeResponse

type HandshakeResponse struct {
	SessionID string `json:"session_id"`
	Status    string `json:"status"`
	ExpiresAt string `json:"expires_at"`
}

HandshakeResponse represents the handshake response

type ListTokensRequest

type ListTokensRequest struct {
	ActiveOnly bool `json:"active_only,omitempty"`
}

ListTokensRequest represents the request body for listing tokens

type RemoteCCHandler

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

RemoteCCHandler handles remote Claude Code requests

func NewRemoteCCHandler

func NewRemoteCCHandler(sessionMgr *session.Manager, claudeLauncher *launcher.ClaudeCodeLauncher, summaryEngine *summarizer.Engine, auditLogger *audit.Logger, cfg *config.Config) *RemoteCCHandler

NewRemoteCCHandler creates a new remote-coder handler

func (*RemoteCCHandler) Chat

func (h *RemoteCCHandler) Chat(c *gin.Context)

Chat handles POST /remote-coder/chat

func (*RemoteCCHandler) ClearSessions

func (h *RemoteCCHandler) ClearSessions(c *gin.Context)

ClearSessions handles POST /remote-coder/sessions/clear

func (*RemoteCCHandler) GetSession

func (h *RemoteCCHandler) GetSession(c *gin.Context)

GetSession handles GET /remote-coder/sessions/:id

func (*RemoteCCHandler) GetSessionMessages

func (h *RemoteCCHandler) GetSessionMessages(c *gin.Context)

GetSessionMessages handles GET /remote-coder/sessions/:id/messages

func (*RemoteCCHandler) GetSessionState

func (h *RemoteCCHandler) GetSessionState(c *gin.Context)

GetSessionState handles GET /remote-coder/sessions/:id/state

func (*RemoteCCHandler) GetSessions

func (h *RemoteCCHandler) GetSessions(c *gin.Context)

GetSessions handles GET /remote-coder/sessions

func (*RemoteCCHandler) UpdateSessionState

func (h *RemoteCCHandler) UpdateSessionState(c *gin.Context)

UpdateSessionState handles PUT /remote-coder/sessions/:id/state

type RemoteChatMessage

type RemoteChatMessage struct {
	Role      string `json:"role"`
	Content   string `json:"content"`
	Summary   string `json:"summary,omitempty"`
	Timestamp string `json:"timestamp"`
}

RemoteChatMessage represents a chat message for API response

type RemoteChatRequest

type RemoteChatRequest struct {
	SessionID string                 `json:"session_id,omitempty"`
	Message   string                 `json:"message" binding:"required"`
	Context   map[string]interface{} `json:"context,omitempty"`
}

RemoteChatRequest represents a chat request to Claude Code

type RemoteChatResponse

type RemoteChatResponse struct {
	SessionID    string `json:"session_id"`
	Message      string `json:"message"`
	Summary      string `json:"summary"`                 // Chopped/summarized response
	FullResponse string `json:"full_response,omitempty"` // Full response (if requested)
	Success      bool   `json:"success"`
	Error        string `json:"error,omitempty"`
}

RemoteChatResponse represents a chat response from Claude Code

type RemoteSession

type RemoteSession struct {
	ID           string `json:"id"`
	Status       string `json:"status"`
	Request      string `json:"request,omitempty"`
	Response     string `json:"response,omitempty"`
	Error        string `json:"error,omitempty"`
	CreatedAt    string `json:"created_at"`
	LastActivity string `json:"last_activity"`
	ExpiresAt    string `json:"expires_at"`
	ProjectPath  string `json:"project_path,omitempty"`
}

RemoteSession represents a remote session for API response

type RemoteSessionState

type RemoteSessionState struct {
	ProjectPath      string `json:"project_path,omitempty"`
	ExpandedMessages []int  `json:"expanded_messages,omitempty"`
}

RemoteSessionState represents persisted UI/session state

type RemoteSessionStateUpdate

type RemoteSessionStateUpdate struct {
	ProjectPath      *string `json:"project_path,omitempty"`
	ExpandedMessages *[]int  `json:"expanded_messages,omitempty"`
}

RemoteSessionStateUpdate represents a partial update to session state

type ResetRateLimitRequest

type ResetRateLimitRequest struct {
	IP string `json:"ip"`
}

ResetRateLimitRequest represents the request body for resetting rate limit

type RevokeTokenRequest

type RevokeTokenRequest struct {
	ClientID string `json:"client_id" binding:"required"`
}

RevokeTokenRequest represents the request body for revoking a token

type StatsResponse

type StatsResponse struct {
	TotalSessions     int                    `json:"total_sessions"`
	ActiveSessions    int                    `json:"active_sessions"`
	CompletedSessions int                    `json:"completed_sessions"`
	FailedSessions    int                    `json:"failed_sessions"`
	ClosedSessions    int                    `json:"closed_sessions"`
	RecentActions     map[string]int         `json:"recent_actions"`
	Uptime            string                 `json:"uptime"`
	RateLimitStats    map[string]interface{} `json:"rate_limit_stats"`
}

StatsResponse represents the stats response

type StatusResponse

type StatusResponse struct {
	SessionID    string `json:"session_id"`
	Status       string `json:"status"`
	Request      string `json:"request,omitempty"`
	Summary      string `json:"summary,omitempty"`
	Error        string `json:"error,omitempty"`
	CreatedAt    string `json:"created_at"`
	LastActivity string `json:"last_activity"`
	ExpiresAt    string `json:"expires_at"`
}

StatusResponse represents the status response

type TokenInfo

type TokenInfo struct {
	Token     string `json:"token"`
	ClientID  string `json:"client_id"`
	ExpiresAt string `json:"expires_at"`
	CreatedAt string `json:"created_at"`
}

TokenInfo represents token information for response

type TokenValidationResult

type TokenValidationResult struct {
	Valid    bool   `json:"valid"`
	ClientID string `json:"client_id,omitempty"`
	Message  string `json:"message,omitempty"`
}

TokenValidationResult represents the result of token validation

Jump to

Keyboard shortcuts

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