Documentation
¶
Overview ¶
Package desk exposes the /api/v1/desk HTTP endpoints backed by internal/desk.Service — a web front door onto the same remote/session + agentboot machinery IM's @cc already drives.
Index ¶
- func RegisterRoutes(apiV1 *swagger.RouteGroup, h *Handler, enabled func() bool)
- type BackgroundTaskInfo
- type CreateSessionRequest
- type Handler
- func (h *Handler) Archive(c *gin.Context)
- func (h *Handler) CreateSession(c *gin.Context)
- func (h *Handler) GetSession(c *gin.Context)
- func (h *Handler) Handoff(c *gin.Context)
- func (h *Handler) Interrupt(c *gin.Context)
- func (h *Handler) ListSessions(c *gin.Context)
- func (h *Handler) Messages(c *gin.Context)
- func (h *Handler) PermissionModes(c *gin.Context)
- func (h *Handler) RecentFolders(c *gin.Context)
- func (h *Handler) Respond(c *gin.Context)
- func (h *Handler) SendMessage(c *gin.Context)
- func (h *Handler) SetModel(c *gin.Context)
- func (h *Handler) SetPermissionMode(c *gin.Context)
- func (h *Handler) SetProfile(c *gin.Context)
- func (h *Handler) Status(c *gin.Context)
- func (h *Handler) StopTask(c *gin.Context)
- func (h *Handler) TaskOutput(c *gin.Context)
- type HandoffResponse
- type MessageInfo
- type MessageListResponse
- type PermissionModesResponse
- type QuotaSegmentInfo
- type RecentFoldersResponse
- type RespondRequest
- type RouteResolver
- type SendMessageRequest
- type SessionInfo
- type SessionListResponse
- type SessionStatusResponse
- type SetModelRequest
- type SetPermissionModeRequest
- type SetProfileRequest
- type TaskOutputResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes(apiV1 *swagger.RouteGroup, h *Handler, enabled func() bool)
RegisterRoutes wires /desk onto an authenticated route group. enabled reports whether the desk feature flag is on; every route 404s while it is off (see gate).
Types ¶
type BackgroundTaskInfo ¶
type BackgroundTaskInfo struct {
TaskID string `json:"task_id"`
// TaskType is "local_bash" (a shell command) or "local_agent" (a subagent).
TaskType string `json:"task_type"`
Description string `json:"description"`
}
HandoffResponse is the shell command that continues a session in a terminal, run from anywhere on the tingly-box host. BackgroundTaskInfo is one running background task.
type CreateSessionRequest ¶
type CreateSessionRequest struct {
Path string `json:"path" binding:"required"`
Prompt string `json:"prompt" binding:"required"`
PermissionMode string `json:"permission_mode"`
// Profile is a Claude Code profile id; empty uses the main claude_code routing.
Profile string `json:"profile"`
// Model is a model tier alias from GET /scenario/claude_code/models;
// empty is the profile's default.
Model string `json:"model"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(svc *desk.Service, routes RouteResolver) *Handler
func (*Handler) CreateSession ¶
func (*Handler) GetSession ¶
func (*Handler) ListSessions ¶
func (*Handler) PermissionModes ¶
func (*Handler) RecentFolders ¶
func (*Handler) SendMessage ¶
func (*Handler) SetPermissionMode ¶
func (*Handler) SetProfile ¶
func (*Handler) TaskOutput ¶
type HandoffResponse ¶
type HandoffResponse struct {
Command string `json:"command"`
}
type MessageInfo ¶
type MessageInfo struct {
Role string `json:"role,omitempty"`
Content string `json:"content"`
Kind string `json:"kind,omitempty"`
RequestID string `json:"request_id,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
// Parent is the tool_use id of the subagent call that produced this
// entry; empty for the main conversation.
Parent string `json:"parent,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
MessageInfo is the wire shape of a session.Message.
type MessageListResponse ¶
type MessageListResponse struct {
Messages []MessageInfo `json:"messages"`
}
type PermissionModesResponse ¶
type PermissionModesResponse struct {
Modes []string `json:"modes"`
}
type QuotaSegmentInfo ¶
type QuotaSegmentInfo struct {
Type string `json:"type"`
Balance bool `json:"balance"`
// Text is the value as the terminal status line renders it:
// "60% left", "12K/100K left", "$12.40".
Text string `json:"text"`
UsedPercent float64 `json:"used_percent"`
ResetsAt *time.Time `json:"resets_at,omitempty"`
LimitReached bool `json:"limit_reached"`
}
QuotaSegmentInfo is one quota window of the routed provider.
type RecentFoldersResponse ¶
type RecentFoldersResponse struct {
Folders []desk.RecentFolder `json:"folders"`
}
type RespondRequest ¶
type RouteResolver ¶
type RouteResolver interface {
ResolveRoute(ctx context.Context, scenario, modelID string) *statusline.Route
}
RouteResolver resolves where a model request is routed and the quota it draws on, the way the terminal status line does (statusline.Handler).
type SendMessageRequest ¶
type SendMessageRequest struct {
Text string `json:"text" binding:"required"`
}
type SessionInfo ¶
type SessionInfo struct {
ID string `json:"id"`
Project string `json:"project"`
Status string `json:"status"`
Request string `json:"request"`
Response string `json:"response"`
Error string `json:"error,omitempty"`
PermissionMode string `json:"permission_mode"`
Profile string `json:"profile"`
// Model is the model tier alias ("opus", "sonnet", "haiku"); empty is
// the profile's default model.
Model string `json:"model"`
// AwaitingInput is true while the session's turn waits on an approval
// or a question from the user.
AwaitingInput bool `json:"awaiting_input"`
// BackgroundTasks are the background tasks (shell commands, subagents)
// the session's process is running now; empty once it has none or the
// process is gone.
BackgroundTasks []BackgroundTaskInfo `json:"background_tasks"`
CreatedAt time.Time `json:"created_at"`
LastActivity time.Time `json:"last_activity"`
}
SessionInfo is the wire shape of a session.Session: the same fields, snake_case, with no internal-only detail added.
type SessionListResponse ¶
type SessionListResponse struct {
Sessions []SessionInfo `json:"sessions"`
}
type SessionStatusResponse ¶
type SessionStatusResponse struct {
// Scenario is the gateway scenario the session's turns go through:
// "claude_code" or "claude_code:<profile id>".
Scenario string `json:"scenario"`
// RequestedModel is the model id the session's next turn asks for (its
// chosen tier), else the one its latest turn asked for; empty if neither
// is known, in which case nothing below is set.
RequestedModel string `json:"requested_model,omitempty"`
ProviderName string `json:"provider_name,omitempty"`
ProviderModel string `json:"provider_model,omitempty"`
Quota []QuotaSegmentInfo `json:"quota"`
}
SessionStatusResponse is the tingly-box half of a session's status line: where its model requests are routed and the quota they draw on. The token half comes from the transcript's "usage" entries.
type SetModelRequest ¶
type SetModelRequest struct {
// Model is a model tier alias from GET /scenario/claude_code/models;
// empty is the profile's default.
Model string `json:"model"`
}
type SetPermissionModeRequest ¶
type SetPermissionModeRequest struct {
Mode string `json:"mode"`
}
type SetProfileRequest ¶
type SetProfileRequest struct {
// Profile is a Claude Code profile id; empty switches back to the main
// claude_code routing.
Profile string `json:"profile"`
}
type TaskOutputResponse ¶
type TaskOutputResponse struct {
Content string `json:"content"`
// Truncated means the file is longer than Content; Size is its length.
Truncated bool `json:"truncated"`
Size int64 `json:"size"`
}
TaskOutputResponse is the end of a background task's output file.