| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- import { z } from "zod"
- import {
- type ProviderSettings,
- type PromptComponent,
- type ModeConfig,
- type InstallMarketplaceItemOptions,
- type MarketplaceItem,
- marketplaceItemSchema,
- } from "@roo-code/types"
- import type { ShareVisibility } from "@roo-code/cloud"
- import { Mode } from "./modes"
- export type ClineAskResponse = "yesButtonClicked" | "noButtonClicked" | "messageResponse" | "objectResponse"
- export type PromptMode = Mode | "enhance"
- export type AudioType = "notification" | "celebration" | "progress_loop"
- export interface UpdateTodoListPayload {
- todos: any[]
- }
- export interface WebviewMessage {
- type:
- | "updateTodoList"
- | "deleteMultipleTasksWithIds"
- | "currentApiConfigName"
- | "saveApiConfiguration"
- | "upsertApiConfiguration"
- | "deleteApiConfiguration"
- | "loadApiConfiguration"
- | "loadApiConfigurationById"
- | "renameApiConfiguration"
- | "getListApiConfiguration"
- | "customInstructions"
- | "allowedCommands"
- | "deniedCommands"
- | "alwaysAllowReadOnly"
- | "alwaysAllowReadOnlyOutsideWorkspace"
- | "alwaysAllowWrite"
- | "alwaysAllowWriteOutsideWorkspace"
- | "alwaysAllowWriteProtected"
- | "alwaysAllowExecute"
- | "alwaysAllowFollowupQuestions"
- | "alwaysAllowUpdateTodoList"
- | "followupAutoApproveTimeoutMs"
- | "webviewDidLaunch"
- | "newTask"
- | "askResponse"
- | "terminalOperation"
- | "clearTask"
- | "didShowAnnouncement"
- | "selectImages"
- | "exportCurrentTask"
- | "shareCurrentTask"
- | "showTaskWithId"
- | "deleteTaskWithId"
- | "exportTaskWithId"
- | "importSettings"
- | "exportSettings"
- | "resetState"
- | "flushRouterModels"
- | "requestRouterModels"
- | "requestOpenAiModels"
- | "requestOllamaModels"
- | "requestLmStudioModels"
- | "requestVsCodeLmModels"
- | "requestHuggingFaceModels"
- | "openImage"
- | "saveImage"
- | "openFile"
- | "openMention"
- | "cancelTask"
- | "updateVSCodeSetting"
- | "getVSCodeSetting"
- | "vsCodeSetting"
- | "alwaysAllowBrowser"
- | "alwaysAllowMcp"
- | "alwaysAllowModeSwitch"
- | "allowedMaxRequests"
- | "allowedMaxCost"
- | "alwaysAllowSubtasks"
- | "alwaysAllowUpdateTodoList"
- | "autoCondenseContext"
- | "autoCondenseContextPercent"
- | "condensingApiConfigId"
- | "updateCondensingPrompt"
- | "playSound"
- | "playTts"
- | "stopTts"
- | "soundEnabled"
- | "ttsEnabled"
- | "ttsSpeed"
- | "soundVolume"
- | "diffEnabled"
- | "enableCheckpoints"
- | "browserViewportSize"
- | "screenshotQuality"
- | "remoteBrowserHost"
- | "openMcpSettings"
- | "openProjectMcpSettings"
- | "restartMcpServer"
- | "refreshAllMcpServers"
- | "toggleToolAlwaysAllow"
- | "toggleToolEnabledForPrompt"
- | "toggleMcpServer"
- | "updateMcpTimeout"
- | "fuzzyMatchThreshold"
- | "writeDelayMs"
- | "diagnosticsEnabled"
- | "enhancePrompt"
- | "enhancedPrompt"
- | "draggedImages"
- | "deleteMessage"
- | "deleteMessageConfirm"
- | "submitEditedMessage"
- | "editMessageConfirm"
- | "terminalOutputLineLimit"
- | "terminalOutputCharacterLimit"
- | "terminalShellIntegrationTimeout"
- | "terminalShellIntegrationDisabled"
- | "terminalCommandDelay"
- | "terminalPowershellCounter"
- | "terminalZshClearEolMark"
- | "terminalZshOhMy"
- | "terminalZshP10k"
- | "terminalZdotdir"
- | "terminalCompressProgressBar"
- | "mcpEnabled"
- | "enableMcpServerCreation"
- | "remoteControlEnabled"
- | "searchCommits"
- | "alwaysApproveResubmit"
- | "requestDelaySeconds"
- | "setApiConfigPassword"
- | "mode"
- | "updatePrompt"
- | "updateSupportPrompt"
- | "getSystemPrompt"
- | "copySystemPrompt"
- | "systemPrompt"
- | "enhancementApiConfigId"
- | "includeTaskHistoryInEnhance"
- | "updateExperimental"
- | "autoApprovalEnabled"
- | "updateCustomMode"
- | "deleteCustomMode"
- | "setopenAiCustomModelInfo"
- | "openCustomModesSettings"
- | "checkpointDiff"
- | "checkpointRestore"
- | "deleteMcpServer"
- | "maxOpenTabsContext"
- | "maxWorkspaceFiles"
- | "humanRelayResponse"
- | "humanRelayCancel"
- | "browserToolEnabled"
- | "codebaseIndexEnabled"
- | "telemetrySetting"
- | "showRooIgnoredFiles"
- | "testBrowserConnection"
- | "browserConnectionResult"
- | "remoteBrowserEnabled"
- | "language"
- | "maxReadFileLine"
- | "maxImageFileSize"
- | "maxTotalImageSize"
- | "maxConcurrentFileReads"
- | "includeDiagnosticMessages"
- | "maxDiagnosticMessages"
- | "searchFiles"
- | "toggleApiConfigPin"
- | "setHistoryPreviewCollapsed"
- | "hasOpenedModeSelector"
- | "accountButtonClicked"
- | "rooCloudSignIn"
- | "rooCloudSignOut"
- | "condenseTaskContextRequest"
- | "requestIndexingStatus"
- | "startIndexing"
- | "clearIndexData"
- | "indexingStatusUpdate"
- | "indexCleared"
- | "focusPanelRequest"
- | "profileThresholds"
- | "setHistoryPreviewCollapsed"
- | "openExternal"
- | "filterMarketplaceItems"
- | "marketplaceButtonClicked"
- | "installMarketplaceItem"
- | "installMarketplaceItemWithParameters"
- | "cancelMarketplaceInstall"
- | "removeInstalledMarketplaceItem"
- | "marketplaceInstallResult"
- | "fetchMarketplaceData"
- | "switchTab"
- | "profileThresholds"
- | "shareTaskSuccess"
- | "exportMode"
- | "exportModeResult"
- | "importMode"
- | "importModeResult"
- | "checkRulesDirectory"
- | "checkRulesDirectoryResult"
- | "saveCodeIndexSettingsAtomic"
- | "requestCodeIndexSecretStatus"
- | "requestCommands"
- | "openCommandFile"
- | "deleteCommand"
- | "createCommand"
- | "insertTextIntoTextarea"
- text?: string
- editedMessageContent?: string
- tab?: "settings" | "history" | "mcp" | "modes" | "chat" | "marketplace" | "account"
- disabled?: boolean
- context?: string
- dataUri?: string
- askResponse?: ClineAskResponse
- apiConfiguration?: ProviderSettings
- images?: string[]
- bool?: boolean
- value?: number
- commands?: string[]
- audioType?: AudioType
- serverName?: string
- toolName?: string
- alwaysAllow?: boolean
- isEnabled?: boolean
- mode?: Mode
- promptMode?: PromptMode
- customPrompt?: PromptComponent
- dataUrls?: string[]
- values?: Record<string, any>
- query?: string
- setting?: string
- slug?: string
- modeConfig?: ModeConfig
- timeout?: number
- payload?: WebViewMessagePayload
- source?: "global" | "project"
- requestId?: string
- ids?: string[]
- hasSystemPromptOverride?: boolean
- terminalOperation?: "continue" | "abort"
- messageTs?: number
- historyPreviewCollapsed?: boolean
- filters?: { type?: string; search?: string; tags?: string[] }
- url?: string // For openExternal
- mpItem?: MarketplaceItem
- mpInstallOptions?: InstallMarketplaceItemOptions
- config?: Record<string, any> // Add config to the payload
- visibility?: ShareVisibility // For share visibility
- hasContent?: boolean // For checkRulesDirectoryResult
- checkOnly?: boolean // For deleteCustomMode check
- codeIndexSettings?: {
- // Global state settings
- codebaseIndexEnabled: boolean
- codebaseIndexQdrantUrl: string
- codebaseIndexEmbedderProvider: "openai" | "ollama" | "openai-compatible" | "gemini" | "mistral"
- codebaseIndexEmbedderBaseUrl?: string
- codebaseIndexEmbedderModelId: string
- codebaseIndexEmbedderModelDimension?: number // Generic dimension for all providers
- codebaseIndexOpenAiCompatibleBaseUrl?: string
- codebaseIndexSearchMaxResults?: number
- codebaseIndexSearchMinScore?: number
- // Secret settings
- codeIndexOpenAiKey?: string
- codeIndexQdrantApiKey?: string
- codebaseIndexOpenAiCompatibleApiKey?: string
- codebaseIndexGeminiApiKey?: string
- codebaseIndexMistralApiKey?: string
- }
- }
- export const checkoutDiffPayloadSchema = z.object({
- ts: z.number(),
- previousCommitHash: z.string().optional(),
- commitHash: z.string(),
- mode: z.enum(["full", "checkpoint"]),
- })
- export type CheckpointDiffPayload = z.infer<typeof checkoutDiffPayloadSchema>
- export const checkoutRestorePayloadSchema = z.object({
- ts: z.number(),
- commitHash: z.string(),
- mode: z.enum(["preview", "restore"]),
- })
- export type CheckpointRestorePayload = z.infer<typeof checkoutRestorePayloadSchema>
- export interface IndexingStatusPayload {
- state: "Standby" | "Indexing" | "Indexed" | "Error"
- message: string
- }
- export interface IndexClearedPayload {
- success: boolean
- error?: string
- }
- export const installMarketplaceItemWithParametersPayloadSchema = z.object({
- item: marketplaceItemSchema,
- parameters: z.record(z.string(), z.any()),
- })
- export type InstallMarketplaceItemWithParametersPayload = z.infer<
- typeof installMarketplaceItemWithParametersPayloadSchema
- >
- export type WebViewMessagePayload =
- | CheckpointDiffPayload
- | CheckpointRestorePayload
- | IndexingStatusPayload
- | IndexClearedPayload
- | InstallMarketplaceItemWithParametersPayload
- | UpdateTodoListPayload
|