mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
* feat read file range feat: add file truncation with code structure preview Add configurable line limit for large file handling with source code structure preview. This improves performance and memory usage while maintaining code readability. Key changes: Add maxReadFileLine setting (default: 4500) with UI controls Create efficient line counter utility using streams Add parseSourceCodeDefinitionsForFile for single file parsing Show truncation notice with code structure for large files Add comprehensive tests for new functionality Move file extensions to shared constant add line number pr comment Return definition ranges from tree-sitter make treesitter always add line add line number to rg search enhance tree siter output & fix test update snapshot fix test * Add translations, tweak range --------- Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
163 lines
3.9 KiB
TypeScript
163 lines
3.9 KiB
TypeScript
import { z } from "zod"
|
|
import { ApiConfiguration, ApiProvider } from "./api"
|
|
import { Mode, PromptComponent, ModeConfig } from "./modes"
|
|
|
|
export type ClineAskResponse = "yesButtonClicked" | "noButtonClicked" | "messageResponse"
|
|
|
|
export type PromptMode = Mode | "enhance"
|
|
|
|
export type AudioType = "notification" | "celebration" | "progress_loop"
|
|
|
|
export interface WebviewMessage {
|
|
type:
|
|
| "apiConfiguration"
|
|
| "deleteMultipleTasksWithIds"
|
|
| "currentApiConfigName"
|
|
| "saveApiConfiguration"
|
|
| "upsertApiConfiguration"
|
|
| "deleteApiConfiguration"
|
|
| "loadApiConfiguration"
|
|
| "renameApiConfiguration"
|
|
| "getListApiConfiguration"
|
|
| "customInstructions"
|
|
| "allowedCommands"
|
|
| "alwaysAllowReadOnly"
|
|
| "alwaysAllowWrite"
|
|
| "alwaysAllowExecute"
|
|
| "webviewDidLaunch"
|
|
| "newTask"
|
|
| "askResponse"
|
|
| "clearTask"
|
|
| "didShowAnnouncement"
|
|
| "selectImages"
|
|
| "exportCurrentTask"
|
|
| "showTaskWithId"
|
|
| "deleteTaskWithId"
|
|
| "exportTaskWithId"
|
|
| "resetState"
|
|
| "requestOllamaModels"
|
|
| "requestLmStudioModels"
|
|
| "openImage"
|
|
| "openFile"
|
|
| "openMention"
|
|
| "cancelTask"
|
|
| "refreshOpenRouterModels"
|
|
| "refreshGlamaModels"
|
|
| "refreshUnboundModels"
|
|
| "refreshRequestyModels"
|
|
| "refreshOpenAiModels"
|
|
| "alwaysAllowBrowser"
|
|
| "alwaysAllowMcp"
|
|
| "alwaysAllowModeSwitch"
|
|
| "alwaysAllowSubtasks"
|
|
| "playSound"
|
|
| "playTts"
|
|
| "stopTts"
|
|
| "soundEnabled"
|
|
| "ttsEnabled"
|
|
| "ttsSpeed"
|
|
| "soundVolume"
|
|
| "diffEnabled"
|
|
| "enableCheckpoints"
|
|
| "checkpointStorage"
|
|
| "browserViewportSize"
|
|
| "screenshotQuality"
|
|
| "remoteBrowserHost"
|
|
| "openMcpSettings"
|
|
| "restartMcpServer"
|
|
| "toggleToolAlwaysAllow"
|
|
| "toggleMcpServer"
|
|
| "updateMcpTimeout"
|
|
| "fuzzyMatchThreshold"
|
|
| "writeDelayMs"
|
|
| "enhancePrompt"
|
|
| "enhancedPrompt"
|
|
| "draggedImages"
|
|
| "deleteMessage"
|
|
| "terminalOutputLineLimit"
|
|
| "terminalShellIntegrationTimeout"
|
|
| "mcpEnabled"
|
|
| "enableMcpServerCreation"
|
|
| "enableCustomModeCreation"
|
|
| "searchCommits"
|
|
| "alwaysApproveResubmit"
|
|
| "requestDelaySeconds"
|
|
| "rateLimitSeconds"
|
|
| "setApiConfigPassword"
|
|
| "requestVsCodeLmModels"
|
|
| "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"
|
|
| "discoverBrowser"
|
|
| "browserConnectionResult"
|
|
| "remoteBrowserEnabled"
|
|
| "language"
|
|
| "maxReadFileLine"
|
|
| "searchFiles"
|
|
text?: string
|
|
disabled?: boolean
|
|
askResponse?: ClineAskResponse
|
|
apiConfiguration?: ApiConfiguration
|
|
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
|
|
slug?: string
|
|
modeConfig?: ModeConfig
|
|
timeout?: number
|
|
payload?: WebViewMessagePayload
|
|
source?: "global" | "project"
|
|
requestId?: string
|
|
ids?: 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 type WebViewMessagePayload = CheckpointDiffPayload | CheckpointRestorePayload
|