requests.go

 1package proto
 2
 3import "github.com/charmbracelet/crush/internal/config"
 4
 5// ConfigSetRequest represents a request to set a config field.
 6type ConfigSetRequest struct {
 7	Scope config.Scope `json:"scope"`
 8	Key   string       `json:"key"`
 9	Value any          `json:"value"`
10}
11
12// ConfigRemoveRequest represents a request to remove a config field.
13type ConfigRemoveRequest struct {
14	Scope config.Scope `json:"scope"`
15	Key   string       `json:"key"`
16}
17
18// ConfigModelRequest represents a request to update the preferred model.
19type ConfigModelRequest struct {
20	Scope     config.Scope             `json:"scope"`
21	ModelType config.SelectedModelType `json:"model_type"`
22	Model     config.SelectedModel     `json:"model"`
23}
24
25// ConfigCompactRequest represents a request to set compact mode.
26type ConfigCompactRequest struct {
27	Scope   config.Scope `json:"scope"`
28	Enabled bool         `json:"enabled"`
29}
30
31// ConfigProviderKeyRequest represents a request to set a provider API key.
32type ConfigProviderKeyRequest struct {
33	Scope      config.Scope `json:"scope"`
34	ProviderID string       `json:"provider_id"`
35	APIKey     any          `json:"api_key"`
36}
37
38// ConfigRefreshOAuthRequest represents a request to refresh an OAuth token.
39type ConfigRefreshOAuthRequest struct {
40	Scope      config.Scope `json:"scope"`
41	ProviderID string       `json:"provider_id"`
42}
43
44// ImportCopilotResponse represents the response from importing Copilot credentials.
45type ImportCopilotResponse struct {
46	Token   any  `json:"token"`
47	Success bool `json:"success"`
48}
49
50// ProjectNeedsInitResponse represents whether a project needs initialization.
51type ProjectNeedsInitResponse struct {
52	NeedsInit bool `json:"needs_init"`
53}
54
55// ProjectInitPromptResponse represents the project initialization prompt.
56type ProjectInitPromptResponse struct {
57	Prompt string `json:"prompt"`
58}
59
60// LSPStartRequest represents a request to start an LSP for a path.
61type LSPStartRequest struct {
62	Path string `json:"path"`
63}
64
65// FileTrackerReadRequest represents a request to record a file read.
66type FileTrackerReadRequest struct {
67	SessionID string `json:"session_id"`
68	Path      string `json:"path"`
69}
70
71// MCPNameRequest represents a request targeting a named MCP server.
72type MCPNameRequest struct {
73	Name string `json:"name"`
74}
75
76// MCPReadResourceRequest represents a request to read an MCP resource.
77type MCPReadResourceRequest struct {
78	Name string `json:"name"`
79	URI  string `json:"uri"`
80}
81
82// MCPGetPromptRequest represents a request to get an MCP prompt.
83type MCPGetPromptRequest struct {
84	ClientID string            `json:"client_id"`
85	PromptID string            `json:"prompt_id"`
86	Args     map[string]string `json:"args"`
87}
88
89// MCPGetPromptResponse represents the response from getting an MCP prompt.
90type MCPGetPromptResponse struct {
91	Prompt string `json:"prompt"`
92}