merge
This commit is contained in:
commit
2a5c74009c
1045 files changed
+107194
-22024
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import { Empty, EmptyRequest } from "@shared/proto/cline/common"
|
||||
import { Controller } from ".."
|
||||
|
||||
export async function cancelBackgroundCommand(controller: Controller, _request: EmptyRequest): Promise<Empty> {
|
||||
const controllerWithCancel = controller as Controller & {
|
||||
cancelBackgroundCommand: () => Promise<void>
|
||||
}
|
||||
await controllerWithCancel.cancelBackgroundCommand()
|
||||
return Empty.create()
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export async function deleteAllTaskHistory(controller: Controller): Promise<Dele
|
||||
|
||||
// Delete non-favorited task directories
|
||||
const preserveTaskIds = favoritedTasks.map((task) => task.id)
|
||||
await cleanupTaskFiles(controller, preserveTaskIds)
|
||||
await cleanupTaskFiles(preserveTaskIds)
|
||||
|
||||
// Update webview
|
||||
try {
|
||||
@@ -91,13 +91,13 @@ export async function deleteAllTaskHistory(controller: Controller): Promise<Dele
|
||||
|
||||
try {
|
||||
// Remove all contents of tasks directory
|
||||
const taskDirPath = path.join(controller.context.globalStorageUri.fsPath, "tasks")
|
||||
const taskDirPath = path.join(HostProvider.get().globalStorageFsPath, "tasks")
|
||||
if (await fileExistsAtPath(taskDirPath)) {
|
||||
await fs.rm(taskDirPath, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
// Remove checkpoints directory contents
|
||||
const checkpointsDirPath = path.join(controller.context.globalStorageUri.fsPath, "checkpoints")
|
||||
const checkpointsDirPath = path.join(HostProvider.get().globalStorageFsPath, "checkpoints")
|
||||
if (await fileExistsAtPath(checkpointsDirPath)) {
|
||||
await fs.rm(checkpointsDirPath, { recursive: true, force: true })
|
||||
}
|
||||
@@ -127,8 +127,8 @@ export async function deleteAllTaskHistory(controller: Controller): Promise<Dele
|
||||
/**
|
||||
* Helper function to cleanup task files while preserving specified tasks
|
||||
*/
|
||||
async function cleanupTaskFiles(controller: Controller, preserveTaskIds: string[]) {
|
||||
const taskDirPath = path.join(controller.context.globalStorageUri.fsPath, "tasks")
|
||||
async function cleanupTaskFiles(preserveTaskIds: string[]) {
|
||||
const taskDirPath = path.join(HostProvider.get().globalStorageFsPath, "tasks")
|
||||
|
||||
try {
|
||||
if (await fileExistsAtPath(taskDirPath)) {
|
||||
|
||||
@@ -47,8 +47,6 @@ export async function deleteTasksWithIds(controller: Controller, request: String
|
||||
* @param id The task ID to delete
|
||||
*/
|
||||
async function deleteTaskWithId(controller: Controller, id: string): Promise<void> {
|
||||
console.info("deleteTaskWithId: ", id)
|
||||
|
||||
try {
|
||||
// Clear current task if it matches the ID being deleted
|
||||
if (id === controller.task?.taskId) {
|
||||
@@ -82,8 +80,8 @@ async function deleteTaskWithId(controller: Controller, id: string): Promise<voi
|
||||
|
||||
// If no tasks remain, clean up everything
|
||||
if (updatedTaskHistory.length === 0) {
|
||||
const taskDirPath = path.join(controller.context.globalStorageUri.fsPath, "tasks")
|
||||
const checkpointsDirPath = path.join(controller.context.globalStorageUri.fsPath, "checkpoints")
|
||||
const taskDirPath = path.join(HostProvider.get().globalStorageFsPath, "tasks")
|
||||
const checkpointsDirPath = path.join(HostProvider.get().globalStorageFsPath, "checkpoints")
|
||||
|
||||
if (await fileExistsAtPath(taskDirPath)) {
|
||||
await fs.rm(taskDirPath, { recursive: true, force: true })
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Controller } from ".."
|
||||
* @param _request The empty request
|
||||
* @returns The total size as an Int64 value
|
||||
*/
|
||||
export async function getTotalTasksSize(controller: Controller, _request: EmptyRequest): Promise<Int64> {
|
||||
const totalSize = await calculateTotalTasksSize(controller.context.globalStorageUri.fsPath)
|
||||
return Int64.create({ value: totalSize || 0 })
|
||||
export async function getTotalTasksSize(_controller: Controller, _request: EmptyRequest): Promise<Int64> {
|
||||
const totalSize = await calculateTotalTasksSize()
|
||||
return { value: totalSize || 0 }
|
||||
}
|
||||
@@ -1,14 +1,88 @@
|
||||
import { Empty } from "@shared/proto/cline/common"
|
||||
import { String } from "@shared/proto/cline/common"
|
||||
import { PlanActMode, OpenaiReasoningEffort as ProtoOpenaiReasoningEffort } from "@shared/proto/cline/state"
|
||||
import { NewTaskRequest } from "@shared/proto/cline/task"
|
||||
import { Settings } from "@shared/storage/state-keys"
|
||||
import { convertProtoToApiProvider } from "@/shared/proto-conversions/models/api-configuration-conversion"
|
||||
import { DEFAULT_BROWSER_SETTINGS } from "../../../shared/BrowserSettings"
|
||||
import { Controller } from ".."
|
||||
|
||||
/**
|
||||
* Creates a new task with the given text and optional images
|
||||
* @param controller The controller instance
|
||||
* @param request The new task request containing text and optional images
|
||||
* @param request The new task request containing text and optional images, and optional task settings
|
||||
* @returns Empty response
|
||||
*/
|
||||
export async function newTask(controller: Controller, request: NewTaskRequest): Promise<Empty> {
|
||||
await controller.initTask(request.text, request.images, request.files)
|
||||
return Empty.create()
|
||||
export async function newTask(controller: Controller, request: NewTaskRequest): Promise<String> {
|
||||
const convertOpenaiReasoningEffort = (effort: ProtoOpenaiReasoningEffort): string => {
|
||||
switch (effort) {
|
||||
case ProtoOpenaiReasoningEffort.LOW:
|
||||
return "low"
|
||||
case ProtoOpenaiReasoningEffort.MEDIUM:
|
||||
return "medium"
|
||||
case ProtoOpenaiReasoningEffort.HIGH:
|
||||
return "high"
|
||||
case ProtoOpenaiReasoningEffort.MINIMAL:
|
||||
return "minimal"
|
||||
default:
|
||||
return "medium"
|
||||
}
|
||||
}
|
||||
|
||||
const convertPlanActMode = (mode: PlanActMode): string => {
|
||||
return mode === PlanActMode.PLAN ? "plan" : "act"
|
||||
}
|
||||
|
||||
const filteredTaskSettings: Partial<Settings> = Object.fromEntries(
|
||||
Object.entries({
|
||||
...request.taskSettings,
|
||||
...(request.taskSettings?.autoApprovalSettings && {
|
||||
autoApprovalSettings: (() => {
|
||||
// Merge with global settings to ensure complete settings for new task
|
||||
const globalSettings = controller.stateManager.getGlobalSettingsKey("autoApprovalSettings")
|
||||
const incomingSettings = request.taskSettings.autoApprovalSettings
|
||||
return {
|
||||
...globalSettings,
|
||||
...(incomingSettings.version !== undefined && { version: incomingSettings.version }),
|
||||
...(incomingSettings.enableNotifications !== undefined && {
|
||||
enableNotifications: incomingSettings.enableNotifications,
|
||||
}),
|
||||
actions: {
|
||||
...globalSettings.actions,
|
||||
...(incomingSettings.actions
|
||||
? Object.fromEntries(Object.entries(incomingSettings.actions).filter(([_, v]) => v !== undefined))
|
||||
: {}),
|
||||
},
|
||||
}
|
||||
})(),
|
||||
}),
|
||||
...(request.taskSettings?.browserSettings && {
|
||||
browserSettings: {
|
||||
viewport: request.taskSettings.browserSettings.viewport || DEFAULT_BROWSER_SETTINGS.viewport,
|
||||
remoteBrowserHost: request.taskSettings.browserSettings.remoteBrowserHost,
|
||||
remoteBrowserEnabled: request.taskSettings.browserSettings.remoteBrowserEnabled,
|
||||
chromeExecutablePath: request.taskSettings.browserSettings.chromeExecutablePath,
|
||||
disableToolUse: request.taskSettings.browserSettings.disableToolUse,
|
||||
customArgs: request.taskSettings.browserSettings.customArgs,
|
||||
},
|
||||
}),
|
||||
...(request.taskSettings?.openaiReasoningEffort !== undefined && {
|
||||
openaiReasoningEffort: convertOpenaiReasoningEffort(request.taskSettings.openaiReasoningEffort),
|
||||
}),
|
||||
...(request.taskSettings?.mode !== undefined && {
|
||||
mode: convertPlanActMode(request.taskSettings.mode),
|
||||
}),
|
||||
...(request.taskSettings?.customPrompt === "compact" && {
|
||||
customPrompt: "compact",
|
||||
}),
|
||||
...(request.taskSettings?.planModeApiProvider !== undefined && {
|
||||
planModeApiProvider: convertProtoToApiProvider(request.taskSettings.planModeApiProvider),
|
||||
}),
|
||||
...(request.taskSettings?.actModeApiProvider !== undefined && {
|
||||
actModeApiProvider: convertProtoToApiProvider(request.taskSettings.actModeApiProvider),
|
||||
}),
|
||||
}).filter(([_, value]) => value !== undefined),
|
||||
)
|
||||
|
||||
const taskId = await controller.initTask(request.text, request.images, request.files, undefined, filteredTaskSettings)
|
||||
return String.create({ value: taskId || "" })
|
||||
}
|
||||
@@ -23,7 +23,7 @@ export async function showTaskWithId(controller: Controller, request: StringRequ
|
||||
await controller.initTask(undefined, undefined, undefined, historyItem)
|
||||
|
||||
// Send UI update to show the chat view
|
||||
await sendChatButtonClickedEvent(controller.id)
|
||||
await sendChatButtonClickedEvent()
|
||||
|
||||
// Return task data for gRPC response
|
||||
return TaskResponse.create({
|
||||
@@ -47,7 +47,7 @@ export async function showTaskWithId(controller: Controller, request: StringRequ
|
||||
await controller.initTask(undefined, undefined, undefined, fetchedItem)
|
||||
|
||||
// Send UI update to show the chat view
|
||||
await sendChatButtonClickedEvent(controller.id)
|
||||
await sendChatButtonClickedEvent()
|
||||
|
||||
return TaskResponse.create({
|
||||
id: fetchedItem.id,
|
||||
|
||||
@@ -10,7 +10,8 @@ import { Controller } from ".."
|
||||
export async function taskCompletionViewChanges(controller: Controller, request: Int64Request): Promise<Empty> {
|
||||
try {
|
||||
if (request.value && controller.task) {
|
||||
await controller.task.checkpointManager?.presentMultifileDiff(request.value, true)
|
||||
// presentMultifileDiff is optional on ICheckpointManager, so capture then optionally invoke
|
||||
await controller.task.checkpointManager?.presentMultifileDiff?.(request.value, true)
|
||||
}
|
||||
return Empty.create()
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user