first commit
This commit is contained in:
@@ -7,29 +7,33 @@ import "encoding/json"
|
||||
type RPCCommand struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id,omitempty"`
|
||||
// prompt fields
|
||||
Text string `json:"text,omitempty"`
|
||||
Images []ChatImage `json:"images,omitempty"`
|
||||
// model / thinking fields
|
||||
Provider string `json:"provider,omitempty"`
|
||||
ModelID string `json:"modelId,omitempty"`
|
||||
Budget *int `json:"budget,omitempty"`
|
||||
// session fields
|
||||
Path string `json:"path,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
// streaming behaviour
|
||||
StreamingBehavior string `json:"streamingBehavior,omitempty"`
|
||||
// slash dispatch passthrough
|
||||
Args string `json:"args,omitempty"`
|
||||
// extension ui
|
||||
Response json.RawMessage `json:"response,omitempty"`
|
||||
// prompt / steer / follow_up
|
||||
Message string `json:"message,omitempty"`
|
||||
Images []ChatImage `json:"images,omitempty"`
|
||||
StreamingBehavior string `json:"streamingBehavior,omitempty"`
|
||||
// model / thinking
|
||||
Provider string `json:"provider,omitempty"`
|
||||
ModelID string `json:"modelId,omitempty"`
|
||||
Level json.RawMessage `json:"level,omitempty"`
|
||||
// session
|
||||
SessionPath string `json:"sessionPath,omitempty"`
|
||||
CwdOverride string `json:"cwdOverride,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
// bash
|
||||
Command string `json:"command,omitempty"`
|
||||
ExcludeFromContext bool `json:"excludeFromContext,omitempty"`
|
||||
}
|
||||
|
||||
// RPCResponse mirrors the pi CLI response frame:
|
||||
//
|
||||
// {"type":"response","id":"req_1","command":"get_state","success":true,"data":{...},"error":"..."}
|
||||
type RPCResponse struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Result json.RawMessage `json:"result,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Command string `json:"command,omitempty"`
|
||||
Success bool `json:"success"`
|
||||
Data json.RawMessage `json:"data,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// Raw event line forwarded to SSE clients as-is
|
||||
@@ -130,7 +134,7 @@ type SetModelRequest struct {
|
||||
}
|
||||
|
||||
type SetThinkingRequest struct {
|
||||
Budget *int `json:"budget"` // nil = disable
|
||||
Level json.RawMessage `json:"level"` // string ("high"/"off"...) or number
|
||||
}
|
||||
|
||||
// ── Commands ─────────────────────────────────────────────────────────────────
|
||||
@@ -148,8 +152,8 @@ type CommandsResponse struct {
|
||||
// ── WebUI Config ──────────────────────────────────────────────────────────────
|
||||
|
||||
type AvatarsResponse struct {
|
||||
UserAvatar string `json:"userAvatar,omitempty"`
|
||||
AssistantAvatar string `json:"assistantAvatar,omitempty"`
|
||||
UserAvatarURL string `json:"userAvatarUrl"`
|
||||
AgentAvatarURL string `json:"agentAvatarUrl"`
|
||||
}
|
||||
|
||||
type WebuiConfigResponse struct {
|
||||
@@ -171,46 +175,53 @@ type WebuiConfigDeleteRequest struct {
|
||||
}
|
||||
|
||||
// ── Settings ──────────────────────────────────────────────────────────────────
|
||||
// Field names mirror the frontend SettingsData contract (frontend/src/types/events.ts).
|
||||
|
||||
type SkillInfo struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Path string `json:"path"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Toggleable bool `json:"toggleable"`
|
||||
}
|
||||
|
||||
type ExtensionInfo struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Source string `json:"source"` // local | npm
|
||||
Commands []string `json:"commands,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Category string `json:"category,omitempty"` // local | npm
|
||||
Source string `json:"source,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Toggleable bool `json:"toggleable"` // only local extensions can be toggled
|
||||
Commands []string `json:"commands,omitempty"`
|
||||
}
|
||||
|
||||
type MCPTool struct {
|
||||
Server string `json:"server,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Disabled bool `json:"disabled"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
type MCPServer struct {
|
||||
Name string `json:"name"`
|
||||
Disabled bool `json:"disabled"`
|
||||
Tools []MCPTool `json:"tools,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Configured bool `json:"configured"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ToolCount int `json:"toolCount"`
|
||||
EnabledToolCount int `json:"enabledToolCount"`
|
||||
Tools []MCPTool `json:"tools,omitempty"`
|
||||
}
|
||||
|
||||
type SettingsResponse struct {
|
||||
Skills []SkillInfo `json:"skills"`
|
||||
Extensions []ExtensionInfo `json:"extensions"`
|
||||
MCPServers []MCPServer `json:"mcpServers"`
|
||||
SystemPrompt string `json:"systemPrompt,omitempty"`
|
||||
ModelsConfig string `json:"modelsConfig,omitempty"`
|
||||
// SkillToggleRequest / ExtensionToggleRequest identify the target by path.
|
||||
type SkillToggleRequest struct {
|
||||
Path string `json:"path"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
type ToggleRequest struct {
|
||||
ID string `json:"id"`
|
||||
type ExtensionToggleRequest struct {
|
||||
Path string `json:"path"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
@@ -225,24 +236,19 @@ type MCPToolToggleRequest struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// SystemPromptRequest uses a pointer so a missing field is distinguishable from
|
||||
// an empty string — guards against accidentally clearing the file.
|
||||
type SystemPromptRequest struct {
|
||||
Content string `json:"content"`
|
||||
SystemPrompt *string `json:"systemPrompt"`
|
||||
}
|
||||
|
||||
type ModelsConfigRequest struct {
|
||||
Content string `json:"content"`
|
||||
ModelsConfig *string `json:"modelsConfig"`
|
||||
}
|
||||
|
||||
type AvatarsSetRequest struct {
|
||||
UserAvatar string `json:"userAvatar,omitempty"`
|
||||
AssistantAvatar string `json:"assistantAvatar,omitempty"`
|
||||
}
|
||||
|
||||
type EnvironmentResponse struct {
|
||||
Platform string `json:"platform"`
|
||||
Arch string `json:"arch"`
|
||||
Hostname string `json:"hostname"`
|
||||
Version string `json:"version"`
|
||||
UserAvatarURL string `json:"userAvatarUrl"`
|
||||
AgentAvatarURL string `json:"agentAvatarUrl"`
|
||||
}
|
||||
|
||||
// ── Extension UI ──────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user