Cleanup: Remove unused params from the ToolExecutor constructor. (#4588)

Organize imports.
This commit is contained in:
Sarah Fortune authored and GitHub committed 2025-06-30 18:55:19 -07:00
1 parent c013b4f329
commit 559eba5dd1
2 files changed
+35 -47

No files matched your search

+35 -43
View File
@@ -1,17 +1,23 @@
import * as vscode from "vscode"
import { TaskState } from "./TaskState"
import { MessageStateHandler } from "./message-state"
import { showSystemNotification } from "@/integrations/notifications"
import { listFiles } from "@/services/glob/list-files"
import { telemetryService } from "@/services/posthog/telemetry/TelemetryService"
import { regexSearchFiles } from "@/services/ripgrep"
import { parseSourceCodeForDefinitionsTopLevel } from "@/services/tree-sitter"
import { findLast, findLastIndex, parsePartialArrayString } from "@/shared/array"
import { createAndOpenGitHubIssue } from "@/utils/github-url-utils"
import { getReadablePath, isLocatedInWorkspace } from "@/utils/path"
import Anthropic from "@anthropic-ai/sdk"
import { ApiHandler } from "@api/index"
import { TerminalManager } from "@integrations/terminal/TerminalManager"
import { BrowserSession } from "@services/browser/BrowserSession"
import { DiffViewProvider } from "@integrations/editor/DiffViewProvider"
import { McpHub } from "@services/mcp/McpHub"
import { FileContextTracker } from "@core/context/context-tracking/FileContextTracker"
import { ClineIgnoreController } from "@core/ignore/ClineIgnoreController"
import { DiffViewProvider } from "@integrations/editor/DiffViewProvider"
import { extractTextFromFile, processFilesIntoText } from "@integrations/misc/extract-text"
import WorkspaceTracker from "@integrations/workspace/WorkspaceTracker"
import { BrowserSession } from "@services/browser/BrowserSession"
import { UrlContentFetcher } from "@services/browser/UrlContentFetcher"
import { McpHub } from "@services/mcp/McpHub"
import { AutoApprovalSettings } from "@shared/AutoApprovalSettings"
import { ChatSettings } from "@shared/ChatSettings"
import { ToolParamName, ToolUse, ToolUseName } from "../assistant-message"
import { AutoApprove } from "./tools/autoApprove"
import { BrowserSettings } from "@shared/BrowserSettings"
import {
BrowserAction,
BrowserActionResult,
@@ -25,37 +31,29 @@ import {
ClineSayTool,
COMPLETION_RESULT_CHANGES_FLAG,
} from "@shared/ExtensionMessage"
import WorkspaceTracker from "@integrations/workspace/WorkspaceTracker"
import { BrowserSettings } from "@shared/BrowserSettings"
import { ClineAskResponse } from "@shared/WebviewMessage"
import { fixModelHtmlEscaping, removeInvalidChars } from "@utils/string"
import { fileExistsAtPath } from "@utils/fs"
import { formatResponse } from "../prompts/responses"
import { isClaude4ModelFamily, isGemini2dot5ModelFamily } from "@utils/model-utils"
import { ToolResponse, USE_EXPERIMENTAL_CLAUDE4_FEATURES } from "."
import { serializeError } from "serialize-error"
import * as path from "path"
import { extractTextFromFile, processFilesIntoText } from "@integrations/misc/extract-text"
import { COMMAND_REQ_APP_STRING } from "@shared/combineCommandSequences"
import { UrlContentFetcher } from "@services/browser/UrlContentFetcher"
import { constructNewFileContent } from "../assistant-message/diff"
import { getReadablePath, isLocatedInWorkspace } from "@/utils/path"
import { listFiles } from "@/services/glob/list-files"
import { showNotificationForApprovalIfAutoApprovalEnabled } from "./utils"
import { parseSourceCodeForDefinitionsTopLevel } from "@/services/tree-sitter"
import { regexSearchFiles } from "@/services/ripgrep"
import { showSystemNotification } from "@/integrations/notifications"
import { findLast, findLastIndex, parsePartialArrayString } from "@/shared/array"
import { ensureTaskDirectoryExists } from "../storage/disk"
import { telemetryService } from "@/services/posthog/telemetry/TelemetryService"
import { loadMcpDocumentation } from "../prompts/loadMcpDocumentation"
import Anthropic from "@anthropic-ai/sdk"
import { createAndOpenGitHubIssue } from "@/utils/github-url-utils"
import { getWorkspaceState } from "../storage/state"
import os from "os"
import { ContextManager } from "../context/context-management/ContextManager"
import { fileExistsAtPath } from "@utils/fs"
import { isClaude4ModelFamily, isGemini2dot5ModelFamily } from "@utils/model-utils"
import { fixModelHtmlEscaping, removeInvalidChars } from "@utils/string"
import { setTimeout as setTimeoutPromise } from "node:timers/promises"
import os from "os"
import * as path from "path"
import { serializeError } from "serialize-error"
import * as vscode from "vscode"
import { ToolResponse, USE_EXPERIMENTAL_CLAUDE4_FEATURES } from "."
import { ToolParamName, ToolUse, ToolUseName } from "../assistant-message"
import { constructNewFileContent } from "../assistant-message/diff"
import { ChangeLocation, StreamingJsonReplacer } from "../assistant-message/diff-json"
import { ContextManager } from "../context/context-management/ContextManager"
import { loadMcpDocumentation } from "../prompts/loadMcpDocumentation"
import { formatResponse } from "../prompts/responses"
import { ensureTaskDirectoryExists } from "../storage/disk"
import { getWorkspaceState } from "../storage/state"
import { TaskState } from "./TaskState"
import { MessageStateHandler } from "./message-state"
import { AutoApprove } from "./tools/autoApprove"
import { showNotificationForApprovalIfAutoApprovalEnabled } from "./utils"
export class ToolExecutor {
private autoApprover: AutoApprove
@@ -75,7 +73,6 @@ export class ToolExecutor {
private taskState: TaskState,
private messageStateHandler: MessageStateHandler,
private api: ApiHandler,
private terminalManager: TerminalManager,
private urlContentFetcher: UrlContentFetcher,
private browserSession: BrowserSession,
private diffViewProvider: DiffViewProvider,
@@ -88,7 +85,6 @@ export class ToolExecutor {
// Configuration & Settings
private autoApprovalSettings: AutoApprovalSettings,
private browserSettings: BrowserSettings,
private chatSettings: ChatSettings,
private cwd: string,
private taskId: string,
@@ -106,8 +102,6 @@ export class ToolExecutor {
partial?: boolean,
) => Promise<{ response: ClineAskResponse; text?: string; images?: string[]; files?: string[] }>,
private saveCheckpoint: (isAttemptCompletionMessage?: boolean) => Promise<void>,
private reinitExistingTaskFromId: (taskId: string) => Promise<void>,
private cancelTask: () => Promise<void>,
private sayAndCreateMissingParamError: (toolName: ToolUseName, paramName: string, relPath?: string) => Promise<any>,
private removeLastPartialMessageIfExistsWithType: (type: "ask" | "say", askOrSay: ClineAsk | ClineSay) => Promise<void>,
private executeCommandTool: (command: string) => Promise<[boolean, any]>,
@@ -336,8 +330,6 @@ export class ToolExecutor {
// Handle write error
return { shouldBreak: true, error: `Write error: ${e}` }
}
const newContentParsed = this.taskState.streamingJsonReplacer.getSuccessfullyParsedItems()
}
return { shouldBreak: true } // Wait for more chunks
-4
View File
@@ -279,7 +279,6 @@ export class Task {
this.taskState,
this.messageStateHandler,
this.api,
this.terminalManager,
this.urlContentFetcher,
this.browserSession,
this.diffViewProvider,
@@ -290,14 +289,11 @@ export class Task {
this.contextManager,
this.autoApprovalSettings,
this.browserSettings,
this.chatSettings,
cwd,
this.taskId,
this.say.bind(this),
this.ask.bind(this),
this.saveCheckpoint.bind(this),
this.reinitExistingTaskFromId.bind(this),
this.cancelTask.bind(this),
this.sayAndCreateMissingParamError.bind(this),
this.removeLastPartialMessageIfExistsWithType.bind(this),
this.executeCommandTool.bind(this),