diff --git a/src/api/providers/anthropic.ts b/src/api/providers/anthropic.ts index 67e1425482..5e76d943e1 100644 --- a/src/api/providers/anthropic.ts +++ b/src/api/providers/anthropic.ts @@ -23,7 +23,7 @@ export class AnthropicHandler implements ApiHandler { let stream: AnthropicStream const modelId = model.id - let budget_tokens = this.options.thinkingBudgetTokens || 0 + const budget_tokens = this.options.thinkingBudgetTokens || 0 const reasoningOn = modelId.includes("3-7") && budget_tokens !== 0 ? true : false switch (modelId) { diff --git a/src/api/providers/bedrock.ts b/src/api/providers/bedrock.ts index f969d5fb57..cc316eefc2 100644 --- a/src/api/providers/bedrock.ts +++ b/src/api/providers/bedrock.ts @@ -25,7 +25,7 @@ export class AwsBedrockHandler implements ApiHandler { @withRetry() async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream { // cross region inference requires prefixing the model id with the region - let modelId = await this.getModelId() + const modelId = await this.getModelId() const model = this.getModel() // Check if this is an Amazon Nova model @@ -40,7 +40,7 @@ export class AwsBedrockHandler implements ApiHandler { return } - let budget_tokens = this.options.thinkingBudgetTokens || 0 + const budget_tokens = this.options.thinkingBudgetTokens || 0 const reasoningOn = modelId.includes("3-7") && budget_tokens !== 0 ? true : false // Get model info and message indices for caching @@ -250,7 +250,7 @@ export class AwsBedrockHandler implements ApiHandler { */ async getModelId(): Promise { if (this.options.awsUseCrossRegionInference) { - let regionPrefix = this.getRegion().slice(0, 3) + const regionPrefix = this.getRegion().slice(0, 3) switch (regionPrefix) { case "us-": return `us.${this.getModel().id}` diff --git a/src/api/providers/requesty.ts b/src/api/providers/requesty.ts index f252b89e69..8c10f7b61d 100644 --- a/src/api/providers/requesty.ts +++ b/src/api/providers/requesty.ts @@ -26,7 +26,7 @@ export class RequestyHandler implements ApiHandler { async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream { const modelId = this.options.requestyModelId ?? "" - let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [ + const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [ { role: "system", content: systemPrompt }, ...convertToOpenAiMessages(messages), ] diff --git a/src/api/transform/ollama-format.ts b/src/api/transform/ollama-format.ts index 4f6bde4f2d..85e723cd2c 100644 --- a/src/api/transform/ollama-format.ts +++ b/src/api/transform/ollama-format.ts @@ -28,7 +28,7 @@ export function convertToOllamaMessages(anthropicMessages: Anthropic.Messages.Me ) // Process tool result messages FIRST since they must follow the tool use messages - let toolResultImages: string[] = [] + const toolResultImages: string[] = [] toolMessages.forEach((toolMessage) => { // The Anthropic SDK allows tool results to be a string or an array of text and image blocks, enabling rich and structured content. In contrast, the Ollama SDK only supports tool results as a single string, so we map the Anthropic tool result parts into one concatenated string to maintain compatibility. let content: string diff --git a/src/api/transform/openai-format.ts b/src/api/transform/openai-format.ts index ddcffc8f76..1faf1c4194 100644 --- a/src/api/transform/openai-format.ts +++ b/src/api/transform/openai-format.ts @@ -38,7 +38,7 @@ export function convertToOpenAiMessages( ) // Process tool result messages FIRST since they must follow the tool use messages - let toolResultImages: Anthropic.Messages.ImageBlockParam[] = [] + const toolResultImages: Anthropic.Messages.ImageBlockParam[] = [] toolMessages.forEach((toolMessage) => { // The Anthropic SDK allows tool results to be a string or an array of text and image blocks, enabling rich and structured content. In contrast, the OpenAI SDK only supports tool results as a single string, so we map the Anthropic tool result parts into one concatenated string to maintain compatibility. let content: string @@ -127,7 +127,7 @@ export function convertToOpenAiMessages( } // Process tool use messages - let tool_calls: OpenAI.Chat.ChatCompletionMessageToolCall[] = toolMessages.map((toolMessage) => ({ + const tool_calls: OpenAI.Chat.ChatCompletionMessageToolCall[] = toolMessages.map((toolMessage) => ({ id: toolMessage.id, type: "function", function: { diff --git a/src/core/assistant-message/parse-assistant-message.ts b/src/core/assistant-message/parse-assistant-message.ts index 2c37a650b6..819a4bc3a9 100644 --- a/src/core/assistant-message/parse-assistant-message.ts +++ b/src/core/assistant-message/parse-assistant-message.ts @@ -1,7 +1,7 @@ import { AssistantMessageContent, TextContent, ToolUse, ToolParamName, toolParamNames, toolUseNames, ToolUseName } from "." export function parseAssistantMessage(assistantMessage: string) { - let contentBlocks: AssistantMessageContent[] = [] + const contentBlocks: AssistantMessageContent[] = [] let currentTextContent: TextContent | undefined = undefined let currentTextContentStartIndex = 0 let currentToolUse: ToolUse | undefined = undefined diff --git a/src/integrations/terminal/TerminalProcess.ts b/src/integrations/terminal/TerminalProcess.ts index 8c6c352a67..c0cf6e49b0 100644 --- a/src/integrations/terminal/TerminalProcess.ts +++ b/src/integrations/terminal/TerminalProcess.ts @@ -71,7 +71,7 @@ export class TerminalProcess extends EventEmitter { // remove ansi data = stripAnsi(data) // Split data by newlines - let lines = data ? data.split("\n") : [] + const lines = data ? data.split("\n") : [] // Remove non-human readable characters from the first line if (lines.length > 0) { lines[0] = lines[0].replace(/[^\x20-\x7E]/g, "") diff --git a/src/services/browser/BrowserSession.ts b/src/services/browser/BrowserSession.ts index 8400e561db..d7a5cb518a 100644 --- a/src/services/browser/BrowserSession.ts +++ b/src/services/browser/BrowserSession.ts @@ -212,7 +212,7 @@ export class BrowserSession { interval: 100, }).catch(() => {}) - let options: ScreenshotOptions = { + const options: ScreenshotOptions = { encoding: "base64", // clip: { diff --git a/src/services/glob/list-files.ts b/src/services/glob/list-files.ts index 19327c31a5..b6fd0007df 100644 --- a/src/services/glob/list-files.ts +++ b/src/services/glob/list-files.ts @@ -68,8 +68,8 @@ Breadth-first traversal of directory structure level by level up to a limit: - Timeout mechanism prevents infinite loops */ async function globbyLevelByLevel(limit: number, options?: Options) { - let results: Set = new Set() - let queue: string[] = ["*"] + const results: Set = new Set() + const queue: string[] = ["*"] const globbingProcess = async () => { while (queue.length > 0 && results.size < limit) { diff --git a/src/shared/combineApiRequests.ts b/src/shared/combineApiRequests.ts index 36f318babf..e017ec3435 100644 --- a/src/shared/combineApiRequests.ts +++ b/src/shared/combineApiRequests.ts @@ -23,13 +23,13 @@ export function combineApiRequests(messages: ClineMessage[]): ClineMessage[] { for (let i = 0; i < messages.length; i++) { if (messages[i].type === "say" && messages[i].say === "api_req_started") { - let startedRequest = JSON.parse(messages[i].text || "{}") + const startedRequest = JSON.parse(messages[i].text || "{}") let j = i + 1 while (j < messages.length) { if (messages[j].type === "say" && messages[j].say === "api_req_finished") { - let finishedRequest = JSON.parse(messages[j].text || "{}") - let combinedRequest = { + const finishedRequest = JSON.parse(messages[j].text || "{}") + const combinedRequest = { ...startedRequest, ...finishedRequest, } diff --git a/webview-ui/src/components/history/HistoryView.tsx b/webview-ui/src/components/history/HistoryView.tsx index 2ca0af4045..3b58abc8a5 100644 --- a/webview-ui/src/components/history/HistoryView.tsx +++ b/webview-ui/src/components/history/HistoryView.tsx @@ -85,7 +85,7 @@ const HistoryView = ({ onDone }: HistoryViewProps) => { }, [presentableTasks]) const taskHistorySearchResults = useMemo(() => { - let results = searchQuery ? highlight(fuse.search(searchQuery)) : presentableTasks + const results = searchQuery ? highlight(fuse.search(searchQuery)) : presentableTasks results.sort((a, b) => { switch (sortOption) { diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index 2e78471ee4..ab56ceaa8b 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -820,7 +820,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is checked={!!apiConfiguration?.openAiModelInfo?.supportsImages} onChange={(e: any) => { const isChecked = e.target.checked === true - let modelInfo = apiConfiguration?.openAiModelInfo + const modelInfo = apiConfiguration?.openAiModelInfo ? apiConfiguration.openAiModelInfo : { ...openAiModelInfoSaneDefaults } modelInfo.supportsImages = isChecked @@ -871,7 +871,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is } style={{ flex: 1 }} onInput={(input: any) => { - let modelInfo = apiConfiguration?.openAiModelInfo + const modelInfo = apiConfiguration?.openAiModelInfo ? apiConfiguration.openAiModelInfo : { ...openAiModelInfoSaneDefaults } modelInfo.contextWindow = Number(input.target.value) @@ -890,7 +890,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is } style={{ flex: 1 }} onInput={(input: any) => { - let modelInfo = apiConfiguration?.openAiModelInfo + const modelInfo = apiConfiguration?.openAiModelInfo ? apiConfiguration.openAiModelInfo : { ...openAiModelInfoSaneDefaults } modelInfo.maxTokens = input.target.value @@ -911,7 +911,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is } style={{ flex: 1 }} onInput={(input: any) => { - let modelInfo = apiConfiguration?.openAiModelInfo + const modelInfo = apiConfiguration?.openAiModelInfo ? apiConfiguration.openAiModelInfo : { ...openAiModelInfoSaneDefaults } modelInfo.inputPrice = input.target.value @@ -930,7 +930,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is } style={{ flex: 1 }} onInput={(input: any) => { - let modelInfo = apiConfiguration?.openAiModelInfo + const modelInfo = apiConfiguration?.openAiModelInfo ? apiConfiguration.openAiModelInfo : { ...openAiModelInfoSaneDefaults } modelInfo.outputPrice = input.target.value @@ -950,7 +950,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage, is : openAiModelInfoSaneDefaults.temperature?.toString() } onInput={(input: any) => { - let modelInfo = apiConfiguration?.openAiModelInfo + const modelInfo = apiConfiguration?.openAiModelInfo ? apiConfiguration.openAiModelInfo : { ...openAiModelInfoSaneDefaults } diff --git a/webview-ui/src/components/settings/OpenAiModelPicker.tsx b/webview-ui/src/components/settings/OpenAiModelPicker.tsx index 82bac0b7b4..2986d4b0ca 100644 --- a/webview-ui/src/components/settings/OpenAiModelPicker.tsx +++ b/webview-ui/src/components/settings/OpenAiModelPicker.tsx @@ -66,7 +66,7 @@ const OpenAiModelPicker: React.FC = () => { }, [searchableItems]) const modelSearchResults = useMemo(() => { - let results: { id: string; html: string }[] = searchTerm + const results: { id: string; html: string }[] = searchTerm ? highlight(fuse.search(searchTerm), "model-item-highlight") : searchableItems // results.sort((a, b) => a.id.localeCompare(b.id)) NOTE: sorting like this causes ids in objects to be reordered and mismatched diff --git a/webview-ui/src/components/settings/OpenRouterModelPicker.tsx b/webview-ui/src/components/settings/OpenRouterModelPicker.tsx index 89c6fd6582..5ae6ea7cd9 100644 --- a/webview-ui/src/components/settings/OpenRouterModelPicker.tsx +++ b/webview-ui/src/components/settings/OpenRouterModelPicker.tsx @@ -87,7 +87,7 @@ const OpenRouterModelPicker: React.FC = ({ isPopup } }, [searchableItems]) const modelSearchResults = useMemo(() => { - let results: { id: string; html: string }[] = searchTerm + const results: { id: string; html: string }[] = searchTerm ? highlight(fuse.search(searchTerm), "model-item-highlight") : searchableItems // results.sort((a, b) => a.id.localeCompare(b.id)) NOTE: sorting like this causes ids in objects to be reordered and mismatched