Roo-Code/src/shared/WebviewMessage.ts
Canyon Robins 4804e3b3b9
[Condense] Move condense settings out of experimental and defualt enable (#4088)
* [Condense] Move condense settings out of experimental and defualt enable

* tests

* wip

* Update translations

* fixes

* more tests

* changeset

* wip

* update translations

* fix more translations
2025-05-28 17:05:39 -07:00

208 lines
5 KiB
TypeScript

import { z } from "zod"
import type { ProviderSettings, PromptComponent, ModeConfig } from "@roo-code/types"
import { Mode } from "./modes"
export type ClineAskResponse = "yesButtonClicked" | "noButtonClicked" | "messageResponse"
export type PromptMode = Mode | "enhance"
export type AudioType = "notification" | "celebration" | "progress_loop"
export interface WebviewMessage {
type:
| "deleteMultipleTasksWithIds"
| "currentApiConfigName"
| "saveApiConfiguration"
| "upsertApiConfiguration"
| "deleteApiConfiguration"
| "loadApiConfiguration"
| "loadApiConfigurationById"
| "renameApiConfiguration"
| "getListApiConfiguration"
| "customInstructions"
| "allowedCommands"
| "alwaysAllowReadOnly"
| "alwaysAllowReadOnlyOutsideWorkspace"
| "alwaysAllowWrite"
| "alwaysAllowWriteOutsideWorkspace"
| "alwaysAllowExecute"
| "webviewDidLaunch"
| "newTask"
| "askResponse"
| "terminalOperation"
| "clearTask"
| "didShowAnnouncement"
| "selectImages"
| "exportCurrentTask"
| "showTaskWithId"
| "deleteTaskWithId"
| "exportTaskWithId"
| "importSettings"
| "exportSettings"
| "resetState"
| "flushRouterModels"
| "requestRouterModels"
| "requestOpenAiModels"
| "requestOllamaModels"
| "requestLmStudioModels"
| "requestVsCodeLmModels"
| "openImage"
| "openFile"
| "openMention"
| "cancelTask"
| "updateVSCodeSetting"
| "getVSCodeSetting"
| "vsCodeSetting"
| "alwaysAllowBrowser"
| "alwaysAllowMcp"
| "alwaysAllowModeSwitch"
| "allowedMaxRequests"
| "alwaysAllowSubtasks"
| "autoCondenseContext"
| "autoCondenseContextPercent"
| "condensingApiConfigId"
| "updateCondensingPrompt"
| "playSound"
| "playTts"
| "stopTts"
| "soundEnabled"
| "ttsEnabled"
| "ttsSpeed"
| "soundVolume"
| "diffEnabled"
| "enableCheckpoints"
| "browserViewportSize"
| "screenshotQuality"
| "remoteBrowserHost"
| "openMcpSettings"
| "openProjectMcpSettings"
| "restartMcpServer"
| "toggleToolAlwaysAllow"
| "toggleMcpServer"
| "updateMcpTimeout"
| "fuzzyMatchThreshold"
| "writeDelayMs"
| "enhancePrompt"
| "enhancedPrompt"
| "draggedImages"
| "deleteMessage"
| "terminalOutputLineLimit"
| "terminalShellIntegrationTimeout"
| "terminalShellIntegrationDisabled"
| "terminalCommandDelay"
| "terminalPowershellCounter"
| "terminalZshClearEolMark"
| "terminalZshOhMy"
| "terminalZshP10k"
| "terminalZdotdir"
| "terminalCompressProgressBar"
| "mcpEnabled"
| "enableMcpServerCreation"
| "searchCommits"
| "alwaysApproveResubmit"
| "requestDelaySeconds"
| "setApiConfigPassword"
| "mode"
| "updatePrompt"
| "updateSupportPrompt"
| "resetSupportPrompt"
| "getSystemPrompt"
| "copySystemPrompt"
| "systemPrompt"
| "enhancementApiConfigId"
| "updateExperimental"
| "autoApprovalEnabled"
| "updateCustomMode"
| "deleteCustomMode"
| "setopenAiCustomModelInfo"
| "openCustomModesSettings"
| "checkpointDiff"
| "checkpointRestore"
| "deleteMcpServer"
| "maxOpenTabsContext"
| "maxWorkspaceFiles"
| "humanRelayResponse"
| "humanRelayCancel"
| "browserToolEnabled"
| "telemetrySetting"
| "showRooIgnoredFiles"
| "testBrowserConnection"
| "browserConnectionResult"
| "remoteBrowserEnabled"
| "language"
| "maxReadFileLine"
| "searchFiles"
| "toggleApiConfigPin"
| "setHistoryPreviewCollapsed"
| "condenseTaskContextRequest"
| "requestIndexingStatus"
| "startIndexing"
| "clearIndexData"
| "indexingStatusUpdate"
| "indexCleared"
| "codebaseIndexConfig"
text?: string
disabled?: boolean
askResponse?: ClineAskResponse
apiConfiguration?: ProviderSettings
images?: string[]
bool?: boolean
value?: number
commands?: string[]
audioType?: AudioType
serverName?: string
toolName?: string
alwaysAllow?: 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"
historyPreviewCollapsed?: boolean
}
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 type WebViewMessagePayload =
| CheckpointDiffPayload
| CheckpointRestorePayload
| IndexingStatusPayload
| IndexClearedPayload