desk

package
v1.261015.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MPL-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) Archive

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

func (*Handler) CreateSession

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

func (*Handler) GetSession

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

func (*Handler) Handoff

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

func (*Handler) Interrupt

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

func (*Handler) ListSessions

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

func (*Handler) Messages

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

func (*Handler) PermissionModes

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

func (*Handler) RecentFolders

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

func (*Handler) RegisterRoutes added in v1.261002.1

func (h *Handler) RegisterRoutes(rt *module.Routes)

RegisterRoutes wires /desk onto the authenticated V1 group. Every route 404s while the handler's gate (see WithGate) reports the feature off.

func (*Handler) Respond

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

func (*Handler) SendMessage

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

func (*Handler) SetModel

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

func (*Handler) SetPermissionMode

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

func (*Handler) SetProfile

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

func (*Handler) Status

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

func (*Handler) StopTask

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

func (*Handler) TaskOutput

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

func (*Handler) WithGate added in v1.261002.1

func (h *Handler) WithGate(enabled func() bool) *Handler

WithGate sets the feature-flag predicate that every route is gated on.

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 RespondRequest struct {
	RequestID string `json:"request_id" binding:"required"`
	Approved  bool   `json:"approved"`
	Answer    string `json:"answer"`
}

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.

Jump to

Keyboard shortcuts

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