fix: Add missing types for Files Changed Overview feature

This commit is contained in:
Roo Code 2025-09-03 14:17:15 +00:00 committed by Hannes Rudolph
parent 4d90ad1d81
commit c467d53d09
2 changed files with 37 additions and 39 deletions

View file

@ -9,11 +9,10 @@ import type {
ClineMessage,
MarketplaceItem,
TodoItem,
ClineSay,
FileChangeset,
CloudUserInfo,
OrganizationAllowList,
ShareVisibility,
QueuedMessage,
} from "@roo-code/types"
import { GitCommit } from "../utils/git"
@ -59,12 +58,9 @@ export interface LanguageModelChatSelector {
id?: string
}
/**
* Message sent from the VS Code extension to the webview UI.
* The 'type' union below enumerates outbound notifications and data updates
* (e.g., "state", "theme", "indexingStatusUpdate", "filesChanged") that the
* webview consumes to render and synchronize state. See the full union below.
*/
// Represents JSON data that is sent from extension to webview, called
// ExtensionMessage and has 'type' enum which can be 'plusButtonClicked' or
// 'settingsButtonClicked' or 'hello'. Webview will hold state.
export interface ExtensionMessage {
type:
| "action"
@ -128,11 +124,9 @@ export interface ExtensionMessage {
| "commands"
| "insertTextIntoTextarea"
| "filesChanged"
| "checkpointCreated"
| "checkpointRestored"
| "say"
text?: string
payload?: any // Add a generic payload for now, can refine later
filesChanged?: any // Files changed data
action?:
| "chatButtonClicked"
| "mcpButtonClicked"
@ -205,10 +199,7 @@ export interface ExtensionMessage {
messageTs?: number
context?: string
commands?: Command[]
filesChanged?: FileChangeset // Added filesChanged property
checkpoint?: string // For checkpointCreated and checkpointRestored messages
previousCheckpoint?: string // For checkpoint_created message
say?: ClineSay // Added say property
queuedMessages?: QueuedMessage[]
}
export type ExtensionState = Pick<
@ -232,8 +223,10 @@ export type ExtensionState = Pick<
| "alwaysAllowMcp"
| "alwaysAllowModeSwitch"
| "alwaysAllowSubtasks"
| "alwaysAllowFollowupQuestions"
| "alwaysAllowExecute"
| "alwaysAllowUpdateTodoList"
| "followupAutoApproveTimeoutMs"
| "allowedCommands"
| "deniedCommands"
| "allowedMaxRequests"
@ -242,6 +235,7 @@ export type ExtensionState = Pick<
| "browserViewportSize"
| "screenshotQuality"
| "remoteBrowserEnabled"
| "cachedChromeHostUrl"
| "remoteBrowserHost"
// | "enableCheckpoints" // Optional in GlobalSettings, required here.
| "ttsEnabled"
@ -287,12 +281,14 @@ export type ExtensionState = Pick<
| "maxDiagnosticMessages"
| "remoteControlEnabled"
| "openRouterImageGenerationSelectedModel"
| "includeTaskHistoryInEnhance"
> & {
version: string
filesChangedEnabled: boolean
clineMessages: ClineMessage[]
currentTaskItem?: HistoryItem
currentTaskTodos?: TodoItem[] // Initial todos for the current task
apiConfiguration?: ProviderSettings
apiConfiguration: ProviderSettings
uriScheme?: string
shouldShowAnnouncement: boolean
@ -340,8 +336,14 @@ export type ExtensionState = Pick<
marketplaceInstalledMetadata?: { project: Record<string, any>; global: Record<string, any> }
profileThresholds: Record<string, number>
hasOpenedModeSelector: boolean
filesChangedEnabled: boolean
openRouterImageApiKey?: string
openRouterUseMiddleOutTransform?: boolean
messageQueue?: QueuedMessage[]
lastShownAnnouncementId?: string
apiModelId?: string
mcpServers?: McpServer[]
hasSystemPromptOverride?: boolean
mdmCompliant?: boolean
}
export interface ClineSayTool {

View file

@ -7,6 +7,7 @@ import {
type InstallMarketplaceItemOptions,
type MarketplaceItem,
type ShareVisibility,
type QueuedMessage,
marketplaceItemSchema,
} from "@roo-code/types"
@ -22,6 +23,8 @@ export interface UpdateTodoListPayload {
todos: any[]
}
export type EditQueuedMessagePayload = Pick<QueuedMessage, "id" | "text" | "images">
export interface WebviewMessage {
type:
| "updateTodoList"
@ -48,6 +51,12 @@ export interface WebviewMessage {
| "followupAutoApproveTimeoutMs"
| "webviewDidLaunch"
| "webviewReady"
| "filesChangedRequest"
| "viewDiff"
| "acceptFileChange"
| "rejectFileChange"
| "acceptAllFileChanges"
| "rejectAllFileChanges"
| "newTask"
| "askResponse"
| "terminalOperation"
@ -83,6 +92,7 @@ export interface WebviewMessage {
| "allowedMaxRequests"
| "allowedMaxCost"
| "alwaysAllowSubtasks"
| "alwaysAllowUpdateTodoList"
| "autoCondenseContext"
| "autoCondenseContextPercent"
| "condensingApiConfigId"
@ -185,6 +195,7 @@ export interface WebviewMessage {
| "indexCleared"
| "focusPanelRequest"
| "profileThresholds"
| "setHistoryPreviewCollapsed"
| "openExternal"
| "filterMarketplaceItems"
| "marketplaceButtonClicked"
@ -195,6 +206,7 @@ export interface WebviewMessage {
| "marketplaceInstallResult"
| "fetchMarketplaceData"
| "switchTab"
| "profileThresholds"
| "shareTaskSuccess"
| "exportMode"
| "exportModeResult"
@ -210,23 +222,20 @@ export interface WebviewMessage {
| "createCommand"
| "insertTextIntoTextarea"
| "showMdmAuthRequiredNotification"
| "viewDiff"
| "acceptFileChange"
| "rejectFileChange"
| "acceptAllFileChanges"
| "rejectAllFileChanges"
| "filesChangedEnabled"
| "filesChangedRequest"
| "filesChangedBaselineUpdate"
| "imageGenerationSettings"
| "openRouterImageApiKey"
| "openRouterImageGenerationSelectedModel"
| "queueMessage"
| "removeQueuedMessage"
| "editQueuedMessage"
text?: string
editedMessageContent?: string
tab?: "settings" | "history" | "mcp" | "modes" | "chat" | "marketplace" | "cloud"
disabled?: boolean
context?: string
dataUri?: string
uri?: string
uris?: string[]
askResponse?: ClineAskResponse
apiConfiguration?: ProviderSettings
images?: string[]
@ -291,17 +300,6 @@ export interface WebviewMessage {
codebaseIndexMistralApiKey?: string
codebaseIndexVercelAiGatewayApiKey?: string
}
command?: string // Added for new message types sent from webview
uri?: string // Added for file URIs in new message types
uris?: string[] // For rejectAllFileChanges to specify which files to reject
baseline?: string // For filesChangedBaselineUpdate message
fileChanges?: Array<{ uri: string; type: string }> // For filesChangedRequest message
}
export interface Terminal {
pid: number
name: string
cwd: string
}
export const checkoutDiffPayloadSchema = z.object({
@ -347,6 +345,4 @@ export type WebViewMessagePayload =
| IndexClearedPayload
| InstallMarketplaceItemWithParametersPayload
| UpdateTodoListPayload
// Alias for consistent naming (prefer 'Webview' spelling in new code)
export type WebviewMessagePayload = WebViewMessagePayload
| EditQueuedMessagePayload